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

基于FPGA的LM75A温度传感器(VHDL)

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

1. 编写的程序 (一)功能模块: library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; --实体--

entity at24c08 is

port(

clk rst scl sda

: in : in : out

std_logic;

--时钟信号 --复位信号 --i2c时钟线 --i2c数据线 --上限值1

--上限值2

std_logic;

std_logic; std_logic; std_logic;

: inout

: in : in : :

urv_1 urv_2 sel seg beep );

std_logic;

out std_logic_vector(3 downto 0); out std_logic_vector(7 downto 0);

std_logic

--蜂鸣器输出信号线

: out

end at24c08;

--结构体--

architecture arch_at24c08 of at24c08 is signal clk_sslow

: std_logic;

signal counter : std_logic_vector(23 downto 0);

signal readdata_reg_buf : std_logic_vector(15 downto 0); signal readdata_ten signal readdata_std signal qian signal bai signal shi signal ge

signal qian_0 signal bai_0 signal shi_0 signal ge_0

--数码管部分信号 signal sel_0 signal seg_0 signal count

signal clk_slow signal scan_num

signal seg_data_buf

--i2c部分信号 signal sda_buf signal link

signal readdata_reg 存器

signal sda_0 signal scl_0

--按键消抖部分信号

: integer range 0 to 24564; : std_logic_vector(15 downto 0); : std_logic_vector(3 downto 0); : std_logic_vector(3 downto 0); : std_logic_vector(3 downto 0); : std_logic_vector(3 downto 0); : integer range 0 to 10; : integer range 0 to 10; : integer range 0 to 10; : integer range 0 to 10;

: std_logic_vector(3 downto 0); : std_logic_vector(7 downto 0); : std_logic_vector(13 downto 0); : std_logic;

: std_logic_vector(1 downto 0); : std_logic_vector(3 downto 0);

: std_logic; --i2c输入/输出数据寄存器 : std_logic;

--sda输入输出方向寄存器

: std_logic_vector(15 downto 0);--i2c读回的数据寄

: std_logic; --与sda端口连接信号 : std_logic;

--与scl端口连接信号

signal delay_cnt signal start_delay

--分频部分信号 signal clk_div

器,5000分频,10khz

--蜂鸣器部分信号 signal beep_en

signal beep_buf

--时钟部分信号 signal level_high signal level_low

signal level_hig_edge signal level_low_edge

--状态机部分信号 signal main_state signal i2c_state

signal i2c_per_state

--分频部分常量

constant div_parameter --分频系数,500

--状态机部分常量

--操作状态常量

constant read_init

初始化

: std_logic_vector(19 downto 0); --消抖延时计数器 : std_logic;

--按键延时开始

: std_logic_vector(12 downto 0);

--分频计数

: std_logic; --蜂鸣器使能信号 : std_logic;

--与beep端口连接的信号

: std_logic; --高电平中间值,1249 : std_logic; --低电平中间值,3749 : std_logic; --上升沿,4999 : std_logic;

--下降沿,2499

: std_logic_vector(1 downto 0); --状态机主状态 : std_logic_vector(2 downto 0); --i2c状态 : std_logic_vector(3 downto 0); --i2c每一步状态

: std_logic_vector(12 downto 0):=\: std_logic_vector(2 downto 0)

:=\

constant read_high 数据状态

constant read_low 数据状态

: std_logic_vector(2 downto 0) :=\读高位

: std_logic_vector(2 downto 0) :=\读低位

--i2c每一步状态常量

constant start

--开始位 constant first --数据第一位

constant second --数据第二位 constant third

--数据第三位 constant fourth --数据第四位 constant fifth --数据第五位 constant sixth --数据第六位 constant seventh --数据第七位 constant eighth --数据第八位 constant ack --应答位 constant stop --停止位

--结构体开始

: std_logic_vector(3 downto 0)

: std_logic_vector(3 downto 0) : std_logic_vector(3 downto 0) : std_logic_vector(3 downto 0) : std_logic_vector(3 downto 0) : std_logic_vector(3 downto 0) : std_logic_vector(3 downto 0) : std_logic_vector(3 downto 0) : std_logic_vector(3 downto 0) : std_logic_vector(3 downto 0) : std_logic_vector(3 downto 0) :=\

:=\

:=\

:=\

:=\

:=\

:=\

:=\

:=\

:=\

:=\

begin scl <= scl_0; seg <= seg_0;

sda_0 <= sda_buf when (link)='1' else 'Z'; sda <= sda_0; sel <= sel_0; beep <= beep_buf;

--按键消抖

key : process(clk,rst) begin if(not rst='1') then

delay_cnt <= (others => '0');

elsif (clk'event and clk='1') then if start_delay='1' then if(delay_cnt /= \

delay_cnt <= delay_cnt+'1';

else

delay_cnt <= (others => '0');

end if;

end if;

end if;

end process key;

--分频部分

div : process(rst,clk) begin if(not rst='1') then clk_div <= \

level_high <= '0';

--20ms延时

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库基于FPGA的LM75A温度传感器(VHDL)在线全文阅读。

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