Register Naming Conventions

Registers are divided into Control (CON), Status (STA) and Data registers with their naming reflecting this. A general purpose control register of a module has the control identifier named CON. If multiple general purpose control registers exist in a module, they have a suffix number identifier. In this case, the control registers will be named CON0, CON1, CON2 and so on. For example, see ADCON0, ADCON1, ADCON2 and ADCON3 registers in Figure 1-3.

When there are multiple instances of the same peripheral in a device, the name of the peripheral control registers will be depicted as the concatenation of the peripheral identifier, the peripheral instance number and the control identifier. Therefore, all the register names of PIC microcontrollers are unique. For example, in Figure 1-4, observe the RC2STA (Receive Status and Control Register) for EUSART peripheral instance 2.

For registers that have a specific function, their name reflects this functionality. For example, BAUD2CON is the Baud Rate Control Register for the second instance of the EUSART peripheral.

Figure 1. Register Summary for EUSART Peripheral

Since the PIC data bus width is 8 bits, larger registers are implemented using several 8-bit registers. For a 16-bit register, the high and low bytes are accessed by appending ‘H’ and ‘L’ respectively to the register name. For example, the ADC Result Register is named ADRES and the two bytes are ADRESL and ADRESH.

After the Register Summary section in the device data sheet, each register has a Register Definition section, which fully describes the functionality of each bit and bit field in the register. The Register Definitions section shows one instance of all the register names with an ‘x’ in place of the peripheral instance number. An example is presented in Figure 1-5.