AN165| Application Note

AN165 PDF

AN165| Application Note


Maxim > App Notes > MICROCONTROLLERS Keywords: 1wire, 1-Wire communication, microcontrollers, battery monitor, battery protector, DS2761, DS2760, DS2770, DS5000, DS5000T, DS5000FP, DS5001FP, DS5002FP, DS2250, DS2250T, DS2251T, DS2252T, DS5240, DS5250, DS80C310, DS80C320, DS80C323, DS87C520, DS87C

Jan 16, 2002

APPLICATION NOTE 165

Interfacing the DS2760 1-Wire High-Precision Li-Ion Battery Monitor and Protection IC in a Microcontroller Environment
Abstract: This application note provides the reader with information concerning how to interface the Dallas Semiconductor DS2760 Battery Monitor and Protector IC to a microcontroller. The DS5000 microcontroller module is used for example purposes. Both hardware and software concerns are addressed, including block diagrams and sample C code to enable communication between the DS2760 and the microcontroller over the Dallas Semiconductor 1-Wire communication protocol. Software routines for all common 1-Wire commands are provided and therefore can be used on any Dallas Semiconductor device that communicates using the 1-Wire protocol. Also, routines for common battery monitor functions are also provided which can be used with any of the other Dallas Semiconductor battery monitors such as the DS2761 and DS2770.

Introduction
Interfacing a 1-Wire device to a microcontroller can be a very simple procedure. This application note will introduce source code in C to provide the user with a simple 1-Wire solution for embedded controller applications. In the following example, we will demonstrate a method for connecting a 1-Wire interface from a microcontroller to the DS2760K evaluation board to read the voltage, current, accumulated current and temperature registers. The DS2760K hardware is used to simplify the communication because it is a complete circuit to easily verify the source code.

Hardware configuration
A DS5000 (8051-compatible) microcontroller running at 11.059MHz was used in this example. The host microcontroller uses a single wire, which is pulled up to VCC through a 4.7k resistor to connect to the DQ input/output pin of the DS2760. Other microcontrollers could very easily be substituted, once timing considerations have been taken into consideration. A delay line might be needed for some of the faster microprocessors.

Interface timing
Each communication sequence with the DS2760 must begin with a 1-Wire Reset. A reset pulse is defined as the bus master pulling the 1Wire bus (or DQ line) low from the inactive high state for between 480us to 960us and then releasing it. If a 1-Wire device is on the bus, it will respond by pulling the DQ line low to indicate its presence on the 1-Wire bus. The 1-Wire Reset Timing is shown in Figure 1. A write time slot is initiated when the bus master pulls DQ low. All write and read time slots must be 60us to 120us in duration with a 1us minimum recovery time between cycles. During the write "0" time slot, the bus master will pull the line low for the duration of the time slot. However, during the write "1" time slot, the bus master will pull the line low for a maximum of 15us and then release if for the duration of the time slot. A read time slot is initiated when the bus master pulls the 1-Wire bus line low. The line must be kept low for 1us and then released so that the DS2760 can take control of the line
and present valid data. If a '0' is to be placed on the bus, the DS2760 will hold the DQ line low when the master releases the line. If the DS2760 is to place a "1", the DQ will be allowed to go high when the bus master releases the bus. The master will then sample the DQ line to determine if a "0" or a "1" is read from the device. The 1-Wire write and read time slots are shown in Figure 2.


AN165 Application Note maxim Download PDF

Add this permalink to your bookmarks for future download of AN165 ApplicationNote

Permalink: http://application.emcelettronica.com/maxim/AN165

PDF AN165 APPLICATION NOTE