设计一个电子时钟要求可以显示时分秒用户可以设置时间Word文件下载.docx
- 文档编号:19312863
- 上传时间:2023-01-05
- 格式:DOCX
- 页数:22
- 大小:38.75KB
设计一个电子时钟要求可以显示时分秒用户可以设置时间Word文件下载.docx
《设计一个电子时钟要求可以显示时分秒用户可以设置时间Word文件下载.docx》由会员分享,可在线阅读,更多相关《设计一个电子时钟要求可以显示时分秒用户可以设置时间Word文件下载.docx(22页珍藏版)》请在冰豆网上搜索。
);
endentity;
architecturesub1offenpinis
signalQ_1:
std_logic_vector(8downto0);
signalQ_2:
std_logic_vector(6downto0);
signalQ_3:
signalclk10000:
std_logic;
signalclk100:
signalclk1:
begin
process(clk_10M)
begin
ifclk_10M'
eventandclk_10M='
1'
then
ifQ_1=500then
Q_1<
="
000000000"
;
clk10000<
=notclk10000;
ifQ_2=100then
Q_2<
0000000"
clk100<
=notclk100;
ifQ_3=100then
Q_3<
clk1<
=notclk1;
elseQ_3<
=Q_3+1;
endif;
elseQ_2<
=Q_2+1;
endif;
elseQ_1<
=Q_1+1;
endif;
endif;
endprocess;
clk_10000<
=clk10000;
clk_100<
=clk100;
clk_1<
=clk1;
endsub1;
2、libraryieee;
--扫描数码管
entityxianshiis
port(clk_10000:
instd_logic;
jian4:
moshi:
inintegerrange0to4;
a0,a1,a3,a4,a6,a7:
inintegerrange0to9;
sg11:
outstd_logic_vector(6downto0);
bt11:
outstd_logic_vector(7downto0));
end;
architectureoneofxianshiis
signalcnt8:
std_logic_vector(2downto0);
signala:
integerrange0to15;
signallight:
signalflash:
integerrange0to2;
signalcount1,count2:
integerrange0to10;
p1:
process(cnt8,light,a0,a1,a3,a4,a6,a7)
casecnt8is
when"
000"
=>
bt11<
&
(light);
a<
=a0;
001"
000000"
(light)&
'
0'
=a1;
010"
00000"
"
00"
=15;
011"
0000"
=a3;
100"
=a4;
101"
110"
='
=a6;
111"
=(light)&
=a7;
whenothers=>
null;
endcase;
endprocessp1;
p2:
process(clk_10000)
ifclk_10000'
eventandclk_10000='
thencnt8<
=cnt8+1;
endif;
endprocessp2;
p3:
process(a)
caseais
when0=>
sg11<
0111111"
when1=>
0000110"
when2=>
1011011"
when3=>
1001111"
when4=>
1100110"
when5=>
1101101"
when6=>
1111101"
when7=>
0000111"
when8=>
1111111"
when9=>
1101111"
when10=>
1110111"
when11=>
1111100"
when12=>
0111001"
when13=>
1011110"
when14=>
1111001"
when15=>
1000000"
endprocessp3;
process(jian4,moshi)
begin
ifmoshi=4then
ifjian4'
eventandjian4='
ifflash=2then
flash<
=0;
elseflash<
=flash+1;
endprocess;
process(clk_10000,flash)
caseflashis
light<
='
ifcount1=2then
count1<
elsecount1<
=count1+1;
light<
ifcount2=4then
count2<
elsecount2<
=count2+1;
3、libraryieee;
--跑表开始暂停
entitypaobiaois
port(clk_1:
jian8:
shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1:
shishi2,shige2,fenshi2,fenge2,miaoshi2,miaoge2:
outintegerrange0to9);
architecturebhvofpaobiaois
signalshi:
integerrange0to100;
signalfen:
signalmiao:
process(clk_1,jian8,shishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1)
ifjian8='
shi<
=shishi1*10+shige1;
fen<
=fenshi1*10+fenge1;
miao<
=miaoshi1*10+miaoge1;
elsifclk_1'
eventandclk_1='
then
ifmiao=59then
=fen+1;
elsiffen>
59then
=shi+1;
elsifshi>
23then
elsemiao<
=miao+1;
endif;
miaoge2<
=miaorem10;
miaoshi2<
=miao/10;
fenge2<
=fenrem10;
fenshi2<
=fen/10;
shige2<
=shirem10;
shishi2<
=shi/10;
4、libraryieee;
--设置当前时间
entitysettimeis
port(moshi:
jian4,jian5:
shishi,shige,fenshi,fenge,miaoshi,miaoge:
architecturebavofsettimeis
signala:
integerrange0to5;
signalshishi1,shige1,fenshi1,fenge1,miaoshi1,miaoge1:
integerrange0to9;
begin
process(moshi,jian4)
ifmoshi=1then
ifa<
5then
a<
=a+1;
elsea<
process(moshi,a,jian5)
ifmoshi=1then
ifa=0then
ifjian5'
eventandjian5='
ifmiaoge1=9then
miaoge1<
elsemiaoge1<
=miaoge1+1;
ifa=1then
ifmiaoshi1=5then
miaoshi1<
elsemiaoshi1<
=miaoshi1+1;
ifa=2then
iffenge1=9then
fenge1<
elsefenge1<
=fenge1+1;
ifa=3then
iffenshi1=5then
fenshi1<
elsefenshi1<
=fenshi1+1;
ifa=4then
ifshige1=9then
shige1<
elseshige1<
=shige1+1;
ifa=5then
ifshishi1=2then
shishi1<
elseshishi1<
=shishi1+1;
miaoge<
=miaoge1;
miaoshi<
=miaoshi1;
fenge<
=fenge1;
fenshi<
=fenshi1;
shige<
=shige1;
shishi<
=shishi1;
5、libraryieee;
--秒表功能
entitymiaobiaois
port(clk_100:
moshi:
jian5,jian4:
fenshi,fenge,miaoshi,miaoge,xmiaoshi,xmiaoge:
architecturebhvofmiaobiaois
signalfen,miao,xmiao:
integerrange0to99;
signalstart:
std_logic:
signalreset:
process(clk_100,jian5,jian4,moshi,reset,start)
ifmoshi=2then
ifreset='
miao<
xmiao<
elsifstart='
elsifclk_100'
eventandclk_100='
ifxmiao=99then
xmiao<
miao<
elsifmiao>
fen<
elsiffen>
elsexmiao<
=xmiao+1;
process(jian4,start)
start<
=notstart;
elsestart<
=start;
process(jian5,reset)
reset<
=notreset;
elsereset<
=reset;
xmiaoge<
=xmiaorem10;
xmiaoshi<
=xmiao/10;
miaoge<
miaoshi<
fenge<
fenshi<
6、libraryieee;
--设置闹钟时间
entitynaozhongsetis
architecturebavofnaozhongsetis
signalfenshi1,fenge1,miaoge1:
signalshishi1:
integerrange0to9:
=1;
signalshige1:
=2;
signalmiaoshi1:
ifmoshi=3then
ifmoshi=3then
7、libraryieee;
--闹钟喇叭输出
entitynaozhongspeakeris
shishi2,shige2,fenshi2,fenge2,miaoshi2
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 设计 一个 电子 时钟 要求 可以 显示 时分 用户 设置 时间
![提示](https://static.bdocx.com/images/bang_tan.gif)