'//等待接收数据内容
Case revpakage:
'存在接收缓冲区
ReBuff(RevPtr) = SBUF
RevPtr = RevPtr + 1
CheckSum = CheckSum + SBUF
If RevPtr = Revlen Then
RevState = revcrc
End If
'//等待接收校验和
Case revcrc:
'取256的模数
CheckSum = CheckSum Mod 256
If CheckSum = SBUF Then
ComState = Com_revOK ';//接收正确
Else
ComState = Com_revCRCErr ';//接收错误
End If
RevState = revhead1 ';//状态机复位
End Select
If ComState = Com_revOK Then ';//接收正确
'处理串口接收的数据
Call ProcessRevData(Revlen)
ComState = Com_noreving '======================================================================谨记此句
End If