文件名称:main-li-zhong-duan-jishu-
介绍说明--下载内容来自于网络,使用问题请自行百度
上一节讲了多任务中蜂鸣器驱动程序的框架,这节继续利用多任务处理的方式,在主函数中利用累计主循环次数来实现独立按键的检测。要教会大家四个知识点:
第一点:独立按键的驱动程序框架
第二点:用累计主循环次数来实现去抖动的延时。
第三点:灵活运用防止按键不松手后一直触发的按键自锁标志。
第四点:在按键去抖动延时计时中,添加一个抗干扰的软件监控判断。一旦发现瞬间杂波干扰,马上把延时计数器清零。
这种方法是我在复杂的工控项目中总结出来的。以后凡是用到开关感应器的地方,都可以用类似的方法实现软件上的抗干扰处理。
具体内容,请看源代码讲解。
记得把输出线P0.4一直输出低电平,模拟独立按键的触发地GND。
实现功能:有两个独立按键,每按一个独立按键,蜂鸣器发出“滴”的一声后就停。-Previous section talked about the framework 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 framework
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.
I remember the output lines P0.4 output has been low, the analog trigger buttons i
第一点:独立按键的驱动程序框架
第二点:用累计主循环次数来实现去抖动的延时。
第三点:灵活运用防止按键不松手后一直触发的按键自锁标志。
第四点:在按键去抖动延时计时中,添加一个抗干扰的软件监控判断。一旦发现瞬间杂波干扰,马上把延时计数器清零。
这种方法是我在复杂的工控项目中总结出来的。以后凡是用到开关感应器的地方,都可以用类似的方法实现软件上的抗干扰处理。
具体内容,请看源代码讲解。
记得把输出线P0.4一直输出低电平,模拟独立按键的触发地GND。
实现功能:有两个独立按键,每按一个独立按键,蜂鸣器发出“滴”的一声后就停。-Previous section talked about the framework 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 framework
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.
I remember the output lines P0.4 output has been low, the analog trigger buttons i
(系统自动生成,下载前可以参看下载内容)
下载文件列表
第07节:在主函数中利用累计定时中断的次数来实现独立按键的检测.c
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.