01-03-2012 04:11 AM
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.
01-03-2012 04:29 AM
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
01-03-2012 05:06 AM
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.
01-03-2012 06:56 AM
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
01-03-2012 10:21 PM
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
01-03-2012 10:36 PM
Here's the VI for LV 8.6
01-03-2012 10:57 PM
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
03-06-2012 05:38 AM
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.