<avr\/interrupt.h><\/font><\/strong><\/font><\/p>\n#include <avr\/pgmspace.h><\/font><\/strong><\/font>
\n#include <util\/delay.h><\/font><\/strong><\/font><\/p>\n#include \"a2d.h\"<\/font><\/strong><\/font>
\n#include \"uart.h\"<\/font><\/strong><\/font>
\n#include \"avrlibdefs.h\"<\/font><\/strong><\/font>
\n#include \"avrlibtypes.h\"<\/font><\/strong><\/font><\/p>\n\/* define CPU frequency in Mhz here if not defined in Makefile *\/<\/font>
\n#ifndef F_CPU<\/strong><\/font>
\n#define F_CPU 8000000UL<\/strong><\/font>
\n#endif<\/strong><\/font><\/p>\nstatic<\/strong> char<\/strong> mPwrLedLevel<\/font> =<\/font> 0<\/font>;<\/font><\/p>\nstatic<\/strong> void<\/strong> incr_pwr_led<\/font>(<\/font>void<\/strong>)<\/font>;<\/font><\/p>\nISR<\/font>(<\/font>SIG_OVERFLOW0<\/font>)<\/font> {<\/strong><\/font><\/p>\nincr_pwr_led<\/font>(<\/font>)<\/font>;<\/font>
\n}<\/strong><\/font><\/p>\nISR<\/font>(<\/font>TIMER0_COMP_vect<\/font>)<\/font> {<\/strong><\/font>
\nincr_pwr_led<\/font>(<\/font>)<\/font>;<\/font><\/p>\n}<\/strong><\/font><\/p>\nstatic<\/strong> char<\/strong> aDirection<\/font>;<\/font>
\nstatic<\/strong> void<\/strong>
\nincr_pwr_led<\/font>(<\/font>void<\/strong>)<\/font><\/p>\n{<\/strong><\/font>
\n\/\/TIMSK<\/font> =<\/font> 0x03<\/font>;<\/font><\/p>\nif<\/strong>(<\/font>mPwrLedLevel<\/font> =<\/font>=<\/font> 0x20<\/font>)<\/font> {<\/strong><\/font><\/p>\naDirection<\/font> =<\/font> 1<\/font>;<\/font>
\n}<\/strong><\/font>
\nif<\/strong>(<\/font>mPwrLedLevel<\/font> =<\/font>=<\/font> 0xE0<\/font>)<\/font> {<\/strong><\/font><\/p>\naDirection<\/font> =<\/font> 0<\/font>;<\/font>
\n}<\/strong><\/font><\/p>\nif<\/strong>(<\/font>aDirection<\/font> =<\/font>=<\/font> 1<\/font>)<\/font> mPwrLedLevel<\/font>+<\/font>+<\/font>;<\/font><\/p>\nif<\/strong>(<\/font>aDirection<\/font> =<\/font>=<\/font> 0<\/font>)<\/font> mPwrLedLevel<\/font>-<\/font>-<\/font>;<\/font><\/p>\nOCR0<\/font> =<\/font> mPwrLedLevel<\/font>;<\/font>
\n}<\/strong><\/font><\/p>\nint<\/strong> main<\/font>(<\/font>void<\/strong>)<\/font><\/p>\n{<\/strong><\/font><\/p>\nsbi<\/font>(<\/font>DDRB<\/font>, PB3<\/font>)<\/font>;<\/font>
\nPORTB<\/font> |<\/font>=<\/font> (<\/font>1<\/font><<\/font><<\/font>PORTB3<\/font>)<\/font>;<\/font><\/p>\nfor<\/strong>(<\/font>int<\/strong> j<\/font>=<\/font>0<\/font>;<\/font> j<\/font><<\/font>30<\/font>;<\/font> j<\/font>+<\/font>+<\/font>)<\/font><\/p>\n_delay_ms<\/font>(<\/font>32<\/font>)<\/font>;<\/font>
\ncbi<\/font>(<\/font>PORTB<\/font>, PB3<\/font>)<\/font>;<\/font>
\nfor<\/strong>(<\/font>int<\/strong> j<\/font>=<\/font>0<\/font>;<\/font> j<\/font><<\/font>30<\/font>;<\/font> j<\/font>+<\/font>+<\/font>)<\/font><\/p>\n_delay_ms<\/font>(<\/font>32<\/font>)<\/font>;<\/font>
\nsbi<\/font>(<\/font>PORTB<\/font>, PB3<\/font>)<\/font>;<\/font>
\nfor<\/strong>(<\/font>int<\/strong> j<\/font>=<\/font>