How to build reference from subvi to vi?

I have both vi and Subvi vi program, i try to link up the data "send data", "received data", "Listen to" boolean , how can i build references and use vi to control subvi
Attachments:
Machine_connection.vi ‏20 KB
Semester2.vi ‏34 KB

The code does not fit the way execution is controlled in LabVIEW, namely through data flow...Other key consepts to check out is locals, globals/functional globals...
I would also recommend you to use a left to right design on all code; inputs to the sub-vi should be on the left side of the VI, outputs on the right side...but back to the problem at hand:
There are a number of ways to solve this...the easiest is to simply not use a sub-vi, move the sub-vi code to the vi..that way the button will be read on each iteration and you can stop it...if the loop is in a sub-vi it will not read any new inputs nor output anything until it has finished (data flow).
If you still want the listener in a sub-vi and control it from the main vi put the button in a loop and u
se VI globals to share data (attached is an example for the button control; initialize it prior to doing anything else, then put the button in a while loop and wire it to the input of the global, with the function set to write...then replace the button in the listening VI with the global and set the funtion to read..wire the output the same way as the button used to be...You need to make similar globals for the send and receive data...a better option there htough would be to use ques, that way you will not loose any data.)
Other options include making the listening sub-vi load dynamically so that the calling vi does not wait for it to finish..and then share data between the two using a send and a receive que...
Search this site for functional globals to read more about the idea behind the VI global example...Also check out texts and examples on ques and client-server solutions...
MTO
Attachments:
Listen.vi ‏17 KB

