Monday, February 28, 2011

7.3 Receiving characters

Hello Readers:

I have started this blog to show you Embedded C programming for 8051 family microcontroller using KEIL compiler. The KISS philosophy is used to write this tutorial. What is KISS? Keep It Simple, Stupid!

7. Serial Port Interface

This section teaches you how to send data and receive data from personal computer through serial port.

7.3 Receiving characters

This program is used to receive the characters sent by PC or other device through serial cable. Since LCD is used to display the received characters, LCD modules are inserted in this program. 

Start KEIL V4.01 and close projects, if any are open. Now start new project with Device -> Generic->8051 [all variants] for general 8051 family target chip. Add a new text file, name it Pgm_73.C and add it to above created project as a source file. It is time to add code to Pgm_73.C, so type below shown code in it.


 
Code explanation: This program is better understood by referring flow chart diagram closely.
Below is the flow chart diagram of program PGM_73.C.

 
After typing the code, press F7 or click Project->Build Target for building the source code. If there are no typical errors file will build successively and shows zero errors and zero warnings. No need to enter into debug mode as serial data receiving provision is not provided in this program.

If you generate HEX file of this program, burn it into your target chip’s memory using suitable uploader and connecting chip to PC with the help of serial cable you can watch received character sent by PC’s Hyper Terminal to chip on LCD. To stop running the program press red ‘x’ mark icon or click Debug->Stop.

To get back the compile mode press Ctrl+F5 or click Debug->Start/Stop Debug Session menu.   

<End of 7.3   Receiving characters >
 
...till next post bye-bye & take care.

No comments:

Post a Comment