LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I do to make an loop of acquisition running all the time ?

Hello everybody,

I want to thank those that help to make CVI save datas tree times per
day.

I'am a new user of Labwindows/CVI and I meet a problem with an
acquisition of datas.

I want to acquire a pH with an RS 232 which is connected to a pH-meter.
To acquire the pH, the user click on a command button "measure". But
after a first acquisition, the loop of acquisition stops. How can I do to
make the loop of acquisiton running all the time ? I woul like that the
user could stop the acquition with a command button "stop", but I don't
know how to do that.
0 Kudos
Message 1 of 3
(2,877 Views)
One possibility to obtain this behaviour is to use a timer control and put the code for acquiring PH in the timer callback.
In order to use it I suggest you to do the following:
1. Set the timer interval for the acquisition pacing you want (once-per-second, once-per-minute...)
2. Set it as disabled in the UIR editor
3. In the 'Acquire' button enable the timer: from this moment on, the timer callback will be called at regular intervals. In case, in the same callback enable the 'Stop' button if present and disabled, or change the label of the button to 'Stop'
4. To stop the timer, simply disable it in the 'Stop' button callback

There remain a few conditions in which the timer callback is not executed: a time-consuming function in your program that
causes the timer to miss some call, or operator actions that halt the program (like clicking and maintaining pressed the mouse button on a panel title bar, or causing a long time out for example on a network or disk access...).
The first condition should be easy to detect while developing the program and can solved for example calling ProcesSystemEvents () several times inside the long-lasting function.
The second condition is more difficult to deal with (but fortunately there are very rare events): if this can cause a problem to you, you should consider moving to an asyncronous timer, but since you are a new user I suggest you not to try it until your program is fully developed and tested and you are more familiar with CVI.

Hope this all helps you a little.
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(2,877 Views)
Thank you for your help Roberto.
0 Kudos
Message 3 of 3
(2,877 Views)