initial
This commit is contained in:
25
MeterbusTypeConversion.py
Normal file
25
MeterbusTypeConversion.py
Normal file
@ -0,0 +1,25 @@
|
||||
'''
|
||||
Created on 11.06.2015
|
||||
|
||||
@author: wn
|
||||
'''
|
||||
|
||||
|
||||
def bcd(data):
|
||||
v = ""
|
||||
for c in data:
|
||||
v += str((c & 0xf0) >> 4)
|
||||
v += str(c & 0x0f)
|
||||
return v
|
||||
|
||||
def manufCode(data):
|
||||
print("data: %s %s" % (hex(data[1]), hex(data[0])))
|
||||
v = data[1] * 256 + data[0]
|
||||
print("v: %s" % hex(v))
|
||||
l3 = chr((v & 0x20) + 64)
|
||||
print("l3: %s" % l3)
|
||||
l2 = chr((v >> 5) & 0x20)
|
||||
print("l2: %s" % l2)
|
||||
l1 = chr((v >> 10) & 0x20)
|
||||
print("l1: %s" % l1)
|
||||
return l1 + l2 + l3
|
Reference in New Issue
Block a user