PDA

View Full Version : continuous retrieval of adc data without while loop



emigrand
16th March 2012, 20:57
Good evening,

I am working on a data plotter for an adc (USB-1608FS by Measurement instruments). Everything is working fine when I use a function that allows single readouts:


int cbAIn(int BoardNum, int Channel, int Range, unsigned short *DataValue);

Calling this function regularly with a QTimer allows sampling rates of max. 250 Hz, which is not enough. So I have to use a function that continuously retrieves data in small packages:


int cbAInScan(int BoardNum, int LowChan, int HighChan, long Count, long *Rate, int Range, int MemHandle, int Options)

To update my plot, I query the package index with


int cbGetStatus(int BoardNum, int *Status, long *CurCount, long *CurIndex, int FunctionType)

in a while loop and call addValues(CurIndex) on change.

The problem: the gui does not stay responsive! I know that the solution to my problems might consist of threading and signals/slots, but I am not sure which function to move to the thread, what is my signal, what my slot and if this is really advantegous compared to my former approach with a while loop.

Any help would be appreciated!

wysota
17th March 2012, 13:05
Keeping the GUI Responsive