Control an event in a Subvi

Hi all

I have a main VI and a Subvi (somewhat complicated one) that works with a structure of the event.

I need a way to bind a button (the trigger) in this case VI to a button in my main VI.

I know there isn't an easy way to do it, and I'm a newbie when it comes to references.

I tried globals, but that doesn't seem to work...

Can someone help me by telling exactly how can I combine two buttons together (from different VI), so that this will change the specific event (the button is a value Boolean btw)

THX in advantage!

What a mess!

1. try to keep the size of your diagrams in a single screen.  Scroll around to see what's going on is understand (and troubleshoot) a very difficult VI.

2. get rid of local variables. They break the flow of data, can create race conditions and it is difficult to say what the program does. The WIRE is the variable.  Controls and indicators (and local variables associated with them) are simply the user access point to the value of a variable (the WIRE).

3. the main program has 3 endless loops running in parallel.  At least one of them has no delay or expected and likely to monopolize the CPU resources.  How to stop this program?  Someone on this Forum said, "Stop a VI using the Abort button is like stopping a car by running it in a tree." It works, but it has (unintended) consequences.

4. the AVS_Main.vi has a 10 sec wait in the tiny structure which runs in parallel to the structure of the event.  This will make things very insensitive to events.

5 sequence structures are almost always useless. Stacked sequence structures must be avoided because they hide code, are difficult to extend or change and lead to a right to left wiring.  Use the data flow.  Use a state machine.

Now to the point of your question.

6. If it is possible to put in place a structure of the event in a Subvi to respond to the actions of the user on the main façade, it would probably be best for you to have the structure of the event in a loop of its own in the main VI.  Look at the design of producer/consumer model (events).

I can't be sure that your program is supposed to do, I think it can be done with two while loops in a producer/consumer model, without sequence structures, local variables and not larger than a screen of diagrams.

Lynn

Tags: NI Software

