Hi, All
When I use PCI 6034E to scan multiple channels (double buffer), I met a strange problem. If I want to scan 3 or 6 channels and the frequency of each channel is 100 (or 10) HZ, Scan_Start reports error 10697 (Unable to convert your timebase/interval pair to match the actual hardware capabilities of this board). I checked the values of iSampTB,uSampInt, iScanTB, and uScanInt. They are 1us, 3333, 1us, 10000, respectively. Does this error means 6034E can't support these values? If I change the frequency (each channel) to 110 or 104 HZ, there is no such error. What's wrong with my program?
Thanks.
Le Cai
I attached part code here.
i16 i,j;
i16 iStatus = 0;
i16 iRetVal = 0;
i16 iDevice = 1;
// i16 iChan = 1;
i16 iGain = gain;
f64 dSampRate;
dSampRate = frequency*num;
f64 dScanRate = frequency;
u32 ulCount = frequency*num/SIZE_HALF;
f64 dGainAdjust = 1.0;
f64 dOffset = 0.0;
i16 iUnits = 0;
i16 iSampTB = 0;
u16 uSampInt = 0;
i16 iScanTB = 0;
u16 uScanInt = 0;
i16 iDAQstopped = 0;
u32 ulRetrieved = 0;
i16 iNumMUXBrds = 0;
i16 iNumChans = num; //num is the number of channels
//Two buffers (half buffer and full buffer) for measurement data
static i16 *piBuffer = (i16 *) malloc (frequency*num*sizeof(i16)/SIZE_HALF);
static i16 *piHalfBuffer =(i16 *) malloc ((frequency/2)*num*sizeof(i16*)/SIZE_HALF);;
//get channel numbers from channel array and set Gain vector, set output files
static i16 piChanVect[8] ;
static i16 piGainVect[8] ;
for (j=0;j {
piChanVect[j]= (i16)channel[j];
piGainVect[j]= iGain;
}
i16 iIgnoreWarning = 0;
i16 iYieldON = 1;
i16 iDBmodeON = 1;
i16 iDBmodeOFF = 0;
i16 iLoopCount = 0;
//the time of reading half buffer
//since we set the size of half buffer as num*frequency/2
//we will read half buffer once per half second
i16 iHalfBufsToRead = time*2*SIZE_HALF;
i16 iHalfReady = 0;
u32 ulPtsTfr = 0;
//the interval between starting sample points of two channels
//in half buffer
int point_per_channel=frequency/(2*SIZE_HALF);
/* Convert sample rate (S/sec) to appropriate timebase and sample
interval values. (NOT scan interval values) */
iStatus = DAQ_Rate(dSampRate, iUnits, &iSampTB, &uSampInt);
/* Convert scan rate rate (S/sec) to appropriate timebase and
sample interval values. (NOT scan interval values) */
iStatus = DAQ_Rate(dScanRate, iUnits, &iScanTB, &uScanInt);
/* Turn ON software double-buffered mode. */
iStatus = DAQ_DB_Config(iDevice, iDBmodeON);
iRetVal = NIDAQErrorHandler(iStatus, "DAQ_DB_Config",
iIgnoreWarning);
iStatus = SCAN_Setup(iDevice, iNumChans, piChanVect, piGainVect);
iRetVal = NIDAQErrorHandler(iStatus, "SCAN_Setup",
iIgnoreWarning);
/* Acquire data from multiple channels. */
iStatus = SCAN_Start(iDevice, piBuffer, ulCount, iSampTB,uSampInt, iScanTB, uScanInt);
iRetVal = NIDAQErrorHandler(iStatus, "SCAN_Start",
iIgnoreWarning);