Bit Masks and Bit Field Masks

Register bits can be manipulated using predefined masks, or bit positions. The predefined bit masks from the header file are either related to individual bits, called a bit mask, or related to a bit field, called a bit field mask.

A bit mask is used both when setting and clearing individual bits. A bit field mask is mainly used when clearing multiple bits in a bit field.

For the ADCON2 register, the bit fields, bit names, bit positions, and bit masks of this register, see the table below.

Table 1. Bit Fields, Bit Names, Bit Positions, and Bit Masks in the ADCON2 Register
Bit Field - ADCRS - ADMD
Bit Name ADPSIS ADCRS2 ADCRS1 ADCRS0 ADACLR ADMD2 ADMD1 ADMD0
Bit Position 7 6 5 4 3 2 1 0
Bit Mask 0x80 0x40 0x20 0x10 0x08 0x04 0x02 0x01