Mein leicht angepasster Code
1 | // interrupt based light flashing program for atmel mega8l
|
2 | //
|
3 | // Craig Limber, July 2004
|
4 | //
|
5 | |
6 | #include <avr/interrupt.h> |
7 | #include <avr/io.h> |
8 | //#include <avr/signal.h>
|
9 | |
10 | //-----------------------------------------------------------------------------
|
11 | ISR(TIMER1_COMPA_vect) |
12 | {
|
13 | static uint8_t ledon; |
14 | |
15 | if (ledon) |
16 | {
|
17 | ledon = 0; |
18 | PORTB |= _BV(PB2); |
19 | }
|
20 | else
|
21 | {
|
22 | ledon = 1; |
23 | PORTB &= ~_BV(PB2); |
24 | }
|
25 | }
|
26 | |
27 | //-----------------------------------------------------------------------------
|
28 | void main() |
29 | {
|
30 | DDRB = _BV(PB2); // enable output |
31 | |
32 | TIMSK = _BV(OCIE1A); |
33 | TCCR1B = _BV(CS12) // 256 prescale |
34 | | _BV(WGM12); // CTC mode, TOP = OCR1A |
35 | OCR1A = 15625; // count up to TOP 1hz with 8 meg system clock |
36 | sei(); |
37 | int i=0; |
38 | while (1) |
39 | {
|
40 | i++; |
41 | }
|
42 | }
|
1 | avr-gcc -std=gnu99 -mmcu=atmega8 $1 -Os -o $1.hex -Wall |
2 | avrdude -V -U flash:w:$1.hex -cavrisp -b19200 -p m8 -P /dev/ttyUSB0 |
damit wirds compiliert hat da jemand ne idee (hatte zunächst mein eigenes programm geschrieben udn danahc mir das beispiel ausm netz geladen, keins von beiden funktioniert)