gotta fix your project’s search paths.
find the project settings in the project menu, and change the paths.
include -> mcc18/h
library -> mcc18/lib
linker -> mcc18/lkr
Open MPLab, open the project, go to Project -> Build Options -> Project
Then on the General tab (or something like Paths in v8), set the links like this:
Linker -> mcc18/lkr
Library -> mcc18/lib
Include -> mcc18/h
Check the lines above that for something like a missing brace or semicolon.
Since the C18 compiler gives ever-so-helpful error messages, I can’t say for sure, but I’m guessing the compiler was expecting a semicolon at the end of a statement or a closing curly-brace, but instead it found “void Autonomous_Spin(void)”.
The syntax error occurred on line 242, but the problem that caused it isn’t necessarily on that line. The actual problem is often on the line above the one the compiler says it is.
Without the surrounding code, it’s hard to tell. Based on that file name, I’m assuming you’re using Kevin’s v3 code, correct? Did you modify that file?
Well, without the whole file, it’s hard to tell what’s wrong, but do you have semicolons and closing brackets everywhere? (Those would result in something more like “expected xx instead of yy” errors, though…)
void Teleop(void)
{
// enable this to use IFI’s default robot code
// Default_Routine(); // located in ifi_code.c
pwm01 = 255 - Limit_Mix(2000 + p1_y + p1_x - 127);
pwm02 = Limit_Mix(2000 + p1_y - p1_x + 127);
pwm10=pwm11=p2_x;
// update the state of the LEDs on the operator interface
Update_OI_LEDs(); // located in ifi_code.c
}
Here is the part before the error. Can someone help me ?
void Autonomous(void)
{
/* Add your own autonomous code here. */
/*Bob's Code starts*/
/* SCENARIO 1 ----
step 1 grip keeper
step 2 raise arm
step 3 drive forward 3 seconds full
step 4 realease keeper and move backwards
step 5 wait
*/
// Autonomous_Code is determined by the position of the switch
// rc_dig_in16 switch on the robot rc AUTONOMOUS mode
// rc_dig_in15 switch on the robot rc AUTONOMOUS mode
//#define AUTO_MODE_DEFAULT 0 // NO switch on the Robot at all
// AUTO_MODE_DEFAULT 1 // if switch on rc_dig_in15
// AUTO_MODE_ARM 2 // if switch in the middle
// AUTO_MODE_DEFENSE 3 // if switch on rc_dig_in16
//#define AUTONOMOUS_GO_TO_Rack ( (int)rc_dig_in16 == 0)
/*set our default - no switch on bot */
Autonomous_Code = AUTO_MODE_DEFAULT ;
Finney_auto_counter++;
// we need to find out if the switch is installed on the RC in Digital IN/OUT
// if so, then run the appropriate Autonomos code
if ( (!rc_dig_in15) )
Autonomous_Code = AUTO_MODE_DEFAULT ; // run code for position 15
else if ( (!rc_dig_in16) )
Autonomous_Code = AUTO_MODE_DEFENSE ; // run code for position 16
else if ( (rc_dig_in16) && (rc_dig_in15) ) // run code for MIDDLE position
Autonomous_Code = AUTO_MODE_ARM ;
if ( (rc_dig_in16) && (rc_dig_in15) ) // switch is in middle or missing
{ // Going forward for three seconds.
left_drive = left2_drive = 210;
right_drive = right2_drive = 44;
if (Finney_auto_counter > 78) step++;
}
else if ( (!rc_dig_in16) || (!rc_dig_in15) ) // for position 15 or 16
{
switch (step)
{
case 1:
/***** STEP 1 ******/
//grip keeper ring
// claw_close = 1;
// printf("auto step =%d
", step);
if (Finney_auto_counter > 26) step++; //was 95
break;
case 2:
/***** STEP 2 ******/
// raise arm.
// arm = 90;
if (Finney_auto_counter > 78) step++;
break;
case 3: /***** STEP 3 ******/
// drive forward.
left_drive = left2_drive = 220;
right_drive = right2_drive = 60;
if (Finney_auto_counter > 95) step = 5;
break;
case 4: /***** STEP 4 ******/
// release keeper and drive backwards
// claw_open = 1;
//claw_close = 0;
left_drive = left2_drive = 69;
right_drive = right2_drive = 69;
if (Finney_auto_counter > 380) step++;
break;
case 5: /***** STEP 5 ******/
// stop and wait.
left_drive = left2_drive = 127;
right_drive = right2_drive = 127;
if (Finney_auto_counter > 131) step++;
break;
case 6: /***** STEP 6 ******/
// look for the light and move towards it
Process_Data_From_Master_uP();
if (Get_Tracking_State() == SEARCHING)
{
left_drive = left2_drive = right_drive = right2_drive = 127;
}
// This is so when it's not searching, it's moving towards the light
else
{
// turn robot right toward the light
if(PAN_SERVO < 124)
{
left_drive = left2_drive = 230;
right_drive = right2_drive = 128;
}
// turn robot left toward the light
else if(PAN_SERVO > 124)
{
left_drive = left2_drive = 128;
right_drive = right2_drive = 76;
}
// drive robot straight toward the light until 5 feet in front
else if((116/tan(180*(((TILT_SERVO-144)*25)/50)/3.1415)) > 5) // This converts the PWMs to radians and uses trig to find the distance
{
left_drive = left2_drive = 230;
right_drive = right2_drive = 76;
}
}
default:
left_drive = left2_drive = 127;
right_drive = right2_drive = 127;
// claw_close = 0;
break;
} /* End of Switch ( Finney_auto_counter) */
/*Bob's Code ends*/
I know this may be a pain, but try commenting out blocks of your code at a time. Comment out a huge block that fixes the problem, then make the block smaller and smaller until you find the line that causes the problem.