User Tools

Site Tools


sensus_heat_meter

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
Last revisionBoth sides next revision
sensus_heat_meter [2021/01/15 13:23] emozolyaksensus_heat_meter [2021/01/15 13:39] emozolyak
Line 1: Line 1:
-====== Sensus Gmbh heat meters with M-bus ======+====== Sensus GmbH heat meters with M-bus ====== 
 +{{ ::for_wiki_.png?200|}}
  
 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,pos,len)                                         -- GetCRC посчитать контрольную сумму+function getCRC(a,pos,len)                                         -- GetCRC 
     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,mask)+        sum = bit.band(sum, mask)
     end      end 
-                                                                    DEBUG("CRC sum in the end of function = "..tostring(sum))+                              DEBUG("CRC sum in the end of function = "..tostring(sum))
     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, 5, 4)                            -- теперь поставить контрольные СУММЫ+    app_reset[9] = getCRC(app_reset, 5, 4)                            
     REQ_UD2[4] = getCRC(REQ_UD2, 2, 2)     REQ_UD2[4] = getCRC(REQ_UD2, 2, 2)
     SND_NKE[4] = getCRC(SND_NKE, 2, 2)     SND_NKE[4] = getCRC(SND_NKE, 2, 2)
 </code> </code>
 +{{data_read.png|}}
  
sensus_heat_meter.txt · Last modified: 2022/01/15 17:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki