Register Initialization using Bit Positions

Read-modify-write operations are not needed, when working with bit masks or bit positions, if the reset value of the register is '0' and the register configures in a single line.

The code listing below shows how to initialize a register using bit positions.

T0CON0 = (1 << _T0CON0_T0EN_POSITION)      /* Enable TMR0 */
       | (0 << _T0CON0_T016BIT_POSITION)   /* A placeholder to select 16-bit mode*/
       | (1 << _T0CON0_T0OUTPS0_POSITION)
       | (1 << _T0CON0_T0OUTPS3_POSITION); /* Select 1:10 postscaler */
Note: The (0 << _T0CON0_T016BIT_POSITION) line does nothing here, but it can be used as a placeholder to quickly change bit settings.