Logic Machine Forum
setup modbus tcp slave - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: setup modbus tcp slave (/showthread.php?tid=1232)

Pages: 1 2


RE: setup modbus tcp slave - admin - 01.03.2018

You can use HTTP(s) / remote services. Using BACnet for this has no advantages.

Option 1: Create an event script mapped to a certain tag that will send values via grp.update call on other LM. This way no polling is needed.

Options 2: Use polling by requesting exported object list from another LM. Go through that list and use grp.checkupdate to update local values. This might save some resources if very frequent update is not needed.


RE: setup modbus tcp slave - fabiorusco - 07.05.2018

Hello,
I try to use the script:
https://forum.logicmachine.net/showthread.php?tid=181
but not everytime I can connect with HL.
If I need canghe the modbus mapping start with 100 how I must modify the script.
Thank you


RE: setup modbus tcp slave - admin - 07.05.2018

Make sure that the client connections are closed properly. There's a limit on active connections to modbus TCP slave.

Mapping will always start from 0. You can specify mapping like this (+1 is need because Lua table start from 1, modbus addressing starts from 0):
Code:
registers = {}
registers[ 100 + 1 ] = '1/1/1' -- mb register 100
registers[ 101 + 1 ] = '1/1/2' -- mb register 101

Since mapping table will not be a continuous array, you will have to set mapping like this:
Code:
mb:setmapping(table.maxn(coils), 0, table.maxn(registers), 0)



RE: setup modbus tcp slave - fabiorusco - 09.05.2018

(07.05.2018, 11:30)admin Wrote: Make sure that the client connections are closed properly. There's a limit on active connections to modbus TCP slave.

Mapping will always start from 0. You can specify mapping like this (+1 is need because Lua table start from 1, modbus addressing starts from 0):
Code:
registers = {}
registers[ 100 + 1 ] = '1/1/1' -- mb register 100
registers[ 101 + 1 ] = '1/1/2' -- mb register 101

Since mapping table will not be a continuous array, you will have to set mapping like this:
Code:
mb:setmapping(table.maxn(coils), 0, table.maxn(registers), 0)

With this script it is possible manage  lux value (DPT 9.004) and counter value (DPT 12.001)? How I can do it?


RE: setup modbus tcp slave - admin - 09.05.2018

There's a work-around on how to implement float16<>float32 conversion:
https://forum.logicmachine.net/showthread.php?tid=181&pid=833#pid833

Same goes for uint32 and similar values.

If you do not need to change these values from modbus side then you only need a single script per each value that will split 32 bits into two 16-bit values.


RE: setup modbus tcp slave - fabiorusco - 09.05.2018

I need convert in dt.int16 the datapoint lux value (DPT 9.004):
MEEEEMMM MMMMMMM
FloatValue = (0,01*M)*2(E)
E = [0 … 15]
M = [-2 048 … 2 047], two’s complement notation
For all Datapoint Types 9.xxx, the encoded value 7FFFh shall always be used to denote invalid data.