User Tools

Site Tools


vedirect_protocol:faq

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
vedirect_protocol:faq [2020-07-20 13:09] – [2. Framehandler reference implementation] mbosmavedirect_protocol:faq [2020-07-20 21:25] – [Q8: How do I calculate the TEXT checksum?] mbosma
Line 79: Line 79:
 ==== Q8: How do I calculate the TEXT checksum? ==== ==== Q8: How do I calculate the TEXT checksum? ====
  
-I need to get data from a BMV, but how do I calculate the checksum?\\+I need to get data from a BMV, but how do I check the data integrityThe [[https://www.victronenergy.com/support-and-downloads/whitepapers|VE.Direct protocol]] mentions the modulo 256 sum; what is this?\\ 
 + 
 +**Answer:**\\
 Consider the following output: Consider the following output:
 <code> <code>
Line 113: Line 115:
 char message[] = { ... }; char message[] = { ... };
 for (int i = 0; i < message.length; i++) { for (int i = 0; i < message.length; i++) {
-   checksum +rxBuffer[i] & 255; /* Take modulo 256 in account */+   checksum = (checksum + message[i]& 255; /* Take modulo 256 in account */
 } }
  
vedirect_protocol/faq.txt · Last modified: 2023-03-31 12:04 by mvader

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki