LED點陣字符驅(qū)動顯示實驗報告_第1頁
LED點陣字符驅(qū)動顯示實驗報告_第2頁
LED點陣字符驅(qū)動顯示實驗報告_第3頁
LED點陣字符驅(qū)動顯示實驗報告_第4頁
LED點陣字符驅(qū)動顯示實驗報告_第5頁
已閱讀5頁,還剩4頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

LED點陣字符驅(qū)動顯示實驗 鄭家貴110800533陳鶴110800524一實驗?zāi)康恼莆沼肅PU控制掃描的方法實現(xiàn)點陣LED顯示器的字符、圖形的顯示。掌握用單片機進(jìn)行顯示系統(tǒng)開發(fā)的方法。了解大容量顯示器點陣圖形顯示驅(qū)動擴展的一般方法。二實驗儀器單片機最小系統(tǒng),電源模塊,8*8點陣LED顯示器四塊,AT89C51單片機,74HC154N兩片,HD74LSO4P一片,100排阻等。三設(shè)計思想用單片機的P1.0-P1.4和P2.0-P2.7共13個輸出口來傳遞數(shù)據(jù)碼,其中P1.0-P1.3分別接4線-16線譯碼器的四個數(shù)據(jù)輸入端(A、B、C、D),P1.4作為片選輸出信號,當(dāng)P1.4為高電平時,U2工作,U3不工作;當(dāng)P1.4為低電平輸出,U2不工作,U3工作。信號經(jīng)過74HC154N譯碼后輸出,再接至4片點陣LED的行信號輸入端,而列信號由單片機的P2口直接控制。1、系統(tǒng)框圖:圖1:16X16點陣硬件電路圖2、單片機最小系統(tǒng):上圖是51單片機的最小系統(tǒng)。將程序燒寫進(jìn)單片機后,便可以實現(xiàn)對硬件系統(tǒng)的控制。3、LED點陣顯示屏:上圖即顯示屏,是由4塊8*8LED點陣級聯(lián),成為16*16LED點陣。由單片機控制,按照程序中的控制命令和字模數(shù)據(jù)表輸出相應(yīng)漢字,同時按一定速率流動,顯示多個漢字。4、74HC154N工作原理:74HC154N為4線—16線譯碼器,可以實現(xiàn)地址的擴展。引腳說明:1-11,3-17:輸出端(outputs)12:Gnd電源地(ground)18-19:使能輸入端、低電平有效(enableinputs)20-23地址輸入端(addressinputs)24:VCC電源正(positivesupplyvoltage)四設(shè)計的電路樣品的照片如圖下圖所示五實驗結(jié)論及心得:通過和同伴的一致努力,最終完成了整個電路的設(shè)計。雖然實現(xiàn)的功能并不多,但是在焊制整個電路時,總會出現(xiàn)各種問題,在解決這些問題的過程中對各模塊進(jìn)行調(diào)試,最終實現(xiàn)設(shè)計目標(biāo)。16X16點陣字符顯示利用人眼視覺殘留效應(yīng),實現(xiàn)LED字符穩(wěn)定顯示。顯示驅(qū)動原理先送行掃描一位后立即送列數(shù)據(jù)直到16位數(shù)據(jù)送完,當(dāng)時鐘足夠快時看到的就是完整的字符了。因為采用了16X16而MCU為8位,故在送數(shù)據(jù)時應(yīng)送2次。通過這次試驗,讓我對單片機的使用產(chǎn)生了更大的興趣,也對自己的動手能力有了更大的信心。實驗程序參考電子版#include<AT89X52.h>#defineucharunsignedchar#defineuintunsignedintuchartable1[]={0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,/*"_",0*/0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,/*"_",1*/};/*上移顯示的字符*/ ucharcodetable[]={0x00,0x00,0xFE,0xFF,0x22,0x04,0x5A,0x08,0x86,0x07,0x08,0x20,0x88,0x11,0x68,0x0D,0x18,0x41,0x0F,0x81,0xE8,0x7F,0x08,0x01,0x08,0x05,0x08,0x09,0x08,0x30,0x00,0x00,/*"陳",0*/0x00,0x02,0x02,0x02,0x0C,0x7F,0xC0,0x00,0x00,0x10,0x20,0x08,0x20,0x06,0xE0,0x41,0x00,0x80,0xFF,0x7F,0x70,0x00,0xA0,0x01,0x10,0x06,0x08,0x08,0x00,0x10,0x00,0x00,/*"冰",1*/0x04,0x01,0x84,0x00,0xC4,0xFF,0x34,0x00,0x04,0x00,0x2F,0x1F,0x24,0x11,0x24,0x11,0x24,0x11,0x2F,0x1F,0x24,0x40,0x24,0x80,0xE4,0x7F,0x24,0x00,0x24,0x00,0x00,0x00,/*"荷",2*/0x00,0x00,0x10,0x20,0x10,0x20,0xF8,0x3F,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,/*"1",3*/0x00,0x00,0x10,0x20,0x10,0x20,0xF8,0x3F,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,/*"1",4*/0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00,/*"0",5*/0x00,0x00,0x70,0x1C,0x88,0x22,0x08,0x21,0x08,0x21,0x88,0x22,0x70,0x1C,0x00,0x00,/*"8",6*/0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00,/*"0",7*/0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00,/*"0",8*/0x00,0x00,0xF8,0x19,0x08,0x21,0x88,0x20,0x88,0x20,0x08,0x11,0x08,0x0E,0x00,0x00,/*"5",9*/0x00,0x00,0x70,0x30,0x08,0x28,0x08,0x24,0x08,0x22,0x88,0x21,0x70,0x30,0x00,0x00,/*"2",10*/0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00,/*"0",11*///至此字模插入結(jié)束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};ucharcodetable2[]={0x40,0x00,0x42,0x00,0xCC,0x3F,0x00,0x10,0x00,0x2A,0xFC,0x13,0x56,0x4A,0x55,0x86,0xFC,0x7F,0x80,0x00,0x10,0x43,0x10,0x80,0xFF,0x7F,0x10,0x00,0x10,0x00,0x00,0x00,/*"謝",0*/0x00,0x20,0xC2,0x10,0xBA,0x08,0x82,0x46,0x82,0x81,0xFE,0x7F,0xA2,0x00,0x90,0x00,0xFC,0xFF,0x4B,0x22,0x48,0x22,0xF9,0x3F,0x4A,0x22,0x48,0x22,0x08,0x20,0x00,0x00,/*"雅",1*/0x00,0x01,0x80,0x00,0x60,0x00,0xF8,0xFF,0x47,0x40,0x40,0x40,0x44,0x44,0x44,0x44,0x44,0x44,0x7F,0x7F,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x40,0x40,0x00,0x00,/*"佳",2*/0x00,0x00,0x10,0x20,0x10,0x20,0xF8,0x3F,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,/*"1",3*/0x00,0x00,0x10,0x20,0x10,0x20,0xF8,0x3F,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,/*"1",4*/0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00,/*"0",5*/0x00,0x00,0x70,0x1C,0x88,0x22,0x08,0x21,0x08,0x21,0x88,0x22,0x70,0x1C,0x00,0x00,/*"8",6*/0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00,/*"0",7*/0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00,/*"0",8*/0x00,0x00,0xF8,0x19,0x08,0x21,0x88,0x20,0x88,0x20,0x08,0x11,0x08,0x0E,0x00,0x00,/*"5",9*/0x00,0x00,0x00,0x07,0xC0,0x04,0x20,0x24,0x10,0x24,0xF8,0x3F,0x00,0x24,0x00,0x00,/*"4",10*/0x00,0x00,0xE0,0x0F,0x10,0x11,0x88,0x20,0x88,0x20,0x18,0x11,0x00,0x0E,0x00,0x00,/*"6",11*///至此字模插入結(jié)束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}; /*逐屏顯示字符*/ucharv,flag,temp;uchari,j,k,shuz,shub,temp1;uchara,b,c,d,e,f,numa,numb;ucharii,jj,kk;uchariii,jjj,kkk;uchara3,b3;ucharnum3,temp3;uchartemp2; intzw; /*各變量值的初始化*/voidinit(); /*主函數(shù)的初始化聲名*/ voidinit1(); /*左移顯示方式的初始化聲名*/voidinit2(); /*上移顯示方式的初始化聲名*/voidinit3(); /*逐屏顯示方式的初始化聲名*/voiddisp1(); /*左移顯示子程序聲名*/ voiddisp2(); /*上移顯示子程序聲名*/voiddisp3(); /*逐屏顯示子程序聲名*/voiddelay(uintz)/*延時函數(shù)聲名及定義*/{ uintx,y;for(x=z;x>0;x--) { for(y=110;y>0;y--);}} voidmain(){ init(); flag=0; P0=0xFF; P2=0XFF; P1_3=0; P1=0x00; for(zw=0;zw<2;zw++) { for(;(P1&0x07)<0x07;P1++) delay(350); P1=P1|0x07; delay(350); P1_3=~P1_3; P1=P1&0xF8; } flag=1;//選擇當(dāng)前顯示方式為上移顯示 init2(); //上移顯示初始化 for(ii=0;ii<=15;ii++) //上移緩沖 { for(jj=0;jj<=v;jj++) //向上移動的速度由變量v控制 { for(kk=0;kk<=15;kk++) //顯示一幕 disp2(); //若沒有中斷調(diào)用左移顯示子程序 delay(1); } } flag=0; //選擇當(dāng)前顯示方式為左移顯示 init1(); //左移顯示初始化 for(i=0;i<=a;i++) //判斷左移的字符個數(shù) for(j=0;j<=v;j++) //向左移動的速度由變量v控制 for(k=i*2;k<(i*2+32);) //顯示一幕 disp1(); //若沒有中斷調(diào)用左移顯示子程序 flag=2;//選擇當(dāng)前顯示方式為逐屏顯示 init3();//逐屏顯示初始化 for(iii=0;iii<=7*32;iii=iii+32)//判斷逐屏顯示的字符個數(shù) for(jjj=0;jjj<=v*10;jjj++)//逐屏顯示字符的速度由變量v控制 { for(kkk=0;kkk<=15;kkk++) //顯示一幕 disp3();//若沒有中斷調(diào)用閃爍顯示子程序 num3=0; temp3=0; //顯示完一幕準(zhǔn)備下一幕的顯示 } }voidinit() //主程序初始化{ EA=1; //CPU開放所有中斷源的中斷請求 EX0=1; //允許外部中斷0中斷 EX1=1; //允許外部中斷1中斷 IT0=1; //外部中斷0采用邊沿觸發(fā)方式產(chǎn)生中斷 IT1=1; //外部中斷1采用邊沿觸發(fā)方式產(chǎn)生中斷 v=15; //設(shè)置移動速度的初值}voidinit1() //左移顯示方式各變量的初始化{ shuz=5; shub=1; a=shuz*16+shub*8+16; P0=0; P2=0; temp1=0;}voiddisp1() //左移顯示子程序{ P0=table[k]; k++; P2=table[k]; k++; P1=temp1; temp1++; if(temp1==0x10) temp1=0x00; delay(1); }voidinit2() //上移

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論