LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing button status on completion of one loop?

Thanks. I have tried this but it wont let me wire to new value, it gives a broken wire. To be honest i dont really understand what the menu does, ive tried reading the help but im none the wiser!
0 Kudos
Message 11 of 20
(1,215 Views)

See the picture.  No broken wire.  I hope you realise how this works the way you have it wired.  If the Acquire button is not pressed, it is False, and the NOT function makes it True.  So the outer loop will stop after one loop.  If the Acquire is pressed, it turns true, the New Value is true, the NOT makes it false, and the loop will execute again.  On the next iteration, the event will not be fired and the loop will just sit there waiting for some event to take place.  You need a timeout event.  Notice the numerical 100 in my picture.  It is wired to the timeout event.  After 100mS, the timeout event will fire and the loop will then complete its iteration.  The default output wired to the stop sign is false and the loop will start the next iteration, and so on.

Message Edited by tbob on 02-20-2007 08:56 AM

- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 20
(1,200 Views)

Cheers, i understand this now however I dont think its what I need. Essentially the while loop is still looping twice, once when the event is triggered, and once more when it thinks the button is still down but is then released by labview straight afterwards. I am also having trouble with passing a previous value from a different event structure, i was wondering if you could help? I've attached a couple of screenshots. What I am basically aiming for is a button to acquire a waveform and display it on screen, then for a user to click a button which will allow them to save the waveform to spreadsheet.

I have got both these elements working individually but cant seem to implement them how i have suggested. Currently, a user can press a button and the waveform is acquired but how I have wired the block diagram means they must click the "save waveform" button within 10ms in order to save the waveform (save1.jpg). Else the while loop repeats now with a timeout event case, which passes zero values to the save waveform part of the diagram. Is there a way I can get labview to continue to pass the previous values along to the save waveform case unless new values are received? For the user it should seem seamless and as if the waveform they are seeing on the screen is the one they can save. I hope this makes sense, cheers.

Download All
0 Kudos
Message 13 of 20
(1,188 Views)

Don't use two event structures.  One event structure can handle many events.  Right click on the event structure border and select Add Event Case.  You can then add the event for the Save button.  You can use a shift register to hold the waveform.  In the timeout case, just wire the shift register straight through and it will not change back to default.  If you add an event for a stop button, then you don't even need the timeout event.  As long as you are sure one event will fire, you don't need the timeout.  It works like this.  The main loop has this event structure in it.  The loop will not advance to the next iteration until some event fires.  That is usually why the timeout event is there, in case no event happens and you want the loop to continue because of some code external to the event structure.  But in your case, the user has to press either the acquire button, the save button, or the stop button.  The loop will wait until one of those is pressed, the event will process, then the next loop iteration will take place, again waiting for an event to fire.  When the stop even occurs, wire a true to the loop stop sign.

Instead of using a case structure to save the waveform, put this code inside the event case for the save button.  Everything should be in an event case.

Message Edited by tbob on 02-22-2007 09:45 AM

- tbob

Inventor of the WORM Global
0 Kudos
Message 14 of 20
(1,182 Views)
tbob, thank you so much for your help. My program works beautifully now! The only problem I have is that the acquire button still does not stay "true" until the event has finished. If I select "latch until released" the value stays true even after the event has finished. I'd like it to revert back to false as soon as the event has finished doing what its doing. Any ideas? Thanks So much so far, you've been incredibly helpful.
0 Kudos
Message 15 of 20
(1,168 Views)
Latch until released means the button will turn to true when pressed.  Then the program reads the button and it should turn false, but if the mouse is still pressed, it remains true until the mouse is released, then it should turn false.  But this causes another event to be fired because the button has changed states by the mouse action.  Use another latch method, like latch when pressed or latch when released.  Then when the program reads the button, it will turn false and the event will fire.
- tbob

Inventor of the WORM Global
0 Kudos
Message 16 of 20
(1,161 Views)
Hi (Exulus posting from home).
 
I've tried all these and yep it works as you say but I want that button to stay true until the waveform has been acquired (ie the entire event has completed running). I want the user to know the acquiring is happening and to wait (on true the button has text "Please Wait" and turns red). Thanks.
0 Kudos
Message 17 of 20
(1,158 Views)
Instead of doing it that way, place an indicator on your front panel to let the user know that the acquire is in progress.  You can use the property node to make the indicator visible while the acquiring is taking place, and then you could hide it when the acquire is done.  This is  a lot easier than trying to manipulate the button control state.
- tbob

Inventor of the WORM Global
0 Kudos
Message 18 of 20
(1,156 Views)
Hi, sorry for the late reply but im not quite sure what you mean by the property node? I've noticed these being used before but cant seem to find out how to acheive this. Thanks.
0 Kudos
Message 19 of 20
(1,129 Views)
In your block diagram, right click on the indicator icon.  Select Create - Property Node.  Usually a Visibility property node pops up.  You can wire in a constant to the left side.  True will make the indicator visible on the front panel.  False will make it invisible (hidden).  You can choose other properties as well.  Left click on the word Visible, and you can see a list of properties for that indicator.  Controls also have properties.  You can drag the bottom side of the property node down and select several properties at one time.  You can right click on the property and select Change to Read, Change All to Read, or if it is already a read, then it can be Change to Write.  I suggest you play around with it using a simple example to get the hang of it.  Investigate different properties of different objects.  You can also right click and select Help for a particular property.
- tbob

Inventor of the WORM Global
0 Kudos
Message 20 of 20
(1,122 Views)