收藏 分享(赏)

原始代码.doc

上传人:j35w19 文档编号:8778207 上传时间:2019-07-11 格式:DOC 页数:8 大小:34.50KB
下载 相关 举报
原始代码.doc_第1页
第1页 / 共8页
原始代码.doc_第2页
第2页 / 共8页
原始代码.doc_第3页
第3页 / 共8页
原始代码.doc_第4页
第4页 / 共8页
原始代码.doc_第5页
第5页 / 共8页
点击查看更多>>
资源描述

1、原始代码.txt 等余震的心情,就像初恋的少女等情人,既怕他不来,又怕他乱来。 听说女人如衣服,兄弟如手足,回想起来,我竟然七手八脚地裸奔了二十多年!今天心情不好,我只有四句话想说,包括这句和前面的两句,我的话说完了!#include #include #define uchar unsigned char#define uint unsigned intchar code SST5163 _at_ 0x003b;uchar table17= 0x28,0x7e,0xa2,0x62,0x74,0x61,0x21,0x7a,0x20,0x60,0x30,0x25,0xa9,0x26,0xa1,0

2、xb1;/数码管代码uchar code song636= 0xFF,0xFF,4,0xFd,0x08,2,0xFd,0x08,2,0xFd,0x08,2,0xFd,0x08,2,0xFd,0x08,2,0xfd,0x08,2, /210xFD,0x5B,4,0xFD,0x08,2,0xFC,0xAB,2,0xFC,0x0B,2,0xFC,0x0B,2,0xff,0xff,2,0xFc,0x0B,2, /210xFC,0xAB,2,0xFC,0xAB,2,0xFC,0xAB,2,0xFC,0xAB,2,0xFC,0xAB,4,0xFC,0xAB,2,0xFC,0xAB,2, /210xFB,0

3、x8F,2,0xFC,0x0B,2,0xFC,0x0B,4,0xff,0xff,8,/120xff,0xff,2,0xFD,0x08,2,0xFD,0x08,2,0xFD,0x08,2,0xFD,0x08,4,0xFD,0x08,2,0xFD,0x08,2, /210xFD,0x5B,4,0xFD,0x08,2,0xFC,0xAB,4,0xFD,0x08,6, /120xff,0xff,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x03,2,0xFA,0x14,2, /240xFC,0xAB,4,0xF

4、C,0xAB,2,0xFC,0xAB,2,0xFC,0xAB,2,0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x08,4,0xFd,0x08,2, /210xfd,0x5b,4,0xfd,0x08,2,0xfc,0xab,4,0xfc,0x0b,6,/120x

8、FF,0xFF,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x03,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x03,2, /240xFC,0x0B,4,0xFB,0x8F,2,0xFC,0x0B,2,0xFB,0x03,2,0xfa,0x14,2,0xfa,0x14,4,/180xff,0xff,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x03,2,0xFA,0x14,2, /240xfb,0x03,2,0xfb,0x03,2,0xf

9、b,0x03,2,0xfa,0x14,2,0xfa,0x14,1,0xf9,0x5b,1,0xf8,0x2a,2,0xf8,0x2a,4, /240xff,0xff,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x03,2,0xFA,0x14,2, /240xfb,0x8f,2,0xfc,0x08,2,0xfc,0x08,2,0xfc,0x08,10,/120xff,0xff,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xF

10、B,0x03,2,0xFA,0x14,2, /240xfb,0x03,2,0xfb,0x03,2,0xfb,0x03,2,0xfa,0x14,2,0xfa,0x14,1,0xf9,0x5b,1,0xf8,0x2a,2,0xf8,0x2a,4, /24,2070xff,0xff,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x8F,2,0xFB,0x03,2,0xFA,0x14,2, /240xfc,0xab,2,0xfd,0x08,2,0xfd,0x08,2,0xfd,0x08,2,0xff,0xff,4,0xff,0xff,4

11、;/18,42,636uchar tone=108, 102, 91, 86, 77, 68, 61, 57;sbit BEEP = P37; /蜂鸣器驱动线uchar dis_buf; /显示缓存uchar temp;uchar key; /键顺序吗void beep(); /蜂鸣器void delay0(uchar x); /x*0.14MSvoid sound(uchar x);void delay8us(uchar x);void gge1();void delayms(unsigned char ms);/-/* 延时子程序*/void delay(uchar x) uchar j;

12、while(x-)!=0) for(j=0;j4)|0xF0);if(temp=1)key=key+0;else if(temp=2)key=key+4;else if(temp=4)key=key+8;else if(temp=8)key=key+12;elsekey=16;dis_buf=tablekey; /查表得键值/-/*判断键是否按下*/void keydown(void) P1=0xF0;if(P1!=0xF0)keyscan();beep();/ while(P1!=0xF0); /等待键释放 /-void beep()uchar keys;while(1)if(key=1)s

13、ound(0); else if(key=2)sound(2); else if(key=3)sound(3); else if(key=4)sound(4); else if(key=5)sound(5); else if(key=6)sound(6); else if(key=7)sound(7); else if(key=8)/?void sound(uchar x) char i;for(i=0;i60;i+) beep=1;delay8us(tonex);beep=0;delay8us(tonex); /延迟函数void delay8us(uchar x) uchar i,j;for

14、(i=0;ix;i+)for(j=0;j1;j+);/-/放歌子程序 1void gge1() unsigned int data j;TMOD = 0x01;IE = 0x82;while(1) j=0;while (j636) TR0=1;if (songj=0xff)/休止符用0xff,0xff 表示,出现休止符时 CT0 禁止,不发声.delayms(songj+2); /每一音符唱多长.j=j+3;void timer0() interrupt 1 using 1 /每一音符唱多高 TH0=songj;TL0=songj+1;beep = !beep;void delayms(unsigned char ms) /基本延时子程序(16 分之 1 拍的时间) unsigned int i;while(ms-)for(i = 0; i 20300; i+);TR0=0;/-/放歌子程序 2/-void delay0(uchar x) /x*0.14MSunsigned char i;while(x-)for (i = 0; i13; i+) /- main()P0=0xFF; /置 P0 口P2=0xFF; /置 P2 口 dis_buf=0xBF;while(1) keydown();P0 = dis_buf; /键值送显示delay(2);P2 = 0x7F; /-

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报