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

基于FPGA的温度监控系统 - 图文

来源:用户分享 时间:2025/5/15 10:08:04 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

山东科技大学学士学位论文 附录

dq_out <= data_w[cnt_bit]; end else if(cnt < 'd65) begin link <= 0; end else begin cnt <= 0; cnt_bit <= cnt_bit + 1; if(cnt_bit == 'd7) begin cnt_bit <= 0; state <= WAIT_800MS; end end end

WAIT_800MS: begin cnt <= cnt + 1; if(cnt == 'd800000) begin cnt <= 0; state <= RESET2; end end

RESET2: begin cnt <= cnt + 1; if(cnt < 'd500) begin link <= 1; dq_out <= 0; end else if(cnt < 'd1000) begin link <= 0; end else begin cnt <= 0;

state <= WRITE_CC2;

41

//等待800ms //第二次复位 山东科技大学学士学位论文 附录

data_w <= 8'hcc; cnt_bit <= 0; end end

WRITE_CC2: begin //吸入跳过rom命令 cnt <= cnt + 1; if(cnt < 'd5) begin link <= 1; dq_out <= 0; end else if(cnt < 'd60) begin dq_out <= data_w[cnt_bit]; end else if(cnt < 'd65) begin link <= 0; end else begin cnt <= 0; cnt_bit <= cnt_bit + 1; if(cnt_bit == 'd7) begin state <= WRITE_BE; cnt_bit <= 0; data_w <= 8'hbe; end end end

WRITE_BE: begin cnt <= cnt + 1; if(cnt < 'd5) begin link <= 1; dq_out <= 0; end

else if(cnt < 'd60)

42

//写入读数据命令 山东科技大学学士学位论文 附录

begin dq_out <= data_w[cnt_bit]; end else if(cnt < 'd65) begin link <= 0; end else begin cnt <= 0; cnt_bit <= cnt_bit + 1; if(cnt_bit == 'd7) begin state <= READ1; cnt_bit <= 0; end end end

READ1: begin cnt <= cnt + 1; if(cnt < 'd3) begin link <= 1; dq_out <= 0; end else if(cnt == 'd3) link <= 0; else if(cnt == 'd12) data_r[cnt_bit] <= dq_in; else if(cnt > 'd65) begin cnt <= 0; cnt_bit <= cnt_bit + 1; if(cnt_bit == 'd7) begin cnt_bit <= 0; temp[7:0] <= data_r; state <= READ2;

end

43

//读入第一个字节 山东科技大学学士学位论文 附录

end end READ2:

begin //读入第二个字节 cnt <= cnt + 1; if(cnt < 'd3) begin link <= 1; dq_out <= 0; end else if(cnt == 'd3) link <= 0; else if(cnt == 'd12) data_r[cnt_bit] <= dq_in; else if(cnt > 'd65) begin cnt <= 0; cnt_bit <= cnt_bit + 1; if(cnt_bit == 'd7) begin cnt_bit <= 0; temp[15:8] <= data_r; state <= RESET1; end end end endcase end

endmodule 分频模块: module clk_gen( input rst, input clk, output reg clk_1k, output reg clk_1m ); reg[14:0] cnt_1k;

44

搜索更多关于: 基于FPGA的温度监控系统 - 图文 的文档
基于FPGA的温度监控系统 - 图文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c9id076s1no4oweh0piu0_12.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top