數(shù)字邏輯課程設(shè)計實踐_第1頁
數(shù)字邏輯課程設(shè)計實踐_第2頁
數(shù)字邏輯課程設(shè)計實踐_第3頁
數(shù)字邏輯課程設(shè)計實踐_第4頁
數(shù)字邏輯課程設(shè)計實踐_第5頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

數(shù)字邏輯課程設(shè)計

多功能數(shù)字餅

班級:

學(xué)號:

課程設(shè)計人:

指導(dǎo)老師:

課題:

完畢時間:

一、設(shè)計目的:

學(xué)會應(yīng)用數(shù)字系統(tǒng)設(shè)計措施進行電路設(shè)計,純熟地運用匯編語言。

二、設(shè)計任務(wù)及規(guī)定:

1.記時、記分、記秒

2.校時、校分、秒清0

3.整點報時

4.時間正常顯示

5,鬧時功能

三、設(shè)計思緒:

將整個鬧鐘分為如下幾種模塊,每個模塊中均有詳細的各部分的設(shè)計思緒,源代

碼及仿真圖像,生成的器件。

1.計時模塊

計小時:24進制計數(shù)器

計分、計秒:60進制計數(shù)器

計時間過程:

計秒:1HZ計數(shù)脈沖,0~59循環(huán)計數(shù),計數(shù)至59時產(chǎn)生進位信號。

計分:以秒計數(shù)器進位信號作為分計數(shù)脈沖,0~59循環(huán)計數(shù),59時產(chǎn)生進

位。

計時:以分計數(shù)器進位信號作為時計數(shù)脈沖,0~23循環(huán)計數(shù),23時清0。

二十四進制計數(shù)器代碼:

libraryieee;

useieee.std_logic_l164.all;

useieee.std_logic_unsigned.all;

entitycnt24is

port(elk:instdlogic;

qh,ql:outstdlogicvector(3downto0));

endcnt24;

architecturebehaveofcnt24is

signalql,qO:std_logic_vector(3downto0);

begin

process(elk)

begin

if(elk,eventandelk='1')then

if(ql=,,00',0,zandqO=〃0011")then

qk="0000〃;q0<="0000〃;

elsif(qO=”1001〃)then

qO<=//OOOOz/;ql<=ql+,T;

else

qO<=qO+,T;

endif;

endif;

qh<=ql;

ql<=qO;

endprocess;

endbehave;

仿真成果:

圖一、cnt24仿真圖像

六十進制計數(shù)器代碼:

libraryieee;

useieee.std_logic_l164.all;

useieee.std_logic_unsigned.all;

entitycnt60is

port(elk:instd_logic;

clr:instd_logic;

ql,qh:outstd_logic_vector(3downto0);

c:outstd_logic);

endcnt60;

architectureentofcnt60is

signalql,qO:stdlogicvector(3downto0);

begin

process(elk,clrj

begin

if(clr=,T)then

ql<=〃0000〃;q(K=〃0000〃;c<='0';

else

if(elk*eventandclk=,1,)then

if(ql=//010r,andqO="1001")then----到59

ql〈二〃0000〃;q0<=〃0000〃;c<='1';

elsif(ql<"0101〃andqO="1001")then

q0<="0000〃;ql<=ql+T';c<='O';

elsif(q0<z,1001,z)then

qO<=qO+'1';

endif;

endif;

endif;

qh<=ql;

ql<=qO;

endprocess;

endent;

仿真成果:

圖二、cn(60仿真圖像

cnt24cnt60

elkqh[3..O]elkql[3..O]

QH3..0]clrqh[3..O]

instinstl

圖三、生成的計數(shù)器符號

2.校時模塊:

思緒:按下校時鍵,時位迅速遞增,滿23清0

按下校分鍵,分位迅速遞增,滿59清0

注意:此時應(yīng)屏蔽分進位。

按清0鍵,秒清0。

脈沖按鍵S1~S8、撥動開關(guān)K「K12任選三個。

兩個問題:

(1)怎樣實現(xiàn)校對時間時,計數(shù)器迅速遞增?

按鍵校對時間時,將一種頻率較高的計數(shù)脈沖信號作用于計數(shù)器,屏蔽正常

計時的計數(shù)脈沖信號。

(2)怎樣消除“抖動”?

電路抖動:一次按鍵口勺彈跳現(xiàn)象,電路產(chǎn)生多種計數(shù)脈沖,導(dǎo)致一次按鍵,

多次計數(shù)的誤動作。

抖動產(chǎn)生的原因:物理原因。

消除歐I簡易措施:D觸發(fā)器,同步按鍵脈沖。

3.整點報時模塊:

從59分50秒開始,每2秒一次低音報時;當(dāng)?shù)竭_整點時,進行一次高音報

時。

低音:頻率可定為500HZ;高音:頻率可定為1KHZ。

報時效果:報時脈沖接揚聲器輸入,引腳號:N6o

整點報時器件代碼

libraryieee;

useieee.std_logic_l164.al1;

useieee.std_logic_unsigned.all;

entityalert_31is

port(ml,mO,si,sO:instd_logic_vector(3downto0);

siga,sigb:outstd_logic);

endalert_31;

architecturealertofalert_31is

begin

siga<=,Twhen(ml="z01or,andmO=”1001〃andsi=〃0101〃and(sO="0000"or

sO二〃0010”orsO="0100"orsO=”0110〃orsO=”1000〃))else'O';

sigb<='l'whcn(ml="0000〃andmO=〃0000"andsi=”0000〃and

s0=/0000")else,O';

endalert;

仿真成果:

圖四、整點報時模塊,低頻率報時

圖五,整點報時器件符號

4、分頻模塊:

設(shè)計一種進制較大的計數(shù)器,分頻產(chǎn)生多種頻率日勺脈沖信號。

代碼:

libraryiccc;

useieee.std_logic_l164.all;

useieee.std_logic_unsigned.all;

entityfreq_divideris

port(elk:inst.dlogic;

hz512,hz64,hz4,hzl:outstd_logic);

Endfreq_divider;

architecturebehoffreq_divideris

signalcc:stdlogic_vector(9downto0);

begin

process(elk)

begin

if(elk,eventandclk=,T)then

if(cc="〃)then

cc<=;

else

cc<=cc+l;

endif;

endif;

endprocess;

hz512<=cc(0);

hz64<=cc(3);

hz4<=cc(7);

hzl<=cc(9);

endbeh;

仿真成果:

圖六、分頻器仿真及生成器件符號

5.動態(tài)掃描顯示模塊:

動態(tài)模式下,8個數(shù)碼管連接同個七段碼,需要進行分時控制的動態(tài)掃描顯示。

七段譯碼器代碼:

LIBRARYIEEE;

USEIEEE.STD_L0GIC_1164.ALL;

USEIEEE.STDLOGICUNSIGNED.ALL;

ENTITYdtsmis

port(

elk:instd_logic;

h:instdlogic_vector(7clownto0);

m:instdJogic_vector(7clownto0);

s:instdlogic_vector(7downto0);

scg7out:outstd^logic_vcctor(6downto0);

sei:bufferstd_logic_vector(2downto0)

);

ENDdtsm;

ARCHITECTUREbehaofdtsmis

signalkey:std_logic_vector(3downto0);

BEGIN

PROCESS(elk)

variabledount:std.logic.vector(2downto0):=〃000〃;

BEGIN

TF(risingedge:elk))then

IFdount=〃101〃then

dount:=”000〃;

ELSE

dount:=dount+l;

ENDIF;

ENDIF;

sel<=dount;

endprocess;

PROCESS(sei)

BEGIN

CASEseiIS

when,,000,/=>key<=h(7downto4);

when,,00r/=>key<=h(3downto0);

when,,010//=>key<=m(7downto4);

when,,0ir/=>key<=m(3downto0);

when,,100,,=>key<=s(7downto4);

when,,10r,=>key<=s(3downto0);

whenothers=〉nul1;

ENDCASE;

ENDPROCESS;

PROCESS(key)

BEGIN

casekeyis

when,,0000//=>seg7out<=z,011111l,z;

when^OOO1,,=>seg7out<=z,000011O,z;

when〃OO10〃=>seg7out〈二〃1011011”;

when〃0011〃=>seg7out〈二〃1OOI111〃;

whenz,0100z/=>seg7out<=*1100110/z;

whcn,,010r/=>scg7out<=^1101101zz;

whcn^Ol10//=>seg7out<=z,l111101,/;

when^Ol1l//=>seg7out<="z000011l/z;

whenz,1000zz=>seg7out<=/z111111l/z;

when〃1001"=>seg7out<=〃l101111〃;

whenz,1010v=>seg7out<=z,l1101U/z;

whenothers=〉null;

ENDCASE;

ENDPROCESS;

ENDbeha;

器件生成:

圖七、動態(tài)掃描器件

6.鬧時模塊:

多路選擇器源程序:

libraryiccc;

useieee.std_logic_1164.all;

useieee.std_logic_arith.all;

useieee.std_logic_unsigned.all;

entityalarmsot

port(sei:instd_logic;

hclo,mclo,sclo,hair,malr,salr:instd_logic_vector(7downto

0);

h,s,m:outstdlogic_vector(7downto0));

endalarmset;

architecturebehofalarmsetis

begin

process(sei)

begin

if(sel=,0*)thenh<=hclo;

m<=mclo;

s<=sclo;

elseh<=halr:

m<=malr;

s<=salr;

endif;

endprocess;

endbeh;

數(shù)值比較器代碼:

1ihraryiPPP;

useieee.std_logic_l164.all;

useieee.std_logic_arith.all;

useieee.stdlogicunsigned.all;

entityalarmcmpis

port(h,m,hair,malr:instdlogicvector(7downto0);

stop:instdlogic;

sig:outstdlogic);

endalarmcmp;

architecturebehofalarmcmpis

begin

process(h,m,hair,malr,stop)

begin

ifstop='rthen

sig<=,0>;

endif;

ifh=hairandm=malrandstop='O'then

sig<=r;

elsesig〈='O';

endif;

endprocess;

endbeh;

器件生成:

alarmsei

h[7..O]

一hclo(7..0]S17..0)

一mclc[7..O]m[7..O]

-scloI7..0]

-halr[7..O]

一malr(7..O]

一salr[7..O]

inst

圖八、多路選擇器和數(shù)值比較器

四、頂層圖:

QuartusII-F:/3100601002/clock-clock-[clock.bdfjIZ正因

Eil<EditV>rrtroj.CF]:??ssiD4loolsT>ndov

X

JT-T

X-....:、[…IIL、j

:)產(chǎn)彳~H:「:

TexH?1九pr?aiFl

gQuartusII-F:/3100601002/clock-clock-[clock.bdfj

Eilt&ditVierProjectFr?<?ssinzToolsftndov

q

Q

A

od-

r

-

r

f

r

v

o

::::

621,H&3

圖九、頂層圖

六、設(shè)計中碰到的問題及處理措施:

問題1、第一次下載仿真時,秒不動,按下清零鍵自動計時,松開又自動清零。

處理措施:在秒的計數(shù)器清零端加一種非門,這樣當(dāng)一下載到試驗板后,在一秒

后就可以自動計時,且若要清零則按下Sc按鍵即可。

問題2、分一直保持00狀態(tài),秒日勺

溫馨提示

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

評論

0/150

提交評論