Hallo Zusammen,
Ich bin dabei mir den Timer des ATMega328 genauer anzuschauen, dort
geht's dann natürlich auch schnell in Richtung Interrupts.
Zur Auswertung eines Interrupts gibt es ja z.B. die Funktion
ISR(TIMER1_COMPA_vect) {...}
Die Frage, die ich mir stelle, ist:
Bei diesem uC gibt es ja zahlreiche Beispiele im WWW, wie so ein ISR
behandelt werden kann bzw. welche Funktion dafür aufgerufen werden muss.
Somit kann dafür dann viel von anderen Programmieren "abgeschaut"
werden.
Wie geht ihr an die Sache heran bei weniger gebräuchlichen uCs und woher
bekommt ihr die Info, mit welcher Funktion dann z.B. die ISR in diesem
uC ausgewertet soll?
Wenn ich z. B. in der Toolchain von Atmel Studio suche, dann finde ich
in der avr/interrupt.h das hier:
1 | #if defined(__DOXYGEN__)
|
2 | /** \def ISR(vector [, attributes])
|
3 | \ingroup avr_interrupts
|
4 |
|
5 | Introduces an interrupt handler function (interrupt service
|
6 | routine) that runs with global interrupts initially disabled
|
7 | by default with no attributes specified.
|
8 |
|
9 | The attributes are optional and alter the behaviour and resultant
|
10 | generated code of the interrupt routine. Multiple attributes may
|
11 | be used for a single function, with a space seperating each
|
12 | attribute.
|
13 |
|
14 | Valid attributes are ISR_BLOCK, ISR_NOBLOCK, ISR_NAKED and
|
15 | ISR_ALIASOF(vect).
|
16 |
|
17 | \c vector must be one of the interrupt vector names that are
|
18 | valid for the particular MCU type.
|
19 | */
|
20 | # define ISR(vector, [attributes])
|
21 | #else /* real code */
|
22 |
|
23 | #if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
24 | # define __INTR_ATTRS used, externally_visible
|
25 | #else /* GCC < 4.1 */
|
26 | # define __INTR_ATTRS used
|
27 | #endif
|
28 |
|
29 | #ifdef __cplusplus
|
30 | # define ISR(vector, ...) \
|
31 | extern "C" void vector (void) __attribute__ ((signal,__INTR_ATTRS)) __VA_ARGS__; \
|
32 | void vector (void)
|
33 | #else
|
34 | # define ISR(vector, ...) \
|
35 | void vector (void) __attribute__ ((signal,__INTR_ATTRS)) __VA_ARGS__; \
|
36 | void vector (void)
|
37 | #endif
|
38 |
|
39 | #endif /* DOXYGEN */
|
1. Muss ich erstmal "wissen", dass das die richtige Toolchain ist und
2. würde ich jetzt nicht auf Anhieb drauf kommen, dass diese Funktion
entscheidend ist für die ISR...
Im Datenblatt steht ja auch nichts drin bezüglich Implementierung von
ISR...
Also die Frage in Kürze nochmal:
Wie geht ihr bei neuen uCs vor solche Infos schnellst möglichst zu
bekommen?
Danke ;)
Grüße