找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3119|回复: 3
收起左侧

89c52.51单片机蜂鸣器程序 -- 极乐净土 功能可以实现亲测

[复制链接]
ID:396815 发表于 2019-6-17 09:42 | 显示全部楼层 |阅读模式
下面是例子,试过可以使用

#include <REG52.H>   
#include <INTRINS.H>   
#include "reg52.h"       
typedef unsigned int u16;          //对数据类型进行声明定义
typedef unsigned char u8;

sbit k1=P3^1;         //定义P31口是k1



sbit Beep =  P1^5;

unsigned char n=0;      
unsigned char code music_tab[] ={ 0xff,  
               

         0x1c,0x10,0x1c,0x20,0x20,0x10,
0x1c,0x10,0x1c,0x20,0x20,0x10,
0x1c,0x10,0x1c,0x20,0x20,0x10,
0x1c,0x20,0x18,0x20,

0x1c,0x10,0x1c,0x20,0x20,0x10,
0x1c,0x10,0x1c,0x20,0x20,0x10,
0x1c,0x20,0x18,0x20,0x15,0x20,0x13,0x20,

0x2b,0x10,0x26,0x10,
0x39,0x08,0x40,0x08,0x39,0x08,0x40,0x08,

0x2b,0x10,0x26,0x10,
0x39,0x08,0x40,0x08,0x39,0x08,0x40,0x08,

0x2b,0x10,0x26,0x10,
0x39,0x08,0x40,0x08,0x39,0x08,0x40,0x08,

0x30,0x10,0x33,0x10,0x39,0x10,0x40,0x10,
       
0x2b,0x10,0x26,0x10,
0x39,0x08,0x40,0x08,0x39,0x08,0x40,0x08,

0x2b,0x10,0x26,0x10,
0x39,0x08,0x40,0x08,0x39,0x08,0x40,0x08,
                               
0x2b,0x10,0x26,0x10,0x20,0x10,0x18,0x10,
0x19,0x08,0x18,0x08,0x19,0x08,0x1c,0x08,
0x20,0x10,0x26,0x10,

  0x2b,0x10,0x26,0x10,
0x39,0x08,0x40,0x08,0x39,0x08,0x40,0x08,

0x2b,0x10,0x26,0x10,
0x39,0x08,0x40,0x08,0x39,0x08,0x40,0x08,

0x2b,0x10,0x26,0x10,
0x39,0x08,0x40,0x08,0x39,0x08,0x40,0x08,

0x30,0x10,0x33,0x10,0x39,0x10,0x40,0x10,



  0x39,0x10,
  0x40,0x08,0x39,0x08,0x30,0x10,
  0x39,0x08,0x30,0x08,0x2b,0x10,
  0x2b,0x08,0x26,0x08,0x20,0x08,
  0x18,0x08,0x26,0x08,0x20,0x08,
  0x18,0x10,0x19,0x08,0x18,0x08,
  0x19,0x08,0x1c,0x10,0x20,0x10,
  0x1c,0x10,0x20,0x10,0x1c,0x10,




                                          0xff,0xff,0xff,0xff ,


                                         0x00
};   


unsigned char code music_tab1 [] = { 0xff,    0x18,0x08,0x15,0x10,0x13,0x10,
0x1c,0x08,0x20,0x08,0x1c,0x08,0x20,0x08,
  0x15,0x10,0x13,0x10,
0x1c,0x08,0x20,0x08,0x1c,0x08,0x20,0x08,
  0x15,0x10,0x13,0x10,
0x1c,0x08,0x20,0x08,0x1c,0x08,0x20,0x08,                       
  0x18,0x10,0x19,0x10,0x1c,0x10,0x20,0x10,
   0x15,0x10,0x13,0x10,
0x1c,0x08,0x20,0x08,0x1c,0x08,0x20,0x08,
  0x15,0x10,0x13,0x10,
0x1c,0x08,0x20,0x08,0x1c,0x08,0x20,0x08,
0x15,0x10,0x13,0x10,0x10,0x10,0x0c,0x10,
0x0d,0x08,0x0c,0x08,0x0d,0x08,0x0e,0x08,
0x10,0x10,0x13,0x10,
0x15,0x10,0x13,0x10,
0x1c,0x08,0x20,0x08,0x1c,0x08,0x20,0x08,
  0x15,0x10,0x13,0x10,
0x1c,0x08,0x20,0x08,0x1c,0x08,0x20,0x08,
  0x15,0x10,0x13,0x10,
0x1c,0x08,0x20,0x08,0x1c,0x08,0x20,0x08,
0x18,0x10,0x19,0x10,0x1c,0x10,0x20,0x10,


1 (极乐净土).zip

13.72 KB, 下载次数: 57, 下载积分: 黑币 -5

回复

使用道具 举报

ID:396815 发表于 2019-6-17 09:42 | 显示全部楼层
只是一部分,全部还在文件里面
回复

使用道具 举报

ID:558859 发表于 2019-6-22 21:54 | 显示全部楼层
没有下载就扣除黑币了
回复

使用道具 举报

ID:396815 发表于 2019-12-10 14:26 | 显示全部楼层
qysj22 发表于 2019-6-22 21:54
没有下载就扣除黑币了

有的,没有的话点击链接就可以了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表