嵌入式簡(jiǎn)易電子琴系統(tǒng)設(shè)計(jì)._第1頁
嵌入式簡(jiǎn)易電子琴系統(tǒng)設(shè)計(jì)._第2頁
嵌入式簡(jiǎn)易電子琴系統(tǒng)設(shè)計(jì)._第3頁
嵌入式簡(jiǎn)易電子琴系統(tǒng)設(shè)計(jì)._第4頁
嵌入式簡(jiǎn)易電子琴系統(tǒng)設(shè)計(jì)._第5頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、嵌入式開發(fā)試驗(yàn)嵌入式簡(jiǎn)易電子琴系統(tǒng)設(shè)計(jì)LED顯示屏、LED燈模塊(帶ARM2110實(shí)驗(yàn)開發(fā)板,外接矩陣鍵盤、蜂鳴器、4.7K電阻)主程序 #i nclude "systemI nit.h"#in elude "buzzer.h" #i nclude "music.h" #i nclude "system Ini t.h"#defi ne lcde n GPIO_PIN_0 /PB0;#defi ne lcdrs GPIO_PIN_2/定義LED #defi ne LED1 _PERIPH#defi ne LED1_

2、PORT#defi ne LED1 _PIN#defi ne LED2_ PERIPH#defi ne LED2_ PORT#defi ne LED2_PIN#defi ne LED3_ PERIPH#defi ne LED3_ PORT#defi ne LED3_ PIN#defi ne LED4_ PERIPH#defi ne LED4_ PORT#defi ne LED4_PIN#defi ne LED5_ PERIPH#defi ne LED5_ PORT#defi ne LED5_ PIN#defi ne LED6_ PERIPH#defi ne LED6_ PORT#defi ne

3、 LED6_ PIN#defi ne LED7_ PERIPH#defi ne LED7_ PORT#defi ne LED7_ PIN#defi ne LED8_ PERIPH#defi ne LED8_ PORT#defi ne LED8_ PIN/定義KEY #define KEY PERIPH2 #define KEY P0RT2 #define KEY PIN2 /P B2; SYSCTL_ PERIPH_GPIOA GPIO_P ORTA_BASE GPI0_PIN_4SYSCTL PERIPH GPIOAGPIO PORTA BASEGPIO PIN 5SYSCTL_ PERIP

4、H_GPIOA GPIO_P ORTA_BASE GPIO_PIN_6SYSCTL_ PERIPH_GPIOG GPIO_P ORTG_BASE GPIO_PIN_0SYSCTL PERIPH GPIOFGPIO PORTF BASEGPIO PIN 2SYSCTL_ PERIPH_GPIOG GPIO_P ORTG_BASE GPIO_PIN_1SYSCTL PERIPH GPI OEG PIO P ORTE BASEG PIO PIN 0SYSCTL_ PERIPH_GPIOE GPIO_P ORTE_BASE GPIO_PIN_1SYSCTL PERIPH GPI OBG PIO P O

