Learn   /   Beginner Tutorials   /   PIC18F4550

How to configure EUSART in PIC18F4550

Learn EUSART configuration in PIC18F4550 for Arduino: A comprehensive guide to enable serial communication effortlessly.

Published
Updated

At a glance

CategoryBeginner Tutorials
PIC modelPIC18F4550
Reading time~3 min

Summary of How to configure EUSART in PIC18F4550

This article explains serial communication concepts and details the PIC18F4550 microcontroller’s EUSART (Enhanced USART), covering asynchronous/synchronous and full-/half-duplex modes. It highlights EUSART features such as automatic baud-rate detection and describes key EUSART registers—focusing on the TXSTA transmit control register and its bits (TRMT, BRGH, SYNC, TXEN, TX9) and their functions for configuring serial transfer.

Parts used in the PIC18F4550 EUSART Project:

  • PIC18F4550 microcontroller

Both, Parallel and Serial modes of communication have certain advantages and disadvantages over one another. The serial communication is a preferred option due to its ability of long distance communication with error detection capability. The microcontrollers consist of an inbuilt hardware unit known as USART (Universal Synchronous Asynchronous Reception and Transmission) to facilitate serial transfer of data. For more details, refer to USART in AVR section.

 EUSART in PIC
This article is based on Serial communication using a PIC microcontroller and explores the programming methods and hardware of PIC18F4550’s USART.

Before starting USART, some general terms related to communication need to be understood. These terms are explained below.

Asynchronous Communication:
In this type of communication, both Transmitter (Tx) and Receiver (Rx) work on different clocks which means that they are not synchronized. Start and Stop bits are also sent with each Data byte to identify the data.
Synchronous Communication:
In this type of communication, both Tx and Rx are synchronized with the same clock and no Start or Stop bits are used.
Full-duplex Communication:
When either of the devices can send and receive data at the same instant, they are said to have full-duplex communication.
 
Half-duplex Communication:
In this type of communication, a device can either behave as Transmitter or Receiver at an instant which means that a device can’t transmit data when it is receiving and vice versa.
 
 
PIC's EUSART
PIC18F4550 has an inbuilt EUSART (Enhanced USART). Normally USART can be configured as asynchronous full-duplex communication or synchronous half-duplex communication. EUSART provides additional capabilities as compared to USART, like Automatic Baud-rate Detection. Automatic baud-rate detection means that during reception there is no need to set the baud rate at controller’s side, EUSART sets it on its own which is certainly an advantage over USART. Baud rate and its calculation have been explained later in this article.
Registers of EUSART:
To use the EUSART of PIC18f4550 microcontroller following registers need to be configured.
1. TXSTA (Transmit Status and Control Register)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
TRMT: This is a read only bit which shows the status of Shift register where data is stored.
            1 = Transmit Shift Register Empty
            0 = Transmit Shift Register Full
BRGH: This bit is configured to decide the speed of Asynchronous serial communication.
            1 = High speed
0 = Low speed
SYNC: The mode of communication is selected by this bit.
            1 = Synchronous mode
0 = Asynchronous mode
TXEN: This bit is set to high to enable the transmission.
TX9:    This bit is set to high while sending 9-bit long data.
            1 = Selects 9-bit transmission
0 = Selects 8-bit transmission
For more detail: How to configure EUSART in PIC18F4550
  • What types of serial communication modes are described?
    The article describes asynchronous and synchronous serial communication modes.
  • What is asynchronous communication?
    Asynchronous communication uses different clocks for transmitter and receiver and sends start and stop bits with each data byte.
  • What is synchronous communication?
    Synchronous communication has transmitter and receiver synchronized with the same clock and does not use start or stop bits.
  • What is full-duplex communication?
    Full-duplex communication allows devices to send and receive data simultaneously.
  • What is half-duplex communication?
    Half-duplex communication allows a device to either transmit or receive at an instant, not both.
  • What enhanced feature does EUSART provide over USART?
    EUSART provides automatic baud-rate detection among other enhanced capabilities.
  • Which EUSART register is detailed in the article?
    The TXSTA transmit status and control register is detailed.
  • What does the TRMT bit indicate?
    TRMT indicates the transmit shift register status: 1 means empty, 0 means full.
  • How does the BRGH bit affect communication?
    BRGH selects asynchronous speed: 1 for high speed and 0 for low speed.
  • What do the SYNC and TXEN bits do?
    SYNC selects synchronous (1) or asynchronous (0) mode; TXEN enables transmission when set high.
Beginner Tutorials · PIC18F4550

PICDEM FS USB CDC Evaluation Board using PIC18F4550 with Proteus Simulation

Introduction The PICDEM FS USB CDC Evaluation Board is a practical microcontroller project built around the PIC18F4550, designed to demonstrate USB communication...

Peripheral Tutorials · PIC18F4550

PICDEM FS USB Mass Storage Device using PIC18F4550 with Proteus Simulation

Introduction This microcontroller project demonstrates how to simulate a USB Mass Storage Device (MSD) using the PIC18F4550 in a Proteus simulation environment....

Development Boards & Kits · PIC18F2550

Pinguino Project: A PIC Microcontroller Based Arduino

This is a complete tutorial to make a PIC Microcontroller based Arduino. This is a complete tutorial to make PIC microcontroller based...

Beginner Tutorials · PIC16F877A

PIC16F877 Driving LCD in 4-Bit Mode using PIC16F877 with Proteus Simulation

Introduction This microcontroller project shows how a PIC16F877 can drive an LCD display using 4-bit mode inside a Proteus simulation.The project demonstrates...

Beginner Tutorials

PIC12CE518 I2C EEPROM using PIC12CE518 with Proteus Simulation

Introduction This microcontroller project demonstrates how to write and read data using the internal I2C EEPROM of the PIC12CE518 and visualize the...

Beginner Tutorials

Pico Timer Project using Pico with Proteus Simulation

Introduction Timers are one of the most important features in embedded systems because they allow microcontrollers to perform tasks at precise intervals...

Ibrar Ayyub

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough...