Difference between revisions of "Serial Communication with PIC16F877A"
Line 19: | Line 19: | ||
|} | |} | ||
<br><br> | <br><br> | ||
+ | |||
+ | |||
+ | =UART Register Configuration= | ||
+ | Now lets see how to configure the individual registers for UART communication. | ||
+ | {| class="table table-striped table-hover table-condensed table-bordered" | ||
+ | |-class="info" | ||
+ | |TXSTA | ||
+ | |- | ||
+ | |7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 | ||
+ | |- | ||
+ | |CSRC || TX9 || TXEN || SYNC || - || BRGH || TRMT || TX9D | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | {| class="table table-striped table-hover table-condensed table-bordered" | ||
+ | |-class="info" | ||
+ | |TXSTA | ||
+ | |- | ||
+ | |7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 | ||
+ | |- | ||
+ | |SPEN || RX9 || SREN || CREN || ADDEN || FERR || OERR || RX9D | ||
+ | |} |
Revision as of 10:31, 5 May 2016
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.
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 |