Changes

No change in size ,  09:30, 7 December 2017
Line 162: Line 162:  
[[File:Configuration examples modbus higher uptime example.png]]
 
[[File:Configuration examples modbus higher uptime example.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 the value of the second register: '''%MW1 * 65536 + %MW2'''. Which, following from the example above, would add up to '''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'''.  
    
However, while this works when calculating uptime values, it will not work for all parameters. The correct way to calculate the final values would be to first convert them to '''binary'''. As mentioned earlier in this chapter, a register holds 16 bits of information. 16 bits of information can be represented by a 16-digit long binary number. Following from the example above, the first register's value of 1 converted to binary would be '''0000 0000 0000 0001''' and the second register's value of 3067 would be '''0000 1011 1111 1011'''. You can easily convert numbers from one system to another using any online conversion tool:
 
However, while this works when calculating uptime values, it will not work for all parameters. The correct way to calculate the final values would be to first convert them to '''binary'''. As mentioned earlier in this chapter, a register holds 16 bits of information. 16 bits of information can be represented by a 16-digit long binary number. Following from the example above, the first register's value of 1 converted to binary would be '''0000 0000 0000 0001''' and the second register's value of 3067 would be '''0000 1011 1111 1011'''. You can easily convert numbers from one system to another using any online conversion tool: