I'm writing Arduino UNO (=ATMega328P-PU) programs in assembly to save memory, so I use avra.exe (same as atmel studio's avrasm32) to compile and avrdude to upload, and simple programs like blinking run fine. But now i tried to half-bright a LED with pwm. I checked up my code for errors but I didn't find any, but the LED just full brighs. I checked wiring too. Here's my pwm.asm code:
.nolist
.include "m328pdef.inc"
.list
.cseg
.org 0x00
rjmp start
.org 0x34
start: sbi ddrb, 5 ;pin 13
sbi portb, 5 ;pin 13 on, just to compare with the PWMed led
sbi ddrd, 5 ;pin 5 pwm
ldi r16, 0b00100011 ;fast pwm mode, non inverted pwm at oc0b = pin 5
out tccr0a, r16 ;I'm using Timer0
ldi r16, 0b00000001 ;no prescaler
out tccr0b, r16
ldi r16, 128 ; duty cycle = 50%
out ocr0b, r16
loop: rjmp loop
I tried to change duty cycle value but nothing changes.