Datasheet

© 2011 Microchip Technology Inc. DS25095A-page 21
MCP9808
FIGURE 5-3: 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
MCP9808 MCP9808
MCP9808
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 (see Appendix A: “Source Code”).
i2c_start(); // send START command
i2c_write(AddressByte & 0xFE); //WRITE Command (see Section 4.1.4 “Address Byte”)
//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