From e1211bd691c284824463728051ab22d0cf461b06 Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Fri, 8 Jun 2012 18:19:58 +0200 Subject: [PATCH] PWM experiments --- lights.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 ); -- 2.39.3