频率计的设计.docx
- 文档编号:29269983
- 上传时间:2023-07-21
- 格式:DOCX
- 页数:14
- 大小:189.18KB
频率计的设计.docx
《频率计的设计.docx》由会员分享,可在线阅读,更多相关《频率计的设计.docx(14页珍藏版)》请在冰豆网上搜索。
频率计的设计
大学电子信息科学与技术专业
《EDA技术及应用》课程设计
频率计的设计
设计组别:
设计者:
班级:
07级电子信息科学与技术班
指导老师:
设计时间:
2010-6-24
大学物电学院
目录
设计要求………………………………………………03
设计思想及原理框图…………………………………03
综合系统电路图见附录
(一)………………………04
电路工作原理…………………………………………04
主要VHDL源程序…………………………………..04
单元电路仿真图……………………………………...09
硬件验证……………………………………………...11
测试…………………………………………………...13
设计心得…………………………………………………...
附录综合系统电路图………………………………...15
参考文献……………………………………………...15
频率计的设计
设计者:
指导老师:
时间:
2010-6-24
(一)设计要求:
能实现对脉冲信号频率的精密测量;
测量范围1Hz~10MHz;
通过8个数码管动态显示测量值;
扩展要求:
能够测量正弦波、三角波、锯齿波等信号频率。
(二)设计思想及原理框图:
设计思想:
根据系统的设计要求,频率计电路可分为测频控制器电路、十进制技术电路、四位锁存器电路、动态扫描译码显示电路等四个子模块,其中动态扫描电路置零功能,根据此思路该设计采用模块化设计;
综合原理框图:
(三)综合系统电路图见附录
(一)
(四)电路工作原理:
根据频率计的定义和频率测试的基本原理,测定信号的频率必须有一个脉冲宽为1s对输入信号脉冲计数允许的信号;1s计数结束后,计数值锁入锁存器的锁存信号和为下一测频计数周期做准备的计数器清0信号。
这3个信号由测频控制器TESTCL产生,对其的设计要求是,TESTCL的计数使能信号输出CNT_EN能产生一个1s脉宽的周期信号,并对频率计的每一个计数器CNT10的使能端ENA进行同步控制。
当CNT_EN为高电平时允许计数;否则,停止计数,并保持所记的脉冲数。
在停止计数期间,首先需要一个锁存信号LOAD的上升沿将计数器在前1s的计数值锁存如各锁存器REG4B中,并由动态扫描译码显示电路送给数码管显示。
设计锁存器的好处是,显示的数据稳定,不会由于周期性的清零信号而不断闪烁。
信号锁存之后,还需用清零信号RST_CNT对计数器进行清零,为下一秒的计数操作做准备。
(五)主要VHDL源程序
1.测频控制器TESTCL的VHDL源程序及模块
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitytestctlis
port(clkk:
instd_logic;
cnt_en,rst_cnt,load:
outstd_logic);
endtestctl;
architectureoneoftestctlis
signaldiv2clk:
std_logic;
begin
process(clkk)
begin
ifclkk'eventandclkk='1'thendiv2clk<=notdiv2clk;
endif;
endprocess;
process(clkk,div2clk)
begin
ifclkk='0'anddiv2clk='0'thenrst_cnt<='1';
elserst_cnt<='0';endif;
endprocess;
load<=notdiv2clk;cnt_en<=div2clk;
endone;
2.十进制计数器CNT_10的VHDL源程序及模块
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycnt10is
port(clock,rst,ena:
instd_logic;
outy:
outstd_logic_vector(3downto0);
cout:
outstd_logic);
endcnt10;
architecturethreeofcnt10is
signalcqi:
std_logic_vector(3downto0);
begin
p_reg:
process(clock,rst,ena)
begin
ifrst='1'thencqi<="0000";
elsifclock'eventandclock='1'andena='1'then
ifcqi="1001"thencqi<="0000";cout<='1';
elsecqi<=cqi+1;cout<='0';
endif;
endif;
outy<=cqi;
endprocessp_reg;
endthree;
3.四位锁存器REG4B的VHDL源程序及模块
libraryieee;
useieee.std_logic_1164.all;
entityreg4bis
port(load:
instd_logic;
din:
instd_logic_vector(3downto0);
dout:
outstd_logic_vector(3downto0));
endreg4b;
architecturetwoofreg4bis
begin
process(load,din)
begin
ifload'eventandload='1'thendout<=din;
endif;
endprocess;
endtwo;
4.动态扫描saomiao5的VHDL的VHDL源程序及模块
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
useieee.std_logic_arith.all;
entitysaomiaois
port(clk1,reset:
instd_logic;
cnt0,cnt1,cnt2,cnt3,cnt4,cnt5,cnt6,cnt7:
instd_logic_vector(3downto0);
sel0,sel1,sel2:
outstd_logic;
cout:
outstd_logic_vector(3downto0));
endsaomiao;
architecturefiveofsaomiaois
signalcount:
std_logic_vector(2downto0);
begin
sel0<=count(0);
sel1<=count
(1);
sel2<=count
(2);
process(clk1,reset,cnt0,cnt1,cnt2,cnt3,cnt4,cnt5,cnt6,cnt7)
begin
if(reset='0')then
count<="000";
elsifclk1'eventandclk1='1'then
if(count>="101")then
count<="000";
else
count<=count+1;
endif;
endif;
casecountis
when"000"=>cout<=cnt0(3downto0);
when"001"=>cout<=cnt1(3downto0);
when"010"=>cout<=cnt2(3downto0);
when"011"=>cout<=cnt3(3downto0);
when"100"=>cout<=cnt4(3downto0);
when"101"=>cout<=cnt5(3downto0);
when"110"=>cout<=cnt6(3downto0);
when"111"=>cout<=cnt7(3downto0);
endcase;
endprocess;
endfive;
5.译码电路dec7sdeVHDL源程序及模块
libraryieee;
useieee.std_logic_1164.all;
entitydec7sis
port(a:
inbit_vector(3downto0);
led7s:
outbit_vector(7downto0));
end;
architecturefourofdec7sis
begin
process(a)
begin
caseais
when"0000"=>led7s<="00111111";
when"0001"=>led7s<="00000110";
when"0010"=>led7s<="01011011";
when"0011"=>led7s<="01001111";
when"0100"=>led7s<="01100110";
when"0101"=>led7s<="01101101";
when"0110"=>led7s<="01111101";
when"0111"=>led7s<="00000111";
when"1000"=>led7s<="01111111";
when"1001"=>led7s<="01101111";
whenothers=>led7s<=null;
endcase;
endprocess;
endfour;
(六)单元电路仿真图:
测频控制器TESTCL的仿真图
计数电路COUNT10的仿真图
四位锁存器REG4B的仿真图
COUNT7计星期电路的仿真图
动态扫描saomiao5电路的仿真图
译码电路的仿真图
系统电路仿真图
(七)硬件验证
引脚分部图
实验开发平台及连线如图所示
引脚说明:
Out[0]~out[7]分别接试验箱上数码管旁边的a~dp;sel0~sel2分别接键盘旁边的sel0~sel2;
Reset接拨动开关;smclk接5KHz;F100Hz接100Hz
芯片型号:
本实验采用三星公司的cyclone下EP1C12Q240C8N芯片。
(八)测试
标准源
测量值
误差
相对误差
9
9
0
0
99
99
0
0
999
999
0
0
1000
1000
0
0
1499
1499
0
0
2499
2499
0
0
8499
8499
0
0
15499
15499
0
0
30499
30499
0
0
80499
80500
-1
1.24225E-05
100499
100500
-1
9.95035E-06
500499
500504
-5
9.99003E-06
800499
800507
-8
9.99377E-06
1000499
1000510
-11
1.09945E-05
1200499
1200513
-14
1.16618E-05
1500499
1500515
-16
1.06631E-05
1800499
1800519
-20
1.1108E-05
1900499
1900519
-20
1.05236E-05
2000499
2000522
-23
1.14971E-05
2200499
2200524
-25
1.13611E-05
2400499
2400527
-28
1.16642E-05
2500499
2500527
-28
1.11978E-05
2600499
2600529
-30
1.15362E-05
2900499
2900532
-33
1.13774E-05
3000499
3000534
-35
1.16647E-05
3200499
3200536
-37
1.15607E-05
3500499
3500541
-42
1.19983E-05
3900499
3900546
-47
1.20497E-05
4000499
4000548
-49
1.22485E-05
5000499
5000559
-60
1.19988E-05
6000499
6000571
-72
1.1999E-05
7000499
7000584
-85
1.2142E-05
8000499
8000596
-97
1.21242E-05
9000499
9000609
-110
1.22215E-05
10000499
10000622
-123
1.22994E-05
12000499
12000647
-148
1.23328E-05
14000499
14000672
-173
1.23567E-05
14400499
14400683
-184
1.27773E-05
14600499
14600689
-190
1.30133E-05
14900499
14900696
-197
1.3221E-05
误差分析:
本系统的误差主要来自于计数脉冲和门控信号不同步。
(九)设计心得
这次课程设计收获很大,首先加深了对Vhdl的理解和掌握;第二,设计思想上也有了提升,掌握了把一项工程分成若干个模块各个击破的模块化设计思想;
由于时间紧张,本设计的扩张部分要求未能实现。
但可以考虑在系统前端加用74LS00构成的施密特触发器,它对输入信号进行整形,使之成为矩形脉冲。
(十)附录
综合系统电路图
(十一)参考文献
[1].汪国强。
EDA技术与应用(第2版)。
北京:
电子工业出版社,2007。
[2].谢自美。
电子线路设计实验测试(第三版)。
武汉:
华中科技大学出版社,2007。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 频率计 设计