Your code looks fine. There is no magic check to see if you've changed anything in main.c. Lots of teams have rewritten main.c without issues. All the teams I mentor modify main.c for this and a variety of other reasons as well.
I'll see if I can find some past threads on this topic. [edit]
http://www.chiefdelphi.com/forums/sh...ad.php?t=24590
Since the call to User_Initialization comes before the loop you posted I suspect other problems.
Here's one stripped down version. For clarity I removed some lines that delayed all action until the sensors stabilize after power-up, resets autonomous upon disable, and a couple of other specialized routine calls like conversion from 0->254 to -127->127. The Put/Getdata calls are also brought into main.c instead of being repeated elsewhere, so User_Autonomous() is a normal routine.
Code:
void main (void)
{
#ifdef UNCHANGEABLE_DEFINITION_AREA
IFI_Initialization (); /* DO NOT CHANGE! */
#endif
User_Initialization(); /* You edit this in user_routines.c */
statusflag.NEW_SPI_DATA = 0; /* DO NOT CHANGE! */
while (1) /* This loop will repeat indefinitely. */
{
#ifdef _SIMULATOR
statusflag.NEW_SPI_DATA = 1;
#endif
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* Get fresh data from the master microprocessor. */
Process_Data_From_Master_uP(); // Modified to only handle slow loop sensor stuff
if (competition_mode) // Robot is disabled
{
Gyro(); // Initialize gyro assumes FRC is powered up only when robot is in position
}
else if (autonomous_mode) // Robot is in autonomous
{
User_Autonomous_Code();
}
else // Robot is in normal human driver mode
{
User_Driver(); // Joystick driving
}
Putdata(&txdata); /* DO NOT CHANGE! */
}
Process_Data_From_Local_IO();
} /* while (1) */
} /* END of Main */