In this tutorial we are going to discuss the serial/UART communication using PIC16F877A.
PIC16F877A comes with inbuilt USART which can be used for Synchronous/Asynchronous communication. We will be discussing only the UART. After understating the basics of PIC16F877A UART module, We will see how to use the ExploreEmbedded libraries to communicate with any of the UART devices.

0 UART main.gif


UART Registers

The below table shows the registers associated with PIC16F877A UART.

Register Description
TXSTA Transmit Status And Control Register
RCSTA Receive Status And Control Register
SPBRG USART Baud Rate Generator




UART Register Configuration

Now lets see how to configure the individual registers for UART communication.

TXSTA
7 6 5 4 3 2 1 0
CSRC TX9 TXEN SYNC - BRGH TRMT TX9D


TXSTA
7 6 5 4 3 2 1 0
SPEN RX9 SREN CREN ADDEN FERR OERR RX9D