10-18-2013 09:45 AM
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 ,
10-18-2013 09:53 AM
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.
10-18-2013 10:09 AM
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 ..
10-18-2013 10:17 AM - edited 10-18-2013 10:22 AM
@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
better to use elapsed time.vi, tick count, time stamp....
10-18-2013 10:23 AM
mmm i can see ur point .
hoever can u explain how to use elapsed time .vi ??
10-18-2013 10:29 AM
@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?
10-18-2013 10:37 AM
@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).
10-18-2013 10:44 AM
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 ?
10-18-2013 10:51 AM
the hint would be in how you reset the timer to start it, some boolean logic and shift registers
10-18-2013 10:51 AM
@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.