33.13 Configuring the CWG
- Ensure that the TRIS control bits corresponding to CWG outputs are set so that all are configured as inputs, ensuring that the outputs are inactive during setup. External hardware must ensure that pin levels are held to safe levels.
- Clear the EN bit, if not already cleared.
- Configure the MODE bits to set the output operating mode.
- Configure the POLy bits to set the output polarities.
- Configure the ISM bits to select the data input source.
- If a Steering mode is selected, configure the STRy bits to select the desired output on the CWG outputs.
- Configure the LSBD and LSAC bits to select the Auto-Shutdown Output Override states (this is necessary even if not using auto-shutdown, because start-up will be from a Shutdown state).
- If auto-restart is desired, set the REN bit.
- If auto-shutdown is desired, configure the ASyE bits to select the shutdown source.
- Set the desired rising and falling dead-band times with the CWGxDBR and CWGxDBF registers.
- Select the clock source with the CS bit.
- Set the EN bit to enable the module.
- Clear the TRIS bits that correspond to the CWG outputs to set them as outputs.
If auto-restart is to be used, set the REN bit and the SHUTDOWN bit will be cleared automatically. Otherwise, clear the SHUTDOWN bit in software to start the CWG.