請問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;
}
|