Practice Problems: Interrupts

  1. Initialize Interrupt 1 (INT1) pin to generate an Interrupt on a rising edge. Set all unused bits to default values.
    _____ R16, 0x____
    _____ EICRA, R16
  2. Initialize Interrupt 0 (INT0) pin to generate an Interrupt on a falling edge. Do not change the other bits (ISC11, ISC10) in the External Interrupt Control Register A (EICRA). You should assume the previous code (problem 1) has been written (i.e., bits 1 and 0 cleared)
    _____ R16, EICRA
    _____ R16, 0x____
    _____ EICRA, R16
  3. Configure Pin 15 PB1 (OC1A/PCINT1) to generate an Interrupt whenever the pin changes state. Do not change any other bits. To make things more interesting, do not use the SBR instruction.
    _____ R16, PCMSK0 ; load
    _____ R17, PCICR
    _____ R18, SREG
    _____ R16, 0x ; do something
    _____ R17, 0x____
    _____ R18, 0x____
    _____ PCMSK0, R16 ; store
    _____ PCICR, R17
    _____ SREG, R18