# Simple Timer code in ATmega16 not outputting on OC0 pin in PROTEUS emulation software

#### JPjuice23

Joined Mar 23, 2013
1
This is the code,
Code:
.org 0
rjmp start
.org $30 start: LDI r16,$04
OUT SPH, r16
LDI r16, $5F OUT SPL, r16 //setup cbi DDRB, 0 sbi DDRB, 3 ldi r20, 3 out ocr0, r20 ldi r20, 0 out tcnt0, r20 ldi r20,$56
out tccr0, r20

here: rjmp here
And this is a picture of the schematic, emulated on Proteus 8 Pro.

I don't understand why the output at pin 4 is automatically high, when I set it up to only be high when the OCR0 meets the TCNT0, which goes up when I press the button. (CS = 110, means external pin is clock) It's high no matter what.

Some more things, TCNT0 is \$56, or 0101 0110
CS is 110, meaning external clock PB0 is used
WGM is 01, which is CTC, clear timer on compare match
COM is 01, which will toggle on compare match.

I don't understand if the problem is ME, my code, or the program. Thanks for your time.