In MPLab (all i know), the relays are controlled by default fairly well. here's the code from default:
Code:
relay1_fwd = p1_sw_trig & rc_dig_in01; /* FWD only if switch1 is not closed. */
relay1_rev = p1_sw_top & rc_dig_in02; /* REV only if switch2 is not closed. */
relay2_fwd = p2_sw_trig & rc_dig_in03; /* FWD only if switch3 is not closed. */
relay2_rev = p2_sw_top & rc_dig_in04; /* REV only if switch4 is not closed. */
relay3_fwd = p3_sw_trig;
relay3_rev = p3_sw_top;
relay4_fwd = p4_sw_trig;
relay4_rev = p4_sw_top;
relay5_fwd = p1_sw_aux1;
relay5_rev = p1_sw_aux2;
relay6_fwd = p3_sw_aux1;
relay6_rev = p3_sw_aux2;
relay7_fwd = p4_sw_aux1;
relay7_rev = p4_sw_aux2;
relay8_fwd = !rc_dig_in18; /* Power pump only if pressure switch is off. */
relay8_rev = 0;
basically, the first relay is controlled by the trigger and side switch on the first joystick. the second is the same on the second joy, etc. etc., up until the fifth. THose are as follows:
relay 5: Joy 1 top buttons
relay 6: Joy 3 top buttons
relay 7: joy 4 top buttons
here's the nice one:
relay 8: opposite of 18th input.
Basically, the last one is for the pneumatics. put a pressure switch on the 18 digital input, and the compressor will run automatically! Isn't technology amazing?