4th Semseter files

This commit is contained in:
2024-02-22 14:24:32 -05:00
parent 5223b711a6
commit cd78e4d51b
238 changed files with 34030 additions and 0 deletions

View 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