版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、搖搖棒制作心得陳彥彧為什么制作搖搖棒?其實(shí)是為了一個(gè)同學(xué)的生日。當(dāng)初對(duì)于我這個(gè)還沒有用C語(yǔ)言編過搖搖棒程序的我來說就是一次挑戰(zhàn),還有自動(dòng)生成字模軟件發(fā)了神經(jīng),迫使我鉆研下去,現(xiàn)在有了成果。我使用的是AT89S52單片機(jī),其他的單片機(jī)接線不一樣,你們要看著該電路,改程序。第一次制作的同學(xué)建議用排針,可是排針有不好搖,怎么辦?自己想辦法吧,我的排針焊好之后很大一塊,可是對(duì)摸索搖搖棒制作很有好處。電路圖是有缺陷的,這是網(wǎng)上找的,你只要把復(fù)位按鍵并聯(lián)到電容C1上才可以形成一個(gè)復(fù)位電路。其他都沒事。除了ISP端口之外把其他都焊上去吧,你喜歡把ISP端口接上都沒有問題。大家喜歡。有一個(gè)提示是p0.0指的是
2、搖搖棒的第一個(gè)LED。焊反了有可能圖案不太妥當(dāng)。我用的是5mm高亮度紅色發(fā)光二極管。其他的元件有:IN4007二極管*1,5mm或者3mm高亮度發(fā)光二極管*1610K排阻*110K電阻*330pf電容*2水銀開關(guān)*1(這個(gè)要小心使用,我用膠槍把它封住了)復(fù)位按鍵*210f電容*1(就是電路圖中的C1,可能看不大清楚)還有如果你想下載的話就焊接ISP接口吧,只要一個(gè)如果你想就買排針焊接,記得要買導(dǎo)線,問一下賣主與排針配套的線是什么就行了。做好一切之后就可以來寫程序啦!不會(huì)寫程序的就直接把程序?qū)戇M(jìn)單片機(jī)吧,就當(dāng)做為我同學(xué)生日做點(diǎn)祝福!以下紅色字是程序主體:/*程序名稱:LED搖搖棒顯示64*16像
3、素簡(jiǎn)要說明:外部中斷方式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)延時(shí)子程序*/void DelayUs(uint Nuint x;for(x=0; x<=N;x+;/*中斷服務(wù)程序*/void intersvr0(void interrupt 0 using 1KY=KY; /每個(gè)搖動(dòng)來回水銀開關(guān)會(huì)在擺幅兩端分別產(chǎn)生下降沿中斷,只提取其中一次(從左向右搖才顯示)if(KY=0num+; /計(jì)算中斷次數(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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025服裝托管合同
- 2025涉外勞動(dòng)技術(shù)服務(wù)合同技術(shù)服務(wù)合同范本
- 2025公路養(yǎng)護(hù)安全合同書
- 2025解除合作合同協(xié)議書范本
- 壓力容器焊工考試試題及答案
- 修理廠勞動(dòng)合同
- 家庭農(nóng)場(chǎng)股東合同范例
- 奔馳g購(gòu)車合同范例
- 口罩 居間合同范例
- 臺(tái)班合同范例
- 5 協(xié)商決定班級(jí)事務(wù) (教學(xué)設(shè)計(jì))-2024-2025學(xué)年道德與法治五年級(jí)上冊(cè)統(tǒng)編版
- 2024年清潔機(jī)器人項(xiàng)目合作計(jì)劃書
- 高校實(shí)驗(yàn)室安全通識(shí)課學(xué)習(xí)通超星期末考試答案章節(jié)答案2024年
- 銀行客戶經(jīng)理招聘面試題與參考回答(某大型集團(tuán)公司)
- 殘疾人體育活動(dòng)推廣與普及考核試卷
- 《安全系統(tǒng)工程》期末考試卷及答案
- 空氣動(dòng)力學(xué)仿真技術(shù):計(jì)算流體力學(xué)(CFD):CFD在飛機(jī)設(shè)計(jì)中的應(yīng)用
- 2024新教材高中政治 第一單元 生產(chǎn)資料所有制與經(jīng)濟(jì)體制 第一課 我國(guó)的生產(chǎn)資料所有制 1.1《公有制為主體 多種所有制經(jīng)濟(jì)共同發(fā)展》教案 部編版必修2
- 2024年北京版小學(xué)英語(yǔ)必背單詞表
- 職業(yè)學(xué)院食品藥品監(jiān)督管理專業(yè)核心課《企業(yè)管理》課程標(biāo)準(zhǔn)
- 建筑公司證書津貼支付管理辦法
評(píng)論
0/150
提交評(píng)論