Code Modules • Codec • Bluetooth Module • Rotary Encoder • Menu State Machine
Codec Interface • Uses the DCI module for communication • Interrupt based • Uses 4 interrupts per 16 frame packet • Each interrupt simultaneously transmits and stores 4 frames
Bluetooth Module • Uses Asynchronous serial at 9600 bps for communication • Microcontroller uses internal Uart module • Is interrupt based • Uses a 100 character circular buffer for transmit and a 30 char static buffer for receive
Rotary Encoder • Is polling based • Polled during each iteration of the main loop • Controlled with a small state machine to determine the number of change in increments, direction, and pushbutton.
Menu State Machine • Main loop is running a state machine that controls the current state and function of the unit • The state machine takes input from the rotary encoder and displays the current operating mode and relevant information on the lcd screen. • Each state has a function call and arguments associated with it.
Hierarchical Block Diagram Audio Input Codec AC’97 String Frequency Detect DCI DFFT PWM Signal PORTD RPM Decoder Motor Controller PWM Module 6 RPG Input LCD Output Menu Control State Machine Tx Buffer LCD Controller PORTA Bluetooth Adapter Uart Input Parser
Main State Machine Start Setup State Machine Init PLL Run State Function Get RPG Input Init Uart Init LCD Change State? No Init RPG Yes Init DCI Change to new state Init PWM Update state Variable
Tuning Algorithm Start String Tune Acquire Sound Data Calculate Required String Movements Start up DCI Module Data Full? If Desired accuracy reached Detect Strum Move Strings No Run DFFT If strum Detected No Yes Yes String Freq Detection Tuning Finished