DS18B20时序.docx


文档分类:通信/电子 | 页数:约11页 举报非法文档有奖
1/11
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/11
文档列表 文档介绍
DS18B2C时序
Author : exploer
CIEE ,CAU 2008-9-16
本文档参照 Maxim 公司DS18B20 的Datasheet 而完成。其中,加了 灰框的部分为原文档内容,其中英文部分为官方文档内容,中文部分为本人的翻 译。限于本人水平,本文档可能存在错误或者让人误解的内容, 对于因此引起的 一切问题作者(exploer , CIEE-CAU )概不负责。
INITIALIZATION PROCEDURE — RESET AND PRESENCE PULSES 初始化序列——复位和存在脉冲
All com muni cati on with the DS18B20 beg ins with an in itializati on sequenee that consists of a reset pulse from the master follo wed by a presenee pulse from the DS18B20. This is illustrated in Figure 13. When the DS18B20 sen ds the prese nee pulse in resp onse to the reset, it is indicating to the master that it is on the bus and ready to operate.
DS18B20的所有通信都由由复位脉冲组成的初始化序列开始。该初始化序 列由主机发出,后跟由DS18B20发出的存在脉冲(presenee pulse )。下图 (插图13,即如下截图)阐述了这一点。当发出应答复位脉冲的存在脉冲后, DS18B20通知主机它在总线上并且准备好操作了。
Duri ng
the initialization sequenee the
bus
master
tran smits
(T
X)
the reset pulse
by pulling the 1-Wire
bus
low
for
a minimum
of
480 卩 s.
The bus
master then releases
the
bus
and
goes into
re
ceive mode (RX).
在初始化步骤中,总线上的主机通过拉低单总线至少 480ys来产生复位脉
冲。然后总线主机释放总线并进入接收模式。
When the bus is released , the 5k Q pullup resistor pulls the 1 - Wire bus high. When the DS18B20 detects this rising edge, it wa its 15 卩 s to 60 卩 s and then transmits a presenee pulse by pulling t he 1-Wire bus low for 60 卩 s to 240 卩 s.
当总线释放后,5kQ的上拉电阻把单总线上的电平拉回高电平。当 DS18B 20检测到上升沿后等待15到60us,然后以拉低总线60-240us 的方式发出 存在脉冲。
F ig ure 13. Initia Liza cion Timing
LINETYPE LEGEND
Bus masler pulling law
piillng law
R ctiilOr pUiluF>
如文档所述,主机将总线拉低最短 480us,之后释放总线。由于5kQ上拉 电阻的作用,总线恢复到高电平。DS18B20检测到上升沿后等待15到60us, 发出存在脉冲:拉低总线60-240us。至此,初始化和存在时序完毕。
根据上述要求编写的复位函数为:
首先是延时函数:(由于DS18B20延时均以15us为单位,故编写了延时 单位为15us的延时函数,注意:以下延时函数晶振为 12MHz)
/*
************************************
函数:Delayxus_DS18B20
功能:DS18B20 延时函数
参数:t为定时时间长度
返回:无
说明: 延时公式:15n+15 (近似),晶振12Mhz
******************************************
*/
void Delayxus_DS18B20(unsigned int t)
{
for(t;t>0;t--)
{
_nop_();_nop_();_nop_();_nop_();
}
_nop_(); _n

DS18B20时序 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息