基于FPGA温度传感器DS18B20的Verilog设计4页

上传人:文库****9 文档编号:173996859 上传时间:2021-03-15 格式:DOC 页数:4 大小:352KB
返回 下载 相关 举报
基于FPGA温度传感器DS18B20的Verilog设计4页_第1页
第1页 / 共4页
基于FPGA温度传感器DS18B20的Verilog设计4页_第2页
第2页 / 共4页
基于FPGA温度传感器DS18B20的Verilog设计4页_第3页
第3页 / 共4页
基于FPGA温度传感器DS18B20的Verilog设计4页_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《基于FPGA温度传感器DS18B20的Verilog设计4页》由会员分享,可在线阅读,更多相关《基于FPGA温度传感器DS18B20的Verilog设计4页(4页珍藏版)》请在金锄头文库上搜索。

1、基于FPGA温度传感器DS18B20的Verilog设计赖青松(江西师范大学 南昌 电子信息工程)摘 要: 本文利用数字温度传感器 DS18B20 的数据接口和特点 ,阐述了一种基于现场可编程门阵列( FPGA)控制DS18B20的方法。使用 FPGA 作为控制器 ,严格控制DS18B20 的时序 ,在单总线上实现读写功能 ,完成测量数字温度的功能。将测量的二进制数转换为BCD码 ,并通过数码管显示。系统设计使用 Verilog 语言。由于 DS18B20 是采用一根 I/ O 总线读写数据,因此DS18B20 对读写数据位有严格的时序要求。DS18B20 遵循相应的通信协议从而保证数据传输的

2、正确性和完整性。该通信协议定义了多种信号时序:初始化时序、 写时序、 读时序1、初始化时序:During the initialization sequence the bus master transmits (TX) the reset pulse by pulling the 1-Wire bus low for a minimum of 480us. The bus master then releases the bus and goes into receive mode (RX). When the bus is released, the 5k pullup resistor

3、pulls the 1-Wire bus high.When the DS18B20 detects this rising edge, it waits 15us to 60us and then transmits a presence pulse by pulling the 1-Wire bus low for 60us to 240us.初始化时序中,控制器发送一个480us-960us的低电平的复位信号,然后释放总线,也就是总线为高电平,此时,控制器准备接收DS18B20的反应信号,当总线释放后,如果存在DS18B20,那么DS18B20将在15-60us内发送一个持续60-240

4、us的反应信号。2、写时序:(因为本设计总线上只挂了一个DS18B20,所以不用读取64位序列号,直接发送忽略rom命令skin rom)There are two types of write time slots: “Write 1” time slots and “Write 0” time slots. The bus master uses a Write 1 time slot to write a logic 1 to the DS18B20 and a Write 0 time slot to write a logic 0 to the DS18B20. All write

5、time slots must be a minimum of 60us in duration with a minimum of a 1us recovery time between individual write slots. Both types of write time slots are initiated by the master pulling the 1-Wire bus low写时序有写1和写2时序,首先将总线拉低电平,拉低后15us之内必须把所要向DS18B20写的数据传到总线上,DS18B20将在15us-60us内采样总线上的数据,如果为高则写1,为低则写0;

6、写完一次后释放总线。每两次写数据之间时隙要大于1us3、读时序:All read time slots must be a minimum of 60us in duration with a minimum of a 1us recovery time between slots. A read time slot is initiated by the master device pulling the 1-Wire bus low for a minimum of 1us and then releasing the bus (see Figure 14). After the mast

7、er initiates the read time slot, the DS18B20 will begin transmitting a 1 or 0 on bus. The DS18B20 transmits a 1 by leaving the bus high and transmits a 0 by pulling the bus low. Output data from the DS18B20 is valid for 15us after the falling edge that initiated the read time slot. Therefore, the ma

8、ster must release the bus and then sample the bus state within 15us from the start of the slot.读时序时,总线拉低电平大于1us后,然后释放总线准备接收DS18B20传来的数据,DS18B20将在总线拉低后15us之内将数据传到总线上,因此,控制器必须在拉低电平然后释放总线15us之内采样总线上的数据。每次读取一位数据不小于60us。4、程序流程图FPGA 控制DS18B20 实现温度转换的程序流程如下图所示。本实验采用状态机控制各时序。具体请看源码。5、电源连接DS18B20 可使用寄生电源,可以在

9、 I/ O 引脚处于高电平时 “偷” 些能量,储存在电容中供正常使用,但进行精确转换时需要 I/ O 引脚保持大电流供电,这样对 FPGA 芯片引脚造成很大压力,所以使用 VDD 引脚接外部电源:DS18B20 进行温度转换需要很大电流,工作最大电流可达 1 mA。使用 VDD 引脚接外部电源供电的优点在于I/ O 线上不需要在温度变换期间保持高电平。这样就可以有效的保护 FPGA 芯片,也可在单总线上放置多数目的DS18B20。使用外部电源,通过发出 Skip ROM 跳过命令,然后发出 Convert T变换命令,可以完成温度变换。6、显示:控制器从DS18B20接收的16位温度值为12位(大家懂的),精度为0.0625, DS18B20用 12 位存贮温值度 最高位为符号位8S=1 正温度 S=0 如 0550H为+85度, 0191H为 25.0625度 ,FC90H为-55 度。本次试验显示忽略了小数位,只取整数位,那么只取temperature11:4这8位,便是温度的整数值。 完 。

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号