Download Print this page

STC micro STC8A8K64D4 Series Reference Manual page 865

Advertisement

STC8A8K64D4 Series Manual
if (Counter100-- == 0)
{
Counter100 = 100;
if (TimeOut) TimeOut--;
}
}
// Serial port interrupt service routine
void uart(void) interrupt 4
{
static WORD RecvSum;
static BYTE RecvIndex;
static BYTE RecvCount;
BYTE dat;
if (TI)
{
TI = 0;
UartBusy = FALSE;
}
if (RI)
{
RI = 0;
dat = SBUF;
switch (UartRecvStep)
{
case 1:
if (dat != 0xb9) goto L_CheckFirst;
UartRecvStep++;
break;
case 2:
if (dat != 0x68) goto L_CheckFirst;
UartRecvStep++;
break;
case 3:
if (dat != 0x00) goto L_CheckFirst;
UartRecvStep++;
break;
case 4:
RecvSum = 0x68 + dat;
RecvCount = dat - 6;
RecvIndex = 0;
UartRecvStep++;
break;
case 5:
RecvSum += dat;
RxBuffer[RecvIndex++] = dat;
if (RecvIndex == RecvCount)
break;
case 6:
if (dat != HIBYTE(RecvSum))
UartRecvStep++;
break;
case 7:
if (dat != LOBYTE(RecvSum))
UartRecvStep++;
break;
UartRecvStep++;
goto L_CheckFirst;
goto L_CheckFirst;
- 849 -

Advertisement

loading
Need help?

Need help?

Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin