Microcontroller peripheral labs
I wrote C firmware for button inputs, LED outputs, and a PWM buzzer. The final program uses an external interrupt for button handling, Timer2 with output compare for PWM, and a separate Timer3 interrupt for timed LED updates.
RepositoryFinal programSPI lab
Implementation
- Button interrupt: the handler toggles an LED output and enables or disables the output-compare peripheral used for the buzzer.
- PWM: Timer2 supplies the time base for OC1, with peripheral configuration written directly in C.
- Timed output: a Timer3 interrupt handler toggles a separate LED.
- SPI lab: a separate program configures SPI1 in master mode. Its button interrupt handler writes successive byte patterns to the SPI buffer and wraps the sequence index.
Source files
| File | Contents |
|---|---|
| finalcode.c | GPIO configuration, button and timer interrupt handlers, and PWM output. |
| lab9.c | SPI master configuration and interrupt-driven byte transfers. |