Interfacing a Microcontroller With a PC Using RS232 and the PC Serial Port

By November 8, 2017Uncategorized

Serial Communication

Serial communication is a technique of transmitting data between two pieces of hardware. The smallest piece of data that is transmitted is the byte. A byte is made up of 8 bits. When data is transmitted between two pieces of hardware, the bits are sent one at a time. The hardware sends these bits by sending varying voltages across the wires connecting the devices. The sender and the receiver agree on how often a bit (or voltage level) will be sent.

How often a bit will be sent is referred to as baud rate or bits per second (bps). Then with the help of very precise clocks they can send a series of voltage levels between each other and then reassmble these voltage levels into bytes.

The Problem Communicating Between a PC and a Microcontroller

The RS232 serial port on a PC uses +3 to +25 volts to signify a logic level of 0, and -3 to -25 volts to signify a logic level of 1.

Most microcontrollers use TTL / CMOS logic levels which use 0 to some threshold voltage to signify a logic level of 0, and some threshold voltage to 5 volts to signify a logic level of 1.

In order for the PC and a microcontroller to successfully communicate some logic level translation is necessary.

Using a TTL / CMOS To RS232 Converter

There are many companies that manufacture modules that take care of the required logic level translation. The TTL / CMOS To RS232 Converter is one such module. Typically, these modules connect to the RS232 port on the PC and connect to the microcontroller's transmit and receive pins. Supply 5 volts and ground and you are ready to communicate.

Applications Ideas

Once you have your microcontroller communicating with your PC it opens up all kinds of possible applications ranging from data loggers, pc based oscilloscopes, controlling your pc from your microcontroller, controlling your microcontroller from your pc, etc.

Source by Sidney Kantor

Leave a Reply

Skip to toolbar