Re: Need Advice on PWM and other stuff
- From: Bob Smith <bsmith@xxxxxxxxxxxxx>
- Date: Sat, 26 May 2007 21:09:41 -0700
Joe wrote:
On May 26, 3:06 pm, Bob Smith <bsm...@xxxxxxxxxxxxx> wrote:Sorry, the "(2)" was *supposed* to be "(s)" indicating moreSince you have an AVR, you might want to replace the 555
with a pin(2) from the AVR. Depending on which AVR you have
you may already have a couple of PWM counters on board.
Even if you don't have the PWM counters you can build one
easily enough with a timer interrupt.
Hello Bob,
Yes, a very kind offer. Just one pin?
than one pin. You'll probably want, per motor, one pin for
the PWM output and one pin for the direction.
I would love to use the avr, butI sit at a Linux desktop and really like the AVR since you can
I don't know how, even after reading the dox. I am going to have one
micro whose sole function will be to control the motors and steering
(and, at first, will have to decode the signals from my RC and timeout
when it stops receiving the once every 18ms pulse that the transmitter
generates when it is on, just a safety precaution in case the thing's
running full tilt and my RC transmitter batteries go dead, or it goes
out of range). I will add micros later for sensors, navigation, etc.
as needed.
program it using gcc. The site that got me going on this was: http://www.linuxfocus.org/English/March2002/article231.shtml
Some AVR books to consider are: John Morton's "AVR, An Introductory
Course", and Dhananjav Gadre's "Programming and Customizing the AVR
Microcontroller".
I have in my possession the following:All of the above are good and have enough PWM channels that you
ATTiny 2313 (I know that has 4 PWMs aboard), but limited memory
ATMega 8515, my favorite
ATMega8535, because of the A/D's. I haven't used this one yet.
Bascom full version programming language. 1.1.83
STK 500 programmer.
I cannot seem to wrap my head around how to use the timers for PWM and
get a timeout if needed also. Being more inclined to hardware, I
thought I would use a separate PWM (which probably sounds insane).
Anyway, suggestions on which micro would be the best to use
don't need to use a timer interrupt. I use the ATMega8 in the
28 pin DIP. It is easy work with since I wire-wrap most of my
projects. (See my hobby web site at: http://www.linuxtoys.org)
and, IfThe basic idea is the same for both a hardware and a software
possible, I would like to control each motor with its own PWM so I can
slow down instead of stopping one of them to make a turn.
Now, if it so happens that you don't use Bascom, then a flow chart
(antiquated term, I know), or description of which pins I have to
use, details, details, and I can probly figure out how to code it
myself in Bascom.
implementation. You have a free running counter with the number
of bits of your desired resolution. For 8 bit resolution you
need an 8 bit counter. Set up a timer interrupt and increment
the counter on each interrupt. If the new count is zero, set
the PWM output high. The terminal count is the PWM width times
the resolution. So if you wanted a one-quarter width PWM output,
the terminal count would be 64. If the new count is equal the
terminal count, set the PWM output pin low. There are other
considerations but this is the basic idea.
hope this helps
Bob
.
- Follow-Ups:
- Re: Need Advice on PWM and other stuff
- From: Joe
- Re: Need Advice on PWM and other stuff
- References:
- Need Advice on PWM and other stuff
- From: Joe
- Re: Need Advice on PWM and other stuff
- From: Bob Smith
- Re: Need Advice on PWM and other stuff
- From: Joe
- Need Advice on PWM and other stuff
- Prev by Date: Re: Microcontroller options
- Next by Date: Re: help on 10 wire stepper motor
- Previous by thread: Re: Need Advice on PWM and other stuff
- Next by thread: Re: Need Advice on PWM and other stuff
- Index(es):
Relevant Pages
|