資源描述:
《矩陣-點陣仿真-有代碼仿真.doc》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、實驗二8*8點陣的設(shè)計一、實驗?zāi)康模?.了解點陣式LED顯示原理。2.掌握單片機(jī)與8×8點陣塊之間接口電路設(shè)計及編程。3.掌握8155工作原理及與單片機(jī)的接口電路設(shè)計。二、實驗要求:利用8×8點陣顯示屏,自己設(shè)計并調(diào)試電路板,實現(xiàn)在單片機(jī)的控制下,點陣顯示屏顯示數(shù)字。三、實驗步驟:1、實驗電路圖2、編碼程序:#include#include#defineucharunsignedchar#defineuintunsignedintuchari=0,n,k;ucharcodeTable[][8]={{~0x00,~
2、0x00,~0x3C,~0x42,~0x42,~0x3C,~0x00,~0x00},{~0x00,~0x00,~0x00,~0x22,~0x7E,~0x02,~0x00,~0x00},{~0x00,~0x00,~0x22,~0x46,~0x4A,~0x32,~0x00,~0x00},{~0x00,~0x00,~0x22,~0x49,~0x49,~0x36,~0x00,~0x00},{~0x00,~0x00,~0x18,~0x28,~0x7E,~0x08,~0x00,~0x00},{~0x00,~0x00,~0x7A,~0x29,~0x29,~0x2E,
3、~0x00,~0x00},{~0x00,~0x00,~0x3E,~0x49,~0x49,~0x26,~0x00,~0x00},{~0x00,~0x00,~0x40,~0x4F,~0x50,~0x60,~0x00,~0x00},{~0x00,~0x00,~0x36,~0x49,~0x49,~0x36,~0x00,~0x00},{~0x00,~0x00,~0x32,~0x49,~0x49,~0x3E,~0x00,~0x00},{~0x91,~0x52,~0x00,~0xA4,~0xF5,~0xBF,~0xF4,~0xA4},{~0x11,~0x13,~0x
4、55,~0x51,~0x55,~0x12,~0x11,~0x00},};ucharcodeTab[]={~0xfe,~0xfd,~0xfb,~0xf7,~0xef,~0xdf,~0xbf,~0x7f};voiddelay(uinti);voidmain(){TMOD=0x00;TH0=(8192-3000)/32;TL0=(8192-3000)%32;TR0=1;EA=1;ET0=1;while(1){n=4;}}voidT0_ISP(void)interrupt1{TH0=(8192-3000)/32;TL0=(8192-3000)%32;P3=Ta
5、b[k++];if(k==8)k=0;P0=Table[n][i];if(++i==8)i=0;}voiddelay(uinti){while(i--);}3、實驗結(jié)果:實驗三:矩陣鍵盤的設(shè)計一、實驗?zāi)康模?、掌握鍵盤接口的基本特點,了解獨立鍵盤和矩陣鍵盤的應(yīng)用方法。2、掌握鍵盤接口的硬件設(shè)計方法,軟件程序設(shè)計和貼士排錯能力。3、復(fù)習(xí)利用Keil51軟件對程序進(jìn)行編譯。4、用Proteus軟件繪制“矩陣鍵盤掃描”電路,并用測試程序進(jìn)行仿真。二、實驗要求?通過實訓(xùn),學(xué)生應(yīng)達(dá)到以下幾方面的要求:(1)素質(zhì)要求1.以積極認(rèn)真的態(tài)度對待本次實訓(xùn),遵章守紀(jì)、團(tuán)結(jié)
6、協(xié)作。?2.善于發(fā)現(xiàn)數(shù)字電路中存在的問題、分析問題、解決問題,努力培養(yǎng)獨立工作能力。??(2)能力要求?1.模擬電路的理論知識?2.脈沖與數(shù)字電路的理念知識?3.通過模擬、數(shù)字電路實驗有一定的動手能力?4.能熟練的編寫8951單片機(jī)匯編程序?5.能夠熟練的運用仿真軟件進(jìn)行仿真三、實訓(xùn)基本步驟??????1、用Proteus繪制“矩陣鍵盤掃描”電路原理圖。2、編寫程序使數(shù)碼管顯示當(dāng)前閉合按鍵的鍵值。(代碼)#include#defineucharunsignedchar#defineuintunsignedintucharcodedis
7、[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0X88,0X83,0XC6,0XA1,0X86,0X8E};ucharcodetab[]={0x77,0xb7,0xd7,0xe7,0x7b,0xbb,0xdb,0xeb,0x7d,0xbd,0xdd,0xed,0x7e,0xbe,0xde,0xee};voiddelay(uintx){uchari;while(x--)for(i=0;i<120;i++);}ucharscan(){uchara,b,c,i;P2=0XF0;delay(10);
8、P2=0X0F;for(i=0;i<16;i++)if(c==tab[i])returni;}