版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
...wd......wd......wd...數(shù)字電路綜合實(shí)驗(yàn)報(bào)告簡易智能密碼鎖一、實(shí)驗(yàn)課題及任務(wù)要求設(shè)計(jì)并實(shí)現(xiàn)一個(gè)數(shù)字密碼鎖,密碼鎖有四位數(shù)字密碼和一個(gè)確認(rèn)開鎖按鍵,密碼輸入正確,密碼鎖翻開,密碼輸入錯(cuò)誤進(jìn)展警示。根本要求:1、密碼設(shè)置:通過鍵盤進(jìn)展4位數(shù)字密碼設(shè)定輸入,在數(shù)碼管上顯示所輸入數(shù)字。通過密碼設(shè)置確定鍵〔BTN鍵〕進(jìn)展鎖定。2、開鎖:在閉鎖狀態(tài)下,可以輸入密碼開鎖,且每輸入一位密碼,在數(shù)碼管上顯示“-〞,提示已輸入密碼的位數(shù)。輸入四位核對密碼后,按“開鎖〞鍵,假設(shè)密碼正確則系統(tǒng)開鎖,假設(shè)密碼錯(cuò)誤系統(tǒng)仍然處于閉鎖狀態(tài),并用蜂鳴器或led閃爍報(bào)警。3、在開鎖狀態(tài)下,可以通過密碼復(fù)位鍵〔BTN鍵〕來去除密碼,恢復(fù)初始密碼“0000〞。閉鎖狀態(tài)下不能去除密碼。4、用點(diǎn)陣顯示開鎖和閉鎖狀態(tài)。提高要求:1、輸入密碼數(shù)字由右向左依次顯示,即:每輸入一數(shù)字顯示在最右邊的數(shù)碼管上,同時(shí)將先前輸入的所有數(shù)字向左移動(dòng)一位。2、密碼鎖的密碼位數(shù)〔4~6位〕可調(diào)。3、自擬其它功能。二、系統(tǒng)設(shè)計(jì)2.1系統(tǒng)總體框圖2.2邏輯流程圖2.3MDS圖2.4分塊說明程序主要分為6個(gè)模塊:鍵盤模塊,數(shù)碼管模塊,點(diǎn)陣模塊,報(bào)警模塊,防抖模塊,控制模塊。以下進(jìn)展詳細(xì)介紹。鍵盤模塊本模塊主要完成是4×4鍵盤掃描,然后獲取其鍵值,并對其進(jìn)展編碼,從而進(jìn)展按鍵的識別,并將相應(yīng)的按鍵值進(jìn)展顯示。鍵盤掃描的實(shí)現(xiàn)過程如下:對于4×4鍵盤,通常連接為4行、4列,因此要識別按鍵,只需要知道是哪一行和哪一列即可,為了完成這一識別過程,我們的思想是,首先固定輸出高電平,在讀入輸出的行值時(shí),通常高電平會(huì)被低電平拉低,當(dāng)當(dāng)前位置為高電平“1〞時(shí),沒有按鍵按下,否則,如果讀入的4行有一位為低電平,那么對應(yīng)的該行肯定有一個(gè)按鍵按下,這樣便可以獲取到按鍵的行值。同理,獲取列值也是如此,先輸出4列為高電平,然后在輸出4行為低電平,再讀入列值,如果其中有哪一位為低電平,那么肯定對應(yīng)的那一列有按鍵按下。由此可確定按鍵位置。X78按鍵儲(chǔ)存鍵盤譯碼消抖9按鍵儲(chǔ)存鍵盤譯碼消抖X456X123XX0鍵盤掃描x鍵盤掃描〔X為無效按鍵〕2.數(shù)碼管模塊本實(shí)驗(yàn)采用六位七段共陰極數(shù)碼管,通過選通6個(gè)位選管腳,向相應(yīng)的IO口送低電平來點(diǎn)亮其中任何一位數(shù)碼管,因?yàn)楝F(xiàn)在采用四位密碼鎖,所以只是用了其中四個(gè),最高位兩位數(shù)碼管位選全部置1.如下附上7段共陰極數(shù)碼管真值表3.點(diǎn)陣模塊點(diǎn)陣模塊,共由8*8*2個(gè)發(fā)光二極管組成,行低電平有效,列高電平有效。要求在開鎖模式和閉鎖模式顯示不同的圖案,則先將要顯示的每幅圖像畫8*8個(gè)小方格的矩形框中,再在有圖案下落處的小方格里填上“1〞,無圖案處填上“0〞,這樣就形成了與圖案所對應(yīng)的二進(jìn)制數(shù)據(jù)在該矩形框上的分布。當(dāng)閉鎖時(shí)以紅色點(diǎn)陣顯示,此時(shí)綠色點(diǎn)陣全部置0,反之亦然。4.報(bào)警模塊當(dāng)報(bào)警程序被調(diào)用,蜂鳴器輸出高電平進(jìn)展報(bào)警,表示輸入密碼錯(cuò)誤5.防抖按鍵輸入只有為15ms以上的高電平時(shí)才會(huì)讀出按鍵值從而消除電路中的抖動(dòng)。6.控制中心lockmode='1表示關(guān)鎖,此時(shí)點(diǎn)陣顯示落鎖,按任何鍵都不會(huì)顯示密碼,清零或者開鎖,在此時(shí)輸入密碼kwei從0開場不斷加1,輸入的密碼位數(shù)在數(shù)碼管上依次左移,當(dāng)輸入密碼m與存放器中預(yù)設(shè)密碼mm一樣時(shí),按下確認(rèn)鍵btn2切換為開鎖狀態(tài),lockmode=0,此時(shí)按下btn1表示清零,恢復(fù)為初始密碼0000,按set鍵存放器內(nèi)密碼,按下btnloc切換為關(guān)鎖狀態(tài)。三、仿真波形分析在QUARTUS2中應(yīng)用系統(tǒng)自帶的功能進(jìn)展波形仿真,這里采用了分模塊仿真。主程序仿真在主要功能程序方面波形如下,在初始化模式按下set鍵系統(tǒng)進(jìn)入修改密碼狀態(tài),setmode波形顯示高電平。為仿真方便,僅使kbin〔即行輸入信號〕在1011和1111兩個(gè)狀態(tài)下相互轉(zhuǎn)換,在不同的kbout〔即列掃描輸出信號〕下分別對應(yīng)4、5、6、7四個(gè)數(shù)字,故密碼存放器m[x]為輸入的修改后的密碼。按下btn2〔確認(rèn)鍵〕確認(rèn)密碼后,setmode變?yōu)榈碗娖剑葱薷拿艽a狀態(tài)完畢。按下btn1時(shí)清零,密碼存放器取值復(fù)原為0000,至此均為開鎖狀態(tài)下的操作,lockmode一直為低電平。按下閉鎖鍵btnloc后,lockmode從0跳變到1,由此進(jìn)入閉鎖模式。按鍵消抖模塊仿真當(dāng)按下鍵時(shí)得到的高電平為輸入x,持續(xù)一定時(shí)間前方可輸出一個(gè)高電平,而無論按下的時(shí)間多長,都只輸出一個(gè)高電平y(tǒng),從而實(shí)現(xiàn)消除按鍵電路中的抖動(dòng)。分頻模塊仿真為仿真方便,改變分頻比。原程序在50Mhz時(shí)鐘輸入下,輸出分別為1Mhz、 200hz、1000hz、500hz,分別用于鍵盤掃描、消抖模塊輸入、點(diǎn)陣掃描以及數(shù)碼管掃描。數(shù)碼管模塊仿真由smgcatout輸出可以看出低四位數(shù)碼管依次選通。第i位選通時(shí),smgzf為m[i]的七段數(shù)碼管的譯碼值。點(diǎn)陣模塊仿真當(dāng)lockmode=1時(shí)dzcolr全部為0僅dzcolg顯示圖案;當(dāng)lockmode=0時(shí)dzcolg全部為0由dzcolr顯示圖案;而dzrow一直在進(jìn)展行掃描,形成了兩種不同顏色點(diǎn)陣。報(bào)警模塊仿真當(dāng)bj=0時(shí),fmq為0;bj=1時(shí),fmq將clk分頻后輸出,即蜂鳴器發(fā)出聲響。四、源程序-----------------------頂層文件-------------------------libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitylockisport(clk:instd_logic;setmode:outstd_logic;lockmode:outstd_logic;set:instd_logic;btn1,btn2,btnloc:instd_logic;smgzf:outstd_logic_vector(6downto0);smgcatout:outstd_logic_vector(5downto0);kbin:instd_logic_vector(3downto0);kbout:bufferstd_logic_vector(3downto0);dzrow,dzcolr,dzcolg:outstd_logic_vector(7downto0);fmq:outstd_logic);endlock;architecturebehaveoflockissignalsetm:std_logic;signallockm:std_logic;signallbj:std_logic;signallkwei:integerrange0to4;signallm1,lm2,lm3,lm4:integerrange0to9;signalclk_1:std_logic; --1MHz signalclk_2:std_logic; --200Hz signalclk_3:std_logic; --1000Hzsignalclk_4:std_logic;--500Hzcomponentkbis-----------鍵盤模塊port(clk:instd_logic;set:instd_logic;btn1,btn2,btnloc:instd_logic;kbin:instd_logic_vector(3downto0);kbout:bufferstd_logic_vector(3downto0);bj:outstd_logic;setmod:outstd_logic;lockmod:outstd_logic;kbwei:outintegerrange0to4;m1x,m2x,m3x,m4x:outintegerrange0to9);endcomponent;componentsmgis-------------數(shù)碼管顯示模塊port(clk:instd_logic;setmode:instd_logic;lockmode:instd_logic;kwei:inintegerrange0to4;m1,m2,m3,m4:inintegerrange0to9;smgzf:outstd_logic_vector(6downto0);smgcatout:outstd_logic_vector(5downto0));endcomponent;componentdzis-----點(diǎn)陣模塊port(clk:instd_logic;--set:instd_logic;lockmode:instd_logic;dzrow,dzcolr,dzcolg:outstd_logic_vector(7downto0));endcomponent;componentalarmis------報(bào)警模塊port(clk:instd_logic;bj:instd_logic;fmq:outstd_logic);endcomponent;componentfenpinis-------分頻模塊 port(clk:instd_logic; clk_out1:outstd_logic; clk_out2:outstd_logic; clk_out3:outstd_logic; clk_out4:outstd_logic); endcomponent;begina1:fenpinportmap(clk=>clk,clk_out1=>clk_1,clk_out2=>clk_2,clk_out3=>clk_3,clk_out4=>clk_4);u1:kbportmap(clk=>clk,set=>set,btn1=>btn1,btn2=>btn2,btnloc=>btnloc,kbin=>kbin,kbout=>kbout,bj=>lbj,setmod=>setm,lockmod=>lockm,kbwei=>lkwei,m1x=>lm1,m2x=>lm2,m3x=>lm3,m4x=>lm4);u2:smgportmap(clk=>clk_4,setmode=>setm,lockmode=>lockm,kwei=>lkwei,m1=>lm1,m2=>lm2,m3=>lm3,m4=>lm4,smgzf=>smgzf,smgcatout=>smgcatout);u3:dzportmap(clk=>clk_3,lockmode=>lockm,dzrow=>dzrow,dzcolr=>dzcolg,dzcolg=>dzcolr);u4:alarmportmap(clk=>clk,bj=>lbj,fmq=>fmq);setmode<=setm;lockmode<=lockm;end;-----------------------鍵盤模塊-------------------------libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitykbisport(clk:instd_logic;set:instd_logic;btn1,btn2,btnloc:instd_logic;kbin:instd_logic_vector(3downto0);kbout:bufferstd_logic_vector(3downto0);bj:outstd_logic;setmod:outstd_logic;lockmod:outstd_logic;kbwei:outintegerrange0to4;m1x,m2x,m3x,m4x:outintegerrange0to9);endkb;architecturebehaveofkbissignaljpout:integerrange0to10;signalalarm:std_logic;signaltmp4:integerrange0to2499999;signalclkfd:std_logic;signalm1,m2,m3,m4,mm1,mm2,mm3,mm4:integerrange0to9;signalwei:integerrange0to3;signalkwei:integerrange0to4;signalsetmode:std_logic;signallockmode:std_logic;signalset1:std_logic;signalclear:std_logic;signalsure:std_logic;signallock:std_logic;signalen,finish:std_logic; signalbtn1_out,btn2_out,btnloc_out,set_out:std_logic; signalclk_1:std_logic; --1MHz signalclk_2:std_logic; --200Hz componentscanis port(clk_1:instd_logic; clk_2:instd_logic; row:instd_logic_vector(3downto0); col:bufferstd_logic_vector(3downto0); en_up:bufferstd_logic; y:outintegerrange0to10); endcomponent; componentfenpinis port(clk:instd_logic; clk_out1:outstd_logic; clk_out2:outstd_logic; clk_out3:outstd_logic; clk_out4:outstd_logic); endcomponent; componentdebounceis port(clk,x:instd_logic; y:outstd_logic); endcomponent;beginsetmod<=setmode;lockmod<=lockmode;bj<=alarm;kbwei<=kwei;m1x<=m1;m2x<=m2;m3x<=m3;m4x<=m4;u1:scanportmap(clk_1=>clk_1,clk_2=>clk_2,row=>kbin,col=>kbout,en_up=>en,y=>jpout);u2:fenpinportmap(clk=>clk,clk_out1=>clk_1,clk_out2=>clk_2,clk_out3=>open,clk_out4=>open);u3:debounceportmap(clk=>clk_2,x=>btn1,y=>btn1_out);u4:debounceportmap(clk=>clk_2,x=>btn2,y=>btn2_out);u5:debounceportmap(clk=>clk_2,x=>btnloc,y=>btnloc_out);u6:debounceportmap(clk=>clk_2,x=>set,y=>set_out);process(clk)beginif(clk'eventandclk='1')thenif(tmp4=2499999)thentmp4<=0;clkfd<=notclkfd;elsetmp4<=tmp4+1;endif;endif;endprocess;process(clk_1,en,jpout)beginif(clk_1'eventandclk_1='1')thenif(lockmode='1')then----------閉鎖狀態(tài)下輸入密碼并讀入按鍵值后存入mmwei<=0;if(jpout/=10)thenif(kwei=3)thenmm4<=jpout;kwei<=kwei+1;elsif(kwei=2)thenmm3<=jpout;kwei<=kwei+1;elsif(kwei=1)thenmm2<=jpout;kwei<=kwei+1;elsif(kwei=0)thenmm1<=jpout;kwei<=kwei+1;endif;endif;if(sure='1')then---------確認(rèn)后判斷密碼是否正確if((mm1=m1)and(mm2=m2)and(mm3=m3)and(mm4=m4))thenlockmode<='0';alarm<='0';----------正確開鎖elsekwei<=0;alarm<='1';----------錯(cuò)誤報(bào)警endif;endif;elsekwei<=0;---------------開鎖狀態(tài)下if(lock='1')then--------------上鎖lockmode<='1';elseif(set1='1')thensetmode<='1';-------修改密碼elsesetmode<='0';endif;if(clear='1')then-----------清零m1<=0;m2<=0;m3<=0;m4<=0;--mm1<=0;mm2<=0;mm3<=0;mm4<=0;wei<=0;kwei<=0;alarm<='0'elsif(setmode='1')thenif(jpout/=10)then----------------修改密碼狀態(tài)下讀入按鍵值存入m并移位if(wei=0)thenm1<=m2;m2<=m3;m3<=m4;m4<=jpout;wei<=wei+1;elsif(wei=1)thenm1<=m2;m2<=m3;m3<=m4;m4<=jpout;wei<=wei+1;elsif(wei=2)thenm1<=m2;m2<=m3;m3<=m4;m4<=jpout;wei<=wei+1;elsif(wei=3)thenm1<=m2;m2<=m3;m3<=m4;m4<=jpout;wei<=0;endif;endif;if(sure='1')then-----------確認(rèn)后完畢修改密碼狀態(tài)setmode<='0';alarm<='0';endif;endif;endif;endif;endif;endprocess;process(set,sure)--------修改密碼鍵beginif(clkfd'eventandclkfd='1')thenif(set='1')thenset1<='1';endif;if(sure='1')thenset1<='0';endif;endif;endprocess;process(btn1)-----------清零鍵beginif(btn1='1')thenclear<='1';elseclear<='0';endif;endprocess;process(btn2)----------確認(rèn)鍵beginif(btn2='1')thensure<='1';elsesure<='0';endif;endprocess;process(btnloc)-----閉鎖鍵beginif(btnloc='1')thenlock<='1';elselock<='0';endif;endprocess;end;----------------------------鍵盤掃描-------------------------libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityscanis port( clk_1:instd_logic; --高頻(forscan)1Mhzclkout1 clk_2:instd_logic; --低頻(fordebounce)200hzclkout2 row:instd_logic_vector(3downto0); col:bufferstd_logic_vector(3downto0); en_up:outstd_logic; y:outintegerrange0to10 );endscan;architectureaofscanis signalen:std_logic; componentdebounceis port(clk,x:instd_logic; y:outstd_logic);endcomponent;begin u1:debounceportmap(clk=>clk_2,x=>en,y=>en_up); process(clk_1) begin if(clk_1'eventandclk_1='1')then---------列掃描 if(en='1')then col<="1000"; else casecolis when"1110"=>col<="1101"; when"1101"=>col<="1011"; when"1011"=>col<="1110"; whenothers=>col<="1110"; endcase; endif; endif; endprocess; process(clk_1,col,row) begin if(clk_1'eventandclk_1='1')then casecolis when"1000"=> if((row(3)androw(2)androw(1)androw(0))='1')then en<='0'; endif; when"1110"=> caserowis --when"1110"=>y<="1111"; when"1101"=>y<=1;en<='1';--1 when"1011"=>y<=4;en<='1';--4 when"0111"=>y<=7;en<='1';--7 whenothers=>y<=10; endcase; when"1101"=> caserowis when"1110"=>y<=0;en<='1';--0 when"1101"=>y<=2;en<='1';--2 when"1011"=>y<=5;en<='1';--5 when"0111"=>y<=8;en<='1';--8 whenothers=>y<=10; endcase; when"1011"=> caserowis --when"1110"=>y<="1111"; when"1101"=>y<=3;en<='1';--3 when"1011"=>y<=6;en<='1';--6 when"0111"=>y<=9;en<='1';--9 whenothers=>y<=10; endcase; whenothers=>null; endcase; endif; endprocess;enda;----------------------------消抖-------------------------libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitydebounceis port( clk,x:instd_logic;-------------200hz低頻時(shí)鐘 y:outstd_logic );enddebounce;architectureaofdebounceis typestateis(s0,s1,s2,s3,s4);------------5個(gè)狀態(tài) signalpre_s,next_s:state;begin process(clk) begin if(clk'eventandclk='1')then pre_s<=next_s; endif; endprocess; process(pre_s,x)-------輸入為連續(xù)3個(gè)或以上的高電平時(shí),輸出一個(gè)高電平 begin casepre_sis whens0=>-----------初始狀態(tài)s0 if(x='1')then next_s<=s1; else next_s<=s0; endif; y<='0'; whens1=> if(x='1')then next_s<=s2; else next_s<=s0; endif; y<='0'; whens2=> if(x='1')then next_s<=s3; else next_s<=s0; endif; y<='0'; whens3=>------------連續(xù)3個(gè)高電平,輸出一個(gè)高電平 y<='1'; next_s<=s4; whens4=>----------3個(gè)以上高電平,不再繼續(xù)輸出高電平 y<='0'; if(x='1')then next_s<=s4; else next_s<=s0; endif; endcase; endprocess;enda;---------------------------分頻模塊-------------------------libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityfenpinis port( clk:instd_logic; clk_out1:outstd_logic; clk_out2:outstd_logic; clk_out3:outstd_logic; clk_out4:outstd_logic );endfenpin;architecturedivoffenpinis constantdiv1:integer:=24;--1Mhz,用于鍵盤掃描 constantdiv2:integer:=124999;--200hz,用于消抖 constantdiv3:integer:=24999;--1000hz,用于點(diǎn)陣掃描 constantdiv4:integer:=49999;--500hz,用于數(shù)碼管掃描 signalc1:integerrange0todiv1; signalc2:integerrange0todiv2; signalc3:integerrange0todiv3; signalc4:integerrange0todiv4; signaltemp1:std_logic; signaltemp2:std_logic; signaltemp3:std_logic; signaltemp4:std_logic;beginprocess(clk) begin if(clk'eventandclk='1')then if(c1=div1)then temp1<=nottemp1; c1<=0; else c1<=c1+1; endif; if(c2=div2)then temp2<=nottemp2; c2<=0; else c2<=c2+1; endif; if(c3=div3)then temp3<=nottemp3; c3<=0; else c3<=c3+1; endif; if(c4=div4)then temp4<=nottemp4; c4<=0; else c4<=c4+1; endif; endif; endprocess; clk_out1<=temp1; clk_out2<=temp2; clk_out3<=temp3; clk_out4<=temp4;enddiv;------------------------------------數(shù)碼管-------------------------------libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitysmgisport(clk:instd_logic;--500hzclkout4setmode:instd_logic;lockmode:instd_logic;kwei:inintegerrange0to4;m1,m2,m3,m4:inintegerrange0to9;----------四位密碼的值smgzf:outstd_logic_vector(6downto0);---------編碼值smgcatout:outstd_logic_vector(5downto0));endsmg;architecturebehaveofsmgissignalsmgcat:integerrange0to5;signalm1y,m2y,m3y,m4y:std_logic_vector(6downto0);beginprocess(clk)-----------位選碼beginif(clk'eventandclk='1')thenif(smgcat=5)thensmgcat<=0;elsesmgcat<=smgcat+1;endif;endif;endprocess;process(setmode,lockmode,smgcat)beginif(lockmode='0')thencasesmgcatis--------------輸入密碼值在數(shù)碼管顯示,從左到右when0=>smgcatout<="110111";smgzf<=m1y;when1=>smgcatout<="111011";smgzf<=m2y;when2=>smgcatout<="111101";smgzf<=m3y;when3=>smgcatout<="111110";smgzf<=m4y;when4=>smgcatout<="111111";when5=>smgcatout<="111111";endcase;elsesmgzf<="0000001";--------------輸入密碼在數(shù)碼管顯示“-〞if(kwei=1)thensmgcatout<="111110";elsif(kwei=2)thensmgcatout<="111100";elsif(kwei=3)thensmgcatout<="111000";elsif(kwei=4)thensmgcatout<="110000";elsesmgcatout<="111111";endif;endif;endprocess;process(m1)--------------七段數(shù)碼管真值表begincasem1iswhen0=>m1y<="1111110";when1=>m1y<="0110000";when2=>m1y<="1101101";when3=>m1y<="1111001";when4=>m1y<="0110011";when5=>m1y<="1011011";when6=>m1y<="1011111";when7=>m1y<="1110000";when8=>m1y<="1111111";when9=>m1y<="1111011";whenothers=>m1y<="0000000";endcase;endprocess;process(m2)begincasem2iswhen0=>m2y<="1111110";when1=>m2y<="0110000";when2=>m2y<="1101101";when3=>m2y<="1111001";when4=>m2y<="0110011";when5=>m2y<="1011011";when6=>m2y<="1011111";when7=>m2y<="1110000";when8=>m2y<="1111111";when9=>m2y<="1111011";whenothers=>m2y<="0000000";endcase;endprocess;process(m3)begincasem3iswhen0=>m3y<="1111110";when1=>m3y<="0110000";when2=>m3y<="1101101";when3=>m3y<="1111001";when4=>m3y<="0110011";when5=>m3y<="1011011";when6=>m3y<="1011111";when7=>m3y<="1110000";when8=>m3y<="1111111";when9=>m3y<="1111011";whenothers=>m3y<="0000000";endcase;endprocess;process(m4)begincasem4iswhen0=>m4y<="1111110";when1=>m4y<="0110000";when2=>m4y<="1101101";when3=>m4y<="1111001";when4=>m4y<="0110011";when5=>m4y<="1011011";when6=>m4y<="1011111";when7=>m4y<="1110000";when8=>m4y<="1111111";when9=>m4y<="1111011";whenothers=>m4y<="0000000";endcase;endprocess;end;------------------------點(diǎn)陣-------------------------------libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitydzisport(clk:instd_logic;--1000hzclkout3lockmode:instd_logic;dzrow,dzcolr,dzcolg:outstd_logic_vector(7downto0));enddz;architecturebehaveofdzissignaldzcat:integerrange0to7;beginprocess(clk)----------------------------計(jì)數(shù)器輸出dzcat用于行掃描beginif(clk'eventandclk='1')thenif(dzcat=7)thendzcat<=0;elsedzcat<=dzcat+1;endif;endif;endprocess;process(lockmode,clk)beginif(lockmode='1')then----------點(diǎn)陣顯示閉鎖圖形casedzcatiswhen0=>dzrow<="01111111";dzcolr<="00000000";dzcolg<="00011000";when1=>dzrow<="10111111";dzcolr<="00000000";dzcolg<="00100100";when2=>dzrow<="11011111";dzcolr<="00000000";dzcolg<="00100100";when3=>dzrow<="11101111";dzcolr<="00000000";dzcolg<="01111110";when4=>dzrow<="11110111";dzcolr<="00000000";dzcolg<="01111110";when5=>dzrow<="11111011";dzcolr<="00000000";dzcolg<="01111110";when6=>dzrow<="11111101";dzcolr<="00000000";dzcolg<="01111110";when7=>dzrow<="11111110";dzcolr<="00000000";dzcolg<="00000000";endcase;else-----------------點(diǎn)陣顯示開鎖圖形casedzcatiswhen0=>dzrow<="01111111";dzcolr<="00000110";dzcolg<="00000000";when1=>dzrow<="10111111";dzcolr<="00001001";dzcolg<="00000000";when2=>dzrow<="11011111";dzcolr<="00001001";dzcolg<="00000000";when3=>dzrow<="11101111";dzcolr<="11111100";dzcolg<="00000000";when4=>dzrow<="11110111";dzcolr<="11111100";dzcolg<="00000000";when5=>dzrow<="11111011";dzcolr<="11111100";dzcolg<="00000000";when6=>d
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 工商代理注冊服務(wù)合同
- 冷熱型飲水機(jī)購銷合同
- 實(shí)習(xí)與補(bǔ)充協(xié)議格式
- 信息技術(shù)研發(fā)合同
- 房屋買賣合同房屋抵押問題解答
- 橋梁施工分包合同協(xié)議
- 購銷合同簽訂的壞處
- 毒性物質(zhì)銷售合同
- 溫開水型直飲水機(jī)購銷合同
- 創(chuàng)業(yè)合伙合同書范本
- 靜療小組第一季度理論試卷(2024年)復(fù)習(xí)測試卷附答案
- 文化活動(dòng)突發(fā)輿情應(yīng)急預(yù)案
- 高中技術(shù)《第四章控制和設(shè)計(jì)》單元自測題
- 中國普通食物營養(yǎng)成分表(修正版)
- 掘進(jìn)機(jī)檢修工理論知識考試卷及答案
- 一年級科學(xué)上冊評價(jià)方案宮艷春
- 對話大國工匠 致敬勞動(dòng)模范學(xué)習(xí)通超星期末考試答案章節(jié)答案2024年
- 5.1 中國外交政策的形成與發(fā)展 課件高中政治統(tǒng)編版選擇性必修一當(dāng)代國際政治與經(jīng)濟(jì)
- 2024-2025學(xué)年九年級化學(xué)人教版上冊檢測試卷(1-4單元)
- 2024年大學(xué)試題(經(jīng)濟(jì)學(xué))-流通經(jīng)濟(jì)學(xué)考試近5年真題集錦(頻考類試題)帶答案
- 博弈論完整版本
評論
0/150
提交評論