DPRG
DPRG List  



DPRG: Strategy

Subject: DPRG: Strategy
From: Eric B. Olsen robojoc at worldnet.att.net
Date: Wed Jul 30 22:09:54 CDT 1997

Jay Couture wrote:
> 
> Hello all,
> 
>         I would like some feedback as to some a strategy I should use with the
> following setup:
> 
> I am using a power window motor (per side that is) which is being speed
> controlled via PWM from an HC11. The PWM is that same code from Chap 10 in
> the Ref Manual. It works great. Now I've added a shaft encoder with 1000
> pulses per revolution! Way more accurate then I really need.
> 
> I have thought about running the output of the shaft encoder through a
> binary counter. I would then pull the signal from the MSB into my pulse
> counting interrupt routine. Any comments on this?
> 
> Should I even bother? Another strategy I have imagined is using the RTI to
> cycle through my subroutines and poll the count on every RTI. This way I
> wouldn't have to worry about counter overflows, and so I could forego the
> binary counter scheme. Comments?
> 
> Right now, the only reason for the shaft encoders is to make sure the
> wheels are spinning at the same speed when the forward command is given.
> 
> Thanks for you time, Jay

Jay,

I like your second suggestion.  If I understand you correctly, you can
measure the time interval between pulses generated by the encoder.

Because your encoder gives 1000 pulses per revolution, you can expect a
one millisecond pulse rate at the slow speed of one revolution per
second.  If this is also your wheel speed, you'll expect a pulse every
200us at five revolutions per second ... a moderate speed for your
robot, but possibly too fast to want to keep up with using interrupts. 
Thus, I would suggest you divide down the number of pulses per second
generated so that you have an acceptable interrupt rate at your highest
robot speed (say every millisecond), and use your timer to measure the
time duration between pulses.

The reason this technique is valuable is that you get a very accurate
(instantaneous) wheel rate, and this rate is updated very frequently.  I
haven't seen the note in chapter 10, but I hope this makes sense!

Eric Olsen
Las Vegas NV

------------------------------

More information about the DPRG mailing list