Transmitting and receiving data using UART protocol PIC Microcontroller




UART or serial communication is one of the important protocol used by the Microcontrollers to transmit and receive data from the external devices. Almost every controller is equipped with this protocol to make transmission and reception easier just using two pins. This tutorial will teach you to initialize and send data by using UART protocol PIC microcontroller.Transmitting and receiving data using UART protocol PIC Microcontroller

I assume that you are familiar with the concept of UART and proceed to explain the steps to initialize and use it in PIC controller. If you are familiar with the concept of  UART kindly go through this link before proceeding.

REGISTERS USED IN UART:

TXSTA REGISTER: This register have the status and control bits of the Transmission in the controller.

RXSTA: This register holds the status and control bits of the Reception in the microcontroller.

SPBRG: This register holds the value which decides the baud rate of the serial communication. The formula governing the calculation varies based on the modes high speed and low speed.

LOW SPEED:

(Asynchronous) Baud Rate = FOSC/(64 (X + 1))

(Synchronous) Baud Rate = FOSC/(4 (X + 1))

HIGH SPEED:

Baud Rate = FOSC/(16 (X + 1))

Where X is the value of SPBRG register.

 

Since we are using standard 9600 bps, we are about to use 129 in the SPBRG register. According to the datasheet it results in giving 9600 bps 20MHZ crystal. You can find brief explanation of the bits in these registers in the data sheet of this controller.Schematic Transmitting and receiving data using UART protocol PIC Microcontroller

For more detail: Transmitting and receiving data using UART protocol PIC Microcontroller

READ  Interfacing Internal EEPROM with PIC Microcontroller

JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Get quote online easily: https://jlcpcb.com




Current Project / Post can also be found using:

  • lcd displey project for pic

Leave a Comment

*
= 4 + 7

Read previous post:
Windows 95 on an Apple Watch
Windows 95 on an Apple Watch

I installed Windows 95 on my Apple Watch With a 520 MHz processor, 512 MB of RAM, and 8GB of...

Close
Scroll to top