Log in

View Full Version : [FVC]: MPLab using two transmitters


emmell
23-02-2007, 15:09
Okay, I looked and looked and can't find example code to do the following: One transmitter drives the bot. The other transmitter handles the arm and servos. I see how to do it with EasyC, but how do you do it in MPLab. Do I have access to two RxData/TxData data structures. Where?

/*
* Driver Control - Rx1 preferably
* pwm03 - left side drive
* pwm04 - right side drive (reverse it)
*
* Arm Control - Rx2 preferably
* pwm01 - Arm raise/lower
* pwm02 - Arm extend/retract
* pwm05 - Servo to lock arm
*
*/

Thank you!

Mannie Lowe

Mark McLeod
23-02-2007, 15:55
PWM_in1 through 6 are from the first Vex receiver port
PWM_in7 through 12 are from the second Vex receiver port.

So...

// Driver Control - Rx1 preferably
pwm03 = PWM_in1; // Depends on what mode you select on the transmitter
pwm04 = PWM_in2;

//Arm Control - Rx2 preferably
pwm01 = PWM_in7; //- Arm raise/lower (on CH 1 of 2nd transmitter)
pwm02 = PWM_in9; //- Arm extend/retract (on CH 3 of 2nd transmitter)
pwm05 = PWM_in11; //- Servo to lock arm (on CH 5 of 2nd transmitter)


In ifi_aliases.h you'll see them:

/*
*-------------------------------------------------------------------------------
*---------- Aliases for R/C PWM IN connectors -------------------------------
*-------------------------------------------------------------------------------
* Below are aliases for the PWM inputs received from the radio-control receiver.
*/
#define PWM_in1 rxdata.oi_analog01
#define PWM_in2 rxdata.oi_analog02
#define PWM_in3 rxdata.oi_analog03
#define PWM_in4 rxdata.oi_analog04
#define PWM_in5 rxdata.oi_analog05
#define PWM_in6 rxdata.oi_analog06

#define PWM_in7 rxdata.oi_analog07
#define PWM_in8 rxdata.oi_analog08
#define PWM_in9 rxdata.oi_analog09
#define PWM_in10 rxdata.oi_analog10
#define PWM_in11 rxdata.oi_analog11
#define PWM_in12 rxdata.oi_analog12

emmell
24-02-2007, 00:33
Mark:

Thank you. Thank you. I knew that. I just had a brain freeze these past three days trying to get ready for the tournament that I'm running on 2/24 (Georgia FVC) and mentoring my team at the same time.

I coded it right after I got your reply and it worked like a charm. Chimera #832 thanks you very much.

Mannie