Chapter 4: Interrupts/Exceptions Flashcards

1
Q

Why do we need interupts?

A

A microprocessor is likely to be required to respond to events that might occur; for example a button press, a stroke on a keyboard, or a reading from a sensor, and it will have dedicated input wires to allow this.

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

The two fundamental paradigms as to how a processor can be programmed to respond to events?

A

whether the programme finds out for itself whether an event has occurred, or whether the event tells the processor that an event has occurred. In the first case the programme is in charge, whereas in the second the event is in charge.

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

What is a programme-controlled input/output?

A

would consist of a loop that checks or polls the input port. The speed at which the programme can respond to an event depends on the number of cycles in that loop (if the event occurs just after one check, the programme must go round the loop again before it realises that an event has occurred).

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

Disadvantages of programme-controlled input/output?

A

The problem with this method is that the processor cannot do anything else whilst waiting for the event to occur.

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

The alternative to programme-controlled input/output?

A

The alternative is for the event to interrupt the processor when an event occurs. The processor then switches to a set of code called an interrupt handler or interrupt service routine which deals with the event before returning to the point in the main programme for it to continue

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

How can an external event cause an event to be executed?

A

When an external event occurs, it asserts an interrupt request line. This might occur at any time during the main programme. The event causes the programme counter to change to the address stored in an interrupt vector corresponding to the start of the interrupt handler (a vector stores an address) and also saves a return address.

Once the current instruction has completed, the programme then switches to the interrupt handler. This needs to be written carefully so that the current status of the registers is saved to the stack before responding to the external event.

After this response, the saved registers must be restored before returning to the main programme using the stored return address. Instruction sets often provide a special return from interrupt instruction.

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

ISR diagram?

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

How are exceptions similar to interrupts?

A

An exception operates in a similar manner to an interrupt in that 1) it can occur at any time within the main programme, and 2) it initiates the execution of a special set of code called the exception handler.

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

Differences between interrupt and exceptions?

A

However, in contrast to an interrupt, an exception occurs when the microprocessor encounters an error condition.

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

Common causes of error?

A

Division by zero

Memory access failure

wrong address

write to read only

…and can be caused by bugs in the software.

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