05-02-2012 03:16 AM
Hi!
Im working with making a subVI to set a the outputs to a valve. I have been trying for a while now, but just dont seem to get it right.
This is the function that im looking for:
One output opens the valve, and output closes it. These two can not be active at the same time.
To open the valve, i need the output to be set hi for at least 5 sec, and after that it goes low again. The valve vil now hold its posittion.
The same ways goes with the closing.
The output status changes with a hi pulse.
Can anyone help me with this? Anyone that got a smart solution?:)
Solved! Go to Solution.
05-02-2012 05:28 AM
Hi Elling,
Do this first, in your subVI.File>>VI properties>>In category>>Execution>>Enable re-entrant execution.
Then try to do properly what you want.
05-02-2012 05:50 AM
Hi danil,
could you please explain how reentrancy could solve any of the problems involved in the OPs question?
Infact I think it's not a good idea to set this subVI reentrant.
This is the function that im looking for:
One output opens the valve, and output closes it. These two can not be active at the same time.
To open the valve, i need the output to be set hi for at least 5 sec, and after that it goes low again. The valve vil now hold its posittion.
The same ways goes with the closing.
The output status changes with a hi pulse.
I would use a statemachine approach for that purpose. The subVI will remember the current status of the valve and can handle any timing inssues on it's own. Define some states (like: init, switch, wait) to handle the different tasks. Then it will become easy to implement the logic...
05-02-2012 07:42 AM
What hardware are you using? Can you post the section of code in question? This would be helpful.
05-02-2012 07:59 AM
Hi and thanks for the replys:)
Im using a Ni PXI-1036 Chassis, with a PXI-6238 card.
Im also using the PXI-8360 link card to connect to the laptop.
05-02-2012 08:06 AM
And your code?
05-02-2012 08:14 AM
Im not quite shure what code you want
Im kind of new in this program.
I have tryed setting it up as a event(Attached file) but i than figured out that i couldn't jump out of the event if the valve needed to be closed soner than after the event.
I have been sitting a few hours today(without getting far), trying with a state machine. But im just no getting it right.
05-02-2012 08:19 AM
An event structure may not be the right archetecture for you. I think a state-machine will work best. Can you down-convert your state-machine? Go to File>>Save for Previous Version, and save it for 8.2.
05-02-2012 08:32 AM
Here you go!
05-02-2012 10:14 AM
I think i might figured it out now!
Check out the attached file:)
Is there any improvements that should be done?