LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help I'm stuck - I need a case structure?

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

 

 

0 Kudos
Message 1 of 8
(2,649 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 8
(2,633 Views)

Use a "t s f" selector?

 

 

0 Kudos
Message 3 of 8
(2,604 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 8
(2,584 Views)

@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.

0 Kudos
Message 5 of 8
(2,571 Views)

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

0 Kudos
Message 6 of 8
(2,563 Views)

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!

 

 

0 Kudos
Message 7 of 8
(2,552 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 8
(2,551 Views)