12-16-2014 03:44 AM
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
Solved! Go to Solution.
12-17-2014
08:12 AM
- last edited on
02-17-2025
10:28 AM
by
Content Cleaner
Hi Joox
Have a look at the following example:
NI-DAQmx: M Series Pulse Width Modulation (PWM) - National Instruments
https://forums.ni.com/t5/Example-Code/NI-DAQmx-M-Series-Pulse-Width-Modulation-PWM/ta-p/3996080
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
12-18-2014 04:53 AM
Thanks, corinneD, I didn't think about using the FIFO and pre-store the waveforms, its really inspiring.
Regards
Joox
12-18-2014
12:15 PM
- last edited on
02-17-2025
10:28 AM
by
Content Cleaner
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,
12-20-2014 06:54 PM - edited 12-20-2014 06:56 PM
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