Advanced Modbus Driver , Modbus Slave RTU

I’m trying to send data to a Modbus RTU (RS485) slave using the Advanced Modbus Driver.

I’ve completed the configuration and started testing, but I’m not receiving any data.

Now that all the above setup is complete, I need to map tens of thousands of words from source tags to Modbus tags.
Is there an efficient or recommended method for handling this large-scale mapping?

I recommend using the Integration Toolkit's RePublish tag action to attach the target OPC Item Path directly to the source tag. (In this approach, you don't need Ignition tags for the Modbus registers.)

As for making the assignments, consider including these tag properties in your UDTs, if any, and scripting the writes to these tag properties for atomic tags.

1 Like

"Thank you, pturmel, for your prompt response. I'd like to confirm if the above configuration is correct, and if there are any additional settings I should consider."

I don't see anything wrong with your configuration, but I have no way to know if it is correct for your hardware.

I have tested the hardware using Modbus Poll as a slave, and I am receiving data correctly. I would like to receive data using the following settings, but it is still not working. The manual only provides the settings shown below, so I am unsure how to proceed. Can you explain the setup process from the beginning with images?

Settings:

  • Baudrate: 19200
  • Data bits: 8
  • Stop bits: 1
  • Parity: None
  • COM Port: 11
    This test must be completed before proceeding to the next step.

Your hardware is sending a function code that isn't in the list of function codes supported by my driver.

"I've reset all the settings and started over from the beginning, but the same issue still occurs. Do I also need to enable Modbus Gateway Support in addition to these settings?"

this Configuration

ignition device setting

If I complete just this configuration, should the Modbus server be activated and ready to send and receive data with the client through COM11?

"While testing, I found that communication only works when the parity is set to 'odd'; it doesn't work with 'none' or 'even'. Why could that be?"

"When configured with 'odd', we observe that about 1 in 5 communication attempts fails. Is there a way to improve this issue?"

Serial communications require matching parity on both ends. Your device must be using Odd parity. Which is strange, as that is optional in the Modbus standard (devices must support even parity). When using no parity, the link must use two stop bits instead of one. (See the serial line Modbus standard at modbus.org.)

This is almost always caused by physical interference (particularly if running RS232 wires more than a few feet). The protocol performs CRC16 checks on each message and discards corrupted messages. This can usually be improved by reducing the baud rate.

I've noticed this, and it's interesting because I'm willing to bet most people are using 8N1 instead of 8N2, if for no other reason than I think that's the default for our driver (and for most serial stuff I've seen?). I wonder why it still works...

Because it only distorts the timing criteria a little, in a generally good direction. But if you are only timing across an entire message, instead of per character, you could allow a gap that should have been rejected.

I default to 8E1, because that is the default in the standard.

How to Use RePublish and queueUtil.py in Ignition?

Does this look correct?

1 Like

I found in the forum that configuring it as shown below successfully writes values to the Modbus address.

  1. The values are written correctly, but I’m seeing the following warning message.
    What should I configure to clear or eliminate this message?
org.python.core.PyException: TypeError: 'com.inductiveautomation.ignition.common.script.ProjectScriptModule' object is not callable

at org.python.core.Py.TypeError(Py.java:234)

at org.python.core.PyObject.__call__(PyObject.java:396)

at org.python.core.PyObject.__call__(PyObject.java:461)

at com.automation_pros.simaids.gateway.actors.BulkScriptBatcher.deliver(BulkScriptBatcher.java:51)

at com.automation_pros.simaids.gateway.actors.AbstractBatcher$Processor$2.run(AbstractBatcher.java:110)

at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:550)

at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  1. Do I need to include the following code in the valueChanged script for each tag?
    RePublish.enqSlavePublish(tag, tagPath, previousValue, currentValue, initialChange, missedEvents)

  2. Do I need to include the following code in the gateway event timer script?
    RePublish.drainSlavePublish()

If it is required, how can I determine an appropriate timer delay value?

Thank you for your kind answer.

  1. You enabled the BulkScript action with an invalid function name. Turn this back off
  2. No.
  3. No.

The RePublish and BulkScript action are independent of each other. The RePublish action works without any scripting.

1 Like

pturmel!
The previous issue has been resolved.
Is there a method to exclude a certain group of tags from being written to the Modbus slave while the system is operating normally?

Only tags that have the Tag Actions configured on them will be forwarded to the modbus slave device(s). If necessary, write to RepublishEnabled as needed at runtime.

Can I enable or disable based on a specific tag as a trigger?