基于AT89S52單片機(jī)的多模式帶音樂(lè)跑馬燈設(shè)計(jì)實(shí)訓(xùn)報(bào)告_第1頁(yè)
基于AT89S52單片機(jī)的多模式帶音樂(lè)跑馬燈設(shè)計(jì)實(shí)訓(xùn)報(bào)告_第2頁(yè)
基于AT89S52單片機(jī)的多模式帶音樂(lè)跑馬燈設(shè)計(jì)實(shí)訓(xùn)報(bào)告_第3頁(yè)
基于AT89S52單片機(jī)的多模式帶音樂(lè)跑馬燈設(shè)計(jì)實(shí)訓(xùn)報(bào)告_第4頁(yè)
基于AT89S52單片機(jī)的多模式帶音樂(lè)跑馬燈設(shè)計(jì)實(shí)訓(xùn)報(bào)告_第5頁(yè)
已閱讀5頁(yè),還剩13頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、-實(shí)訓(xùn)課題基于AT89S52單片機(jī)的多模式帶音樂(lè)跑馬燈設(shè)計(jì)一、實(shí)訓(xùn)目的及要求(1)通過(guò)實(shí)訓(xùn),理解與掌握單片機(jī)系統(tǒng)的開(kāi)發(fā)流程及常見(jiàn)系統(tǒng)的開(kāi)發(fā)設(shè)計(jì)、仿真調(diào)試等,培養(yǎng)一定的單片機(jī)設(shè)計(jì)與開(kāi)發(fā)能力。(2)掌握按鍵電路的設(shè)計(jì)。(3)掌握單片機(jī)復(fù)位電路和晶振電路的工作原理及設(shè)計(jì)。(4)掌握和了解+5V電源原理設(shè)計(jì)。(5)了解單片機(jī)C語(yǔ)言及程序設(shè)計(jì)。(6)對(duì)Keil C51和Proteus 7軟件進(jìn)展熟練的掌握和操作。二、實(shí)訓(xùn)設(shè)備和元器件裝有Proteus、Keil C軟件的PC機(jī)一臺(tái),AT89S52單片機(jī)一塊,12MHZ晶振,電容,電解電容,電阻,16個(gè)發(fā)光二級(jí)管,按鍵,三極管,74LS245集成塊,LED

2、數(shù)碼管,+5V電源,印制板。三、實(shí)訓(xùn)任務(wù)及功能要求(1)有16個(gè)發(fā)光二極管做跑馬燈,其中跑馬燈有10種亮燈模式。(2)有專(zhuān)門(mén)的按鍵用以切換跑馬燈的模式,并且對(duì)于任何一種跑馬燈模式都可以對(duì)亮燈速度進(jìn)展控制。(3)每一種跑馬燈模式用LED數(shù)碼管進(jìn)展顯示。(4)當(dāng)跑馬燈處于一種模式時(shí),伴隨的音樂(lè)響起,音樂(lè)至少有3首,并可以對(duì)其進(jìn)展切換。四、系統(tǒng)硬件電路1、系統(tǒng)硬件框圖基于AT89S52單片機(jī)的多模式帶音樂(lè)跑馬燈控制系統(tǒng)由電源電路、單片機(jī)主控電路、模式切換以及調(diào)速按鍵控制電路、LED數(shù)碼管顯示電路和16個(gè)發(fā)光二級(jí)管的跑馬燈電路幾局部組成,系統(tǒng)框圖如圖1-1所示:電源電路AT89S1單片機(jī)復(fù)位電路晶振電

