06-28-2006 07:14 AM
06-28-2006 07:42 AM
Your function is blocking the events in your main thread so the Timer callback is not called and the Tick Event can not be processed. If the actions performed by the timer can not collide with those performed by your other function (no access to the same resources) then you can execute them in a separate thread. This is made easy by the use of an async timer.
Look for the example asyncdem in CVI (use the search function under Help==>Examples in the CVI menus). It shows how to create another thread running from an async timer. You can also search async timer in this forum, you will find a lot of threads that discuss it and provide tips on how to best use it in various designs.
Hope this helps, if it does not provide you with a solution or you have other questions about how to implement it, please post again.
Good Luck
06-28-2006 12:34 PM
As mvr points out and the documentation for the standard CVI timer control states, there is no guarantee that you will get timer callbacks on time or even one for every timer interval. If your program is busy doing something else, the timer callbacks may never be generated.
Mutilthreading is really the way to go to both improve performance and ensure that timers are generating callbacks when expected. Fortunately, you do not have to dive directly into multithreading to get its benefit for timers. As mvr suggested, the best way to get around this problem is the asynchronous timer. This type of timer executes in its own thread and is very reliable. I have been using this type since it first became available and have been much happier with it. I have completely abandoned the use of standard CVI timer controls and will never go back to using them in new code. In fact, if I update an old program using a timer control, I replace it with the asynchronous timer.