Hallo, ich möchte folgendes machen: main:
1 | //Interrupt-Test
|
2 | |
3 | |
4 | |
5 | //Set up the timer1 as described in the
|
6 | //tutorial
|
7 | |
8 | TCCR1B=(1<<WGM12)|(1<<CS11)|(1<<CS10); |
9 | OCR1A=65535; |
10 | |
11 | OCR1B=35500; // timer2 |
12 | |
13 | |
14 | //Enable the Output Compare A interrupt
|
15 | TIMSK|=(1<<OCIE1A); |
16 | |
17 | //Enable the Output Compare B interrupt
|
18 | TIMSK|=(1<<OCIE1B); |
19 | |
20 | //Enable interrupts globally
|
21 | sei(); |
22 | |
23 | |
24 | while( 1 ) |
25 | {
|
26 | |
27 | }
|
28 | |
29 | |
30 | |
31 | // Ende-Test
|
Interrupt.c:
1 | //The output compate interrupt handler
|
2 | //We set up the timer in such a way that
|
3 | //this ISR is called exactly at 1ms interval
|
4 | |
5 | ISR(TIMER1_COMPA_vect) |
6 | {
|
7 | sendchar('I'); |
8 | sendchar('N'); |
9 | sendchar('T'); |
10 | sendchar('E'); |
11 | sendchar('R'); |
12 | sendchar('R'); |
13 | sendchar('U'); |
14 | sendchar('P'); |
15 | sendchar('T'); |
16 | sendchar('A'); |
17 | |
18 | sendchar(13); |
19 | sendchar(10); |
20 | sendchar(10); |
21 | |
22 | }
|
23 | |
24 | ISR(TIMER1_COMPB_vect) |
25 | {
|
26 | sendchar('I'); |
27 | sendchar('N'); |
28 | sendchar('T'); |
29 | sendchar('E'); |
30 | sendchar('R'); |
31 | sendchar('R'); |
32 | sendchar('U'); |
33 | sendchar('P'); |
34 | sendchar('T'); |
35 | sendchar('B'); |
36 | |
37 | sendchar(13); |
38 | sendchar(10); |
39 | sendchar(10); |
40 | |
41 | }
|
jedoch erhalte ich als Ausgabe nur gleichmäßig abwechselnd Interrupt A und Interrupt B und nicht ungleichmäßig wie gewünscht... Warum??? http://extremeelectronics.co.in/avr-tutorials/timers-in-compare-mode-part-ii/ Quelle...