i'm attempting create lua program monitor periodic status pings of slave device. slave device sends status in 16-bit hexadecimal words, need convert binary string since each bit pertains property of device. can receive input string, , have table containing 16 keys each parameter. having difficult time understanding how convert hexadecimal word string of 16-bits can monitor it. here basic function of i'm starting work on. function slave_status(ip,port,name) status = path:read(ip,port) stable = {} if status stable.ready=bit32.rshift(status:byte(1), 0) stable.paused=bit32.rshift(status:byte(1), 1) stable.emergency=bit32.rshift(status:byte(1), 2) stable.started=bit32.rshift(status:byte(1), 3) stable.busy=bit32.rshift(status:byte(1), 4) stable.reserved1=bit32.rshift(status:byte(1), 5) stable.reserved2=bit32.rshift(status:byte(1), 6) stable.reserved3=bit32.rshift(status:byte(1), 7) stable.r...
Comments
Post a Comment