nzkunal
Member level 2
Hi,
I am trying to write some code to generate a fast PWM signal (8-bit Timer). I am using an Atmel ATMEGA48 and for simplicity have chosen port D6 that corresponds to OCR0A.
I have read the data sheet and am trying to figure out what code I need to operate this channel.
Initialization
TCCR0A=ox83 so COM0A=2 for non-inverting and WGM0[2:0]=3 for TOP=MAX
Is this the only initialization I need to perform
Controlling duty cycle
Change OCR0A i.e. if OCR0A=0x7F will give 50% duty cycle
Does this code look correct?
Thanks
I am trying to write some code to generate a fast PWM signal (8-bit Timer). I am using an Atmel ATMEGA48 and for simplicity have chosen port D6 that corresponds to OCR0A.
I have read the data sheet and am trying to figure out what code I need to operate this channel.
Initialization
TCCR0A=ox83 so COM0A=2 for non-inverting and WGM0[2:0]=3 for TOP=MAX
Is this the only initialization I need to perform
Controlling duty cycle
Change OCR0A i.e. if OCR0A=0x7F will give 50% duty cycle
Does this code look correct?
Thanks