View Single Post
  #3   Spotlight this post!  
Unread 25-02-2004, 12:12
unclear_physics's Avatar
unclear_physics unclear_physics is offline
SW Engineer/Physicist
AKA: Richard Neese
#0147 (Deep Thunder)
Team Role: Engineer
 
Join Date: Jan 2004
Location: St. Petersburg, FL
Posts: 5
unclear_physics is an unknown quantity at this point
Re: More Programming Help!

Assuming that you use Relay 1 (you can change this depending on the relay that you use) and you put the red lead of the pump to the M+ leg of the relay and the black lead to the M- leg of the relay, issue the following command to turn on the pump all of the time:

relay1_rev = 1;
relay1_fwd = 0;

This must be in your version of the Default_Routine or whatever you use that gets called everytime thru the 26.2 msec loop.

If you want the pressure switch to control the pump, take a pwm cable, cut off the male end, and wire the signal line (white wire) to one side of the switch and the ground line (the black wire) to the other side of the switch. Don't connect the red wire. Just cut it back and electrical tape the end. Then plug the end with the female connector into a free digital input, say for example digital input 7. Then the following logic will turn the pump off when the switch closes at 115 PSI and turns it on when the switch opens at about 95 PSI:

if (!rc_dig_in07) // don't forget the exclamation point
{
relay1_rev = 1;
relay1_fwd = 0;
}

The exclamation point means the complement (or not). This is because the
pressure switch is normally opened and when the switch closes the value on
rc_dig_in07 will go to ground which is 0 in the code. And !0 = 1, so your pump turns on. When the switch opens, the value goes to 1, and !1 = 0, so
your pump turns off.

Hope this helps.