資源簡介
韋根26與串口通訊程序,是門禁及停車場行業開發程序必備的知識

代碼片段和文件信息
#include?????
???
unsigned?char?CurrentData[4];???
???
void?Send_Char(unsigned?char);???
void?Send_Data(void);???
???
void?main?(void)???
{???
????SCON?=?0x50;???
????TMOD?=?0x21;???
????EA=1;
ET0=1;
EX0=1;
EX1=1;??
????TH0??=?0xEE;???
????TL0??=?0x0;???
????TH1??=?0xFD;???
????TL1??=?0xFD;???
????TCON?=?0x55;???
???
????while(1)???
????{???
????????if(Current?==?26)???
????????{???
????????????Current?=?0;???
????????????EA?=?0;???
????????????Send_Data();???
????????????EA?=?1;???
????????}???
????}???
}???
???
void?Ex0(void)?interrupt?0???
{???
????Data[(25?-?Current)?/?8]?&=?~(0x1?<((25?-?Current)?%?8));???
????TH0?=?0xEE;???
????TL0?=?0x0;???
????Current++;???
}???
???
void?Ex1(void)?interrupt?2???
{???
????Data[(25?-?Current)?/?8]?|=?0x1?<((25?-?Current)?%?8);???
????TH0?=?0xEE;???
????TL0?=?0x0;???
????Current++;???
}???
???
void?Timer0(void)?interrupt?1???
{???
????TH0?=?0xEE;???
????TL0?=?0x0;???
????Current?=?0;???
}???
???
void?Send_Char(unsigned?char?buf)???
{???
????SBUF?=?buf;???
????while(TI?==?0);???
????TI?=?0;???
}???
???
void?Send_Data(void)???
{???
????Send_Char(0x55);???
????Send_Char(Data[3]);???
????Send_Char(Data[2]);???
????Send_Char(Data[1]);???
????Send_Char(Data[0]);???
????Send_Char(0xAA);???
}?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1331??2009-04-11?15:28??wg26_rs232.c
?????文件????????813??2009-04-11?15:28??WG26_RS232.hex
?????文件???????4260??2009-04-11?15:28??WG26_RS232
-----------?---------??----------?-----??----
?????????????????6404????????????????????3
- 上一篇:ROS中smartcar機器人的描述文件
- 下一篇:pointCloud
評論
共有 條評論