sensus_heat_meter
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
sensus_heat_meter [2021/01/15 13:23] – emozolyak | sensus_heat_meter [2021/01/15 13:39] – emozolyak | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Sensus | + | ====== Sensus |
+ | {{ :: | ||
Sensus support M-bus specs. of EN 13757-3. | Sensus support M-bus specs. of EN 13757-3. | ||
Line 9: | Line 10: | ||
<code lua> | <code lua> | ||
- | function getCRC(a, | + | function getCRC(a, |
local sum = 0 | local sum = 0 | ||
local mask = 0xFF | local mask = 0xFF | ||
| | ||
- | for i = pos, pos+len-1 do | + | for i = pos, pos + len - 1 do |
sum = sum + a[i] | sum = sum + a[i] | ||
- | sum = bit.band(sum, | + | sum = bit.band(sum, |
end | end | ||
- | | + | |
return sum | return sum | ||
end | end | ||
Line 35: | Line 36: | ||
function readRegister (reg, device, unitId) | function readRegister (reg, device, unitId) | ||
- | app_reset[6] = unitId | + | app_reset[6] = unitId |
REQ_UD2[3] = unitId | REQ_UD2[3] = unitId | ||
SND_NKE[3] = unitId | SND_NKE[3] = unitId | ||
| | ||
- | app_reset[9] = getCRC(app_reset, | + | app_reset[9] = getCRC(app_reset, |
REQ_UD2[4] = getCRC(REQ_UD2, | REQ_UD2[4] = getCRC(REQ_UD2, | ||
SND_NKE[4] = getCRC(SND_NKE, | SND_NKE[4] = getCRC(SND_NKE, | ||
</ | </ | ||
+ | {{data_read.png|}} | ||
sensus_heat_meter.txt · Last modified: 2022/01/15 17:30 by 127.0.0.1