91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 6KB
    文件類型: .c
    金幣: 1
    下載: 0 次
    發布日期: 2021-08-23
  • 語言: 其他
  • 標簽:

資源簡介

51單片機數字音樂盒制作,上傳c語音源代碼,proteus仿真圖。實現多首歌曲播放,LCD1602,開機顯示畫面,播放歌曲同時動態顯示,led燈隨音符閃動。

資源截圖

代碼片段和文件信息

						?/*	名稱:數字音樂盒LCD1602字符液晶滾動演示程
*/
#include
#include
#define?uchar?unsigned?char?
#define?uint?unsigned?int
void?Initialize_LCD();
void?DelayMS(uint?ms);
void?ShowString(ucharucharuchar?*);
void?ShowChar(uchar?xuchar?yuchar?z);
sbit?K1=P2^5;
sbit?K2=P2^4;
sbit?K4=P2^6;
sbit?K3=P2^7;
sbit?SPK=P2^3; //蜂鳴器
uchar?Song_Index=0Tone_Index=0k=0t1=0t2=0t3=0;//當前音樂段索引,音符索引節拍變量
//標準音符頻率對應的延時表
uchar?code?Led[]={0x3f0x1f0x0f0x070x030x010x00};
uchar?code?HI_LIST[]={0226229232233236238240241242244245246247248};
uchar?code?LO_LIST[]={04131020386223526143};
uchar?code?Time0[]=“00:00:00“;
uchar?code?Time1[]=“0123456789“;
uchar?code?Xuhao[][30]={“1.<>““2.the?second?song““3.last?song.“};
uchar?const?Line_Count=3; ??//待滾動顯示的信息段落,每行不超過80個字符,共6行
uchar?code?Msg[][80]=“Welcom?you!?nowlet‘s?press?K1?to?begin.?“;

//三段音樂的音符
uchar?code?Song[][100]=
{
{05334221234555533422135512222234333336553342213551-1}
{01515216651215151611165611232212255332311655323212212255332311165532321221223321621355556532165231-1}
{012311231345345565431565431151151-1}
};
//三段音樂的節拍
uchar?code?Jiepai[][100]=
{
{03111121111211212111111111111111111111111111111111-1}
{02222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222}
{0222222222222222222222222222222}
};
??//定時器1中斷函數
void?T1_INT()?interrupt?3
{
TL1=LO_LIST[Song[Song_Index][Tone_Index]];
TH1=HI_LIST[Song[Song_Index][Tone_Index]];
SPK=~SPK;
}
//定時器0中斷函數
void?T0_jp()?interrupt?1?
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
k++;
t1++;
if(k>5*Jiepai[Song_Index][Tone_Index])
{
k=0;
Tone_Index++;
P1=Led[Song[Song_Index][Tone_Index]%7];
if(Song[Song_Index][Tone_Index]==-1)
Tone_Index=0;
}
}
//鍵盤掃描
? void?KeyScan()
{
if(K1==0)
{
? DelayMS(100);
if(K1==0)
{
??TR0=!TR0;
??TR1=!TR1;
??
}
}
if(K2==0&&TR0==1)
{
? DelayMS(100);
? if(K2==0)
{
? TR0=0;
TR1=0; //播放結束或者播放中途切換歌曲時停止播放
Song_Index=(Song_Index+1)%3; //跳到下一首的開頭
Tone_Index=0;
DelayMS(500);
TR0=1;
TR1=1;
t1=0;
t2=0;
t3=0;?
}
}
if(TR0==1)
{
//ShowString(00Xuhao[Song_Index]);
??if(t1==19)

評論

共有 條評論