From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with A/D channels of DAQpad6020 in LabWindows:

We are trying to read data from the A/D channels of a DAQpad6020. We wrote this simple sample code to test our board but we
realized that the rate for printing data on screen is exteremly slow. Could you advise us of any possible error in code or any other solution that can fasten up this process?

In our application, we basically would like to read 12 channels of A/D at the rate of 100 Hz. We tested our code in both release and debug mode and made sure enough USB bandwidth is available.

Regards,



void main(void)
{
shyort input[12];
int num_of_chan=12;


Init_DA_Brds (1, &init);

SCAN_Setup (1, num_of_chan, channel_list, gain);

while (1)
{
AI_Read_Scan (1, input);

printf("%f %f %f %f %f %f %f %f %f %f %f %f\n",
input[0], input[1], input[2], input[3],
input[4], input[5], input[6], input[7],
input[8], input[9], input[10], input[11]);
}
}
0 Kudos
Message 1 of 2
(2,548 Views)
Hello

How are you specifying the scan rate for the aquisition? Instead of controlling the scan rate with a while loop, you should configure the device to use its internal clock to do the aqusition for you. I think the reason why its taking longer is that you are continuously polling the 12 channels pt by pt, which on a USB bus might cause delay. Check out the daq single buffer examples ( finite number aquisition) or the double buffer example if you want to continuosly aquire data. You can find then under ../Program Files/National Instruments/NI-DAQ/Examples/VisualC. This would configure the built in clock of the device, giving you a more accurate scan rate.

I hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 2
(2,548 Views)