4.3.2.4 How Do I Access Special Function Registers (SFRs)?

The compiler is distributed with header files that define variables. The variables are mapped over the top of memory-mapped SFRs. Since these are C variables, they can be used like any other C variables. No new syntax is required to access these registers.

The names of these variables should be the same as those indicated in the data sheet for the device you are using.

Bits within SFRs can also be accessed. Bit-fields are available in structures which map over the SFR as a whole. For example, PORTCbits.RC1 means the RC1 bit of PORTC. For more information on header files, refer to the Device Header Files section.