Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run the SubVI?

Solved!
Go to solution

Hello,

I am using a instrument control VI and within that I have used a subVI to start the power supply after a certain point. I have created a simple two way pattern in the SubVI which includes just error in as an Input and error out as an output and wired them to the respective terminals in main VI. The SubVI has 5 control inputs which I have made default values hence it will always execute with that values. Those values act as an input to the Power Supply I am controlling with that subVI. 

Now when I run my VI it doesn't start the sub VI, It won't execute the values from control and gives 0 input to the PSU so it won't run. I want that SubVI to run when I run my Main VI. Am I missing something ? SubVI runs perfectly when I try to run it seperately.

What more things should be done when we link any SubVI to the Main VI.

Thank you.

0 Kudos
Message 1 of 7
(4,955 Views)

Did you save the values as default?

 

You might want to post your subVI to see if one of us can find your problem.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(4,953 Views)

Hello,

Thank you for the reply.

Yes, I have made the values default and they will appear as it is when I open the program again.

I have attached both of the VI's. The state machine example is the Main VI and PSU_OCP State communication is the SubVI.

Thank you.

Download All
0 Kudos
Message 3 of 7
(4,949 Views)
Solution
Accepted by topic author Mohit1991

LOCAL VARIABLES!!!

 

Your problem is that you have what we call race conditions.  Learn to think in data flow.  A function will execute when it has all of its inputs and will output its data when it is done running.  So what are local variables waiting for in order to run?  NOTHING.  So they run immediately, returning the default data.

 

The solution is quite simple, use wires instead.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 7
(4,946 Views)

Hello,

Thank you for the reply.

But still the Local variables should execute the values written in control right? I mean, as you said that Local variables are not waiting for anything and executing the default values, but the default values is something I want. What I am missing is when I run it the output array still shows 0 which means the SubVI is not runnning. 

How can I correct that?

Thank you.

0 Kudos
Message 5 of 7
(4,944 Views)
Solution
Accepted by topic author Mohit1991

@Mohit1991 wrote:

Hello,

Thank you for the reply.

But still the Local variables should execute the values written in control right? I mean, as you said that Local variables are not waiting for anything and executing the default values, but the default values is something I want. What I am missing is when I run it the output array still shows 0 which means the SubVI is not runnning. 

How can I correct that?

Thank you.


But you are write to the power supply with the values BEFORE your array is created.  DATAFLOW.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 7
(4,942 Views)

Hello,

I am not sure how to do that. I am using Local variables for using the indicators as input for next process and also to divide the binary into high and low bits and then supply individual bit.

Can you explain me more? I am a little confused here.

Thank you.

 

0 Kudos
Message 7 of 7
(4,934 Views)