28.6 CLC Setup Steps
These steps need to be followed when setting up the CLC:
- Disable the CLC by clearing the EN bit.
- Select the desired inputs using the CLCnSEL0 through CLCnSEL3 registers.
- Clear any ANSEL bits associated with CLC input pins.
- Set all TRIS bits associated with inputs. However, a CLC input will also operate if the pin is configured as an output, in which case the TRIS bits must be cleared.
- Enable the chosen inputs through the four gates using the CLCnGLS0 through CLCnGLS3 registers.
- Select the gate output polarities with the GyPOL bits.
- Select the desired logic function with the MODE bits.
- Select the desired polarity of the logic output with the POL bit (this step may be combined with the previous gate output polarity step).
- If driving a device pin, configure the associated pin PPS control register and also clear the TRIS bit corresponding to that output.
- Configure the interrupts (optional). See the CLC Interrupts section.
- Enable the CLC by setting the EN bit.