Professional Documents
Culture Documents
ELEC3300 04 Interrupt
ELEC3300 04 Interrupt
Topic 4
Interrupt Organization
Prof. Tim Woo
Microcontroller Structure
A/D Port
Buffering and
Serial Port Direct Memory Access
CPU
(DMA)
External Memory Port
Memory,
Interfacing to Memory,
External Interrupt Port
Memory Timing
Interrupt and applications
External Timer Port Interfacing LCD
Organization Timer and
Counter Simple I/O Port
Motor Interfacing
In this course, STM32 is used as a driving vehicle for delivering the concepts.
To be covered In progress Done
Program code
predictable delay (e.g. In loading a Description
printer buffer with text, the buffer can Ask the device Abstract idea of project
(Define the functionality of the
run out before the printer is polled system)
again and thus printing stops) Data format / representation
Programming Language
Communication Protocol
Physical connection (Pins
assignment)
Hardware devices
(Microcontroller, Peripherals)
Program code
• Configure a GPIO as an appropriate function
(says, input or output port) Ask the device
• Implementation
• Write a while-loop / if-then-else loop for checking
the status of the GPIO
Initialization main()
Description
{
Abstract idea of project
Configure PA0 as input port (Define the functionality of the
while() system)
Data format / representation
{
Programming Language
Check if PA0 is pressed,
Communication Protocol
if yes, …. ; break
Physical connection (Pins
if not, …. ; back to while loop assignment)
implementation } Hardware devices
(Microcontroller, Peripherals)
}
Description
D1 D6 D7
Abstract idea of project Loop Back
(Define the functionality of the
system)
Data format / representation
Programming Language
D2 D5 D8
Communication Protocol
Physical connection (Pins
assignment)
D9
Hardware devices
(Microcontroller, Peripherals) D3 D4 Next Instruction
Program code
• Configure a GPIO as an appropriate function
(says, input or output port) Ask the devices
• Implementation
• Write a while-loop / if-then-else loop for checking
the status of the GPIO
Initialization main() * remark
{ Description
Configure PA0, PA1, …., as input ports * Abstract idea of project
while() (Define the functionality of the
system)
{
Check if PA0 is pressed, Data format / representation
D2 D5 D8
D3 D4 D9
ELEC 3300 : Spring 17/18 Tim Woo 10
Timing diagram of Interrupts
• Before an Interrupt Service Routine (ISR) can do anything, it must save
away the current program’s registers (if it touches those registers)
•Pushing the PC, registers etc onto the stack
•Disable subsequent interrupts of the same
Description type from occurring. However, interrupts of a
higher priority can still occur.
Abstract idea of project
(Define the functionality of the
system)
Hardware devices
(Microcontroller, Peripherals)
Program code
ISR
as interrupt signal) ………
Enable the IRQ channel
Clear the interrupt pending bit
while()
}
{
Program code
………
implementation }
}
* CAN1_RX and CAN1_TX in connectivity line devices; CAN_RX and CAN_TX in other devices with a single CAN interface.
• Features:
– Up to 20 edge detectors in connectively line devices
– Up to 19 edge detectors in other devices for general event / interrupt
requests
– Independent trigger and mask on each interrupt / event line
– Dedicated status bit for each interrupt line
– Generation of up to 20 software event / interrupt requests
– Detection of external signal with pulse width lower than APB2 clock
period.
Lowest Priority
Microcontroller Structure
A/D Port
Buffering and
Serial Port Direct Memory Access
CPU
(DMA)
External Memory Port
Memory,
Interfacing to Memory,
External Interrupt Port
Memory Timing
Interrupt and applications
External Timer Port Interfacing LCD
Organization Timer and
Counter Simple I/O Port
Motor Interfacing
In this course, STM32 is used as a driving vehicle for delivering the concepts.
To be covered In progress Done
Hints:
– The hardware devices: I/O ports, on-board switches, LEDs
– Communication protocols: polling, interrupt