View Single Post
Old 01-15-2009, 09:22 AM   #202 (permalink)
Master EcoModder
Join Date: Jun 2008
Location: London, Ontario
Posts: 1,096

2k2Prot5 - '02 Mazda Protege5
90 day: 33.82 mpg (US)
Thanks: 0
Thanked 12 Times in 9 Posts
Paul, do you have any concept of how fast your main loop is running? Are you using an RTOS (i'm guessing not) or a tick timer make decisions, or just full-speed main looping it?

Do this test for us... at the bottom of your main loop, just toggle an output pin - that would compile into a single asm line so it won't slow down the loop at all, and see what that signal looks like on your scope. I'm used to running 32-bit 80MHz microcontrollers, and with main loops that are controling a dozen periferals and serial com and they are BLAZING fast (in the realm of microseconds).

Something i'd like to suggest (i'd do it for you, but i've got a busy day ahead of me and i shouldn't be posting on forums... oops) have a look at the datasheets for your processor and see if you can pair up PWM channels to create a 16-bit pwm count. That would change your resolution from 0-255 to 0-16k and allow you must neater current control. If at 0 speed you can go from half max current at 1 to over max current at 2, i think you need more resolution. If i build one, i'm definately going to find a processor with a 16-bit pwm for this reason.
  Reply With Quote