Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

Project Request

Return
dinusha kothalawala
dinusha

posted on 2015/03/07 05:21:45 AM CET

Audio & Speech

50 hz pwm atmega 16

i want to simple 50hz code for atmega 16
without library alredy i have code but it not wirking

void main()
{
//Configure TIMER1
TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11); //NON Inverted PWM
TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10); //PRESCALER=64 MODE 14(FAST PWM)

ICR1=4999; //fPWM=50Hz (Period = 20ms Standard).

DDRD|=(1<<PD4)|(1<<PD5); //PWM Pins as Out

while(1)
{

OCR1A=97; //0 degree
Wait();



}