5、RTB BASEGPIO_PIN _6|G PIO_PIN _5|G PIO_PIN_4連接方式矩陣鍵盤的行線接PC47列線接PA03un sig ned char data; /PD0-PD7;un sig ned char num;int gua n;int jia n;int numm;/lcd顯示模塊技術(shù) /lcd模塊 void write_com(u nsig ned char com) /寫命令GPIOPin Write(G PIO_P ORTB_BASE,lcdrs,0x00); / lcdrs=0;GPIOPin Write(G PIO_P ORTD_BASE,G PIO_PI

6、N _0|G PIO_PIN _1|G PIO_PIN_2|GPIO_PIN _3|G PIO_PIN _4|G PIO_PIN _5|G PIO_PIN _6|G PIO_PIN _7,com);/ PD=com;SysCtlDelay(5 * (TheSysClock / 4000); / 延時(shí) 5ms void write_data( un sig ned char date)GPIOPin Write(G PIO_P ORTB_BASE,lcdrs,0xFF); / lcdrs=1;GPIOPin Write(G PIO_P ORTD_BASE,G PIO_PIN _0|G PIO_P

7、IN _1|G PIO_PIN_2|GPIO_PIN _3|G PIO_PIN _4|G PIO_PIN _5|G PIO_PIN _6|G PIO_PIN _7,date);/ PD=date;SysCtlDelay(5 * (TheSysClock / 4000);GPIOPin Write(G PIO_P ORTB_BASE,lcde n,0xFF); / lcde n=1;SysCtlDelay(5 * (TheSysClock / 4000);GPIOPin Write(G PIO_P ORTB_BASE,lcde n,0x00); / lcde n=0;GPIOPin Write(

8、G PIO_P ORTB_BASE,lcde n,0xFF); / lcde n=1; SysCtlDelay(5 * (TheSysClock / 4000); GP IO Pin Write(G PIO_P ORTB_BASE,lcde n,0x00); / lcde n=0;void ini t()SysCtIPeriEnable(SYSCTL_PERIPH_GPIOD); 使能 A 端口GPIOPinTyp eOut(G PIO_P ORTD_BASE, GPIO_PIN _0|G PIO_PIN _1|G PIO_PIN_2| GPIO_PIN _3|G PIO_PIN _4|G P

9、IO_PIN _5|G PIO_PIN _6|G PIO_PIN _7);SysCtl PeriE nable(SYSCTL_ PERIPH_GPI OB);GPIOPinTyp eOut(G PIO_P ORTB_BASE, GPIO_PIN _0|G PIO_PIN _2);GPIOPin Write(G PIO_P ORTB_BASE,lcde n,0x00); / lcde n=0;write_com(0x38);write_com(0x0c); write_com(0x06);write_com(0x01); / 在開始清屏 write_com(0x80+0x10); /數(shù)據(jù)指針地址

10、/lcd模塊結(jié)束,矩陣鍵盤模塊開始 unsigned char KeyScan(void) if (GPIOPinRead(KEY_PORT2, KEY_PIN2) = 0x30) / 如果按下 KEY2 num=17; return nu m; else if (GP IO Pin Read(KEY_ PORT2, KEY_ PI N2) = 0x50) / 如果按下 KEY3 num=18;return nu m; else if (GP IO Pin Read(KEY_ PORT2, KEY_ PI N2) = 0x60) / 如果按下 KEY4 num=16; retu rn num;

11、GPIOPinTyp eOut(G PIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN _7);GPIOPinTyp eOut(G PIO_P ORTA_BASE,G PIO_PIN_0| GPIO_PIN _3);GPIOPin Write(G PIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_7,0Xf0);GPIOPin Write(G PIO_P ORTA_BASE,G PIO_P IN_0| GP IO_PIN_3,0X00);GPIOPinTyp eI n(GPIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN

12、 _7);gua n=GPIOPin Read(G PIO_P ORTC_BASE, 0xff)&0 xf0;jian=GP IO Pin Read(G PIO_P ORTA_BASE,0xff)&0x0f; gua n=jia n| gua n; if(gua n!=0xf0) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n!=0xf0) GPIOPinTyp eOut(G PIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5| GPIO_PIN_6| GPIO_PIN _7);GPIOPinTyp eOu

13、t(G PIO_P ORTA_BASE,G PIO_PIN_O| GPIO_PIN _3);GPIOPin Write(G PIO_P ORTC_BASE,G PIO_PIN_4| GPIO _PIN_7,0Xf0);GPIO_PIN _1| GPIO_PIN_5|GPIO_PIN_2| GPIO_PIN_6|GPIO PIN 5| GPIO PIN 1| GPIO PIN 5| GPIO PIN 1| GPIO PIN 5|GPIO PIN 6| GPIO PIN 2| GPIO PIN 6| GPIO PIN 2| GPIO PIN 6|GPIOPin Write(G PIO_P ORTA

14、_BASE, GPIO_PIN_0| GPIO_PIN_1| GPIO_PIN_2|GP IO_PIN_3,0X07);GPIOPinTyp eI n(GPIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5| GPIO_PIN_6| GPIO_PIN _7);gua n=GPIOPin Read(G PIO_P ORTC_BASE, GPIO_PIN_4| GPIO_PIN_5| GPIO_PIN_6| GPIO_PIN_7)&0xf0;jian=GPIOPin Read(G PIO_P ORTA_BASE,G PIO_PIN_0| GPIO_PIN _1|

15、GPIO_PIN_2| GPIO_PIN_3)&0 x0f;gua n=jia n| gua n;if(gua n=0x77) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0x77)num=11;return num;if(gua n=0xb7) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0xb7)num=7;return num;if(gua n=0xd7) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0xd7) num=4;return

