利用中断进行的通讯:
void UART_Server(void) interrupt 4
{
if(TI == 0)
{
//deal with send function
}
if(RI == 0)
{
//deal with receive function
}
}
void T0_Server(void) interrupt 1
{
//deal with your step motor
}
void T0_Server(void) interrupt 1
{
//deal with your step motor
//adjust your T0 interrupt speed due to you step motor speed
}
void UART_Server(void) interrupt 4
{
if(TI == 1)
{
//deal with send function
}
if(RI == 1)
{
//deal with receive function
}
}
uchar crc = 0;//必须赋初值为0
for(i = 0; i < 512; i++)
{
GetCRC(g_TempState,&crc);
}//可以连续计算
crc =~crc;//结果要取反。
最后要说的是我用的是8210校验。
用户292630 2014-12-12 00:50
用户1053025 2006-9-25 17:01