02-02-2017 12:16 AM
I'm working with an NI-9474 Digital Output card in an NI-9174 chassis. Along with the digital output card, there is an NI-9239 Analog card and an NI-9422 Digital Input card.
I was hoping to use one of the digital outputs to drive a frequency input control for a motor. But software timing, even with a timed loop is not producing pulses consistently enough to drive the motor at a stable speed. Even with a max pulse/loop speed of 20Hz.
From what I understand, with hardware timing my pulse output options are limited.
How Do I Program the Frequency Output (FREQ OUT) Signal Using NI-DAQmx?
This will not give me the fine control I need over the speed of the motor.
Testing in MAX in Continuous Samples mode, it looks like I can change Samples to Write and Rate to have pretty fine control over the pulses out. But I can't test this on actual hardware at the moment
Do I have any other options?
.
Solved! Go to Solution.
02-03-2017 07:32 AM
I don't have a lot of familiarity with cDAQ family hardware so I can only speak to more general knowledge based mainly on desktop boards. Readings on the forums tell me that this stuff *can* also be true for cDAQ, but it may depend on which chassis and modules you use.
So anyway, the main idea is to generate your variable frequency output as a Counter task rather than a DO task. It's much easier to both get the precise timing you want and the ability to change frequency on-the-fly without stopping. If you add the phrase "on the fly" to your searches here, you should find a lot of relevant results.
- Kevin P
02-03-2017 08:57 AM
Hi Kevin,
Thanks for the reply!
Adding "On the fly" to my search term gave me some results I hadn't found before.
Change Counter Output Frequency on the Fly
I did have to make some changes to the example code to get it to run. (Basically replace the Reference and Value property combination with a Local Variable of the Frequency control.
I don't have access to the hardware at the moment. But the code is working in simulation. If I can produce a stable 100Hz pulse train, then I should be able to control the motor.