Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Again help require

Sir i m using PCI6025E to get voice from 8 channels continousely using half buffer ready the code is as follow:



iStatus = Timeout_Config(iDevice, lTimeout);

iRetVal = NIDAQErrorHandler(iStatus, "Timeout_Config",iIgnoreWarning);



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

iRetVal = NIDAQErrorHandler(iStatus, "DAQ_Rate",iIgnoreWarning);

if(!debug)

printf("\nActual bitrate : dwamptate = %f ismtb = %d usamint = %d", dSampRate, iSampTB, uSampInt);

iStatus = DAQ_DB_Config(iDevice, iDBmodeON);

iRetVal = NIDAQErrorHandler(iStatus, "DAQ_DB_Config",iIgnoreWarning);



iStatus = SCAN_Setup (iDevice, iChan, ichanVector, igainVector);

iRetVal = NIDAQErrorHandler(iStatus, "SCAN_Setup", iIgnoreWarning);



iStatus = SCAN_Start (iDevice, piBuffer, ulCount,iSampTB, uSampInt , iscanTimebase, iscanInterval);

iRetVal = NIDAQErrorHandler(iStatus, "SCAN_Start", iIgnoreWarning);

int first=second=1;

while(first)

{

//Here create file to record voice





while(second)

{



if((iStatus = DAQ_DB_HalfReady(iDevice, &iHalfReady, &iDAQstopped)) != 0)

{

//Error

}

if (iHalfReady == 1)

{

if((iStatus = DAQ_DB_Transfer(iDevice, piHalfBuffer, &ulPtsTfr, &iDAQstopped))!= 0) {

{

//Error

}

//here store the voice in the file close file break second loop

}



}

}//end second loop





Desription :

piHalfBuffer store one minute data second loop and the second loop is running continously but this is hotlooping taking cpu resources very much

but i want such mechanism that tell me after one minUte is acquird and i can get it from double buffer and can transfer to half buffer as i m checking continously

the halfready flag so i can finish the second loop.Please tell such code that only invoke callback or give indication after the one minute data is acquired in the buffer i hope u have understand my question

actaullly i m making recorder that got data from 8 channels and i want more efficiency less cpu overhead.

THANKS AJMAL(ajmal_qau@yahoo.com)
Lead Data Scientist
0 Kudos
Message 1 of 2
(3,023 Views)
Hello Ajmal. Thank you for contacting National Instruments. Since you have an E Series device with VC++, you should consider using DAQmx. DAQmx does all of the double buffering for you so you don't have to mess with it. Take a look at this KnowledgeBase on how to get started with DAQmx. This tutorial talks about LabVIEW, but the concepts are the same in VC++.

If switching drivers is not an option, take a look at some of the examples on ni.com. Go to Developer Zone>>Example Code and search "double buffered." Many examples will appear. Please let me know if you have any questions. Have a great day!

Marni S.
National Instruments
0 Kudos
Message 2 of 2
(3,006 Views)