LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM duty cycle varying issue on LabVIEW

Solved!
Go to solution

Hi,

I have attached two vi files. 

 

1. FanControllerPWM

2. PWMControl

 

In FanControllerPWM.vi file I have created a channel that generates PWM and a knob to vary the PWM .Using an external oscilloscope I can able to see the variation in frequency according to the variation in the PWM.

 

In PWMControl.vi file I have called the FanControllerPWM as subvi and I created a knob to vary the PWM frequency. 

 

When I try to vary the frequency on the knob on the PWMControl vi the PWM frequency remains the same and doesn't vary.

 

But I can able to vary it from FanControllerPWM vi. 

 

can I please know why? what am I missing here ?

Download All
0 Kudos
Message 1 of 2
(2,526 Views)
Solution
Accepted by topic author VikashKumar23

Hi Vikash,

 

what am I missing here ?

You missed the basic paradigm of LabVIEW: THINK DATAFLOW!

 

Explaining DATAFLOW: In PWMControl you read the current value of your knob and then you call FanController using this value. The subVI uses this value - and you wonder about it's usage? As PWMControl has finished its task it does not care about your try to change the knob value later on…

 

Possible solutions:

- run both VIs in parallel and use a queue/notifier to set the PWM value in your FanController! (basically a producer-consumer scheme)

- get rid of PWMControl and use only FanController…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 2
(2,515 Views)