Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Modbus_Module WriteSingleCoil

Modbus_Module WriteSingleCoil 13 years 11 months ago #748

  • Maden
  • Maden's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 86
  • Karma: 0
Hello,

I have an I/O card that communicates with ProView via Modbus-TCP. I managed to read Coils (FC1), Discrete Inputs (FC2), Holding Registers (FC3) and Input Registers (FC4). Also Write Single Register (FC6) works fine.

The problem is that I cannot get Write Single Coil (FC5) to work. In the node hierarchy I use ChanDo objects under the Modbus_Module which is set up with FunctionCode=WriteSingleCoil and Continous=Yes.

In the Plant Hierarchy I have Do objects connected to the ChanDo objects. At runtime I set the ActualValue of the Do object to 1 but SigValue remains 0 and the I/O card doesn't receive the comand.

Am I doing something wrong?

Ondrej
The administrator has disabled public write access.

Re:Modbus_Module WriteSingleCoil 13 years 11 months ago #749

  • robert
  • robert's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 178
  • Karma: 7
Hi Ondrej,

I think you have encountered a bug that is fixed now but maybe not in your version. First of all you should only configure a single ChanDo under this Module. The bug is that it didn't handle all the representations. I think default for a chando is Int32. Please try with Int16 instead.

/Robert
The administrator has disabled public write access.

Re:Modbus_Module WriteSingleCoil 13 years 11 months ago #750

  • Maden
  • Maden's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 86
  • Karma: 0
Hi Robert,

you are right, only some representations are supported. I tried all available representations and in my case only Bit8, Bit16 and Bit32 work.

I have 16 digital outputs and configuring a single ChanDo under the Modbus_Module I can command the first output. Adding more ChanDo's will always command only the first output. Is there a workaround to address also the remaining signals with the current 4.7 release ?

Ondrej
The administrator has disabled public write access.

Re:Modbus_Module WriteSingleCoil 13 years 11 months ago #751

  • Maden
  • Maden's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 86
  • Karma: 0
A similar problem exits for Write Single Register (FC6). Configuring 2 ChanAo objects with representation UInt16 under the Modbus_Module, only the first channel is written correctly. The second channel is never written to.

Another bug ?

Ondrej
The administrator has disabled public write access.

Re:Modbus_Module WriteSingleCoil 13 years 11 months ago #752

  • robert
  • robert's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 178
  • Karma: 7
Hi Ondrej,

These function codes both generate one message for each single coil/register that needs to be written. You will have to add one Modbus_Module for each single coil/register.

/Robert
The administrator has disabled public write access.

Re:Modbus_Module WriteSingleCoil 13 years 11 months ago #754

  • Maden
  • Maden's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 86
  • Karma: 0
Hi Robert,

ok, that was my mistake, of course. By replacing the WriteSingleRegister with WriteMultipleRegisters function code I could resolve the problem with the analog outputs.

For the digital outputs however, using function code WriteMultipleCoils for a Modbus_Module with 8 ChanDo objects (each with representation Bit8) underneath gives me the Status \"IllegalDataValue\" at runtime.

ProView sends 1 byte (Bit8) for every coil to be set. Instead the Modbus protocol specifies only 1 bit for every coil, so in our case the slave expects just one byte of data and this probably causes the error.

Can you have a look into this please?

Thanks, Ondrej
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 8.260 seconds