From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I not have my SubVI just use default values for some of its inputs?

Solved!
Go to solution

I'm running code for an DS345 machine, using the example code from here: http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=E3B19B3E9149659CE034080020E748...

 

I'm using the 7.0 version (cause I'm in 7.1). 

 

So anyways. I managed to get the proper waveform I wanted, and just stored the waveform in the default values, and made the frequency an input, so I can input whatever frequency I want. When I run the example VI on its own, it outputs the waveform to the machine just fine, however, when I use this example VI as a SubVI, it doesn't output any data to the machine. 

 

Any ideas?

 

Thank you

 

Edit:

 

When I say default values for some of its inputs, I mean values that are usually plugged in by a user, controls that are not "inputs" to the VI.

0 Kudos
Message 1 of 9
(2,956 Views)

I have to close my main VI and then i'm able to run this VI successfully, I'm very confused. I need the main VI to be able to call it.

0 Kudos
Message 2 of 9
(2,943 Views)

If it is a VI that existed as an example, you should be able to run it on its own.

If you want to pass certain values to it, such as an array, then you need a main VI which has those values.

However, nothing prevents you from entering those values manually into the controls of the example VI and it should run on its own..

As a matter of fact, if you wanted to run a VI example without a calling VI and you had a large array (for instance) you could by-pass the front panel control (input) and wire the array within the block diagram of that VI.

 

So... I probably do not understand what you mean that you need a main VI to call another VI (sub-vi).  Sub-vi's should (usually - not all cases) be able to run on their own.

 

 

What are you trying to accomplish?  Can you post your code?

0 Kudos
Message 3 of 9
(2,935 Views)

Here's the relevant code. Note I removed a bunch, but this is the part that's having issues, and still isn't working (tested it)

 

Keep in mind, the Pulse On and Pulse Off subvi's are basically just the same example VI with different default values saved

0 Kudos
Message 4 of 9
(2,928 Views)

1. get the example running like you want it.

2. Edit -> Make current values default

3 save

 

4 close example

5 run main

 

Does it work now?

0 Kudos
Message 5 of 9
(2,915 Views)

I'm pretty sure that's what I did. If you open both of the Pulse On and Pulse Off VI's, you'll see they have different values as default, for example, the Pulse Off is outputting Noise, whereas the On is outputting a square wave.

 

I just opened the main, ran it, nothing happened.

Then I doubleclicked the ON, ran it, and it turned the wave on.

THen I doubleclicked the OFF subVI, and it turned the wave off.

Then I ran the main... Nothing...

0 Kudos
Message 6 of 9
(2,910 Views)

Does Pulse on work witht the Pulse voltage and pulse width you are passing to it?

 

When you double click a vi thats closed it comes up with all default values. Are you forcing voltage and width out of range with main so that it won't turn on?

0 Kudos
Message 7 of 9
(2,902 Views)

 


@Viper wrote:

Does Pulse on work witht the Pulse voltage and pulse width you are passing to it?

 

When you double click a vi thats closed it comes up with all default values. Are you forcing voltage and width out of range with main so that it won't turn on?


 

All of the default values are in range (and will successfully output to the machine)

 

The values I'm feeding it in the main are all valid too. And if they weren't, the machine gives me an error when I put in out of range values. 

 

I'm very confused

0 Kudos
Message 8 of 9
(2,899 Views)
Solution
Accepted by topic author bobholmgren

I figured out the issue, and I have to say I'm embarassed. If you look at the code, I'm feeding a VISA Resource Name, when the SubVI needs just a string with the number of the GPIB address.

0 Kudos
Message 9 of 9
(2,827 Views)