怎么用32单片机接蜂鸣器后播放歌曲
答案:2 悬赏:80 手机版
解决时间 2021-03-06 11:41
- 提问者网友:星軌
- 2021-03-05 11:38
怎么用32单片机接蜂鸣器后播放歌曲
最佳答案
- 五星知识达人网友:天凉才是好个秋
- 2021-03-05 13:10
能提供几首单片机的歌曲代码?用蜂鸣器唱的
星月神话》
TABLE:
DB 34H,22H,12H,24H,12H,0A2H,14H,0A2H,92H,88H,94H,12H,0A2H,0A4H,82H,0D2H,0DCH
DB 12H,22H,34H,22H,12H,24H,12H,0A2H,14H,0A2H,92H,88H
DB 94H,32H,0A2H,0A4H,12H,22H,1DH,96H,12H,0A4H,12H,22H,36H,52H,38H
DB 96H,12H,0A4H,12H,22H,1AH,12H,22H,34H,22H,12H,24H,12H,0A2H,14H,0A2H,92H,86H
DB 94H,12H,0A2H,0A4H,12H,22H,36H,22H,24H,12H,22H,34H,22H,12H,24H,12H,0A2H,14H,0A2H,92H,86H
DB 12H,82H,94H,32H,12H,0A4H,12H,22H,1CH,32H,52H,66H,62H,54H,22H,52H,34H,14H,94H
DB 92H,0A2H,14H,32H,22H,24H,52H,32H,3CH,32H,52H,66H,62H,52H,22H,22H,25H,32H,12H,12H,92H,94H
DB 32H,22H,14H,32H,22H,24H,32H,0A2H,9CH
DB 00
废湃暥摅泑梀愢濓汇冻沩旈椯庪抹
星月神话》
TABLE:
DB 34H,22H,12H,24H,12H,0A2H,14H,0A2H,92H,88H,94H,12H,0A2H,0A4H,82H,0D2H,0DCH
DB 12H,22H,34H,22H,12H,24H,12H,0A2H,14H,0A2H,92H,88H
DB 94H,32H,0A2H,0A4H,12H,22H,1DH,96H,12H,0A4H,12H,22H,36H,52H,38H
DB 96H,12H,0A4H,12H,22H,1AH,12H,22H,34H,22H,12H,24H,12H,0A2H,14H,0A2H,92H,86H
DB 94H,12H,0A2H,0A4H,12H,22H,36H,22H,24H,12H,22H,34H,22H,12H,24H,12H,0A2H,14H,0A2H,92H,86H
DB 12H,82H,94H,32H,12H,0A4H,12H,22H,1CH,32H,52H,66H,62H,54H,22H,52H,34H,14H,94H
DB 92H,0A2H,14H,32H,22H,24H,52H,32H,3CH,32H,52H,66H,62H,52H,22H,22H,25H,32H,12H,12H,92H,94H
DB 32H,22H,14H,32H,22H,24H,32H,0A2H,9CH
DB 00
废湃暥摅泑梀愢濓汇冻沩旈椯庪抹
全部回答
- 1楼网友:长青诗
- 2021-03-05 14:49
1、单片机与蜂鸣器连接图已附.
2、通常p1、p2、p3口都可以用来作为控制,p0口也可以,但因其内部无上拉电阻,所以外接时,应接一1k的上拉电阻,其他一样。有源蜂鸣器驱动电路设计,无须外加驱动电路。
3、c语言编程为:
#include//头文件
sbit d1=p1^2;//位定义,把p1口的p1.2位设为驱动口,当然其它口也可。
void main()//主函数
{
d1=0//单片机默认状态为1,不用初始化了,此处直接赋值0则可驱动
};
此为最最简单的电路程序设计。下载后,蜂鸣器一会一直处于鸣叫状态。
你可以加一个延时函数,再把d1口置高,可让它,叫一下关闭。也可以加个while(1)大循环,让它“滴、滴”不停地叫。还可以设置一个按键,按一个亮一下。
随程序的变化,现象也会各不同。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