Chapter 3 Creating and Editing Screens CHRCHKSUM (Calculate Data Length of Texts or Characters and Checksum) Equation Var1 = CHRCHKSUM (“Var2”, Var3, Var4) Explanation This command is used to calculate the data length of texts or characters and checksum. Var1 is the internal memory address that stores the text length of Var2. Var2 is the string of text. Var3 is the internal memory address that stores the checksum of Var2. Var4 is the data length of the checksum that stores in Var3. 1 represents Byte and 2 represents Word. Operation of checksum: Convert format of each data characters to ASCII code and add them up.
For example, convert ’2’ to ASCII code ‘31H’, convert ’4’ to ASCII code ‘34H’ and the checksum is 31Hex + 34Hex = 65H. Remark Var1 and Var3 can be internal memory only. Var2 can be a string of texts only. Var4 can be constant only. Example Calculate the data length of "24" and checksum $0 = CHRCHKSUM("24", $10, 2) After the above operation, 4 is stored in $0 and 4 represents the data length is 2 WORDS. The checksum stored in $10 is 65H. Revision May, 2010 3-361