Interfacing with UART of PIC microcontroller

This post provides the solution for using the PIC controller UART interface (e-g to connect PIC controller with PC using serial adapter).

Interfacing with UART of PIC microcontroller

Complete code and simulation can be downloaded from the ‘Downloads‘ section at the bottom of this post. The following figure shows the result of simulation of PIC UART in Proteus7.6.

In the main function UART is intialized by calling the function InitUART (defined in the serial.c file included in the project). Then a Hello World! is sent on the UART terminal (e-g using serial adapter you can display this Hello World! on Hyper Terminal on PC). After that, interrupts are enabled because in the Interrupt Service Routine (ISR) UART interrupt is handled as shown below in the code.

Interfacing with UART of PIC microcontroller schematic

Downloads

The code was compiled in MPLAB v8.76 with HI-TECH C and simulation was made in Proteus v7.6.
To download code click here.
To download Proteus simulation click here.

 

For more detail: Interfacing with UART of PIC microcontroller

About The Author

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 research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter