文件名称:zhong-duan-ji-shu-LED-blink
- 所属分类:
- 单片机(51,AVR,MSP430等)
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2014-07-07
- 文件大小:
- 3kb
- 下载次数:
- 0次
- 提 供 者:
- 高*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
上一节讲了多任务中蜂鸣器驱动程序的框架,这节继续利用多任务处理的方式,在主函数中利用累计主循环次数来实现独立按键的检测。要教会大家四个知识点:
第一点:独立按键的驱动程序框架
第二点:用累计主循环次数来实现去抖动的延时。
第三点:灵活运用防止按键不松手后一直触发的按键自锁标志。
第四点:在按键去抖动延时计时中,添加一个抗干扰的软件监控判断。一旦发现瞬间杂波干扰,马上把延时计数器清零。
这种方法是我在复杂的工控项目中总结出来的。以后凡是用到开关感应器的地方,都可以用类似的方法实现软件上的抗干扰处理。
具体内容,请看源代码讲解。
(1)用矩阵键盘中的S1和S5号键作为独立按键,记得把输出线P0.4一直输出低电平,模拟独立按键的触发地GND。
(2)实现功能:有两个独立按键,每按一个独立按键,蜂鸣器发出“滴”的一声后就停。-Previous section talked about the fr a mework of multi-tasking in buzzer driver, this section continue to use the way multi-task processing, are used to detect the use of separate keys cumulative primary cycles in the main function. Knowledge to teach you four points:
First point: independent key driver fr a mework
The second point: The cumulative number of cycles to achieve the main debounce delay.
The third point: flexible use grimdeath prevent the keys from the lock button has been triggered flag.
The fourth point: the key to timing jitter delay, add an anti-jamming software monitoring judgments. Once an instant clutter found immediately to the delay counter is cleared.
This approach is summed up in my complex industrial projects. After all switch sensors used in place anti-jamming processing software can be achieved on a similar approach.
Details, see the source code to explain.
(1) with S1 and S5 matrix keypad number keys as a separate button, remember to out
第一点:独立按键的驱动程序框架
第二点:用累计主循环次数来实现去抖动的延时。
第三点:灵活运用防止按键不松手后一直触发的按键自锁标志。
第四点:在按键去抖动延时计时中,添加一个抗干扰的软件监控判断。一旦发现瞬间杂波干扰,马上把延时计数器清零。
这种方法是我在复杂的工控项目中总结出来的。以后凡是用到开关感应器的地方,都可以用类似的方法实现软件上的抗干扰处理。
具体内容,请看源代码讲解。
(1)用矩阵键盘中的S1和S5号键作为独立按键,记得把输出线P0.4一直输出低电平,模拟独立按键的触发地GND。
(2)实现功能:有两个独立按键,每按一个独立按键,蜂鸣器发出“滴”的一声后就停。-Previous section talked about the fr a mework of multi-tasking in buzzer driver, this section continue to use the way multi-task processing, are used to detect the use of separate keys cumulative primary cycles in the main function. Knowledge to teach you four points:
First point: independent key driver fr a mework
The second point: The cumulative number of cycles to achieve the main debounce delay.
The third point: flexible use grimdeath prevent the keys from the lock button has been triggered flag.
The fourth point: the key to timing jitter delay, add an anti-jamming software monitoring judgments. Once an instant clutter found immediately to the delay counter is cleared.
This approach is summed up in my complex industrial projects. After all switch sensors used in place anti-jamming processing software can be achieved on a similar approach.
Details, see the source code to explain.
(1) with S1 and S5 matrix keypad number keys as a separate button, remember to out
(系统自动生成,下载前可以参看下载内容)
下载文件列表
第04节:累计定时中断次数使LED灯闪烁.c