Bit Positions

It is possible to use bit positions as an alternative to set or clear bits. A bit position within a register is defined using the same naming convention used at the bit masks, with the ‘_POSITION’ suffix instead of ‘_MASK’. There is also another definition for the bit positions in the header file. This bit position definition has the same functionality, but the suffix is ‘_POSN’. This is implemented for compatibility reasons.

The naming convention adopted for the predefined bit positions in the header file is presented in the Figure 2-4 with an example for the ADPSIS bit position in the ADCON2 register.
Figure 1. Naming Convention of Bit Positions

The bit position definition for the ADPSIS bit from the header file is shown below.

#define _ADCON2_ADPSIS_POSN                                 0x7
#define _ADCON2_ADPSIS_POSITION                             0x7

The bit positions are included for compatibility reasons. They are also needed when programming in assembly for instructions that use a bit number.