请问STC89C52在处理速度上和STC11有什么差距吗?我有一份模拟串口代码可以在STC11上运行,放在STC89C52上就不行了
void timer0(void) interrupt 1
{
//TR0 = 0;
//TL0=0x00;
TH0 = 0xd8; // 1/90秒
g_ReceDlyCnt ++;
g_MsgDlyCnt ++;
if((g_MsgDlyCnt%30)==0)
{if(LED)
LED= 0;
else
LED= 1;
}
}
uint8 receiveFromCoderTwo() //从模拟口接收数据
{
uint8 result;
//对于接收第一个字节的后续字节需要同步等待
g_ReceDlyCnt = 0;
ET0=1;
if(RXD2)//等待起始位
{
//接收第一个字节的后续字节
while(1)
{
if(RXD2==0)
{
ET0=0;
break ;
}
if(g_ReceDlyCnt>9)
{
return 0;//超时
}
}
}
ET0=0;
ACC=0;
CY=0;
#pragma asm
MOV R3,#120 ;1
DJNZ R3,$ ;240
MOV R2,#8;
Rec_8Bits2:
MOV R3,#255;1
DJNZ R3,$;510
MOV R3,#28 ;1
DJNZ R3,$ ;62
NOP ;1
MOV C,RXD2;2
RRC A;1
DJNZ R2,Rec_8Bits2;2total 576
MOV R3,#255 ;1 //停止位
DJNZ R3,$ ;510
MOV R3,#27 ;1
DJNZ R3,$ ;54
#pragma endasm
result=ACC;
ET0=1;
return result;
}
|