LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I make an event occur at a certain time?

I would like to have an event occur at a particular time and don't know how to do that.


Example: at 7:00, 8:00 8:30 take a measurement then at 12:00 print the results.
0 Kudos
Message 1 of 4
(2,864 Views)
Looks like my first reply didn't show up. Anyway, this .vi should give you an example of how to do that.

Hope this helps.
Message 2 of 4
(2,864 Views)
> I would like to have an event occur at a particular time and don't
> know how to do that.
>
>
> Example: at 7:00, 8:00 8:30 take a measurement then at 12:00 print the
> results.

There are several ways to do this. The key to the simplest one is to
take the target time and the current time and be able to subtract them
to get a delta in millisecs. I don't believe this will be hard, and
once you have a delta, you can use a wait ms node to put different loops
to sleep until they are supposed to wake up and run again.

A variation of this, that is easier to cancel is to make the timers use
an occurrence and a timeout. You will use is in reverse since the
normal case will be for the timeout to happen, and when you want to
cancel it, you will set th
e occurrence.

A third way of doing this is if the times are as sparse as you indicate
is to have a single loop that knows about the tasks -- it has an array
of times and task identifiers. Have the a loop sleep a bit, wake up and
check the current time against the array of tasks. If you keep the task
array sorted by time, then you only have to loop to the first one in the
future. You can then set your loop to sleep for something like 500ms,
or whatever you want the resolution to be.

Greg McKaskle
Message 3 of 4
(2,864 Views)
This third options seems to be the one that will be the most versital for my needs. Thanks for the input.
0 Kudos
Message 4 of 4
(2,864 Views)