Minor changes are by default collapsed in the page history.
No changes
The page does not exist yet.
Failed to load changes
Version by on
Leave Collaboration
Are you sure you want to leave the realtime collaboration and continue editing alone? The changes you save while editing alone will lead to merge conflicts with the changes auto-saved by the realtime editing session.
Common Macros in the MPLAB XC8 Compiler
Last modified by Microchip on 2023/11/09 09:13
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.