我第一次接触串行通信,我必须通过java与带有手动通信协议的串行设备进行通信,我希望你们帮助我只了解重要的部分:命令部分
FORMAT : <command><size><data><checksum>
<command> : 1 byte type : CAPITAL LETTER from 'A' to 'Z'
<size> : 1 byte type : char between 0 and 255
<data> : String composed of <size> bytes : Format is depending on the command
<checksum> Calculated as follow : checksum = -(<command> + <size> + [b]E[/b](<data>(i))) modulo 0x100 ([b]E[/b] sum simbol)
Command example : 0x43,0x10,0x87,0x31,0x2E,0x35 (What this means in string format?)
CheckSum calculation :
0x43+0x10+0x87+0x31+0x2E+0x35 = 0x16E (How to sum this ?)
Then calcule it complement : -0x16E = 0xE92
Then : checksum = 0xE92 modulo 0x100 = 0x92