CCS C UART example for PIC18F4550 microcontroller

This article shows how to get started with PIC18F4550 microcontroller USART module using CCS PIC C compiler.
PIC18F4550 microcontroller has one (1) USART (Universal Synchronous/Asynchronous Receive/Transmit) module. This module can work in USRT mode or UART mode. In this topic we are going to use the USART module as UART (Universal Asynchronous Receive/Transmit) to transmit and receive data between the microcontroller and the computer.

PIC18F4550 UART connection circuit schematic:
Pin RC6 (TX) and pin RC7 (RX) are used for the UART (serial) communication between the microcontroller and the computer. To change between TTL logic levels (5V) and RS232 signals (+/-12V), an IC is needed which is max232.
Don’t connect TX and RX pins directly to an RS232 serial port which may damage your microcontroller.
PIC18F4550 UART example circuit
In this example the PIC18F4550 microcontroller uses its internal oscillator and MCLR pin function is disabled.

PIC18F4550 UART example CCS C code:
This is the full C code of this example.

PIC18F4550 UART example video:
The following video shows communication between the computer and PIC18F4550 using UART module.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.