beautypg.com

Rainbow Electronics DS2745 User Manual

Page 13

background image

DS2745 Low-Cost I

2

C Battery Monitor

13 of 14

Read/Write Bit

The R/W bit following the slave address determines the data direction of subsequent bytes in the transfer. R/W = 0
selects a write transaction, with the following bytes being written by the master to the slave. R/W = 1 selects a read
transaction, with the following bytes being read from the stave by the master.

Bus Timing

The DS2745 is compatible with any bus timing up to 400kHz. No special configuration is required to operate at any
speed.

2-Wire Command Protocols

The command protocols involve several transaction formats. The simplest format consists of the master writing the
START bit, slave address, R/W bit, and then monitoring the acknowledge bit for presence of the DS2745. More
complex formats such as the Write Data, Read Data and Function command protocols write data, read data and
execute device specific operations. All bytes in each command format require the slave or host to return an
Acknowledge bit before continuing with the next byte. Each function command definition outlines the required
transaction format. The following key applies to the transaction formats.

Table 3. 2-Wire Protocol Key

KEY

DESCRIPTION

KEY

DESCRIPTION

S

START bit

Sr

Repeated START

SAddr

Slave Address (7-bit)

W

R/W bit = 0

FCmd

Function Command byte

R

R/W bit = 1

MAddr

Memory Address byte

P

STOP bit

Data

Data byte written by master

Data

Data byte returned by slave

A

Acknowledge bit - Master

A

Acknowledge bit

¾Slave

N

No Acknowledge - Master

N

No Acknowledge

¾Slave

Basic Transaction Formats

Write:

S SAddr W A MAddr A Data0 A P


A write transaction transfers one or more data bytes to the DS2745. The data transfer begins at the memory
address supplied in the MAddr byte. Control of the SDA signal is retained by the master throughout the transaction,
except for the Acknowledge cycles.

Read:

S SAddr W A MAddr A Sr SAddr R A Data0 N P



Write

Portion Read

Portion

A read transaction transfers one or more bytes from the DS2745. Read transactions are composed of two parts, a
write portion followed by a read portion, and is therefore inherently longer than a write transaction. The write portion
communicates the starting point for the read operation. The read portion follows immediately, beginning with a
Repeated START, Slave Address with R/W set to a 1. Control of SDA is assumed by the DS2745 beginning with
the Slave Address Acknowledge cycle. Control of the SDA signal is retained by the DS2745 throughout the
transaction, except for the Acknowledge cycles. The master indicates the end of a read transaction by responding
to the last byte it requires with a No Acknowledge. This signals the DS2745 that control of SDA is to remain with
the master following the Acknowledge clock.