11-26-2008 03:17 AM
We have listed the two VI's that we need to have a common input.
The dial from Main.VI is needed to feed into PWM.VI aswell as for use in the Main.VI. At the moment the dial value gets fed through once, however when we increase the value on the dial the value doesn't update in the PWM sub VI. The only way the value updates is if the Main.Vi is started then stopped.
11-26-2008 03:25 AM
Your Dial is in the while loop, .........your PWM.vi is outside of the while loop.
So its "expected behaviour" that the PWM.vi will be updated after you leave the while loop when stopping the Main.vi.
Christian
11-26-2008 03:27 AM
It looks like the PWM sub loops forever, and since it's connected outside the loop in Main it wont get updated again.
Wouldn't it work to just move the PWN-call inside the loop in Main and remove the loop in PWN? If i'm right the main will then call the PWN each loop which'll only run once.
/Y
11-26-2008 04:44 AM
11-26-2008 05:03 AM
I'm not sure I understand your problem, but your question in the subject line asks if it's possible to have an integer value used in two VIs. The answer is yes; pass a reference to the dial control to the PWM vi and read a (value) property node there.
Jim
11-26-2008 07:24 AM
I would like to invite you to take a look at my Nugget on Action Engines.
Since you have a data value that must be available for live updates in more than one place in the code, an Action Engine will provide a reliable method to share that value. You will update the Action Engine any time the control changes. All other function that require that information can read the the value form the Action Engine.
That method has been in use since LV version 2 and provided the AE is implemented correctly (see Nugget) it gives good performance and helps keep code modular.
I hope that help,
Ben
11-26-2008 03:55 PM
I am working with the other member who originally posted this question.
We are having issues when running the program by calling the PWM as a sub VI.
When we run the programs separately, but at the same time, the PWM signal is not affected and runs as expected. However, when we run the PWM.Vi as a sub VI and feed values through to it the PWM signal outputted by the DAQ card is slowed down significantly. Is there any particular reason for this?
Note : the VI's posted above now have the loop in the PWM signal removed, this allows for the dial to control the duty cycle from the Main.VI (where we previously had difficulties
11-26-2008 04:00 PM
Another issue we are having is related to the graphing of voltage vs current, acquired through the USB 6008 DAQ card.
Since we cannot use the switching frequency of 10khz, due to limitations of the DAQ card, we are switching at 10Hz. This results in the graph waveforms been so slow that it appears as a square/oscillating waveform, is there any way to take only the peak of the waveform as those are the values we require.