Wonderware & Modbus write multiple coils

Rob.Hill

Member
Join Date
Dec 2009
Location
Yorkshire
Posts
47
Hi,
I've used modbus quite extensively in the past - but always based around reading holding registers and setting the odd coil.

I've now got an application that requires multiple coils to be written at once. Question is how to address multiple coils within intouch? Is there a way to 'wrap around' the discrete coils into a word for e.g.?

Thanks

Rob
 
Hi,

The MODBUS protocol does have a function code (15) to force multiple coils.

I found WW tech note 180.

It reads, "If any consecutive addresses ... the Modbus server may send this function code to the end device."

So, it looks like it "might" be possible.

I would check with WW support.
 
Cheers for the reply. I have raised a support call (a week ago) but the response has been very vague, with no real guidance of how to achieve it in intouch. I still have a support case open, but am not holding my breath!
 
Hi Rob,

What is your application connecting to PLC? IOserver?

We normally bitstrip and bitpack discrete signals for comms between HMI and PLC layer but you would need to unpack/pack them within your partner controller.

Rheinhardt
 
Hi Rheinhardt,

Do you mean what IO server am I using? its DASMBTCP 2.0

The end device isn't a conventional PLC, but an embedded software controller. Can't really tell you much more about it as its what the client manufactures in house - they just want me to sort the wonderware side.

Am I understanding right that the bit packing/ unpacking is managed automatically within the IO server?

Thanks for the help

Rob
 
No any unpacking/packing has to be coded. If the software controller you are connecting with has the ability to take a WORD and convert it to bits that is the way i would go. I would then use the bits within the word.

TagWord.00 = DiscreteCoil1 (in Controller)
Tagword.01 = DiscreteCoil2
........
Tagword.15 = DiscreteCoil16

This is how i normally set up comms . I have a rule that no bit level communication should happen betweren my HMI and controller. Is just a method of optimizing communication via the DAS.

So this way you can pack the discrete and transfer them in a single word.
 
Last edited:
Great stuff.

So am I right in thinking that there is no Modbus standard that defines the word which encompasses the coil bits? I.e. we could use a holding register for example & get the embedded controller to unpack this register to the 16 discrete coils?

Thanks
 
there is no Modbus standard that defines the word which encompasses the coil bits?
The Modbus standard does define a format for function code 01, read coils, where the up to 16 coils are bit packed into a 16 bit data word which occupies one Modbus register.

Quote from a Modbus standard, MODBUS Application Protocol Specification V1.1b

----------------------------
6.1 01 (0x01) Read Coils
This function code is used to read from 1 to 2000 contiguous status of coils in a remote device.

The Request PDU specifies the starting address, i.e. the address of the first coil specified, and the number of coils. In the PDU Coils are addressed starting at zero. Therefore coils numbered 1-16 are addressed as 0-15.

The coils in the response message are packed as one coil per bit of the data field. Status is indicated as 1= ON and 0= OFF. The LSB of the first data byte contains the output addressed in the query. The other coils follow toward the high order end of this byte, and from low order to high order in subsequent bytes.

If the returned output quantity is not a multiple of eight, the remaining bits in the final data byte will be padded with zeros (toward the high order end of the byte). The Byte Count field specifies the quantity of complete bytes of data.
---------------------

Unpacking the register word is the task of the slave or Master, depending.

Some PAC's use an entire integer or floating point holding registers to indicate the status of a ooil or discrete input register, which wastes lots of bits but with ethernet comm, the loss isn't terribly noticeable.

I.e. we could use a holding register for example & get the embedded controller to unpack this register to the 16 discrete coils?
If you have the ability in the embedded controller to unpack, then yes, use a holding register and unpack it for the 16 coils.
 
Thanks for the reply. Therefore it appears I have 2 ways forward:
1. write to a holding register & let the end device unpack the bits to the relevant set of coils (if the controller can do this)
2. Use Modbus functions 01 to read & 15 to write multiple coils, which look like you specify the 1st coil address, then the number to be read/ written.

So if I wanted (or am forced because of the possible controller limitations) to use the 2nd option - does anyone know how I would do this in intouch?

Thanks
 
I think it would come down to how you set the address of the Intouch tag for the coil.
Have seen devices similar, that decide on the function code based on the address format.
Not completely sure about Intouch yet as don't have access to manuals just now.
 

Similar Topics

Hello, I am attempting to add some IO Discrete tags to a AVEVA InTouch project (version 2020). These tags use the MBTCP driver and attempt to map...
Replies
1
Views
1,201
So I am trying to access data from an Eaton PXG900 Power gateway with Wonderware. The gateway can be polled for data by Modscan and does provide...
Replies
3
Views
2,865
I'm creating a new HMI to communicate with a Yaskawa controller. I started adding some of the values to the screen from the 4XXXXX registers and...
Replies
2
Views
2,439
Hello I'm trying to read a register from a Modbus device into Wonderware System Platform. In object viewer it shows the status of being "Good"...
Replies
1
Views
1,922
I about to upgrade all of my computers in the plant to windows 7 machines. My problem is that some of them are running Wonderware with Modbus Plus...
Replies
0
Views
1,466
Back
Top Bottom