LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Scanning rate with a ISA board

I have a problem with a ISA board. I use low level I/O functions for loop scanning a input port.
I have something like that:
do{
x=inp(adress);
...
}while(flag);
In this way I have a good scanning rate (1-10 usec),
but I haven't any control of my program.
If I insert in loop a function like GetUserEvent() or
ProcessUserEvent() to catch a keystroke for terminating
the loop, the scanning rate becomes very low (30-50 msec).
Is there a way to control a loop like this and have in the same
time a good scanning rate?
0 Kudos
Message 1 of 2
(2,810 Views)
The only other feasible way to process events during the scanning loop you have is to make your program multithreaded. With the user interface running in the main thread and this processing loop running in a second thread. After you have set it up in this fashion you can then use global flag variables to communicate process information back and forth, and use things like thread safe queues to reliably pass data between threads.

Take a look at the "Multithreading Overview" linked to in the online help in CVI 5.5. It can also be found as a .pdf file on your hard drive in the cvi\bin directory. Multithreading is a new feature in CVI 5.5 and is not available in earlier versions.

Hope that helps you out.

Jason Foster
Applications Engineer
National Instruments
www.ni.com/ask

0 Kudos
Message 2 of 2
(2,810 Views)