请问485尾码checksum 怎样计算 点击:1061 | 回复:2



保镖

    
  • 精华:0帖
  • 求助:0帖
  • 帖子:2帖 | 6回
  • 年度积分:0
  • 历史总积分:13
  • 注册:2003年1月11日
发表于:2003-08-10 17:53:00
楼主
Data format Each transmission block consist of the following bytes: 1. STX (02h) Start of Text 2. Address Pump address ‘00’ - ‘99’ ASCII, can be set on the pump 3. Data block ASCII symbol order according to command description 4. ETX (03h) End of Text 5. VRC Checksum Each receiver block consists of the following bytes: 1. STX (02h) Start of Text 2. Data block All data are in ASCII format 3. ETX (03h) End of Text 4. VRC Checksum The checksum is the last byte in a command string. All bytes (except the line synchronisation character and the checksum (VRC)) are linked to the XOR. The receiver of a message compares the transmitted checksum with the calculated checksum from the transmitted data; if the values are identical, the transmission is considered to be error-free. ?SI for Pump address 00: Command: #200?SI#3$ [$ = CHR(36)] Answer: #6#2KNF00#3B [B = CHR(66)] ? for Pump address 01: Command: #201?SI#3% [% = CHR(37)] Answer: #6#2KNF01#3C [C = CHR(67)] 我不会算checksum 啊,求救各位大侠!



microtomato

  • 精华:1帖
  • 求助:0帖
  • 帖子:84帖 | 1476回
  • 年度积分:0
  • 历史总积分:2078
  • 注册:2001年11月02日
发表于:2003-08-10 17:52:00
1楼
将所有字符的ASCII码取异或(XOR)即可。

microtomato

  • 精华:1帖
  • 求助:0帖
  • 帖子:84帖 | 1476回
  • 年度积分:0
  • 历史总积分:2078
  • 注册:2001年11月02日
发表于:2003-08-10 17:53:00
2楼
将所有字符的ASCII码取异或(XOR)即可。

热门招聘
相关主题

官方公众号

智造工程师