01-16-2006 09:18 AM
01-16-2006 09:27 AM
01-16-2006 10:01 AM
01-16-2006 11:09 AM
01-17-2006 02:13 AM
01-17-2006 03:22 AM
01-17-2006 07:29 AM
Hi HFZ,
I unfortunately do not have LV installed at my work PC at the moment.
But I think you might be able to get away by creating a vi that first sends commands to the flowmeter (via serial), and then enters a while loop which has a couple of case statements.
I will look at you vi (hopefully soon, if not tonight) and propose an example.
So imagine the following:
a) a sub-vi to open the COM port, send the commands to flow meter, then close the port (sub-vi to keep the main vi clean).
b) another sub vi which has a while loop. A STOP button is wired to the loop control, maybe ANDed with a certain event to trigger the end of the function. Open COM Port just outside (before) the while loop (you only want to do this once). Within the while loop are the following case statements:
1 Upon pressing config button (or an event occurs), set sample rate and other config. If only done once (ie static), then you can also do this outside the while loop at the same location as the COM port open.
2. Upon even (including press button), it sets a condition for another case statement to sample data, flow, etc. And maybe data change if this is when you want it to happen.
3. Keep the start stop button seperate from the case statements which are to do a sepcific task for every iteration of the loop. If you want it to take a single sample or to turn sampling on/off without exiting the loop, you can use shift registers (to pass a new value to the case statement with the appropriate logic).
4. You can also use (seperate) shift registers to store the last data values. You can also have a case structure to handle writing data to a file. The nice thing with the case structures is that you can converts them to sub-vi's if they start getting large. 😉 You can then use the data from the shift register to send to the flow meter (although I am not sure why). But following the suggestion from item 3 should keep the while loop running until you press STOP or some event stops it. That way you can read, stop reading, start reading from the flowmeter without actually stopping the loop. Simply set a case that says "read if true", for instance. By having a case statement take care of configuration, you can click on it and change the samplerate, etc for the flowmeter. The config case could be inside the read data, but you'd have to be careful that it is only triggered once per instance of read (hopefully this sentence will make sence to you) 🙂
5. By STOPping the while loop, you could close the serial port (at the right of the loop), and process the data if necessary. I would do things such as writing to a file from within the loop. Basically, after the while loop, you would want to close ports, files, etc and complete the vi.
01-17-2006 07:52 AM
I don't know how to thank you,
I'll try to develop from your answers or points, from now on during the day.
regards
HFZ
01-17-2006 08:44 AM
You're welcomed.
I hope it works. And thanks for the stars 😄
You can continue to ask questions within this thread on this topic.
Ray
01-19-2006 02:05 AM
Hi Ray,
I cant figure point three out,
What i need is, that when i press the Arrow button (go) in labview, the main vi runs with its sub vi's, and the first 'ready command ' is send to FLOWMETER(FLM)
Now when i press the start/stop-switch from my main vi to 'start', i want to send the next command wich is the last data changed by the buttons, and then the event case is running by waiting for an action to accure (a data change by data, flow and samplerate).
The problem is,: i cant control a loop (to run /stop running) from out side the vi. mean by that, i cant control a while loop by a start/stop switch as Global variable!
thats because, before i switch the start/stop-switch, the eventcase my not react on the button changes.
Thanks regards
HFZ