Summary of RS232 Communication using PIC18F4520’s USART – PIC Microcontroller Tutorial
This article explains how to establish RS232 serial communication between a PIC18F4520 microcontroller and a PC using a terminal program like RealTerm or Hyperterminal. The PIC18F4520 communicates using TTL logic levels, which differ from RS232 signaling, necessitating a MAX232 level converter. The setup includes the PIC18F4520 MCU, a 20MHz crystal oscillator, capacitors for noise immunity, and connections for transmitting (Tx) and receiving (Rx) data. This basic configuration helps users test and understand serial communication before moving on to custom software.
Parts used in the RS232 Communication with PIC18F4520:
- PIC18F4520 microcontroller
- MAX232 IC (RS232 level converter)
- 20MHz crystal oscillator
- Capacitors 0.1uF (C6 and C12)
- ICSP connector (for programming)
- RESET switch
RS232 can be used to communicate between a variety of devices. Like your MCU and a GSM module or a PC. In this tutorial we will demonstrate a link between a PIC18F4520 MCU and a standard PC. On PC we will run a terminal program like RealTerm or Hyperterminal. A terminal program is used to send and receive text data. So any text send by the MCU will be visible on Terminal Screen and Any keypress you make on the PC keyboard will be send over RS232 to your MCU. This configuration is the simplest setup to test and understand RS232 communication. When you have enough knowledge you can replace the Terminal with your own PC end software for sending receiving data.
Connecting PIC18F4520 with a PC
In Serial Communication the line that is used to transmit data is called Tx and the line used to receive data is called Rx. The PIC MCU uses TTL level for logic that is a 1 is a 5v and 0 is 0v but RS232 standard uses different scheme for logic level, so we need a level converter in between.
Schematic for Testing Serial Communication with PIC18F4520
The above image show the schematic of circuit you will need to make. Most of the circuit is common for many other application too. The only specific part is the level converter which built around the MAX232 IC.
The heart of this unit is PIC18F4520 chip (you may also use PIC18F4550). The ICSP connector is used to download programs via a PIC programmer. RESET switch is used to reset the MCU so its start executing from the beginning of the program. A 20MHz crystal is the source of oscillation. C12 and C6 which are 0.1uF (Marking 104) should be placed as closed to the MCU as possible, they provide extra immunity to noise.
For more detail: RS232 Communication using PIC18F4520’s USART – PIC Microcontroller Tutorial