Quote:
|
Originally Posted by Phil_Lutz
Why do you need to pause the program?
For testing purposes?
If so, you can code a switch, when closed allows the code to execute, when released if stops.
Code:
if ((autonomous_mode = 0) || (AUTON_SWITCH = 1))
{
execute auton code
}
Or something like that. (I don't have my code in front of me. 
AUTO_SWITCH - is an alias to one of the O/I joystick triggers for testing only. Make sure to remove it before comp.
|
First of all, that's a logical OR. You want AND (&&).
How about this? In main.c:
Code:
while (1) /* This loop will repeat indefinitely. */
{
#ifdef _SIMULATOR
statusflag.NEW_SPI_DATA = 1;
#endif
if (!PAUSE_SWITCH)
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{ /* I'm slow! I only execute every 26.2ms because */
/* that's how fast the Master uP gives me data. */
Process_Data_From_Master_uP(); /* You edit this in user_routines.c */
if (autonomous_mode) /* DO NOT CHANGE! */
{
User_Autonomous_Code(); /* You edit this in user_routines_fast.c */
}
}
Process_Data_From_Local_IO(); /* You edit this in user_routines_fast.c */
/* I'm fast! I execute during every loop.*/
}
} /* while (1) */
Basically, if you flip the switch, the robot will finish, and then go into a
really fast loop: it does nothing until you turn it off. Be sure to but something similar in the auto.mode code: it has its own loop.