08-11-2015 03:21 PM
HI
I am having a small problem, where I trigger an event using a value change button, which works fine. The problem is that the VI doesn't wait for me to trigger an event, and instead runs the same event again, even when I have not pressed the button to trigger it again. The mechanical action of the button is switch when released.
I was wondering how you would get the event structure to wait for a user event, after it has run the first time.
Solved! Go to Solution.
08-11-2015 03:25 PM
Is this using the same code from your last thread? If not, please share the new code. If so, please share the same code here.
The event structure will wait for an event to run, so there's something in your code causing it to run again. FYI, the mechanical action has no affect on event generation, just the value after the event.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-11-2015 03:43 PM
Yeah so here is the code
The problem seems to be the while loop loops after the event ends, but does not wait for my command to begin the same event again. Once again I apoligize because I can't seem to get you the subVIs in this program
08-11-2015 03:53 PM
@fghfghgfhfhg wrote:
Yeah so here is the code
Once again I apoligize because I can't seem to get you the subVIs in this program
Do you know about ZIP files? This is from Microsoft (for Windows 7):
If you are using LabVIEW Project (you really should be using Project), compress the Project Folder, which should get all of the sub-VIs (if your Project is organized into physical folders).
Bob Schor
08-11-2015 03:54 PM
So give me a step-by-step reenactment of what you do when it goes through the event twice. There is no reason that the event should be triggered twice as the only way it is triggered in your code is by the user clicking "Hall Measure Only". Is it only running twice, or is it continuously running through the event? How do you know it's running again? By probing?
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-11-2015 04:00 PM
I know that it is running twice because I am running execution highlighting, and when I am watching the code run, after it ends, and I have pressed the button to trigger the value change event, I see all the variables and other stuff pushing their values through the event case, which I have not triggerred a seond time, into the subVI , and the subVI executes
08-11-2015 04:04 PM
@James.M wrote:
There is no reason that the event should be triggered twice as the only way it is triggered in your code is by the user clicking "Hall Measure Only".
Oh yes there is, and I deserve a kudo for this one. The mechanical action on the button is set to Switch Until Released, so clicking will generate an event, on the down, and on the up, attached is an example.
Boy did my students hate that question, and to be fair I hated it. When would you ever do this intentionally? Honestly? Anyway change the mechanical button back to something normal (like default Latch When Released) and move the button terminal into the event structure where it is handled and it will work like normal.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-11-2015 04:04 PM - edited 08-11-2015 04:26 PM
Oh goddammit. I have literally never used that button configuration in an application because it's a pretty useless option (I know I know, someone might need a momentary switch, but come on)
Good find.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'