35.14 RX/TX Activity Time-Out

The UART works in conjunction with the HLT timers to monitor activity on the RX and TX lines. Use this feature to determine when there has been no activity on the receive or transmit lines for a user-specified period of time.

To use this feature, set the HLT to the desired time-out period by a combination of the HLT clock source, timer prescale value and timer period registers. Configure the HLT to reset on the UART TX or RX line and start the HLT at the same time the UART is started. UART activity will keep resetting the HLT to prevent a full HLT period from elapsing. When there has been no activity on the selected TX or RX line for longer than the HLT period, an HLT interrupt will occur signaling the time-out event.

For example, the following register settings will configure HLT2 for a 5 ms time-out of no activity on U1RX:
  • T2PR = 0x9C (156 prescale periods)
  • T2CLKCON = 0x05 (500 kHz internal oscillator)
  • T2HLT = 0x04 (free-running, Reset on rising edge)
  • T2RST = 0x15 (Reset on U1RX)
  • T2CON = 0xC0 (Timer2 on with 1:16 prescale)