Datasheet
MCP9808
DS25095A-page 20 © 2011 Microchip Technology Inc.
FIGURE 5-2: Timing Diagram for Writing to the Configuration Register (see Section 4.0 “Serial
Communication”).
Writing to the CONFIG Register to Enable the Event Output Pin <0000 0000 0000 1000>b:
SDA
A
C
K
0011
A
0000
A
C
K
S
2
A
1
A
0
12345678 12345678
SCL
0
Address Byte
W
MCP9808 MCP9808
MSB Data
A
C
K
A
C
K
P
12345678 12345678
LSB Data
Configuration Pointer
MCP9808
MCP9808
001
00000
000 00001
000
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_write(0x00); // Write data
i2c_write(0x08); // Write data
i2c_stop(); // send STOP command