03-08-2018 10:43 AM
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:
Does someone know or have an idea for a better way to do that?
Elen.
03-08-2018 11:04 AM
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.
03-08-2018 11:36 AM
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?
03-08-2018 02:44 PM
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.
03-08-2018 03:02 PM
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.