Similar Questions

  • problem with tab structure control and event

    Hello

    My program has a tab control. In each tab, I have an event structure to control some events.

    I encountered some problems. These are:

    1. in each tab, I set tab as an event control, to altogether from the structure of the event as tab change (for example, the image below). My first problem is that when I change the tabs, in the arch depending on whether my program is entered in the next tab environment, happening at the event: change value to main tab! And gives bad result.

    2 - I've scheduled two final tabs as below in the image. I had no routine in these two tabs. Simply, I want when I change the tab, it goes to the next case of the tab control. But when I run the program, it goes to something as busy after one or two changes tab and did not work properly.

    Could someone help me please?

    Thanks in advance

    Baran

    Rebecca wrote:

    I want to have 4 tabs, each tab having 3 Boolean control.

    If in each tab all Boolean control wins 1, a Subvi should be run.

    I wrote this code with some time within each tab loop this case hase 3 for each Boolean control. The result is true.

    But I think that if I write it with a structure of the event within each tab instead of 3 cases, the cpu load will be lower.

    Is it not true?

    Make a unique Structure of the event.

    Add events for all controls (buttons, Boolean)

    When the event is triggeredcheck for active tab control and decide what void / vi to run

    It will work fine you

  • How to use a structure of the event in a Subvi

    I am using a structure of the event within a Subvi.  The Subvi has a table constructor that built tables and the structure of the event is used so that when the program runs, it allows you to change the elements of the array.  It works, but when I apply within a Subvi, it does not work properly.  This goes into a Subvi, because it will be part of a much larger progrram, so it must be modular.

    If you are using a structure of the event, it is not a Subvi.  If you worry about modularity, you should not use the structure of the event.

    You seem to have a fundamental misunderstanding of modularity.  An event structure must be placed in a while loop.  If you have a while loop in a Subvi, you have transferred control of your program to the Subvi.  You are not at this stage modular.  Your higher level GUI has no control.  You would have to create a stupid system of variables to pass data down to the loop to stop the loop and return to your main VI.  This is not a good design decision.

    Instead of searching for a way to make something broken, you should spend effort trying to understand what you really want to accomplish.  You should also spend some time to learn how to work the event structures.

    This application is small at the moment and it is already on the way to the unreadable.  It's a terrible thing to do for you.  Break these habits now.  variables are only when absolutely necessary.  Using subVIs to accomplish individual tasks, do not run the entire application.  With the structures of the event, use a value of stop button change event for will not be held hostage to the time-out.  If your variable is '2' in it, you're doing something wrong.  It has to be something different between set points, put it in the name.  If you want to make the subVIs, create an icon.

    But first and foremost, invest time in understanding dataflow

  • With the help of registration of dynamic events for a Subvi

    Greetings to the forum LV,

    I'm having a problem with the inclusion of dynamic events in a Subvi and hope someone here can help you! Attached, is the culmination of many attempts to try to understand the inclusion of dynamic events. Basically what I'm trying to do with the screw joint is 1.) have a button that controls output PWM, 2). a speed selection menu that can enter 1 button said.) with an array of pwm values predefined; and finally, 3) to have some sort of event program which "connects" controls in 1). (and 2.) (IE, if I move the button to an exact value shown in the table, the speed selection must match this event). So far, I can say with certainty that the "speed selection" event card will not work because "New value" & "Old value" refer now to the refnum and not the selection of speed control (I intend to solve this problem after I solved this problem of the Subvi). However, the map of event engine speed PWM should work (when matches button among the values in the table, the selected speed will also report the "speed selection" control), which allowed me to reach my conclusion that the Subvi is not working.

    My reference to dynamic Subvi Event Registration: http://digital.ni.com/public.nsf/allkb/A882E27D1D7A949386256E0D0066B91A

    You need to make a different State for 'Timeout' in the Subvi and also avoid passing the value of timeout as -1.

    Find the file code.

  • Update controls with events

    I'm getting to do a settings editor window that has several groups of settings that can be edited and saved.  The settings are loaded and saved on a Bay of clusters.  The window uses a shift register to store all changes and then you can save at the same time when you are ready.  The problem I see is that if I change a value and leave the cursor in the control, and then a new group he will not read this new value.  I understand that you should put the control that you want to play in the same event, but the problem is I want to be able to read this control with several events and it makes sense to have the control outside the structure of the event.  I have attached a sample vi of what I am trying to accomplish.  I'm relatively new to labview and learning I'm leaving, so any help would be appreciated. Thank you


  • Error service Control Manager Event Id 7026

    Service Control Manager error - the next time you start Event Id 7026 or starting system (s) failed to load: __Lbd (I see this error message in the system event viewer when connecting). The full message of MS is below.

    Details
    Product: Windows Operating System
    ID: 7026
    Source: Service Control Manager
    Version: 5.2
    Symbolic name: EVENT_BOOT_SYSTEM_DRIVERS_FAILED
    Message: The next (s) starting or starting system could not load: %1
        
    Explanation
    The specified drivers not been loaded properly. The driver is not in the expected location.
         
    User action
    Do all the following:
    Verify that the drivers are properly configured.
    Check that the computer is running the latest version of the drivers.

    Unfortunately MS did not say how to do this, just to make - not all that useful. How can I solve this exactly?  Any help will be greatly appreciated.

    Hi Bantam,

    In Event Viewer, do you think the list of specific drivers as well as the error message?

    You can follow this link to update the drivers on your computer:

    How to manage devices in Windows XP?

    Hope the helps of information.

  • Cannot delete the animation control enterframe event listener

    Hello

    I am trying to create a simple game, stop, rewind. fforward controller. I have the slide show and control in the same time line.

    As the enterframe event is nested inside a function, it will go back, but then no other buttons work as I am not able to removeEventListener to the enterframe event. Thanks for the research. Concerning

    Stop();
    btnStop.addEventListener (MouseEvent.CLICK, StopSlideShow)
    btnPlay.addEventListener (MouseEvent.CLICK, PlaySlideShow)
    btnRewind.addEventListener (MouseEvent.CLICK, RewindSlideShow)

    function PlaySlideShow(e:MouseEvent):void
    {
    Play();
    }
    function StopSlideShow(e:MouseEvent):void
    {
    Stop();
    }

    function RewindSlideShow(e:MouseEvent):void
    {
    addEventListener (Event.ENTER_FRAME, keeprewinding);

    function keeprewinding(e:Event):void
    {
    prevFrame();
    }

    if(currentFrame ==1)
    {
    removeEventListener (Event.ENTER_FRAME, keeprewinding);
    }

    }

    Stop();
    btnStop.addEventListener (MouseEvent.CLICK, StopSlideShow);
    btnPlay.addEventListener (MouseEvent.CLICK, PlaySlideShow);
    btnRewind.addEventListener (MouseEvent.CLICK, RewindSlideShow);

    function PlaySlideShow(e:MouseEvent):void
    {
    removeEventListener (Event.ENTER_FRAME, keeprewinding);
    Play();
    }
    function StopSlideShow(e:MouseEvent):void
    {
    removeEventListener (Event.ENTER_FRAME, keeprewinding);
    Stop();
    }

    function RewindSlideShow(e:MouseEvent):void
    {
    addEventListener (Event.ENTER_FRAME, keeprewinding);

    }

    function keeprewinding(e:Event):void
    {

    If (currentFrame == 1)
    {
    removeEventListener (Event.ENTER_FRAME, keeprewinding);
    }

    prevFrame();
    }

  • Are there any key press\type\hit control textfield event.

    Hello

    I'm counting the number of characters typed in the textfield control.

    I can't find a case where it should trigger and get me counties when I type in the textfield.

    I'm able to count the characters entered using EXIT event. But it gives me an account only when I leave the command or click here and there. While typing in the textfield control his does not work.

    Please suggest me how to count number of characters, when I type in the textfield control.

    Concerning

    Sunil

    If you use the xfa.event.newText, it returns the text that is in the field. So if you use this code on the change event and you type in th estring Test you get

    T, then Te, then, test it

    If you use xfa.event.change, it will give you the unique tank that was typed. So same example above, you will get

    T, then e, then s, then t

    Hope that helps

    Paul

  • Join/leave control room event

    Hello

    What would be the best method to control when a user enters or leaves a piece? I have a base by keeping control over the number of users each of my rooms, and I'm looking to implement a good method to keep up to date because it is very important for my request for data. Are there several apartment possibilities to control everything on the client side? I think that this is not valid because a customer could for example have a connection problem and then it will not be able to send the "I've left the message from the House" on my server. Is it possible for a call from the adobe server to some php on my server function when this happens?

    Thanks for your help!

    Hello

    Go on the client side could be tuned to UserEvent.USER_REMOVE event of UserManager. This is returned when the item the user gets are returned from the server.

    We use mainly that for all accounting side of customer to userlists.

    However, using the API server to your server can listen to the UserManager Collection after calling registerhook and subscribed to UserManager Collection. There is an example of php in sampleApps for your server record hook and listening to a node of the collection as UserManager.

    Thank you

    Hironmay Basu

  • MX Tree control point events


    How do I make for each item in the tree control to have events like an event click or something like that.
    So when the user choose an item in the Tree control, I need to show a panel with additional options and the same as the other points... the click event should present different options.

    Kind regards...


    < mx:Tree id = "TreeProject".
    width = "326".
    height = "395".
    labelField="@label".
    showRoot = 'true '.
    defaultLeafIcon = "{myDefaultLeafIcon}".
    folderOpenIcon = "{myFolderOpenIcon}".
    folderClosedIcon = "{myFolderClosedIcon}" >

    < mx:dataProvider >
    < mx:XMLListCollection id = "ProjectTree" >
    < mx:XMLList >
    < record label = "Project name" >
    < record label = "Page of home" >
    < label folder = "Slide Show" / >
    < record label = "Other file" >
    < / case >
    < / case >
    < / case >
    < / mx:XMLList >
    < / mx:XMLListCollection >
    < / mx:dataProvider >
    < / mx:Tree >

    evsPeart,

    Is this something like the following for you?

  • Control the event with two controls

    Here's what I have.

    I have two separate loops of time. Inside of each timed loop, I have a structure of the event. Each structure is the trigger by pressing a button each. It works very well.

    However, I would like to add a third button that runs the two structures of the event. I want to do this without creating additional events in each structure. Is it possible to somehow this third button wire to the other two and to trigger both based on the action of the third? I have problems it works.

    Thank you

    Small example

  • Service Control Manager (event ID 7000, 7009) issues

    Cannot start a license server Flexnet (PTC, Flexlm 10.8, 32-bit) as a service on my Windows Server 2008 R2 SP1 system. When I try it does not immediately, event ID 7000, 7009. There is no second waiting 30 or 60 before the failure is reported. (Yes, I tried increase the setting of registry ServicePipeTimeout.) When I uncheck the option 'use the service' LM 'configure the service' tab and start the license server manually, it runs. How can I make it work as a service?

    Hello

    As you use the Windows Server 2008 R2 operating system, we have a forum dedicated to the same thing. Please post the same query in the Windows Server forum:

    https://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    Please let us know if you need any other assistance on Windows.

  • Event ID 11 ATAPI / Service Control Manager event ID 7031 / crashes / freezes...

    OK, I'm almost certain that it is a hardware problem; probably in the hard drive (because that's what I read form similar problems online).

    I have a Dell XPS m1330 laptop computer, 2 GB of Ram, Vista Home Premium, 2.2 GHz processor, Nvidia G8400 MS with 128 MB allocated.

    Basically, he started a week or two ago, I got bluescreen containing "KERNEL_INPAGE_DATA_ERROR", out of the blue. I read it can be caused by incompatible software, which makes sense to me because I have recenty changed in msconfig startup programs, to try to speed up my startup... It was fine for a day or two, but then I got persistent crashes, woulf computer freeze for 20 seconds - 3 minutes (90% of the time when I was using firefox, although he did so with just iTunes open by himself before).

    Checking event viewer I've seen above, errors with the Red 'X'.

    I also see a lot of "Volmgr - the system does not have empty data in the transaction log.". Corruption can occur "with a yellow '! ».

    Also, I see some "Kernel-processor-Power - the speed of the processor 0 is restricted by the system firmware. The processor has been in this state of reduced performance for 9 seconds since the last report. »

    I often get warning messages that various programs have stopped working and the dialog box "do you want to close now or wait to face." These programs are sometimes an indexer Board/management console/windows search service Mcafee etc...

    Today, I got a new problem, a warning box appears, saying a critical error has occurred and windows will restart in one minute, telling me to save and close all work immediately...

    The only reason why I post here instead of replacing parts is that I updated my Dell Support Center and ran a test of the hard drive:

    Targeted reading test
    Test started 03/05/2011 12:37:29
    Error message: Error reading sector 23962699. 03/05/2011 12:38:14
    Error message: Error reading sector 23962698. 03/05/2011 12:38:58
    Error message: The test found 2 errors in sector. 03/05/2011 12:39:01
    Completion test: Failed 03/05/2011 12:39:02

    For some reason, it won't test the rest of the hard drive, just do not here and stop the test. However, he claims that the mistakes above are not "allways" indicative of hard drive failure... and annoyingly, tells me to do more tests...

    I know this doesn't look good, and I am extremely optimistic to think I can remedy without replacement of the equipment, but are there steps I can take before finally diving into the portfolio? (Guarantee missed 3 weeks ago... obviously).

    ChkDsk runs fine, no problem.
    Reference Dell Diagnostic returned failures in the hard drive, which I can list if necessary.
    I checked for new drivers, nothing there.
    I took out my hard drive, compressed air used to attempt to clean the connectors, nothing helps. (Note I've heard SATA cables may be at fault, but I wasn't able to get to them because of their location, migt need to disassemble my laptop further if you think it's worth)
    Off the CD/DVD rom drive (had mistakes occasional cdrom with yellow "!") The computer can will work perfectly for hours and then suddenly hang down to the minute, and Event Viewer is filled with dozens of error ID 11 atapi...

    Any advice?... huh.

    Hello

    I suggest to run the disk check in windows recovery environment and check if it helps.

    http://Windows.Microsoft.com/en-us/Windows-Vista/startup-repair-frequently-asked-questions

    Method

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-are-the-system-recovery-options-in-Windows-Vista

    Open the command prompt in Windows recovery and type chkdsk/r click on Enter Note there is a space between chkdsk and / r

    We you will ask if you want a drive type is check, and then press enter

    It will take place in 5 sections, please do not interrupt this let him finish.

    But the files may be corrupted and unrecoverable

    Hope this helps,

  • Control billing events in project invoices

    Dear Dina,

    When several project events are created in the system even date and the end user wishes to restrict the events to go to specific bills, how can it limit? in GDI, the system generates automatically 1 new invoice with all available existing events.

    Kindly help me how to overcome this kind of situation.

    Thank you very much in advance...

    Hello

    Put all events pending billing, but the first event, you need to charge. When the invoice is released, select the next event, remove the hold of billing and generate the next invoice, etc.

    Dina

  • Digital control do not light the Subvi table lines

    Hello people of the forum NOR!

    I have a small question, I think you could help me:

    I tried to find a way that would allow my program read data, acquired from a millimeter and use a table - with coefficients - multiply the data obtained.

    When it was written directly on my program, it worked fine, but when I created a sub VI to 'clean up', he ceased to alternate values and it uses the fixed value of the Sub VI.

    The sub VI has a connector to the CNC.

    This program is the 'read the table under vi' attached to this message and the other, is the program I use to get my data.

    Thank you before useful assistance.

    Concerning

    Leandro

    Hello Leandro, Dennis

    I don't think I got the problem right so I can only guess:

    VI Sub is placed outside the Structure of sequence and therefore only runs once at the beginning of the VI.

    As Dennismentioned, since the "Table" does not have default values assigned it cant work now.

    It would be better if you post an another Set of screws: (Bevore, adding the Sub VI and after)

    Concerning

    Moritz M.

Maybe you are looking for