I developed a small app to test out the use of a TSQ to acquire data from a device (mass spec), and pass it to the main thread for plotting on an X-Y graph (AMU vs Measured Intensity). In the small app, the plotting keeps up with the data acq and gives a smooth continuous moving graph from start amu to the final amu (x-axis)as the daq scan progresses and overall the technique works very well. Note: the data scan takes about 4-5 secs to scan ~500 points and feeds data asynch back to my PC during the scan, so it's not an overly fast daq.
However, when I integrate the app into my much larger app, I find that the plotting is very choppy, plotting about 1/4 of the graph, pause, graph 1/4 of the graph, pause...
The secondary thread has o
nly one func to read data and put in the TSQ. I don't have any timers running in either thread, I put a ProcessDrawEvents() inside the plot function to update each point as it's plotted, I've modified my sleep policy in both threads with no effect. I know that plotting individual points is slower than the entire graph, but I thought that it should work in the large app similar to the small app since it's multithreaded. BTW, this pausing occurs when I call the plotting function inside the secondary thread as well. But it seems that the main thread is somehow delaying the graphing update.
Any suggestions how I can get the daq/plotting in the large app to be similar to the small app?