3、路LED數(shù)碼管顯示電路16個(gè)發(fā)光二極管做跑馬燈模式切換按鍵以及速度調(diào)節(jié)按鍵圖1-1 基于AT89S52單片機(jī)的多模式帶音樂(lè)跑馬燈控制系統(tǒng)框圖2、系統(tǒng)電路原理圖本工程用AT89S52單片機(jī)的P1,P2口分別控制8個(gè)跑馬燈,而P3口與LED數(shù)碼管相連,音樂(lè)采用蜂鳴器接P2.6輸出,P2.1接模式鍵切換按鍵,P2.4和P2.5分別接跑馬燈加速和減速按鍵,在音樂(lè)播放時(shí)加速與減速按鍵可以控制音樂(lè)的切換。綜上所述,可設(shè)計(jì)出基于AT89S52單片機(jī)的多模式帶音樂(lè)跑馬燈,電路原理圖如圖1-2所示:圖1-2 基于AT89S52單片機(jī)的多模式帶音樂(lè)跑馬燈原理圖五、系統(tǒng)控制軟件1、控制流程圖該程序采用兩個(gè)程序編寫(xiě):

4、第一個(gè)為單片機(jī)主程序,作用是使單片機(jī)完成相應(yīng)上電功能;第二個(gè)為音樂(lè)產(chǎn)生程序,在第一個(gè)程序中包含第二個(gè)程序的頭文件。程序流程圖如圖1-3所示:. z-YNNYI/O初始化模式鍵被按下.模式加1,等于9.送LED與跑馬燈開(kāi)場(chǎng)完畢播放音樂(lè)YYNN設(shè)定跑馬燈初速檢查按鍵開(kāi)關(guān)減少時(shí)間,使跑馬燈加速增加時(shí)間,使跑馬燈減速LED跑馬燈加速鍵被按下.減速減被按下.(a)主程序 (b) 音樂(lè)產(chǎn)生程序. z-圖1-3 程序流程圖2、系統(tǒng)源程序C或匯編*include <REG52.H>*include <SoundPlay.h>unsigned char RunMode;void Dela

5、y1ms (unsigned int count) unsigned int i,j; for(i=0;j<count;i+) for(j=0;j<1200;j+);unsigned char code LEDDisplayCode= 0*C0,0*F9,0*A4,0*B0,0*99,0*92,0*82,0*F8, 0*80,0*90,0*88,0*83,0*C6,0*A1,0*86,0*8E, 0*FF;void Display(unsigned char Value) P3=LEDDisplayCodeValue; void LEDflash(unsigned char cou

6、nt) unsigned char i; bit Flag; for(i=0;i<count;i+) Flag=!Flag; if(Flag) Display(RunMode); else Display(0*10); Delay1ms(100); Display(RunMode); unsigned char GetKey(void) unsigned char KeyTemp,CheckValue,Key=0*00; CheckValue=P2&0*32; if(CheckValue=0*32) return 0*00; Delay1ms(10); KeyTemp=P2&am

