08-20-2010 03:34 PM - edited 08-20-2010 03:38 PM
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.
Solved! Go to Solution.
08-20-2010 03:56 PM - edited 08-20-2010 03:57 PM
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.
08-20-2010 04:06 PM
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?
08-20-2010 04:21 PM - edited 08-20-2010 04:24 PM
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
08-20-2010 04:58 PM
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?
08-20-2010 05:14 PM
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...
08-20-2010 05:41 PM
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?
08-20-2010 05:48 PM
@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
08-23-2010 02:08 PM
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.