How to use individual bit of a word tag

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


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.

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

Watch this video to see how to get a bit from a tag: … -functions


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

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 (1.44 KB)

1 Like

thanks for giving solution. I will try to implement