Audio-Tone Generation Using a Lookup Table With MPLAB® Harmony v3: Step 10

Last modified by Microchip on 2023/11/09 09:07

Debug Your New Application

Congratulations! I assure you, the hard part is over! You can now build, program, and debug Debug Project Icon your first application!

Before you start the debugger, set a breakpoint in the application file in app_tone_lookup_table.c. Through this breakpoint, you can observe that the tone lookup table task is successfully able to open the codec driver.

Breakpoint set in the application file

Debug your first application. Click the Debug Main Project icon. Debug Project Icon

Single-step (by pressing the F7 key) through the application state machine to see how each state is executed.

Put a breakpoint in the buffer event handler. Hitting the breakpoint in the event handler indicates that the last submitted buffer is transferred to the codec.

Breakpoint set in the buffer event handler

Remove all breakpoints, press the F5 key and allow the application to run.

Connect a headphone to the HP Out connector on the Multimedia Expansion Board II and you should hear a tone.

You are now an MPLAB® Harmony developer!

Feel free to debug and step through the code to see how it works. As you continue stepping through the project, you will eventually arrive back at the super loop in the main function. Fundamentally, this is how polled state machines execute within an MPLAB Harmony system.

Time permitting: explore the audio_player_lab1 project files and folders. Observe that the project consists of several “logical” folders within MPLAB X IDE and several physical folders on the disk. This organization is used consistently by MPLAB Harmony applications to keep the files well organized. MPLAB X IDE separates header (.h) files from source (.c) files, so the logical folder structure mirrors (with some small differences) the physical folder structure on the disk under both the header files and source files top-level logical folders. In most cases, the folders on the disk correspond directly to the logical folders in MPLAB X IDE, but the header files and source files are not separated on the disk as they are in the MPLAB X IDE logical folder tree. Also, the app logical folder corresponds to the src folder on the disk.

The application’s src folder contains the main.c file as well as the app.c and app.h files along with other application-specific files like app_tone_lookup_table.c and app_tone_lookup_table.h that implement the application (by convention, main.c is identical for all MPLAB Harmony applications). The config folder normally holds one or more configuration-specific folders (config/default in this case) that each contain a complete set of configuration files for an MPLAB Harmony application.