1 / 11

題目 : 迷你電子琴

題目 : 迷你電子琴. 微處理機應用暨實習報告. 組員 :4980D005 楊仁緯 4980D061 林家鵬 指導老師 : 郭晉魁. 目錄. 凌陽 SPCE061A 晶片模組 ----------------------3 副板模組 ----------------------------------4 電子琴簡介 --------------------------------5 迷你電子琴 --------------------------------6 流程圖 ------------------------------------7

Télécharger la présentation

題目 : 迷你電子琴

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 題目:迷你電子琴 微處理機應用暨實習報告 組員:4980D005 楊仁緯 4980D061 林家鵬 指導老師:郭晉魁

  2. 目錄 • 凌陽SPCE061A晶片模組----------------------3 • 副板模組----------------------------------4 • 電子琴簡介--------------------------------5 • 迷你電子琴--------------------------------6 • 流程圖------------------------------------7 • 程式碼----------------------------------8~10 • 成品展示---------------------------------11

  3. 凌陽SPCE061A晶片模組

  4. 副板模組

  5. 電子琴簡介 • 基本功能 • 標準鍵盤(49鍵、54鍵、61鍵、76鍵、78鍵、88鍵),少於61鍵者,大多為玩具 • 音色切換(切換演奏的樂器) • 節奏切換 • 音量控制 • 自動伴奏(和弦) • 詳細介紹 • 電子琴,以鍵盤形態出現的一種樂器。由音色、自動節奏,自動和弦三大部分組成。 • 電子琴有模擬各種樂器的豐富的音色庫,我們可以根據樂曲的需要,選用合適的音色,來訓練各種演奏法。 • 電子琴的自動節奏部分,為老師給學生進行節奏感的教學提供了有利條件。老師可讓學生合著自動節奏反覆打拍子,甚至可以運動身體,比如合著節奏踏步、走步等,從中用心和身體去領略各種節奏的律動。 • 電子琴的演奏有較大一部分是通過自動和弦伴奏來配合完成的,在音樂中和弦的連接推動了旋律地進行,不同的和聲連接,形成了不同的音樂色彩。

  6. 迷你電子琴 利用1~8的按鍵,發出DO、RE、MI、 FA、SO、LA、SI、DO聲音,並且對應的 LED燈會發光。

  7. 程式碼#1 • #include "SPCE061A.H" • #define DAC1 1 • #define DAC2 2 • #define Ramp_UpDn_Off 0 • #define Ramp_Up_On 1 • #define Ramp_Dn_On 2 • #define Ramp_UpDn_On 3 • void delay(); • void Init_B_Port(); • char table2[8]={1,2,4,8,16,32,64,128}; • void playsound(int SPEECH_1) • { • SACM_A2000_Initial(1); //自動方式播放初始化 • SACM_A2000_Play(SPEECH_1,DAC1,Ramp_UpDn_On); • //定義語音索引號、播放通道、允許音量增/減調節 • while(SACM_A2000_Status()&01) • SACM_A2000_ServiceLoop();//獲取語音資料並將其填入解碼佇列 • }

  8. 程式碼#2 • int main() • { int key;//按鍵值 • Init_A_Port();//規劃 A/B Port • Init_B_Port();//IO初始化完成 • while (1) {//無窮迥圈 • key = *P_IOA_Data;//讀取A Port值 • key = ~key;//輸入為負邏輯, 所以將位元反向成正邏輯 • key &= 0x00ff;//保留IOA0-7共8 bit • *P_IOB_Data = key | 0x4000;//輸出至B Port • find(key);} // while(1) • } • void find(unsigned int r2) • { unsigned int i; • for (i=0; i<8; i++) • { if (table2[i] == r2) • { • playsound(i); //播放聲音 • } • } • } • //======================================================

  9. 程式碼#3 • void delay(unsigned int n) • { • int i; • for (i=0; i<n; i++) ; • *P_Watchdog_Clear = 0x0001;//清除看門狗計數器 • } • void Init_B_Port() • { • *P_IOB_Dir = 0xffff;//規劃IOB0~7為同相的低電位輸出 • *P_IOB_Attrib = 0xffff;//規劃IOB8~15為反相的低電位輸出 • *P_IOB_Data = 0xffff; • } • void Init_A_Port() • { • *P_IOA_Dir = 0x0000;//規劃IOA0~7上拉電阻輸入, IOA8~15沒用到 • *P_IOA_Attrib = 0x0000; • *P_IOA_Data = 0x00ff; • }

  10. 成品展示

More Related