Click PLC compare with math.

Please be patient I just started learning this.

In a compare, I have data A: as DF2.
data B: I want (DF10 /6.25)+6

It says I entered an Address that cannot be used.

Thanks for any help......
 
Thanks Steve for a quick reply.
I did not try placing the result of the calculation in a separate DF address and used that in
the compare function?
When I did try it , I could not figure it out.
I did stumble on the ability to scale your inputs which worked great for this. No math needed.
 
I do not know Click but I agree with the following:

[DIV DF10, 6.25, DFxx] so divide DF10 by 6.25 & store in DFxx
[ ADD DFxx, 6, DFxx] Add the 6 & store in DFxx
[CMP DF2, DFxx] Do the compare
Although here I used the same temporary Variable you could use 2 so you can see both the divide result & the add for monitoring purposes.
You did not state what the compare was or what it is for.
Is it =, >, <, >=, <= one thing to bear in mind (many make this mistake) if you use equals then due to errors in floating point maths a result may give you this:
DF2 = 20.3 DFxx = 20.30031 so an equals will not work as due to floating point math errors DFxx could jump from 20.299 to 20.30031 so never sees the required 20.3
There are two possible solutions rather than use = use >= or <=
[>= DF2, DFxx]
[<= DF2, DFxx]
if for some reason it is not practical to a grater than or less than i.e. needs to be exact then you may need to do a limit compare with enough tolerance i.e. + or - 0.001.
 
Yes slight mistake there, the constant 6 should be 6.0, if using floats then trying to use an integer in the maths probably will not compile, or at the very least give the wrong result.
 

Similar Topics

I have a device that transmits a 12-byte RS-232 message every 98 milliseconds or so. Inside the message is a byte that contains a "percent full"...
7
Replies
836
Views
The goal is to open a solenoid valve every morning but also open it for 2 minutes at any time if soil moisture drops too low. I had to simulate a...
3
Replies
969
Views
Is there any way to do test mode on click PLC program without a physical controller? I just want to see the outputs light up green and stuff to...
2
Replies
1,268
Views
Hello guys, looking for help on this. I have a Click Plus PLC C2-01CPU and a C-More CM5-T7W HMI screen. I am using an RJ12 CPC6 cable off of...
9
Replies
3,056
Views
Asking for help on this one, I am a beginner. I am using an external power supply, Rhino PSB24-240 24DC, with a Click Plus PLC C2-01CPU and Click...
6
Replies
1,761
Views
Top