Download User`s Manual
Transcript
Appendices Checksum Calculation Method You can add a checksum to transmitted data. (The checksum cannot be added to a command or a response to a command.) Adding a checksum enables incorrect data translation to be detected in the RS232C communication. If the checksum does not match when the PASS/RTRY or ACK/NAK protocol is used, modify the program so that the “Request to resend” (RTRY or NAK) command is sent to the N-400. To set the checksum, use the “PROTOCOL SETUP” screen of the N-400 setup software. (The checksum cannot be added when the PLC link is used.) ■ Checksum calculation range and the position to add checksum The checksum calculation is performed with all characters except for the header and delimiter. The checksum is added immediately before the delimiter. CC = Checksum (Two ASCII code characters) • Data communication in multi-drop link mode Header % P mm – Read Data CC Delimiter Calculation range Result • Data communication in multi-head mode Header Read Data CC Delimeter Calculation range Result ■ Checksum calculation method Example: Appendices Appendix G Header % P 01 – AB12 CC Delimiter Calculate the checksum (CC) in the above example. Convert each character into the ASCII code as shown below, and express the result as 8-bit binary numbers. Calculate the “Exclusive-OR” of the binary numbers of each bit. Data % P 0 1 – A B 1 2 ASCII code (Hexadecimal) 25h 50h 30h 31h 2Dh 41h 42h 31h 32h * Based on the “Exclusive OR” logic, when an odd number of “1”s are present, the calculation result is “1”, and when an even number of “1”s are present, the calculation result is “0”. Binary 0010 0101 0011 0011 0010 0100 0100 0011 0011 0101 0000 0000 0001 1101 0001 0010 0001 0010 + 0101 1001 59h 135