# How to use individual bit of a word tag

**URL:** <https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081>\
**Category:** Ignition\
**Created:** [June 2, 2015, 11:53am UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081 "2015-06-02T11:53:28Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdahigaonkar](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@sdahigaonkar](https://forum.inductiveautomation.com/u/sdahigaonkar)\
**Post date:** [June 2, 2015, 11:53am UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/1 "2015-06-02T11:53:28Z")

</div>

recently we are adding some new screens in existing project of the HMI. we want to have pump on/off controls from HMI. we have 20 pumps and I want to make a common program  
Ignition is linked with KEP and S7-400 PLC  
from the PLC I assign one word each for one pump (so total 20 words)  
Each bit of the word will carry signals. For ex - bit 0 is pump select, bit 1 is pump ON, bit 2 is pump OFF and so on  
If I link the DB word of PLC into KEP OPC and then bring it to Ignition, how can I use the each bit of this word  
I mean, I want to link the bit 1 to the button click in the screen  
please explain the procedure

---

<div class="post-metadata">

**Author:** ![Chris\_Taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_taylor/32/3315_2.png) [@Chris\_Taylor](https://forum.inductiveautomation.com/u/Chris_Taylor)\
**Post date:** [June 2, 2015, 1:35pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/2 "2015-06-02T13:35:32Z")

</div>

sdahigaonkar

Its probably easier to do this in Kepware. just add “.\*” to the end of the address to extract the bit  
so for bit 4 from variable memory address of V12 would be V12.4

If you want to do it in Ignition then read the address as an OPC tag and then make separate expression tags such as “getBit({[~]V12},4)”, if you put this all in a UDT with all the bools from the variable then its easy to repeat.

---

<div class="post-metadata">

**Author:** ![sdahigaonkar](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@sdahigaonkar](https://forum.inductiveautomation.com/u/sdahigaonkar)\
**Post date:** [June 2, 2015, 4:58pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/3 "2015-06-02T16:58:54Z")

</div>

Hi,  
thanks for reply,  
I could not understand it properly. Can you please explain me in detail. I am beginner for Ignition/KEP

Suppose example - DB900.DBW0 is the word I have in PLC  
DB900.DBX0.2 is the pump ON bit I want to receive from Ignition button click on the screen to the PLC  
DB900.DBX1.0 is the pump running feedback bit, I want to send from PLC to Ignition for display  
Like this all the bits will be used for pump-1 for various purpose.  
Same way I have 20 pumps and so I will have 20 words of DB900 in the PLC

How I will make tag for this word in KEP  
How the KEP tag will go to Ignition and how tag to be made  
How I can use bit 1

Thanks for guiding me

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [June 2, 2015, 8:20pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/4 "2015-06-02T20:20:42Z")

</div>

Watch this video to see how to get a bit from a tag:  
[inductiveuniversity.com/video/e … -functions](https://inductiveuniversity.com/video/expression-binding-bit-functions)

Best,

---

<div class="post-metadata">

**Author:** ![sdahigaonkar](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@sdahigaonkar](https://forum.inductiveautomation.com/u/sdahigaonkar)\
**Post date:** [June 3, 2015, 4:09am UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/5 "2015-06-03T04:09:36Z")

</div>

hello,  
Thanks for giving link for how to use getbit function. I understand.  
This is for reading individual bit of a word received from PLC.  
Same way can you please suggest me how to write to a bit of a word and sending to PLC

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 3, 2015, 1:34pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/6 "2015-06-03T13:34:10Z")

</div>

To write individual bits you will need to address them individually. Consider not reading entire words–just read individual bits. Use a UDT with a string parameter to supply the common part of the OPC path, then an integer parameter for the ‘n’ in the first DBXn.0 address. Everything else would be generated in the UDT from those. There would be no getBit() expressions at all.

As an example, say the string is {base} = “[S7]DB900.DBX” and the integer is {start} = 0. Then within the boolean elements of the UDT, use OPC items paths like “{base}{start}.0” for the first bit, then “{base}{start}.1”, …, “{base}{start+1}.0”, et cetera. Each boolean can be separately designated read-only versus read/write.

I’ve attached a simple UDT export as a sample/starting point. Just import it into your data types folder.  
[SiemensSimplePumpUDT.xml](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f3b5222892d62b5cdbba640a4793693becabcc0e.xml) (1.44 KB)

---

<div class="post-metadata">

**Author:** ![sdahigaonkar](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@sdahigaonkar](https://forum.inductiveautomation.com/u/sdahigaonkar)\
**Post date:** [June 3, 2015, 3:43pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/7 "2015-06-03T15:43:14Z")

</div>

thanks for giving solution. I will try to implement

---

<div class="post-metadata">

**Author:** ![Etienne\_Delage](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@Etienne\_Delage](https://forum.inductiveautomation.com/u/Etienne_Delage)\
**Post date:** [April 28, 2024, 8:06pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/8 "2024-04-28T20:06:34Z")

</div>

with OPC UA the “.\*” is not working anymore. NOw no choice but to do hoops and tricks with getbit() and other suffering

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 28, 2024, 8:13pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/9 "2024-04-28T20:13:35Z")

</div>

The ability to append `.N` to specify the bit to an _OPC Item Path_ has always depended on the OPC server you are connected to supporting that syntax.

What server are you connected to? What changed since "anymore"?

---

<div class="post-metadata">

**Author:** ![Etienne\_Delage](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@Etienne\_Delage](https://forum.inductiveautomation.com/u/Etienne_Delage)\
**Post date:** [April 28, 2024, 8:21pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/10 "2024-04-28T20:21:48Z")

</div>

ecostruxure OPC UA server expert

see link:

> **[How to read/write a word bit with OPC UA | Schneider Electric USA](https://www.se.com/us/en/faqs/FAQ000235288/)**
>
>  

It used to work but not anymore. NOt create error on OPC server instead of working properly

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 28, 2024, 8:27pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/11 "2024-04-28T20:27:08Z")

</div>

Ok, so Schneider changed the behavior of their OPC UA server.

That's definitely a bummer if you were relying on that behavior. You should probably open an issue with their support.

> OPC UA does not allow the user to access a bit of a word directly. The OPC UA specification (OPC 10000-3 - UA Specification Part 3 - Address Space Model 1.05.01) does not specify this as a standard data type.

This is true in the sense that yes, there is no dedicated service or parameter for the Read service that can specify a bit within the word, but there is nothing preventing a server from modelling bits as Boolean Nodes underneath other Integer-type Nodes, and/or making them accessible at a NodeId like `$NodeId$.BitNumber`, just as Ignition and Kepware and practically every other OPC server have been doing for years.

It's a modelling choice that is up to the server vendor.

---

<div class="post-metadata">

**Author:** ![Etienne\_Delage](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@Etienne\_Delage](https://forum.inductiveautomation.com/u/Etienne_Delage)\
**Post date:** [April 28, 2024, 8:29pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/12 "2024-04-28T20:29:16Z")

</div>

What makes me afraid is the explanation: The OPC UA specification (OPC 10000-3 - UA Specification Part 3 - Address Space Model 1.05.01).

I hope the others OPC server wont do the same...

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 28, 2024, 8:31pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/13 "2024-04-28T20:31:56Z")

</div>

There is no reason to make that change. If somebody at Schneider read whatever part of the OPC UA spec they are quoting and thought the take away was "we can't expose bits of words in the address space any more" they're just plainly wrong

---

<div class="post-metadata">

**Author:** ![Etienne\_Delage](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@Etienne\_Delage](https://forum.inductiveautomation.com/u/Etienne_Delage)\
**Post date:** [April 28, 2024, 8:33pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/14 "2024-04-28T20:33:15Z")

</div>

DO you have a good example of a derived tag to read and write bit in a word?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 28, 2024, 8:35pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/15 "2024-04-28T20:35:50Z")

</div>

> [@Troubles making a Derived Boolean Tag work as a mask for a Short Tag](https://forum.inductiveautomation.com/t/troubles-making-a-derived-boolean-tag-work-as-a-mask-for-a-short-tag/15203/2):
>
> I’ve made it work using the following expressions: Read: (toInt({source}) \>\> N) & 1 Write: if({value}, toInt({source}) | (1 \<\< N), toInt({source}) & ~(1 \<\< N)) Where N will vary based on the bit number (0-15 for a Modbus register). You should also turn on the “OPC Optimistic Writes” flag for the scan class these tags belong to or you’re going to have a race condition if you try to write to multiple bits in the same word too quickly.

---

<div class="post-metadata">

**Author:** ![Etienne\_Delage](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@Etienne\_Delage](https://forum.inductiveautomation.com/u/Etienne_Delage)\
**Post date:** [April 28, 2024, 8:40pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/16 "2024-04-28T20:40:58Z")

</div>

thanks Ill try that, I guess it will work better than what I was trying to do right now:

PLc word tag - ecostruxure OPC UA - opc tag - refernce tag - igntion opc ua - tag.bit number

getting errors lol

---

<div class="post-metadata">

**Author:** ![hunterdg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hunterdg/32/67774_2.png) [@hunterdg](https://forum.inductiveautomation.com/u/hunterdg)\
**Post date:** [May 9, 2024, 5:10pm UTC](https://forum.inductiveautomation.com/t/how-to-use-individual-bit-of-a-word-tag/10081/17 "2024-05-09T17:10:41Z")

</div>

FWIW…

I ran into this while converting from Concept \> Unity/Control Expert. Concept UDTs/blocks “built” the word from internal bits and exposed the word as an output parameter.

I modified the UDT parameter configuration to expose the underlying bits of the word as “public” variables which are picked up nicely by OPC UA Expert via native OFS protocol and exposed as children of the UDT in ignition OPC UA client.

I even removed the word output parameters from the UDTs since they only existed for legacy modbus HMI communication . I also marked the internal/public HMI bits as “Application” tags and configured the PLC/UA Expert to only publish/subscribe to “Application” tags instead of every tag, drastically simplifying the OPC browse tree for clients/Ignition.
