Changes

Line 160: Line 160:  
The values are returned in decimal and, if you add '''-D''' to the command, hexadecimal forms. Sometimes the answer is self-explanatory as in the example above. But, since a register only hold 2 bytes (16 bits) of information, the value stored in a register can't be higher than '''65535 (2<sup>16</sup>)'''. So what happens if the router's uptime is higher than that? Lets examine another example where the router's uptime is higher than 65535:  
 
The values are returned in decimal and, if you add '''-D''' to the command, hexadecimal forms. Sometimes the answer is self-explanatory as in the example above. But, since a register only hold 2 bytes (16 bits) of information, the value stored in a register can't be higher than '''65535 (2<sup>16</sup>)'''. So what happens if the router's uptime is higher than that? Lets examine another example where the router's uptime is higher than 65535:  
   −
[[File:Configuration examples modbus higher uptime example.png]]
+
[[File:Configuration examples modbus higher uptime example_v2.png]]
    
When the value climbs over 65535 the counter resets and the value held by the first register increases by 1. So one way to interpret the results would be to multiply the value in the first register by 65536 (2<sup>16</sup>) and add it to the value of the second register: '''%MW1 * 65536 + %MW2'''. Which, following from the example above, would be: '''1 * 65536 + 3067 = 68603 s''' or '''19 hours 3 minutes 23 seconds'''.  
 
When the value climbs over 65535 the counter resets and the value held by the first register increases by 1. So one way to interpret the results would be to multiply the value in the first register by 65536 (2<sup>16</sup>) and add it to the value of the second register: '''%MW1 * 65536 + %MW2'''. Which, following from the example above, would be: '''1 * 65536 + 3067 = 68603 s''' or '''19 hours 3 minutes 23 seconds'''.  

Navigation menu