Hi,
I'm new into assembly and I need to generate in PWM, phase correct mode signal with frequency 255 Hz and FF 55 % but I have problem with Atmega328 - you can see in the screen what is wrong. But what's more - my code works for Atmega32. It looks like I use some kind of bad instruction, but I've no idea what exactly is wrong. Do you have any idea what's wrong?
.include"m328def.inc"
SBI DDRB, 3
LDI R16, 140 // Fill factor 140/255 = 55%
OUT OCR2A, R16
LDI R17, 0b00000001 //PWM PC
out TCCR2A, R17
LDI R18, 0b00000101 //prescaler 128
out TCCR2B, R17
loop:
rjmp loop