LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event structure no response

HI,

   This is my first time writing a LabVIEW program using event structure.

   This program is designed for changing the temperature setpoint with a given ramp speed and monitoring the tempearture continously.

   I am using a while loop continously generating user event to control reading temperature, and a "setT" button for active the event of changing setpoint.

  Now the problem is the "setT" button cannot be catched by the event structure after the 1st time work.

 

  Also, I always meet a trouble with continously showing reading. For example, worjking with a temperature controller, if I want to set the setpoint, reading tempeature have to be stopped.  Then the real-time display(continously reading) seems not possible.

0 Kudos
Message 1 of 12
(3,606 Views)

You've got several serious flaws with your program.  Try running it with execution highlighting turned on.

 

1.  You are trapping your program inside the while loop inside the event structure.  That while loop with either run exactly once (because the conditions that come from outside the while loop executes the false case which stops the while loop.  Or it will run for ever when the conditions that come from outside the while loop run the true case.  The values on those orange wires never get to change because there value get locked in once the while loop starts.

 

2.  Don't put while loops inside event structures (even if it is a properly functioning while loop).  Why?  An event case should execute in reasonable amount of time so it can be ready to handle the next event.

 

3.  You have the event set to lock the front panel until completed.  That prevents other actions from occurring on the front panel.  And since the loop inside the event case is infinite, the event never completes, and the front panel never gets freed up.

 

Your unregister for events and destroy user events will never run because your two large while loops are also endless since they have a False wired to the stop terminal.  The only way to stop your program is by aborting it with the toolbar's abort button.

 

Also stay away from stacked sequences as they hide your code.  If it is necessary to use a sequence structure, use a flat sequence.

 

Several major dataflow errors are occurring.  I'd recommend you take the tutorials on LabVIEW.

0 Kudos
Message 2 of 12
(3,595 Views)

Thanks a lot.

 Actually, the while loop inside the even structure is finite (not endless). When the setpoint is finished, the while loop is terminated.

 It does work,  but the event response to the "SET" is very slow.  When I clicked the "SET" button, it takes maybe 1 minute to get action.

 

 

WeiTOng

0 Kudos
Message 3 of 12
(3,584 Views)

The user generated event and 2nd loop is completely redundant, just put it in the timeout case of your event structure with 100 connected as timeout.¨

 

What's really going on in the SetT case, as it takes so long to finish causing the UI lag?

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 12
(3,575 Views)

Put the user generated event into timeout case is good idea!

 

Yes, the SetT case takes some time to finish and that is what I need.

When the setT case was finished, I click the "set" button again, it will take more than 1min to get response. This is the problem.

 

0 Kudos
Message 5 of 12
(3,568 Views)

Remove/replace your Current Setpoint and use a shift register instead, it's faster and avoids race conditions. Else you need to run with highlighting to analyze what's taking so long.

 

In your loop you call "Set T", could it be that it creates a new event?

 

/Y

Message Edited by Yamaeda on 12-10-2009 10:36 AM
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 12
(3,552 Views)

Now, I modified the program. First two event cases work well.

But there is no response to the 3rd case  (setP case).

 

See attached.

0 Kudos
Message 7 of 12
(3,545 Views)

Your lower loop (which i dont get the idea of) is running at 100% cpu in case your Current Setpoint check is true. That'll cause very slow response.

 

You can get rid of 80% of the flat sequences if you wire through Error, in case of the waits, why dont you make it into a vi with error in and out to avoid the sequence? 🙂

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 12
(3,525 Views)

Since that, why are the first case (time out) and second case (setP) working well? There is 250ms waiting in the flat sequence of the lower while loop.

 

 

How to make it into a vi with error in and out to avoid the sequence?

Thanks

Message Edited by weitong on 12-10-2009 06:07 PM
0 Kudos
Message 9 of 12
(3,495 Views)

This is the new version. It looks working good now.

I wish to get some more comments for improving it. Please provide them in a little more detail. Thanks in advance.

 (LabVIEW8.2)

 

Best,

WeiTOng

0 Kudos
Message 10 of 12
(3,462 Views)