08.05.2019, 13:38
Hello All,
Can anyone please help me decoding a 1 byte object as mentioned below?
1-byte object to transmit and read out the error status of individual DALI operating devices connected to the system.
The following bit assignment is used:
Bit 0...5: Number of the DALI operating device (0...63)
Bit 6: Lamp error ("0" = No error, "1" = Error)
Bit 7: Electronic ballast error ("0" = No error, "1" = Error)
I could use the following code to get the status of the last two bits but I don't know how to convert the first 6 bits to integer and write the value to a virtual object.
Thank you in andvance.
Can anyone please help me decoding a 1 byte object as mentioned below?
1-byte object to transmit and read out the error status of individual DALI operating devices connected to the system.
The following bit assignment is used:
Bit 0...5: Number of the DALI operating device (0...63)
Bit 6: Lamp error ("0" = No error, "1" = Error)
Bit 7: Electronic ballast error ("0" = No error, "1" = Error)
I could use the following code to get the status of the last two bits but I don't know how to convert the first 6 bits to integer and write the value to a virtual object.
Code:
function getbit(value, nr)
value = bit.rshift(value, nr)
return bit.band(value, 1) == 1
end
value = event.getvalue()
grp.checkupdate('32/1/1', getbit(value, 6))
grp.checkupdate('32/1/2', getbit(value, 7))
Thank you in andvance.