What am I doing wrong?
TCCR1A 10000010
bits 7,6: Clear OC1A/OC1B on Compare Match, set OC1A/OC1B at TOP
bits 1,0: WGM11,WGM10
TCCR1B 00011001
bits 4,3: WGM13,WGM12 ;WGM mode 14 selected
bits 2,1,0: system clock, no prescaler
TCCR1C 00000000
no timer interrupts used.
ICR1 0x0500 (TOP)
The timer is expected to count from 0x0000 to 0x0500 then clear to 0x0000 and count up again and so on.
OCR1A is set to 0x005D. The output pin is supposed to go LOW when the counter reaches the OCR1A value and HIGH when it reaches the TOP.
Prototype not working. :(
Simulation with AVRStudio4 4.14 build 589 is showing
Compare output mode 1A 0x02 (correct)
Compare output mode 1B 0x00 (correct; not using B)
Pulse width modulator select 0x02 (correct?; WGM11,WGM10)
Waveform generation mode 0x03 (correct?; WGM13,WGM12)
However, it is counting UP till it reaches 0x01FF, then it starts counting DOWN. This seems to correspond to WGM mode 02 instead of the selected WGM mode 14. :?: :(
[EDIT] Made description clearer ('down' replaced with 'clear'). :oops: