SubVI's in Main VI

I am new to this group and relatively new to labview, so forgive me if this
is a repeat post.
My question is sort of similar to the "duplication of controls" post
5/9/200. I have two kinds of subVI's that I want to use in a third main VI.
The two subVI's are for analog input and output and have associated
indicators and controls respectively. I want to use these in a third main
VI. My problem is this. I want the controls and indicators that I have
fashioned for the subVI's to appear in the main VI front panel and as of yet
I have not been able to get this to happen. Futher, the only way that I can
get the VI to work is to wire a "duplicate" control on the main VI diagram
(but this does not take the form that I have fashioned for it in
the subVI.
Also, I was using the AO or AI single point aquistion VI with a while loop
and global logical variable to start/stop all subVI's in the main VI. It is
hoped that we can do this to avoid using a while loop in the main VI to
start stop the main vi and the associated subVI's. Is this the most logical
way to go about his or should I use continuous AO and AI blocks in the
subVI's.
I hope that this has not been too confusing. Thanks in advance for any help.
Jeffrey Nesiba
NESAC/Bio Assistant
Chemical Engineering
Work (206) 543-8073
Home (206) 324-2472 (206) 320-0401
[email protected]

Thanks for all the help. As far as the second part of the question goes:
"Also, I was using the AO or AI single point aquistion VI with a while loop
and global logical variable to start/stop all subVI's in the main VI. It is
hoped that we can do this to avoid using a while loop in the main VI to
start stop the main vi and the associated subVI's. Is this the most logical
way to go about his or should I use continuous AO and AI blocks in the
subVI's."
I was still wondering if the route I have taken (AO or AI single point
aquistion VI within a while loop
and global logical variable to start/stop all subVI's in the main VI) is the
most logical. Or should I use a continuos AO/AI blocks. The end use is for a
simple process control mockup for a chemical engineering process control
class, so computing cycles are not a big issue if that may be concern.
Finally, I have in the past I have done what Kevin Kent suggested. The
problem with this is that the controls and indicators that I have fashioned
for the subVIs don't show up on the front panel on the main VI, rather it is
the control and indicators that I have just created by following KBK's
procedure. I/my professor would rather the student be able to use these
subVIs on a blank diagram and be able to connect them and use them without
having to delve to deep in to Labview (as they will have little or no prior
experience using labview). Having the VI/subVI use a preararnged
control/indicator would allow them to get started a little quicker with
process control rather than tackle labviews learning curve. Is there a way
of doing this that I have not discovered? Thanks again for suggestions and
help.
Jeff
Kevin B. Kent wrote in message
news:[email protected]...
> "Jeffrey L. Nesiba" wrote:
>
> > I am new to this group and relatively new to labview, so forgive me if
this
> > is a repeat post.
> >
> > My question is sort of similar to the "duplication of controls" post
> > 5/9/200. I have two kinds of subVI's that I want to use in a third main
VI.
> > The two subVI's are for analog input and output and have associated
> > indicators and controls respectively. I want to use these in a third
main
> > VI. My problem is this. I want the controls and indicators that I have
> > fashioned for the subVI's to appear in the main VI front panel and as of
yet
> > I have not been able to get this to happen. Futher, the only way that I
can
> > get the VI to work is to wire a "duplicate" control on the main VI
diagram
> > (but this does not take the form that I have fashioned for it in the
subVI.
>
> Create your 2 SubVIs (as you already have) , make sure you wire the
> controls and indicators to the terminals (right click on the icon of the
> front panel, select show connector, use the wire tool, click on the
> control / indictor, click on the terminal to use). Open a new vi
> drop the 2 subvis on the diagram. Right click on the terminals of the
> subvi and select Create control (or indicator) . This will create a
duplicate
> of the control / indicator on the front panel of the main VI .
>
> You will have to move them around to suit your needs.
> Kevin Kent
>

Similar Messages

  • Stream data from a subvi to the main vi - path refnum

    hello everyone
    sorry my english
    http://forums.ni.com/t5/LabVIEW/stream-data-from-a-subvi-to-the-main-vi/m-p/2205150/highlight/true#M...
    - refnum boolean worked
    - refnum graph worked
    - refnum numeric worked
    how to create a  path refnum? stream data from a subvi to the main vi
    where do I start?
    thank
    Solved!
    Go to Solution.

    Bom Dia Saille,
    Eu acredito que o que você tenha hoje seja isso aqui (Desenho bem simplificado):
    Hoje o que você tem é o Aplicativo do Medidor + USB Driver controlando o seu medidor. Basicamente, sua aplciação está dividida em três camadas:
    Aplicação - Onde estão as funcionalidades principais do programa (interface com o usuário, apresentação de dados, geração de arquivos, etc.)
    VISA - Uma arquitetura de Software para controle de instrumentos. Basicamente, ele se comunica com o Driver USB para poder enviar e receber pacotes de dados através do barramento USB.
    Device Driver - Intruções de SW de baixo nível para controlar um periférico através de um barramento.
    No desenho, eu aponto duas camadas onde você pode tentar atuar para automatizar suas medições:
    Aplicação - Você pode usar o VI Server para controlar o Aplicativo do Medidor (Se este aplicativo tiver sido desenvolvido em LabVIEW, o que eu suponho ser verdade). No entanto é necessário saber se o desenvolvedor do produto permitiu isso (Veja Using VI Server to Pass Data Between a VI and a LabVIEW Executable). Outra alternativa é conversar com o fabricante para ver se ele desenvolveu alguma API (Application Programming Interface) para que você consiga controlar o instrumento diretamente.
    VISA - O LabVIEW Fornece uma API chamada NI-VISA para poder enviar e receber informações através de diversos barramentos (Veja Serial Instrument Control Tutorial)
    É possível acessar o Driver diretamente também, mas eu não recomendo. O resultado não compensa o esfroço!
    Espero ter esclarecido suas dúvidas e espero que você tenha sucesso na sua aplicação!!
    Atenciosamente.
    Felipe Flores
    Engenharia de Aplicações
    National Instruments Brasil

  • Open differents subvis on own main vi.... is it possible?

    Hi Guys,
    I have a litle dude.
    I have a very good application and works well,  i have main vi, it takes differents bottoms to open subvis with differents options or applications, but the problem is when i do the executable file, on xp open 2 files on the tab. One of them is named like exe file, and the another is the name of main file vi. And when i open any subvi, i can see the 2 windows openned.
    I am asking myself if is it possible open the differents subvis on the main vi. Therefore, will open the differents subvis and when close the subvi, will come back to the main vi with the bottoms...
    Only improving... I hope to see any example to do it...
    Regards and thanks for the advises, Fonsi.

    I'm not sure I understand your question perfectly, but if you want to open a window so that you can't access other LV windows at the same time, go to File>>VI Properties>>Window Appearance>>Custom and make it modal. That way, it will stay on top until you close it.
    Another option of having all of them in the same window is calling all the VIs dynamically in a subpanel, but that will probably be more complicated than you like. You can search the LV user manual or help for "subpanel" to find out more.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • Show graph that is created in a subVI in the main vi

    Hi Everyone
    I can not, show graph that is created in a subVI in the main vi.
    help!
    Thank you
    Solved!
    Go to Solution.
    Attachments:
    Sub VI.jpg ‏58 KB

    Thank you very much
    Where am I going wrong?
    Is this possible?
    http://forums.ni.com/t5/LabVIEW/show-graph-that-is-created-in-a-subvi/td-p/672249 - solution
    Thank you again, and sorry my english
    Attachments:
    Sub VI.jpg ‏237 KB
    Main VI.jpg ‏177 KB

  • Dataflow problem, queuing in subvi dequeuing in main vi

    ive stuck on a very simple data flow problem here, I'd like to pass data being enqueue in the subvi and dequeue in the main vi consumer loop. Ive attached the vi, since im already stuck on this problem, i was hoping i could learn a few things, specially implementing action engine in this situation  
    thanks.
    Solved!
    Go to Solution.
    Attachments:
    Counter Main.vi ‏16 KB
    counter subvi.vi ‏11 KB

    Your subVI doesn't make any sense since your loop will always exit after the first iteration and you always initialize your counter to 0 every time you execute it. That is one issue.
    Your code also suffers from multiple places that are dequeueing data from the queue. You will get undeterministic behavior since you don't know which dequeue will get the data first. Generally for a producer/consumer architecture using queues one or more loops loops should be enqueueing data to the queue. One and only one loop should be dequeueing data. These loops shuold run in parallel to each other. In your code you will only run your subVI whenever you press the start button and as stated you will always post a value of 1 to the queue. What you would need to do is have your subVI run independently once it is started. Use the "Start Asychronous CAll" to start your subVI when the Start button is presed and then let it simply run. Have it post the counter to the queue. Your lower loop in the main VI should dequeue the values and display them. You do not need the Wait in that lower loop since that is the purpose of the dequeue. That loop will be idle if there is no data present and will only run when data is in the queue.
    In the upper loop of your main VI remove the dequeue and enqueue. You don't need them since the subVI is all that is needed to post the data to the queue.
    Try this:
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How to handle event from subVI in the main VI?

    Hello,
    I'm doing some measurement. During the measurement I want the user to see some activity dialog - that's easy to do. Before the measurement starts I dynamically run VI (EX_Progress.vi) that shows some activity and then I do the measurement (in my example simulated by random number generation) . After the measurement is done (or error occurs) I can dynamically abort the activity indicator. But on the other hand I want to give to the user chance to abort the measurement manually via the activity dialog by STOP button. There are some ways how to do it via global variable and check every iteration in the main VI it's state but isn't there some better way? Would be nice to run event in the main VI when the user pushes the STOP button in the Progress VI. Is it possible to achieve this using register events? I tried but don't really now how I'm not familiar with this technique.
    Thanks in advance
    Message Edited by ceties on 11-26-2007 01:34 PM
    LV 2011, Win7
    Attachments:
    Ex.zip ‏374 KB

    OK, here's an example using User Events. It doesn't directly have the main VI listen for the Button press event in the subVI. Instead, it has the main VI listen for a custom User Event that the subVI fires every time there's a button press. You could theoretically directly listen to the button press directly from the Main VI, but you would have to somehow get that control's reference to the main VI. That would require storing a copy of it in a global or some such method. This method I will show here is very common and is definitely worth learning.
    For more info on User Events, refer to the LabVIEW help. You can learn more by clicking any of the User Event VIs and selecting Help from the shortcut menu.
    (I didn't set the subVIs front panel to open automatically, so you'll have to do that yourself to see anything from this demo...)
    Message Edited by Jarrod S. on 11-26-2007 02:51 PM
    Jarrod S.
    National Instruments
    Attachments:
    Example.zip ‏25 KB

  • Multiple subvi's in main front panel

    Hello and welcome (it is my first post here),
    sorry if such subject was already risen, however I don't know how to specify it exactly in terms of LV nomenclature (I'm a beginner in LV) what makes it quite difficult to search the forum.
    I need to create an interface with user specified number of input channels (specified during application work, so dynamic loading is necessary). Each channel is to be controlled by subVI. I'd like to load panels of all running input subVI's into some container in a main front panel (similarly to subpanel, but loading multiple VI, not single one). Is there a container capable of this? Is it at all possible in LV?
    Regards,
    kaolpr
    Solved!
    Go to Solution.

    You can use multiple subpanels. Unfortunately the number of subpanels must be set during development. You could create a method of cycling through your various channels. This would involve loading and unloading the multiple subpanels that you do include in the UI.
    Another alternative would be to use a table or something similar. Have your subVIs post updates to the UI code via queues, notifiers or user events. Tables are much easier to manage when your number of elements varies. If you need to have the UI pass information to the subVIs it can also use queues, notifiers or user events.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How to stop and resume a subVI from the main VI?

    I am trying to write a test sequencer, I need to start a subVI (which is a test sequence) from my main VI, I'd like to control the execution of subVI by pressing the 'stop' 'resume' 'jump step' button in the main VI. Does anyone have any idea how to implement this in LV?
    Thank you.

    Yay for State Machine!! I would actually recommend the State Machine Using Events design pattern. Taking advantage of the Event Structure will allow you to replace the "Idle" state in the traditional state diagram design pattern. Instead, we are not waking LabVIEW to handle particular events on the front panel.
    More information regarding the State Machine design pattern as well as design patterns in general are available:
    NIDZ Tutorial: Changing the Face of Design Patterns with LabVIEW 7 Express Event Structure
    NIDZ Tutorial: Applicati
    on Design Patterns: State Machines
    LabVIEW Application Design Patterns
    Good luck.

  • How to initialize the variables in the subvi when the main vi running?

    Hi, friends!
    Now I am working on a project with labview. I make a main vi  including many subvis.
    When the main vi running, I want to reinnitialize the variables in the subvi to zero.
    I know that I can realize that  using the local variable when I enter the subvi,
    but I want to keep the the values when I left the subvi and saw them when I
    click in this subvi again. So, I do not reinitialize the subvi when it runs. But, I
    don not know how to reinitialize the indicators in the subvi when I run the main
    VI in the first instance. I try to use the global variables, but it seems do not work
    well. Would you like to give me some advice? Thanks a lot!

    Hi dec,
          If I understand your question, try using the "First Call?" node in your Sub-VI - to initialize values the first time the VI executes every time the top-level VI is Run.
    If this doesn't work for you, just post again!
    Cheers.
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • Stopping a subvi from the main vi with a global variable

    Hello,
    I want a vi and a subvi to stop simultaneously. Thus, I created a global variable, STOP, which I connected it with the stop of the main vi and also with the conditional terminal of the subvi. However, it doesn’t work. Could somebody explain where am I wrong?
    Thank you in advance
    Attachments:
    STOP.vi ‏4 KB
    subvi.vi ‏5 KB
    main.vi ‏6 KB

    Hi,
    You are making 2 mistakes. The first is that you didn't temporize the loops. The second is that when you launch the main VI this straight away launch the subvi that get the control and don't release till something change the value of the global variable, but in that time the main isn't running, so even though you press the stop button the main is in not running mode and doesn't change the variable.
    Try this with the VI server to pass trough the control between two VIs.
    Ricky
    Italian Developer engineer
    www.www.selt-sistemi.com
    Attachments:
    main.vi ‏9 KB
    STOP.vi ‏4 KB
    subvi.vi ‏9 KB

  • Multiple SubVI display onto main VI

    Hi everyone,
    Probably a really simple solution to this problem:
    I have 6 SubVI's that I want to use on one main VI, no problem, but I would like to display all 6 SubVI front panel display onto this one main VI. Hope this makes sense!
    I looked at SubPanels and tried to add more VI's to it but it only displayed a single one.
    Any help would be great
    Thanks

    Hi Intel;
    My application had similar GUI requirements, but unfortunately, there is only so much GUI space!  Here are a couple of options that you can use:
    (1) Break up the GUI using splitter bars (if you are using LabVIEW 8.0 or later) and place several subpanels, or forget the splitter bar and simply place several subpanels on the same GUI; or...
    (2) Use a TAB structure, and place a different subpanel in each tab (i.e. if you have 6 subpanels, then use 6 tabs each containing a subpanel); or...
    (3) You can use a single subpanel, and depending on which sub-vi is required to be active, you can write some code to "unload" the existing sub-VI and then "load" the new one.  This is the only way (I am aware of) to have a single subpanel reference multiple VIs.
    Hope this gives you some ideas.  I make use of all three methods in a single program, for example.
    DJH

  • Generating Event with Subvi Control on Main Vi

    We are creating a code in which on pressing set up button( present on main vi front panel ) we are calling one subvi as pop up window which further contains some boolean controls and every boolean control has further one subvi associated with it, when we press on that button a window comes that has several numeric and string control, what we want is after entering all values on numeric and string control and after pressing ok button, these val;ues should get updated to the sequence list present on main vi front panel, i have tried to do this using queue but what we want is that on pressing ok button( present inside subvi) we need to generate a event on main vi that it should dequeue elements to the list only when that ok button is pressed, i have tried to do it using value signalling property node but this is not working, i am not getting how to do this or there if there is any other better way to do this
    I have attached the code for reference.
    Attachments:
    Automation.lvproj ‏9 KB

    A better way to do this would be to enqueue the state that the event case is calling from the instrument state.  Then you don't have to poll the global variable and worry about signaling the event.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    queue up state.PNG ‏9 KB

  • Opening subvi so the main vi is active

    In the main program during execution when appropriate button is clicked subvi with a picture is called (chosen by case structure). The rest of the program (front panel) is blocked until the subvi window is closed - how can I open the subvi with a picture so it remains opened and the program goes further?
    greetings,
    Michal
    Solved!
    Go to Solution.

    You need a nonblocking dialog box. As RavensFan says the VI needs to be launched dynamically. Check the link in my signature, I wrote post about one possible implementation. What I show is just a simple "Are you sure..." kind of dialog, but it shows the basic process.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • 'OK' Boolean within Subpanel subVI (vs. in main code)?

    This is my first real need for subpanelling.
    I have what I thought was going to be a simple piece of subVI code to implement in a subpanel.  (and maybe I do).
    The subVI just consists of a radio button dialog (see attached) with
    the idea that I want to get the choice from the user and feed it to the
    main program AFTER the user presses 'OK' (the 'OK' boolean is within
    the subVI).
    The way I tried to address this was to use an invoke node 'Get Control Value' from the control with control name 'Method?'.
    The only thing is that the invoke node executes without waiting for the
    'OK' boolean to be pressed which under normal run circumstances is
    requeired prior to the while loop of the subVI being exited.
    The subpanel examples I saw have booleans such as 'STOP' buttons in the
    main code and not in the subVI.  Is this the way I will have to do
    this or is there a way to do what I want (and it is obvious but just
    have not figured it out).
    Thanks,
    Don
    Attachments:
    Method_sonix.vi ‏17 KB

    This is what your main code should look like.  The key is to wire a True to the Wait until done in the 1st Invoke Node.
    Message Edited by tbob on 08-22-2005 02:22 PM
    - tbob
    Inventor of the WORM Global
    Attachments:
    SubPanel.PNG ‏24 KB

  • Clear chart in subvi from the main vi

    Hi all,
    im not sure if this has been solved before but my problem is, is there a easier method if i create a subvi containing a waveform chart and i want to clear the data in the chart after each run so that new values from the main vi can be plotted without the previous data plot. I placed the "history data" property node and wired it to an empty array in the subvi but when i ran the program, the graph doesnt plot at all..
    Regards
    Adrian

    hmm ii'll try using the invoke property method.
    Appreciate and thanks for the help guys!
    Attachments:
    Computerscreen.vi ‏18 KB
    trialanderror2.vi ‏35 KB

Maybe you are looking for