单片机之旅——中断之流水灯
时间:11-20
来源:互联网
点击:
#include#include sbit K2 = P3^2;sbit K3 = P3^3;void delayms(unsigned int m);unsigned char aa = 0xfe;void main(){EA = 1;EX0 = 1;EX1 = 1;IT0 = 0;IT1 = 0;IP = 0xf1;P1 = 0xff;}/*低级的外部中断2,负责按钮1 的操作,即实现流水灯*/void button_1() interrupt 2{ if(K3 == 0){delayms(10);if(K3 == 0){while(1){ P1 = aa;aa = _crol_(aa,1);delayms(500);} }}}/*外部中断0(最高级),负责打断外部中断 2*/void button_2() interrupt 0{if(K2 == 0){delayms(10);if(K2 == 0){while(1);}}}void delayms(unsigned int m){unsigned int i, j;for(i = m; i > 0; i--){for(j = 110; j > 0; j--);}}
单片机中断流水 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)