版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、搖搖棒制作心得陳彥彧為什么制作搖搖棒?其實是為了一個同學(xué)的生日。當(dāng)初對于我這個還沒有用C語言編過搖搖棒程序的我來說就是一次挑戰(zhàn),還有自動生成字模軟件發(fā)了神經(jīng),迫使我鉆研下去,現(xiàn)在有了成果。我使用的是AT89S52單片機,其他的單片機接線不一樣,你們要看著該電路,改程序。第一次制作的同學(xué)建議用排針,可是排針有不好搖,怎么辦?自己想辦法吧,我的排針焊好之后很大一塊,可是對摸索搖搖棒制作很有好處。電路圖是有缺陷的,這是網(wǎng)上找的,你只要把復(fù)位按鍵并聯(lián)到電容C1上才可以形成一個復(fù)位電路。其他都沒事。除了ISP端口之外把其他都焊上去吧,你喜歡把ISP端口接上都沒有問題。大家喜歡。有一個提示是p0.0指的是
2、搖搖棒的第一個LED。焊反了有可能圖案不太妥當(dāng)。我用的是5mm高亮度紅色發(fā)光二極管。其他的元件有:IN4007二極管*1,5mm或者3mm高亮度發(fā)光二極管*1610K排阻*110K電阻*330pf電容*2水銀開關(guān)*1(這個要小心使用,我用膠槍把它封住了)復(fù)位按鍵*210f電容*1(就是電路圖中的C1,可能看不大清楚)還有如果你想下載的話就焊接ISP接口吧,只要一個如果你想就買排針焊接,記得要買導(dǎo)線,問一下賣主與排針配套的線是什么就行了。做好一切之后就可以來寫程序啦!不會寫程序的就直接把程序?qū)戇M(jìn)單片機吧,就當(dāng)做為我同學(xué)生日做點祝福!以下紅色字是程序主體:/*程序名稱:LED搖搖棒顯示64*16像
3、素簡要說明:外部中斷方式INT0顯示;取模方式:縱向取模、字節(jié)倒序編 寫:陳彥彧最后更新:2012年4月20日星期五*/#include #define uchar unsigned char#define uint unsigned int /宏定義#define KEY P3_0 /定義畫面切換按鍵uchar KY; /KY作用在后面說明 uchar disp; /顯示漢字指針uchar pic=0,num=0; /pic為按鍵次數(shù);num為中斷次數(shù)uchar code dajiaaini = /*大*/0x00,0x00,0x00,0x00,0x40,0x80,0x40,0x40,0x4
4、0,0x20,0xc0,0x18,0x40,0x18,0x40,0x03,0xfe,0x00,0x40,0x01,0x40,0x06,0x40,0x08,0x40,0x10,0x40,0x20,0x40,0x40,0x40,0x80,/*家*/0x00,0x00,0x38,0x00,0x08,0x00,0x28,0x00,0x28,0x04,0x28,0x02,0x28,0x49,0xaa,0x24,0xec,0x33,0x28,0x4b,0x28,0xfe,0x28,0x3,0x88,0x08,0x08,0x10,0x38,0x00,0x00,0x00,/*愛*/0x00,0x00,0x00
5、,0x00,0xe0,0x01,0x24,0x10,0x2c,0x89,0x36,0x85,0x26,0x4f,0xa6,0x55,0x6e,0x25,0x32,0x55,0x22,0x55,0x33,0x8d,0x2d,0x81,0x20,0x81,0xe0,0x00,0x00,0x00,/*你*/0x40,0x00,0x20,0x00,0x10,0x00,0xf8,0xff,0x24,0x00,0x13,0x08,0x18,0x04,0x14,0x00,0x10,0x20,0x10,0x40,0xf0,0xff,0x10,0x00,0x50,0x02,0x30,0x0c,0x30,0x08
6、,0x00,0x00,;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,0x00,0x00,0x00,0x00,0xF8,0x0F,0x04,0x10,0x02,0x20,0x02,0x20,
7、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,0x82,0x20,0x82,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
8、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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
9、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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
10、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,0x18,0x20,0x06,0x20,0x01,0xe0,0x00,0xfe,0xff, 0xe0,0x00,0x20,0x03,0x00,0x0c,0x20,0x12,0xa0,0x01,0x60,0x00,0xfe,0xff,0xe0,0x
11、00,0x20,0x03,0x00,0x0e,0x00,0x18,/*曼*/0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x01,0x20,0x81,0x2e,0x8d,0xee,0x55,0x2e,0x65,0x2e,0x25,0xee,0x55,0x2e,0x4d,0xe0,0x81,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,/*怡*/0x00,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xfe,0xff,0xc0,0x00,0x80,0x01,0x80,0x7c,0xe0,0x44,0x98,0x
12、44,0x86,0x44,0x80,0x44,0xc0,0x44,0x40,0x7c,0x00,0x01,0x00,0x00,; uchar code lehe = /*生*/0x00,0x41,0xC0,0x40,0x30,0x42,0x1E,0x42,0x10,0x42,0x10,0x42,0x10,0x42,0xFF,0x7F,0x10,0x42,0x10,0x42,0x10,0x42,0x10,0x43,0x18,0x42,0x10,0x60,0x00,0x40,0x00,0x00,/*日*/0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x7F,0x82,0x
13、20,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0xFF,0x7F,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*快*/ 0x80,0x00,0x70,0x00,0x00,0x00,0xFF,0xFF,0x10,0x82,0x20,0x42,0x10,0x22,0x10,0x1A,0xFF,0x07,0x10,0x0A,0x10,0x12,0x10,0x22,0xF8,0x43,0x10,0xC2,0x00,0x42,0x00,0x00,/*樂*/ 0x00,0x00,0x80,
14、0x40,0xC0,0x20,0xBC,0x10,0x84,0x0C,0x84,0x40,0x84,0x80,0xF4,0x7F,0x82,0x00,0x82,0x00,0x83,0x04,0x82,0x08,0x80,0x30,0xC0,0x60,0x80,0x00,0x00,0x00,; uchar code kuaile = /*身*/ 0x00,0x40,0x00,0x42,0x00,0x42,0x00,0x22,0xFC,0x23,0x54,0x22,0x56,0x12,0x55,0x12,0x54,0x0A,0x54,0x46,0x54,0x82,0xFE,0x7F,0x04,0x
15、01,0x80,0x00,0x40,0x00,0x00,0x00,/*體*/0x40,0x00,0x20,0x00,0xF8,0xFF,0x07,0x08,0x10,0x06,0x90,0x01,0x70,0x04,0x10,0x04,0xFF,0xFF,0x10,0x04,0x70,0x04,0x90,0x01,0x18,0x06,0x10,0x0C,0x00,0x04,0x00,0x00,/*健*/ 0x40,0x00,0x20,0x00,0xF8,0xFF,0x07,0x44,0x88,0x29,0x48,0x19,0x38,0x27,0x10,0x49,0x54,0x89,0x54,0
16、x89,0xFF,0xFF,0x54,0x89,0x54,0x89,0x7C,0xCD,0x10,0x49,0x00,0x00,/*康*/ 0x00,0x40,0x00,0x30,0xFC,0x0F,0x44,0x40,0x54,0x23,0x54,0x15,0x54,0x49,0x55,0x81,0xFE,0x7F,0x54,0x05,0x54,0x09,0x54,0x11,0xF4,0x29,0x46,0x64,0x44,0x20,0x00,0x00,; /*函數(shù)聲明*/void display1(void;void display2(void;void display3(void;voi
17、d display4(void;void display5(void;void display6(void;/*n(us)延時子程序*/void DelayUs(uint Nuint x;for(x=0; x<=N;x+;/*中斷服務(wù)程序*/void intersvr0(void interrupt 0 using 1KY=KY; /每個搖動來回水銀開關(guān)會在擺幅兩端分別產(chǎn)生下降沿中斷,只提取其中一次(從左向右搖才顯示)if(KY=0num+; /計算中斷次數(shù)switch(pic /選擇畫面case 0:display1(;break;case 1:display2(;break;case
18、 2:display3(;break;case 3:display4(;break;case 4:display5(;break;case 5:display6(;break;default:display1(; /*顯示子程序1(我們愛你)*/void display1(voiduchar i;DelayUs(4000;for(i=0;i<64;i+P0=dajiaainii*2;P2=dajiaainii*2+1;DelayUs(120;/*顯示子程序2(LOVE)*/void display2(voiduchar i;DelayUs(4000;for(i=0;i<64;i+P
19、0=lovei*2;P2=lovei*2+1;DelayUs(120;/*顯示子程序3(心形圖案)*/void display3(voiduchar i;DelayUs(4000;for(i=0;i<64;i+P0=loveyoui*2;P2=loveyoui*2+1;DelayUs(120;/*顯示子程序4(林曼怡)*/void display4(voiduchar i;DelayUs(4000;for(i=0;i<48;i+P0=hehei*2;P2=hehei*2+1;DelayUs(120;/*顯示子程序5(生日快樂)*/void display5(voiduchar i;DelayUs(4000;for(i=0;i<64;i+P0=lehei*2;P2=lehei*2+1;DelayUs(120;/*顯示子程序6(身體健康)*/void display6(voiduchar i;DelayUs(4000;for(i=0;i<64;i+P0=kuailei*
溫馨提示
- 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)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度養(yǎng)老院車庫租賃與養(yǎng)老服務(wù)合同4篇
- 2025年度出租車公司車輛安全檢查合同6篇
- 2024年船舶加油與貨物運輸合同
- 2025年度生態(tài)魚塘租賃及管理服務(wù)合同4篇
- 2025年度石油鉆井設(shè)備租賃與技術(shù)服務(wù)合同4篇
- 2024版洗碗工勞動合同違約金
- 2024科技公司與科研機構(gòu)之間的聯(lián)合研發(fā)合同
- 2024造價咨詢服務(wù)合作協(xié)議-裝配式建筑版3篇
- 2025年度智慧城市建設(shè)項目車位使用權(quán)租賃合同4篇
- 2025年度時尚餐廳裝修設(shè)計及設(shè)備采購合同3篇
- 勞務(wù)投標(biāo)技術(shù)標(biāo)
- 研發(fā)管理咨詢項目建議書
- 濕瘡的中醫(yī)護理常規(guī)課件
- 轉(zhuǎn)錢委托書授權(quán)書范本
- 一種配網(wǎng)高空作業(yè)智能安全帶及預(yù)警系統(tǒng)的制作方法
- 某墓園物業(yè)管理日常管護投標(biāo)方案
- 蘇教版六年級數(shù)學(xué)上冊集體備課記載表
- NUDD新獨難異 失效模式預(yù)防檢查表
- 內(nèi)蒙古匯能煤電集團有限公司長灘露天煤礦礦山地質(zhì)環(huán)境保護與土地復(fù)墾方案
- 22S702 室外排水設(shè)施設(shè)計與施工-鋼筋混凝土化糞池
- 2013日產(chǎn)天籟全電路圖維修手冊45車身控制系統(tǒng)
評論
0/150
提交評論