【正文】
n serve as generalpurpose memory. Byte 0 and byte 1 of the scratchpad contain the LSB and the MSB of the temperature register, respectively. These bytes are readonly. Bytes 2 and 3 provide access to TH and TL registers. Byte 4 contains the configuration register data. Bytes 5, 6, and 7 are reserved for internal use by the device and cannot be overwritten. Byte 8 of the scratchpad is readonly and contains the CRC code for bytes 0 through 7 of the scratchpad. The DS18B20 generates this CRC using the method described in the CRC Generation section. Data is written to bytes 2, 3, and 4 of the scratchpad using the Write Scratchpad [4Eh] mand。s (max) after this mand is issued the master must enable a strong pull up on the 1Wire bus. If the DS18B20 is powered by an external supply, the master can issue read time slots after the Convert T mand and the DS18B20 will respond by transmitting a 0 while the temperature conversion is in progress and a 1 when the conversion is done. In parasite power mode this notification technique cannot be used since the bus is pulled high by the strong pull up during the conversion. SCRATCHPAD [BEh] This mand allows the master to read the contents of the scratchpad. The data transfer starts with the least significant bit of byte 0 and continues through the scratchpad until the 9th byte (byte 8 – CRC) is read. The master may issue a reset to terminate reading at any time if only part of the scratchpad data is needed. SCRATCHPAD [4Eh] This mand allows the master to write 3 bytes of data to the DS18B20’s scratchpad. The first data byte is written into the TH register (byte 2 of the scratchpad), the second byte is written into the TL register (byte 3), and the third byte is written into the configuration register (byte 4). Data must be transmitted least significant bit first. All three bytes MUST be written before the master issues a reset, or the data may be corrupted. SCRATCHPAD [48h] This mand copies the contents of the scratchpad TH, TL and configuration registers (bytes 2, 3 and 4) to EEPROM. If the device is being used in parasite power mode, within 10181。s and then transmits a presence pulse by pulling the 1Wire bus low for 60181。 sD S 1 8 B 2 0 p r e s e n c e p u l s e 6 0 ~ 2 4 0 181。s recovery time between individual write slots. Both types of write time slots are initiated by the master pulling the 1Wire bus low (see Figure 7). To generate a Write 1 time slot, after pulling the 1Wire bus low, the bus master must release the 1Wirebus within 15181。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. M A S T E R W R IT E ― 0 ‖ S L O T 6 0 u s T x 1 2 0 u s 1 u s 1 u s1 5 u sD S 1 8 B 2 0 S a m p l e s1 5 u s 3 0 u sD S 1 8 B 2 0 S a m p l e s1 5 u s1 5 u s 3 0 u sD S 1 8 B 2 0 W r i t e T i m e S l o t S T A R T O F S L O T V c cG N D1 w i r e B u sM A S T E R W R IT E ― 1 ‖ S L O T M I N T Y P M A X M I N T Y P M A XB u s m a s t e r p u l l i n g l o w R e s i s t o r p u l l u p S T A R T O F S L O T Figure Write Time Slot 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] mand, 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] mands to find out the status of the operation. All read time slots must be a minimum of 60181。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 15181。C 到 +12176。另外, DS18B20 能夠從數(shù)據(jù)線中直接獲得能量(寄生電源),消除了對外部供電的需求。 ? 獨特的單線接口,只需要一個接口引腳即可通信 ? 每個設備均由一個存儲在板上 ROM 的獨一無二的 64 位序列碼 ? 多點能力使分布式溫度檢測應用得以簡化 ? 不需要外部器件 ? 可用數(shù)據(jù)線供電;電壓范圍是 ~ ? 溫度測量范圍是 55176。F) ? 10176。C ? 傳感器分辨率可從 9 位到 12 位由用戶選擇 ? 最大在 750ms 內(nèi)轉(zhuǎn)換 12 位數(shù)據(jù)的字節(jié) ? 用戶可定義的非易失性警報設置 ? 告警搜索命令和尋址超出設定的溫度界限的設備 ? 軟件與 DS1822 兼容 外文翻譯(譯文) 17 ? 應用范圍包括溫度調(diào)節(jié)控制器、工業(yè)系統(tǒng)、消費產(chǎn)品、溫度計,或者任何熱敏感系統(tǒng) 圖 1 給出了 DS18B20 的方框圖,并且在引腳說明表格中給出了引腳介紹。配置寄存器允許用戶設定 9 位、 10 位、 11 位和 12 位的溫度分辨率。在這個總線系統(tǒng)中,微處理器(控制設備)利用每一個設備的唯一 64 位碼識別和尋址總線上的設備。當總線高電平時能量由單線上拉電阻經(jīng)過 DQ 引腳獲得。 6 4 位 R O M 和1 W i r e總 線 接 口存 儲 器 和 控 制 器高 速 緩 存 存 儲 器溫 度 靈 敏 元 件溫 度 上 限 觸 發(fā) 器 T H溫 度 下 限 觸 發(fā) 器 T L配 置 寄 存 器8 位 C R C 生 成 器電 源 檢 測內(nèi) 部 電 源 V d d寄 生 電 源 電 路C p pV p u4 . 7 KD QG N DV d d 圖 方框圖 外文翻譯(譯文) 18 測量溫度 DS18B20 的核心功能是它的數(shù)字式溫度器。C, 和176。為了初始化溫度測量和進行 AD 轉(zhuǎn)換,控制器必須發(fā)出一個轉(zhuǎn)換溫度命令。 DS18B20 輸出溫度數(shù)據(jù)是攝氏度標準,若要轉(zhuǎn)為華氏溫度,必須使用查表或轉(zhuǎn)換子程序。對 10 位分辨率,位 1 和位 0 無定義;對 9 位分辨率,位 位 1和位 0 無定義。接著 48 位包含一個唯一的序列號。存儲器由一個高速暫存 RAM 和一個非易失性電可擦除 EEPROM 組成,后者存儲高溫和低溫觸發(fā)器( TH 和 TL)和配置寄存器。字節(jié) 2 和字節(jié) 3 提供提供 TH 和 TL寄存器的接口。 數(shù)據(jù)被寫暫存器命令寫在暫存器的字節(jié) 3 和 4 中,數(shù)據(jù)從字節(jié) 2 的最低有效位開始寫入 DS18B20。 Byte0 溫度測量值低 8 位 LSB Byte1 溫度測量值高 8 位 MSB Byte2 TH 高溫寄存器 外文翻譯(譯文) 20 Byte3 TL 低溫寄存器 Byte4 配置寄存器 Byte5 預留( FFH) Byte6 預留( OCH) Byte7 預留( IOH) Byte8 循環(huán)冗余碼校驗( CRC) 圖 存儲器映射 高速暫存存儲器的字節(jié) 4 包含配置寄存器,正如 圖 5 中 那樣定義。配置寄存器中位 7 和位 0 至位 4 為設備內(nèi)部使用作預留,而且不能被重寫。所有數(shù)據(jù)和命令通過單總線首先傳輸最低有效位。在發(fā)出兩者之一的 ROM 命令后,主機必須返回到處理順序的第一步,也就是初始化。 ( 2) ROM 命令 在總線主機檢測到一 個應答脈沖后,就可以發(fā)出一個 ROM 命令。主機設備必須在發(fā) DS18B20 功能命令之前發(fā)出合適的ROM 命令。如果總線上只有一個從機,那么更為簡單的讀 ROM 命令可以代替搜索命令來處理。 ROM 命令 55H 匹配 ROM 命令跟隨 64 位 ROM 碼,從而使主機在多站或單站總線上指定某一特定的 DS18B20,只有匹配 64 位 ROM 碼的 DS18B20 才會響應主機發(fā)出的功能命令,其他設備則處于等待復位脈沖狀態(tài)。 如此看來,允許主機讀取從機而不需要發(fā)送設備的64 位 ROM 碼,這樣可以節(jié)省操作時間。在每一個報警搜索循環(huán)后(也就是報警搜索命令后跟隨數(shù)據(jù)交換),總線主機必須返回至命令序列的第一步(初始化)。如果設備采用寄生電源,此命令發(fā)出之后最多在 10181。 BEH 這個命令使主機讀暫存器的內(nèi)容。開始字節(jié)的數(shù)據(jù)被寫入 TH 寄存器(暫存器的字節(jié) 2),第二