89C52單片機搖搖棒設(shè)計報告_第1頁
89C52單片機搖搖棒設(shè)計報告_第2頁
89C52單片機搖搖棒設(shè)計報告_第3頁
89C52單片機搖搖棒設(shè)計報告_第4頁
89C52單片機搖搖棒設(shè)計報告_第5頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、搖搖棒設(shè)計任務設(shè)計制做一個搖搖棒總體介紹: 大家知道,人的眼睛存在視覺暫留現(xiàn)象,正因為眼睛的反應遲鈍,才豐富了人的視覺感受。意思是時間小于1/24秒人就分辨不出了,led搖搖棒很好地利用了人眼的視覺暫留特性。配合手的左右搖晃就可呈現(xiàn)一幅完整的畫面,可以顯示字符、圖片等。講白了就和點陣的顯示沒什么去別,只是你的手搖晃的過程代替了點陣的片選。下面是總體的設(shè)計電路圖:系統(tǒng)設(shè)計1.1 系統(tǒng)流程圖開始否延時繼續(xù)顯示下一組圖案開始循環(huán),顯示第一個圖案是否顯示完整所有圖案 上電復位查詢是否中斷否取點陣文件顯示并產(chǎn)生新中斷是否達到切換圖片的中斷次數(shù)中斷次數(shù)+1制作所需要的元件參考:16個高亮led5mm紅色小

2、燈12mhz晶振一個200歐姆電阻20個1k電阻兩個水銀開關(guān)一個,按鍵開關(guān)兩個(一個作電源開關(guān),一個做復位開關(guān))20皮法電容2個,20微法電容3個,100微法電容一個,導線若干做好的作品圖:實驗效果圖:搖搖棒源程序:/*=*/* */* 廣東藥學院單片機興趣小組 */* 曹廣輝、馬偉彬、彭東信 */* */*=*/#include#define uchar unsigned char/-兩邊加0x0000是為了兩個字之間延時時不出現(xiàn)字的”拖尾“現(xiàn)象-uchar code ee198 = /-e- 0x00,0x00,0x00,0x00,0x00,0xf8,0x01,0xfc,

3、0x01,0x44,0x01,0x44,0x01,0x44,0x01,0xcc,0x00,0xc8,0x00,0x00,0x00,0x00, /-e-0x00,0x00,0x00,0x00,0x00,0xf8,0x01,0xfc,0x01,0x44,0x01,0x44,0x01,0x44,0x01,0xcc,0x00,0xc8,0x00,0x00,0x00,0x00, /-h- 0x00,0x00,0x10,0x04,0x1f,0xfc,0x1f,0xfc,0x01,0x84,0x01,0x00,0x01,0x04,0x01,0xfc,0x00,0xfc,0x00,0x04,0x00,0x00

4、, /-o- 0x00,0x00,0x00,0x00,0x00,0xf8,0x01,0xfc,0x01,0x04,0x01,0x04,0x01,0x04,0x01,0xf8,0x00,0xf8,0x00,0x00,0x00,0x00, /-m- 0x00,0x00,0x01,0x04,0x01,0xfc,0x01,0xfc,0x01,0x00,0x01,0xfc,0x01,0xfc,0x01,0x00,0x01,0xfc,0x00,0xfc,0x00,0x00, /-e- 0x00,0x00,0x00,0x00,0x00,0xf8,0x01,0xfc,0x01,0x44,0x01,0x44,0

5、x01,0x44,0x01,0xcc,0x00,0xc8,0x00,0x00,0x00,0x00, /-.- 0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x0c,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /-c- 0x00,0x00,0x00,0x00,0x00,0x70,0x00,0xf8,0x01,0x8c,0x01,0x04,0x01,0x04,0x01,0x8c,0x00,0x88,0x00,0x00,0x00,0x00, /-n- 0x00,0x00,0x0

6、1,0x04,0x01,0xfc,0x01,0xfc,0x01,0x84,0x01,0x00,0x01,0x04,0x01,0xfc,0x00,0xfc,0x00,0x00,0x00,0x00;/-兩邊加0x0000是為了兩個字之間延時時不出現(xiàn)字的”拖尾“現(xiàn)象-uchar code hanzi252 = /-生- 0x00, 0x00,0x00,0x80,0x01,0x02,0x06,0x02,0x78,0x82,0x08,0x82,0x08,0x82,0x08,0x82,0x08,0x82, 0xff,0xfe,0x48,0x82,0x08,0x82,0x08,0x82,0x19,0x82,

7、0x08,0x86,0x00,0x02,0x00,0x00,0x00, 0x00, /-物- 0x00, 0x00,0x02,0x20,0x3c,0x20,0x08,0x40,0xff,0xfe,0x08,0x80,0x0b,0x22,0x04,0x44,0x18,0x88, 0xf3,0x10,0x1c,0x20,0x10,0xc2,0x1f,0x01,0x10,0x02,0x1f,0xfc,0x00,0x00,0x00,0x00, 0x00, 0x00, /-醫(yī)- 0x00, 0x00,0x00,0x00,0x7f,0xfe,0x42,0x02,0x45,0x02,0x79,0x0a,0x

8、49,0x12,0x49,0x22,0x49,0xc2, 0x4f,0x02,0x49,0x82,0x49,0x42,0x49,0x3a,0x4b,0x12,0x41,0x02,0x00,0x02,0x00,0x00, 0x00, 0x00, /-學- 0x00, 0x00,0x02,0x00,0x0c,0x40,0x08,0x40,0x48,0x40,0x3a,0x40,0x2a,0x40,0x0a,0x42,0x8a,0x41, 0x7a,0xfe,0x2b,0x40,0x0a,0x40,0x18,0x40,0xea,0x40,0x4c,0x40,0x08,0x40,0x00,0x00,

