Question
The AVR code below (with some information missing) is designed to initialize and service interrupts from three I/O devices (DevA, DevB, and DevC). (a) There
The AVR code below (with some information missing) is designed to initialize and service interrupts from three I/O devices (DevA, DevB, and DevC).
(a) There are 8 external interrupt pins (INT0-INT7) in AVR. Which of the three interrupt pins are these I/O devices connected to and what is the immediate value needed in line (1)?
(b) Which I/O devices interrupt is detected on a falling edge?
(c) The interrupt pins referred to in part (a) are connected to two of the 7 ports (PORTA-PORTG) in AVR. Which ports are they?
(d) There are important instructions missing in lines 2-4 of the code. Fill in the missing instructions in lines 2-4 so that the code will work correctly.
(e) Suppose DevB requires that no interrupts are detected while it is being serviced. Fill in lines 5-6 with the necessary code to clear any latched interrupts at the end of ISR_DevB.
(f) Suppose a signal that transitions from high to low is detected on all three interrupt pins at the same time. Which subroutine (ISR_DevA, ISR_DevB, or ISR_DevC) will be executed first?
.include m128def.inc
.def mpr = r16
START:
.org $0000
RJMP INIT
.org $0004
RJMP ISR_DevA
.org $0006
RJMP ISR_DevB
.org $000E
RJMP ISR_DevC
INIT:
ldi mpr, 0b00101100
sts EICRA, mpr
ldi mpr, 0b00100000
out EICRB, mpr
ldi mpr, _________________(1)
out EIMSK, mpr
ldi mpr, $00
out DDRD, mpr
________________________(2)
ldi mpr, 0b01000100
________________________(3)
________________________(4)
Sei
MAIN:
{
do something
}
ISR_DevA:
{
RETI
}
ISR_DevB:
_______________________(5)
_______________________(6)
RETI
ISR_DevC:
{
RETI
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started