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

TOPIC: Modbus_Module WriteSingleCoil

Re:Modbus_Module WriteSingleCoil 13 years 10 months ago #755

  • 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.

Re:Modbus_Module WriteSingleCoil 13 years 10 months ago #756

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
Hi Ondrej,

The ChanDo object has a Number attribute that for Modbus TCP specfies the bit number. If you number your channels from 0 to 7 witih representation Bit8 they will be packed into one byte.

/Claes
The administrator has disabled public write access.

Re:Modbus_Module WriteSingleCoil 13 years 10 months ago #757

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

the bit numbering was indeed the problem. I thought I had tried that already but apparently I hadn't. Numbering the ChanDo objects from 0 to 7, the corresponding outputs are set correctly.

In order to read or write 16 digital outputs I still have to use Bit8 as representation and restarting the numbering at 0 for the ninth ChanDo/ChanDi object. Using Bit16 does not give the desired result as it swaps the Hi and Lo byte.

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