logo elektroda
logo elektroda
X
logo elektroda
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

Włączenie przerwania polega na ustawieniu bitu w rejestrze

LPU92 19 Maj 2015 23:25 870 2
  • #1 14706458
    LPU92
    Poziom 9  
    Włączenie przerwania polega na ustawieniu bitu w rejestrze maskującym czy flagowym ?
  • #2 14706535
    dondu
    Moderator na urlopie...
    Na przykład w ATmega48 przerwanie INT0 włączasz bitem w rejestrze EIMSK.
    Czytaj dokumentację, tam wszystko jest napisane:

    Cytat:
    EIMSK – External interrupt mask register

    • Bit 0 – INT0: External interrupt request 0 enable
    When the INT0 bit is set (one) and the I-bit in the status register (SREG) is set (one), the external
    pin interrupt is enabled
    . The interrupt sense Control0 bits 1/0 (ISC01 and ISC00) in the
    external interrupt control register A (EICRA) define whether the external interrupt is activated on
    rising and/or falling edge of the INT0 pin or level sensed. Activity on the pin will cause an interrupt
    request even if INT0 is configured as an output. The corresponding interrupt of external
    interrupt request 0 is executed from the INT0 interrupt vector.


    + oczywiście przerwania globalne - bit I w rejestrze SREG - co także powyżej jest opisane.

    W Atmega8 zamiast EMISK należy wykorzystać GICR:

    Cytat:
    General Interrupt Control Register – GICR

    • Bit 6 – INT0: External Interrupt Request 0 Enable
    When the INT0 bit is set (one) and the I-bit in the Status Register (SREG) is set (one), the external
    pin interrupt is enabled
    . The Interrupt Sense Control0 bits 1/0 (ISC01 and ISC00) in the MCU
    general Control Register (MCUCR) define whether the external interrupt is activated on rising
    and/or falling edge of the INT0 pin or level sensed. Activity on the pin will cause an interrupt
    request even if INT0 is configured as an output. The corresponding interrupt of External Interrupt
    Request 0 is executed from the INT0 Interrupt Vector.
  • #3 14706553
    Konto nie istnieje
    Poziom 1  
REKLAMA