Sign In

Brightness Control

APURBA RAJBANGSHI apurbarajbangshi@gmail.com India

Hardware: ATmega 2560 Software: C Program Using Atmel Studio 7

unable to generate pwm signal.

Images

Program


#define F_CPU 16000000L
#include <avr/io.h>
#include <util/delay.h>
void TIMER0_init()
{
	int FF;
	TCCR0A=0*FF;
	OCR0A=0*FF;
	TCNT0=0*FF;
}
void init_pwm()
{
	TCCR0A|=1<<WGM01|1<<WGM00|1<<COM0A1|1<<CS00;
	

}
int main(void)
{
	int brightness=0;
	int pwm();
    /* Replace with your application code */
    while (1) 
    {
		for(brightness=0;brightness<255;brightness++)
		{
			OCR0A=brightness;
			_delay_ms(500);
    }
	for(brightness=255;brightness>0;brightness--)
	{
		OCR0A=brightness;
		_delay_ms(500);
	}
	}
}

Post a reply to APURBA RAJBANGSHI

Think you can help APURBA RAJBANGSHI ? Then post your thoughts that might help APURBA RAJBANGSHI. You will earn a lot of reputation in the technical community.

If your program is in multiple files, then ZIP the entire folder and attach below

Images and Screenshots

These helps other better understand your suggestion.