|Online Development Notebook > Index > U4x1 Application Notes > App9: 1-Wire (MicroLAN)|
App9: 1-Wire (MicroLAN)
VERSION 1.30+ of the firmware, VERSION 36+ of the DLL
Provide a program that interfaces to a DS18S20 Dallas⁄Maxim temperature sensor. The program can also be used to discover the serial number ID of any 1-wire device connected to the U4x1. For the sake of simplicity, this app assumes that a single device is connected to the U4x1 pin, since it does not distinguish devices based on their serial number.
The application code can be modified to work with other 1-wire devices. If the 1-wire device serial number is used to address the device (rather than using the "skip ROM" 1-wire function) then multiple devices can be used on a single U4x1 line⁄pin.
This program initializes the selected port line⁄pin (selected by the pin number drop-down in the example) as a 1-wire bus. It is assumed that for this application there will be only a single 1-wire device located on the bus. The "Read Serial Number" button will read the single 1-wire device on the selected U4x1 pin and retrieve the device serial number for display.
The serial number for any 1-wire device can be retrieved with this application, not just the DS18S20.
Pressing "Read Temp" will read the temperature from a connected DS18S20 device. When the temperature is read, 85 degrees C is returned. This is the default temp that is in the device, if the conversion action has not been performed. By pressing "Start Temp Conversion" then " Read Temp" the measured temperature will be returned. Please see the data sheets for details.
The first box contains the temperature in degrees Celsius, the second in Fahrenheit (calculated from Celsius).
Below is the application screen reading the DS18S20 temperature value.
The data line (DQ) of the DS18S20 was connected to a pin of the U4x1, the grounds were common, and the VDD pin of the DS18S20 was connected to +5VDC. A 10k ohm pull-up resistor was used on the data line.
Download all application files: (all application files)
|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