文件名称:beep-qu-dong
- 所属分类:
- 单片机(51,AVR,MSP430等)
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2014-07-07
- 文件大小:
- 3kb
- 下载次数:
- 1次
- 提 供 者:
- 高*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
上一节讲了利用累计定时中断次数实现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 fr a mework:
With a switch statement to achieve a state machine, plus a timer interrupt. This fr a mework may seem simple, actually so simple. I do all the development projects are based on this simple fr a mework,
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 fr a mework buzzer preparation.
The second point: the procedural fr a mework 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 fr a mework:
With a switch statement to achieve a state machine, plus a timer interrupt. This fr a mework may seem simple, actually so simple. I do all the development projects are based on this simple fr a mework,
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 fr a mework buzzer preparation.
The second point: the procedural fr a mework 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