Datasheet

© 2009 Microchip Technology Inc. DS22153C-page 23
MCP9843/98243
FIGURE 5-4: Timing Diagram for Reading from the Configuration Register (See Section 4.0
“Serial Communication”).
SDA
A
C
K
0011
A
Configuration Pointer
0000
A
C
K
S
2
A
1
A
0
12345678 12345678
SCL
0
Address Byte
A
C
K
0011
A
MSB Data
A
C
K
N
A
K
S P
2
A
1
A
0
12345678 12345678 12345678
Address Byte
LSB Data
R
MCP9843/98243
MCP9843/98243
MCP9843/98243
Master
Master
W
SDA
SCL
001
00000
000 00001
000
Reading the CONFIG Register.
Note: It is not necessary to
select the register
pointer if it was set from
the previous read/write.
Note: this is an example routine:
i2c_start(); // send START command
i2c_write(AddressByte & 0xFE); //WRITE Command
//also, make sure bit 0 is cleared ‘0’
i2c_write(0x01); // Write CONFIG Register
i2c_start(); // send Repeat START command
i2c_write(AddressByte | 0x01); //READ Command
//also, make sure bit 0 is set ‘1’
UpperByte = i2c_read(ACK); // READ 8 bits
//and Send ACK bit
LowerByte = i2c_read(NAK); // READ 8 bits
//and Send NAK bit
i2c_stop(); // send STOP command