Also, to make pneumatics programming easier, I've whipped up a quick set of macros you can use in your project to control the relays.
Changing a relay's state requires you to set a 0 to one variable and a 1 to another, if you forget, they jam, not such a good thing, these macro's will automate the process a bit and neaten up your code.
Example of the old way:
Code:
relay1_fwd = 1; // This sets relay 1
relay1_rev = 0; // to forward
relay2_fwd = 0; // This sets relay 2
relay2_rev = 1; // to reverse
relay3_fwd = 1; // This makes relay 3
relay3_rev = 1; // get stuck!
relay4_fwd = 0; // This sets relay 4
relay4_rev = 0; // to off
Example of my way:
Code:
RELAY1_FWD; // This sets relay 1 to forward
RELAY2_REV; // This sets relay 2 to reverse
// No way to get stuck!
RELAY4_OFF; // This sets relay 4 to off
All you need to do is add
Code:
#include "relays.h"
at the top of whatever file uses these macros, and that file is attached to this post:
http://www.chiefdelphi.com/forums/sh...507#post455507
Good luck!