08-03-2010 03:15 PM
Hey,
I have a pressure controller that I am trying to interface with Labview. Here is the way I have it set. I have a read function that sends the parameter to read the position of the valve and returns its position. And I have a event case structure that will send different codes to the pressure controller if I need to open/close the valve or change its position. The problem is that it is only running the read statement when I start my VI and whenever an event in the case structure is triggered. I need to constantly be telling me the actual valve position in real time. Any ideas how to do this? Thanks.
I can attache the VI if needed
08-04-2010 12:41 AM
08-05-2010 10:02 AM
Here is what I have so far and it is working for the most part. If XOR close valve and open valve then I run a flat sequence reading the pressure of the valve and the position of the valve. Else I run into a case statement where if open valve has a value change then the valve is open to a specific pressure input, and if close then valve just closes. I beleive it is running for like I want it to for the most part but I find having to toggle the close or open twice to get it to work. For example, I will toggle the valve open up to get into the case structure and the down to activate the event structure. Any idea on how to avoid this?
08-05-2010 10:20 AM
You've mad some pretty major mistakes. First, the example VI is not intended to be used as a subVI. You really don't want to be opening, closing, initializing, the serial port over and over again. Do the initialize once when the VI starts and do the close once when the VI stops. When you want to do a write, just use a VISA Write function. When you want to do a read, just use a VISA Read function. You would pass in the VISA Resource from the initialize function.
You do not have a loop around your code. That means you are using the run continuous button. Do NOT use that. It is meant for special debug uses.
Don't put a case statement around the event structure. The event structure runs at all times and you are not disabling it in the false case.
Your 'Close Valve' and 'Open Valve' terminalss need to be in their respective events.
To get constant pressure and postion, put those commands in a timeout event.
Get rid of all sequence structures. They are just bad design. What you will have in each event is a couple of VISA Reads that you connect with the error out/error in clusters.