Yahoo Groups archive

AVR-Chat

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

Thread

Re: problesm with PWM

Re: problesm with PWM

2007-07-04 by kernels_nz

Hi Tom,

Sorry, I am a C programmer, so wouldnt be much help with your assembly
language, just a few things you definately want to check:

1. Have you defined the PWM pin as output ? I did a search through
your code and didnt find a reference to the DDR register ?

2. Where did you set up timer 0 ? It looks like your using the output
compare of timer0 to do the PWM. Maybe if you tell me the hex values
you assign to the registers I can look through them and see what looks
out of place / wrong.

3. The PWM works fine, everyone here has probably used it many times,
it is almost certainly just a register set up incorrectly.

Cheers
Hein B
Auckland, New Zealand.

--- In AVR-Chat@yahoogroups.com, Thomas Keller <tjkeller1@...> wrote:
>
> 
> OK.   I may not have communicated my problem very well with the post 
> that included my source code listing.  The problem is almost certainly 
> somewhere in my setup of the PWM module.  Everything else seems t be 
> working just fine (the interrupt based timing loop is interrupting, the 
> table lookup on each interrupt is occuring as it should and returning 
> the correct values, etc.)
> So what I think I need is for someone knowledgeable with the PWM
modules 
> to scan my code and see if they can tell me what I am doing wrong,
as it 
Show quoted textHide quoted text
> is almost 100% certain it is MY error, not a hardware issue.
> 
> 
> thanks in advance,
> 
> tom
>

problesm with PWM

2007-07-04 by Thomas Keller

OK.   I may not have communicated my problem very well with the post 
that included my source code listing.  The problem is almost certainly 
somewhere in my setup of the PWM module.  Everything else seems t be 
working just fine (the interrupt based timing loop is interrupting, the 
table lookup on each interrupt is occuring as it should and returning 
the correct values, etc.)
So what I think I need is for someone knowledgeable with the PWM modules 
to scan my code and see if they can tell me what I am doing wrong, as it 
is almost 100% certain it is MY error, not a hardware issue.


thanks in advance,

tom

Re: [AVR-Chat] Re: problesm with PWM

2007-07-05 by Thomas Keller

Thanks, Hein.

   OK.  I think I am getting a handle on this.  timer/counter 0 is not 
running, as est I can figure out. i am having dsome difficulty figuring 
out which bit(s) in which register I am not setting appropriately.

   Taking care of the DDRB register solved the problem of no output from 
the PWM unit, but now I am having problems with it (counter/timer0) not 
counting, at this point.  So, what I am now getting is a constant LED0 
on on the STK-500

  *groan*  I feel so stupid, I know it is right here in front of me, but 
I am not seeing it. )-:

tom
.

Re: problesm with PWM

2007-07-05 by enkitec

--- In AVR-Chat@yahoogroups.com, Thomas Keller <tjkeller1@...> wrote:
>
>   *groan*  I feel so stupid, I know it is right here in front of me,
but 
> I am not seeing it. )-:
> 
> tom
> .


I think you should make sure your ZERO register IS zero before using it.

Mark Jordan

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.