I have a measurement system that is highly modular written in C/C++ utilizing COM via ATL. The application (EXE) communicates with a COM object I wrote in a separate DLL. This COM object is responsible for communicating with the Nidaq (6.3) libraries via DLL calls (GetProcAddress).
I have a simple turnpot meter (0-5V) connected to 3 channels (0,1,2). Sampling rate is 250Hz. I have been trying my best efforts to acquire the data and "simultaneously" display it in a window. I have implemented the acquisition using asynchronous and double-buffering approach. As an example, the total # of scans is 1000 and the buffer was 20 so I could get 10 samples at a time (with the DAQ_DB_H
alfReady). I setup a separate thread to do the acquiring, where every 10 scans (when buffer half full) I would obtain and write to a global buffer of TotalSamples * 3 Channels. I then setup a windows timer for every 250 ms to get the "next" 10 samples and display on the screen.
The problem is that when the acquisition thread is normal priority, sometimes the displaying causes the thread to miss data (nidaq already began writing over the buffer I wanted). When I set the acquisition thread to highest priority, the data is not displayed until the acquisition has completed.
Any thoughts?