Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating a frequency ramp in ANSI-C (DAQmx, Status: -200459)

Hello,

 

I'm trying to write a stepper driver output that ramps up in frequency.  I have it running with a fixed number of steps and a fixed frequency.  I'm just trying to ramp from 0Hz to some speed over a fixed period of time using the ANSI-C function DAQmxWriteCtrFreqScalar.  When I call it on a task (regardless of if it's running or not) it fails with the status response -20459: 

 

Measurements: Write failed, because there are no output channels in this task to which data can be written.
Task Name: linMotorDrv

Status Code: -200459

 

Is there a way to change the frequency of a continuous pulse train while it's running?  And does anyone know why I wouldn't be able to write to this output channel?  I'm able to set all the parameters when configuring the task initially, but never again after.

 

Thanks in advance.

-mtburt

0 Kudos
Message 1 of 2
(4,768 Views)

Hi mtburt,

 

Welcome to the NI forums!

 

This thread covers the same issue (coded in LabVIEW).  Instead of calling DAQmx Write, I would suggest using the DAQmxSetCOPulseFreq and DAQmxSetCOPulseDutyCyc functions:

 

  • int32 __CFUNC DAQmxSetCOPulseFreq(TaskHandle taskHandle, const char channel[ ], float64 data);
  • int32 __CFUNC DAQmxSetCOPulseDutyCyc(TaskHandle taskHandle, const char channel[ ], float64 data);


This should allow you to change your pulse settings on the fly in software.  There is an open Corrective Action Request regarding the misleading error message--we hope to fix this soon to make things more clear.  Thanks for posting and have a great day!

 

-John 

 

 

 

 

John Passiak
0 Kudos
Message 2 of 2
(4,756 Views)