4.1 MCC Generated Code
To generate this project using MPLAB Code Configurator (MCC), follow these steps:
- Create a new MPLAB X IDE project.
- Open the MCC from the toolbar (information on how to install the MCC plug-in can be found on the Microchip website).
- Go to Project Resources >
System > System Module and use the following configurations:
- Oscillator Select: HFINTOSC
- HF Internal Clock: 4 MHz
- Clock Divider: 4
- In the Watchdog Timer Enable field, in the WWDT tab, ensure WDT Disable is selected
- In the Programming tab, make sure Low-Voltage Programming Enable is checked
- From the Device Resources window, add
EUSART2 to the project, then use the following configurations:
- Mode: Asynchronous
- Enable EUSART: Checked
- Enable Transmit: Checked
- Baud Rate: 9600
- Transmission-bits: 8 bits
- Reception-bits: 8 bits
- Data Polarity: Noninverted
- Redirect STDIO to USART: Checked
- Open Pin Manager > Grid
View window, select UQFN40 in the MCU package field and make the
following pin configurations:
- RD0 – EUSART2 TX
- RD1 – EUSART RX
- RE0 – GPIO output
Figure 4-1. Pin Mapping - In Project Resource, locate Pin Module and rename RE0 from IO_RE0 to LED0; uncheck the Analog check box.
- Click Generate in the Project Resources tab.
- Replace the
main.c
file with the code provided in the code example. - Use MPLAB X Data Visualizer as described in the appendix, Send Commands from MPLAB X Data Visualizer.