Guys,
I am working through the control of my new inverters and batteries and have worked out the next stage of sending data to them in the correct format.
Basically it is a hex string such as
aa55c07f02390b070d04000006000005ff7f0425
The last two bytes are the checksum which are calculated by a simple addition of all the preceeding bytes.
In this instance the one value that will change is the 05 towards the end of the string and this could be any number between decimal 1 and 100
I could be calculating this every 10 seconds so should not be a big load on the PI
For this particular instance the string will remain the same length - but for some of the other functions it will vary.so i would like to write a generic checksum routine that i call at the end of each calculation
What would be the most effective way ? Read it into an array and cycle through all the elements in the array and add them from there ?
Craig