7、p;0*32; if(KeyTemp=CheckValue) return 0*00; if(!(CheckValue&0*02) Key |=0*01 ; if(!(CheckValue&0*10) Key |=0*02 ; if(!(CheckValue&0*20) Key |=0*04; return Key;unsigned int Timer0Count,SystemSpeed,SystemSpeedInde*;void InitialTimer2(void) T2CON=0*00; TH2=RCAP2H=0*FC; ET2=1; TR2=1; EA=1;Un

8、signedint code SpeedCode=1,2,3,5,8,10,14,17,20,30,40,50,60,70,80,90,100,120,140,160,180,200,300,400,500,600,700,800,900,1000;void SetSpeed(unsigned char Speed) SystemSpeed=SpeedCodeSpeed;void LEDShow(unsigned int LEDStatus) P1= (LEDStatus&0*00FF); P0= (LEDStatus>>8)&0*00FF);void Initia

9、lCPU(void) RunMode=0*00; Timer0Count=0; SystemSpeedInde*=22; P1=0*00; P0=0*00; P2=0*FF; P3=0*00; Delay1ms(500); P1=0*FF; P0=0*FF; P2=0*FF; P3=0*FF; SetSpeed(SystemSpeedInde*); Display(RunMode);unsigned int LEDinde*=0;bit LEDDirection=1,LEDflag=1;void mode_0(void) LEDShow(0*0001<<LEDinde*); LED

10、inde*=(LEDinde*+1)%16;void mode_1(void) LEDShow(0*8000>>LEDinde*); LEDinde*=(LEDinde*+1)%16;void mode_2(void) if(LEDDirection) LEDShow(0*0001<<LEDinde*); else LEDShow(0*8000>>LEDinde*); if(LEDinde*=15) LEDDirection=!LEDDirection; LEDinde*=(LEDinde*+1)%16;void mode_3(void) if(LEDDir

11、ection) LEDShow(0*0001<<LEDinde*); else LEDShow(0*8000>>LEDinde*); if(LEDinde*=15) LEDDirection = !LEDDirection; LEDinde*=(LEDinde*+1)%16;void mode_4(void) if(LEDDirection) if(LEDflag) LEDShow(0*FFFE<<LEDinde*); else LEDShow(0*7FFF>>LEDinde*);else if(LEDflag) LEDShow(0*7FFF&g

12、t;>LEDinde*); else LEDShow(0*FFFE<<LEDinde*);if(LEDinde*=15) LEDDirection=!LEDDirection; if(LEDDirection) LEDflag=!LEDflag;LEDinde*=(LEDinde*+1)%16;void mode_5(void) if(LEDDirection) LEDShow(0*000F<<LEDinde*); else LEDShow(0*F000>>LEDinde*); if(LEDinde*=15) LEDDirection = !LEDDi

13、rection; LEDinde*=(LEDinde*+1)%16;void mode_6(void) if(LEDDirection) LEDShow(0*000F<<LEDinde*); else LEDShow(0*F000>>LEDinde*); if(LEDinde*=15)LEDDirection=!LEDDirection; LEDinde*=(LEDinde*+1)%16;void mode_7(void) if(LEDDirection) LEDShow(0*003F<<LEDinde*); else LEDShow(0*FC00>&

14、gt;LEDinde*); if(LEDinde*=9) LEDDirection=!LEDDirection; LEDinde*=(LEDinde*+1)%10;void mode_8(void) LEDShow(+LEDinde*);void Timer0EventRun(void) if(RunMode=0*00) mode_0( ); else if(RunMode=0*01) mode_1(); else if(RunMode=0*02) mode_2(); else if(RunMode=0*03) mode_3();else if(RunMode=0*04) mode_4();

15、else if(RunMode=0*05) mode_5(); else if(RunMode=0*06) mode_6(); else if(RunMode=0*07) mode_7(); else if(RunMode=0*08) mode_8();void timer2(void) interrupt 5 using 3 TF2=0; if(+Timer0Count>=SystemSpeed) Timer0Count=0; Timer0EventRun(); unsigned char MusicInde*=0;void keydispose(unsigned char key)

16、if(key&0*01) LEDDirection=1; LEDinde*=0; LEDflag=1; RunMode=(RunMode+1)%10; Display(RunMode); if(RunMode=0*09) TR2=0; else TR2=1; if(key&0*02) if(RunMode=0*09)MusicInde*=(MusicInde*+MUSIUMBER-1)%MUSIUMBER; else if(SystemSpeedInde*>0) -SystemSpeedInde*; SetSpeed(SystemSpeedInde*); elseLEDf

17、lash(6); if(key&0*04) if(RunMode=0*09|0*08|0*07|0*06|0*05|0*04|0*03|0*02|0*01|0*00) MusicInde*=(MusicInde*+1)%MUSIUMBER; else if(SystemSpeedInde*<28) +SystemSpeedInde*; SetSpeed(SystemSpeedInde*); elseLEDflash(6); unsigned char code Music_Girl= 0*17,0*02, 0*17,0*03, 0*18,0*03, 0*19,0*02, 0*15

18、,0*03, 0*16,0*03, 0*17,0*03, 0*17,0*03, 0*17,0*03, 0*18,0*03, 0*19,0*02, 0*16,0*03, 0*17,0*03, 0*18,0*02, 0*18,0*03, 0*17,0*03, 0*15,0*02, 0*18,0*03, 0*17,0*03, 0*18,0*02, 0*10,0*03, 0*15,0*03, 0*16,0*02, 0*15,0*03, 0*16,0*03, 0*17,0*02, 0*17,0*03, 0*18,0*03, 0*19,0*02, 0*1A,0*03, 0*1B,0*03, 0*1F,0*

19、03, 0*1F,0*03, 0*17,0*03, 0*18,0*03, 0*19,0*02, 0*16,0*03, 0*17,0*03, 0*18,0*03, 0*17,0*03, 0*18,0*03, 0*1F,0*03, 0*1F,0*02, 0*16,0*03, 0*17,0*03, 0*18,0*03, 0*17,0*03, 0*18,0*03, 0*20,0*03, 0*20,0*02, 0*1F,0*03, 0*1B,0*03, 0*1F,0*66, 0*20,0*03, 0*21,0*03, 0*20,0*03, 0*1F,0*03, 0*1B,0*03, 0*1F,0*66,

20、 0*1F,0*03, 0*1B,0*03, 0*19,0*03, 0*19,0*03, 0*15,0*03, 0*1A,0*66, 0*1A,0*03, 0*19,0*03, 0*15,0*03, 0*15,0*03, 0*17,0*03, 0*16,0*66, 0*17,0*04, 0*18,0*04, 0*18,0*03, 0*19,0*03, 0*1F,0*03, 0*1B,0*03, 0*1F,0*66, 0*20,0*03, 0*21,0*03, 0*20,0*03, 0*1F,0*03, 0*1B,0*03, 0*1F,0*66, 0*1F,0*03, 0*1B,0*03, 0*

21、19,0*03, 0*19,0*03, 0*15,0*03, 0*1A,0*66, 0*1A,0*03, 0*19,0*03, 0*19,0*03, 0*1F,0*03, 0*1B,0*03, 0*1F,0*00, 0*1A,0*03, 0*1A,0*03, 0*1A,0*03, 0*1B,0*03, 0*1B,0*03, 0*1A,0*03, 0*19,0*03, 0*19,0*02, 0*17,0*03, 0*15,0*17, 0*15,0*03, 0*16,0*03, 0*17,0*03, 0*18,0*03, 0*17,0*04, 0*18,0*0E, 0*18,0*03, 0*17,

22、0*04, 0*18,0*0E, 0*18,0*66, 0*17,0*03, 0*18,0*03, 0*17,0*03, 0*18,0*03, 0*20,0*03, 0*20,0*02, 0*1F,0*03, 0*1B,0*03, 0*1F,0*66, 0*20,0*03, 0*21,0*03, 0*20,0*03, 0*1F,0*03, 0*1B,0*03, 0*1F,0*66, 0*1F,0*04, 0*1B,0*0E, 0*1B,0*03, 0*19,0*03, 0*19,0*03, 0*15,0*03, 0*1A,0*66, 0*1A,0*03, 0*19,0*03, 0*15,0*0

23、3, 0*15,0*03, 0*17,0*03, 0*16,0*66, 0*17,0*04, 0*18,0*04, 0*18,0*03, 0*19,0*03, 0*1F,0*03, 0*1B,0*03, 0*1F,0*66, 0*20,0*03, 0*21,0*03, 0*20,0*03, 0*1F,0*03, 0*1B,0*03, 0*1F,0*66, 0*1F,0*03, 0*1B,0*03, 0*19,0*03, 0*19,0*03, 0*15,0*03, 0*1A,0*66, 0*1A,0*03, 0*19,0*03, 0*19,0*03, 0*1F,0*03, 0*1B,0*03,

24、0*1F,0*00, 0*18,0*02, 0*18,0*03, 0*1A,0*03, 0*19,0*0D, 0*15,0*03, 0*15,0*02, 0*18,0*66, 0*16,0*02, 0*17,0*02, 0*15,0*00, 0*00,0*00;unsigned char code Music_Same= 0*0F,0*01,0*15,0*02,0*16,0*02,0*17,0*66,0*18,0*03, 0*17,0*02,0*15,0*02,0*16,0*01,0*15,0*02,0*10,0*02, 0*15,0*00,0*0F,0*01,0*15,0*02,0*16,0

25、*02,0*17,0*02, 0*17,0*03,0*18,0*03,0*19,0*02,0*15,0*02,0*18,0*66, 0*17,0*03,0*19,0*02,0*16,0*03,0*17,0*03,0*16,0*00, 0*17,0*01,0*19,0*02,0*1B,0*02,0*1B,0*70,0*1A,0*03, 0*1A,0*01,0*19,0*02,0*19,0*03,0*1A,0*03,0*1B,0*02, 0*1A,0*0D,0*19,0*03,0*17,0*00,0*18,0*66,0*18,0*03, 0*19,0*02,0*1A,0*02,0*19,0*0C,

26、0*18,0*0D,0*17,0*03, 0*16,0*01,0*11,0*02,0*11,0*03,0*10,0*03,0*0F,0*0C, 0*10,0*02,0*15,0*00,0*1F,0*01,0*1A,0*01,0*18,0*66, 0*19,0*03,0*1A,0*01,0*1B,0*02,0*1B,0*03,0*1B,0*03,0*1B,0*0C,0*1A,0*0D,0*19,0*03,0*17,0*00,0*1F,0*01,0*1A,0*01,0*18,0*66,0*19,0*03,0*1A,0*01,0*10,0*02,0*10,0*03,0*10,0*03,0*1A,0*

27、0C,0*18,0*0D,0*17,0*03,0*16,0*00,0*0F,0*01,0*15,0*02,0*16,0*02,0*17,0*70, 0*18,0*03,0*17,0*02,0*15,0*03,0*15,0*03,0*16,0*66,0*16,0*03,0*16,0*02,0*16,0*03,0*15,0*03,0*10,0*02, 0*10,0*01,0*11,0*01,0*11,0*66,0*10,0*03,0*1F,0*0C,0*1A,0*02,0*19,0*02,0*16,0*03,0*16,0*03,0*18,0*66,0*18,0*03,0*18,0*02,0*17,

28、0*03,0*16,0*03,0*19,0*00,0*00,0*00;unsigned char code Music_Two= 0*17,0*03,0*16,0*03,0*17,0*01,0*16,0*03,0*17,0*03,0*16,0*03,0*15,0*01,0*10,0*03,0*15,0*03,0*16,0*02, 0*16,0*0D,0*17,0*03,0*16,0*03,0*15,0*03,0*10,0*03,0*10,0*0E,0*15,0*04,0*1F,0*01,0*17,0*03,0*16,0*03, 0*17,0*01,0*16,0*03,0*17,0*03,0*1

29、6,0*03,0*15,0*01,0*10,0*03,0*15,0*03,0*16,0*02,0*16,0*0D,0*17,0*03,0*16,0*03,0*15,0*03,0*10,0*03,0*15,0*03,0*16,0*01,0*17,0*03,0*16,0*03,0*17,0*01,0*16,0*03,0*17,0*03,0*16,0*03,0*15,0*01,0*10,0*03,0*15,0*03,0*16,0*02, 0*16,0*0D,0*17,0*03,0*16,0*03,0*15,0*03,0*10,0*03,0*10,0*0E,0*15,0*04,0*0F,0*01,0*

30、17,0*03,0*19,0*03, 0*19,0*01,0*19,0*03,0*1A,0*03,0*19,0*03,0*17,0*01,0*16,0*03,0*16,0*03,0*16,0*02,0*16,0*0D,0*17,0*03, 0*16,0*03,0*15,0*03,0*10,0*03,0*10,0*0d,0*15,0*00,0*19,0*03,0*19,0*03,0*1A,0*03,0*1F,0*03,0*1B,0*03, 0*1B,0*03,0*1A,0*03,0*17,0*0D,0*16,0*03,0*16,0*03,0*16,0*0D,0*17,0*01,0*17,0*03

31、,0*17,0*03,0*19,0*03,0*1A,0*02,0*1A,0*02,0*10,0*03,0*17,0*0D,0*16,0*03,0*16,0*01,0*17,0*03,0*19,0*03,0*19,0*03,0*17,0*03, 0*19,0*02,0*1F,0*02,0*1B,0*03,0*1A,0*03,0*1A,0*0E, 0*1B,0*04,0*17,0*02,0*1A,0*03,0*1A,0*03,0*1A,0*0E, 0*1B,0*04,0*1A,0*03,0*19,0*03,0*17,0*03,0*16,0*03,0*17,0*0D,0*16,0*03,0*17,0

32、*03,0*19,0*01,0*19,0*03, 0*19,0*03,0*1A,0*03,0*1F,0*03,0*1B,0*03,0*1B,0*03, 0*1A,0*03,0*17,0*0D,0*16,0*03,0*16,0*03,0*16,0*03,0*17,0*01,0*17,0*03,0*17,0*03,0*19,0*03,0*1A,0*02,0*1A,0*02,0*10,0*03,0*17,0*0D,0*16,0*03,0*16,0*01,0*17,0*03,0*19,0*03,0*19,0*03,0*17,0*03,0*19,0*03,0*1F,0*02,0*1B,0*03,0*1A

33、,0*03,0*1A,0*0E,0*1B,0*04,0*17,0*02,0*1A,0*03,0*1A,0*03,0*1A,0*0E,0*1B,0*04,0*17,0*16,0*1A,0*03,0*1A,0*03,0*1A,0*0E,0*1B,0*04,0*1A,0*03,0*19,0*03,0*17,0*03,0*16,0*03,0*1F,0*02,0*10,0*03,0*15,0*00,0*00,0*00;unsigned char*SelectMusic (unsigned char SoundInde*) unsigned char*MusicAddress=0; switch (Sou

34、ndInde*) case 0*00:MusicAddress=&Music_Girl0; break; case 0*01:MusicAddress=&Music_Same0; break; case 0*02:MusicAddress=&Music_Two0; break; case 0*03:break; case 0*04:break; case 0*05:break; case 0*06:break; case 0*07:break; case 0*08:break; case 0*09:break; default:break;return MusicAdd

35、ress;void playmusic(void) Delay1ms(200);Play(SelectMusic(MusicInde*),0,3,360);main( )unsigned char key;InitialCPU();InitialSound();InitialTimer2();while(1)key=GetKey();if(RunMode=0*09) playmusic(); if(key!=0*00) KeyDispose(key); 音樂(lè)產(chǎn)生程序清單如下:*ifndef _SOUNDPLAY_H_REVISION_FIRST_*define _SOUNDPLAY_H_REV

36、ISION_FIRST_*define SYSTEM_OSC 6000000*define SOUND_SPACE 4/5*define MUSIUMBER 3sbit BeepIo=P26;e*tern void LEDShow(unsigned int LEDStatus);e*tern unsigned char GetKey(void);e*tern void KeyDispose(unsigned char Key);e*tern void Delay1ms(unsigned int count);e*tern unsigned char MusicInde*;unsignedint

37、 code FreTab12=262,277,294,311,330,349,369,392,415,440,466,494;unsigned char code SignTab7=0,2,4,5,7,9,11;unsigned char code LengthTab7=1,2,4,8,16,32,64;unsigned char Sound_Temp_TH0,Sound_Temp_TL0;unsigned char Sound_Temp_TH1,Sound_Temp_TL1;void InitialSound(void) BeepIo=0; Sound_Temp_TH1=(65535-(1/

38、1200)*SYSTEM_OSC)/256; Sound_Temp_TL1=(65535-(1/1200)*SYSTEM_OSC)%256; TH1=Sound_Temp_TH1; TL1=Sound_Temp_TL1; TMOD|=0*11; ET0=1; ET1=0; TR0=0; TR1=0; EA=1;void BeepTimer0(void) interrupt 1BeepIo=!BeepIo;TH0=Sound_Temp_TH0;TL0=Sound_Temp_TL0;void Play(unsigned char*Sound,unsigned char Signature,unsi

39、gned Octachord,unsigned int Speed)unsigned int NewFreTab12;unsignedchar i,j;unsignedintPoint,LDiv,LDiv0,LDiv1,LDiv2,LDiv4,CurrentFre,Temp_T,SoundLength;unsigned char Tone,Length,SL,SH,SM,SLen,*G,FD,Key,LEDflash,OFFSet;for(i=0;i<12;i+)j=i+Signature;if(j>11)j=j-12;NewFreTabi=FreTabj*2;elseNewFre

40、Tabi=FreTabj;if(Octachord=1)NewFreTabi>>=2;else if(Octachord=3)NewFreTabi<<=2; SoundLength=0;while(SoundSoundLength!=0*00) SoundLength+=2;Point=0;Tone=SoundPoint;Length=SoundPoint+1;LDiv0=12000/Speed;LDiv4=LDiv0/4;LDiv4=LDiv4-LDiv4*SOUND_SPACE;TR0=0;TR1=1;while(Point<SoundLength) SL=T

41、one%10; SM=Tone/10%10; SH=Tone/100; LEDflash=SM*(SL/2)+1)+2; LEDShow(0*FFFE<<LEDflash); OFFSet=2; CurrentFre=NewFreTabSignTabSL-1+SH;if(SL!=0) if(SM=1)CurrentFre>>=2; if(SM=3)CurrentFre<<=2; Temp_T=65536-(50000/CurrentFre)*10/(12000000/SYSTEM_OSC); Sound_Temp_TH0=Temp_T/256; Sound_

42、Temp_TL0=Temp_T%256; TH0=Sound_Temp_TH0; TL0=Sound_Temp_TL0+6; SLen=LengthTabLength%10; *G=Length/10%10; FD=Length/100; LDiv=LDiv0/SLen; if(FD=1) LDiv=LDiv+LDiv/2; if(*G!=1) if(*G=0) if(SLen<=4) LDiv1=LDiv-LDiv4; else LDiv1=LDiv*SOUND_SPACE; else LDiv1=LDiv/2; else LDiv1=LDiv; if(SL=0)LDiv1=0; LD

43、iv2 = LDiv-LDiv1; if(SL!=0) TR0=1; for(i=LDiv1;i>0;i-) OFFSet=(OFFSet+1)%5; LEDShow(0*FFFE<<(LEDflash+OFFSet-2); while(TF1=0) Key=GetKey(); if(Key!=0*00) KeyDispose(Key); TR0=0; TR1=0; BeepIo=0; return; TH1=Sound_Temp_TH1; TL1=Sound_Temp_TL1; TF1=0; if(LDiv2!=0) TR0=0; BeepIo=0; for(i=LDiv2

44、;i>0;i-) OFFSet=(OFFSet+1)%5; LEDShow(0*FFFE<<(LEDflash+OFFSet-2); while(TF1=0) Key=GetKey(); if(Key!=0*00) KeyDispose(Key); TR0=0; TR1=0; BeepIo=0; return; TH1=Sound_Temp_TH1; TL1=Sound_Temp_TL1; TF1=0; Point+=2;Tone=SoundPoint;Length=SoundPoint+1;BeepIo=0;MusicInde*=(MusicInde*+1)%MUSIUMBER;LEDShow(0*0001);Delay1ms(300);*endif六、系統(tǒng)仿真、調(diào)試及運(yùn)行1、proteus的使用及系統(tǒng)仿真圖(1) 翻開(kāi)proteus軟件應(yīng)用。(2) 在應(yīng)用頁(yè)面中選擇元件模式,并在該模式中單擊“P按鈕,翻開(kāi)后在“關(guān)鍵字欄中輸入所需元件名稱(chēng),并添加到方框列表中。添加到方框中。如圖1-4所示:圖1-4 單擊P按鈕查找所需元器件(3) 在頁(yè)面上放置添加到方

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論