LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupt at at specific time and date

The big picture: I have quite big program that needs to do some things at specific times. I already have an array of timestamps.

I will simplify my question to one timestamp, and to turn on LED at that specific time.

I have a working VI (added) that checks the system clock every X miliseconds but i find this solution to be somewhat cumbersome.

pic of the VI:

interruptat.JPG

Does someone know or have an idea for a better way to do that?

 

Elen.

0 Kudos
Message 1 of 5
(2,758 Views)

I would just check if system time is greater or equal to interrupt time, and not mess with the string conversions. Other than that, having it run the check in a slow helper loop as you are doing seems like the right thing to do.

0 Kudos
Message 2 of 5
(2,751 Views)

The reason for checking if the interrupt time is greater than system time is: what happens if your CPU usage goes high for some reason during one of these checks and your interrupt loop skips a beat?  If that happens, you will never get an interrupt. 

 

When you do get an interrupt, what happens?  Do you really want a STOP button in your interrupt loop or should this loop exit when an interrupt is detected?  Are you re-populating the interrupt time with a new value after the current one is detected? 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 5
(2,737 Views)

thanks for the replies.

 

I will change the checking mechanism to greater than between the timestamps. The former way does work, because it is checking the date,hour and minute (and not seconds). Which gives a "window" of one minute. But still the other way I find to be more elegant and robust so thanks for that.

 

As for the stop button, I actually have an array of interupts (timestamps) so yes, I am repopulating the the interrupt time- hence the stop button is necessery to terminate the program.

0 Kudos
Message 4 of 5
(2,719 Views)

Put a for loop around your while loop and auto-index your array of timestamps.  After the last interrupt is detected, your for loop will automatically exit and the program shuts down.  No need for a button.

interrupt.PNG

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 5
(2,713 Views)