General 2-wire information, Initiating communication with the ds1631, Wire writes – Rainbow Electronics DS1631 User Manual

Page 8: Wire reads

Advertising
background image

DS1631

8 of 14

GENERAL 2-WIRE INFORMATION

§ All data is transmitted MSb first over the 2-wire bus.
§ A pullup resistor is required on the SDA line and, when the bus is idle, both SDA and SCL must remain

in a logic-high state.

§ All bus communication must be initiated with a START condition and terminated with a STOP

condition. During a START or STOP is the only time SDA is allowed to change states while SCL is
high. At all other times, changes on the SDA line can only occur when SCL is low: SDA must remain
stable when SCL is high.

§ One bit of data is transmitted on the 2-wire bus each SCL period.
§ After every 8-bit (1-byte) transfer, the receiving device must answer with an ACK (or NACK), which

takes one SCL period. Therefore, nine clocks are required for every one byte data transfer.

INITIATING COMMUNICATION WITH THE DS1631

To initiate communication with the DS1631, the master must generate a START followed by a control
byte containing the DS1631 bus address. The R/

W

¯¯

bit of the control byte must be a 0 (“write”) since the

master must next write a command byte to the DS1631. The DS1631 will respond with an ACK after
receiving the control byte. This must be followed by a command byte from the master, which tells the
DS1631 what type of operation is to be performed. The DS1631 will again respond with an ACK after
receiving the command byte.
If the command byte is a Start Convert T or Stop Convert T command (see Figure 6a), the transaction is
finished, and the master must issue a STOP to signal the end of the communication sequence. If the
command byte indicates a write or read operation, additional actions must occur as explained in the
following sections.

2-WIRE WRITES

The master can write data to the DS1631 by issuing an Access Config, Access TH, or Access TL
command following the control byte (see Figures 6b and 6d). Since the R/

W

¯¯

bit in the control byte was a

0 (“write”), the DS1631 is already prepared to receive data. Therefore, after the DS1631 sends an ACK in
response to the command byte, the master device can immediately begin transmitting data to the DS1631.
When writing to the configuration register, the master must send one byte of data, and when writing to the
T

H

or T

L

registers the master must send two bytes of data. After receiving each data byte, the DS1631 will

respond with an ACK, and the transaction is finished with a STOP from the master.

2-WIRE READS

The master can read data from the DS1631 by issuing an Access Config, Access TH, Access TL, or Read
Temperature command following the control byte (see Figures 6c and 6e). After the DS1631 sends an
ACK in response to the command, the master must generate a repeated START followed by a control
byte with the same DS1631 address as the first control byte. However, this time the R/

W

¯¯

bit must be a 1,

which tells the DS1631 that a “read” is being performed. After the DS1631 sends an ACK in response to
the control byte, it will begin transmitting the requested data on the next clock cycle, provided the master
continues to generate the clock signal on SCL. When reading from the configuration register, the DS1631
will transmit one byte of data, after which the master must respond with a NACK followed by a STOP.
For two-byte reads (i.e., from the temperature, T

H

or T

L

, register), the master must respond to the first

data byte with an ACK and to the second byte with a NACK, followed by a STOP. If only one byte of
temperature data is needed, the master can issue a NACK followed by a STOP after reading the first data
byte, and the DS1631 will quit transmitting data.

Advertising