03-25-2015 12:22 AM - edited 03-25-2015 12:23 AM
Hai guyz/galz. Im just a newbie starting out in the labview field. I have just started designing a temperature measuring VI and Im having a problem right now which is I cant seem to quit when I press the QUIT button the VI if it is running unless I prss the STOP button. Apart from that whenever I press STOP the VI and wish to START again, I can't seem too resume. I apologise for this trivial question of mine. Any pointers wil be much appreciated.
Solved! Go to Solution.
03-25-2015 01:52 AM - edited 03-25-2015 01:57 AM
You have a fundamental misunderstanding here. Learn the basics of LabVIEW, and what data flow means (LINK). Your outer while loop is polling your CPU during it is waiting for the user to click the start button. Put some timing here. In the block diagram I do not see the physical channel info for setting up the DAQmx. When your inner while loop finishes execution, all you can do is to quit. So this is not a proper way to do what you want. You also does not close your DAQmx task, you neither have any error check.
Beside, why you want to sample your temperature sensor with 1kHz rate? I work a lot with temperature sensors, and it does not seem to make any sense to me. What kind of sensor do you use? In most applications, 1 or max 10 Hz is totally satisfactory (usually temperature sensors are SLOW).
edit: of course, the story is different, if you have a noisy sensor, and you want to sample at higher freq. so you can make some kind of noise reduction...?
Try something like this:
03-25-2015 06:59 AM
I see. Thanks for the pointers. Really appreciate it. Ill try it out tomorrow and see what happens. Thanks again mate.
03-25-2015 07:15 AM - edited 03-25-2015 07:18 AM
One more thing. The structure Blokk showed you will work well as long as the delay between measurements is short. To see why, imagine a 1 minute delay between reads, and let's say that you click the Stop button a few seconds into a delay.
What happens is that LabVIEW doesn't immediately see the click because due to the way dataflow works, the button state has already been read for that iteration. In fact, reading that button will be one of the first things LabVIEW will do with each iteration.
So LabVIEW will see the click at the beginning of the next iteration and will know that the loop needs to stop, However, before it can stop it has to execute everything inside the loop again -- including another 1 minute delay...(Which will likely never get the chance to complete because you will have decided that the program has locked up and hit the Abort.)
Mike...
03-25-2015 08:21 AM
I'll definitely keep that in mind Mike. Thanks for the info.
03-26-2015 12:41 AM
Your advice was super helpful Blokk and Mike. Really appreciate it. My VI can now run.