Basic RS232 Communication.
The quickest way to display something is probably sending the data to the computer to be displayed on the monitor. One of the ways to do this is to use the USART module on board the PIC Microcontroller by making use of the pins RC6 and RC7 which is also the TX and RX pins respectively when the SPEN bit on the RCSTA register is set.

PIC sends data using TTL (Transistor-Transistor Logic), that is, 5V for logic HIGH and 0V for logic LOW. However, the COM Port on the computer registers logic HIGH as negative voltage while logic LOW as positve voltage. In order to translate between the two, we will need something to convert TTL to negative and positive voltages we will need a MAX232 IC or something similar. =)

This project is demonstrates the most basic form of RS232 communication, that is, sending ASCII characters to the PIC via COM Port and the PIC will send the received character back to the PC to be displayed. It just echoes the character back at Hyperterminal. The setting of the following is used on Hyperterminal:

After entering these settings, we can send ASCII characters to the PIC with just a keypress. The key that was hit will appear on the textbox of Hyperterminal as the ASCII code is being echoed back from the PIC. =)

One application of this method is that we can have the PIC to send raw data to the PC and have the PC to do the complex calculation via high level language. Imagine going through all the trouble computing the area of a circle on a 8 bit PIC. >< = (
Below are the source code, schematics and some pictures. =) Credits to Tony Nixon for his codes on the USART for PIC16F877 which can be found at PIClist.org.

Source code for Assembler Language :
comm.asm
Added a source code for Hi Tech C Compiler :
commc.zip
Last updated : 4th August 2005, 2.37am Eastern Time.
Back to main page
Hosted by www.Geocities.ws

1