This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

16bit to 1byte
#3
If your modbus device is using full 16-bit range [0..65535], you can use bit shift to discard lowest 8 bits:
Code:
value = bit.rshift(value, 8)
grp.write('1/1/1', value, dt.uint8) -- force value range to [0..255]

Also, I would suggest using profiles instead of scripts.
Reply


Messages In This Thread
16bit to 1byte - by duvelken - 16.08.2016, 18:59
RE: 16bit to 1byte - by MarkVersluis - 16.08.2016, 20:36
RE: 16bit to 1byte - by admin - 17.08.2016, 06:16

Forum Jump: