View Single Post
  #1   Spotlight this post!  
Unread 02-11-2006, 03:33
cdennisxlx2's Avatar
cdennisxlx2 cdennisxlx2 is offline
Team San Diego Web Liaison
AKA: Cameron Dennis
FRC #1266 (The Devil Duckies)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: San Diego
Posts: 188
cdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to beholdcdennisxlx2 is a splendid one to behold
!HELP! IM STUCK IN A SUBROUTINE!!! !HELP!

Im developing a set of subroutines to make it easyer for my teams programmers. But when i tried to show them how to call them it calls the first one and stays.

example: From user_routines_fast.c

This is the autonomous code i made to test calling subroutines [line: 141]
Code:
/*******Autonomy Notes*********************
* "time" was initalized on line 24
* relay1_fwd/rev = Bottom Cylinder
* relay3_fwd/rev = Top Cylinder
*	    pwm01 = Left Drive motor
*           pwm02 = Right Drive motor
*           pwm03 = Shooter
*           pwm04 = Tilt
*	  26 loops = One Second (roughly)
****************************************/		
                 
if (time >= 0 && time < 50)
{	
	Left();
}
else if (time > 50 && time < 100)
{
	Stop();
}
else if (time > 100 && time < 150)
{ 
	Right();
}
else if (time > 150)
{
	pwm01 = pwm02 = 127;
}
time++;  //Incriment time

These are the subroutines [line: 290 in user_routines_fast.c]
Code:
unsigned char Left()
{
	pwm01 = 0;
	pwm02 = 254;
	return 0;	
}

unsigned char Right()
{
	pwm01 = 254;
	pwm02 = 0;
	return 0;	
}

unsigned char Stop()
{
	pwm01 = pwm02 = 127;
	return 0;
}

The FUNCTION PROTOTYPES for the subroutines in user_routines.h
Code:
unsigned char Left(void);
unsigned char Right(void);
unsigned char Stop(void);

Can anyone tell me why when i run this it stays in Left()??????????


thank you in advanced
__________________
Team San Diego Robotics Web Liaison
Webmaster and Technical Advisor for the San Diego Regional Planning Committee.
Official Score Keeper for the San Diego Regional
www.sandiegoregional.com
www.frc1266.com