Subject:
|
Re: motor routines in lib_hb.c
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Tue, 15 Apr 1997 00:59:06 GMT
|
Original-From:
|
Chuck McManis <CMCMANIS@nomorespamNETCOM.COM>
|
Reply-To:
|
cmcmanis@netcom.com!nomorespam!
|
Viewed:
|
1404 times
|
| |
| |
Rajesh Gottlieb wrote:
> Does anyone know why these eight speeds were chosen in lib_hb.c for the
> motors and what would happen if the code were re-written to allow any
> speed between 0 and 255?
> 0b00000000, 0b00010001, 0b01001001, 0b01010101,
> 0b01010111, 0b01110111, 0b01111111, 0b11111111
Think of them as repeating binary waveforms (they are clocked
out the 'enable' pin of the motor chip at 1Khz) so on an
oscilloscope speed 2 (third entry) would appear..
time -> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 (in mS)
Vmotor : +--+ +--+ +--+ +--+ +--+ +
| | | | | | | | | | |
Ground : ---+ +-----+ +-----+ +--+ +-----+ +-----+
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | | |
Bit # 7 6 5 4 3 2 1 0 7 (repeats)
So you see each bit is shifted out serially (1 per millesecond)
and the resulting wave form is fed to the H-bridge. You can
calculate the power setting of the motor by computing the RMS
power component.
The bits should be chosen to provide 8 different power settings
that approximate a linear response in the motors. Using all
possible values would waste space a many (for example 0b11110000
and 00001111) are simply complements of each other and yield
the same power output to the motor (but you might assume that
speed "15" and speed "240" would be different)
Hope that helps,
--Chuck
--
cmcmanis@netcom.com http://www.professionals.com/~cmcmanis
All opinions in the non-included text above are the sole opinions of
the author.
|
|
Message is in Reply To:
| | motor routines in lib_hb.c
|
| Does anyone know why these eight speeds were chosen in lib_hb.c for the motors and what would happen if the code were re-written to allow any speed between 0 and 255? int _speed_table[]= { 0b00000000, /* speed 0 */ 0b00010001, 0b01001001, (...) (27 years ago, 14-Apr-97, to lugnet.robotics.handyboard)
|
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|