MPLAB® Code Configurator (MCC) is a free graphical programming environment that generates seamless, easy-to-understand C code to insert into your project. Using an intuitive interface, it enables and configures a rich set of peripherals and functions specific to your application. It supports our 8-, 16- and 32-bit devices, which include our PIC®, AVR® and SAM microcontrollers (MCUs) and dsPIC® Digital Signal Controllers (DSCs). Both the downloadable MPLAB X Integrated Development Environment (IDE) and the cloud-based MPLAB Xpress IDE include MCC.
We’ll be using MCC this time to configure the File System Library (FatFs) and SD/MMC card library to complete the exercise.
Step 4.1 – Configure File System Library and Add SD/MMC Card Library
From the Project Resources window, select the FatFs library.
Locate the FatFs tab and click on the Configuration tab. Uncheck the Generate example/demo files box.
Add the SD/MMC card library by selecting SD Card (SPI) in the Select a physical layer driver: field. Click the + Insert Driver button.
Scroll down to the Features Selection and Optimizations section. For the String function optimization pull-down, select 1: Enable without LF-CRLF conversion.
Scroll further down and find the Select Source of File Timestamps section. Select Use fixed timestamp.
Step 4.2 – Configure SD/MMC Card Library
From the Project Resources window, select the SD Card (SPI) library.
Locate the SD Card (SPI) tab and make the following changes:
- Uncheck the Enable Write Protect (WP) box.
- Select Active Low for the Enable Chip Select (CS) Polarity pulldown.
- Select Active Low for the Enable Card Detect (CD) Polarity pulldown.
Note: SPI MCC driver is automatically configured by the SPI Card (SPI) library.
Generate the code by clicking the Generate button in the Project Resources window.
The Output window in the lower right window will read “Generation complete” if successful.