CENG-336 Introduction To Embedded Systems Development
CENG-336 Introduction To Embedded Systems Development
Introduction to Embedded
Systems Development
Interrupts
Spring 2015
I/O Devices and Modules
Because of great differences in control methods and
transmission modes among various kinds of I/O
devices, it is infeasible to connect them directly to
the system bus.
The MPU
Acknowledges the request
Attends to the request
Goes back to processing where it was interrupted
Valid interrupt
Interrupt request bit (flag)
Interrupt enable bit
Priority bit
INTCON3 Register
PIE1
PIR1
Low-priority interrupts
These registers must be saved as a part of the ISR by the
programmer if they are to be used
MOVFF S_TMP,STATUS
RETFIE ;Return from interrupt
main() {
initialize();
while (1) {
task_1();
...
task_n();
}
}
New design:
RB0 is an external interrupt source! We can detect the
rising edge with an interrupt!
So, replace the button_task with an ISR
Keep the LED task as before
while (1) {
send_task();
}
}