
26-02-2004, 13:39
|
 |
La Caņada High School
 FRC #2429
Team Role: Mentor
|
|
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
|
|
|
Re: PWM problem in autonomous
Quote:
|
Originally Posted by Warren Boudreau
We found that if your motors are on PWMs 13-16 and you have more than one interrupt, the PWMs lose signal (blinking orange light on speed controllers) when both interrupts trip. Don't know why, but we moved the motors to PWMs 9-12 and the problem went away.
|
From the infrared beacon and tracking FAQ:
Q: I merged the code from the tracker codebase into my code for non-autonomous driving, including dropping the replacement user_routines_fast.c in place of the default one, and things got weird. The trackers would run okay, but the motors, connected to PWM 13 and PWM 15, started running and stopping with a jerking motion. Having read that there is something different about PWMs 13 through 16, I connected my motors to PWM 10 and PWM 11, turned all the tracking code back on, and everything worked nicely! Can you tell me why changing the motors from 13 and 15 to 10 and 11 changed the behavior from erratic to normal? What's going on here?
A: PWMs 13 through 16 are different because they're controlled by the user processor. I saw the wacky behavior you described while developing the receiver and tracking code. The problem isn't with my code (as far as I know). The IFI folks know about this and wrote it up.
Q: We're seeing wacky behavior like that described above, but we're not using PWMs 13 through 16. What's up?
A: Your interrupt handler(s) might not be saving enough context information. I altered the code to be more conservative in this regard. Get the latest version of the code or just alter the #pragma interruptlow line in user_routines_fast.c to look like this:
#pragma interruptlow InterruptHandlerLow save=PROD,section("MATH_DATA"),section(".tmpdata")
If this change causes problems for you (e.g. your encoders stop working correctly), there are other options that you can try. Read section 2.9.2 of the PIC18 compiler user's guide for more information.
-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
|