ModbusTCP write only

Hi all,

There is a problem writing some tags to a Modbus device.

Reading all goes OK, but there are tags which allows only writing.
On Tag Editor at Access Rights I can choose only Read Only, Read/Write and Custom
The Custom ones allows read/write according with roles.

Testing the tag in gateway, with the OPC Quick Client goes OK. There we have the [s][r][w] options.
Choosing the [w] option the tag get written just perfect.

On designer, choosing the read/write option the project will poll the tag using Function 3.
Capturing with the wireshark shows at Function 3 that specific tag we get response “Illegal data address”

So what can be done in order to just write only once to tags, without polling.

Thanks in advance
Marian

Seems posting makes you more keen into finding answers. :slight_smile:

One solution is not to create the tag at all, and use system.opc.writeValue script,
as to write only once into the OPC tag.

However, is there any other solution?

If you want to keep track of the last value written, consider creating a memory tag for this, using system.opc.write*() in the tag’s value change event. Then your application can use the tag like any other, without worrying about the underlying implementation’s limitation. You won’t be able to really trust the “read” value if anything else can write to the device, too, but it would be consistent within Ignition.

Thanks for info,

Keeping track of last value it’s a must. Having no feedback it’s not nice.
Next step is to ask the manufacturer why they do not allow reading these registers, also the
control philosophy behind the scenes, ie if I write 1 to reset a value, after resetting my 1 becomes 0 or stay 1 till I write 0.

In the Ignition Gateway, if you edit your Modbus device and under the advanced properties disable the “Span Gaps” do you still get the “Illegal data address”?

I know it’s not a direct answer to your question, but there might be something else going on giving the appearance of an illegal address being polled in response to the write. The default poll rate in Ignition is 1,000 ms (1 second) so it could be that the issue is not you write to it and get a weird response, but that the normal polling of the tags is attempting to read an unassigned Modbus address (this could be tested by increasing the poll rate to once every 10 or 20 or 30 seconds or by seeing if you get the illegal address without writing anything to the PLC.).

Disabling the “Span Gaps” option will increase the number of polls to a specific device if there are gaps in your addressing, but it should also prevent the illegal data address (assuming my guess is right, of course)

Span Gaps is not the issue here, it’s disabled anyway.
My poll rate is 5 sec with a timeout of 4 sec.

The issue is that that specific address allows only function 6 or 16, not 3.
Creating regular Ignition tags means they are polled at scan rate. If the address does not support function 3 the the Illegal data address kicks in.

One way I found is not to create Ignition tags at all for that addresses, just to use directly the system.opc.writeValue to write only once into the device. This goes OK so far.

I was just wondering if there is any other solution.

[quote=“allnet”]
One way I found is not to create Ignition tags at all for that addresses, just to use directly the system.opc.writeValue to write only once into the device. This goes OK so far.

I was just wondering if there is any other solution.[/quote]

I think this is your only option.

OK, thanks for info.

So we can consider the topic “Solved” :slight_smile:

All the best.

There’s a better option that you can use specifically for that tag or only a group of tags, instead of changing the behavior of the whole gateway. You have to create a scan class for this, mode Driven, all rate values at 0, and OPC Data mode set as Read. Don’t set Driven properties, and disable the OPC Read after write flag.
This way, when you write the tag value, only the write command is sent, no read back. The problem is that your values are going to stay in undefined state, null value and bad quality. Which, in your case, I think it’s fine. But if you want to keep a record of the value written to the controller, you have to use a memory tag as a placeholder.