9、0x00, 0x00, /-工- 0x00, 0x00,0x00,0x04,0x00,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x7f,0xfc, 0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x00,0x04,0x00,0x00, 0x00, 0x00, /-程- 0x00, 0x00,0x08,0x20,0x48,0xc0,0x4b,0x00,0x7f,0xff,0x89,0x00,0x88,0x82,0x01,0x22,0xfd,0x22, 0

10、x85,0x22,0x85,0xfe,0x85,0x22,0x85,0x22,0xfd,0x22,0x01,0x22,0x00,0x02,0x00,0x00, 0x00, 0x00, /-09- 0x00, 0x00,0x00,0x00,0x07,0xf0,0x08,0x08,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xf0,0x00,0x00, 0x00,0x00,0x07,0x00,0x08,0x8c,0x10,0x44,0x10,0x44,0x08,0x88,0x07,0xf0,0x00,0x00, 0x00, 0x00, ;/-兩邊加0x0000是為了兩個

11、字之間延時時不出現(xiàn)字的”拖尾“現(xiàn)象-/*-小心圖-*/uchar code small_heart36 = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xc0,0x07,0xe0,0x07,0xf0,0x07,0xf0,0x03,0xf8, 0x03,0xf8,0x07,0xf0,0x07,0xf0,0x07,0xe0,0x03,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00;/*-大心圖-*/uchar code big_heart36= 0x00,0x00,0x00,0x00,0x0f,0x80,0x

12、1f,0xc0,0x1f,0xe0,0x1f,0xe0,0x1f,0xf0,0x0f,0xf8,0x07,0xfc, 0x07,0xfc,0x0f,0xf8,0x1f,0xf0,0x1f,0xe0,0x1f,0xe0,0x1f,0xc0,0x0f,0x80,0x00,0x00,0x00,0x00;/*-笑臉圖-*/uchar code smile36= 0x00,0x00,0x03,0x80,0x0c,0x60,0x10,0x18,0x20,0xc4,0x4c,0x24,0x4c,0x12,0x4c,0x12,0x40,0x12, 0x40,0x12,0x4c,0x12,0x4c,0x12,0

13、x4c,0x24,0x20,0xc4,0x10,0x18,0x0c,0x60,0x03,0x80,0x00,0x00;/-兩邊加0x0000是為了兩個字之間延時時不出現(xiàn)字的”拖尾“現(xiàn)象-uchar code china144 = /-曹- 0x00,0x00,0x40,0x00,0x40,0x00,0x5f,0x00,0x55,0x7e,0x55,0x54,0x55,0x54,0xff,0x54,0x55,0x54, 0x55,0x54,0xff,0x54,0x55,0x54,0x55,0x54,0x55,0x7e,0x5f,0x00,0x40,0x00,0x00,0x00,0x00,0x00

14、, /-廣- 0x00,0x00,0x00,0x02,0x00,0x0c,0x3f,0xf0,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0xa0,0x00, 0x60,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x00, /-輝- 0x00,0x00,0x08,0x40,0x18,0xc0,0x31,0x80,0x63,0xff,0xef,0xff,0xce,0x00,0x46,0x00,0x22,0x00, 0x22,0x03,0x23,

15、0xff,0x23,0xfe,0x22,0x00,0x22,0x00,0x22,0x00,0x02,0x00,0x00,0x00, 0x00,0x00, /-!- 0x00,0x00,0x24,0x02,0x1c,0x0c,0x07,0xf0,0xfc,0x00,0x17,0xfc,0x24,0x08,0x64,0x10,0x48,0x90, 0x00,0x00,0x4b,0x90,0x7c,0x90,0x4b,0xff,0x48,0x90,0x48,0x90,0x68,0x90,0x40,0x10,0x00,0x00;uchar wave_time = 0;uchar state = 10;

16、 / 無效狀態(tài)uchar flag = 0; / 顯示過一遍則置1/-延時-void delay(uchar time);void main() signed int i; it0 = 1; ie0 = 0; ex0 = 1; ea = 1;/-p1接上面八位,p2接下面八位- p1 = 0xff; p2 = 0xff; while(1) /-如果沒有中斷產(chǎn)生則不顯示- if(!flag) ie0 = 0;/-中斷請求置0- ea = 0;/-關(guān)中斷- /-狀態(tài)轉(zhuǎn)換- switch(state) /-- case 0: delay(10); / 使圖形在中央附近顯示 for(

17、i = sizeof(ee)-1;i = 0;i-) p1 = eei; p2 = ee-i; delay(2); flag = 1; break; /-生物醫(yī)學工程09- case 1: delay(10); / 使圖形在中央附近顯示 for(i = sizeof(hanzi)-1;i = 0;i-) p1 = hanzii; p2 = hanzi-i; delay(2); flag = 1; break; /-曹廣輝!- case 2: delay(15); / 使圖形在中央附近顯示 for(i = sizeof(china)-1;i = 0;i-) p1 = chinai; p2 = c

18、hina-i; delay(2); flag = 1; break; /-笑臉- case 3: delay(30); / 使圖形在中央附近顯示 for(i = sizeof(smile)-1;i = 0;i-) p1 = smilei; p2= smile-i; delay(5); flag = 1; break; /-心跳(?。? case 4: delay(30); / 使圖形在中央附近顯示 for(i = sizeof(small_heart)-1;i = 0;i-) p1 = small_hearti; p2 = small_heart-i; delay(5); flag = 1; break; /-心跳(大)- case 5: delay(30); / 使圖形在中央附近顯示 for(i = sizeof(big_heart)-1;i = 0;i-) p1 = big_hearti; p2 = big_heart-i; delay(5); flag = 1; break; /-其它不顯示- def

溫馨提示

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

評論

0/150

提交評論