基于FPGA的温度显示系统Word格式.docx

上传人:b****1 文档编号:1467964 上传时间:2023-04-30 格式:DOCX 页数:32 大小:137.08KB
下载 相关 举报
基于FPGA的温度显示系统Word格式.docx_第1页
第1页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第2页
第2页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第3页
第3页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第4页
第4页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第5页
第5页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第6页
第6页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第7页
第7页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第8页
第8页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第9页
第9页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第10页
第10页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第11页
第11页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第12页
第12页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第13页
第13页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第14页
第14页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第15页
第15页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第16页
第16页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第17页
第17页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第18页
第18页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第19页
第19页 / 共32页
基于FPGA的温度显示系统Word格式.docx_第20页
第20页 / 共32页
亲,该文档总共32页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

基于FPGA的温度显示系统Word格式.docx

《基于FPGA的温度显示系统Word格式.docx》由会员分享,可在线阅读,更多相关《基于FPGA的温度显示系统Word格式.docx(32页珍藏版)》请在冰点文库上搜索。

基于FPGA的温度显示系统Word格式.docx

--复位信号

scl:

outstd_logic;

--i2c时钟线

sda:

inoutstd_logic;

--i2c数据线

urv_1:

--上限值1

urv_2:

--上限值2

sel:

outstd_logic_vector(3downto0);

seg:

outstd_logic_vector(7downto0);

beep:

outstd_logic--蜂鸣器输出信号线

);

endat24c08;

--结构体--

architecturearch_at24c08ofat24c08is

signalclk_sslow:

std_logic;

signalcounter:

std_logic_vector(23downto0);

signalreaddata_reg_buf:

std_logic_vector(15downto0);

signalreaddata_ten:

integerrange0to24564;

signalreaddata_std:

signalqian:

std_logic_vector(3downto0);

signalbai:

signalshi:

signalge:

signalqian_0:

integerrange0to10;

signalbai_0:

signalshi_0:

signalge_0:

--数码管部分信号

signalsel_0:

signalseg_0:

std_logic_vector(7downto0);

signalcount:

std_logic_vector(13downto0);

signalclk_slow:

signalscan_num:

std_logic_vector(1downto0);

signalseg_data_buf:

--i2c部分信号

signalsda_buf:

--i2c输入/输出数据寄存器

signallink:

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

signalreaddata_reg:

--i2c读回的数据寄存器

signalsda_0:

--与sda端口连接信号

signalscl_0:

--与scl端口连接信号

--按键消抖部分信号

signaldelay_cnt:

std_logic_vector(19downto0);

--消抖延时计数器

signalstart_delay:

--按键延时开始

--分频部分信号

signalclk_div:

std_logic_vector(12downto0);

--分频计数器,5000分频,10khz

--蜂鸣器部分信号

signalbeep_en:

--蜂鸣器使能信号

signalbeep_buf:

--与beep端口连接的信号

--时钟部分信号

signallevel_high:

--高电平中间值,1249

signallevel_low:

--低电平中间值,3749

signallevel_hig_edge:

--上升沿,4999

signallevel_low_edge:

--下降沿,2499

--状态机部分信号

signalmain_state:

--状态机主状态

signali2c_state:

std_logic_vector(2downto0);

--i2c状态

signali2c_per_state:

--i2c每一步状态

--分频部分常量

constantdiv_parameter:

std_logic_vector(12downto0):

="

1001110001000"

;

--分频系数,500

--状态机部分常量

--操作状态常量

constantread_init:

std_logic_vector(2downto0):

000"

--EEPORM初始化

constantread_high:

001"

--读高位数据状态

constantread_low:

010"

--读低位数据状态

--i2c每一步状态常量

constantstart:

std_logic_vector(3downto0):

0000"

--开始位

constantfirst:

0001"

--数据第一位

constantsecond:

0010"

--数据第二位

constantthird:

0011"

--数据第三位

constantfourth:

0100"

--数据第四位

constantfifth:

0101"

--数据第五位

constantsixth:

0110"

--数据第六位

constantseventh:

0111"

--数据第七位

constanteighth:

1000"

--数据第八位

constantack:

1001"

--应答位

constantstop:

1010"

--停止位

--结构体开始

begin

scl<

=scl_0;

seg<

=seg_0;

sda_0<

=sda_bufwhen(link)='

1'

else'

Z'

sda<

=sda_0;

sel<

=sel_0;

beep<

=beep_buf;

--按键消抖

key:

process(clk,rst)

begin

if(notrst='

)then

delay_cnt<

=(others=>

'

0'

);

elsif(clk'

eventandclk='

)then

ifstart_delay='

then

if(delay_cnt/="

11110100001001000000"

)then--20ms延时

delay_cnt<

=delay_cnt+'

else

endif;

endif;

endif;

endprocesskey;

--分频部分

div:

process(rst,clk)

clk_div<

="

0000000000000"

level_high<

='

level_low<

level_hig_edge<

level_low_edge<

elsif(clk'

if(clk_div/=div_parameter-'

clk_div<

=clk_div+'

else

if(level_high='

level_high<

if(clk_div="

10011100001"

level_high<

if(level_low_edge='

level_low_edge<

100111000011"

level_low_edge<

if(level_low='

level_low<

111010100101"

level_low<

if(level_hig_edge='

level_hig_edge<

1001110000111"

level_hig_edge<

endprocessdiv;

--EEPROM操作部分

state:

start_delay<

scl_0<

sda_buf<

link<

readdata_reg<

0000000000000000"

main_state<

00"

i2c_state<

=read_init;

i2c_per_state<

=start;

casemain_stateis

--初始化EEPROM

when"

=>

--等待读写要求

scl_0<

sda_buf<

link<

i2c_state<

i2c_per_state<

main_state<

10"

--读取EEPRO数据

if(level_hig_edge='

scl_0<

else

if(level_low_edge='

scl_0<

endif;

endif;

casei2c_stateis

whenread_init=>

--读命令地址

casei2c_per_stateis

whenstart=>

if(level_high='

sda_buf<

link<

endif;

if((level_lowandlink)='

i2c_per_state<

=first;

whenfirst=>

if(level_low='

=second;

whensecond=>

=third;

whenthird=>

=fourth;

whenfourth=>

=fifth;

whenfifth=>

=sixth;

whensixth=>

=seventh;

whenseventh=>

=eighth;

wheneighth=>

=ack;

whenack=>

if(level_hig_edge='

=sda;

if(sda_buf='

main_state<

endif;

i2c_state<

=read_high;

whenothers=>

null;

endcase;

whenread_high=>

--读回数据

readdata_reg(15downto9)<

=readdata_reg(14downto8);

readdata_reg(8)<

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 人文社科 > 法律资料

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2