
For example, the following function shows how we can initialize the serial port
for 2400 baud operation:
void serial_init()
{
SCON=0x50;
TMOD=0x20;
TH1=0xF3;
TR1=1;
TI=1;
}
PROJECT 22 ± Output a Simple Text Message from the
RS232 Port
Function
This project shows how we can interface our microcontroller to an external
RS232 compatible device (e.g. an RS232 visual display unit, or COM1 or
COM2 port of a PC) and send a text message to this device. The text message
`THIS IS AN RS232 TEST MESSAGE' is sent out continuously from the
microcontroller. The frame format used in this project is 2400 baud, 8 data
bits, no parity, and 1 stop bit.
151
RS232 Serial Communication ...