In this circuit, the Elektor ATM18  is in charge of communications and represents the master unit, while the DS18S20 sensors are the slave units. The DS18S20s respond to the orders from the master by sending back to it the temperature they are measuring.
Our circuit makes it possible to measure temperatures from −55 °C to +125 °C (–67 °F to 257 °F) with 9-bit resolution and an accuracy of ±0.5 °C from −10 °C to +85 °C (14 °F to 185 °F). However, the resolution can be improved by using a calculation discussed later, and which is implemented in the firmware written in BASCOM-AVR .
The sensors draw their power from the bus (‘parasite power’ mode, up to a few mA) by exploiting the numerous moments when the bus is at logic high. Given that most of them consume less than 100 µA, we just need to keep an eye on the total number of devices present on this bus. However, it’s still possible to power certain Dallas devices locally by feeding a constant voltage of 3–5.5 V.
Each 1-Wire component has a unique 64-bit key to identify it. The eight LSBs of this key contain the family identifier. The code 10h corresponds to the DS18S20 family of sensors, making it possible to distinguish between 1-wire sensor types from different families that may exist on the same bus. The DS18S20 has an internal memory (scratchpad) containing the data that are going to help you calculate the temperature measured.
Initially, the program calculates the number of sensors present on the bus and stores in a memory table the unique identifiers that are sent from MSB to LSB to the Hyperterminal.
The commands CCh + 44h are then executed, ordering all the sensors to perform the temperature conversion; in this way the scratchpads are automatically updated with the new values, a total of nine bytes per scratchpad.
You now call up each sensor individually by using its unique identifier followed by the command BEh. In this way, each time you can store in a table the contents of the nine scratchpad bytes of the sensor concerned. The temperature may be negative, and this is where two’s complement comes in, to express the result in the sensor memory. The ninth bit corresponds to the tenths. A temperature with higher than 9-bit resolution can be calculated by using the ‘countremain’ and ‘count per C’ data, bytes 6 and 7 of the scratchpad. The ‘count per C’ value is factory set to 16 (10h). The value ‘temp read’ is obtained by truncating the 0.5 °C bit (bit 0 of the LSB). The temperature in degrees Celsius can then be calculated accurately using the equation:
T = temp read − 0.25 + (‘count per C’ − ‘count remain’) / ‘count per C’
This is the value that is calculated and sent to the Hyperterminal for each of the three sensors.
Internet Links www.elektor.com/071035  www.elektor.com/110398