eda课程设计数字频率计.docx
- 文档编号:30676020
- 上传时间:2023-08-19
- 格式:DOCX
- 页数:17
- 大小:117.15KB
eda课程设计数字频率计.docx
《eda课程设计数字频率计.docx》由会员分享,可在线阅读,更多相关《eda课程设计数字频率计.docx(17页珍藏版)》请在冰豆网上搜索。
eda课程设计数字频率计
一、EDA课程设计要求--------------------------------2
二、优点及用途-------------------------------------3
三、原理图、VHDL语言程序及仿真波形---------------------3
四、总结-------------------------------------------
五、参考书------------------------------------------
一EDA课程设计要求
1)课程设计题:
数字频率计
2)任务及要求
1、设计一个能测量方波信号的频率的频率计。
2、测量的频率范围是0999999Hz。
3、结果用十进制数显示。
4、按要求写好设计报告(设计报告内容包括:
引言,方案设计与论证,总体设计,各模块设计,调试与数据分析,总结)。
3)教学提示
1、脉冲信号的频率就是在单位时间内所产生的脉冲个数,其表达式为,f为被测信号的频率,N为计数器所累计的脉冲个数,T为产生N个脉冲所需的时间。
所以,在1秒时间内计数器所记录的结果,就是被测信号的频率。
2、被测频率信号取自实验箱晶体振荡器输出信号,加到主控门的输入端。
3、再取晶体振荡器的另一标准频率信号,经分频后产生各种时基脉冲:
1ms,10ms,0.1s,1s等,时基信号的选择可以控制,即量程可以改变。
4、时基信号经控制电路产生闸门信号至主控门,只有在闸门信号采样期间内(时基信号的一个周期),输入信号才通过主控门。
5f=N/T,改变时基信号的周期T,即可得到不同的测频范围。
5、当主控门关闭时,计数器停止计数,显示器显示记录结果,此时控制电路输出一个置零信号,将计数器和所有触发器复位,为新的一次采样做好准备。
6、改变量程时,小数点能自动移位。
4)设计报告要求
1、说明设计作品的功能、特点、应用范围;
2、方案对比,确定方案。
3、电路工作原理、操作方法;
4、编程方法、程序框图及关键程序清单。
5、课程设计总结。
二、优点及用途
数字频率计是计算机、通讯设备、音频视频等科研生产领域不可缺少的测量仪器。
它是一种用十进制数字,显示被测信号频率的数字测量仪器。
它的基本功能是测量正弦信号,方波信号以及其他各种单位时间内变化的物理量。
在进行模拟、数字电路的设计、安装、调试过程中,由于其使用十进制数显示,测量迅速,精度高,显示直观,所以经常要用到数字频率计。
三、原理图、VHDL语言程序及仿真波形
1原理图
编译成功后其波形图如下:
2、信号发生器
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityseleis
port(clk:
instd_logic;
jian:
instd_logic_vector(1downto0);
oclk:
outstd_logic);
end;
architectures_1ofseleis
signalfull:
std_logic;
signalt:
integerrange0to5999999;
begin
P1:
process(jian,t)
begin
casejianis
when"00"=>t<=5999999;--产生时基脉冲1s
when"01"=>t<=599999;--产生时基脉冲100ms
when"10"=>t<=59999;--产生时基脉冲10ms
when"11"=>t<=5999;--产生时基脉冲1ms
whenothers=>null;
endcase;
endprocessP1;
P2:
process(clk,t)
variables:
integerrange0to5999999;
begin
if(clk'eventandclk='1')then
ifs s: =s+1; elses: =0; endif; endif; ifs=tthenfull<='1'; elsefull<='0'; endif; endprocessP2; P3: process(full) variablec: std_logic; begin iffull'eventandfull='1'then c: =notc; ifc='1'then oclk<='1'; elseoclk<='0'; endif; endif; endprocessP3; end; 其仿真波形为: 3、测频 libraryieee; useieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entitycpis port(clkk: instd_logic; en,rst,load: outstd_logic); end; architecturecp_1ofcpis signaldiv2: std_logic; begin process(clkk) begin if(clkk'eventandclkk='1')then div2<=notdiv2; endif; endprocess; process(clkk,div2) begin if(clkk='0'anddiv2='0')then rst<='1'; elserst<='0'; endif; endprocess; load<=notdiv2; en<=div2; end; 其仿真波形为: 4、计数器 libraryieee; useieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entityjishuis port(rst,en,clk: instd_logic; Q: outstd_logic_vector(3downto0); cout: outstd_logic); end; architecturecntofjishuis signalcnt: std_logic_vector(3downto0); begin process(rst,en,clk) begin ifrst='1'thencnt<="0000"; elsif(clk'eventandclk='1')anden='1'then ifcnt="1001"then cnt<="0000";cout<='1'; else cnt<=cnt+1; cout<='0'; endif; endif; endprocess; Q<=cnt; end; 在源程序中COUT是计数器的进位输出;Q[3..0]是计数器的状态输出;CLK是时钟输入端;RST是复位控制端;当RST=1时,Q[3..0]=0,EN是使能控制输入端,当EN=1时,计数器计数,当EN=0时,计数器保持状态不变。 编译成功后,其仿真波形如下: 在项目编译仿真成功后,将设计的十进制计数器电路设置成可调用的元件jishu.sym用于以下的顶层设计。 5、16位寄存器 libraryieee; useieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entitysuocunis port(load: instd_logic; din: instd_logic_vector(15downto0); dout: outstd_logic_vector(15downto0)); end; architecturesuoofsuocunis begin process(load,din) begin if(load'eventandload='1')then dout<=din; endif; endprocess; end; 在源程序中load是锁存信号,上升沿触发;din[3..0]是寄存器输入;dout[3..0]是寄存器输出。 编译成功后生成元件图如下图,以便顶层模块的调用。 4位寄存器 寄存器是在计数结束后,利用触发器的上升沿吧最新的频率测量值保存起来,这样在计数的过程中可不必一直看数码显示器,显示器将最终的频率读数定期进行更新,其输出作为动态扫描电路的输入。 libraryieee; useieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entitysuois port(load: instd_logic; din: instd_logic_vector(3downto0); dout: outstd_logic_vector(3downto0)); end; architecturesuo_1ofsuois begin process(load,din) begin if(load'eventandload='1')then dout<=din; endif; endprocess; end; 在源程序中load是锁存信号,上升沿触发;din[3..0]是寄存器输入;dout[3..0]是寄存器输出。 编译成功后生成元件图如下图,以便顶层模块的调用。 6、译码器 libraryieee; useieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entityledsis port(clk: instd_logic; Din: instd_logic_vector(15downto0); sg: outstd_logic_vector(6downto0); bt: outstd_logic_vector(1downto0)); end; architectureled_1ofledsis signalcnt8: std_logic_vector(1downto0); signalq: std_logic_vector(3downto0); begin P1: process(cnt8,Din,q) begin casecnt8is when"00"=>bt<="00";q<=Din(3downto0); when"01"=>bt<="01";q<=Din(7downto4); when"10"=>bt<="10";q<=Din(11downto8); when"11"=>bt<="11";q<=Din(15downto12); whenothers=>null; endcase; caseqis when"0000"=>sg<="0111111"; when"0001"=>sg<="0000110"; when"0010"=>sg<="1011011"; when"0011"=>sg<="1001111"; when"0100"=>sg<="1100110"; when"0101"=>sg<="1101101"; when"0110"=>sg<="1111101"; when"0111"=>sg<="0000111"; when"1000"=>sg<="1111111"; when"1001"=>sg<="1101111"; whenothers=>null; endcase; endprocessP1; P2: process(clk) begin if(clk'eventandclk='1')then cnt8<=cnt8+1; endif; endprocessP2; end; 编译成功后,其波形图为: 7、译码 libraryieee; useieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entitydividis port(clk50: instd_logic; qlkhz: outstd_logic); end; architecturedivofdividis begin K1: process(clk50) variablecout: integer: =0; begin if(clk50'eventandclk50='1')then cout: =cout+1; ifcout<=24999thenqlkhz<='1'; elsifcout<=49999thenqlkhz<='1'; elsecout: =0; endif; endif; endprocess; end; 编译成功后,其波形图为: 8、动态扫描电路 libraryieee; useieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entitydongtaiis port(q200hz: instd_logic; bt: instd_logic_vector(1downto0); sg: instd_logic_vector(6downto0); led0,led1,led2,led3: outstd_logic_vector(6downto0)); end; architecturebehavofdongtaiis begin process(q200hz) begin if(q200hz'eventandq200hz='1')then casebtis when"00"=>led0<=sg(6downto0); when"01"=>led1<=sg(6downto0); when"10"=>led2<=sg(6downto0); when"11"=>led3<=sg(6downto0); whenothers=>null; endcase; endif; endprocess; end; 仿真波形如下: 编译成功后生成元件图如下图,以便顶层模块的调用。 9、分频设计 libraryieee; useieee.std_logic_1164.all; useieee.std_logic_signed.all; entityfpis port(clk: instd_logic; oclk: outstd_logic); end; architecturefp_1offpis signalfull: std_logic; begin P1: process(clk) variables: integerrange0to99; begin if(clk'eventandclk='1')then ifs<99then s: =s+1; elsifs>99thens: =0; elsifs=99thenfull<='1'; endif; endif; endprocessP1; P2: process(full) variablec: std_logic; begin iffull='1'then c: =notc; ifc='1'then oclk<='1'; elseoclk<='0'; endif; endif; endprocessP2; end; 编译成功后,其波形图为: 四.总结 通过对EDA技术这门课程的学习,心得体会甚多。 虽然一开始觉得什么都不懂,但是通过一次次的实验和高老师的细心指导,我们真的学到了不少的东西。 往往书本上的知识在实际使用或实验时都应该加以修改,使之更适合实际应用,也更简洁。 这次EDA课程设计,使我更加的了解了EDA,VHDL语言和外部设备的接线。 也让我更加了解了EDA设计的流程和原理。 通过本次设计,让我很好的锻炼了理论联系实际,与具体项目、课题相结合开发、设计产品的能力。 既让我们懂得了怎样把理论应用于实际,又让我们懂得了在实践中遇到的问题怎样用理论去解决。 在本次设计中,我们还需要一些上课时没有牢固的知识,于是图书馆和INTERNET成了我们很好的助手。 在查阅资料的过程中,我们要判断优劣、取舍相关知识,不知不觉中我们查阅资料的能力也得到了很好的锻炼。 我们学习的知识是有限的,在以后的工作中我们肯定会遇到许多未知的领域,这方面的能力便会使我们受益非浅。 在设计过程中,总是遇到这样或那样的问题。 有时发现一个问题的时候,需要做大量的工作,花大量的时间才能解决。 自然而然,我的耐心便在其中建立起来了。 为以后的工作积累了经验,增强了信心。 我认为,不仅仅是此次考查设计,在整个这学期的实验中,不仅培养了独立思考、动手操作的能力,在各种其它能力上也都有了提高。 更重要的是,在实验课上,我们学会了很多学习的方法。 而这是日后罪实用的,真的是受益匪浅。 我已从中真正体会到了,做设计不是为顺利完成而做,而是为了学会遇到问题懂得去解决而做。 虽然实践问题会遇到很多,每一次实验其实真的可以让人学到很多知识。 只有自己懂得去总结,才能从中体会到收获。 五.参考书籍: 《EDA技术教程》梁勇著人民邮电出版社 《VHDL应用与开发实践》甘历著科学出版社 《基于QuartusII的FPGA/CPLD设计与实践》高金定电子工业出版社
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- eda 课程设计 数字频率计