Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set/get the frequency or period on analog output of DAQmx??

Hi, I'm new to these forums and my hardware (NI USB-6351).

 

Right now I try to generate continuous pulse train or a sinewave by using DAQmx/VisualC++. 

 

I know hot to set/get the frequency while the signal output from digital panel.

(i.e. DAQmxWriteCtrFreqScalar / DAQmxReadCtrFreqScalar)  

 

But I really want to know how to change/check the frequency while the siganl output from analog panel.

 

Does anyone tell me whitch api commands could do this(or after the channel is created)?

At the following codes, I use continuous pulse train for example...

 

[CODES:]

for(;i<1000;i++)
{  if(i%2 ==0)  data[i] = 10;
   else  data[i] = -10;
 }

 

DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,"Dev1/ao0","",-10.0,10.0, DAQmx_Val_Volts,NULL));

DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",1000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));

DAQmxErrChk (DAQmxRegisterDoneEvent(taskHandle,0,DoneCallback,NULL));

 

 DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,1000,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));


 DAQmxErrChk (DAQmxStartTask(taskHandle));

 

thanks,

 

Sincere regards~

 

0 Kudos
Message 1 of 1
(2,613 Views)