21.4.2.6 Short PWM Code (SPC) Support
The SENT module provides support for implementing SPC with assistance from other external peripherals. The SPCEN (SENTxCON1[6]) bit enables an external Output Compare (OC) peripheral to control the SENT data input pin. In general, a specific OC module is linked in hardware to a specific SENTx module.
- Set the SPCEN (SENTxCON1[6]) bit to enable control of the SENT data pin by an external source.
- For devices with Peripheral Pin Select, map the SENTxTX function to the same I/O pin as SENTxRX.
- Configure the Output Compare module as follows:
- Configure the module for Triggered mode.
- Configure for a single-shot, active-high pulse.
- Set the Period and Duty Cycle registers for the desired pulse duration.
- Verify that the line is in a High-Impedance state by polling the RXIDLE bit (SENTxSTAT[1]).
- Set the Trigger bit of the OC module to trigger the SPC pulse.
During the active period of the SPC pulse, the SENT receiver edge detection is disabled and the SENT data input pin is driven low by the module. At this time, the receiver logic is reset to prepare for a new data frame. When the pulse is completed, the module releases control of the SENT data input pin and input edge detection is re-enabled, so a data frame can be received from the sensor.
- Clear the ON bit to disable receiver operation.
- Manipulate the PORTx and TRISx registers associated with the SENT data pin to drive the data pin low for the desired time.
- Return the SENT data pin to a High-Impedance condition using the TRISx register.
- Set the ON bit to resume receiver operation.