Yahoo Groups archive

AVR-Chat

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

Message

*sigh*

2007-07-05 by Thomas Keller

Alright.   I am monitoring the control register (OCR0) and it is getting 
the appropriate values to cause the PWM unit to dim the LED, but the LED 
is staying brightly lit, at 100% all the time.   In the simulator, you 
cannot see the PWM output, but by watching the various registers, it 
appears to be working, except that on an actual AT90S8515, the LED never 
dims.   Am I missing something in the PWM setup?

PWM initialization code
;-----------------------------------------------------------------------------
;    initialize counters, PWM module
;

    ldi        TEMP,        0x03            ; enable timer and compare 
match register
    out       TIMSK,      TEMP         ; and store to appropriate register
    ldi        TEMP,        0x0d            ; set up timer prescaler
    out        TCCR0,    TEMP          ; output to correct register



PWM access code:
;-----------------------------------------------------------------------------
;    PWM interrupt handler
;

PWM_Handler:

    rcall    EERead                    ; go read the EEPROM data for 
this angle
    out     OCR0,    TEMP        ; output to PWM controller
    in        r27,    OCR0            ; take a peek at the PWM control 
register and siplay for debugging

    ret                                        ; all done, go home

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.