FPGA设计实践课程设计报告打铃系统.docx

上传人:b****1 文档编号:13403260 上传时间:2023-06-13 格式:DOCX 页数:33 大小:369.04KB
下载 相关 举报
FPGA设计实践课程设计报告打铃系统.docx_第1页
第1页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第2页
第2页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第3页
第3页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第4页
第4页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第5页
第5页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第6页
第6页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第7页
第7页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第8页
第8页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第9页
第9页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第10页
第10页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第11页
第11页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第12页
第12页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第13页
第13页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第14页
第14页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第15页
第15页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第16页
第16页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第17页
第17页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第18页
第18页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第19页
第19页 / 共33页
FPGA设计实践课程设计报告打铃系统.docx_第20页
第20页 / 共33页
亲,该文档总共33页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

FPGA设计实践课程设计报告打铃系统.docx

《FPGA设计实践课程设计报告打铃系统.docx》由会员分享,可在线阅读,更多相关《FPGA设计实践课程设计报告打铃系统.docx(33页珍藏版)》请在冰点文库上搜索。

FPGA设计实践课程设计报告打铃系统.docx

FPGA设计实践课程设计报告打铃系统

上海电力学院

课程设计报告

课程设计名称:

FPGA设计实践课程设计

设计课题名称:

自动打铃系统

班级:

2007142指导老师:

赵倩

姓名:

徐晓敏学号:

20072702

成绩:

设计时间:

设计地点:

实验室303

 

计算机信息与工程学院

自动打铃系统报告

一、设计目的:

使用QuartusII完成自动打铃系统的设计

二、实验器材和工具软件:

Pc机使用QuartusII系统

De2平台

三、设计内容:

1.基本计时和现实功能(用12小时制显示):

包括上下午标志,时、分的数字显示,秒信号显示。

2.可以自由设置当前时间(包含上、下午,时、分)。

3.可以实现基本的打铃功能,规定:

上午06:

00起床铃,打铃5s,停2s,再打铃5s;

下午10:

30熄灯铃,打铃5s,停2s,再打铃5s。

铃声可以用LED灯光显示,如果实验装置没有LED发光管,那么可以用七段显示管的小数点显示,也可以用显示小时的十位数码管的多余段显示。

凡是用到铃声功能的均可以如此处理。

4.增加整点报时功能,整点时响铃5s。

要求有控制启动和关闭功能。

5.增加调整起床铃、熄灯铃时间的功能。

6.增加调整打铃时间长短和间隙时间长短的功能。

7.增设上午4节课的上、下课打铃功能,规定:

7:

30上课,8:

20下课

8:

30上课,9:

20下课

9:

40上课,10:

30下课

10:

40上课,11:

30下课。

每次铃响5s。

四、设计具体步骤:

1、完成各个模块的设计,其具体代码如下:

moduleclock(clock,en,adjusth,adjustm,adjusts,adjustpm,second,minute,hour);

inputclock;

inputen;

inputadjusth;

inputadjustm;

inputadjusts;

inputadjustpm;

output[4:

0]hour;

reg[4:

0]hour;

output[5:

0]minute;

reg[5:

0]minute;

output[5:

0]second;

reg[5:

0]second;

always@(posedgeclock)

begin

