Microchip - ATtiny204
objective - working on the ATtiny204 AVR microcontroller for PWM generation.My requirement is to achieve the PWM ON period --> 14us and OFF period --> 56us.After 600ms PWM should be ON for 600 milli second. And again PWM ON period for 14us and OFF period for 56us upto 600ms. the same procedure should be repeat.
Setup - * Wrote a TOP value to the Period register (TCAn.PER)
* Write to Compare value to the Compare register (TCAn.CMP0)
* Enable the peripheral by writing a '1' to the ENABLE bit in the Control A register (TCAn.CTRLA).The counter will start counting clock ticks according to the prescaler setting in the Clock Select bit field (CLKSEL) in TCAn.CTRLA.
* Enable Global interrupts.
* Enable the compare and overflow Interrupts.
Problem Statement - After few iteration pulses are not consistant.
note-- code Attached
Thanks in advance.