搖搖棒制作資料講解_第1頁
搖搖棒制作資料講解_第2頁
搖搖棒制作資料講解_第3頁
搖搖棒制作資料講解_第4頁
搖搖棒制作資料講解_第5頁
已閱讀5頁,還剩13頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、-作者xxxx-日期xxxx搖搖棒制作資料講解【精品文檔】 LED搖搖棒的詳細制作資料LED搖搖棒很好地利用了人眼的視覺暫留特性。下圖是基于51單片機控制、16只高亮度LED發(fā)光二極管構(gòu)成的搖搖棒,配合手的左右搖晃就可呈現(xiàn)一幅完整的畫面,可以顯示字符、圖片等。演示效果見自制LED搖搖棒展示【圖】。 黑暗條件下拍攝的效果圖片: 實物外形圖:基本原理與硬件電路設(shè)計: 16只LED發(fā)光管作為畫面每一列的顯示,左右搖晃起到了掃描的作用,人眼的視覺暫留現(xiàn)象使得看到的是一幅完整的畫面。與LED點陣的顯示有幾分相仿。 硬件電路如下圖(點擊可放大)。系統(tǒng)電源VCC為5V,下載程序和調(diào)試時一定要保證5V電壓,實

2、際使用時用3節(jié)干電池串聯(lián)4.5V即可。AT89S52單片機作為控制器,在它的P0、P2口接有16只以共陽的方式連接的高亮度LED,由單片機輸出低電平點亮。P0口的上拉電阻RA1不能少。串在LED公共端的二極管D1會產(chǎn)生一定的壓降,用來保護LED,經(jīng)實測LED點亮?xí)r兩端電壓為3V左右,在LED的安全承受范圍內(nèi)。K1是畫面切換開關(guān),用于切換顯示不同內(nèi)容;S1為水銀開關(guān)。水銀開關(guān)的作用:棒在搖動時,只能在朝某一方向搖動時顯示,否則會出現(xiàn)鏡像字或鏡像畫面,所以通過接一只水銀開關(guān)來控制,使搖搖棒從左向右搖動時將內(nèi)容顯示出來。硬件制作:使用的是直徑5mm的紅色高亮LED,感覺太大了些,遠看效果很好但近看時

3、字不夠連貫。建議使用直徑為3mm的高亮LED,顏色可根據(jù)個人喜好選擇。水銀開關(guān)里的水銀珠很活躍,導(dǎo)致在接通時容易產(chǎn)生抖動,所以將水銀開關(guān)斜向上放置(尖尖朝斜上方45角),靠水銀珠自身重力的作用減少抖動:IC座里面隱藏元件,既美觀又能保護元件:軟件設(shè)計:/*程序名稱:LED搖搖棒顯示64*16像素簡要說明:外部中斷方式INT0顯示;取模方式:縱向取模、字節(jié)倒序編 寫:JiangX.net最后更新:08/11/15晚*/#include #define uchar unsigned char#define uint unsigned int/宏定義#define KEY P3_0/定義畫面切換按鍵

4、uchar KY;/KY作用在后面說明uchar disp;/顯示漢字指針uchar pic=0,num=0;/pic為按鍵次數(shù);num為中斷次數(shù)uchar code love = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00

5、,0x00,0x00,0x00,0x00,0xF8,0x0F,0x04,0x10,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x04,0x10,0xF8,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x07,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x20,0x00,0x10,0x00,0x08,0xFE,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20

6、,0x82,0x20,0x82,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*LOVE*/;uchar code loveyou = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

7、,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0xFC,0x00,0xFE,0x01,0xFE,0x03,0xFE,0x07,0xFE,0x0F,0xFE,0x1F,0xFC,0x3F,0xF8,0x7F,0xFC,0x3F,0xFE,0x1F,0xFE,0x0F,0xFE,0x07,0xFE,0x03,0xFE,0x01,0xFC,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00

8、,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*心形圖案*/;uchar code hehe = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x

9、00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0x40,0x01,0xC0,0x01,0x00,0x00,0x00,0x00,0xF0,0x0F,0x08,0x10,0x04,0x20,0x00,0x00,0x00,0x00,0xF0,0x3F,0x08,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0xF0,0x3F,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x

10、F0,0x3F,0x08,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0xF0,0x3F,0x00,0x00,0x00,0x00,0x04,0x20,0x08,0x10,0xF0,0x0F,0x00,0x00,0x00,0x00,0xC0,0x01,0x40,0x01,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*呵呵o(_)o圖案*/;unsigned char code

11、 hanzi = /- 歡 - 0x04,0x10,0x34,0x08,0xC4,0x06,0x04,0x01, 0xC4,0x82,0x3C,0x8C,0x20,0x40,0x10,0x30, 0x0F,0x0C,0xE8,0x03,0x08,0x0C,0x08,0x10, 0x28,0x60,0x18,0xC0,0x00,0x40,0x00,0x00,/- 迎 - 0x40,0x00,0x42,0x40,0x44,0x20,0xC8,0x1F, 0x00,0x20,0xFC,0x47,0x04,0x42,0x02,0x41, 0x82,0x40,0xFC,0x7F,0x04,0x40,0x

12、04,0x42, 0x04,0x44,0xFE,0x63,0x04,0x20,0x00,0x00,/- 使 - 0x40,0x00,0x20,0x00,0xF8,0xFF,0x07,0x00, 0x04,0x80,0xF4,0x43,0x14,0x45,0x14,0x29, 0x14,0x19,0xFF,0x17,0x14,0x21,0x14,0x21, 0x14,0x41,0xF6,0xC3,0x04,0x40,0x00,0x00,/- 用 - 0x00,0x80,0x00,0x60,0xFE,0x1F,0x22,0x02, 0x22,0x02,0x22,0x02,0x22,0x02,0xF

13、E,0x7F, 0x22,0x02,0x22,0x02,0x22,0x42,0x22,0x82, 0xFF,0x7F,0x02,0x00,0x00,0x00,0x00,0x00,/- 神 - 0x08,0x01,0x88,0x00,0x49,0x00,0xEE,0xFF, 0x58,0x00,0x88,0x00,0x00,0x00,0xF8,0x1F, 0x88,0x08,0x88,0x08,0xFF,0xFF,0x88,0x08, 0x88,0x08,0xFC,0x1F,0x08,0x00,0x00,0x00,/- 奇 - 0x40,0x00,0x40,0x00,0x44,0x00,0x44

14、,0x3E, 0x64,0x12,0x54,0x12,0x4C,0x12,0x47,0x12, 0x4C,0x3F,0x54,0x42,0x74,0x80,0xC6,0x7F, 0x44,0x00,0x60,0x00,0x40,0x00,0x00,0x00,/- 魔 - 0x00,0x40,0x00,0x30,0xFE,0x8F,0x4A,0x80, 0xAA,0x5F,0x9A,0x4A,0xFE,0x2A,0xAA,0x1A, 0xCB,0x0F,0xAA,0x7A,0xFE,0x8A,0x9A,0xAA, 0xAA,0x8F,0x6B,0x80,0x22,0xE0,0x00,0x00,/

15、- 幻 - 0x80,0x20,0xC0,0x30,0xA0,0x28,0x98,0x24, 0x87,0x22,0x80,0x21,0xC4,0x30,0x04,0x60, 0x04,0x00,0x04,0x20,0x04,0x40,0x04,0x80, 0x04,0x40,0xFE,0x3F,0x04,0x00,0x00,0x00,/- 搖 - 0x10,0x02,0x10,0x42,0x10,0x81,0xFF,0x7F, 0x90,0x04,0x54,0x05,0xCC,0xF4,0xB4,0x44, 0x84,0x44,0xBC,0x7F,0x82,0x44,0xA2,0x44, 0

16、x9B,0xF4,0x82,0x06,0x00,0x04,0x00,0x00,/- 搖 - 0x10,0x02,0x10,0x42,0x10,0x81,0xFF,0x7F, 0x90,0x04,0x54,0x05,0xCC,0xF4,0xB4,0x44, 0x84,0x44,0xBC,0x7F,0x82,0x44,0xA2,0x44, 0x9B,0xF4,0x82,0x06,0x00,0x04,0x00,0x00,/- 棒 - 0x10,0x04,0x10,0x03,0xD0,0x00,0xFF,0xFF, 0x90,0x00,0x54,0x05,0x44,0x12,0xD4,0x15, 0x

17、74,0x14,0x5F,0xFF,0xD4,0x14,0x54,0x15, 0x56,0x12,0x44,0x06,0x40,0x02,0x00,0x00,/- ! - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x7C,0x10,0xFE,0x3B, 0xFE,0x3B,0x7C,0x10,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00;/*函數(shù)聲明*/void display1(void);void display2(void);voi

18、d display3(void);void display4(void);/*n(us)延時子程序*/void DelayUs(uint N)uint x;for(x=0; x10)disp+;num=0;/12個漢字分為3次顯示完(每次顯示4個),每中斷10次切換if(disp2)disp=0;DelayUs(5200);/此處延時時間依各硬件差別而各不相同,試著調(diào)整使得顯示內(nèi)容居中即可for(i=0;i64;i+) P0=hanzidisp*128+i*2; P2=hanzidisp*128+i*2+1; DelayUs(100);/*顯示子程序2(LOVE)*/void display2(void)uch

溫馨提示

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

評論

0/150

提交評論