ATMega_2560_Embedded_THT/PWM_Module/Fast_PWM__8bit
Tanish25 63bd4b3f03 adding files 2022-10-04 18:52:43 +05:30
..
Makefile adding files 2022-10-04 18:52:43 +05:30
main.c adding files 2022-10-04 18:52:43 +05:30
main.elf adding files 2022-10-04 18:52:43 +05:30
main.hex adding files 2022-10-04 18:52:43 +05:30
main.o adding files 2022-10-04 18:52:43 +05:30
readme.txt adding files 2022-10-04 18:52:43 +05:30

readme.txt

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Registers involved:

GPIO:
DDRB: Data Direction Register for Port B= 0xFF for output


PWM Module:
OCR0A: Output Compare Register A=Value here is compared with the Timer value,and when the value matches, the specific pin[pin OC0A(pin 13) in this case] gets toggled

TCCR0A: Timer/Counter 0 Control Register A = 0x83
Bit [7:6]= COM0A-Compare Output Mode A = 10-Non-inverting PWM-Clear OC0A on Compare Match
Bit [1:0]= WGM[1:0]- Waveform Generation Mode=11- for non-inverting fast PWM.

TCCR0B: Timer/Counter 0 Control Register B = 0x03
Bit [2:0]  CS0[2:0]-Clock Select = 011- for prescaler=64 in order to obtain frequency of 1kHz