Logical TAG

Hi, been thru the manual and my Basic skills are not the best.
We would like a tag, to be visible in a overview status page.

We have three DI tags, if all three tags are not active we need a tag to display a OK.

So i am thing more
IF (Tag1@=0) THEN
IF (Tag2@=0) THEN
IF (Tag3@=0) THEN
Tag4@=1
OR
Tag4@=0

Basically if all three tags are 0 then software tag is 1, if one of the tags is 1 then software tag is 0.
Make sense?

Rgrds
Smirre

@Smirre
You have the right idea but you would need to use an ELSE instead of an OR. You will also need an ENDIF for each IF statement at the end of your code. Additionally, you’ll need to setup a timer in your init section that goes to your piece of code if you do it that way.

An easier way to do this would be to use an ONCHANGE in the init section of your BASIC IDE.
If the tag changes then check if it’s not equal to 0. If it’s not equal to 0 then set Tag 4 equal to 1.

Init Section
ONCHANGE “Tag1”, “IF(Tag1@<>0) THEN Tag4@=1 ELSE Tag4@=0”
ONCHANGE “Tag2”, “IF(Tag2@<>0) THEN Tag4@=1 ELSE Tag4@=0”
ONCHANGE “Tag3”, “IF(Tag3@<>0) THEN Tag4@=1 ELSE Tag4@=0”

1 Like