#ifndef __COM_H__
#define __COM_H__
#define uchar unsigned char
#define uint unsigned int
#define XTAL 11059200
#define baudrate 9600
void sendmsg(uint ps)
{
SBUF = ps;
while(TI == 0);
TI = 0;
}
uint rcvmsg(void)
{
RI=0;
return SBUF;
}
void initcom(void)
{
TMOD = 0x20;
TH1=(unsigned char)(256 – (XTAL / (32L * 12L * baudrate)));
TL1=(unsigned char)(256 – (XTAL / (32L * 12L * baudrate)));
SM0 = 0; //串口作业方式操控
SM1 = 1; //串口作业方式操控 //这两个一起操控了串口作业方式为 0;
REN = 1; //串口接纳答应
PCON = 0x00;
TR1 = 1; //答应串口接纳
ES = 0;
}
#endif