LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to generate upto 25KHz range

I am generating 5 frequency outputs upto 700Hz using PCI-6723 AO channels by changing the 'Rate'.
But I want to generate upto 25KHz range.
If I drives the frequeucy above 800Hz Iam getting the following error message.
Error -200018 occurred at Property Node DAQmx Task (arg 1) in daqmxcfg_DAQmx Is Task Done.vi->ESeriesAOTest 1.vi
Possible reason(s):
DAC conversion attempted before data to be converted was available.
Decrease the output frequency to increase the period between DAC conversions, or reduce the size of your output buffer in order to write data more often. If you are using an external clock, check  your signal for the presence of noise or glitches.
Task Name: _unnamedTask<1E>

1) how to resolve the above problem?
2) Send me some example code.
0 Kudos
Message 1 of 4
(3,486 Views)
Hi gopal_ak,

     In PCI 6723 product page,  ( http://sine.ni.com/nips/cds/view/p/lang/it/nid/12551 ) you can find the following:

             800 kS/s per channel for one channel; 45 kS/s per channel for 32 channels

     800 kS/s means that you can achieve an (awful) waveform at 400 kHz (Nyquist theorem);  to obtain better sampled waveform, is good practice to reach maximal frequencies of 3/5 times the Nyquist frequency (400 kHz).    If you're using multiple channels, you have a Nyquist frequency of 45/2 kS/s, that is 22.5 kHz.

    In your post you actually wrote 700 Hz, you mean 700 kHz, I suppose?

    More, if you want, post the task creation-configuration functions you use in your project.

    Trying to help..... let me know, and have a nice day!

graziano

     
0 Kudos
Message 2 of 4
(3,476 Views)
Hi Graziano,
 
Thanks for your solution. Now I could able to generate the frequency signal upto 25KHz. But the resultant waveform what Iam getting is  SawTooth Wave (Please refer the attached (Refer zipped Sine_wave_8Khz.bmp) file. I captured thro Oscilloscope). But my requirement is to generate 5 Sine wave signals with the range of 0-25KHz.
 
The sample code what Iam using is given in Query.TXT of the attached Zip file

Please let me know the code what Iam using is correct or not . Also if possible send me the sample code to generate the sine freq.signal (Upto 25Khz) .
 
Best Regards
gopal_ak
0 Kudos
Message 3 of 4
(3,454 Views)
Hi gopal_ak!

   there're a lot of remarks about your SW......
 
   First of all, I think it's not good practice to store your waves in TestScript[index_i].Value[Count], I suppose you switch from one wave to another changing index_i value..... this is not the common practice in LabWindows-NIDAQ.

   First, you have to ADD CHANNELS TO YOUR TASK:

   instead of

     DAQmxErrChk (DAQmxCreateTask("",taskHandle));
    DAQmxErrChk (DAQmxCreateAOVoltageChan(*taskHandle,"Dev1/ao0","",min,max,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxCfgSampClkTiming(*taskHandle,"",rate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
    if( numChannels )
        DAQmxErrChk (DAQmxGetTaskAttribute(*taskHandle,DAQmx_Task_NumChans,numChannels));

you place something like

    DAQmxErrChk (DAQmxCreateTask("",taskHandle));
    DAQmxErrChk (DAQmxCreateAOVoltageChan(*taskHandle,"Dev1/ao0","",min,max,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxCreateAOVoltageChan(*taskHandle,"Dev1/ao1","",min,max,DAQmx_Val_Volts,NULL));
    DAQmxErrChk (DAQmxCreateAOVoltageChan(*taskHandle,"Dev1/ao2","",min,max,DAQmx_Val_Volts,NULL));     //and so on....
    DAQmxErrChk (DAQmxCfgSampClkTiming(*taskHandle,"",rate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
      if( numChannels )
        DAQmxErrChk (DAQmxGetTaskAttribute(*taskHandle,DAQmx_Task_NumChans,numChannels));

This was the first step.  This is to add 2 more channels to your task.  If you do it properly, you'll get 3 (or 5, it depends upon channels you put....) as DAQmx_Task_NumChans,numChannels. This is a variable which contains the actual number of channels you have in your task.

After that, you perform a Write function this way:

Write_ContGenPerWfmIntClk(taskHandle,&data[0],bufferSize)

in which data[0] contains ALL THE 5 WAVEFORM YOU WANT TO GENERATE.  This is quite important, you do not have to use 5 vectors to store 5 waves!!!!!!! 

You do this in the actual wave write:

DAQmxWriteAnalogF64(taskHandle, bufferSize, 0 , 10.0 , DAQmx_Val_GroupByChannel, data,&written,NULL);

Here, data will contain the 5 waves, in the same way:  bufferSize is the data wave length, I mean, you can have a sinusoid of 100 points, and data will have 500 oints:  from 0 to 99 you have the first wave, from 10 to 199 the second, and so on.....

This is a little bit messsy, I know, but I hope I understood your problem, and please, let me know if you reach to generate what you want.

graziano


PS.: actually, I don't work with DAQmx  analogic devices, so I can't test what I'm saying..... so let me know!





0 Kudos
Message 4 of 4
(3,447 Views)