文档介绍:Application Note 162
INTERFACING THE DS18X20/DS1822
1-WIRE TEMPERATURE SENSOR IN A
MICRO-CONTROLLER ENVIRONMENT
INTRODUCTION
There are several methods available for interfacing 1- Detailed timing and operational information for the
WireTM devices such as the DS18B20, DS18S20 or DS18B20, DS18S20 and DS1822 is available in their
DS1822 to a microcontroller. These methods range respective datasheets, which can be obtained from
from simple software solutions, to using a Serial the Maxim website.
Interface chip such as the DS2480, to incorporating
TM
Dallas Semiconductor’s VHDL 1-Wire Master HARDWARE CONFIGURATION
Controller in a custom ASIC. This article introduces The block diagram in Figure 1 illustrates the simplicity
the user to the simplest possible software solution for of the hardware configuration when using multiple 1-
TM
basic 1-munication between a WireTM temperature sensors. A single-wire bus
microcontroller and any number of DS18x20 or provides munication access and power to all
DS1822 temperature sensors. devices. Power to the bus is provided through the
pullup resistor from a 3V to supply rail.
An almost unlimited number of 1-WireTM devices can
be connected to the bus because each device has a
unique 64-bit ROM code identifier.
Figure 1. Host Micro-Controller Interface
3V to
Host
Micro-Controller
1-WireTM 1-WireTM 1-WireTM
Temp Temp Temp
Sensor Sensor Sensor
1 2 N
INTERFACE TIMING illustrated in Figure 3. During the write “0” time slot,
Communication with the DS18x20/DS1822 is the host micro-controller pulls the line low for the
achieved through the use of “time slots”, which allow duration of the time slot. However, during the write
data to be transmitted over the 1-Wire TM bus. Every “1” time slot, the micro-controller pulls the line low
communication cycle begins with a reset pulse from and then releases the line within 15µs after the start
the micro-controller fol