Noob Codesys Question

ygolohcysp

Member
Join Date
Feb 2020
Location
PA
Posts
8
Hello.

I'm wanting to use a boolean value associated with turning an output on to control the visibility of an image. The visibility option in the visualization uses the true state to make it invisible, which is opposite of what I'm wanting. Is there a way to make it use the inverse value? I know I could do that with logic and another variable, but I'm going to have a lot of these images switching for different states, all applicable to different parts of the system. Easy enough, but that would create a LOT of seemingly unnecessary variables when all I need is the inverse value.

Thank you.
 
Okay, sorry for the dumb question. I've been through training almost 4 years ago, and this is the first I'm using that. Though the training was on AB software. I have a lot more complexity already in this system, but this just didn't function the way my brain was wanting it to.

Simply put, it's Variable_Name=0. That =0 part makes it use the inverse of a boolean value.
 
Can you use NOT(Variable_Name)?

I have used a Codesys platform that we were able to do that for visualizations.
 
Last edited:
I tried with the NOT instruction. Codesys doesn't seem extremely consistent with syntax, and I'm only now just getting back into this. I could try it with the NOT(Variable_Name) approach.

I'm now getting to the 2nd layer of images, 3rd if you count the background, so now I'll get to see if the layer order affects visible layers when multiple states are true like I think it will.
 
Can you use NOT(Variable_Name)?

I have used a Codesys platform that we were able to do that for visualizations.


This should work and actually you can use other operands as well like AND , OR, XOR etc. Also you can use multiple boolean variables:


e.g. Var1 OR Var2



You can also use comparators for the numeric values:


Var1 = 5 (Turns your image invisible if the value of the variable equals to 5)


Or you can type Var1 <> 5 (Turns your image invisible if the value of the variable is something else than 5)
 
Last edited:
This should work and actually you can use other operands as well like AND , OR, XOR etc. Also you can use multiple boolean variables:


e.g. Var1 OR Var2



You can also use comparators for the numeric values:


Var1 = 5 (Turns your image invisible if the value of the variable equals to 5)


Or you can type Var1 <> 5 (Turns your image invisible if the value of the variable is something else than 5)

I meant to say thank you for this information back when you posted it. I hadn't hit submit, and then got busy. But I definitely wanted to say thank you. I've used some of these tips since then. Absolutely helpful.

Only questionable thing left is setting up modbus connections and pulling real time data from those. I have a bit of info on doing that, so as soon as I get the actual modules to tie in and test with, I'll tackle that. Thank you!
 

Similar Topics

Hello, I'm trying to run simple Codesys 3.5 patch3 example for quickstart. But, when I set gateway (Devices->Device(Codesys SP Win V3)->...
Replies
4
Views
12,343
I work in a field where our plc and hmi are constantly being powered fully off and on daily before being sent out. I am new to the world of plc...
Replies
5
Views
956
Please laugh… but can I take 24volts from an IO module and wire it straight into its own input card to simulate an input….?
Replies
5
Views
1,256
I need to be able to open a customer's FT View project and make any changes if necessary. Which one do I need??? :hmmm: I don't want to have...
Replies
10
Views
2,590
Hello all, i will start off by saying i know nothing about load cells, i want a converter/amplifier to output a 4/20mA signal from a load cell...
Replies
14
Views
5,388
Back
Top Bottom