I have -guess what?- yet another problem with my ATmega16. I'm trying to use timer1 (the 16 bit timer) as 2-channel fast PWM generator.
ldi acc, 0b00000001 out TCCR1A, acc ldi acc, 0b00001001 out TCCR1B, acc
This code should be exactly what I need (no COM, I use the ISRs to switch stuff, no FOC as we are in PWM mode, WGM 5/0101 (8 bit fast PWM), no prescalers for now) but the counter counts up to 255 and then counts back down which it shouldn't be doing. We're not in phase correct mode after all.
Has my brain left? I seem to be too blind to find the error... I tried all 16 possible modes for WGM but the counter either counts up AND down or it counts up further than 255. Again, I use the not-too-reliable AVR Studio 4.13 simulator as the hardware doesn't do what it's supposed to be doing and I can't watch a million instructions per second in real-time.