How do I access individual Bits of a DINT?

I have a need to access individual Bits of a DINT tag on a ControlLogix PLC From Ignition.

In the RSLogix environment you simply add .0 (or whatever bit you want) to the end of the tag.

What is the correct syntax for this using the IgnitionOPCUA driver?

Hi,

In the item path, inside of the square brackets that enclose the device name, you can add “,bit=X”. For example, if I have a SLC 5/05 device named “SLC”, I might have something like:

[SLC,bit=0]N7:0

Regards,

Thanks Colby, just what the doctor ordered.

It even works with ControlLogix PLCs :smiley:

Peter

Yes, this syntax is implemented at the server level in Ignition, and should work with all drivers. Individual drivers might choose to implement their own syntax, if it would provide some benefit like better performance or better familiarity, but this syntax should always work.

Regards,

How about writing to individual Bits??
Using the same format as Reading (i.e. ,bit=X)
I tried this:

i=2
system.opc.writeValue("IgnitionOPCUA","[TESTSLC500,bit=%d]N7\N7:3"%i,1)
#where TESTSLC500 = Simulator PLC

What happens is that N7:3 is set to 1 when I expected it should be set to 4 (assuming it was zero initially.)
Do I need to read the tag “OR” the appropriate Bit & Write to the whole tag? Or is there a better way?

While the bit=X syntax can be used for all drivers, it is a read-only operation.

MicroLogix, PLC-5, and SLC can all address the bit for read/write using the following “slash” notation:

[SLC]N7:0/0 would be bit 0
[SLC]N7:0/1 would be bit 1

etc…

Otherwise yes, you’ll have to read/OR/write.

1 Like

Thanks :frowning:

Is there any Plan to allow writes to ControlLogix family PLC’s in a similar manner?
We make extensive use of binary-weighted DINT tags & this means twice as many “round trips” for each bit we write.

So what would happen if you tried [someopcname,bit=0]B3:0/0. Would the world implode upon itself?

Possibly. Be careful.

[quote=“ISDProj”]Thanks :frowning:

Is there any Plan to allow writes to ControlLogix family PLC’s in a similar manner?
We make extensive use of binary-weighted DINT tags & this means twice as many “round trips” for each bit we write.[/quote]
After some discussion we are going to make some changes that allow the bit=X filter to be used for read/write. You should see it in the next update or two.

Thanks for the update Kevin.
Any idea about “how long” before we can get one of those Updates with it in?
I’m just about at the point of rolling out a new app that really needs this functionality & I’d hate to have to write it one way for “testing” then change it once we go-live. :open_mouth:

Peter

The “bit=X” notation has no advantage over the “slash” notation, so this shouldn’t be a roadblock issue. - you can use the slash notation now with no need to ever convert it into the “bit=X” notation

Carl, Does the “Slash notation” work with ControlLogix PLC’s?

I was under the impression that it was only for SLC & PLC style processors.

[quote=“ISDProj”]Carl, Does the “Slash notation” work with ControlLogix PLC’s?

I was under the impression that it was only for SLC & PLC style processors.[/quote]

Slash notation only works on MicroLogix, PLC-5 and SLC-505.

For ControlLogix you can currently use bit=X to read, and will soon be able to read/write.

Currently there is no support in the ControlLogix driver for accessing bits of a DINT.

The solution to this is use an Alias tag in the ControlLogix and will work with other data types beside DINT. See the attached image for details of how to add an Alias tag.

[quote=“Kevin.Herron”][quote=“ISDProj”]Carl, Does the “Slash notation” work with ControlLogix PLC’s?

I was under the impression that it was only for SLC & PLC style processors.[/quote]

Slash notation only works on MicroLogix, PLC-5 and SLC-505.

For ControlLogix you can currently use bit=X to read, and will soon be able to read/write.[/quote]

Unfortunately we’re going to have to backtrack on the claim that you will soon be able to write using the bit=X filter. It’s not possible to do a safe/atomic write to a bit without native support from the driver/device.

Filters will remain read-only.

OK, So it looks like “read OR Write” is how we are going to handle this… :cry:

[quote]It’s not possible to do a safe/atomic write to a bit without native support from the driver/device.
[/quote]I assume that you are talking about the IA driver here, or is the “dot” notation an RSLinx only specialty?

Our core ControlLogix driver will support dot notation for both reading and writing. But we do have to make some modifications to have it tie into the OPC server and work with Ignition.

We should have these changes done in the near future.

[quote=“thechtman”]Our core ControlLogix driver will support dot notation for both reading and writing. But we do have to make some modifications to have it tie into the OPC server and work with Ignition.

We should have these changes done in the near future.[/quote]
At the risk of sounding “pushy” … How near is the “Near Future”? :scratch:
(Same reasons as previously stated)

This is starting to become urgent now…

Do you have any timeframe for the read/write of the DINT bits yet
(note this is specifically required for ControlLogix Processors)

Don’t mean to “harp” on this issue, it’s just that I am a lowly PC programmer & have very little say in how our PLC’s are programmed. :wink:

After some rather “lengthy” discussions with one of our resident PLC programmers I have managed to convince him to supply me with “BOOL” tags for the bits we need to control/read for this project. I’m relying on his expertise here as he states that this has consumed quite alot of extra PLC space (apparently a single BOOL consumes the same space as a DINT in a ControlLogix PLC?).
The arguments I put to him were:
1.) as we are unable to write an individual bit in a DINT we would need to do a read-OR-write.
2.) This would result in twice as much network traffic as a read is required prior to setting any given “bit” of the DINT & write back, and
3.) As the DINT forms part of a bi-directional control array (individual bits being allocated a given direction) we couldn’t guarantee that none of the remaining bits would be affected by the read-OR-write actions.

The long and short of this is we now have an interface that includes some 120 odd “BOOL” tags & around 240 DINT’s (repeated in 3 PLC’s at this site), so the urgency for the individual bit writing to a DINT has been reduced somewhat. Having said that, I’m sure that not all of our PLC programmers and/or hardware would be as accommodating (especially if PLC “space” is getting tight) so I still look forward to the “version” that includes this feature. 8)

Regards,

Peter