LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Gloabal variable can't change the value in an event structure

Hi folks
I've develped a gloabl variable (slide button) in a main.vi, i want that global variable to change its value when pressed but in a sub.VI
In that sub.VI the global variable is attached to its indicator (so it can be handlede in an event casestructure ) But it seems that the event structure cant detect the value change
of the Global Variable,  although i put the globalvariable and its indicator in a while loop and exits the while loop when the Global value did change???
i got that problem for several buttons!!
 
Some one Please help me, I used hours on that!!!
Thanks Professionals and beginners....
HFZ
 
PS. NEWEXAMPLE is the main,vi all other is the sub.vi's and then the global 
HFZ
Download All
0 Kudos
Message 1 of 23
(3,845 Views)
I don't think Event Structure can detect changes you made to the variables.  I had a similar problem before, it seems like Event Structure can only detect the changes made by the user on the front panel.
 
Hope this helps ^_^
0 Kudos
Message 2 of 23
(3,821 Views)
Thanks
Then i'l try to set the event casestructure in the main.vi, and control the buttons from the front directly intead of globals!
does that make sence??
hope for me*?
 
Zamzam
HFZ
0 Kudos
Message 3 of 23
(3,812 Views)
it seems like you have a lot of problems with this program (from the other threads)
well... good luck!!!
 
it'll work out eventually ^_^ espeically when you people here to help (that's how i got my first LabVIEW program done, haha ^_^)
0 Kudos
Message 4 of 23
(3,808 Views)

Maybe I'm missing something, but the variables you have in the subVI aren't even globals.  You have the VI created correctly to hold the globals, but you're not using them.  You just created another control in the subVI with the same name, this does not link it to the global variable.  To add a global to your block diagram, right click to bring up the functions palette and click "Select a VI...", then choose your VI with the globals.

I don't really understand what you're trying to do with these globals though, but maybe the value(signaling) property could help.  If you wire a global to the value(signaling) property of an indicator in a subVI, when the global changes it will change the indicator's value and trigger the value change event for that indicator.

Let me know if this makes sense, or you need any more help.

Message 5 of 23
(3,802 Views)
like i said, Event Structure doesn't detect changes made within the code, it can only detect changes made by the user in the front panel, here's a simple example that demostrates this "special feature"
 
when you click on the button to change the value of Numeric, the event case won't trigger, but if you manually click on Numeric to change the value, the event case will trigger
 
so it doesn't really matter if the globals are used or not
0 Kudos
Message 6 of 23
(3,793 Views)
One other thing I just noticed is that you need to be more careful connecting your wires through the borders of your structures.  Your VISA resource wire that goes through the event structure's timeout case is not connected to the output, there are 2 connections there.  In this case it won't make a difference, but an error like that could cause you some major headaches if you don't catch it right away.
Message 7 of 23
(3,787 Views)
That's exactly the reason they made the value(signaling) property.  Try this VI and you'll see that it does in fact trigger both events when you click the button.
0 Kudos
Message 8 of 23
(3,786 Views)
Marc And Elsa Fung
 
Marc:   , i've made som changes to my  .VI. Now i've got  the eventcase in the main .VI and not as a sub.vi. it is working getting the buttons actions handled when pressed.
But now i got another problem, its, that i cant start the main while loop when start/stop switch is pressed, that's coz the small case structure (if u look at the new .vi) is running.
I need to stop the small casestructure also when the stt/stp-switch is pressed to stop.
 
Elsa: I cant upen your example coz u got vers. Labview 8.0 when I got the 7.01
but try to take a look at my example .vi,
 
i'm waiting!
Thanks   partners!!
Zamzam
HFZ
0 Kudos
Message 9 of 23
(3,781 Views)

Sorry i twisted the names for the answers!

But to understand me well. what i'm trying to say  : is that when i start switching the start/stop-switch to start it goes well. then i switch the start/stop switch back to stop! and also here it goes well, except that the small case don't swict to false instead it keeps running , and meaby there for i can't switch the start/stop-switch to start again!! understand??? I hope so, ,Sorry for my english language its not that good ,so i can't explain so good.

Thanks forall the help, i need it from you !!

Zamzam

waiting!  

HFZ
0 Kudos
Message 10 of 23
(3,773 Views)