Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Re: PWM for reversible DC motors

2006-08-27 by dlc

The enable is where the PWM goes, the IN1 and IN2 determine motor 
direction.  It says that it is crossover protected so you don't need to 
worry about turning on both FETs in either leg - I didn't look too 
closely, but I assume that if both are set the same (low or high) then 
either coast or brake is assumed to occur.  Read the data sheet 
carefully for choices in the bootstrap caps.  I noticed that one circuit 
even had a snubber across the motor, that is a good idea too.  The data 
sheet is quite descriptive (and about 7MB!) so all your questions can be 
answered there.

You need to confer with your documents on your compiler as to how to set 
an IO line to be input or output.  In the AVR there are Data Direction 
Registers, for instance DDRA is the data direction register for the A 
port.  Any bit set to 1 sets that IO line to be an output, a 0 an input.

have fun,
DLC

katraven1 wrote:
> thx for that help =)
> 
> *feeling very n00b...
> 
> jst wanna confirm:
> we're using an L6203 for each H-bridge, which has 1 enable and 2 
> inputs. Am i right to say that the two inputs change the direction 
> of the motor?
> as in, if i put the PWM into input1, it'll go one way and vice versa 
> if i put it into input2? I can't seem to find a good ref which has 
> this explained clearly...
> 
> and, if this is the case.. how could I configure the other ports to 
> change the direction?
> 
> --- In AVR-Chat@yahoogroups.com, dlc <dlc@...> wrote:
> 
>>The Mega32 has two PWM channels (OC's) that you should use for 
> 
> motor 
> 
>>speed.  Use one or two of the other IO lines per H-bridge to 
> 
> select the 
> 
>>direction.
>>
>>DLC
>>
>>katraven1 wrote:
>>
>>>we have an ATmega32 connected to 2 H-bridge circuits for 2 DC 
> 
> motors 
> 
>>>which need to be reversible..
>>>
>>>we're using timer1 to generate our pwm signal and my idea was to 
> 
> use 
> 
>>>one or the other of the OC1 pins to change direction.
>>>
>>>would there be a better method of doing this? using my current 
>>>thinking, the wheels would only be able to work in pairs but not 
>>>independently...
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> 
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>> 
>>>
>>>
>>>
>>
>>-- 
>>-------------------------------------------------
>>Dennis Clark          TTT Enterprises
>>www.techtoystoday.com
>>-------------------------------------------------
>>
> 
> 
> 
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 

-- 
-------------------------------------------------
Dennis Clark          TTT Enterprises
www.techtoystoday.com
-------------------------------------------------

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.