Description
Description-Separate-1The checksum generator is a sub vi that accepts a text and returns the checksum of the text
The following checksums are supported:
0: XOR of characters (8 bit)
1: Modulo 100h of sum of characters (8 bit sum)
2: LRC (8 bit), 256 - Modulo 100h of sum of characters
3: Modulo 10000h of sum of characters (16 bit sum)
4: MODBUS 16 bit CRC
Using the vi:
- Add the sub vi to your vi
- Call the sub vi with a text in String and specify type of checksum in Type where Type is a number from 0 to 4, see above
- Check Invert if you want to invert the checksum, that is negate all bits
- The sub vi outputs the checksum as a 2 byte (8 bit checksum) or 4 byte (16 bit checksum) hex number in the string Checksum hex. It also outputs the checksum as 1 or 2 ASCII characters in the string Checksum dec
You can add more checksum methods by expanding the outer case structure. If your checksum will include more than 16 bits you must add a case to the string conversion case on the right and let the case be called by the number of bytes in the checksum
An older version of the vi is used in my String inspector, https://forums.ni.com/t5/Example-Code/Inspect-strings-compute-and-add-checksums-add-non-printable/ta...
Description-Separate-2