Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Analog Output Continuous waveform Non-Regeneration output

Has Anyone written a application which produces continuous Analog output waveform with "Regeneration mode Disabled" using DAQmx C-APIs.

thanks
satish
0 Kudos
Message 1 of 7
(3,928 Views)
You can use this function: DAQmxSetWriteRegenMode(TaskHandle taskHandle, int32 data);
With this parameter for 'data': DAQmx_Val_DoNotAllowRegen
Attached is the help file where I found this info also:)
-Alan A.
0 Kudos
Message 2 of 7
(3,913 Views)
Whoops. Here is the help file.
0 Kudos
Message 3 of 7
(3,910 Views)
yes I used the above mentioned function to disable regeneration but how do I continuously output data say in a "while" loop also checking to see that the write buffer is not overwritten before outputting.
Here is the modified example code that I'm working on but somehow it is not giving me the desired result.

thanks,
satish

int main(void)
{
int32 error=0;
TaskHandle taskHandle=0;
char errBuff[2048]={'\0'};
bool32 done=0;
int i=0;
int32 written;

uInt32 writeBufferSpaceAvailable;
float64 data[250000*8];

for(;i<250000*8;i++)
data[i] = 9.95*sin((double)i*2.0*PI/100000.0);

/*********************************************/
/*/ DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,"PXI1Slot7/ao0:7","",-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",250000,DAQmx_Val_Rising,DAQmx_Val_ContSamps,250000*2));
DAQmxErrChk (DAQmxCfgOutputBuffer (taskHandle, 250000*2));
DAQmxErrChk (DAQmxSetWriteRegenMode(taskHandle,DAQmx_Val_DoNotAllowRegen));

/*********************************************/
/*/ DAQmx Write Code
/*********************************************/
DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,250000,0,-1,DAQmx_Val_GroupByScanNumber,data,&written,NULL));

/*********************************************/
/*/ DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(taskHandle));

printf("Generating voltage continuously. Press any key to interrupt\n");

while(!_kbhit())
{

DAQmxErrChk (DAQmxGetWriteSpaceAvail(taskHandle, &writeBufferSpaceAvailable));
printf("writeBufferSpaceAvailable : %d\n",writeBufferSpaceAvailable);
if(writeBufferSpaceAvailable > 250000)
{
DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,250000,0,-1,DAQmx_Val_GroupByScanNumber,data,&written,NULL));
printf("data written : %d\n",written);
}
Sleep(100);
}
_getch();

Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
/*********************************************/
/*/ DAQmx Stop Code
/*********************************************/
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
}
if( DAQmxFailed(error) )
printf("DAQmx Error: %s\n",errBuff);
printf("End of program, press Enter key to quit\n");
getchar();
return 0;
}
0 Kudos
Message 4 of 7
(3,904 Views)
So what results are you getting?
-Alan A.
0 Kudos
Message 5 of 7
(3,890 Views)

Hello,

I am also trying with no regeneration and the code above, and it prompt with error message:

Unhandled exception at 0x00413085 in DAQmx_wfm_noregen.exe: 0xC00000FD: Stack overflow.

and debug breaks at the file chkstk.asm at the line:

test    dword ptr [ecx],eax     ; ...probe it

Hope it helps. Smiley Happy

Rolly

0 Kudos
Message 6 of 7
(3,813 Views)
That particular error doesn't seem to be related to using non-regeneration ao.  Are you able to use a simple analog output shipping example?
-Alan A.
0 Kudos
Message 7 of 7
(3,786 Views)