沃芬血凝仪串口通讯所用ASTM协议的数据应该怎么计算校验和。
public List<byte[]> GetRetMsg(string data)
{
// 空字符串返回空
if (string.IsNullOrEmpty(data))
{
return null;
}
// 1.字符串转换成二进制数组
byte[] allByteArr = System.Text.Encoding.ASCII.GetBytes(data);
// 2.计算需要发送的消息次数
int byteArrMsgCount = (allByteArr.Length + 239) / 240;
// 返回消息的初始化
List<byte[]> retList = new List<byte[]>();
// 最后一条消息的长度
int maxLength = allByteArr.Length % 240;
// 3.根据消息数量循环产生消息数组
for (int i = 0; i < byteArrMsgCount; i++)
{
// 初始化消息数组
List<byte> tempByteArrList = new List<byte>();
// <STX>
tempByteArrList.Add(Encoding.ASCII.GetBytes(strSTX)[0]);
int checksum = 0;