Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i do continous reading of temperature(until i stop it) using ni-visa?

I kept annoyed by the looping that might freeze everything while the reading is in progress. I can't even stop the progress. Shall I use mutilthreading? or some other better methods? Some relevant examples will be very appreciated. Thanks. P/s: beside the reading, I also doing the control and other monitoring as well
0 Kudos
Message 1 of 3
(2,694 Views)
In a single threaded mode, just put ProcessSystemEvents() in your temp. read
loop, that way, your UIR events will be processed. On GUI have a button
which when clicked turns on a flag. Now in temp. loop keep monitoring for
this flag and exit when flag is on. It's that simple.

A better approach would be to use multi threading, where you have a worker
thread read data. Use ThreadSafeQueue to transfer data from reader thread to
main thread. MOre difficult than the first approach.

vishi

"naturom" wrote in message
news:506500000008000000A5770000-1042324653000@exchange.ni.com...
> I kept annoyed by the looping that might freeze everything while the
> reading is in progress. I can't even stop the progress. Shall I use
> mutilthreading? or some other bett
er methods? Some relevant examples
> will be very appreciated. Thanks. P/s: beside the reading, I also
> doing the control and other monitoring as well
0 Kudos
Message 2 of 3
(2,694 Views)
thanks, i was thinking to use multithreading also
0 Kudos
Message 3 of 3
(2,694 Views)