ok, here is where teleDirection is both declared and initialzed, right at the top of user_routines.c:
Code:
/*** DEFINE USER VARIABLES AND INITIALIZE THEM HERE ***/
/* EXAMPLES: (see MPLAB C18 User's Guide, p.9 for all types)
unsigned char wheel_revolutions = 0; (can vary from 0 to 255)
unsigned int delay_count = 7; (can vary from 0 to 65,535)
int angle_deviation = 142; (can vary from -32,768 to 32,767)
unsigned long very_big_counter = 0; (can vary from 0 to 4,294,967,295)
*/
unsigned int armPosition = 0; /*arm position read from pot*/
/*---bunch of variables deleted for readability in this post---*/
unsigned int armErrorLast = 0; /* armError last time through */
unsigned int teleDirection = 0; /* telescope last direction moved - 0=down */
and here is where its explicitly initialized with the rest of the variables in user_rountine.c:
Code:
/* FIFTH: Set your PWM output types for PWM OUTPUTS 13-16.
/* Choose from these parameters for PWM 13-16 respectively: */
/* IFI_PWM - Standard IFI PWM output generated with Generate_Pwms(...) */
/* USER_CCP - User can use PWM pin as digital I/O or CCP pin. */
Setup_PWM_Output_Type(IFI_PWM,IFI_PWM,IFI_PWM,IFI_PWM);
/* Add any other initialization code here. */
/*578 initialize drivermode & autonmode variables */
armPosition = 0; /*arm position read from pot*/
gyroData = 0; /*signal read from yaw rate sensor*/
/*more variable deleted for readability in this post*/
teleDirection = 0; /* telescope last direction moved - 0=down */
if we used different values the problem would still be the same - the only place in the code where the variable can be changed is where I pointed out above, so whatever value we use for up or down, the SW cant tell if the switch inputs from the OI are valid or some sort of OI power up mess?