EDA实验报告60S电子闹钟_第1页
EDA实验报告60S电子闹钟_第2页
EDA实验报告60S电子闹钟_第3页
EDA实验报告60S电子闹钟_第4页
EDA实验报告60S电子闹钟_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

EDA实验报告60S电子闹钟EDA实验报告题目60秒电子闹钟学院电子工程学院专业学生姓名导师姓名初秀琴一功能描述电路上电后自动计时,到达预置的闹响时刻后,由扬声器发出音乐报警。闹响时刻可利用DIP开关设置,两位数:0~59。二设计思路电路主要由分频器、M60计数器、闹铃电路、显示电路等部分组成。秒信号脉冲可由分频器产生,用DIP开关设置闹响时刻,当M60计数器的输出与设置的闹响时刻相等时,闹铃电路输出脉冲驱动扬声器发出音乐报警。总体设计思路如图1所示:七段显示七段显示扬声器显示电路DIP开关闹铃电路M60计数器高频脉冲分频器图1总体设计思路三功能模块1分频器程序代码如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitydevideisport( clk :instd_logic;--输入时钟 clk_out :outstd_logic--输出信号 );enddevide;architecturearc_devideofdevideis signalcount:std_logic_vector(14downto0);--定义内部信号 begin process begin waituntilclk'eventandclk='1'; if(count<32767)then--改变最大计数值即可得到不同的分频系数 count<=count+1; clk_out<='1'; endif; endprocess;endarchitecturearc_devide;符号图如图2所示:图2分频器符号图2M60计数器程序代码如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitybcd_m60isport( CLK :instd_logic; EN :instd_logic; CR :instd_logic; QL,QH :outstd_logic_vector(3downto0)--8421BCD码个位、十位输出 );endbcd_m60;architecturebehavofbcd_m60is signalcouL,couH:std_logic_vector(3downto0);begin process(CR,CLK) begin ifCR='0'then--异步复位 couL<="0000"; couH<="0000"; elsifclk'eventandclk='1'then ifEN='1'then if(couL=9andcouH=5)then--个位计到9十位计到5回零 couL<="0000"; couH<="0000"; elsifcouL=9then--个位计到9回零十位加1 couL<="0000"; couH<=couH+1; else couL<=couL+1;--否则个位加1 endif; endif; endif; endprocess; QL<=couL; QH<=couH; endbehav;符号图如图3所示:图3M60计数器符号图仿真波形如图4所示:图4M60计数器仿真波形经分析,M60计数器仿真波形正确。3闹铃电路程序代码如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityalertisport( STOP :instd_logic;--控制是否响铃 CLK :instd_logic; DIPL,DIPH :instd_logic_vector(3downto0); QL,QH :instd_logic_vector(3downto0); SPEAK :outstd_logic );endalert;architecturebehavofalertisbegin process(STOP,CLK,QL,QH) begin ifSTOP='0'then SPEAK<='0'; elsifQL=DIPLandQH=DIPHthen--输出脉冲驱动扬声器 SPEAK<=CLK; endif; endprocess; endbehav;符号图如图5所示:图5闹铃电路符号图4显示电路程序代码如下:libraryieee;useieee.std_logic_1164.all;entityseg7isport(dat:instd_logic_vector(3downto0); a,b,c,d,e,f,g:outstd_logic);endseg7;architecturearcofseg7is signaltmp:std_logic_vector(6downto0);begin process(dat) begin casedatis when"0000"=>tmp<="0111111"; when"0001"=>tmp<="0000110"; when"0010"=>tmp<="1011011"; when"0011"=>tmp<="1001111"; when"0100"=>tmp<="1100110"; when"0101"=>tmp<="1101101"; when"0110"=>tmp<="1111101"; when"0111"=>tmp<="0000111"; when"1000"=>tmp<="1111111"; when"1001"=>tmp<="1101111"; when"1010"=>tmp<="1110111"; when"1011"=>tmp<="1111100"; when"1100"=>tmp<="0111001"; when"1101"=>tmp<="1011110"; when"1110"=>tmp<="1111001"; when"1111"=>tmp<="1110001"; whenothers=>null; endcase; endprocess; a<=tmp(6); b<=tmp(5); c<=tmp(4); d<=tmp(3); e<=tmp(2); f<=tmp(1); g<=tmp(0);endarc;符号图如图6所示:图6显示

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论