Microchip USART

This example describes how you can use the USART for PIC16F876. Also other targets can be used with this example, just change the target into a PIC microcontroller you want to use. In this particular case the example is set as a 1200 Baud USART, please take a look at the hardware settings, Usart tab.

Scheme

This example repeats the incoming characters. When the uart receive bit is high the uartrxtx register is read, the data is written in the uartrxrx register to be send again. Use the output of TXEmpty to send the next charater.


  • UsartRcv is connected to RCIF USART Receive interrupt.
  • USARTTX (Input) is connected to RCREG, USART Receive register.
  • USARTTX (Output) is connected to TXREG, USART Transmit register.
  • TXEmpty is connected to TRMT, USART Transmit shift register status bit.