PIC: Timer Interrupt Fundamentals
Create periodic events without blocking the main program.
◷ 60 minParts and tools
- PIC development board
- PICkit
- Oscilloscope or logic analyser
Lesson
Learning objective
Create periodic events without blocking the main program.
Procedure
- Review the circuit and confirm the board voltage.
- Build and inspect the wiring before applying power.
- Upload the example, observe the result and record your readings.
- Change one parameter, predict the result and test again.
Troubleshooting
Check power, ground, pin selection, polarity, compiler target and serial output. Use a multimeter or logic analyser where appropriate.
Example code
void __interrupt() isr(void){ /* clear flag, service event */ }Knowledge check
Why must an interrupt flag be cleared?
