Datasheet
34
MSL2021 [DATASHEET]
42062A–LED–02/2013
Figure 14-6. I
2
C Slave Address
14.6 I
2
C Message Format for Writing to the MSL2021
A write to the MSL2021 contains the MSL2021’s slave address, the R/W bit cleared to 0, and at least 1 byte of
information (Figure 14-7 on page 34). The first byte of information is the register address byte. The register address byte
is stored as a register pointer, and determines which register the following byte is written into. If a STOP condition is
detected after the register address byte is received, then the MSL2021 takes no further action beyond setting the register
pointer.
Figure 14-7. I
2
C Writing a Register Pointer
When no STOP condition is detected, the byte transmitted after the register address byte is a data byte, and is placed
into the register pointed to by the register address byte (Figure 14-8). To simplify writing to multiple consecutive registers,
the register pointer auto-increments during each following acknowledge period. Further data bytes transmitted before a
STOP condition fill subsequent registers.
Figure 14-8. I
2
C Writing Two Data Bytes
14.7 I
2
C Message Format for Reading from the MSL2021
Read the MSL2021 registers using one of two techniques.
The first technique begins the same way as a write, by setting the register address pointer as shown in Figure 14-7,
including the STOP condition (note that even though the final objective is to read data, the R/W bit is first sent as a write
because the address pointer byte is being written into the device). Follow the Figure 14-7 transaction by what shown in
Figure 14-9, with a new START condition and the slave address, this time with the R/W bit set to 1 to indicate a read.
Then, after the slave initiated acknowledge bit, clock out as many bytes as desired, separated by master initiated
SDA
SCL
1 2 3 4 5 6 7 8 9
A7 = 0 AA6 = 1 A5 = 0
A4 = 0 A3 =0 A2 = 0 A1 = 0 R / W
MSB
SDA
0 1 0 00000 A D7 D0 A
ACKNOWLEDGE
FROM MSL202x
START STOP
SLAVE ADDRESS,
WRITE ACCESS
SET REGISTER
POINTER TO X
......
THE REGISTER POINTER NOW POINTS TO X; A SUBSEQUENT READ
ACCESS READS FROM REGISTER ADDRESS X
ACKNOWLEDGE
FROM MSL202x
SDA
0 1 0 00000 A D7 D0 AAD0 A
ACKNOWLEDGE
FROM MSL202x
START STOP
SLAVE ADDRESS,
WRITE ACCESS
SET REGISTER
POINTER TO X
DATA WRITES TO
REGISTER X
D7
......
THE REGISTER POINTER NOW POINTS TO X + 2; A SUBSEQUENT READ
ACCESS BEGINS READING FROM REGISTER ADDRESS X + 2
ACKNOWLEDGE
FROM MSL202x
ACKNOWLEDGE
FROM MSL202x
......
D7 D0
......
DATA WRITES TO
REGISTER X + 1
ACKNOWLEDGE
FROM MSL202x