From: Jan "Yenya" Kasprzak Date: Fri, 8 Jun 2012 16:19:58 +0000 (+0200) Subject: PWM experiments X-Git-Tag: gedasymbols-20120913~68 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=e1211bd691c284824463728051ab22d0cf461b06;p=bike-lights.git PWM experiments --- diff --git a/lights.c b/lights.c index 18eef18..0bedc53 100644 --- a/lights.c +++ b/lights.c @@ -1,8 +1,26 @@ #include +#include #include +char dbg[5] __attribute__((section(".eeprom"))); + int main(void) { + TCCR1C = _BV(COM1D0) | _BV(COM1D1) | _BV(PWM1D); + TCCR1A = _BV(PWM1A) | _BV(PWM1B); + TCCR1B = 0x80 | _BV(CS13) | _BV(CS12); + OCR1C = 0xFF; + OCR1D = 0x20; + TCNT1 = 3; + DDRB |= _BV( PB5 ); + PORTB &= ~_BV( PB5 ); + + _delay_ms(1000); + eeprom_write_byte(&dbg[0], TCNT1); + eeprom_write_byte(&dbg[1], OCR1C); + eeprom_write_byte(&dbg[2], OCR1D); + eeprom_write_byte(&dbg[3], TIFR); + eeprom_write_byte(&dbg[4], TCCR1B); DDRA |= _BV( PA0 ); while( 1 ) { PORTA |= _BV( PA0 );