04-18-2008 10:43 AM
04-18-2008 03:04 PM
I managed to get it done with this, but I don't know if it's the best solution.
while(ApplicationIsRunning)
{
ErrorCode = DAQmxIsTaskDone (PulseHandle, &TaskDone);
if (TaskDone)
{
DAQmxStopTask(PulseHandle);
DAQmxSetCOPulseLowTime(PulseHandle, "/Dev1/ctr2", Delay);
DAQmxSetCOPulseHighTime(PulseHandle, "/Dev1/ctr2", PulseLength);
DAQmxSetCOPulseTimeInitialDelay(PulseHandle, "/Dev1/ctr2", Delay);
//DAQmxClearTask(PulseHandle);
DAQmxStartTask (PulseHandle);
}
}
04-21-2008 11:19 AM
Hello physicien nocturne,
According to this KnowlegeBase article (How Can I Change the Duty Cycle on My Continuous Pulse Train?) you should be able to change the duty cycle on the fly if you also set the frequency. This KnowlegeBase article shows how to do it in LabVIEW, but for text based you should use a DAQmxWriteCtrFreq (or DAQmxWriteCtrFreqScalar) function call. This should allow you to change the duty cycle without stopping the task.
I hope this helps, and have a great day!
Cheers,