LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

elapsed time beginner

hello guys , 

I need ur help .. 

I have a really simple task to do : i need to push a button , and after 15 second , a LED should turn on 

I've been looking in the forum for such questions , but all of them are advanced or using another version which i can't open !

However i've seen that almost everybody are using the elapsed time block , So if you can please tell me how should i connect this block to my circuit . 

Regards , 

 

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

The simplest way is to use the Wait function, wire 15000 (milliseconds) to it.  After it is completed, set the LED value to true.  To ensure that the LED happens after the wait function, use a sequence structure.

 

There are better ways to create delays but this will be sufficient for what your asking.

0 Kudos
Message 2 of 19
(3,434 Views)

Ah okey thanks 🙂 

and if i want to output the elapsed time ? 

i mean to put an indicator on the front panel to see the elapsed time in seconds .. 

 

0 Kudos
Message 3 of 19
(3,427 Views)

@pjr1121 wrote:

The simplest way is to use the Wait function, wire 15000 (milliseconds) to it.  After it is completed, set the LED value to true.  To ensure that the LED happens after the wait function, use a sequence structure.

 

There are better ways to create delays but this will be sufficient for what your asking.


i wouldnt do that...that will keep anything within the loop from responding to user interface within that time

 

  • CLD 7.b.3. Avoid using any of the Wait functions to time a software operation

 

better to use elapsed time.vi, tick count, time stamp....

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

mmm i can see ur point . 

hoever can u explain how to use elapsed time .vi ??

0 Kudos
Message 5 of 19
(3,413 Views)

@hah49 wrote:

mmm i can see ur point . 

hoever can u explain how to use elapsed time .vi ??


have you dropped the vi onto the block diagram and clicked on the 'question mark' icon on the upper right hand side and clicked detail help?

0 Kudos
Message 6 of 19
(3,405 Views)

@apok wrote:

@pjr1121 wrote:

The simplest way is to use the Wait function, wire 15000 (milliseconds) to it.  After it is completed, set the LED value to true.  To ensure that the LED happens after the wait function, use a sequence structure.

 

There are better ways to create delays but this will be sufficient for what your asking.


i wouldnt do that...that will keep anything within the loop from responding to user interface within that time

 

  • CLD 7.b.3. Avoid using any of the Wait functions to time a software operation

 

better to use elapsed time.vi, tick count, time stamp....


 

You are correct in that it prevents other items from responding and I did say that it was a basic solution.  I normally use timestamps for items such as this so the rest of my code keeps running (I don't usually need very precise timing so errors introduced in when the timestamps are checked don't usually matter to me).

0 Kudos
Message 7 of 19
(3,396 Views)

ok so this is my problem .. i tried to use it and i refered to the help but it is not working .. can u explain why ? 

 

buzzer.png

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

the hint would be in how you reset the timer to start it, some boolean logic and shift registers

0 Kudos
Message 9 of 19
(3,382 Views)

@hah49 wrote:

ok so this is my problem .. i tried to use it and i refered to the help but it is not working .. can u explain why ? 

 


 

Perhaps a little explanation of how Elapsed Time.vi works.  By itself (only thing on your block diagram) it will not set the LED to true.  The Elapsed Time.vi must be within a loop [I can't tell from just your photo how the entire block diagram is designed].  The first time it excecutes, it marks the current time.  Every additional time it excecutes, it compares the current time to the start time.  Once you have exceeded the 15 seconds (or whatever you choose), the Elapsed Time.vi will set the output as TRUE and check to see if it needs to reset and start couting again.

Message 10 of 19
(3,381 Views)