Chapter 8 Flashcards

(10 cards)

1
Q

What is the primary purpose of using Hardware Interrupts in AVR programming?

A

To allow the AVR to multitask and respond instantly to external events by interrupting the normal flow of the program, preempting the main event loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the special function that runs when an interrupt is triggered?

A

An Interrupt Service Routine (ISR)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What process occurs immediately when an interrupt is triggered before the ISR begins running?

A

The AVR saves all the variables currently being used in memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name the two main flavors of external interrupts discussed in the chapter.

A

The fancy interrupts (INT0 and INT1) and Pin-Change Interrupts (PCINT)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which type of external interrupt is highest priority and offers the most versatile triggering possibilities (e.g., rising voltage, falling voltage)?

A

The fancy interrupts (INT0 and INT1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the main characteristic of a Pin-Change Interrupt (PCINT) compared to INT0/INT1?

A

PCINT allows almost every I/O pin to be an interrupt source, but it can only detect a change in voltage, not the direction of the change (rising or falling).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How are Pin-Change Interrupts configured regarding their pins

A

They are grouped together in banks (e.g., B, C, and D pins), and pin mask registers are used to select which specific pins within the bank will trigger the interrup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What two keywords must be used to declare a variable that is shared between the main program loop and an Interrupt Service Routine (ISR)?

A

global and volatile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why is the volatile keyword necessary for a shared variable in an ISR

A

It tells the compiler that the variable’s value can be changed by something outside the normal program flow (i.e., the ISR), preventing the compiler from making optimizations that would result in incorrect code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the main drawback of using polling (checking inputs within the main event loop) instead of interrupts?

A

If any part of the event loop takes a significant time to execute, a delay will be noticed in responding to the event, making the action feel sluggish.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly