校验规则:
第一个字节与字节“00”异或,结果与第二个字节异或,以此类推,至最后一个字节,并将最后异或结果表达为16进制ASCII字符
例:
bn012000000000012008-01-15 20:42:3000c3@@@SO2,0,,BB,;NOx,0,,BB,;烟尘,0,,BB,;动压,0,,BB,;温度,0,,BB,;静压,0,,BB,;O2,0,,BB,;流速,0,;H2O,6.5,;流量,0,;过量空气系数,1,;SO2折算,0,;NOx折算,0,;烟尘折算,0,;SO2排放率,0,;NOx排放率,0,;烟尘排放率,0,;tek
其校验码为:20
Dim ChkXor = Encoding.Default.GetBytes(VerifyString)
Dim len As Integer = ChkXor.Length
Dim i As Integer
Dim ChkXorResult = "00"
Dim curByte As Byte
For i = 0 To len - 1
curByte = ChkXor(i)
If curByte <> 0 Then
ChkXor(i) = CByte(curByte Xor ChkXorResult)
End If
ChkXorResult = ChkXor(i)
Next i
Verify = Hex(ChkXorResult)
End Function