Modbus Integration Kit Question

I have been playing around with the Modbus Integration Kit and have a question. The integration kit appears to indicate that you can "read’ ReadInputRegisters, ReadCoilRegisters, ReadHoldingRegisters. I admit I am new to all this but what about writing to the modbus via the integration kit. If i missed this I apologies up front but can someone share how to do this?

It’s been a while since I have used the kit.
@philip is a lot more up to speed on it than I am.
In the directory that the tool kit unzips into there is a doc.
It has this suggestion for your question…

Yes there are subs to write as well. They start with “Force” for coils or “Preset” for registers.

1 Like

Here is an example simple Modbus Master Strategy.

It sets the comms handle for a serial port in the Epic, but the modbus subroutines are written so you define the coms handle before using them, so it works the same if it is modbus TCP, just change the comms handle.
Epic Serial: “@Outlet:baud=9600,parity=n,data=8,stop=1”
Here are a few other examples from the kit:
//For a serial Modbus device using controller port: SetCommunicationHandleValue(“ser:0,9600,n,8,1”, chModbusMaster);
//For a serial Modbus device using SCM Module: SetCommunicationHandleValue(“tcp:192.168.1.226:22500”, chModbusMaster);
//For an Ethernet Modbus device: SetCommunicationHandleValue(“tcp:192.168.1.2:502”, chModbusMaster);
//For more information about communication handles, please see Form 1700 PAC Control User’s Guide.

The example loads the table that defines the protocol details being loaded.
It shows a read example and a write example.

Disclaimer on the variable names - I hacked apart a working project and changed the names to protect the innocent.
It is in Pac Control 10.3 BasicSimpleModbus.R10.3c.Basic.Archive.D02182021.T182005.zip (32.4 KB)

1 Like

Thank you so much. This defiantly helps with context.