版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、LED搖搖棒的詳細(xì)制作資料 LED搖搖棒很好地利用了人眼的視覺(jué)暫留特性。下圖是基于51單片機(jī)控制、16只高亮度LED發(fā)光二極管構(gòu)成的搖搖棒,配合手的左右搖晃就可呈現(xiàn)一幅完整的畫(huà)面,可以顯示字符、圖片等。演示效果見(jiàn)自制LED搖搖棒展示【圖】。 黑暗條件下拍攝的效果圖片: 實(shí)物外形圖:基本原理與硬件電路設(shè)計(jì): 16只LED發(fā)光管作為畫(huà)面每一列的顯示,左右搖晃起到了掃描的作用,人眼的視覺(jué)暫留現(xiàn)象使得看到的是一幅完整的畫(huà)面。與LED點(diǎn)陣的
2、顯示有幾分相仿。 硬件電路如下圖(點(diǎn)擊可放大)。系統(tǒng)電源VCC為5V,下載程序和調(diào)試時(shí)一定要保證5V電壓,實(shí)際使用時(shí)用3節(jié)干電池串聯(lián)4.5V即可。AT89S52單片機(jī)作為控制器,在它的P0、P2口接有16只以共陽(yáng)的方式連接的高亮度LED,由單片機(jī)輸出低電平點(diǎn)亮。P0口的上拉電阻RA1不能少。串在LED公共端的二極管D1會(huì)產(chǎn)生一定的壓降,用來(lái)保護(hù)LED,經(jīng)實(shí)測(cè)LED點(diǎn)亮?xí)r兩端電壓為3V左右,在LED的安全承受范圍內(nèi)。K1是畫(huà)面切換開(kāi)關(guān),用于切換顯示不同內(nèi)容;S1為水銀開(kāi)關(guān)。水銀開(kāi)關(guān)的作用:棒在搖動(dòng)時(shí),只能在朝某一
3、方向搖動(dòng)時(shí)顯示,否則會(huì)出現(xiàn)鏡像字或鏡像畫(huà)面,所以通過(guò)接一只水銀開(kāi)關(guān)來(lái)控制,使搖搖棒從左向右搖動(dòng)時(shí)將內(nèi)容顯示出來(lái)。硬件制作:使用的是直徑5mm的紅色高亮LED,感覺(jué)太大了些,遠(yuǎn)看效果很好但近看時(shí)字不夠連貫。建議使用直徑為3mm的高亮LED,顏色可根據(jù)個(gè)人喜好選擇。水銀開(kāi)關(guān)里的水銀珠很活躍,導(dǎo)致在接通時(shí)容易產(chǎn)生抖動(dòng),所以將水銀開(kāi)關(guān)斜向上放置(尖尖朝斜上方45°角),靠水銀珠自身重力的作用減少抖動(dòng):IC座里面隱藏元件,既美觀(guān)又能保護(hù)元件:軟件設(shè)計(jì):/*程序名稱(chēng):LED搖搖棒顯示64*16像素簡(jiǎn)要說(shuō)明:外部中斷方式INT0顯示;取模方式:縱向取模、字節(jié)倒序編
4、; 寫(xiě):JiangX.net最后更新:08/11/15晚*/#include #define uchar unsigned char#define uint unsigned int /宏定義#define KEY P3_0 /定義畫(huà)面切換按鍵uchar KY; /KY作用在后面說(shuō)明 uchar disp;
5、 /顯示漢字指針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,0x0
6、0,0x00,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,0x8
7、2,0x20,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,0x0
8、0,0x00,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,0x0
9、0,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,0x00,/*心形圖案*/;uchar code hehe = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
10、x00,0x00,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,0
11、x00,0xF0,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
12、 code 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,0
13、x00,/- 迎 - 0x40,0x00,0x42,0x40,0x44,0x20,0xC8,0x1F, 0x00,0x20,0xFC,0x47,0x04,0x42,0x02,0x41, 0x82,0x40,0xFC,0x7F,0x04,0x40,0x04,0x42, 0x04,0x44,0xFE,0x63,0x04,0x20,0x00,0x00,/- 使 -
14、 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,/- 用 -
15、0; 0x00,0x80,0x00,0x60,0xFE,0x1F,0x22,0x02, 0x22,0x02,0x22,0x02,0x22,0x02,0xFE,0x7F, 0x22,0x02,0x22,0x02,0x22,0x42,0x22,0x82, 0xFF,0x7F,0x02,0x00,0x00,0x00,0x00,0x00,/- 神 -
16、160; 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,/- 奇 -
17、 0x40,0x00,0x40,0x00,0x44,0x00,0x44,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
18、,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,/- 幻 - 0x80,0x20,0xC0,0x30
19、,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
20、,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,0x02,0x10,0x42,0x10,0x81,0xFF,0x7F
21、, 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,
22、60; 0x90,0x00,0x54,0x05,0x44,0x12,0xD4,0x15, 0x74,0x14,0x5F,0xFF,0xD4,0x14,0x54,0x15, 0x56,0x12,0x44,0x06,0x40,0x02,0x00,0x00,/- ! - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, &
23、#160; 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;void display3(void;void display4(void;/*n(us)延時(shí)子程序*/void Del
24、ayUs(uint N uint x; for(x=0; x<=N;x+;/*中斷服務(wù)程序*/void intersvr0(void interrupt 0 using 1 KY=KY; /每個(gè)搖動(dòng)來(lái)回水銀開(kāi)關(guān)會(huì)在擺幅兩端分別產(chǎn)生下降沿中斷,只提取其中一次(從左向右搖才顯示) if(KY=0 num+; /計(jì)算中斷次數(shù) switch(pic
25、160; /選擇畫(huà)面 case 0:display1(;break; case 1:display2(;break; case 2:display3(;break; case 3:display4(;break; default:display1(; /*顯示子程序1(漢字)*/void
26、 display1(void uchar i; if(num>10disp+;num=0; /12個(gè)漢字分為3次顯示完(每次顯示4個(gè)),每中斷10次切換 if(disp>2disp=0; DelayUs(5200; /此處延時(shí)時(shí)間依各硬件差別而各不相同,試著調(diào)整使得顯示內(nèi)容居中即可 for(i=0;i<64;i+ P0=hanzidisp*128+i*2; P2=hanzidisp*128+i*2+1; DelayUs(100; /*顯示子程序2(LOVE)*/void display2(void uchar i; DelayUs(4000; for(i=0;i<64;i+ P0=lovei*2;
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 語(yǔ)言與認(rèn)知研究-洞察分析
- 芯片維修規(guī)范制定方法探討-洞察分析
- 無(wú)障礙電梯智能化技術(shù)應(yīng)用-洞察分析
- 衛(wèi)星遙感GIS-洞察分析
- 小學(xué)語(yǔ)文教研組線(xiàn)上線(xiàn)下銜接教學(xué)計(jì)劃
- 水廠(chǎng)管網(wǎng)改擴(kuò)建工程施工方案及技術(shù)措施
- 人力資源部2025年工作計(jì)劃
- 銅砭刮痧操作流程
- 2025年護(hù)理工作計(jì)劃范文
- 多聯(lián)機(jī)施工計(jì)劃
- 醫(yī)用冰箱溫度登記表
- 《潔凈工程項(xiàng)目定額》(征求意見(jiàn)稿)
- 家庭室內(nèi)裝飾裝修工程保修單
- 小學(xué)語(yǔ)文課堂提問(wèn)有效性策略研究方案
- 物業(yè)上門(mén)維修收費(fèi)標(biāo)準(zhǔn)
- ATS技術(shù)交流(新型發(fā)動(dòng)機(jī)智能恒溫節(jié)能冷卻系統(tǒng))100318
- 手術(shù)區(qū)皮膚的消毒和鋪巾ppt課件
- 2022年度培訓(xùn)工作總結(jié)
- 應(yīng)急照明裝置安裝施工方法
- 靜力觸探技術(shù)標(biāo)準(zhǔn)
- DB34∕T 4057-2021 中小河流防汛特征水位分析規(guī)程
評(píng)論
0/150
提交評(píng)論