Ich würde gerne in einer ISR bei Bedarf eine weitere auslösen. Hab schon Infos gefunden: http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html Verstehe aber nciht genau, wie man das realisiert. Hat jemand evtl. irgendwelche Beispiele? Wäre nett.
Die genannte URL wird bei mir nicht gefunden. Aber hier eine Idee: Du kannst z.B. einen unbenutzten Pin für diesen Zweck verwenden, z.B. den, auf dem der Externe Interrupt INT0 liegt; diesen Interrupt gibst Du frei und definierst den Pin als Ausgang und setzst ihn dann aus Deiner ISR z.B. high; sobald Deine erste ISR endet, wird die neue ISR aufgerufen. Damit hast Du einen echten Interrupt erzeugt. Andernfalls kannst Du ja aus deiner ISR eine Funktion aufrufen; wenn alle ISR's Funktionen aufrufen, sodaß der Code jeweils nicht direkt in der ISR steht, sondern (indirekt) in der (externen) Funktion, kannst Du solche Funktionen ja aus allen beliebigen ISR's in beliebiger Zahl und Reihenfolge aufrufen. Das löst Dein Problem vielleicht auch. Günter
tue_was() isr1() { tue_was() } isr2() { 123 } tue_was() { enable isr2() tue was anderes disable isr2() } So nach dem Prinzip hab ich das Ganze. Und leider funkt es noch nciht, bin noch am nachforschen.
> Die genannte URL wird bei mir nicht gefunden.
Du musst sie cut&pasten, der Link funktioniert auf Grund eines
Bugs dieser Forumsoftware nicht, da sie die Unterstriche in
HTML als <u>...</u> darstellen möchte und dabei vermasselt, dass
es sich in diesem Falle um eine URL handelt, bei der das so nicht
sinnvoll ist.
Geht wenn man die <u> Dinger entfernt. Hier der Text: Nested interrupts The AVR hardware clears the global interrupt flag in SREG before entering an interrupt vector. Thus, normally interrupts will remain disabled inside the handler until the handler exits, where the RETI instruction (that is emitted by the compiler as part of the normal function epilogue for an interrupt handler) will eventually re-enable further interrupts. For that reason, interrupt handlers normally do not nest. For most interrupt handlers, this is the desired behaviour, for some it is even required in order to prevent infinitely recursive interrupts (like UART interrupts, or level-triggered external interrupts). In rare circumstances though it might be desired to re-enable the global interrupt flag as early as possible in the interrupt handler, in order to not defer any other interrupt more than absolutely needed. This could be done using an sei() instruction right at the beginning of the interrupt handler, but this still leaves few instructions inside the compiler-generated function prologue to run with global interrupts disabled. The compiler can be instructed to insert an SEI instruction right at the beginning of an interrupt handler by declaring the handler the following way: void XXX_vect(void) __attribute__((interrupt)); void XXX_vect(void) { ... } where XXX_vect is the name of a valid interrupt vector for the MCU type in question, as explained below. -------------------------------------------------------------------- Und das hab ich auch getestet gehabt void USART_IR_NAME_vect(void) __attribute__((interrupt)); void USART_IR_NAME_vect(void) { weitere Funktion in der TImer IR erlaubt wird } Und irgendwas klappt da nicht.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.