77范文网 - 专业文章范例文档资料分享平台

基于FPGA的数字电压表设计(3)

来源:网络收集 时间:2019-04-09 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

3 4 5 6 7 8 9 10

参考文献

[1]潘松,黄继业.EDA实用教程.北京.科学出版社.2002年10月第一版

[2]黄智伟.全国大学生电子设计竞赛训练教程.北京:电子工业出版式社.2005年1月第1版; [3]高吉祥,〈〈数字电子技术〉〉北京:电子工业出版社,2003年8谭浩强月第1版;

附录1: 源程序清单

顶层:

library IEEE;

use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL;

-- Uncomment the following lines to use the declarations that are -- provided for instantiating Xilinx primitive components. --library UNISIM;

--use UNISIM.VComponents.all;

entity top is

Port ( clk,reset:in std_logic;

key1,eoc:in std_logic;

D:in std_logic_vector(7 downto 0); ale,start,oe,clk500k:out std_logic;

cba:out std_logic_vector(2 downto 0);---0809通道选择 xs:out std_logic_vector(8 downto 0); ---发光二极管显示状态 lcden:out std_logic; --接LCD使能端

lcdda:out std_logic; --接LCD_da信号输入端 lcdrw:out std_logic; --接LCD读写信号输入端

lcddata:inout std_logic_vector(7 downto 0));--接LCD数据输入位 end top;

architecture Behavioral of top is

11

component key is

Port (clk,reset:in std_logic; key1:in std_logic; clkz:out std_logic;

dw1:out integer range 0 to 2;

cba:out std_logic_vector(2 downto 0));

end component;

component ad0809 is

Port ( clk,reset:in std_logic; eoc:in std_logic;

D:in std_logic_vector(7 downto 0); ale,start,oe,clk500k:out std_logic; xs:out std_logic_vector(8 downto 0);---0809工作状态显示

Q:out std_logic_vector(7 downto 0));

end component;

component yima is

Port ( clk:in std_logic; clkz:in std_logic;

Q:in std_logic_vector(7 downto 0);

v1,v2,v3,v4,v5:out integer range 0 to 9);

end component;

component lcd is

generic(delay:integer:=100); ---类属说明 Port ( clk,reset:in std_logic; dw1:in integer range 0 to 2;

v1,v2,v3,v4,v5:in integer range 0 to 9;

lcden:out std_logic; --接LCD使能端

lcdda:out std_logic; --接LCD_da信号输入端 lcdrw:out std_logic; --接LCD读写信号输入端

lcddata:inout std_logic_vector(7 downto 0));--接LCD数据输入位 end component;

signal clkz_load:std_logic;

signal dw1_load:integer range 0 to 2; signal Q_load:std_logic_vector(7 downto 0);

signal v1_load,v2_load,v3_load,v4_load,v5_load:integer range 0 to 9; begin

u1:key port map

(clk=>clk,reset=>reset,key1=>key1,clkz=>clkz_load,dw1=>dw1_load,cba=>cba); u2:ad0809 port map

12

(clk=>clk,reset=>reset,eoc=>eoc,D=>D,ale=>ale,start=>start,oe=>oe,clk500k=>clk500k,xs=>xs,Q=>Q_load); u3:yima port map

(clk=>clk,clkz=>clkz_load,Q=>Q_load,v1=>v1_load,v2=>v2_load,v3=>v3_load,v4=>v4_load,v5=>v5_load); u4:lcd port map

(clk=>clk,reset=>reset,dw1=>dw1_load,v1=>v1_load,v2=>v2_load,v3=>v3_load,v4=>v4_load,v5=>v5_load, 按键: library IEEE;

use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL;

-- Uncomment the following lines to use the declarations that are -- provided for instantiating Xilinx primitive components. --library UNISIM;

--use UNISIM.VComponents.all;

entity key is

Port (clk,reset:in std_logic;

architecture Behavioral of key is signal clkk:std_logic; begin

process(clk,reset) variable clk1:std_logic;

variable cnt:integer range 0 to 50000000; begin

if reset='1' then

if clk'event and clk='1' then if cnt<49999999 then

clk1:='1';cnt:=cnt+1;

key1:in std_logic;

clkz:out std_logic;

dw1:out integer range 0 to 2;

cba:out std_logic_vector(2 downto 0));

lcden=>lcden,lcdda=>lcdda,lcdrw=>lcdrw,lcddata=>lcddata); end Behavioral;

end key;

13

elsif cnt<=50000000 then clk1:='0';cnt:=0;

end if;

end if;

end if; clkz<=clk1; end process;

process(clk,reset) variable clk0:std_logic;

variable cnt:integer range 0 to 3125000;---0.125s begin

if reset='0' then cnt:=0;clk0:='0'; elsif clk'event and clk='1' then if cnt=3125000 then cnt:=0;clk0:=not clk0; else cnt:=cnt+1;

end if;

end if;

clkk<=clk0; end process;

process(clkk,reset,key1)

variable cnt:integer range 0 to 3; begin

if reset='1' then if rising_edge(clkk) then if cnt>2 then cnt:=0; elsif key1='0' then cnt:=cnt+1; case cnt is

when 1=>cba<=\ when 2=>cba<=\

when others=>cba<=\

end case;

end if;

end if;

end if;

end process; end Behavioral;

14

显示; library IEEE;

use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL;

-- Uncomment the following lines to use the declarations that are -- provided for instantiating Xilinx primitive components. --library UNISIM;

--use UNISIM.VComponents.all;

entity lcd is

generic(delay:integer:=100); ---类属说明 Port ( clk,reset:in std_logic; dw1:in integer range 0 to 2;

v1,v2,v3,v4,v5:in integer range 0 to 9;

lcden:out std_logic; --接LCD使能端

lcdda:out std_logic; --接LCD_da信号输入端 lcdrw:out std_logic; --接LCD读写信号输入端

lcddata:inout std_logic_vector(7 downto 0));--接LCD数据输入位 end lcd;

architecture Behavioral of lcd is signal clk_500hz:std_logic;

type state is (set_dlnf,clear_lcd,set_cursor,set_dcb,set_location,write_data); signal current_state:state;

type ram is array(0 to 9) of std_logic_vector(7 downto 0); signal dataram :ram;

signal x1,x2,xv1,xv2,xv3,xv4,xv5:std_logic_vector(7 downto 0); constant v:std_logic_vector(7 downto 0):=\constant g:std_logic_vector(7 downto 0):=\横杠 constant k:std_logic_vector(7 downto 0):=\空格 constant d:std_logic_vector(7 downto 0):=\小数点 constant dw:std_logic_vector(7 downto 0):=\单位v begin

process(clk,reset,clk_500hz)

variable cnt:integer range 0 to 5000;---1khz begin

if reset='0'then cnt:=0;clk_500hz<='0'; elsif clk'event and clk='1' then cnt:=cnt+1;

if cnt<2500 then clk_500hz<='1';

15

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库基于FPGA的数字电压表设计(3)在线全文阅读。

基于FPGA的数字电压表设计(3).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/582791.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: