1.2 KiB
Executable File
1.2 KiB
Executable File
Intro to Embedded Systems Lecture Notes: February 2nd, 2023
Registers
| Reg Name | Function |
|---|---|
| PxSEL | Function select register |
| PxDIR | Whether input or output |
| PxOUT | Output value |
| PxIN | Input value |
| PxREN | Pull-up / Pull-down resistor |
| PxIE | Interrupt enable |
| PxIFG | Interrupt flag register |
| PxIES | Interrupt edge select register |
PxSEL
| PxSEL1 | PxSEL0 | I/O Function |
|---|---|---|
| 0 | 0 | General purpose I/O |
| 0 | 1 | ADC |
| 1 | 0 | Timer |
| 1 | 1 | Digital Communication (SPI / UART / I2C) |
Using PxSEL to Modify Behavior of P1.7
GPIO Function
P1SEL1 &= ~BIT7;
P1SEL0 &= ~BIT7;
ADC Function
P1SEL1 &= ~BIT7;
P1SEL0 |= BIT7;
Timer Function
P1SEL1 |= BIT7;
P1SEL0 &= ~BIT7;
SPI (Requires 4 Pins)
P1SEL1 |= 0xF0;
P1SEL0 |= 0xF0;
Using PxIE, PxIFG, and PxIES
| Level Triggering | Edge Triggering |
|---|---|
| Signal asserted when high | Signal asseted on positive* edge |
| Signal not asserted when low |
* positive edge only used when using positive edge triggering. Negative edge triggering also exists