From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I modify complete pwm example to make the frequency dynamic just like the duty cycle?

Solved!
Go to solution

I successfully downloaded and compiled "daqmx_pwm_examples.zip"

 

from http://www.ni.com/white-paper/2991/en

 

and executed it in LabView.  I know it works because the oscilloscope correctly displays a pulse waveform with the desired frequency and duty cycle. 

 

I noticed while the program is running, if I decide to change the duty cycle it dynamically updates the pulse wave form on the oscilloscope.  However, if I change the frequency while the program is running it does not update in the oscilloscope. 

 

I think the reason is because the duty cycle is hooked into a "shift register" whereas the frequency is not. 

 

I have attempted to hook up the frequency into a shift register as well, and I was wondering if i could get some advise with regards to simplying or correcting my back panel wiring diagram shown here:

 

http://i.stack.imgur.com/j6tdP.jpg

 

I would greatly appreciate all / any advise.

 

Thanks.

0 Kudos
Message 1 of 7
(2,425 Views)

You only need one instance of DAQmx Write; it has inputs for both Frequency and Duty Cycle. Delete the additional one. Add an OR on the case structure condition - you want to execute the write if the Duty Cycle has changed, OR if the Frequency has changed.

0 Kudos
Message 2 of 7
(2,420 Views)

Hi Nathand -

 

I have updated my wiring diagram based off of your suggestion: http://i.stack.imgur.com/p9g4u.jpg

 

Is this what you were referring to?

 

If not, could you please comment?

 

Thanks.

0 Kudos
Message 3 of 7
(2,398 Views)

I think that's the right wiring, but it's hard to tell since you show the false case where nothing happens. You could clean it up a bit by removing excessive wire bends and keeping wires running left to right.

 

No need to upload to a third-party image hosting site, the image hosting on this forum works fine and you can upload directly. Even better would be to attach your VI instead of a screenshot.

0 Kudos
Message 4 of 7
(2,392 Views)

HI Nathand -

 

I have uploaded the VI as well as an image of the back panel.

 

Please let me know what your thought are.

Download All
0 Kudos
Message 5 of 7
(2,381 Views)
Solution
Accepted by topic author invasion2121

Still some ugly wires (particularly the error wire that loops back under the case structure) but the logic looks fine. I'm not really sure what you're asking - are you still having a problem with it, or does it work as you expect? Did you test it?

Message 6 of 7
(2,376 Views)

Hi Nathand -

 

I just tested it right now and it works perfecrtly using the diagram below:

 

. complete_pwm6.JPG

 

I cleaned it up using the "Cleanup Diagram" button.  I uploaded the VI as well in case anybody else needs it.

 

Thanks for your help.

Download All
0 Kudos
Message 7 of 7
(2,368 Views)