I use the Modbus v2 driver, and in the manual there is no explication how to write to a single bit in a holding register in the PLC (Modicon compact A984-130).
Sorry, the user manual section is still talking about Modbus-v1.
To address a bit you create a SQLTag and in the OPC Item Path append a “.” and then the bit number you want to the normal address, for example:
Would address Holding Register 1, bit 3 on the device you have configured named “my_modbus_device”. You can also copy/paste/modify tags you’ve already dragged in from browsing (which are only available if you created an address map). You can then read and write to that SQLTag like normal.
Reading should work on any device, but writing requires that the device supports the MaskWriteRegister Modbus function code.
Reading a bit, that works fine, but write to a bit in the plc will not work.
I have the following error message :
Error writing “1” to tag V41201-V41260/V41215_10 StatusCode[Severity=Bad, Subcode=NotSpecified, 0x80
Any idea ?
If you look in your logs on the Ignition gateway, under Configure > Console > Logs tab, you will probably see an error message that says “Received response with ExceptionCode: IllegalFunction”.
If this is the case then your device does not support the MaskWriteRegister function code and you will not be able to write to individual bits atomically.
A work-around is to create some global scripting functions that read the value and perform some bit twiddling before writing the value back down, but this is not 100% safe because there’s no guarantee the value won’t change in the mean-time and you end up writing down a value that clobbers the change.
This is the error that I found in the system console:
0:21:47 SQLTags.TagProviders.Provider[default] [[default]V41201-V41260/V41215_10] Error writing to OPC address [[Ignition OPC-UA Server][PLC22]22.HR1215.10]. Result code: StatusCode[Severity=Bad, Subcode=NotSpecified, 0x80000000]
0:21:47 ModbusDriver2.PLC22.MaskWriteRegisterRequest Error reading response at field “Register Values”. Buffer=[15 EB 00 00 00 03 16 96 01 ].
I’m guessing you’re using a version prior to beta5, which did not give as helpful of error messages, but what you’re seeing is indeed the device responding with an IllegalFunction ExceptionCode, meaning MaskWriteRegister requests are not supported.
I use Ignition version 7.2.7 (b170). The Modbus v2 is version 2.2.0 (b0).
The PLC is a Modicon 984-130, the communication go’s over Ethernet via a Modbus to Ethernet bridge (174 CEV 300 10). I thought that with this combination it must be possible to write to individual bits in a holding register. But it’s not so.
For write to a bit I will use the specific script for it. Somewhere on this forum I read about it.
You should definitely upgrade your Modbus v2 driver to the latest version. It’s available on the development downloads page: inductiveautomation.com/down … evelopment
I did the update for ignition and Modbus v2. Now I can not configure a device because there is no driver module from modbus to find. I see Siemens, Allen Bradley, … etc but no Modbus.
Uh-oh. There shouldn’t be any problems using Modbus v2 beta 5 on a 7.2.7 gateway. Can you find your wrapper.log file(s) and email them to firstname.lastname@example.org? On a default install they can be found in C:\Program Files\Inductive Automation\Ignition.
One thing you might try in the mean-time:
- Shut down Ignition
- Open the modules folder. On a default install, this is C:\Program Files\Inductive Automation\Ignition\contexts\main\modules
- Delete any Modbus modules you find there.
- Place the new Modbus-v2 .modl file you downloaded here.
- Start Ignition.
There were some compatibility issues between the earlier and later betas that may be causing the problem.