此帖出自嵌入式系统论坛
最新回复
利用中断来,
bit ti_wait;
xdata unsigned char tibuf[TIBUFMAX];
int tirear,tibufcount;
//-----------------------------------------------------------------------------
void WrTiBuf(unsigned char c)
{
ES0 = 0;
tibuf[tirear] = c;
tirear++;
if(tirear == TIBUFMAX) tirear = 0;
if(tibufcount != TIBUFMAX) tibufcount++;
if(ti_wait)
{
ti_wait = 0;
TI = 1;
}
ES0 = 1;
}
//---------------------------------------------------------------------------------
void IntComm() interrupt 4
{
if(TI)
{
TI = 0;
if(tibufcount) S0BUF = RdTiBuf();
else ti_wait = 1;
}
}
//
想要发数据时只要调用: WrTiBuf(char);
详情
回复
发表于 2008-9-19 23:40
| ||
|
||
此帖出自嵌入式系统论坛
| ||
|
||
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
| |
|
|
| |
|
|
此帖出自嵌入式系统论坛
| ||
|
||
EEWorld Datasheet 技术支持