if(en==1'b1)

begin

if(adjustpm==1'b0)

begin

if(hour<12)

begin

hour<=hour+12;

end

else

begin

hour<=hour-12;

end

end

elseif(adjusth==1'b1)

begin

if(hour==23)

begin

hour<=0;

end

else

begin

hour<=hour+1;

end

end

elseif(adjustm==1'b1)

begin

if(minute==59)

begin

minute<=0;

end

else

begin

minute<=minute+1;

end

end

elseif(adjusts==1'b1)

begin

second<=0;

end

end

else

begin

if(second==59)

begin

second<=0;

if(minute==59)

begin

minute<=0;

if(hour==23)

begin

hour<=0;

end

else

begin

hour<=hour+1;

end

end

else

begin

minute<=minute+1;

end

end

else

begin

second<=second+1;

end

end

end

endmodule

 

modulestatemachine(clock,changemode,adjposition,adjval,command,adjbotton,flash);

inputclock;

inputchangemode;

inputadjposition;

inputadjval;

output[4:

0]command;

reg[4:

0]command;

output[2:

0]adjbotton;

reg[2:

0]adjbotton;

output[2:

0]flash;

reg[2:

0]flash;

parameter[2:

0]timer=0;

parameter[2:

0]adj_timer=1;

parameter[2:

0]adj_morningtime=2;

parameter[2:

0]adj_eveningtime=3;

parameter[2:

0]adj_ringlength=4;

parameter[2:

0]adj_12or24=5;

reg[2:

0]state;

reg[1:

0]pos;

always@(posedgeclock)//mokuai1gongnengshitongguochangemodedeanxialaigaibianzhuangtai

begin

case(state)//casestate

timer:

//timer0shi

begin

if(changemode==1'b0)//

begin

state<=adj_timer;

end

end

adj_timer:

begin

if(changemode==1'b0)

begin

state<=adj_morningtime;

end

end

adj_morningtime:

begin

if(changemode==1'b0)

begin

state<=adj_eveningtime;

end

end

adj_eveningtime:

begin

if(changemode==1'b0)

begin

state<=adj_ringlength;

end

end

adj_ringlength:

begin

if(changemode==1'b0)

begin

state<=adj_12or24;

end

end

adj_12or24:

begin

if(changemode==1'b0)

begin

state<=timer;

end

end

default:

begin

state<=timer;

end

endcase

end

always@(posedgeclock)//mokuai2

begin

case(state)

timer:

//zhengchangjishishi

begin//

command<=5'b00000;//shuchucommandwei00000

pos<=0;//poswei0

end

adj_timer:

//tiaozhengshijianshi

begin

if(command==5'b00000)//ruguodangqianweizhengchangjishizhuangtai

begin

//command<=5'b00001;

pos<=1;//poswei1

end

else

begin//ruguobushizhengchangjishizhuangtai

if(adjposition==1'b0)//erqiecishiadipositionwei1

begin

if(pos==3)//erqieposwei3

begin

pos<=1;//poswei1

end

else

begin//posbuwei3dehuapos=pos+1

pos<=pos+1;

end

end

end

command<=5'b00001;//zuowanshangmianzhihoucommandwei00001

end

adj_morningtime:

//tiaozhengqichuangshijianzhuangtai

begin

if(command==5'b00001)//ruguodangqianweitiaozhengshijianzhuangtai

begin

pos<=1;//poswei1

end

else

begin

if(adjposition==1'b0)//fouzheruguoadjpositionwei1

begin

if(pos==1)//erqieposwei1

begin

pos<=2;//poswei2

end

else

begin

pos<=1;//fouzeposbuwei1shiposwei1

end

end

end

command<=5'b00010;//zuowanzhihoucommandshuchuwei00010tiaozhengxidengzhuangtai

end

adj_eveningtime:

begin

if(command==5'b00010)//tiaowanshangshijiandezhuangtaidangcommandwei00010shi

begin

pos<=1;//poswei1

end

else

begin

if(adjposition==1'b0)//commandbuwei00010shiadjpositionwei1shi

begin

if(pos==1)//ruguoposwei1

begin

pos<=2;//poswei2

end

else

begin

pos<=1;//fouzewei1

end

end

end

command<=5'b00100;//zhihoucommandshuchuwei00100

end

adj_ringlength:

//tiaozhengxiangliangzhuangtai

begin

if(command==5'b00100)//ruguocommandwei00100

begin

pos<=1;//poswei1

end

else

begin

if(adjposition==1'b0)//fouzeruguocommandbushi00100qieadjpositionwei1

begin

if(pos==1)//qieposwei1

begin

pos<=3;//poswei3

end

else

begin

pos<=1;//fouzeposwei1

end

end

end

command<=5'b01000;//zuihoushuchuwei01000

end

adj_12or24:

//ruguodangqianzhuangtaiwei

begin

pos<=2;//poswei2

command<=5'b10000;//commandshuchuwei10000

end

default:

begin

pos<=0;//fouzezuihouposwei0

command<=5'b00000;//commanwei00000

end

endcase

case(pos)//posdecase

0:

begin//poswei0shi

flash<=3'b000;//flashwei000

adjbotton<=3'b000;//adjbottonwei000

end

1:

//poswei1

begin

flash<=3'b100;//flashwei100

if(adjval==1'b0)//ruguoadjvalwei1

begin

adjbotton<=3'b100;//adjbottonwei100

end

else

begin

adjbotton<=3'b000;//fouzewei000

end

end

2:

//ruguoposwei2

begin

flash<=3'b010;//flashwei010

if(adjval==1'b0)//ruguoadjvalwei1

begin

adjbotton<=3'b010;//adjbottonwei010

end

else

begin

adjbotton<=3'b000;//fouzewei000

end

end

3:

begin

flash<=3'b001;//poswei3shiflashwei001

if(adjval==1'b0)//ruguoadjval

begin

adjbotton<=3'b001;//adjbottonwei001

end

else

begin

adjbotton<=3'b000;//fouzewei000

end

end

default:

begin

flash<=3'b000;//fouzezuihouflashwei000

adjbotton<=3'b000;//adjbottonwei000

end

endcase

end

endmodule

 

moduledisplaycontroller(clock,enchange,change,enring,command,hour,getuphour,sleephour,minute,enalarm,getupminute,sleepminute,second,ringtime,pausetime,numa,numb,numc,pm,ring);

inputclock;

inputenchange;

inputchange;

inputenring;

input[4:

0]command;

input[4:

0]hour;

input[3:

0]getuphour;

input[3:

0]sleephour;

input[5:

0]minute;

input[5:

0]getupminute;

input[5:

0]sleepminute;

input[5:

0]second;

input[4:

0]ringtime;

input[3:

0]pausetime;

output[5:

0]numa;

reg[5:

0]numa;

output[5:

0]numb;

reg[5:

0]numb;

output[5:

0]numc;

reg[5:

0]numc;

outputpm;

regpm;

outputring;

regring;

outputenalarm;

wireenalarm;

regdisplay24;

regenablealarm;

wire[5:

0]time1;

wire[5:

0]time2;

always@(posedgeclock)

begin

if(enchange==1'b1)//zongkaishikongzhi

begin

if(change==1'b1)//bianhuaweiyi

begin

display24<=~display24;//

end

end

if(enring==1'b0&command==5'b00000)//commandmoshilingshengshinengyufou

begin

enablealarm<=~enablealarm;//

end

end

always@(negedgeclock)//bingxingyunxingmokuai

begin

case(command)//casetiaoxuanyuju

5'b00000,4'b0001:

//dangcommanddengyu00000huozhi0001shi

begin

if(display24==1'b0)//display24wei0shiweiampaxianshi

begin

if(hour>=12)

begin

numa<=hour-12;//hour>12pmweiyi

pm<=1'b1;

end

else

begin

numa<=hour;//fouzepmwei0

pm<=1'b0;

end

end

else

begin

numa<=hour;//displaywei1shi

pm<=1'b0;//pmbulianghourweinuma

end

numb<=minute;//fenweinumb

numc<=second;//miaoweinumc

end

5'b00010:

//commandwei00010shi

begin

pm<=1'b0;//pmwei0

numa<=getuphour;//xianshideshiweigetuphour

numb<=getupminute;//xianshidefenweinumb

numc<=0;

end

5'b00100:

//commandwei00100shixianshitiaozhengwanshuishijian

begin

if(display24==1'b0)//dangdisplay12dianshi

begin

numa<=sleephour-12;//xianshiyeyaobiancheng12,qieshi

pm<=1'b1;

end

else

begin

numa<=sleephour;//dangxianshi24xiaoshishipm0

pm<=1'b0;

end

numb<=sleepminute;

numc<=0;

end

5'b01000:

//commandwei01000shi

begin

pm<=1'b0;//24xiaoshixianshi

numa<=ringtime;//numaxianshixianglingshijianchangdu

numb<=60;//numbfuzhi60

numc<=pausetime;//numbxianshixianglingzantingshijian

end

5'b10000:

//commandwei10000shi

begin

pm<=1'b0;//24xiaoshixianshi

numa<=60;//numa60fuzhi

if(display24==1'b0)//dangshi12xiaoshimoshi

begin

numb<=12;//numbxianshi12

end

else

begin

numb<=24;//fouzexinshi24

end

numc<=60;//numcwei60

end

default:

begin

end

endcase

end

always@(negedgeclock)//xindebingxingmokuai

begin

if(((hour==getuphour)&(minute==getupminute))|((hour==sleephour)&(minute==sleepminute)))

begin//dangqichuanghuozhewanshuilingshengshijianshi

if(second

begin

ring<=1'b1;//lingshengxiangqi

end

elseif(second

begin

ring<=1'b0;

end

elseif(second

begin

ring<=1'b1;

end

else

begin

ring<=1'b0;//qitasuoyoushihouxianglingguanbi

end

end

elseif((hour==7&minute==30)|(hour==8&minute==20)|(hour==8&minute==30)|(hour==9&minute==20)|(hour==9&minute==40)

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2