Circuit description
Circuit is quite simple in any project we can add this facility to do serial communication with computer.

For that UART section of 8051 microcontroller is used. Rx and Tx line of microcontroller are connected to the computer’s serial port via MAX232. MAX232 is used to reverse the logic. Because RS232 works on negative logic and 8051 work on positive logic.

8051 is programmed in such a way that serial communication will take place at the speed of 9600 bps.

After that StringToTerminal() is used the string to the serial port of computer. SerialPrint() is used to send any integer variable to the serial port. These two function can be used in any project.

StringToTerminal() = to send any string to PC.

SerialPrint() = to send content of any variable to PC.

StringToTerminal function is most important. Here we are sending characters one by one. instead of checking flags we are giving 10 msec delay. our assumption is that within this time communication will take place.

Sending complete string, Line feed and carriage return characters are also send so that curser at hyper terminal will come to next line.

This is Keil Project and can be open directly in Keil IDE. If you do not have KEIL IDE, then you can download it from following link at free of cost.

Debugging of 8051 application can be very easy if we able to send debug information to serial port of PC. And its output can be seen on HyperTerminal (in Windows ) or Minicom ( in Linux ). We can display content of any variable, memory location etc. We can also print other useful information on serial terminal which could replicate the flow of the code.

Such messages can be displayed like “Entering into function A”, “Existing from function B” , “Data is send” etc. So this is very cost effective solution because we do not need any In Circuit Emulator or any other debugging device. In this tutorial circuit and working code is shown.

Logos and brand names used in this site are belonging to their respected owners. We have used them here only for the purpose of information. Enable Active X control from internet options of internet explorer to view all element of this site.