LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pwm input/output.

i can currently designing a labview program that could generate pwm signals from the DAC1 and DAC0 channels. In addition, we must be able to change the duty cycle of the pulse during runtime.however, as we are quite new with labview. we would be grateful if someone could help us with a sample of a labview code that does that.
0 Kudos
Message 1 of 6
(3,669 Views)
Try going to the 'Help' in LabVIEW menu and do a search on "PWM". There are several examples that ship with LabVIEW that show generating a PWM signal using the analog outs.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 6
(3,669 Views)
On top of searching for examples in the LabVIEW Example Finder, I was also able to find an example that changes the specs of generated pulses on the fly.

The instructions are as follow:
This VI generates a single pulse on the default out pin of the chosen counter. This single pulse can continuously be triggered and re-triggered by a signal on the gate which will create a train of these single pulses. The pulses being outputted are also re-programmable while the VI is running, by simply changing the pulse specs. So if you change the frequency and/or duty cycle while the VI is running, the frequency and/or duty cycle of the out going pulses will be updated. This VI works with STC based devices (e.g.: E-series) as well as TIO based devices and uses a fixed, se
lectable timebase. The difference between this VI and the "Generate Retriggerable Pulse.vi" that ships with LabVIEW is that this example allows you to change the frequency and duty cycle on the fly.

The program was written in LabVIEW 6.0.2 with NI-DAQ 6.9.1.

I hope that you find this example helpful.

Jared A
0 Kudos
Message 3 of 6
(3,669 Views)
Is there a DAQmx equivalent to this VI?

Robert
0 Kudos
Message 4 of 6
(3,669 Views)
The attachment to this post was written in LabVIEW 7.1 and NI-DAQ 7.2. This example has not yet been released to our online forum, so there is a chance that it is not yet complete. You may have to do some programming yourself in this VI depending on the performance you are seeing.

Here are the preliminary instructions:

The NI-DAQmx driver allows you to reprogram the counters on the fly during continuous pulse train generation. This means that you can change both the number of pulses per second and the pulse-width while pulse train generation is in progress without glitching.

The attached example program demonstrates this capability. It can be used with E Series or 660x devices. The accuracy of the pulse train frequency and duty cycle
is limited only by the resolution of the internal timebase. You may choose any timebase supported by your device. The timebase you choose determines the range of frequencies you may produce.

A Note on Accuracy:

For E Series devices, there are two timebases available, yielding a counter resolution of 50 nanoseconds or 10 microseconds. For 660x devices, there are three timebases available, yielding a resolution of 12.5 nanoseconds, 50 nanoseconds, or 10 microseconds. If the pulse train specification you desire is evenly divisible by the timebase, then you can achieve within about 0.01 percent of the timebase on E Series devices or within about 0.005 percent of the timebase on a 660x device.

Best Regards,

Jared A
0 Kudos
Message 5 of 6
(3,669 Views)
Thank you, I appreciate it.

Robert
0 Kudos
Message 6 of 6
(3,669 Views)