Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital waveform output pulse counter

Hello people!

I am working on an application for testing solenoid valves in pulse mode. The idea is to be able to register the number of cycles and to change the opening pulse duty cycle during the test.

The idea is to use a "for loop" to generate a 100 position array for digital output, so duty cycle can be easily adjusted. I placed the digital write function inside a "while loop" to use the loop counter as the cycle counter.

 

Because I wanted to know exactly the number of opening cycles, I initially used the DAQmx Timing vi wired as finite samples outside the writing loop, but this solution did not work. Several writing errors shown up as I tried to test different "auto start" input configurations, regeneration mode and task start/stop alternatives.

 

Merging some hints from the forum I got to 2 stable solutions:

1) To wire the Timing vi as continuous samples and let the Write vi to run freely inside the loop;

2) To remove the Timing vi and use the  Write vi as "on demand".

 

The 1st solution is elegant and nice in therms of buffering the output and repeatability of the generated signal, but it has absolutely no control of the number of pulses neither the duty cycle.

The second solution works great for duty cycle control and number of pulses recording, but because it relies on OS for requesting the writes, pulses are not repetitive and I always have to explain to my boss that I has nothing to do with the valve under test.

 

So, after that, my question is: Is it possible to have the best of all solutions buffering the output with finite samples timing configuration?

 

Hardware: cDAQ9189 + NI 9485 Solid State Relay module

 

Digital Output.png

0 Kudos
Message 1 of 2
(2,342 Views)

Hi Leonardo,

 

I suggest you to use DAQmx Counter Output task to generate the pulse train and then you change the duty cycle when it requires.

 

See the whitepaper Pulse Width Modulation (PWM) Using NI-DAQmx and LabVIEW to know how to create a counter output task and change the duty cycle dynamically.

 

Thanks 

Lincoln

0 Kudos
Message 2 of 2
(2,297 Views)