LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to have a integer value(dial position) that can be used between 2 VI's.. Could you explain how this is possible please

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.

  

 

 

Download All
0 Kudos
Message 1 of 8
(3,718 Views)

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

 

0 Kudos
Message 2 of 8
(3,715 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 3 of 8
(3,714 Views)
Thanks for the reply. We tried this but it still and it worked but now the PWM has slowed right down.....
Download All
0 Kudos
Message 4 of 8
(3,691 Views)

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

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 5 of 8
(3,684 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 8
(3,672 Views)

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

 

 

0 Kudos
Message 7 of 8
(3,649 Views)

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.

0 Kudos
Message 8 of 8
(3,646 Views)