I have found a work around but can't understand why this isn't working the way I think it should(...maybe because it's working the way it was design to work;-). Using AVR Studio and atmega88PA
; initialize timerCounter0 ldi temp, (1<<wgm01)|(1<<oc0a1) ; clear oc0a1 on compare match, ctc mode out tccr0a, temp ldi temp, (1<<cs00) ; no prescale on clock out tccr0b, temp ldi temp, 92 ; about 5 microseconds at 18.432 MHz out ocr0a, temp ;sei ; enable global interupts prime: ldi temp, (1<<pd6) out ddrd, temp sbi portd, 6 main: rjmp main
I would think that portd pin6 would go high and after the compare match it would go low but "sbi portd, 6" has no affect in this mode. If I set it high before initializing the timer it get's cleared after the timer is initialized. I have tried to simulate it using AVR Simulator 2 and have slowed it down with a prescale of 1024 to see if it works on the STK500 when hooked to an LED (added more code to make it flash) but the I can't seem to get the OCOA pin to go high using this timer mode.