PDA

View Full Version : Vex Programming help!


davelu
12-22-2005, 09:38 PM
Hey
I tried googling around for help and this forum but i just couldn't find it... In ifi_aliases.h in what part of the program does it define the controls? returning the analog values of the analog joystick?
is it this? Cuz last year was p1_y p1_x it was quite obvious... .... sorry i'm a bit slow on this :D help would be apperieated...
I'm using MPLAB IDE rather than easy c (For Vex Programming) And the controllers i'm talking about are the ones that came with the vex robotics kit....
#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

if so would it be somehing liek this if i do a four wheel drive using one anlog stick

pwm1=pwm2=pwm3=pwm4=pwm_in1;
if ( pwm_in2 < 127){
pwm1=pwm2=pwm_in2;
pwm3=pwm4=255-pwm_in2;
}
else if ( pwm_in2>127)
{
pwm3=pwm4=pwm_in2;
pwm1=pwm2=255-pwm_in2;
}

davelu
12-22-2005, 11:21 PM
:D I'm having some trouble compiling my program in MPLAB. The Error message says 'AARG.O' out of date. The files comes from C:\Program Files\Intelitek\easyC\Mcc18 I just overwiten the MCC18 i installed ealier beacuse it said 'ifi_library.o' was out of date and after i overwitten the files it says AARG.O rather than ifi_libary.o

Copyright (c) 2005 Microchip Technology Inc.
Error - Coff file format for 'AARG.O' is out of date.
Error - Could not build member 'AARG.O' in library file 'C:\MCC18\lib/clib.lib'.
Errors : 2

Mark McLeod
12-23-2005, 08:32 AM
That sounds like it might be a mismatch due to your c compiler.

Look at this thread to see if your symptoms seem similar.

davelu
12-23-2005, 08:22 PM
Yeah it works now. I installed c18 2.40 with MPLAB 7.0

I'm trying to call Limit_Switch_Min & Max but it gives me an syntax error
which says "syntax error"

in the header file i defined BASE_DR pwm01=pwm02

Limit_Switch_Min(BASE_1_LIMIT,&BASE_DR);
but if i write it this way it doesn't
Limit_Switch_Min(BASE_1_LIMIT,&pwm01);

can anynow tell me what is wrong with the way i wrote it?
Limit_Switch_Min(BASE_1_LIMIT,&BASE_DR);



For the top part i suppose
#define PWM_in1 rxdata.oi_analog01 would be stick 1Y
#define PWM_in1 rxdata.oi_analog05 would be stick 1X

Mark McLeod
12-23-2005, 09:03 PM
in the header file i defined BASE_DR pwm01=pwm02

Limit_Switch_Min(BASE_1_LIMIT,&BASE_DR);
but if i write it this way it doesn't
Limit_Switch_Min(BASE_1_LIMIT,&pwm01);

"BASE_DR" will be replaced in the call by "pwm01=pwm02"
so what you are getting is:

Limit_Switch_Min(BASE_1_LIMIT,&pwm01=pwm02); // your syntax error begins at the = sign.

when you really just wanted

Limit_Switch_Min(BASE_1_LIMIT,&pwm01);

Change your define to:
#define BASE_DR pwm01
and it will work the way you planned.

As to your other question I haven't had time to go look at the Vex controller yet to make sure.

P.S. The Vex start code prints the values of all the controls to the IFI terminal window in order, and you can see which ones change when you move each control.

#define PWM_in1 rxdata.oi_analog01 //Right joystick x
#define PWM_in2 rxdata.oi_analog02 //Right joystick y
#define PWM_in3 rxdata.oi_analog03 //Left joystick y
#define PWM_in4 rxdata.oi_analog04 //Left joystick x
#define PWM_in5 rxdata.oi_analog05 //Ch. 5 buttons on back of transmitter
#define PWM_in6 rxdata.oi_analog06 //Ch. 6 buttons on back of transmitter