/* * PWM.c * * Created: 11.4.2014 7:55:30 * Author: maticpi */ #include void Init(); int main(void) { Init(); OCR2A=128; //set duty cycle to 50% (LCD back light at 1/2 power) while(1) { } } void Init() { //IO port PORTA=0x08; //0000 1000 PORTB=0x00; //0000 0000 PORTC=0x3E; //0011 1110 PORTD=0x7D; //0111 1101 //1-output, 0-input DDRA=0xF0; //1111 0000 DDRB=0xFF; //1111 1111 DDRC=0xC1; //1100 0001 DDRD=0x82; //1000 0010 //Init timer0 TCCR2A=(2<