Similar Messages

  • How to add indicators from subVIs to main VI

    Hi,
    I have a similar problem as well as a question or two about running subVI's.  Basically, I am trying to create a project that will use both syringe pump injections and the opening and closing of valves to transport a fluid.  As of now, I have a program written for the syringe pump that I was able to modify from an instrument driver from the manufactuer of the syringe.  The goal is to just have the operator press a single run button, as all volume and flow rate conditions will stay the same from trial to trial.  I created two separate syringe pump suvbVI's, one injects 1mL of fluid at 1mL/min and the second injects 2mL of fluid at 1mL/min.  
    I want to use the flat sequence structure to run these two subVI's sequentially, which I am having some difficulty with.  I set this up so that the operator must press an "OK" button in order for the case structre to read "true" and begin the operations in the flat sequence.  Both subVI's work correctly if operated on their own.  However, when I use the highlight data flow function (lightbulb on block diagram) I can see that pressing the OK button causes the case structure to read true, and the program to engage the first subVI.  Upon opening the block diagram of the first subVI and using the same lightbulb tool, I noticed that the information is getting stuck in the first while loop and repeating itself endlessly.  Any suggestions as to why this may be the case?  (I did go into each subVI and changed the VISA resource name to the correct COM port)
    Also, once I figure out how to get the information to flow correctly, I do want my main VI front panel to display some of the front panel indicators on the syringe pump VI's, such as the volume dispense and tank.  I would like to know more information about how to reference a wire to the subVI as previously mentioned in this thread.
    Sorry this was such a long post!  I attached the main VI with the embedded syringe pump subVI's as well as both individual subVI's.  Any suggestions would be greatly appreciated!
    Thanks
    Attachments:
    Test Project_Pumps.vi ‏9 KB
    NE-50X Push Button Example-tester_1mL_3_30_1013.vi ‏289 KB
    NE-50X Push Button Example-tester_2mL_3_30_1016.vi ‏289 KB

    galXE1,
    From my example you can use the invoke node method of "get all" and it will retrieve all the indicator names and values and then you can get the values you want. 
    Sorry for not posting this originally but without modifying your code a bunch your quickest option is to use shared variables. If you have important vital tasks they aren't the best but if you're just looking to pass data between vi's then they are you're easiest option. 
    Creating a Shared Variable - look at single process shared variable section. 
    http://zone.ni.com/devzone/cda/tut/p/id/4679
    So you basically call your subvi every time the loop iterates to perform some execution and then you can update your main front panel with the newest values. Calling the subvi with a loop in it. Nothing special but it gets the job done. Its not very good practice if you have a bunch of values you want to pass. 
    See subvi calculations.jpg
    A better approach to passing data between vi's is detailed in the document. Its called a Functional Global Variable. 
    https://decibel.ni.com/content/docs/DOC-12876
    Kyle Hartley
    RIO Product Support Engineer
    National Instruments
    Attachments:
    Subvi calculations.JPG ‏42 KB

  • 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

  • Huge DVD-9 project needs two Dual Layer discs - How to build a from single project?

    Hello Encore Pros,
    I have a DVD project with about 5 hours of video media and it won’t fit on a single DVD-9.  It has to be built onto TWO Dual Layer DVDs.   I’ve created the project as ONE BIG PROJECT in Encore CS6 (Mac Pro 10.7.5) with lots of menus, buttons, timelines, and media.  Here’s the $20,000 question: how will Encore know to build the project onto two DVD-9 discs?  Can I program it to do this and if so, how?  Or do I need to break the project into TWO SEPARATE PROJECTS (both dual layer) and burn individually?   If so, can I simply duplicate the full project and delete all movies/menus/timelines not needed for each new half?  And if that’s the case, I know there'll be some revising elements like setting a new 1st play on disc 2 and some End Action links, etc., but that I can deal with.  I suppose I’d name the two new dual layer projects xxx_pt1 and xxx_pt2.   On the plus side, the Check Project comes up with no errors, so that’s good so far.  Oh, "the horror....... the horror” to quote “Apocalypse Now”  
    -- Thanks in advance for help and suggestions.

    Bill Hunt is still MIA. See this link for his instructions on doing the sort of process I was describing.
    Re: Multiple (different) DVD outputs from a single Encore project
    In a similar thread, Hunt refers to a more detailed piece he did on "multi-disc" authoring. But he didn't find the link, and neither have I!
    Edit: Not it, but may add something:
    Re: Multiple-Disc Project

  • [IMAQ] How to build images from ROIs

    Hi everybody!
    I'm a newbie in Labview and i'm tring to build up a vision analisys system
    with it.
    I need to take a line of pixels (always the same line) from a sequence of
    images coming from a frame grabber and then to use these lines to build
    another image....i'm trying to realize a sort of scanner with a camera.
    I defined a ROI (the line) and i took it out from the images but i can't
    find the way to create an empty array of specified sizes and then to copy in
    it, line by line, the ROIs i acquired.
    After the array is filled it will be easy to convert it into an image with
    the 'IMAQ Array To Image' function and than to display it.
    I need/want to do all of this within a 'While Loop' structure.
    Can anyone give me an hint?
    Thanks in
    advance!
    Davide

    > I defined a ROI (the line) and i took it out from the images but i can't
    > find the way to create an empty array of specified sizes and then to copy in
    > it, line by line, the ROIs i acquired.
    You probably want to use Initialize Array. By default, it is for 1D
    arrays, but you can grow it to set the rows and columns of a 2D. You
    also wire up the initial value of all elements, 0 would work well for
    black for example.
    Greg McKaskle

  • How to build ACL from syslog entries on permit any any log

    We have several user subnets that we want to start securing but no one knows all the ports and such that are currently in use. We dont have the time to open everthing up one by one over the next month or so. We have put a permit any any log and have started logging all the connections and such.
    Is there a utility or an easy way to condense all this connection information in the syslogs and build an ACL from it?

    Hi Bro
    This is a very good question. Many have asked me the same thing too :-) For starters, you could just use Cisco ASDM. Please do refer to this URL for further details http://www.ciscopress.com/articles/article.asp?p=1552963&seqNum=6
    P/S: If you think this comment is useful, please do rate them nicely :-)

  • How to build executable from labview for R-series board

    Hi all,
    I have a PC with Win XP 32 and a PCI-7852R board.  I have labview installed on it and have done all my development on that machine.  Now that I'm done, I'd like to build more of the systems but don't want to have to install labview on every one.  Plus, I'd like to be able to take labview off this machine so that I can start working on the next project on another machine.
    So is there a way to build a distributable package of host and FPGA code on one machine and install it on target machines without having labview on them?  Ideally I'd like to be able to build the package on a machine that doesn't have the R series board - instead just have a simulated board.  But that doesn't seem to be an option in NI MAX.
    thanks
    Solved!
    Go to Solution.

    Hi Manick,
    I mean that it would be best to create a new thread on the forum.  I've attached a screenshot to show what I mean.  From there, you can enter a unique title, and have a unique description for your case.  That way, we can support you better, and other users of the forum can search for the same behavior that you're seeing.
    Regards,
    Che T.
    Applications Engineer
    National Instruments
    Attachments:
    new_post.png ‏70 KB

  • How to build applications from LabVIEW with Diadem?

    Dear all,
    I got a question regarding a LabVIEW application with integrated DIADEM report VIs (DIADEM Report). My problem is that the computer, on which the application shall run, has no DIADEM installed.
    For LabVIEW it is clear to install the RUNTIME engine, which works on PCs without installed LabVIEW, but is there something similar for DIADEM available?
    Thanks for your help in advance.
    Best regards,
    RidderM
    Message Edited by RidderM on 01-09-2008 07:39 AM

    No, I don't think it is possible.
    The LabVIEW VIs call the Activex interface of DIADem, I was also exploring this and the best I could think of is to contact a computer that has DIADem installed to run the LabVIEW-DIADem connection there.
    However I didn't ask it to NI.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Cannot build JDS3 from source

    I recently successfully installed Solaris 10 from the media kit on an x86 machine. I also successfully downloaded the JDS3 source tarballs and bunzip'd and untar'd them. I eventually figured out how to set my PATH (and LD_LIBRARY_PATH) environment variable up so that all the requisite tools for building JDS3 from source are in my path. However, I'm failing miserably when I try to use 'pkgbuild --rebuild /path/to/somepackage-src', as  detailed in the instructions on building JDS3 from source. The errors I get depend on what package I try the pkgbuild on. I really only want to be able to peruse the source code (especially the GNOME sources included with the JDS3 source), so I would be happy just to get the "prep" or maybe the "compile" phases of pkgbuild to work, if not the entire rebuild. I have googled and visited  solaris /jds forums for days, and have yet to discover any good information about how to build JDS3 from source on Solaris 10. Surely there are a bunch of people who successfully do this. Can anyone point me to some helpful info? Thanks in advance...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    I am using the macro _TARGET_PRODUCT_VERSION_ which yields major, minor, service and build version (but without the autoincrement)

  • How do I get an activeX object reference from a LabVIEW ActiveXContainer ref?

    How do I get an activeX object reference from a LabVIEW ActiveXContainer ref?
    I'm trying to control an ActiveX object (a Web Browser) from another VI and need to get the object reference programmatically. I can get the LabVIEW ActiveXContainer reference, but am lost on how to get the reference for the object _inside_ the container.

    Hi Lee,
    The reference to the container is actually also accessing the object inside the container. Use the Property Node and Invoke Node to access properties and launch methods for the object. I've attached a small example that passes the reference to a SubVI and invokes a method inside the SubVI.
    - Philip Courtois, Thinkbot Solutions
    Attachments:
    WebContainer.zip ‏21 KB

  • How do I create a runtime library reference from a J2EE library DC?

    I've created a J2EE library DC that references some classes in an already deployed library.  The referenced jar file has been correctly deployed, as it's successfully used by some other components.  I can build the DC, since I've created created a compile-time reference to the local copy of the target jar file.
    Unfortunately, I can't figure out how to create a runtime reference from my J2EE library to the already deployed library - there just doesn't appear to be any place to put the reference, at least using a gui-based function in NWDS.  Unlike WebDynpro, which has a 'references' configuration option, J2EE lib's don't appear to have anything similar.
    Where/How can I do this?
    BTW, the Visual Administrator function 'ClassLoader Viewer ' is a very handy tool for diagnosing ClassDefNotFoundError errors....

    Hello Ken,
    well it seems to be not a trivial thing.
    1) Build your library DC.
    2) Create folder "server" in root DC folder "_comp".
    3) Extract provider.xml from generated SDA file to "server" folder.
    4) Add references in provider.xml:
        <references>
          <reference type="library" strength="weak">
            sapxmltoolkit
          </reference>
          <reference type="library" strength="weak">
            com.sap.lcr.api.cimclient
          </reference>
          <reference type="service" strength="weak">
            tc~sec~securestorage~service
          </reference>
        </references>
    5) Rebuild DC. Deploy.
    6) Enjoy!
    Useful links:
    http://help.sap.com/saphelp_webas630/helpdata/en/b5/22123b8d92294fac207283f3e8756e/content.htm
    http://help.sap.com/saphelp_webas630/helpdata/en/09/5d963be736904c96cbdfe93793eb42/TEMPLATE_image002.gif
    Best regards, Maksim Rashchynski

  • How do I reference a MovieClip from a class

    Hi. Trying to learn AS3 and having a hard time ; (
    I'm working on a game. I have a Ship class that uses addChild
    to add a linked Bullet MovieClip to the stage. The Bullet MC is
    linked to the class below. I've got it working so it moves up the
    screen, but now I need to build a hitTest, however I cant get
    access to a movie clip I've placed on the stage, "enemyDisplay_mc".
    How do I reference this MC? In AS2 I would just do a _root.
    Thanks!
    package {
    import flash.display.*;
    import flash.events.Event;
    public class Weapons extends MovieClip {
    private var _thisWeaponMC:MovieClip;
    private var _enemyHit:DisplayObject;
    private var _speed:Number;
    public function Weapons () {
    this.addEventListener (Event.ADDED,Initialize);
    private function Initialize (event:Event):void {
    //trace ("Weapons");
    _thisWeaponMC =
    MovieClip(this.parent.getChildByName(this.name));
    trace ("_thisWeaponMC: " + _thisWeaponMC);
    _thisParent = event.currentTarget.parent;
    trace ("_thisParent: " + _thisParent);
    _enemyHit = this.parent.getChildByName("enemyDisplay_mc");
    trace ("_enemyHit: " + _enemyHit);
    _speed=20;
    this.addEventListener (Event.ENTER_FRAME,moveShip);
    private function moveShip (event:Event):void {
    this.y-= _speed;
    }

    This code is called from my Ship class.
    The Ship class is the Base class of the ship movie clip.
    VulcanShot is the linkage class name of the bullet movie,
    it's base class is Weapons.
    Thanks!

  • Power Query; How do I reference a Power Pivot table from a Power Query query

    Hi,
    It's pretty awesome how you can define Extract Transform and Load processes within Power Query without having to type in a single line of code. However how do I reference a Power Pivot table from a Power Query query to avoid me repeatedly accessing
    the same data source (CSV) file with a view to increasing performance?
    We are aware of the reference sub menu option with Power Query. However the new query created by the "reference" option still seems to refresh data from the data source (CSV) rather than just referencing the base query. Is this understanding
    correct? There does seem to be a lot of hard disk activity when re-running the new query which is based on a base query rather than a data source.  So we were hoping the new query would just need to reference the base query in memory rather than rescanning
    the hard disk. Is there any way to ensure that the reference query just rescans the base query in memory?
    Kind Regards,
    Kieran.
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    Hi Kieran,
    This sounds like something to be suggested for a future release. At the present time, Power Query will always re-run the entire Power Query query when refreshed. The Reference feature is analogous to a SQL view whereby the underlying query is always re-executed
    when it's queried, or in this case refreshed. Even something like using the Power Query cache to minimise the amount of data re-read from the disk would be helpful for performance but the cache is only used for the preview data and stored locally.
    It would be a good idea to suggest this feature to the Power BI team via the feedback smiley face.
    Regards,
    Michael Amadi
    Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to vote it as helpful :)
    Website: http://www.nimblelearn.com, Twitter:
    @nimblelearn
    Hi Michael, 
    Glad to hear from you about this.  And thanks to Kieran for bringing a very good valid point to debate. Will be glad to see this in future release. 
    - please mark correct answers

  • How can i use class reference from an array effeciently?

    Hi,
    I made some test here with getting a class reference from an array and using the reference's methods or variables.
    Basically arrayEx is a container of type Array and it contains the Person's class instance in it. Num is a number extracted from the Person's instance
    Example #1----Strongly typed
    Var reference:Person;
    Var num:int;
    //Assignation
    reference=arrayEx[0];-----IT IS SLOW HERE
    //Use
    num=reference.number --- IT IS FAST HERE
    Example #2---Not typed
    Var reference:*;
    Var num:int;
    //Assignation
    reference=arrayEx[0]; ---- IT IS FAST HERE
    //Use
    num=reference.number ---IT IS SLOW HERE
    No matter what i change in both code like casting Person on arrayEx, i cant seem to make them work both fast at the same time
    If someone knows how, please tell me,
    Dominik

    Hi,
    I made some test here with getting a class reference from an array and using the reference's methods or variables.
    Basically arrayEx is a container of type Array and it contains the Person's class instance in it. Num is a number extracted from the Person's instance
    Example #1----Strongly typed
    Var reference:Person;
    Var num:int;
    //Assignation
    reference=arrayEx[0];-----IT IS SLOW HERE
    //Use
    num=reference.number --- IT IS FAST HERE
    Example #2---Not typed
    Var reference:*;
    Var num:int;
    //Assignation
    reference=arrayEx[0]; ---- IT IS FAST HERE
    //Use
    num=reference.number ---IT IS SLOW HERE
    No matter what i change in both code like casting Person on arrayEx, i cant seem to make them work both fast at the same time
    If someone knows how, please tell me,
    Dominik

  • How to build a String from Date?

    How to build a String from class Date?
    How to get the year, month, day, hour ... from a Date object.

    Ok to build a string use this function in java.util.Date
    toString()
    TO get year, date, etc u can use the following functions
    getYear()
    getDate()
    This link might help u more
    http://java.sun.com/products/jdk/1.1/docs/api/java.util.Date.html

Maybe you are looking for

  • Creative Cloud for teams gets me an trail version

    Hi There, I accept a invitation for the Creative Cloud for teams at my work(Triple-IT). I downloaded the Creative Cloud Desktop app for my macbook and I am logged in with the correct Adobe ID. I even have downloaded and run the Adobe Creative Cloud C

  • Issue with instead of trigger on a view

    Gurus, I have an issue with an instead of trigger on a view. The trigger is listed below. The insert and update seem to be working fine but the delete section is not. From the application, we have a screen on which we attach images. We trigger of an

  • Upgrading Macs from g to n

    Hi - I currently have a 802.11g base station and two macs (a G5 iMac and a G4 powerbook) connecting to it for internet access. I'm thinking of getting an apple tv box, and reckon I should upgrade the wireless network. So, as well as getting a airport

  • Problem with Select tag in iPad Safari

    The <select> tag which provides a drop-down list is giving me problems. I when I change the value, sometimes I get all sorts of spurious characters after the field and sometimes I get a truncated value. I need to put a span tag in front of it to get

  • Handshake error

    When perfoming handshake I am getting the following error. Not sure where the error is and what is causing the error Please help Thanks, ============================================= Failed When Handshake : java.lang.IllegalArgumentException javax.ne