In this chapter, we’ll explore the versatile world of USART communication using PIC, a vital link between devices like PCs and microcontrollers. UART (Universal Asynchronous Receiver/Transmitter) or USART facilitates seamless serial data exchange, supporting full-duplex transmission and reception asynchronously. Additionally, it can operate in half-duplex mode synchronously. Get ready for an engaging journey into the heart of communication! Let’s dive in and make some magic happen!


Electricity poses inherent risks. Adequate skills are crucial for handling it safely. Undertake tasks at your own risk; the author disclaims responsibility for misuse, harm, or errors. Website content is unique and copyrighted; refrain from unauthorized copying. Most articles are open-source for your benefit. Feel free to use the knowledge freely, and consider purchasing available resources. For assistance or guidance, comment below; the author aims to help. Some articles may contain affiliate links, having no impact on you but supporting the author with a commission. Thank you for your understanding.


If you missed the previous chapter you can read that here:

About USART:

In the realm of embedded systems, communication plays a pivotal role, enabling devices to interact with each other and exchange data seamlessly. One of the key communication interfaces found in PIC microcontrollers is the Universal Synchronous Asynchronous Receiver Transmitter (USART). This versatile module empowers developers to establish reliable serial communication links between PIC microcontrollers and external devices, unlocking a myriad of possibilities for data exchange in various applications.

Understanding USART:

At its core, the USART module facilitates bidirectional serial communication, supporting both synchronous and asynchronous modes of operation. This flexibility makes it adaptable to diverse communication requirements encountered in real-world scenarios.

Key Features of USART:

  1. Full Duplex Communication: USART enables simultaneous transmission and reception of data, allowing devices to communicate in both directions without interference.
  2. Asynchronous Mode: In asynchronous mode, communication is clock-independent, making it suitable for applications where precise timing synchronization is not critical. This mode is commonly used for establishing communication between PIC microcontrollers and peripheral devices like sensors, displays, and external modules.
  3. Synchronous Mode: Synchronous mode synchronizes data transmission and reception with a clock signal, ensuring precise timing alignment between communicating devices. This model is beneficial in scenarios where high-speed data transfer and synchronization are essential, such as communication between microcontrollers or interfacing with synchronous peripherals.
  4. Baud Rate Flexibility: USART allows developers to configure the baud rate to match the communication speed requirements of the application, ensuring reliable data transfer over serial communication channels.

Practical uses examples of USART/UART:

USART or UART can be used in different practical actions. Such as:

  1. Serial communication with Sensors: Some sensors communicate through UART with a specific baud rate.
  2. Wireless RF communication: To communicate between RF wireless devices such as drones, remote control, Bluetooth data communication, etc.
  3. Debugging: Sometimes UART is used to debug microcontrollers and also upload firmware if the MCU has a bootloader.
  4. GSM/GPRS modules: GSM/GPRS/GPS modules communicate through UART. So if you want to use those, then UART must.
  5. USB-Serial communication: When you need to communicate with a PC with your microcontroller, then you have to use USB to Serial data communication. So in this case, UART is very important.

Now, these are only some examples of how you can use the UART communication. Despite these, there are many other purposes you may need this communication.

Practical Example:

Let’s make a project using UART communication.

USART communication using PIC


void UART_Write_CText(const char *cptr)
    char chr;
    for ( ; chr = *cptr ; ++cptr ) UART1_Write(chr);

char uart_rd;

void main() 
  TRISA = 0x01;
 // TRISC = 0x00;//do not do this
  UART1_Init(9600);               // Initialize UART module at 9600 bps
  Delay_ms(100);                  // Wait for UART module to stabilize



    /*if (UART1_Data_Ready())
    { // If data has been received
        uart_rd = UART1_Read();     // read the received data,



Code explanation:

After setting the I/O, UART is initialized at a baud rate of 9600. Then a start message so that we can read something on the terminal.

    if (UART1_Data_Ready())
    { // If data has been received
        uart_rd = UART1_Read();     // read the received data,

In this portion of the code, if there is any data on the UART1 terminal, then we are reading it and printing it back to the terminal. So that we can see what we are writing on the terminal.

Details are given in this video:

MCU to PC communication:

In the case of PC communication, you will need either an RS232 converter or a USB to TTL/serial converter.

USART communication using PIC


USART communication using PIC

There are lots of modules now available on the market. Depending on your PC configuration, you can use any one of these types.


UART/USART data communication is not so difficult. But in some MCUs, you may need extra care of the FERR_bit and OERR_bit register. But for common operations, you do not need anything extra. Just use it for your project where necessary.

You may read:

This article was very simplified and I presented it in an easy way so that you can understand it easily. But if you are already familiar with this and need advanced information then you can read mikroC’s guidelines here.

For Professional Designs or Help:



Mithun K. Das; B. Sc. in EEE from KUET; Head of R&D @ M's Lab Engineering Solution. "This is my personal blog. I post articles on different subjects related to electronics in the easiest way so that everything becomes easy for all, especially for beginners. If you have any questions, feel free to ask through the contact us page." Thanks.


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *