freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

課程設(shè)計-基于單片機的音樂盒播放器設(shè)計-在線瀏覽

2024-08-02 22:12本頁面
  

【正文】 PA 口顯示輸出值 0x77。 鍵盤的設(shè)計 按鍵掃描問題:將全部行線設(shè)置為低電平,然后讀入輸入列線有無低電平出現(xiàn)。在確認(rèn)有按鍵按下后,需要進入確定具體哪一個鍵閉合的過程,依次將行線設(shè)置為低電平,并檢測列線的輸入,進而確認(rèn)具體按鍵位置。 保證了在一次按鍵過程中至少可以檢測到 2 次按鍵閉合,任意兩次按鍵檢測不會落在 1 個抖動區(qū)內(nèi) 。 for (i=1。 i++) // 掃描鍵盤 { PORTB = ~key_line。 // 必須送 2 次!??! key_value = Key_mask amp。 // 讀列電平 if (key_value == Key_mask) key_line = 1。 // 有按鍵,停止掃描 7 7 break。 case 1: if (key_value == (Key_mask amp。 break。 … case 2: PORTB=0b00001111。 if((Key_mask amp。 break。 } 音樂播放 軟件采用 T/C1 比較匹配模式。一個時鐘周期為 1 微秒,寄存器 OCR1A 中為音符的半周期值,所以 2 次匹配中斷的匹配比較輸出在 0C1A 上,輸出一個完整的方波。 8 8 在 T/C1中的 OC1A會自動判別整個音樂是否全部播放完成,如果音樂沒有全部播完,將取出下一個音符的節(jié)拍和音調(diào)面繼續(xù)播放。一旦按鍵 A 鍵播放鍵被按下就會開始觸發(fā)外部中斷,進行工作。再通過揚聲器放大電路把它播放出去。 DDRD=0x20。 // OCR0 = 0xF9(249),(249+1)/125=2ms TCCR0 = 0x0A。 TCCR1B=0x08。 // 允許 T/C1 比較匹配 A 中斷,允許 T/C0 比較匹配中斷 。 當(dāng)看到自己設(shè)計的小音樂盒發(fā)聲播放,上面的小女孩旋轉(zhuǎn)的 時候,那種喜悅的感覺不言而喻。 希望能夠成為更加全面立體的電子類人才。 flash unsigned int t[16] = {0,1908,1700,1516,1433,1276,1136,1012,956,865,759,716,638,568,506,470}。 flash unsigned char music1[150]= {5,2,8,2,5,2,4,2,3,2,2,2,1,4, 1,2,1,2,2,2,3,2,3,2,1,2,3,2,4,2,5,8, 5,2,8,2,5,2,4,2,3,2,5,2,2,4, 4,2,3,2,2,2,6,2,5,4,2,2,3,2,1,8, 5,4,3,2,6,4,8,4,7,4,6,2,7,2,5,4,3,4, 9,2,9,2,9,2,8,2,7,4,6,2,8,2,5,8, 5,4,3,2,6,4,8,4,7,2,6,2,7,2,8,2,9,6, 5,2,6,2,7,2,8,3,8,4,5,4,8,8}。 flash unsigned char music3[100]= {1,4,1,4,5,4,5,4,6,4,6,4,5,8, 4,4,4,4,3,4,3,4,2,4,2,4,1,8, 5,4,5,4,4,4,4,4,3,4,3,4,2,8, 5,4,5,4,4,4,4,4,3,4,3,4,2,8, 1,4,1,4,5,4,5,4,6,4,6,4,5,8, 4,4,4,4,3,4,3,4,2,4,2,4,1,8}。 flash unsigned char music5[150]={3,2,3,2,4,2,5,2,5,2,4,2,3,2,2,2,1,2,1,2,2,2,3,2,3,2,2,1,2,8, 3,2,3,2,4,2,5,2,5,2,4,2,3,2,2,2,1,2,1,2,2,2,3,2,2,2,1,1,1,8, 2,2,2,2,3,2,1,2,2,2,30,1,4,1,3,2,1,2,2,2,3,1,4,1,3,2,2,2,1,2,2,2,2,4, 3,2,3,2,4,2,5,2,5,2,4,2,3,2,2,2,1,2,1,2,2,2,3,2,2,2,1,1,1,8}。 flash unsigned char music7[150]={1,2,2,2, 3,2,4,2, 5,2,5,2, 5,1,4,1,3,1, 4,2,4,2, 4,1,3,1,2,1, 1,2,3,2, 5,4, 1,2,2,2, 3,2,4,2, 5,2,5,2, 5,1,4,1,3,1, 4,2,4,2, 4,1,3,1,2,1, 1,2,3,2, 1,4, 6,2,6,2, 6,1,5,1,4,1, 5,2,5,2, 5,1,4,1,3,1, 4,2,4,2, 4,1,3,1,2,1, 1,2,3,2, 5,4, 6,2,6,2, 6,1,5,1,4,1, 5,2,5,2, 5,1,4,1,3,1, 4,2,4,2, 4,1,3,1,2,1,1,2,3,2, 1,4}。 flash unsigned char music9[200]={8,2,8,2,8,2,10,2,13,2,10,2,12,4, 12,2,13,2,12,2,10,2,11,2,10,2,19,4, 9,2,9,2,9,2,11,2,14,2,14,2,13,2,12,2,12,2,12,2,12,2,11,2,7,4,8,4,9,8, 8,2,8,2,8,2,10,2,13,2,10,2,12,4, 12,2,13,2,12,2,10,2,11,2,10,2,19,4, 9,2,9,2,9,2,11,2,14,2,14,2,13,2,12,2,12,2,12,2,12,2,11,2,7,4,9,4,8,8, 11 11 13,4,13,2,12,2,11,1,12,1,13,1,12,2,9,2,10,2,11,2,9,2,12,4, 13,4,12,4,11,8,9,4,14,2,13,2,12,2,13,2,12,2,11,4,12,2,13,2,10,4,9,4,8,8}。 int num=0,kai=1,pp。 unsigned int int_n=1。 int key_stime_counter。 key_stime_ok = 1。 if (note_n max[pp1]) { switch (pp) { case 1: OCR1A = t[music1[note_n]]。 note_n++。 note_n++。 break。 12 12 int_n = d[music2[note_n]]。 int_n = int_n * music2[note_n]*4。 TCCR1B = 0x09。 case 3: OCR1A = t[music3[note_n]]。 note_n++。 note_n++。 break。 int_n = d[music4[note_n]]。 int_n = int_n * music4[note_n]*4。 TCCR1B = 0x09。 case 5: OCR1A = t[music5[note_n]]。 note_n++。 note_n++。 break。 int_n = d[music6[note_n]]。 int_n = int_n * music6[note_n]*5。 TCCR1B = 0x09。 case 7: OCR1A = t[music7[note_n]]。 note_n++。 note_n++。 break。 int_n = d[music8[note_n]]。 int_n = int_n * music8[note_n]*5。 TCCR1B = 0x09。 case 9: OCR1A = t[music9[note_n]]。 note_n++。 note_n++。 break。 int_n=1。} } } } define No_key 17 define K1_1 1 define K1_2 2 define K1_3 3 define K1_4 4 define K2_1 5 define K2_2 6 define K2_3 7 define K2_4 8 define K3_1 9 define K3_2 10 define K3_3 11 define K3_4 12 define K4_1 17 define K4_2 17 define K4_3 17 14 14 define K4_4 17 define Key_mask 0b00001111 unsigned char read_key() { static unsigned char key_state = 0, key_value, key_line。 switch (key_state) { case 0: key_line = 0b00010000。 i=4。 // 輸出行線電平 PORTB = ~key_line。 PINB。 // 沒有按鍵,繼續(xù)掃描 else { key_state++。 // 轉(zhuǎn)消 抖確認(rèn)狀態(tài) } } break。 PINB)) // 再次讀列電平, { switch (key_line | key_value) // 與狀態(tài) 0 的相同,確認(rèn)按鍵 { // 鍵盤編碼,返回編碼值 case 0b00011110: key_return = K4_1。 case 0b00011101: key_return = K4_2。 case 0b00011011: key_return = K4_3。 case 0b00010111: key_return = K4_4。 case 0b00101110:
點擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1