1、EDA课程设计 数字电压表 代码及 报告第一部分 项目名称、内容与要求项目名称:数字电压表设计1.1 设计内容利用FPGA与模数转换器ADC0809设计一个数字电压表,能够测量05V之间的直流电压,用四个数码管显示被测电压,要求精确到小数点后三位数字。了解数字电压表的工作原理,掌握可编程逻辑器件与模数转换器之间的接口电路设计及调试方法。下载并测试电路功能,分析芯片资源的占用情况。1.2 具体要求1)、能正确测量0-5模拟电压,误差=0 and qq=1000000 and qq=2000000 and qq=3000000 and qq=4000000 and qq=5000000 and q
2、q=0 and baii=100000 and baii=200000 and baii=300000 and baii=400000 and baii=500000 and baii=600000 and baii=700000 and baii=800000 and baii=900000 and baii=0 and shll=10000 and shll=20000 and shll=30000 and shll=40000 and shll=50000 and shll=60000 and shll=70000 and shll=80000 and shll=90000 and sh
3、ll=0 and gee=1000 and gee=2000 and gee=3000 and gee=4000 and gee=5000 and gee=6000 and gee=7000 and gee=8000 and gee=9000 and gee=9999 then ge:=9; else ge:=0; end if; wqian=qian;wbai=bai;wshi=shi;wge=ge;end process;process(clk) variable cnt:std_logic_vector(2 downto 0);begin if clkevent and clk=1 th
4、en if cnt3 then cnt:=cnt+1; else cnt:=000;p=not p; end if; weiqqqqnull; end case; end if; wr=p; rd=1; csdaadaadaadaadaadaadaadaadaadaanull; end case;end process;process(wei,daa)begin if wei=000 then w=wei; da=daa or00000001; else w=wei; da=daa; end if; end process;end behave;AD控制元件代码IBRARY ieee; -A/
5、D0809use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity ad is port(ST,eoc:in std_logic; -控制端口d:in std_logic_vector(7 downto 0);oe,sta,ale,adda:out std_logic;q:out std_logic_vector(7 downto 0);end ad;architecture a of ad istype states is(st0,st1,st2,st3,st
6、4,st5,st6); -7个状态signal c_state,n_state:states :=st0;signal regl:std_logic_vector(7 downto 0);signal lock:std_logic;begin addaale=0;sta=0;oe=0;lock=0;n_stateale=1;sta=0;oe=0;lock=0;n_stateale=0;sta=1;oe=0;lock=0;n_stateale=0;sta=0;oe=0;lock=0;if(eoc=1) then n_state=st4;else n_stateale=0;sta=0;oe=1;l
7、ock=0;n_stateale=0;sta=0;oe=0;lock=1;n_stateale=0;sta=0;oe=0;lock=1;n_staten_state=st0;end case;end process com;reg:process(st) beginif(stevent and st=1) thenc_state=n_state;end if;end process reg;lo:process(lock) -锁存begin if(lockevent and lock=1) then regl=d;end if;end process lo;q=regl; end a;3.2
8、系统整体电路图(或RTL级电路图)第四部分:系统仿真(Simulation Waveform)系统仿真图如图:仿真前输入设置图:功能仿真图:时序仿真图: 第五部分:FPGA实现(FPGA Implementation)1、硬件验证 在前两次代码无误但下载到芯片硬件验证,始终不能满足要求时,经过查阅资料和老师指导。和本组成员的不放弃的努力下。改正过RTL原理图后,怀着试一试的态度和必胜的心态又一次下载到硬件验证。2、操作过程 下载成功后,我们可以通过AD装换芯片ADC0809(详见附录)的功能,通过:A/B/C三段的不同84321BCD码状态来得到此芯片八个频道具体是哪一频道。(注:000选CH
9、0;001选CH1)然后将相应的频道接到直流电压(05V)。当然输出显示为数码管显示和3个LED灯(3个LED灯主要是显示的是CS,RD,WD)。3、结果等说明 在实验箱上的左上角的直流电压旋钮旋到最小处时数码管显示为:0:.000,当旋到最大处时数码管显示为:5:.000,中间的值位0V5V之间。 第六部分:总结(Closing)这次数字电压表系统的设计达到了预期的效果,这次设计的内容主要体现在程序算法上。电压值。此程序下载后占用芯片内存小易实现。,DVM的高速发展,使它已成为实现量的采集资料的过程。在这个过程里我们走过需对弯路和冤枉路。这些都是我们宝贵的字系统设参考书目(Reference
10、):EDA技术与实验 陈立万 陈强 赵威威 李洪兵 姜玉泉电子设计自动化(EDA)课程设计与项目实例 李莉 路而红附录(Appendix):A/D转换器芯片ADC0809简介 8路模拟信号的分时采集,片内有8路模拟选通开关,以及相应的通道抵制锁存用译码电路,其转换时间为100s左右。1. ADC0809的内部结构ADC0809的内部逻辑结构图如图9-7所示。图9.7 ADC0809内部逻辑结构图中多路开关可选通8个模拟通道,允许8路模拟量分时输入,共用一个A/D转换器进行转换,这是一种经济的多路数据采集方法。地址锁存与译码电路完成对A、B、C 3个地址位进行锁存和译码,其译码输出用于通道选择,
11、其转换结果通过三态输出锁存器存放、输出,因此可以直接与系统数据总线相连,表9-1为通道选择表。 2信号引脚ADC0809芯片为28引脚为双列直插式封装,其引脚排列见图9.8。对ADC0809主要信号引脚的功能说明如下:IN7IN0模拟量输入通道ALE地址锁存允许信号。对应ALE上跳沿,A、B、C地址状态送入地址锁存器中。START转换启动信号。START上升沿时,复位ADC0809;START下降沿时启动芯片,开始进行A/D转换;在A/D转换期间,START应保持 低电平。本信号有时简写为ST.A、B、C地址线。 通道端口选择线,A为低地址,C为高地址,引脚图中为ADDA,ADDB和ADDC。其地址状态与通道对应关系见表9-1。CLK时钟信号。ADC0809的内部没有时钟电路,所需时钟信号由外界提供,因此有时钟信号引脚。通常使用频率为500KHz的时钟信号EOC转换结束信号。EOC=0,正在进行转换;EOC=1,转换结束。使用中该状态信号即可作为查询的状态标志,又可作为中断请求信号使用。D7D0数据输出线。为三态缓冲输出形式,可以和单片机的数据线直接相连。D0为最低位,D7为最高 OE输出允许信号。用于控制三态输出锁存器向单片机输出转换得到的数据。OE=0,输出数据线呈高阻;OE=1,输出转