Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM pulses using Digital I/O

Sir,

   Thank u for ur reply sir.But i m enable to get what u suggested.I jst need a pwm pulses of specified frequency whose duty ratio can be controlled.Even if dont use the  sawtooth waveform ,and just specify the duty ratio i.e nothing but  the count the counter sholud hold for high and low period I think its enough.Am I ryt ??? wht i meant in the previos discussion was how  to change the duty ratio automatically without using the indicator update duty ratio so that it automatically responds to change in duty ratio.I m attaching the VI in which i made modified for test purpose.Wht i want is when the two knobs are chaged the change in duty ratio shuld be observed.

0 Kudos
Message 11 of 18
(1,538 Views)

Yes, you can definitely update the duty ratio value from anywhere in your code, you simply need to write that value to a local variable. So instead of using the knobs you can programmatically change that value.

You code looks OK, you have written the value to a indicator and used a local variable tied to it to update the PWM parameters within the main loop so everything should work out fine. Though, ideally you should put the other code (which updates the control) in another while loop so that the changes you make are reflected correctly in the main while loop. That is what I was trying to convey in my previous post.

 

I hope this clarifies things. Your understanding is correct, using a local variable to update the PWM parameters should work fine.

 

Regards,

Navjodh

0 Kudos
Message 12 of 18
(1,533 Views)

Sir,

    Thank you so much.Actually when i change the knob postions i.e the difference x-y cahnges and click update duty ratio the change in duty ratio is not observed may be bcoz of the improper use of the property node block ,bcoz culdnt undersatnd  that  block properly.Also as u specified that i need to write a code so that change in duty ratio is automatically refelected i.e the update duty ratio control is not required.Sir plz give me guidelines for that code.

 

0 Kudos
Message 13 of 18
(1,530 Views)

Hi,

 

Ideally, you will have a parallel loop (apart from the main loop) where you will be making changes to duty cycle values and writing that to a variable. Another copy of the variable will make the new value available inside the main loop.

 

I have taken the code from the link that I shared with you earlier (Complete PWM.vi at the link http://zone.ni.com/devzone/cda/tut/p/id/2991) and added a parallel loop for your reference (see attached code). In this case you do not need to manually press the update button since there is logic that compares new value with previous value and automatically makes the update. 

Mainly, adding the parallel loop is the only extra code that you will have to write (apart from, of course, the logic that you are trying to implement).

 

Regards,

Navjodh

0 Kudos
Message 14 of 18
(1,522 Views)

Sir,

Thank you so very much.Sir can u plz send the VI which u attached with previous mail in version 8.6 or below.

Thanking You,

J.H Agrawal

0 Kudos
Message 15 of 18
(1,513 Views)

Here's the VI for LV 8.6

0 Kudos
Message 16 of 18
(1,508 Views)

Sir,

    Thank you so very much .The code is working properly now. I will modify it according to my programme and let u know if some problem persists.

Thanking You,

J.H.Agrawal

0 Kudos
Message 17 of 18
(1,505 Views)

I m trying to implement SPWM(Sinusoidal pulse width modulation) in LAbview using digital I/o .But i m getting an error saying "external clock source ".Can anybody plz help me out with this.I am attaching my VI for reference.

0 Kudos
Message 18 of 18
(1,483 Views)