16、num;if(gua n=0xe7) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0xe7) num=0;return num;GPIOPinTyp eOut(G PIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5|GPIO_PIN _7);GPIOPin Write(G PIO_P ORTA_BASE,G PIO_P IN_0| GPIO_PIN_1|GPIO_PIN _3,0X0b);GPIOPinTyp eI n(GPIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5| GPIO_PIN

17、_6|GPIO_PIN_2| GPIO_PIN_6|GPIO_PIN _7);GPIOPinTyp eOut(G PIO _P ORTA_BASE,G PIO_PIN_0| GPIO_PIN_1| GPIO_PIN _3);GPIOPin Write(G PIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5|GPIO_PIN _7,0Xf0);gua n=GPIOPin Read(G PIO_P ORTC_BASE, 0xff)&0 xf0;jian=GPIOPin Read(G PIO_P ORTA_BASE,0xff)&0x0f;gua n=jia

18、 n| gua n;if(gua n=0x7b) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0x7b) num=13;return num;if(gua n=0xbb) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0xbb) num=9;return num;if(gua n=Oxdb) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0xdb) num=6;return num;if(gua n=0xeb) SysCtlDelay(5 * (TheSy

19、sClock / 4000);if(gua n=0xeb) num=2;return num;GPIOPinTyp eOut(G PIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5| GPIO_PIN _7);GPIOPinTyp eOut(G PIO_P ORTA_BASE,G PIO_PIN_0| GPIO_PIN_1| GPIO_PIN _3); GPIOPin Write(G PIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5|GPIO_PIN _7,0Xf0);GPIOPin Write(G PIO_P ORTA_BASE,G

20、PIO_P IN_0| GPIO_PIN_1| GPIO_PIN_2|GPIO PIN 6| GPIO PIN 6| GPIO PIN 2| GPIO PIN 6| GPIO PIN 2|GPIO_PIN _3,0X0d);GPIOPinTyp eI n(GPIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5| GPIO_PIN _7); gua n=GPIOPin Read(G PIO_P ORTC_BASE, 0xff)&0 xf0;jia n=G PIOPin Read(G PIO_P ORTA_BASE,0xff)&0x0f;gua n=jia

21、 n| gua n;if(gua n=0x7d) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0x7d) num=14;return num;if(gua n=0xbd) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0xbd) num=10;return num;if(gua n=0xdd) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0xdd) num=15;return num;if(gua n=0xed) SysCtlDelay(5 * (The

22、SysClock / 4000);if(gua n=0xed) num=3;return num;GPIOPinTyp eOut(G PIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5| GPIO_PIN _7);GPIOPinTyp eOut(G PIO_P ORTA_BASE,G PIO_PIN_0| GPIO_PIN_1| GPIO_PIN _3); GPIOPin Write(G PIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5|GPIO_PIN _7,0Xf0);GPIOPin Write(G PIO_P ORTA_BASE,

23、G PIO_PIN_0| GPIO_PIN_1|GPIO_PIN _3,0X0e);GPIOPinTyp eI n(GPIO_P ORTC_BASE,G PIO_PIN_4| GPIO_PIN_5| GPIO_PIN_6| GPIO_PIN_6| GPIO_PIN_2| GPIO_PIN_6| GPIO_PIN_2| GPIO_PIN_6|GPIO_PIN _7);gua n=GPIOPin Read(G PIO_P ORTC_BASE, 0xff)&0 xf0; jian=GPIOPin Read(G PIO_P ORTA_BASE,0xff)&0x0f; gua n=jia

24、 n| gua n; if(gua n=0x7e) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0x7e) num=12;return num;if(gua n=Oxbe) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0xbe) num=8;return num;if(gua n=0xde) SysCtlDelay(5 * (TheSysClock / 4000);if(gua n=0xde) num=5;return num;if(gua n=0xee) SysCtlDelay(5 * (TheS

25、ysClock / 4000);if(gua n=0xee) num=1;return num;/主函數(shù)(程序入口)int main(v oid)SysCtlPeriEnable(LED1 _PERIPH); / 使能 LED 所在的GPIO 端口GPIOPinTypeOut(LED1 _PORT, LED1 _PIN); / 設(shè)置 LED 所在的管腳為輸出SysCtlPeriEnable(LED2_PERIPH); / 使能 LED 所在的 GPIO端口GPIOPinTypeOut(LED2_PORT, LED2_PIN); / 設(shè)置 LED 所在的管腳為輸出SysCtI PeriE nab

26、le(LED3_ PERI PH); GPIO 端口GPIOPinTyp eOut(LED3_ PORT, LED3_ PI N);的管腳為輸出SysCtl PeriEn able(LED4_ PERI PH); GP IO 端口GPIOPinTyp eOut(LED4_ PORT, LED4_ PI N);的管腳為輸出SysCtl PeriE nable(LED5_ PERI PH); GPIO 端口GPIOPinTyp eOut(LED5_ PORT, LED5_ PI N);的管腳為輸出SysCtl PeriE nable(LED6_ PERIPH); GP IO 端口GPIOPinTy

27、p eOut(LED6_ PORT, LED6_ PI N);的管腳為輸出SysCtl PeriE nable(LED7_ PERIPH); GP IO 端口GPIOPinTyp eOut(LED7_ PORT, LED7_ PI N);的管腳為輸出SysCtl PeriE nable(LED8 _PERIPH); GP IO 端口GPIOPinTyp eOut(LED8 _P ORT, LED8_ PI N);的管腳為輸出 clockI nit(); 6MHz buzzerI nit(); in it();SysCtlPeriEnable(SYSCTL_PERIPH_GPIOA); / 使能

28、 LED 所在的 / 設(shè)置 LED 所在 /使能LED所在的/設(shè)置LED所在/使能LED所在的/設(shè)置LED所在/使能 LED所在的/設(shè)置LED所在/使能LED所在的/設(shè)置LED所在/使能LED所 在的/設(shè)置LED所在/時(shí)鐘初始化:晶振,/使能LED所在的GPIO 端口SysCtl PeriEn able(SYSCTL_ PERI PH_GP IOC);GPIOPinTypeln (G PIO _P ORTA_BASE, GPIO_PIN_O| GP IO_PIN_3);GPIOPinTyp eI n(GPIO_P ORTC_BASE, GPIO_PIN_4| GPIO_PIN _7);SysC

29、tlPeriEnable(KEY_PERIPH2); / 使能 KEY 所在的 GPIO_PIN_1| GPIO_PIN_5| GPIO_PIN_2| GPIO_PIN_6|GPIO 端口GPIOPinTypeIn(KEY_PORT2, KEY_PIN2);管腳為輸入for (;) switch( KeySca n() case 14:GPIOPin Write(LED1_ PORT, LED1_PIN, 0x00); GPIOPin Write(LED2 _P ORT,LED2 _PIN, 0xFF); GPIOPin Write(LED3_ PORT, LED3_ PIN, 0xFF);G

30、PIOPin Write(LED4_ PORT, LED4_PIN, 0xFF); GP IO Pin Write(LED5_ PORT, LED5_ PIN, 0xFF); GPIOPin Write(LED6_ PORT, LED6_ PIN, 0xFF);GPIOPin Write(LED7_ PORT, LED7_ PIN, 0xFF);GPIOPinWrite(LED8_PORT, LED8_PIN, 0xFF); /lcd 滾動(dòng)顯示case 11:GPIOPin Write(LED1_ PORT, LED1_PIN, 0x00); GPIOPin Write(LED2 _P ORT

31、,LED2 _PIN, 0x00); GPIOPin Write(LED3_ PORT, LED3_ PIN, 0xFF);GPIOPin Write(LED4_ PORT, LED4_PIN, 0xFF); GP IO Pin Write(LED5_ PORT,LED5_ PIN, 0xFF); GPIOPin Write(LED6_ PORT, LED6_ PIN, 0xFF);GPIOPin Write(LED7_ PORT, LED7_PIN, 0xFF); GPIOPin Write(LED8_ PORT,LED8_PIN, 0xFF);music Play(O);/調(diào)用電子琴音頻w

32、rite_com(0x82); /設(shè)定上排的顯示位置 write_data(32); / 空格 write_data(32); / 空 格 write_data(32); / 空格 write_data(32); / 空格write_data(32); / 空格write_data(76); 整型數(shù)據(jù)轉(zhuǎn)換為 ASC2/I write_data(53); /整型數(shù)據(jù)轉(zhuǎn)換為 ASC2 /5 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格

33、write_data(32); / 空格 /lcd 顯示結(jié)束 buzzerQuietO; break;/設(shè)置KEY所在/點(diǎn)亮LED /熄滅LED /熄滅LED 熄滅LED /熄滅LED / 熄滅LED /熄滅LED / 熄滅LED case 7:點(diǎn)亮 熄滅 熄滅 熄滅 熄滅 熄滅 熄滅LEDLEDLEDLEDLEDLEDLEDGPIOPin Write(LED1_ PORT, LED1_PIN, 0x00); /GPIOPin Write(LED2_ PORT, LED2 _PIN, 0xFF); /GPIOPin Write(LED3_ PORT, LED3_PIN, 0xFF); /GPI

34、OPin Write(LED4_ PORT, LED4_ PIN, 0xFF); /GPIOPin Write(LED5_ PORT, LED5_PIN, 0xFF); /GPIOPin Write(LED6_ PORT, LED6_ PIN, 0xFF); /GPIOPin Write(LED7_ PORT, LED7_ PIN, 0xFF); /GPIOPinWrite(LED8_PORT, LED8_PIN, 0xFF); musicPlay(2);/ 調(diào)用電子琴音頻 write_com(0x82); /設(shè)定上排的顯示位置 write_data(32); / 空格 write_data(

35、32); / 空 格 write_data(32); / 空格 write_data(32); / 空格write_data(32); / 空格write_data(76); 整型數(shù)據(jù)轉(zhuǎn)換為 ASC2/I write_data(54); /整型數(shù)據(jù)轉(zhuǎn)換為 ASC2 /6 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 SysCtlDelay(100 * (TheSysCIock / 4000)

36、; buzzerQuiet();break;music Play(1);/調(diào)用電子琴音頻write_com(0x82); /設(shè)定上排的顯示位置 write_data(32); / 空格 write_data(32); / 空 格 write_data(32); / 空格熄滅LED 點(diǎn)亮LED 點(diǎn)亮LED /熄滅LED /熄滅LED /熄滅LED /熄滅 LED / 熄滅 LED / 熄滅 LEDwrite_data(32); / 空格write_data(32); / 空格write_data(76); 整型數(shù)據(jù)轉(zhuǎn)換為 ASC2/I write_data(55); /整型數(shù)據(jù)轉(zhuǎn)換為 ASC2

37、/6 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 SysCtlDelay(100 * (TheSysClock / 4000); buzzerQuiet(); break;case 1:GPIOPin Write(LED1_ PORT, LED1_PIN, 0x00); GPIOPin Write(LED2 _P ORT, LED2 _PIN, 0x00); GPIOPin Write(L

38、ED3_ PORT, LED3_ PIN, 0xFF);GPIOPin Write(LED4_ PORT, LED4_PIN, 0xFF); GP IO Pin Write(LED5_ PORT, LED5_ PIN, 0xFF); GPIOPin Write(LED6_ PORT, LED6_ PIN, 0xFF);GPIOPin Write(LED7_ PORT, LED7_PIN, 0xFF); GPIOPin Write(LED8_ PORT, LED8_PIN, 0xFF); musicPlay(2);write_com(0x82); /設(shè)定上排的顯示位置 write_data(32

39、); / 空格write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); /空格write_data(77); 整型數(shù)據(jù)轉(zhuǎn)換為 ASC2/l write_data(49); /整型數(shù)據(jù)轉(zhuǎn)換為 ASC2 /6 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格write_data(32); / 空格SysCtlDelay(100 * (TheS

40、ysClock / 4000); buzzerQuiet(); break;case 5:點(diǎn)亮 點(diǎn)亮 熄滅 熄滅 熄滅LEDLEDLEDLEDLEDGPIOPinWrite(LED7_PORT, LED7_PIN, OxFF); / 熄滅 LEDGPIOPin Write(LED8_ PORT, LED8_PIN, 0xFF); / 熄滅 LED music PI ay(3);SysCtlDelay(40 * (TheSysClock / 3000);write_com(0x82); /設(shè)定上排的顯示位置 write_data(32); / 空格 write_data(32); / 空 格 w

41、rite_data(32); / 空格 write_data(32); / 空格write_data(32); / 空格write_data(77); 整型數(shù)據(jù)轉(zhuǎn)換為 ASC2/I write_data(50); /整型數(shù)據(jù)轉(zhuǎn)換為 ASC2 /6 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格SysCtIDeIay(100 * (TheSysClock / 4000); buzzerQuiet

42、(); break;case 8:GPIOPin Write(LED1_ PORT, LED1_PIN, 0x00); GPIOPin Write(LED2 _P ORT,LED2 _PIN, 0x00); GPIOPin Write(LED3_ PORT, LED3_ PIN, 0x00);GPIOPin Write(LED4_ PORT, LED4_ PIN, 0xFF); GPIOPin Write(LED5_ PORT, LED5_ PIN, 0xFF); GPIOPin Write(LED6_ PORT, LED6_ PIN, 0xFF);GPIOPin Write(LED7_ PO

43、RT, LED7_ PIN, 0xFF); GPIOPin Write(LED8_ PORT,LED8 _PIN, 0xFF); musicPlay(4);SysCtlDelay(40 * (TheSysClock / 3000);write_com(0x82); /設(shè)定上排的顯示位置 write_data(32); / 空格 write_data(32); / 空 格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格/點(diǎn)亮LED 點(diǎn)亮LED 點(diǎn)亮LED /熄滅LED /熄滅LED /熄滅LED /熄滅 LED / 熄

44、滅 LEDwrite_data(77); 整型數(shù)據(jù)轉(zhuǎn)換為 ASC2/I write_data(51); /整型數(shù)據(jù)轉(zhuǎn)換為 ASC2 /6 write_data(32); / 空格 write_data(32); / 空格 write_data(32);/空格write_data(32); / 空格 write_data(32); / 空格write_data(32); / 空格SysCtIDeIay(100 * (TheSysClock / 4000); buzzerQuiet(); break;case 12:GPIOPin Write(LED1_ PORT, LED1_PIN, 0x00)

45、; GPIOPin Write(LED2 _P ORT,LED2 _PIN, 0x00); GPIOPin Write(LED3_ PORT, LED3_ PIN, 0x00);GPIOPin Write(LED4_ PORT, LED4_PIN, 0x00); GP IO Pin Write(LED5_ PORT,LED5_ PIN, 0xFF); GPIOPin Write(LED6_ PORT, LED6_ PIN, 0xFF);GPIOPin Write(LED7_ PORT, LED7_PIN, 0xFF); GPIOPin Write(LED8_ PORT,LED8_PIN, 0x

46、FF); musicPIay(5);SysCtlDelay(40 * (TheSysClock / 3000);write_com(0x82); /設(shè)定上排的顯示位置 write_data(32); / 空格 write_data(32); / 空 格 write_data(32); / 空格write_data(32); / 空格 write_data(32); / 空格write_data(77); 整型數(shù)據(jù)轉(zhuǎn)換為 ASC2/I write_data(52); /整型數(shù)據(jù)轉(zhuǎn)換為 ASC2 /6 write_data(32); / 空格 write_data(32); / 空格 write_

47、data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 SysCtlDelay(100 * (TheSysClock / 4000); buzzerQuiet(); break;case 3:LEDLEDLEDLEDLEDLEDLED music Play(6);GPIOPin Write(LED1_ PORT, LED1_PIN, 0x00); GPIOPin Write(LED2 _P ORT, LED2_PIN, 0x00); 點(diǎn)亮 LED / 點(diǎn)亮 LED 點(diǎn)亮 LED / 點(diǎn)亮 LED

48、 / 熄滅 LED / 熄滅LED /熄滅LED /熄滅LED /點(diǎn)亮LED 點(diǎn)亮點(diǎn)亮 點(diǎn)亮 熄滅 熄滅 熄滅 熄滅GPIOPin Write(LED3_ PORT, LED3_PIN, 0x00); /GPIOPin Write(LED4_ PORT, LED4_PIN, 0x00); / GPIOPin Write(LED5_ PORT, LED5_PIN, 0xFF); / GPIOPin Write(LED6_ PORT, LED6_ PIN, 0xFF); / GPIOPin Write(LED7_ PORT, LED7_PIN, 0xFF); / GPIOPin Write(LED

49、8_ PORT, LED8 _PIN, 0xFF); / SysCtlDelay(40 * (TheSysClock / 3000);write_com(0x82); /設(shè)定上排的顯示位置 write_data(32); / 空格 write_data(32); / 空 格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(77); 整型數(shù)據(jù)轉(zhuǎn)換為 ASC2/l write_data(53); /整型數(shù)據(jù)轉(zhuǎn)換為 ASC2 /6 write_data(32); / 空格 write_data(32)

50、; / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 SysCtlDelay(100 * (TheSysClock / 4000); buzzerQuiet(); break;case 15:GPIOPin Write(LED1_ PORT, LED1_PIN, 0x00); GPIOPin Write(LED2 _P ORT, LED2 _PIN, 0x00); GPIOPin Write(LED3_ PORT, LED3_ PIN, 0x00);GPIOPin W

51、rite(LED4_ PORT, LED4_PIN, 0x00); GP IO Pin Write(LED5_ PORT, LED5_ PIN, 0x00); GPIOPin Write(LED6_ PORT, LED6_ PIN, 0xFF);GPIOPin Write(LED7_ PORT, LED7_ PIN, 0xFF); GPIOPin Write(LED8_ PORT, LED8 _PIN, 0xFF); musicPlay(7);SysCtlDelay(40 * (TheSysClock / 3000);/lcd顯示write_com(0x82); /設(shè)定上排的顯示位置 writ

52、e_data(32); / 空格 write_data(32); / 空 格 write_data(32); / 空格 write_data(32); / 空格/點(diǎn)亮LED 點(diǎn)亮LED 點(diǎn)亮LED 點(diǎn)亮LED 點(diǎn)亮LED /熄滅LED /熄滅 LED / 熄滅 LEDwrite_data(32); / 空格write_data(77); 整型數(shù)據(jù)轉(zhuǎn)換為 ASC2/I write_data(54); /整型數(shù)據(jù)轉(zhuǎn)換為 ASC2 /6 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空

53、格 write_data(32); / 空格 write_data(32); / 空格 SysCtlDelay(100 * (TheSysClock / 4000); buzzerQuiet(); /lcd 顯示結(jié)束 break; case 10:GPIOPin Write(LED1_ PORT, LED1_PIN, 0x00); GPIOPin Write(LED2 _P ORT, LED2_PIN, 0x00); GPIOPin Write(LED3_ PORT, LED3_PIN, 0x00);GPIOPin Write(LED4_ PORT, LED4_PIN, 0x00); GPIO

54、Pin Write(LED5_ PORT, LED5_ PIN, 0x00); GPIOPin Write(LED6_ PORT, LED6_ PIN, 0xFF);GPIOPin Write(LED7_ PORT, LED7_PIN, 0xFF); GPIOPin Write(LED8_ PORT, LED8_PIN, 0xFF); musicPlay(8);SysCtlDelay(40 * (TheSysClock / 3000); write_com(0x82); /設(shè)定上排的顯示位置 write_data(32); / 空格 write_data(32); / 空 格 write_da

55、ta(32); / 空格 write_data(32); / 空格write_data(32); / 空格write_data(77); 整型數(shù)據(jù)轉(zhuǎn)換為 ASC2/l write_data(55); /整型數(shù)據(jù)轉(zhuǎn)換為 ASC2 /6 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 write_data(32); / 空格 SysCtlDelay(100 * (TheSysClock / 4000); buzzerQuiet(); br

56、eak;case 2:/點(diǎn)亮LED 點(diǎn)亮LED 點(diǎn)亮LED 點(diǎn)亮LED 點(diǎn)亮LED /熄滅LED /熄滅 LED / 熄滅 LED點(diǎn)亮 點(diǎn)亮 點(diǎn)亮 點(diǎn)亮 點(diǎn)亮 點(diǎn)亮 熄滅 熄滅LEDLEDLEDLEDLEDLEDLEDLED music Play(9);GPIOPin Write(LED1_ PORT, LED1_PIN, 0x00); /GPIOPin Write(LED2_ PORT, LED2_PIN, 0x00); /GPIOPin Write(LED3_ PORT, LED3_PIN, 0x00); /GPIOPin Write(LED4_ PORT, LED4_PIN, 0x00); /GPIOPin Write(LED5

溫馨提示

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

評(píng)論

0/150

提交評(píng)論