05-24-2011 07:31 PM
I am trying to understand how to poll in LabWindows? My application does not require user interface, it will be separate application. If the application had user interface I was creating a new thread and use timer control. Timer control callback would then call the funciton that needs to be polled after specified time.
Are there any samples or suggestion to poll when the application has no user interface?
05-24-2011 11:50 PM
An equivalent of standard timers are asyncronous timers, which do not make use of a user interface control to work.
Or you could simply loop into the man and take care of time passing by either confronting Timer () value and doing someting at regular intervals or using SyncWait ().
05-24-2011 11:51 PM
Hi,
You can still have threads even if you don't have a user interface.
There is no restriction about that.
In your thread, you can create a timed loop using functions like SyncWait.
See its help before using it.
Second, you can also create a UIR panel and put a timer control on it.
At runtime, load the panel but dont display it.
Your time should still run.
Third, you can use asyncronous timer. Its an instrument installed by default.
Search for the file "asynctmr.fp" in your CVI folder and add it to your project.
Read the related help documentation.
It is a much reliable timer than UI timer control.
Hope this helps,
05-25-2011 02:48 PM
I think SyncWait() would work. Is it recomended to create a new thread for the function or only for syncWait() function? Are there any in built examples to consider as starting point.
TIA.
05-26-2011 12:02 AM
Creating a thread is necessary only if you need to run some other operation parallel to your polling loop.
SyncWait function help gives enough tips on its usage.
There are also multiple examples in CVI installation about multithreading.
People may be of more help if you specify your application a little more.