Within the MPLAB® XC8 compiler are several common macros to make creating an application easier. These are automatically included when the xc.h header file is included in the project. MPLAB Code Configurator (MCC) will automatically include the xc.h header file.
Some common macros include:
SLEEP(): This will generate the code to put the device into sleep / low power mode when the program executes this macro at compile time.
NOP(): This will generate an assembly NOP instruction at the specific location of the macro. This makes it easy to add a single cycle delay without inserting assembly code.
CLRWDT(): This macro will generate a clear watchdog command without having to insert assembly code.
_ _DATE_ _: A double underscore in front and after "DATE" will create the macro to return a string of data with the date the code was compiled. i.e. "May 21 2019"
XC8 VERSION: This macro will return the version of the compiler used.
Menu
Microchip Support
Query Microchip Forums and get your questions answered by our community:
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.