From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-6052E, C-file Programming, DAQ_Rate

I am trying to write a simple c-file to collect some data with my PCI-6052E
Card. The card should be able to handle a sample rate of 333kHz, but I am
finding even if I ask for all sixteen channels at 10KHz using the DAQ_Rate
function, I get an error with the time on SCAN_Start.

The folloing code snip-it generates the error:
<< Snip it>>
f64 dSampRate = 10000.0;
f64 dScanRate = 10000.0;
i16 iUnits = 0;

iStatus = DAQ_Rate(dSampRate, iUnits, &iSampTB, &uSampInt);
iStatus = DAQ_Rate(dScanRate, iUnits, &iScanTB, &uScanInt);

iStatus = SCAN_Start(iDevice, DataBuffer, ulCount, iSampTB, uSampInt,
iScanTB, uScanInt);

printf(" \tiSampTB =%d\n",iSampTB);
printf(" \tuSampInt =%d\n",uSampInt);

printf(" \tiScanTB =%d\n",iScanTB);
printf(" \tuScanInt =%d\n",uSscanInt);

<< Output >>

iSampTB = 1
uSampInt = 100
iScanTB = 1
uSscanInt = 100

Error: -10092
Some devices require a time gap between the last sample in a scan and the
start of the next scan. The scan interval you have specified does not
provide a large enough gap fo rthe board. See your documentation for an
explanation.

But if I use the following code I do not get an error:
<< Snip it>>
f64 dSampRate = 10000.0;
f64 dScanRate = 10000.0;
i16 iUnits = 0;

iStatus = DAQ_Rate(dSampRate, iUnits, &iSampTB, &uSampInt);
iStatus = DAQ_Rate(dScanRate, iUnits, &iScanTB, &uScanInt);

iStatus = SCAN_Start(iDevice, DataBuffer, ulCount, iSampTB, uSampInt,
iScanTB, 0);

printf(" \tiSampTB =%d\n",iSampTB);
printf(" \tuSampInt =%d\n",uSampInt);
printf(" \tiScanTB =%d\n",iScanTB);
printf(" \tuScanInt =%d\n",uSscanInt);


Could anyone point me in the correct direction?
Please reply directly to
tgaudett@n
mr.mgh.harvard.edu


Thanks in advance,

Tom
0 Kudos
Message 1 of 2
(3,876 Views)
Thomas:
The second case works because you are disabling the scan clock, thus making
the acquisition "round robin" based on the sample clock.
If you want to make the first case work with 16 channels, I suggest you
change the dScanRate to this:

> f64 dSampRate = 10000.0;
> f64 dScanRate = 10000.0 /(16+1);

The +1 is just to offer a buffer time.
However, this means that your effective sample rate per channel (aka
dScanRate) is now 10000/17. Is that ok?
If you want the effective sample rate per channel (dScanRate) to be 10kHz,
then you need to bump up dSampRate to 10000 * 16 (=160000, which is
achievable on this device) or greater so that the A/D converter has enough
time to go thru all the 16 channels and still make the dScanRate.

I hope this helps.

--

| Ken Sadahiro (Ken.Sadahiro@ni.com)
| Sr. Software Engineer, User Advocate
| Systems & Architectures: Applications Group
+----+-------------------------------------------
| National Instruments Corporation
| 11500-A North MoPac Expressway
| Austin, Texas 78759-3504 USA
| Tel: +1.512.683.8806
| Fax: +1.512.683.8641
| URL: http://www.ni.com/


Thomas Gaudette wrote in message
news:38307de8@newsgroups.ni.com...
> I am trying to write a simple c-file to collect some data with my
PCI-6052E
> Card. The card should be able to handle a sample rate of 333kHz, but I am
> finding even if I ask for all sixteen channels at 10KHz using the DAQ_Rate
> function, I get an error with the time on SCAN_Start.
>
> The folloing code snip-it generates the error:
> << Snip it>>
> f64 dSampRate = 10000.0;
> f64 dScanRate = 10000.0;
> i16 iUnits = 0;
>
> iStatus = DAQ_Rate(dSampRate, iUnits, &iSampTB, &uSampInt);
> iStatus = DAQ_Rate(dScanRate, iUnits, &iScanTB, &uScanInt);
>
> iStatus = SCAN_Start(iDevice, DataBuffer, ulCount, iSampTB, uSampInt,
> iScanTB, uScanInt);
>
> printf(" \tiSampTB =%d\n",iSampTB);
> printf(" \tuSampInt =%d\n",uSampInt);
> printf(" \tiScanTB =%d\n",iScanTB);
> printf(" \tuScanInt =%d\n",uSscanInt);
>
> << Output >>
>
> iSampTB = 1
> uSampInt = 100
> iScanTB = 1
> uSscanInt = 100
>
> Error: -10092
> Some devices require a time gap between the last sample in a scan and the
> start of the next scan. The scan interval you have specified does not
> provide a large enough gap fo rthe board. See your documentation for an
> explanation.
>
> But if I use the following code I do not get an error:
> << Snip it>>
> f64 dSampRate = 10000.0;
> f64 dScanRate = 10000.0;
> i16 iUnits = 0;
>
> iStatus = DAQ_Rate(dSampRate, iUnits, &iSampTB, &uSampInt);
> iStatus = DAQ_Rate(dScanRate, iUnits, &iScanTB, &uScanInt);
>
> iStatus = SCAN_Start(iDevice, DataBuffer, ulCount, iSampTB, uSampInt,
> iScanTB, 0);
>
> printf(" \tiSampTB =%d\n",iSampTB);
> printf(" \tuSampInt =%d\n",uSampInt);
> printf(" \tiScanTB =%d\n",iScanTB);
> printf(" \tuScanInt =%d\n",uSscanInt);
>
>
> Could anyone point me in the correct direction?
> Please reply directly to
> tgaudett@nmr.mgh.harvard.edu
>
>
> Thanks in advance,
>
> Tom
>
>
Message 2 of 2
(3,876 Views)