Mind map
Lecture 9 - Interrupts (1)
Map content
Lecture 9 - Interrupts (1)
Functions
- A small self contained program
- When Called;
- The Main Program is Suspended
- The Function Runs
- The Main Program Continues, once the function is completed
- The Function Runs
- The Main Program is Suspended
The Stack
- A Temporary Store
- First In Last Out store
- Most recently stored info is the first to be retrieved
- The first info stored is last to be retrieved
- When stack limits are exceeded, data is lost
- Stack Operation
- Program Counter points to the current position in the program
- When a function, subroutine or procedure is called the current value of the Program Counter is pushed on to (stored in) the Stack
- At the end of the subroutine call, the Program Counter value is 'popped' from the stack back into the Program Counter and program resumes previous program from correct location
- When a function, subroutine or procedure is called the current value of the Program Counter is pushed on to (stored in) the Stack
- Program Counter points to the current position in the program
- Use of Stack Pointer in Operating a Stack in Memory
- Mbed implements the Stack in Data Memory (RAM)
- An area of Data Memory is assigned to the Stack and cannot be used for any other application
- In the mbed, the stack starts at the top of memory and 'grows' downward
- An area of Data Memory is assigned to the Stack and cannot be used for any other application
- Mbed implements the Stack in Data Memory (RAM)
- Operation of the Stack Pointer (SP)
- During main() SP points at top of RAM
- During function call, return address to main() stored at next available location
- SP Decremented (Goes down stack)
- During another function call, return address to previous function stored at current location of SP
- SP Decremented (Goes down stack)
- On completion, SP is incremented and data at SP location is loaded into the Program Counter to recommence function
- During function call, return address to main() stored at next available location
- During main() SP points at top of RAM
Interrupts
- Unusual event that requires the CPU to stop normal program execution and perform service related to the unusual event
- Event types
- External
- Internal
- A serial port receiving data
- The A to D converter completing a conversion
- Hardware Induced Function Calls
Interrupt Service Routine (ISR)
- Section of Code written to respond to the interrupt which has occurred
- When an interrupt occurs:
- Process completes the current instruction then:
- Saves Program Counter on Stack
- Jumps to the start address of the ISR
- Executes ISR
- Jumps to the start address of the ISR
- Saves Program Counter on Stack
- Process completes the current instruction then:
- On Completion of the ISR, the Processor:
- Restores Program Counter from Stack
- Restarts Interrupted Program
- Restores Program Counter from Stack
Interrupt Vector
- Allows the processor to know exactly where to find a particular ISR
- Is the starting address of the ISR
- For each possible source of interrupt in the mbed there is an interrupt vector
- Program flow jumps directly to the ISR for that particular interrupt source
- Mostly. e.g. only one Vector for all INT pins
Interrupt Input
Information
- Description
- Degree EL560 (Microcontroller Engineering) Mind Map on Lecture 9 - Interrupts (1), created by Tom Revise on 02/01/2021.
- Created by
- Tom Revise
- Views
- 0
- Rating