Timer (interrupt driven)

Configure the timer in MCC and select interrupt driven. Once you Geneate the MCC code it will have dealt with initialising the timer ready for you to use it. In your code Other timer functions MCC will have created a few useful functions you can call – see the file it generated in: /config/default/peripheral/tmr/

Read More

Atomic access

PIC32 Special Function Registers (SFRs) can be accessed like ordinary variables in C but there can be read-modify-write problems associated with code that wants to change individual bits in these registers. To get around this problem, virtually all registers have an alternate register set, using the primary register name appended with SET, CLR, or INV. […]

Read More

XC32 files, definitions, etc

Predefined C variables that represent the peripheral registers and bits In your sepecific device header file, located in: C:\Program Files\Microchip\xc32\v#.##\pic32mx\include\proc\ Config setting names e.g.#pragma config FMIIEN = In MPLABX: Menu > Window > PIC Memory Views > Configuration Bits, then use “Generate Source Code to Output” button.

Read More

XC8 V1.# Compiler

Setting a new project (After following the steps here) Project Properties > XC8 global options > XC8 Compiler > Select ‘Optimizations’ Speed (or disable optimizations?) & Debug checkboxes Set as needed (off and on is good for debugging) Address qualifiers – CAN BE VERY IMPORTANT!!!! If you are using anything that requires locating in specific […]

Read More

.New XC32 Project

Use MCC Get over it, you have to with V4.# and above XC32, all the old plib.h and config etc functions are completely gone. If you don’t want it you’ll have to use V2.# of the XC32 compiler (we skipped V3.#, not sure on that one). Create MPLAB X Project Run MPLAB X IDE Menu […]

Read More