The example below shows how to update a register bit field using bit positions to set the new configuration. Similar to the process of updating a register configuration using bit masks, the current configuration must be cleared and the new configuration set, in a single line of code.
/* Changing a bit field configuration with bit positions */
T0CON0 = (T0CON0 & ~_T0CON0_T0OUTPS_MASK) | (0 << _T0CON0_T0OUTPS3_POSITION)
| (1 << _T0CON0_T0OUTPS2_POSITION)
| (1 << _T0CON0_T0OUTPS1_POSITION)
| (1 << _T0CON0_T0OUTPS0_POSITION);
T0CON0 = (T0CON0 & ~_T0CON0_T0OUTPS_MASK) | (1 << _T0CON0_T0OUTPS2_POSITION)
| (1 << _T0CON0_T0OUTPS1_POSITION)
| (1 << _T0CON0_T0OUTPS0_POSITION);