Tag Archives: Hyperterminal

Using the USART of AVR Microcontrollers : Reading and Writing Data

Till now we have seen the basics of RS232 communication, the function of level converter and the internal USART of AVR micro. After understanding the USART of AVR we have also written a easy to use function to initialize the USART. That was the first step to use RS232. Now we will see how we can actually send/receive data via rs232. As this tutorial is intended for those who are never used USART we will keep the things simple so as to just concentrate on the "USART" part. Of course after you are comfortable with usart you can make it more usable my using interrupt driven mechanism rather than "polling" the usart. So lets get started! In this section we will make two functions :- USARTReadChar() : To read the data (char) from the USART buffer. USARTWriteChar(): To write a given data (char) to the USART. This two functions will demonstrate the use of USART in the most basic and simplest way. After that you can easily write functions that can write strings to USART. Reading From The USART : USARTReadChar() Function. This function will help you read data from the USART. For example if you use your PC to send data to your micro the data is automatically received by the USART of AVR and put in a buffer […]

RS232 Communication – The Level Conversion

Hello and welcome back. Continuing our discussion on RS232 serial communication in this part we will make a RS232 level converter. In the last tutorial we saw that how RS232 level signals differs from normal logic signals. So to interface RS232 level signals to our MCUs we need a "Level converter". And in this tutorial we will make one. What a level converter will do is to convert RS232 level signals (HIGH=-12V LOW=+12V) from PC to TTL level signal (HIGH=+5V LOW=0V) to be fed to MCU and also the opposite. Fig – Working of RS232 level converter       As RS232 is such a common protocol there is a dedicated IC designed for this purpose of "Level Conversion". This IC is MAX232 from Maxim. By using charge pumps it generates high voltages(12V) and negative voltages(-12V). Now lets make it! Things you need S.No Item Value Qty 1 MAX232 IC 1 2 Capacitors 1uF 4 3 10uF 1 4 DB9 Female Connector 1 5 General Purpose PCB 1 6 Some Wires – –   Fig – Stuffs required for RS232 level converter.     Now having all the stuffs in our working table lets begin. The Schematic Fig – Schematic for RS232 level converter.     Assembly Assemble the circuit according to the schematic on a small piece of general […]