Solution
NI-DAQmx requires that when you update the duty cycle of a pulse train, you must update the frequency at the same time. To do this, create a NI-DAQmx Channel Property Node by going to
Functions Palette»Measurement I/O»DAQmx-Data Acquisition»DAQmx Channel Property Node.
On the DAQmx Channel Property Node, right-click
Property and select
Change to Write. Expand the DAQmx Channel Property Node to have two inputs. Create a
CO.Pulse.DutyCyc AND
CO.Pulse.Freqproperty by right-clicking
Property»Select Property»Counter Output»Pulse»Frequency and select
Duty Cycle. Repeat the last step for the second property and select
Frequency.
Create a new control for the duty cycle and the pulse frequency. Pass the new value for the duty cycle, as well as the desired frequency (even if it has not changed) to the property node. Since LabVIEW will execute a property node in a top-down manner, the duty cycle must be modified before the frequency value is changed.
The duty cycle can also be changed using the DAQmx Write VI when the instance of the VI is set to
Counter Freq 1Chan 1Samp . To do this, place a DAQmx Write VI on your block diagram by going to
Functions Palette»Measurement I/O»DAQmx-Data Acquisition»DAQmx Write.vi. From the pull-down menu of the DAQmx Write VI, select
Counter»Single Channel»Single Sample»Frequency.
Then create three controls for the task, frequency and duty cycle and wire them to the DAQmx Write VI.
See the Attachments section for examples on how to to perform both of the above methods using event structures.