View Single Post
  #1   Spotlight this post!  
Unread 24-01-2004, 18:03
LoyolaCubs LoyolaCubs is offline
Registered User
#1453
 
Join Date: Jan 2004
Location: Los Angeles
Posts: 3
LoyolaCubs is an unknown quantity at this point
Angry problems assigning unsigned chars in FRC Code

Whenever I assign variables (including competition_mode, autonomous_mode, pwm01, and pwm02), the variable values turn into 256x whatever I assigned. For instance, if I give pwm01 the value 127, the value returned after I use a printf command is 32512. Here is my code in my Stop function (located in the User_Autonomous_Code function):

void Stop (int counter1) // Drive forward until counter reaches zero
{
while( counter1 > 0 )
{
counter1--;
pwm01 = 127;
printf("pwm01: %d\n", pwm01);
pwm02 = 127;
printf("pwm02: %d\n", pwm02);
printf("should be stopped \n");
printf("counter1: %d\n", counter1);
}
}

Anyone have a similar problem or know how to fix it?