From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

value comparison for specific time

Hi Everyone,

 

I have a vi to see if a number falls in a range for a specified duration .The input is at 51.2kHz.I want the vi to do the following ; Say if the input/value is continously in range for a specified duration ( say 5 seconds) it turns on an led and keep it on unless its false and when is false it should reset the time.

 

I dont know if my current vi is in the tune with what I want,it does its work but i dont know how to reset the time when its false.

I welcome any advise /assistance on this matter.

 

Thanks a lot,

1sandy1G

0 Kudos
Message 1 of 19
(3,292 Views)

The Elapsed Time function does have a reset input so what you could do is simply have a select function that checks the input range and chooses whether or not to reset the timer.

 

I would also be careful about how you have the inrange and coerce function configured.  It probably won't matter in this case but the default behavior of that function is to include the lower bounds in its check but not the upper bounds.  You can tell this based on whether the diamond is shaded.  You can change this behavior by right clicking on the function.  Again, it probably won't matter with this application but figured it might help you down the road.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 19
(3,267 Views)

@Jacobson-ni wrote:

 

I would also be careful about how you have the inrange and coerce function configured.  It probably won't matter in this case but the default behavior of that function is to include the lower bounds in its check but not the upper bounds.  You can tell this based on whether the diamond is shaded.  You can change this behavior by right clicking on the function. 


You know, I always wished that IR&C right click option would fade out and the diamonds would automagically fill when integer data types are wired.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 19
(3,238 Views)

Thank you for your reply Matt.can you explain resetting the timer ? do i wite a code in the 'false' case and trasfer a boolean to the true one?

 

0 Kudos
Message 4 of 19
(3,211 Views)

@1sandyG1 wrote:

Thank you for your reply Matt.can you explain resetting the timer ? do i wite a code in the 'false' case and trasfer a boolean to the true one?

 


Since you need to reset the timer when the comparison returns a false, all you need to do is use a NOT straight from your comparison.  Then the output of the NOT goes into the Reset of the Time Elapsed VI.


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
Message 5 of 19
(3,136 Views)

@crossrulz wrote:

@1sandyG1 wrote:

Thank you for your reply Matt.can you explain resetting the timer ? do i wite a code in the 'false' case and trasfer a boolean to the true one?

 


Since you need to reset the timer when the comparison returns a false, all you need to do is use a NOT straight from your comparison.  Then the output of the NOT goes into the Reset of the Time Elapsed VI.


Whoops, didn't catch that I said to use the Select funtion to make a boolean decision.  I'll be the next post on the Rube Goldberg thread if I'm not careful.

Matt J | National Instruments | CLA
0 Kudos
Message 6 of 19
(3,122 Views)

@Jacobson-ni wrote:

@crossrulz wrote:

@1sandyG1 wrote:

Thank you for your reply Matt.can you explain resetting the timer ? do i wite a code in the 'false' case and trasfer a boolean to the true one?

 


Since you need to reset the timer when the comparison returns a false, all you need to do is use a NOT straight from your comparison.  Then the output of the NOT goes into the Reset of the Time Elapsed VI.


Whoops, didn't catch that I said to use the Select funtion to make a boolean decision.  I'll be the next post on the Rube Goldberg thread if I'm not careful.


The Last time someone said something like that.Smiley Wink......


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 19
(3,113 Views)

 

crossrulz

 

Since you need to reset the timer when the comparison returns a false, all you need to do is use a NOT straight from your comparison.  Then the output of the NOT goes into the Reset of the Time Elapsed VI.

 


 

 

But when the comparison goes to false the false case is activated and the elapsed time vi is in the true case.So even if i do as you mentioned it doesnt work.

0 Kudos
Message 8 of 19
(3,078 Views)

@1sandyG1 wrote:

But when the comparison goes to false the false case is activated and the elapsed time vi is in the true case.So even if i do as you mentioned it doesnt work.


Then move it to be outside of the case structure.  And just looking at your code, I'm not even sure you need that case structure.  Is that Numeric 2 used somewhere else?


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 9 of 19
(3,071 Views)

I needed to start/trigger the elapsed time vi after a condition is satisfied and  i thought a case structure would suffice.Disregard the numeric 2,forgot to remove it.How could i do it without a case structure? any alternative?

Thanks

0 Kudos
Message 10 of 19
(3,060 Views)