I need to decode the integer value to boolean and store the each bit of 16bits in different variable of boolean type and to be used in the program. I am using siemens Step 7 5.5. Is it possible to do this?
Hi all,
Thanks for reply. Now I would like to ask is there any way to do this in a multi instance FB. I receive integer variable in FB and save it in a local variable (Stat) in FB. I need to access the bits of the integer and to be used as NO or NC in the FB.
I tried this code and I am able to use individual bits of the integer but it works if there is only one FB not in multiinstance.
TAR1 #TempAR1
LAR1 P##VALVE_CONFIG_NO
L W [AR1,P#0.0]
T W [AR2,P#312.0] //Address pointer of the "Decoding_struct"
LAR1 #TempAR1
Please see attached picture to see how Decoding_struct is declared in FB.
Here's an example implementation that uses a function that will move a word from a source to a destination using pointers.
To access variables indirectly in multiple instance FB's, you have to add AR2 to the pointer to the variable. The method I have shown uses the block editor to perform the addition "in the background".
Thank you very much for the code. It worked just fine. Sorry for being late as I was caught in offshore support and couldn't try this code in the weekend. I tried FC MoveWord in multiInstance FB and it's working with no issues.