|
Re: Reversing Relay for motor
The Relay Set VI does not take values on the 1 to -1 scale. Look at the help for this VI to see which values correspond to which relay directions/values.
One way to do this is nested case structures. Another way to do this (and the way I will explain) is to use two Select VIs in series. The Select VI is found in the Comparison palette.
The Select VI takes 3 inputs. The middle input determines which of the other two inputs is passed through. The top input is passed through if the middle is true. The bottom input is passed through if the middle is false.
You want to make a Relay Set VI, right click on the Relay Value terminal and create a constant. Disconnect the constant from the terminal.
Make a Select VI and wire the middle terminal to one of the buttons. Wire the top terminal to the constant and set the constant to the direction you want the relay to go when that button is pressed (Forward or Reverse). Copy the constant and wire it to the bottom terminal and set it to Off.
Make a second Select VI and wire the middle terminal to the other button. the top terminal should be another copy of the constant set to the opposite direction. The bottom terminal should be the output of the first Select VI.
The output of the second Select VI goes to the Relay Value terminal of the Relay Set VI
__________________
2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
|