Yahoo Groups archive

AVR-Chat

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

Thread

PWM problem

PWM problem

2007-10-10 by Thomas Keller

OK, one guy wrote back and said it wasn't possible, but I don't think 
that's
correct, because the PWM can also trigger interrupts.  Again:

   I need to drive more than 20 mA to an LED being PWMed by an ATtiny25.
I want to use the PWM module on timer/counter0 to drive an interrupt
routine that sets and clears, as appropriate, a pair of GPIOs driving my 
LED
to ~~30-35 mA.  ( I really don't have the physical room in my 
environment for
one more transistor, very very tight environment)

   Problem is, the data sheet material on this particular issue has me 
confused,
not clear on what I should be doing.  Any help?

tom

Re: [AVR-Chat] PWM problem

2007-10-10 by David VanHorn

Trigger the int, and in the int, set and clear the bits you want.

But know this:  The output current you'll get is quite variable chip
to chip, and batch to batch. Those limits on current in the data sheet
are not guaranteeing any sort of regulation, they are "do not exceed"
numbers, at least in that if exceeded, the port won't be able to hold
the specified voltages for 1 and 0 states.

Re: [AVR-Chat] PWM problem

2007-10-10 by dlc

You wouldn't use PWM to do that, you'd simply use the timer to fire the 
ISR at the resolution you want.  For instance, if you want a 1KHz PWM 
and you want an 8 bit resolution then you'd need to set your timer to 
interrupt every (1ms/256).  Turn the LED on at the beginning of the 
cycle and off when you reach the count for the on-time you want.

DLC

Thomas Keller wrote:
>    OK, one guy wrote back and said it wasn't possible, but I don't think 
> that's
> correct, because the PWM can also trigger interrupts.  Again:
> 
>    I need to drive more than 20 mA to an LED being PWMed by an ATtiny25.
> I want to use the PWM module on timer/counter0 to drive an interrupt
> routine that sets and clears, as appropriate, a pair of GPIOs driving my 
> LED
> to ~~30-35 mA.  ( I really don't have the physical room in my 
> environment for
> one more transistor, very very tight environment)
> 
>    Problem is, the data sheet material on this particular issue has me 
> confused,
> not clear on what I should be doing.  Any help?
> 
> tom
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 

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

Re: [AVR-Chat] PWM problem

2007-10-10 by dlc

However, if you parallel the outputs you should be safe.  The Atmel 
parts are CMOS outputs, not bipolar so they have a negative temp. 
coefficient.  To be the most repeatable I would sink the current and not 
source it.

DLC

David VanHorn wrote:
> Trigger the int, and in the int, set and clear the bits you want.
> 
> But know this:  The output current you'll get is quite variable chip
> to chip, and batch to batch. Those limits on current in the data sheet
> are not guaranteeing any sort of regulation, they are "do not exceed"
> numbers, at least in that if exceeded, the port won't be able to hold
> the specified voltages for 1 and 0 states.
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 

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

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.