Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM pulse generation 6211

Solved!
Go to solution

Hi all,

I’m quite a newbie with Ni meas. I wanted to make a signal generation/meas application and the NI 6211 USB came in hand. No need to say that the chance to use it would facilitate the task incredibly by integrating signal generation, meas. and data processing

 

My application is quite easy: I wanna generate a PWM pulse, this pulse consists of two parts, the first 10ms with a 80% duty cycle and the second part that is 20 ms with a 50% duty cycle.

 

Initially I thought about using a microcontroller, that is, to program a timer with the first pulse length and a second to generate a PWM, the end of the first part would trigger an interrupt and in there I would program the second pulse length and the second duty cycle. This reprogramming would take microseconds, there would be no delay and both pulses would be connected seamlessly.

Since the NI 6211 USB has two timers, I thought that maybe this behavior would be also possible (through interrupts or combinatory logic). If not, the variables should be changed via software and USB, increasing the time between pulses and making it less predictable.

 

My question is: Would be the microcontroller-like (real time)  behavior possible? How?

 

Thank You Very Much

Joox

0 Kudos
Message 1 of 5
(6,188 Views)

Hi Joox

 

Have a look at the following example:

NI-DAQmx: M Series Pulse Width Modulation (PWM) - National Instruments
http://www.ni.com/example/30043/en/

 

There, they nicely show how to program the PWM and to continuously change the duty cycle and the period of the PWM.

 

I hope this helps with your application.

Kind regards,

Corinne

Corinne Doppmann
Application Engineer
National Instruments
Message 2 of 5
(6,161 Views)

Thanks, corinneD, I didn't think about using the FIFO and pre-store the waveforms, its really inspiring.

 

Regards

Joox

0 Kudos
Message 3 of 5
(6,149 Views)

The 6211 only supports software-timed digital outputs so the example linked won't work as written on this hardware.  To be fair, the linked example suggests that it supports all M Series, but this is not correct (the 621x are quite a bit different from the other M Series devices and this example will not work with them).  There is actually a comment on the linked example itself:

 

This VIs does not work for the M series USB-6211. The error is at the DAQmx Timing: Sample Clock, and it requires On Demand. Is there any modified version of this VIs to work with the model USB-6211 and similar? Thanks.

 

 

However, with a slight modification to the example you may use the Analog Output to do what you need.  Replace the U8 digital output array with the analog voltage equivalents (i.e. "0" for low and "5" for high) and use an analog task instead of a digital one.  Using the counter to generate the sample clock is unnecessary since the Analog Output subsystem has its own timing engine.

 

 

Best Regards,

John Passiak
Message 4 of 5
(6,137 Views)
Solution
Accepted by topic author Joox

Hi all, 

I found a solution to make the 2 signals perfectly seamlessly concatenated, in fact is quite easy.

I generate 2 different signals with 2  "Simulate Signal" blocs  (from  Simulate Signal Express) and the I use the function "Append" to concatenate them one after the other with no delays. I output then through the analog output.

 

Thank You!

Best Regards

Joox

0 Kudos
Message 5 of 5
(6,111 Views)