首先加入外部中断模块:
然后编辑这个模埠,如下设置:
我设置按下和抬起都中断。
再添加个管脚LED0 PB30
最后调试运行,LED0在按键时反转一下,抬起时反转一下:
原程序如下:
main.c:
- #include "atmel_start.h"
- #include "atmel_start_pins.h"
- int main(void)
- {
- system_init();
- /* Replace with your application code */
- while(1) {
- }
- }
atmel_start.c:
|