I am having problems getting some python code to properly calculate the checksums for the Elk serial protocol.
I have looked at the serial protocol document and the example C source code in the Appendix. I have also downloaded the ELK SDK so that I can verify what the SDK is calculating for a checksum vs my code.
The way I understand it the checksum is the sum of all of the decimal representation of the ASCII characters in the message taken mod256. That number is then taken as a twos complement.
Code below. Using a test string of 00300005000 the SDK outputs a checksum of 74 while the below outputs 19. Since the SDK doesn't include source I can see what their tool is doing. Does anyone here have some experience with this? Any pointers would be very appreciated.
Thanks