03-31-2007 07:06 AM
03-31-2007 10:14 AM - edited 03-31-2007 10:14 AM
Message Edité par chilly charly le 03-31-2007 05:27 PM
03-31-2007 10:34 AM
ALWAYS make the event structure code as FAST as possible.
Never put a wait-on-the-user function inside an event handler.
For one thing, the front panel is usually locked while an event is being processed.
For another, it confuses the logic of your program.
Use two threads, running simultaneously. Here's one thought:
Ref = Generate Occurrence
LOOP1:
Repeat {WHILE loop }
Wait on Occurrence (Ref, Timeout = 100 mSec)
if Timed Out
Read data
Store data
Graph data
Analyze data
until not Timed Out
LOOP 2: { in parallel with loop 1 }
Repeat {WHILE loop }
case EVENT of
Stop Button:
Trigger Occurrence (Ref)
Other button:
Do something else
until Stopped
The first loop uses the WAIT ON OCCURRENCE as a timer - if the occurrence is actually fired, that's a signal to quit.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-01-2007 07:48 PM
04-02-2007 08:42 AM