传感器系列2--温度传感器之DS18B20(2)

来源:互联网 发布:剑灵ol mac 编辑:程序博客网 时间:2024/05/23 11:47
READ/WRITE TIME SLOTS

The bus master writes data to the DS18B20 during write time slots and reads data from the DS18B20 during read time slots. One bit of data is transmitted over the 1-Wire bus per time slot.

1个总线时隙传送一位数据。


1)写时序WRITE TIME SLOTS

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 time slots must be a minimum of 60μs in duration with a minimum of a 1μs recovery time between individual write slots. Both types of write time slots are initiated by the master pulling the 1-Wire bus low (see Figure 14).

写时序有两种类型:写1时序和写0时序。总线控制器使用写1时序写一个逻辑1到DS18B20,使用写0时序写一个逻辑0到DS18B20。写时序都必须至少持续60us,且在各个单独的写时隙间要有1us的恢复时间。写时序都要以拉低总线电平作为开始。

To generate a Write 1 time slot, after pulling the 1-Wire bus low, the bus master must release the 1-Wire bus within 15μs. When the bus is released, the 5kΩ pullup resistor will pull the bus high. To generate a Write 0 time slot, after pulling the 1-Wire bus low, the bus master must continue to hold the bus low for the duration of the time slot (at least 60μs).

为产生一个写1时序,在拉低总线后,总线控制器必须在15us内释放总线。之后5kΩ的上拉电阻将拉高总线电平。为产生一个写0时序,在拉低总线后,总线控制器必须继续维持总线电平为低最少60us。

The DS18B20 samples the 1-Wire bus during a window that lasts from 15μs to 60μs after the master initiates the write time slot. If the bus is high during the sampling window, a 1 is written to the DS18B20. If the line is low, a 0 is written to the DS18B20.

DS18B20采样总线电平的时机为总线主控制器发出一个写时序后15us-60us。在采用期间,总线电平为高则DS18B20将读取数据1,总线电平为低则DS18B20将读取数据0。


2)读时序READ TIME SLOTS

The DS18B20 can only transmit data to the master when the master issues read time slots. Therefore, the master must generate read time slots immediately after issuing a Read Scratchpad [BEh] or Read Power Supply [B4h] command, so that the DS18B20 can provide the requested data. In addition, the master can generate read time slots after issuing Convert T [44h] or Recall E2 [B8h] commands to find out the status of the operation as explained in the DS18B20 Function Commands section.

DS18B20作为从机给主控制器发送数据的几种情况。
All read time slots must be a minimum of 60μs in duration with a minimum of a 1μs recovery time between slots. A read time slot is initiated by the master device pulling the 1-Wire bus low for a minimum of 1μs and then releasing the bus (see Figure 14). After the master 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. When transmitting a 0, the DS18B20 will release the bus by the end of the time slot, and the bus will be pulled back to its high idle state by the pullup resister. Outputdata from the DS18B20 is valid for 15μs after the falling edge that initiated the read time slot. Therefore, the master must release the bus and then sample the bus state within 15μs from the start of the slot.

读时序都必须至少持续60us,且在各个单独的写时隙间要有1us的恢复时间。读时序都要以拉低总线电平作为开始,拉低持续时间最少1us,之后释放总线。主控制器初始化读总线时隙后,DS18B20将发出1或者0。DS18B20通过保持总线为高电平作为发送1,通过拉低总线为发送0。当发送值为0时,在时序的最后DS18B20将释放总线,上拉电阻将总线拉高为空闲状态时的高电平。DS18B20输出数据在初始化读时隙下降沿的15us后有效。主控制器应该在这个时候对总线进行采样。因此,总线主控制器必须释放总线并在15us内采样总线。


By:霜月孤鸟

2016.2.19

0 0