Right Click Project > Properties
All posts by
.Create New Project
XC8 Projects Jump to our page here. XC32 Projects Jump to our page here. Create MPLAB X Project Run MPLAB X IDE Menu > File > New Project Categories: Microchip Embedded Projects: Standalone Project Select the device Select the debugging tool Select the Compiler to use Set project name and “Set as main project” Add […]
Debug / Release Modes
MPLAB allows you to use this macro: __DEBUG to detect if a debug or release mode is selected. It is not built in into MPLAB X and will be automatically set when compiling for a debugger. To forcibly enable it you can also just add this to a global header file when debugging: #ifndef __DEBUG […]
Log Information
Go to Tools > Options > Embedded tab > Generic Settings subtab > and enable FINEST logging. Restart MPLAB X
Debugger / Programmer
Right click the project > Properties Window > Project Environment Debugger is only connected once you start a debug session
Compiler Version
Viewing compiler version Project > Select Language Toolsuite
IO Pins
//INPUT if (PORTBbits.RB0) //OUTPUT LATBbits.LATB0 = 0;
Useful Macros
PIC12 and PIC16 ;*********************************************** ;********** USEFUL DEFINES AND MACROS ********** ;*********************************************** #define skip_if_c btfss status,c #define skip_if_nc btfsc status,c #define skip_if_z btfss status,z #define skip_if_nz btfsc status,z ;compare file to w, skip if f=w cpfseq_macro macro reg xorwf reg,w skip_if_z endm ; ;compare file to w, skip if f<>w cpfsneq_macro macro reg xorwf reg,w skip_if_nz […]
Reset
Reset();
AtoD
PIC24FJ256GB106 Auto Sampling //—– SETUP THE A TO D PINS —– //AN0, AN1, AN11 analog //Auto scan of inputs AD1PCFGL = 0xF7FC; //Set the analog pins (0 = analog) AD1PCFGH = 0xFFFF; AD1CON2 = 0x0408; AD1CON3 = 0x1F05; AD1CHS = 0x0000; AD1CSSL = 0x0803; //Set the inputs to scan AD1CON1 = 0x80E4; //AD1CON2 SMPI (interrupts […]