RaiderRev
22-01-2008, 16:19
This competition is our teams first attempt at programming and we have been having some trouble generating any kind of PWM output. Right now we have a test area set up with the general electronics hooked up (2008 FRC robot controller, Victor, Motor, circuit berakers, etc..). We made sure to check the connections and everything has power. We also have the default code we are working with as well as the Kevin Watson's PWM code.
The only thing we are trying to do code wise so far is generate some type of output on any of the PWMs. Right now the only code that we have is in the user_routines.c, Process_Data_From_Master_uP(void) method and we are trying to get the motor connected to PWM13 to do a full reverse. We have tried other PWMs as well but it still doesnt have any effect.
void Process_Data_From_Master_uP(void)
{
static unsigned char i;
Getdata(&rxdata); /* Get fresh data from the master microprocessor. */
//Default_Routine(); /* Optional. See below. */
/* Add your own code here. (a printf will not be displayed when connected to the breaker panel unless a Y cable is used) */
//printf("Port1 Y %3d, X %3d, Fire %d, Top %d\r",pwm01,pwm05,p1_sw_trig,p1_sw_top); /* printf EXAMPLE */
printf("In User Mode");
pwm13 = 0;
printf("Set pwm13 to 0");
PWM(pwm13,pwm14,pwm15,pwm16);
/* Example code to check if a breaker was ever tripped. */
if (aBreakerWasTripped)
{
for (i=1;i<29;i++)
{
if (Breaker_Tripped(i))
User_Byte1 = i; /* Update the last breaker tripped on User_Byte1 (to demonstrate the use of a user byte)
Normally, you do something else if a breaker got tripped (ex: limit a PWM output) */
}
}
Putdata(&txdata); /* DO NOT CHANGE! */
}
The only thing we are trying to do code wise so far is generate some type of output on any of the PWMs. Right now the only code that we have is in the user_routines.c, Process_Data_From_Master_uP(void) method and we are trying to get the motor connected to PWM13 to do a full reverse. We have tried other PWMs as well but it still doesnt have any effect.
void Process_Data_From_Master_uP(void)
{
static unsigned char i;
Getdata(&rxdata); /* Get fresh data from the master microprocessor. */
//Default_Routine(); /* Optional. See below. */
/* Add your own code here. (a printf will not be displayed when connected to the breaker panel unless a Y cable is used) */
//printf("Port1 Y %3d, X %3d, Fire %d, Top %d\r",pwm01,pwm05,p1_sw_trig,p1_sw_top); /* printf EXAMPLE */
printf("In User Mode");
pwm13 = 0;
printf("Set pwm13 to 0");
PWM(pwm13,pwm14,pwm15,pwm16);
/* Example code to check if a breaker was ever tripped. */
if (aBreakerWasTripped)
{
for (i=1;i<29;i++)
{
if (Breaker_Tripped(i))
User_Byte1 = i; /* Update the last breaker tripped on User_Byte1 (to demonstrate the use of a user byte)
Normally, you do something else if a breaker got tripped (ex: limit a PWM output) */
}
}
Putdata(&txdata); /* DO NOT CHANGE! */
}