02-28-2012 02:18 PM
Hi,
I'm doing app in LabView 2011 (v11).
Its reading from FP-RTD-122, attached to FP-1001 via RS485.
Attached app does job quite well, but (Never good enough for me... :-)) when delay between logging is long
(i dont want to log every 100ms, rather every 30 minutes (1800 seconds, 1800000ms) - and it could also get resource-abusing to use COM each 100ms),
app doesn't do multitasking, and waits for sleep to finish, so it could listen to actions again.
For example,
i have 30s "sleep", and after 5 seconds i interrupt app (i stop while loop with button), but i need to wait the rest 25 seconds.
How would I make this app multitasking ("multithreaded"), so i would have GUI thread (graphical interface) in frontground, and logging in background,
and even if it started new sleep cycle, i would be able to stop it without waiting?
I attach .vi.
Thanks for further support.
(PS: strictly windows application, includes creation of folder C:\LOG and usage of Notepad.exe. I appologise if i forgot to translate anything.)
Solved! Go to Solution.
02-28-2012 02:32 PM
DON'T UPLOAD A VI THAT IS SET TO RUN WHEN OPENED!
You should look at using the Elapsed Time express VI. When the alotted time as elapsed, it will output a true and you can use that to drive a case structure such as logging to a file. When the time has not elapsed, it outputs a false. Don't log to to a file, just do the other stuff you need to do inside the loop.
02-29-2012 10:52 AM
I knew i've forgotten something. humm..
so, i think i don't really understand time lapsed thingy... At least it doesn't work as i've wanted...
02-29-2012 12:10 PM
One while loop, not two. You are trapping yourelf into the inner while loop until the time has elapsed. Use the output of the time elapsed to trigger a case structure. Do the stuff you want to do periodically in the true case of the case structure.
Wire your time to wait into the Time Target, not the Set start time.
02-29-2012 12:23 PM
Enlightened! This seems to work! 🙂