文件名称:beep-qu-dong
介绍说明--下载内容来自于网络,使用问题请自行百度
上一节讲了利用累计定时中断次数实现LED灯闪烁,这个例子同时也第一次展示了我最完整的实战程序框架:
用switch语句实现状态机,外加定时中断。这个框架看似简单,实际上就是那么简单。我做的所有开发项目都是基于这个简单框架,
但是非常好用。上一节只有一个单任务的LED灯在闪烁,这节开始,我们多增加一个蜂鸣器报警的任务,要教会大家四个知识点:
第一点:蜂鸣器的驱动程序框架编写。
第二点:多任务处理的程序框架。
第三点:如何控制蜂鸣器声音的长叫和短叫。
第四点:如何知道1秒钟需要多少个定时中断,也就是如何按比例修正时间精度。
具体内容,请看源代码讲解。
实现功能:同时跑两个任务,第一个任务让一个LED灯1秒钟闪烁一次。第二个任务让蜂鸣器在前面3秒发生一次短叫报警,在后面6秒发生一次长叫报警,反复循环。
-Speaking on a cumulative timer interrupt frequency using LED lights flashing, this example also shows my first real full procedural framework:
With a switch statement to achieve a state machine, plus a timer interrupt. This framework may seem simple, actually so simple. I do all the development projects are based on this simple framework,
But it is very easy to use. Previous section only a single task LED lights flashing, this festival started, we multi-task a buzzer alarm increases, the knowledge to teach you four points:
First point: Driver Framework buzzer preparation.
The second point: the procedural framework of multi-tasking.
The third point: how to control the buzzer sounds and the short length is called is called.
The fourth point: How do you know how much a 1 second timer interrupt, which is how a pro rata correction time accuracy.
Details, see the source code to explain.
Function: run two tasks simultaneously, the first task to make a LED light fla
用switch语句实现状态机,外加定时中断。这个框架看似简单,实际上就是那么简单。我做的所有开发项目都是基于这个简单框架,
但是非常好用。上一节只有一个单任务的LED灯在闪烁,这节开始,我们多增加一个蜂鸣器报警的任务,要教会大家四个知识点:
第一点:蜂鸣器的驱动程序框架编写。
第二点:多任务处理的程序框架。
第三点:如何控制蜂鸣器声音的长叫和短叫。
第四点:如何知道1秒钟需要多少个定时中断,也就是如何按比例修正时间精度。
具体内容,请看源代码讲解。
实现功能:同时跑两个任务,第一个任务让一个LED灯1秒钟闪烁一次。第二个任务让蜂鸣器在前面3秒发生一次短叫报警,在后面6秒发生一次长叫报警,反复循环。
-Speaking on a cumulative timer interrupt frequency using LED lights flashing, this example also shows my first real full procedural framework:
With a switch statement to achieve a state machine, plus a timer interrupt. This framework may seem simple, actually so simple. I do all the development projects are based on this simple framework,
But it is very easy to use. Previous section only a single task LED lights flashing, this festival started, we multi-task a buzzer alarm increases, the knowledge to teach you four points:
First point: Driver Framework buzzer preparation.
The second point: the procedural framework of multi-tasking.
The third point: how to control the buzzer sounds and the short length is called is called.
The fourth point: How do you know how much a 1 second timer interrupt, which is how a pro rata correction time accuracy.
Details, see the source code to explain.
Function: run two tasks simultaneously, the first task to make a LED light fla
(系统自动生成,下载前可以参看下载内容)
下载文件列表
第05节:蜂鸣器的驱动程序.c
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.