02-20-2007 04:41 AM
02-20-2007 09:56 AM - edited 02-20-2007 09:56 AM
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
02-22-2007 07:03 AM
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.
02-22-2007 10:43 AM - edited 02-22-2007 10:43 AM
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
02-23-2007 07:25 AM
02-23-2007 10:41 AM
02-23-2007 10:46 AM
02-23-2007 12:12 PM
03-05-2007 08:38 AM
03-05-2007 10:10 AM