Step 4: Include Application-Specific Source Files and Add Required Code

Last modified by Microchip on 2024/01/30 22:10

Copy the following source files into your project's source files folder:

  • app_tone_textfile_sdcard.c
  • app_tone_textfile_sdcard.h

Copy them from apps/training/solutions/audio_player/audio_player_lab2/dev_files to apps/training/solutions/dev/audio_player/audio_player_lab2/firmware/src.

Copy SD card source files

Back to Top


Add the copied source files to your project.

Add app_tone_textfile_sdcard.c to the Source Files/app folder (in the MPLAB X IDE Projects pane) by right-clicking and selecting Add Existing Item…

Add existing item

Select item

Add app_tone_textfile_sdcard.h to the Header Files/app folder by right-clicking and selecting Add Existing Item…

Add existing item

Select item

Back to Top


Remove the following application files from audio_player_lab1:

  • app_tone_lookup_table.c
  • app_tone_lookup_table.h

Right-click on these file names in the Projects pane, and select Remove From Project.

Remove header from project

 Remove C source from project

Back to Top


Since you are retaining the app.c and app.h files from audio_player_lab1, you need to change some of the function names to correspond with the newly included app_tone_textfile_sdcard.c file.

Open the file app.c and change the name of the function prototypes.

Change function prototype names

Back to Top


Then change the name of this function from APP_TONE_LOOKUP_TABLE_Initialize() to "APP_TONE_TEXTFILE_SDCARD_Initialize()" in function APP_Tasks as shown in the accompanying image.

Change initialize function name

Back to Top


Similarly, change the name of this function from APP_TONE_LOOKUP_TABLE_Tasks() to "APP_TONE_TEXTFILE_SDCARD_Tasks()" in function APP_Tasks as shown in the accompanying image.

Change tasks function name

Back to Top


Save the file before closing.

Back to Top