This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ATmega8 with internal 4Mhz clock (6cycle + 64ms) */ | |
#include <avr/io.h> | |
#include <avr/sleep.h> | |
#include <avr/interrupt.h> | |
#include <util/delay.h> | |
int main(void) | |
{ | |
DDRC |= (1 << PC2) | (1 << PC1); // leds for testing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All values/comments are valid with ATmega8 running at Fosc = 4.000MHz | |
#include <avr/io.h> | |
#include <avr/interrupt.h> | |
// TIMER0 with prescaler clkI/O/1024 | |
#define TIMER0_PRESCALER (1 << CS02) | (1 << CS00) | |
void main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All values/comments are valid with ATmega8 running at Fosc = 4.000MHz | |
#include <avr/io.h> | |
#include <avr/interrupt.h> | |
// TIMER1 with prescaler clkI/O/1024 | |
#define TIMER1_PRESCALER (1 << CS12) | (1 << CS10) | |
// ~15s (4MHz@1024 prescale value) | |
#define TIMER1_COMPARE_VALUE 0xE4E1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All values/comments are valid with ATmega8 running at Fosc = 4.000MHz | |
#include <avr/io.h> | |
#include <avr/interrupt.h> | |
// TIMER2 with prescaler clkT2S/1024 | |
#define TIMER2_PRESCALER (1 << CS22) | (1 << CS21) | (1 << CS20) | |
// TIMER2 output compare value | |
// --> value 98 is 25.088ms (4MHz@1024 prescale factor) |