|Online Development Notebook > Index > U4x1 Application Notes > App9: 1-Wire (MicroLAN) > DS18S20 Sensor|
DS18S20 Temperature Sensor
App note #9 interfaces a DS18S20 Dallas⁄Maxim temperature sensor to a USBmicro U4x1 device. The U4x1 provides the interfacing signal, ground, and power for the 1-wire temperature sensor.
DS18S20 Pin Assignment
The DS18S20 comes in a small package with three electrical leads. From the graphic below you can see that these leads⁄pins are labled "GND", "DQ", and "VDD".
The GND connection (DS18S20 pin 1) is ground, and provides an electrical reference for the other two signals. Ground on the U401 is pin 9, and ground on the U421 is also pin 9.
"DQ" (DS18S20 pin 2) is the 1-wire data line. Any U4x1 I⁄O line can be configured as a 1-wire bus to communicate with 1-wire devices. Therefore connection from the DQ line should go to the selected U4x1 I⁄O line.
The general configuration for 1-wire devices is to use a bus that has ground and data⁄power lines. The DS18S20, however, draws current during temperature conversion that is higher than can normally be provided on the data⁄power line. Therefore the VDD (DS18S20 pin 3) connection provides power for the DS18S20. This line should be connected to U401 pin 7 or U421 pin 14.
Using Several DS18S20 Temperature Sensors
The U4x1 devices support 1-wire communication with any 1-wire device. When you select an I⁄O port line of the U4x1 to use as the connection to a 1-wire device, you have changed that line from just being a digital I⁄O line to a 1-wire bus. The Reset1Wire command configures the line with a 14 kohm pull up resistor, and issues a reset pulse on that line. The Reset1Wire command returns (via a pointer - see the command description) an indication of the reception of the device presence pulse.
If you select a particular line to use as the 1-wire bus, you do so with the Reset1Wire command. A Read1Wire command or a Write1Wire command will operate on the line that was last referenced by the Reset1Wire command.
What this means is that you can use all 16 lines on the U4x1 as 16 separate 1-wire busses. Issuing the Reset1Wire command is the way to get attention of the 1-wire devices on that bus, prior to using the Read1Wire and Write1Wire commands to communicate with the 1-wire device. You can use Reset1Wire to select and communicate with one line of the U4x1, then use it again to communicate with a different line on the U4x1.
You can use all 16 lines on the U4x1 to communicate with 16 1-wire devices, one per line. But you can also have multiple 1-wire devices on each line, and address them individually by using their ROM serial numbers. The 1-wire device documentation contains the details that you need to communicate with 1-wire devices.
The internal 14 kohm pull up resistor will suffice for a short bus distance, but you should consider supplementing with a 10 kohm resistor external to the U4x1 device. The 10 kohm resistor would be connected between the 1-wire data line and Vcc (+5V).
|Hardware: U401 USB Interface U421 USB Interface U451 USB Interface|
Programming: USBm DLL Programming Download Files
Application Notes: U4x1 Application Notes Misc Applications and Information FAQ
While every effort has been made to make sure that the information posted on this site is correct, the author can not be held liable for any damages whatsoever for losses as a result of the application of this information. Use this information at your own risk.
USBmicro can design your custom and semi-custom USB product. Email about USB design can be directed to " Robert " at usbmicro.com.
Copyright © USBmicro, L.L.C., 2002-2010