Docsity

PWM Generation Modes: Fast PWM and Phase Correct PWM in ATmega32, Slides of Microprocessor and Assembly Language Programming

Partial preview of the text

Download PWM Generation Modes: Fast PWM and Phase Correct PWM in ATmega32 and more Slides Microprocessor and Assembly Language Programming in PDF only on Docsity!

PWM Generation

PWM Modes

  • (^) ATmega32 has three timers which can be used as wave generation on their dedicated pins
  • (^) There are two basic PWM modes:
  1. Fast PWM
  2. Phase Correct PWM.

Non-Inverted Fast PWM mode

  • (^) On compare match, OC0(PB3) pin clears and upon Top (0xFF) of TCNT0, OC0 pin sets
  • (^) Set COM01 bit & Fast PWM Mode in TCCR0 register

Inverted Fast PWM mode

  • (^) On compare match, OC0 pins sets and upon Top (0xFF) of TCNT0, OC pin clears
  • (^) Set COM01, COM00 bits & Fast PWM Mode in TCCR0 register

Non-Inverted Phase Correct

Mode

  • (^) OC0 ( PB3 ) pin is cleared ( LOW ) when compare match occurs while TCNT0 is counting upward and set ( HIGH) OC0 ( PB3 ) pin when compare match occurs while TCNT0 is counting downward
  • Set COM01 bit & Phase Correct Mode in TCCR0 register
  • (^) 0

Inverted Phase Correct PWM

  • (^) OC0 (PB3) pin is set ( HIGH) when compare match occurs while TCNT0 is counting upward and cleared ( LOW ) OC0 (PB3) pin when compare match occurs while TCNT0 is counting downward
  • Set COM01, COM00 bits & Phase Correct Mode in TCCR0 register
  • (^0)

Phase Correct PWM Frequency

  • (^) The PWM frequency for the output when using phase correct PWM can be calculated by the following equation: