04-21-2014 03:51 PM - edited 04-21-2014 03:54 PM
Hello there!
I am trying to create a VI for humidity. So far everything works fine for that. I also wanted the ability to let the user define the frequency of data collections in units of time. ie: every <x> minutes/hours/days/etc. This also works to some extent.
My problem is that say I choose 1 second, then change the unit to 1 minute. It'll do exactly as expected: the VI will wait 1 minute until capturing a data point. The problem is what if the user changes it back to seconds before that minute is over. The VI will still wait the full minute before changing to the new collection frequency unit.
Is there someway to force reset the timer if the user changes a selection?
Also, I am trying to make a progress bar to let the user know how far the VI is along with the collection interval. I thought it'd be convenient if a user selects 1 hour for example. There is no way of knowing how far along that hour wait is. I can't seem to get this one to work either. I thought it'd be something like
1)get current date/time seconds
2)add the user interval (ie: 60 seconds) to #1
3) get a %
4) add that to progress bar
5) if reaches 100, then reset.
Also for some reason my STOP button doesnt work for this loop.....
Any help on this would be great! I've attached the VI I have going thus far.
thanks so much
04-21-2014 04:04 PM - edited 04-21-2014 04:05 PM
It is a bad idea to stall loops for long time periods. The stop button works just fine (unless you use an unusual mechanical action setting) but the loop cannot complete until everyhting in it (including the long wait) has completed.
In order to update indicators (e.g. a progress bar), the loop needs to actually spin. There is only one update per loop iteration.
Easiest would be to use the timeout of an event structure to trigger a collection. Use other events to immediately break the timout and apply new settings, etc..
(Please attach actual code instead of an image)
04-22-2014 07:59 AM - edited 04-22-2014 08:08 AM
Ah, sorry about that I thought I also attached the VI.
Since this is my first VI, I'm not sure what you mean by:
altenbach wrote:
Easiest would be to use the timeout of an event structure to trigger a collection. Use other events to immediately break the timout and apply new settings, etc..
Here ya go!
04-22-2014 08:57 AM - edited 04-22-2014 08:59 AM
Avoid using any of the Wait functions to time a software operation....let the loop iterate independently from the user inputs.