3.3.2.4 How Do I Access SFRs?

The compiler ships with header files (see 5.2.3 Device Header Files) that define variables that are mapped over memory-mapped SFRs. Since these are C variables, they can be used like any other variable and no new syntax is required to access these registers.

Bits within SFRs can also be directly accessed via structures. Within the structure are bit-field members that allow access to individual elements in the register. Individual single-bit variables are also defined that are mapped over the bits in the SFR, but these should only be used in legacy projects. (see 5.2.6 Using SFRs From C Code).

The name assigned to the variable is usually the same as the name specified in the device data sheet. See 3.3.2.5 How Do I Find The Names Used To Represent SFRs And Bits? if these names are not recognized.