LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Switch to manipulate an eventcase structure??

Hi everybody
I'm working with labview 7.1 and ,i'm developing a userinterface to controle af Flow meter (FLM).
 
In my VI, i'm using  event structure to handle som buttons when pressed.
I starts my application by pressing arrow button in labview. now the my program(VI)is ready.  
I got one problem now, wtih a switch button to stop the measurements and commandswrite from/to the flow meter.
when i switch the start /stop-switch to start, the VI writes some commands to FLM using the serial port like desired,
and then the eventcase structure is ready for some button actions. These buttons are used to send commands to FLM.
i can without problems send the desired commands to FLM.
Now when i switch the start/stop-switch to get the vi to stand by, the event case stil reseives and handle the commandbutton when pressed.
 
can any one help me with my problem?
any suggestions are full acceptable
Thanks
HZ
PS. if there are problems understanding my explanation, please informe it.!   
 

Message Edited by HFZ on 01-16-2006 05:14 AM

HFZ
0 Kudos
Message 1 of 10
(3,424 Views)
Hi,

First of all, the structure of your program look a little strange to me.
You have two infinite while loops, that constant connected to the while loop end control will make sure that once you entered there you will never get out. It's ok that you put an event structure inside the loop and you even have an event assigned to the exit button, then the exit control of the loop should be controled be the value of the exit on that event loop.
I'm quite convinced that you can change the structure of the program in such a way that you have only one loop and only one event structure inside of it controlling all the buttons and the exit condition.
Anyway there are still some functionalities that I don't understand...
Do you want that the program starts once the user press the button to start and then end it when he presses it to stop?
I changed it a little bit, I'm not sure if this is exactely what you need and I'm sure that it can be improoved, but I hope it can help you...

Paulo
Message 2 of 10
(3,408 Views)
>> Now when i switch the start/stop-switch to get the vi to stand by, the event case stil reseives and handle the commandbutton when pressed
 
by commandbutton, do you mean SampleRate 2, Data 2, and Flow 2?
 
if so, check the value of "stop" in the valuechange event of the three buttons (see attachment)
but still, it won't stop until it finishes the loop on the right of the event structure

Message Edited by Elsa Fung on 01-16-2006 06:30 AM

Message 3 of 10
(3,410 Views)
 
<< to Elsa Fung !! << Yes.. the commandButtons are the samplerae, data2, flow2.
I cant upen the VI now coz you got a newer version, (8.0) i got 7.01, what can i do?
 
<<to Paul!! << And about the the two while loops, thats 'coz, i want to place a readsub.vi to read data from the flow, when start/stop switch  is switched to start and to stop reading when swiched back again, .
 
when i press the command buttons before switching to 'start' and then switch to start, all the actions that i have made before switching to 'start', are handled by the event case, its anoying. How come it be.??
 
thanks for help!!  
 
HFZ
0 Kudos
Message 4 of 10
(3,394 Views)
Here it is in version 7.0
Message 5 of 10
(3,391 Views)
without looking at your code (others have done it and should get lots of stars for such in deep analyses!) ....
 
One way to solve your problem is to disable (&grayout) and enable the buttons with the property note when the user press the start/stop button
 
 
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 6 of 10
(3,388 Views)

PauloM

Yes its right about the start stop, i want to stop the vi when the switch is set to start.

Here is an explanaition for my program!!

What my program should do !!:

I press the arrow button in the LV UI. now my program must run.

some commands shall be written to FLM. the program is waiting for UI actions (means by that, actions by pressing new commands by Data2 Flow2 and samplerate)

and they should not be handled if they are pressed before the switch is switched to 'start'

Now I switch to start, and the program reads the data constants (from Samplerate, data2 flow2) and sends them to FLM

after that a "ReadDatasub .vi" should start reading from the FLM.

When i change data commands by pressing the command buttons, "The ReadDatasub.vi" must stop reading, coz new data are sent by the eventhandler. 

when finish, the Read data must run again.

Now when start/stop switch is switched to stop! "ReadDatasub.vi" must stop and a command "stop ", is sent to FLM. and everything stops. 

and the program is in stand by and is waiting for for new action from user. a start switch. 

 

HFZ
0 Kudos
Message 7 of 10
(3,383 Views)
Sorry sorry
I want to stop the vi. when switched to stop!!!
HFZ
0 Kudos
Message 8 of 10
(3,381 Views)
How can  I read data from the Serial port and in the same time make an event structure to wait for som button actions.??
all Thanks for the previous help!! 
 

Message Edited by HFZ on 01-16-2006 08:19 AM

HFZ
0 Kudos
Message 9 of 10
(3,377 Views)

How can i read data from the serial port and in the same time make an event structure to wait for som button events!!

All thanks for previous answers!!

HZZ 

HFZ
0 Kudos
Message 10 of 10
(3,361 Views)