LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get event structure inside while loop to wait for event to occur before running

Solved!
Go to solution

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.

0 Kudos
Message 1 of 8
(6,724 Views)

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>   ---'


Message 2 of 8
(6,717 Views)

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

0 Kudos
Message 3 of 8
(6,696 Views)

@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):

How To Zip a file or folder

  1. Select the file or folder you want to compress
  2. Right click and choose Send To
  3. Slide Right and choose Compressed (zipped) folder
  4. Allow the file or folder to compress
  5. You should now see an icon with the same name plus a .zip extension. It may have a zipper on the folder.
  6. Rename the file if you'd like

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

0 Kudos
Message 4 of 8
(6,680 Views)

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>   ---'


0 Kudos
Message 5 of 8
(6,677 Views)

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

0 Kudos
Message 6 of 8
(6,654 Views)
Solution
Accepted by fghfghgfhfhg

@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.

Message 7 of 8
(6,638 Views)

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>   ---'


Message 8 of 8
(6,636 Views)