Fast PWM
2007-07-14 by vidord
Hi Guys, I started a new project with an ATmega88, and I need two fast-PWM signals. One it will be an inverted signal of the other signal. I wrote the code, but when I simulate it on AVRStudio, I don't get out any signal. Did I missed something? Here comes the code: .include "m88def.inc" ;============================ ;Declarations: .def temp=r16 ;============================ ;Start of program: rjmp Init Init: ;===================== ;Port B initialization ;--------------------- ldi temp, 0x00 out PORTB, temp ldi temp, 0x08 out DDRB, temp ;===================== ;Port D initialization ;--------------------- clr temp out PORTD, temp ldi temp, 0x08 out DDRD, temp ;============================== ;Timer/Counter 2 initialization ;------------------------------ ;Clock source: System Clock ;Clock value: 14745,600 kHz ;Mode: Fast PWM top=OCR2A ;OC2A output: Non-Inverted PWM ;OC2B output: Inverted PWM ldi temp, 0xB3 sts TCCR2A, temp ldi temp, 0x09 sts TCCR2B, temp ldi temp, 0x00 sts TCNT2, temp ldi temp, 0x7F sts OCR2A, temp ldi temp, 0x7F sts OCR2B, temp ;===================== ;Main body of program ;-------------------- Start: ;<Write program here> rjmp Start ;loops back to Sart