LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital signal generation using LabWindows CVI

Hi,
 
I am trying to generate a digital signal using port0/line1 of my 6071E board. I wrote the following code to configure my task:
 
 DAQmxErrChk (DAQmxCreateTask("",taskHandle));
  printf("Task Created\n");
 DAQmxErrChk (DAQmxCreateDOChan(*taskHandle,chan,"",DAQmx_Val_ChanForAllLines));
  printf("Channel Created\n");
 DAQmxErrChk (DAQmxCfgSampClkTiming(*taskHandle,"",Rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,NumSamples));
  printf("Clock Created\n");
Error:
 return error;
 
However it is generating the following error when I call DAQmxCfgSampClkTiming():
 
"Requested value is not a supported value for this property.
Property: DAQmx_SampTimingType
You have requested: DAQmx_Val_SampClk
You can select: DAQmx_Val_OnDemand"
 
I have use similar code for Analog Outputs and it works. Why is not working with a Digital Output Channel ?
 
 
0 Kudos
Message 1 of 5
(3,690 Views)

Hello Pacsoft,
The reason you are getting an error when using the DAQmx Timing function is that your device, the PCI-6071E, has static digital i/o capabilities only.  So you can not perform hardware timed digital i/o.  You might want to take a look at the digital i/o examples.  In CVI, go to Help>>Find Examples.  Navigate to Hardware Input and Output>>DAQmx>>Digital Generation.  Look at "WriteDigPort.prj".  Hope this helps.
-Alan A.

0 Kudos
Message 2 of 5
(3,667 Views)
Ok. That makes sense. Anyway I am using a Counter to generate the square waveform I need, but the new problem is that I cannot find a way to change the frequency on the fly. The way I've been doing it is by stopping the task, configure again the task with the new frequency and then restart the task. The problem is that the frequency does not change smoothly because of the stop-configure-start process. I am using DAQmx driver. Do you know how to do this ?
0 Kudos
Message 3 of 5
(3,667 Views)

Hi Pacsoft.

Sorry, I'm not familiar with DAQmx (yet); is it possible to toggle the output in an asynchronous timer callback? You could then change the callback interval "on the fly". If you need a square wave duty cycle other than 50%, you could control this with an additional timer.

Just a thought.

Regards,
Colin.

 

0 Kudos
Message 4 of 5
(3,661 Views)
Give DAQmxWriteCtrFreqScalar a try (assuming you just have the one pulse generation channel in your task; otherwise use DAQmxWriteCtrFreq).  It will update the pulse train frequency without having to restart the task.

Mert A.
National Instruments
0 Kudos
Message 5 of 5
(3,656 Views)