05-21-2013 08:54 AM
Good morning,
With the attached VI I am trying to continuously collect and plot data from an RS32 connection. The first case structure checks to see if the user entered the appropriate data. The first while loop clears the serial port, collects data, plots the raw data and plots the "cleaned data". However once the second case structure finishes and the data point is plotted to "Clean Signal" the VI aborts. I need the first while loop to continue pulling data and plotting to each chart without having the VI restart each time. Any help will be greatly appreciated.
Thanks
-Grover
05-21-2013 09:19 AM
OK, you have a few fundamental problems with that code but, nothing we can't help with.
05-21-2013 09:19 AM - edited 05-21-2013 09:20 AM
Your VI looks like it is "inside out". Usually a while loop is the outermost structure, not a case structure.
You shouldn't reconfigure your serial port on every iteration of the while loop. Do it once before the loop starts.
Your outermost while loop (inside the case structure) is set to continue if you hit the stop button OR you have an error. If neither of those things happen, your loop will stop.
Perhaps you want to set the loop termination to be Stop when True instead of Continue when True?
(Note. You can debug these kinds of things yourself if you run with Highlight Execution turned on.)
05-21-2013 09:21 AM
1. You need to change the stop condition of the while loop. It is currently set up to be Continue if True. Change it to Stop if True (is should look like a stop sign).
2. You don't need the little loop to check for the number of bytes at the port. Just tell the VISA Read to read the 15 bytes.
3. I'm not sure why you have another loop inside. Are you having problems with data sync?
4. You don't need to call the Stop VI function in the FALSE case.
5. You really should not be using the Run Continuously (I'm guessing you are using it based on your description).
05-21-2013 09:21 AM - edited 05-21-2013 09:22 AM
Bill, That's darned funny. I completely agree
[EDIT] Tim you are late
05-21-2013 09:22 AM - edited 05-21-2013 09:24 AM
EDIT: Better answers above 😄
Regards
05-21-2013 09:32 AM
Jeff·Þ·Bohrer wrote: Tim you are late
Yeah. Work got in the way.
05-21-2013 10:37 AM
Thank you for everyone's input and patience, as I am new to LabVIEW. I have updated my VI and it is performing the way I would like. I have attached the new version, would anyone mind looking over it to make sure I am still not violating major programming conventions?
Thanks again.
05-21-2013 10:44 AM
Again, you don't need to call the Stop LabVIEW function. Just wire a TRUE out of the you False case to stop the loop.
You really should close your VISA session after the while loop.
05-21-2013 10:50 AM
I assume you mean after the inner while loop? This will not affect the reading of data in further iterations? And just for my own edification, why the need to close it?