12-19-2005 08:03 AM
12-19-2005 09:02 AM
12-19-2005 09:58 AM
12-19-2005 10:24 AM
12-19-2005 10:48 AM
12-19-2005 01:17 PM
The code you show above will work just fine. I do something similar all the time when I have long delays in my code and need to check for events occuring during those delays.
However, I think you misunderstand what is going on here.
The function Timer() does not create any sort of timer control, all it does is read the elapsed time from the system timer which is running all the time in the background where you don't have to worry about it. You cannot stop or suspend this timer nor can you reset it to zero (only restarting the machine does that).
The ProcessSystemEvents() function does one thing and one thing only. It signals the user interface manager that you are yielding control so it can check for CVI messages in the message queue. If there are messages in the queue, CVI will dispatch them to the proper callbacks and then return to your delay function. There is only one thing that may be a problem here that I can see, that is if a callback function takes a long time to process, it may delay completion of your Tempo() function. If that is not an issue and you can tolerate longer delays, than you should use this approach. If you can't tolerate the longer delays, you may want to look into using a multi-threaded application to keep the user interface and instrument I/O processing separate.
12-19-2005 03:48 PM
12-21-2005 10:39 AM