12-11-2019 09:22 AM
Last requirement I'm trying to implement into my temperature sensing VI:
Requirement: LED to go on when temperature exceeds a specified values (as indicated from a control on the front panel). LED to go off when the temperature falls below said value.
In other words, you should be able slide to a temperature value on the front panel and if the LM sensor yields a result greater than or equal to that slide value, the LED goes on. If sensor does not yield a result higher than that value it stays off.
I think I need some type of case structure, but can't get the combination of commands correct.
I've attached my VI. the case structure in the upper right corner of the block digram is what I was fiddling with the try and get this to work.
It's probably simple, but I just can't see it yet.
Can anyone help?
Thanks
12-11-2019 09:33 AM - edited 12-11-2019 09:34 AM
Actually you don't need a case structure.
What you're looking for is a switch with a hysteresis effect. I.e. if temp > x AND LED is off, then turn it on. If temp < y AND LED is on, then turn it off. In the values between x and y, it stays as it is.
Try it. 🙂
/Y
12-11-2019 10:01 AM
Use a "t s f" selector?
12-11-2019 10:14 AM - edited 12-11-2019 10:17 AM
@Andre7755 wrote:
Requirement: LED to go on when temperature exceeds a specified values (as indicated from a control on the front panel). LED to go off when the temperature falls below said value.
This sounds like a simple Greater Or Equal? will do the job. Was that not working for you? Or is there a hysteresis requirement that is not explicitly stated here?
EDIT: Just looked closer at your VI. You have the measured value and the slider flipped on the Greater Or Equal function. If you hold CTRL and hover over one of the input terminals, your cursor will turn into the "switcheroo" image. Just click and the two will swap. You do not need the case structure or the Round To Nearest.
12-11-2019 10:23 AM
@Andre7755 wrote:
Use a "t s f" selector?
The name of that function is "select". Your problem is not the mechanism of selecting, but with the logic to decide what to select based on state (and possibly time).
Obviously, your LED terminal does not belong inside a case structure. because you want to always do the comparison.
As a first step, leave out all the DAQ stuff and just simulate the analog data, e.g. with another slider. It is much easier to debug by temporarily isolating and simplifying the problem.
12-11-2019 10:25 AM
Greater or equal won't work as that operation compare the input data and the slider value. Only when the slider matches or exceeds the temp will the led go on.
What I need, is an evaluation.
If the slider is at 40 degrees and the sensor input is at 70 degrees, the led will go on. As the input value is larger than the slider value.
If the slider is set at 80 degrees and the sensor input is at 70 the LED is off. as the input value does not meet the slider value.
It's like the slider is the control for the LED turning on.
I still cant get it
12-11-2019 10:34 AM
CROSSRULZ,
You got it!
Flipped the X, Y terminals on the ">/".
I had no idea/never occurred to me.
Now working as I need it to.
I spent forever on this knowing it had to be something simple. Downside of being new to programming.
Thank to all for the help!
12-11-2019 10:35 AM
@Andre7755 wrote:
Greater or equal won't work as that operation compare the input data and the slider value. Only when the slider matches or exceeds the temp will the led go on.
That is because you have the inputs flipped. Wire the DAQ measurement to the top terminal and your slider to the bottom.