Yahoo Groups archive

AVR-Chat

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

Thread

Timer 1 PWM Esoterica

Timer 1 PWM Esoterica

2006-03-14 by Dave VanHorn

Is there any easy way to stop timer 1 in PWM mode, with the output pin 
high?

I'm using OC1B to generate an output with 100% - 0% duty cycle.

I realize that I could turn off PWM mode entirely, returning the pin to 
a straight I/O.

I could make the turn-off conditional on getting a 0 on the pin 
register, but I'm a little creeped out by that, as it might not always 
dependably read a 1 or 0


What I'm trying to avoid is adding two more states, as "starting up" 
and "shutting down" to my existing "running" and "not running".

RE: [AVR-Chat] Timer 1 PWM Esoterica

2006-03-14 by Chuck Hackett

> From: Dave VanHorn
> 
> Is there any easy way to stop timer 1 in PWM mode, with the output pin
> high?
> 
> I'm using OC1B to generate an output with 100% - 0% duty cycle.
> 
> I realize that I could turn off PWM mode entirely, returning the pin to
> a straight I/O.
> 
> I could make the turn-off conditional on getting a 0 on the pin
> register, but I'm a little creeped out by that, as it might not always
> dependably read a 1 or 0

Not sure I understand completely (I have not done PWM on an AVR yet) but:

1) At 'idle' times can you just leave the PWM at 100% (i.e.: pin is solid 1)?

2) If, when disabled, the PWM pin reliably goes to 0 you could just run the pin
thru an inverter and use a duty cycle of 0 - 100% rather than 100% - 0%

... but, since I haven't used PWM yet, there's probably something I don't
realize that is getting in the way.

Cheers,

Chuck Hackett
"Good judgment comes from experience, experience comes from bad judgment"
7.5" gauge Union Pacific Northern (4-8-4) 844
http://www.whitetrout.net/Chuck

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.