单片机生日快乐歌(带流水灯)程序

来源:本站
导读:目前正在解读《单片机生日快乐歌(带流水灯)程序》的相关信息,《单片机生日快乐歌(带流水灯)程序》是由用户自行发布的知识型内容!下面请观看由(电工技术网 - www.9ddd.net)用户发布《单片机生日快乐歌(带流水灯)程序》的详细说明。
简介:在这里和大家分享一个单片机生日快乐歌(带流水灯)的程序。

#include<reg52.h>#define uchar unsigned char#define uint unsigned intsbit P32=P3^3;uchar i,j,time1,time2;uint code array1[]={     400,400,650,650,650,1200,     400,400,650,650,650,1200,     400,400,650,650,650,650,1200,     400,400,650,650,650,1200     };uchar code array[]={     0xfd,0x79,0xfd,0x79,0xfd,0xc7,0xfd,0x79,0xfe,0x21,0xfe,0x05,        0xfd,0x79,0xfd,0x79,0xfd,0xc7,0xfd,0x79,0xfe,0x51,0xfe,0x21,      0xfd,0x79,0xfd,0x79,0xfe,0xc0,0xfe,0x84,0xfe,0x21,0xfe,0x05,0xfd,0xc7,     0xfe,0x99,0xfe,0x99,0xfe,0x90,0xfe,0x21,0xfe,0x51,0xfe,0x21     }; uchar code LED[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};void delay(uint m){    uint n; for(;m>0;m--)  for(n=80;n>0;n--);} void main(){ uint a=0; TMOD=0x01; TH0=0; TL0=0; EA=1; ET0=1; TR0=1; while(1) {  if(a==8)      {a=0;}  time1=array[i++];  time2=array[i++];  if(i==50)   i=0;   P1=LED[a];   a++;  delay(array1[j++]);  P0=1;  if(j==25)  { j=0;}   }}void init() interrupt 1{ TR0=0; P32=~P32; TH0=time1; TL0=time2; TR0=1;}

提醒:《单片机生日快乐歌(带流水灯)程序》最后刷新时间 2024-03-14 00:58:17,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《单片机生日快乐歌(带流水灯)程序》该内容的真实性请自行鉴别。