PIC16F877 UART code and Proteus simulation




This post answers the question, “How to use interrupt based UART in PIC16F877” ?

PIC16F877 UART
Also, using PIC16 simulator (Proteus) you can verify this UART code and change it according to your needs. This code is written in C language using MPLAB with HI-TECH C compiler. You can download this code from the ‘Downloads‘ section at the bottom of this page.

This PIC16F877 microcontroller tutorial provides the interrupt based UART functions which you can easily understand and use. After reading this page you can easily use PIC16F877 serial UART interface.

It is assumed that you know how to blink an LED with PIC16F877 microcontroller. If you don’t then please read this page first, before proceeding with this article.

The following diagram (made in Proteus) shows the PIC microcontroller circuit diagram.

PIC16F877 UART schematic

In the above figure, UART baudrate is currently set to 9600 bps, but you can change it to your desired value. RC6 pin is the TX pin and RC7 pin is the RX pin the UART. Whenever a new character is received on the UART, then PIC16F877 goes into interrupt service routine and received character is echoed back.

When code starts to execute then PIC16F877 sends ‘Hello World‘ to virtual terminal. After that PIC16F877 echos back whatever character is sent to it. ‘Hi’ was typed in the virtual terminal after the start up of the simulation in Proteus and PIC16F877 echoed it back.

Code

The code used to set different properties of UART is shown below. (From UART.h file)

Downloads

UART code for PIC16F877 was compiled in MPLAB v8.85 with HI-TECH C v9.83 compiler and simulation was made in Proteus v7.10. To download code and Proteus simulation click here.

 

For more detail: PIC16F877 UART code and Proteus simulation




Current Project / Post can also be found using:

  • UART in proteus
  • ft232r usb uart projetc proteus
  • pic24fj64ga UART proteus
  • proteus uart analyse

Leave a Comment

*
= 4 + 0

Read previous post:
PIC16F877 LCD interfacing
PIC16F877 LCD interfacing code (In 4bit mode) and Proteus simulation

This PIC16F877 microcontroller tutorial answers the question, "How to interface LCD[1]  in 4bit mode with PIC16F877" ? Also, using PIC16 simulator (Proteus)...

Close
Scroll to top