LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling a relay board using Labview

I'm currently working on a project that involves using labview to control a series of valves hooked up to air muscles. To this end, I'm using two types of valve setups. The first one keeps air within the muscle, regardless of the valve's state, and another that only has air in it as long as the valve is on. The hardware I'm using is from Measurement computing, and the universal library they provide has a function that translates a number into binary, and this determines which valves are activated (i.e. if 1 is sent, then the first relay is activated. If a 2 is sent, the first relay is deactivated, and the second is activated, and so on).

The problem I'm running into is that I have a way of sending the correct number to the relay, but after the relay has been activated, I want to shut the valve off again. If they were all the same type, then I could just write a zero and turn them all off at once, but since I have some that I need to stay open, writing a zero to all of them will shut the others off as well. Does anyone one know of some way to turn only the specific input numbers on, then off again without turning them all off?

I'm working on this project in Labview 8.20.

0 Kudos
Message 1 of 4
(4,067 Views)

hi loatisaf,

      Without knowing anything about the MCC relay drivers - except that you can write bit patterns - I'd build myself a "driver" VI that takes two inputs - a "pattern", and a "mask" (see attached).  The VI "remembers" the last pattern written, and only changes the bits you specify in the bit-mask.  This pattern/mask scheme is already part of NI's DIO VIs - but you have to be using NI hardware to use those.

When it comes time to set some bits for specific valves, but not for others, use the bit-mask to enable only specific valves.

Cheers!

 



Message Edited by tbd on 02-13-2008 12:45 AM
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 4
(4,061 Views)
hi loatisaf, I guess you are using the DOut.vi to send the information to the relayboard. So you could also use the DIn.vi to get the information about your relay states. There is a vi attached, doing nothing than using the result from DIn to manipulate a selected port and delivering the result for DOut. I have done this with a conversion into a boolean array, so it is perhaps easier to understand what is done.
0 Kudos
Message 3 of 4
(4,036 Views)
Thank you all for the prompt reply. It looks like using the Din.vi can help, I just need to figure out a way to handle multiple changes at once.
0 Kudos
Message 4 of 4
(4,020 Views)