4th Semseter files
This commit is contained in:
BIN
4th-Semester-Spring-2023/Embedded/Lectures/Lecture07/L#4-Interrupts_Polling.pptx
Executable file
BIN
4th-Semester-Spring-2023/Embedded/Lectures/Lecture07/L#4-Interrupts_Polling.pptx
Executable file
Binary file not shown.
54
4th-Semester-Spring-2023/Embedded/Lectures/Lecture07/notes.md
Executable file
54
4th-Semester-Spring-2023/Embedded/Lectures/Lecture07/notes.md
Executable file
@@ -0,0 +1,54 @@
|
||||
# Intro to Embedded Systems Lecture Notes: February 7th, 2023
|
||||
|
||||
## Using Interrupts
|
||||
```c
|
||||
#define INTERRUPT_PINS 0x03
|
||||
|
||||
int main(void)
|
||||
{
|
||||
P4IE |= INTERRUPT_PINS; // Local interrupt enable
|
||||
P4IFG |= INTERRUPT_PINS;
|
||||
P4IES |= INTERRUPT_PINS;
|
||||
|
||||
_enable_interrupts(); // Global interrupt enable
|
||||
__bis_SR_register(GIE);
|
||||
|
||||
while (true)
|
||||
{
|
||||
...
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Port 4 interrupt service routine
|
||||
void __attribute__ ((interrupt(PORT4_VECTOR))) Port_4 (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Interrupt Servicing Summary
|
||||
1. Interrupt Pending
|
||||
2. Complete Current Instruction
|
||||
3. Clear SR
|
||||
4. Retrieve starting address of ISR & put address in PC
|
||||
5. Execute ISR
|
||||
6. Pop SR and PC from stack
|
||||
7. Continue to main program
|
||||
|
||||
## Multiple Interrupts
|
||||
### Three Types:
|
||||
1. Reset Interrupt
|
||||
2. Maskable Interrupt
|
||||
- ADC, port, timer, e_USCI
|
||||
- User-asserted event
|
||||
3. Non-Maskable Interrupt
|
||||
- Fault, error detection
|
||||
- Oscillator fault
|
||||
- Flash key violation
|
||||
|
||||
## Priority of Interrupts
|
||||
1. Timers
|
||||
2. e_USCI
|
||||
3. ADC
|
||||
4. Port
|
||||
Reference in New Issue
Block a user