The MPLAB® XC8 Compiler has a built-in delay function that can be handy. This project demonstrates how to use it with MPLAB Code Configurator (MCC) macros to toggle an output with a programmable delay.
MCC Content Manager Wizard now gives a list of Required Content and Optional Content list. In this case, no additional content is required for this project. Click Finish.
Open the Pin Manager: Grid View tab in the output window and then click on the PORTA pin 2 (RA2) Output blue lock symbol. It will turn green. It should look like the accompanying image when completed:
Click on the Pin Module selection in the Project Resources section. The center screen should show RA2 listed on the I/O chart. Click on the Output box to make the pin an output (if not checked) and make sure Analog and WPU are not checked (click on them to uncheck them).
Click on the Debug and Run icon to compile and run the code; you should see a BUILD SUCCESSFUL message in the output window under the Digital-out (Build,Load,...) tab.
Each time you click on Continue the program will run until it hits the breakpoint on the IO_RA2_Toggle() command. You will see the RA2 bit of PORTA change state.
The project can be closed in MPLAB X IDE. The project is saved automatically when it is built, but any changes to files or configuration may ask to be saved before the project is closed.
Close the project under File Menu > Close Project.
If you need to work with Microchip Support staff directly, you can submit a technical support case. Keep in mind that many questions can be answered through our self-help resources, so this may not be your speediest option.