±0.5°C Maximum Accuracy Digital Temperature Sensor
Features
•Accuracy:
- ±0.25 (typical) from -40°C to +125°C
- ±0.5°C (maximum) from -20°C to 100°C
- ±1°C (maximum) from -40°C to +125°C
• User-Selectable Measurement Resolution:
- +0.5°C, +0.25°C, +0.125°C, +0.0625°C
• User-Programmable Temperature Limits:
- Temperature Window Limit
- Critical Temperature Limit
• User-Programmable Temperature Alert Output
• Operating Voltage Range: 2.7V to 5.5V
• Operating Current: 200 µA (typical)
• Shutdown Current: 0.1 µA (typical)
• 2-wire Interface: I
2
C™/SMBus Compatible
• Available Packages: 2x3 DFN-8, MSOP-8
Typical Applications
• General Purpose
• Industrial Applic atio ns
• Industrial Freezers and Refrigerators
• Food Processing
• Personal Computers and Servers
• PC Peripherals
• Consumer Electronics
• Handheld/Portable Devices
Temperature Accuracy
40%
TA= -20°C, 25°C, 85°C, 100°C
= 3.3V
V
DD
854 units
30%
Description
Microchip Technology Inc.’s MCP9808 digital
temperature sensor converts temperatures between
-20°C and +100°C to a digital word with
±0.25°C/±0.5°C (typical/maximum) accuracy.
The MCP9808 comes with user-programmable registers
that provide flexibility for temperature sensing
applications. The registers allow user-selectable
settings such as Shutdown or Low-Power modes and
the specification of temperature Alert window limits and
critical output limits. When the temperature changes
beyond the specified boundary limits, the MCP9808
outputs an Alert signal. The user has the option of setting
the Alert output signal polarity as an active-low or activehigh comparator output for thermostat operation, or as a
temperature Alert interrupt output for microprocessorbased systems. The Alert output can also be configured
as a critical temperature output only.
This sensor has an industry standard 400 kHz, 2-wire,
SMBus/I
2
C compatible se rial interfa ce, allowing up to
eight or sixteen sensors to be controlled with a single
serial bus (see Table 3-2 for available Address codes).
These features make the MCP9808 ideal for
sophisticated, multi-zone, temperature-monitoring
applications.
Package Types
8-Pin 2x3 DFN*
SDAV
1
SCL
2
Alert
3
GND
4
* Includes Exposed Thermal Pad (EP); see Table 3-1 .
†Notice: S tress es ab ove th ose li ste d under “Maxim um
ratings” may ca use permanen t damage to the de vice.
This is a stress rating only and functional operation of
the device at tho se or any oth er conditions ab ove those
indicated in the operational listings of this specification
is not implied. Exposure to maximum rating conditions
for extended periods may affect device reliability.
TEMPERATURE SENSOR DC CHARACTERISTICS
Electrical Specifications: Unless otherwise indicated, VDD = 2.7V to 5.5V, GND = Ground and
= -40°C to +125°C.
T
A
ParametersSymMinTypMaxUnitConditions
Temperature Sensor Accuracy
-20°C < T
-40°C < TA ≤ +125°C -1.0±0.25+1.0°CVDD = 3.3V
Temperature Conversion Time
0.5°C/bitt
0.25°C/bit—65—ms15s/sec (typical)
0.125°C/bit—130—ms7s/sec (typical)
0.0625°C/bit—250—ms4s/sec (typical)
Power Supply
Operating Voltage RangeV
Operating CurrentI
Shutdown CurrentI
Power-on Reset (POR)V
Power Supply RejectionΔ°C/ΔV
Electrical Specifications: Unless otherwise indicated, VDD = 2.7V to 5.5V, TA = -40°C to +125°C, GND = Ground
= 80 pF. (Note 1)
and C
L
ParametersSymMinMaxUnitsConditions
2-Wire SMBus/Standard Mode I
Serial Port Clock Frequencyf
Low Clockt
High Clockt
Rise Timet
Fall Timet
Data in Setup Timet
Data In Hold Timet
Data Out Hol d Timet
Start Condition Setup Timet
Start Condition Hold Timet
Stop Condition Setup Timet
Bus Freet
Time-out t
Bus Capacitive LoadC
Note 1: All values referred to V
2: If t
LOW
> t
OUT
or t
is required for communication.
3: This device can be used in a Standard mode I
be met. This device does not stretch the SCL Low time.
4: As a transmitter, the device provides internal minimum delay time, t
region (min. 200 ns) of the falling edge of SCL, t
conditions.
5: As a receiver, SDA should not be sampled at the falling edge of SCL. SDA can transition t
SCL toggles Low.
2
C™ Compatible Interface (Note 1)
SC
LOW
HIGH
R
F
SU-DI
HD-DI
HD-DO
SU-START
HD-START
SU-STOP
B-FREE
OUT
b
HIGH
and V
IL MAX
> t
, the temperature senso r I2C interface will time-out. A Repeat Start comm and
Note:The graphs and t ables provid ed follo wing this no te are a st atis tical summa ry bas ed on a lim ited nu mber of
samples and are provided for informational purposes only. The performance characteristics listed herein
are not tested or guaranteed. In some graphs or tables, the data presented may be outside the specified
operating range (e.g., outside specified power supply range) and therefore outside the warranted range.
Note: Unless otherwise indicated, VDD = 2.7V to 5.5V, GND = Ground, SDA/SCL pulled-up to VDD and
T
= -40°C to +125°C.
A
1.0
0.5
V
= 3.3V
DD
854 units at -20°C, 25°C, 85°C, 100°C
240 units at -40°C, 125°C
The descriptions of the pins are listed in Table 3-1.
TABLE 3-1:PIN FUNCTION TABLE
DFNMSOPSymbolPin Function
11SDASerial Data Line
22SCLSerial Clock Line
33AlertTemperature Alert Output
44 GNDGround
55A2Slave Address
66A1Slave Address
77A0Slave Address
88 V
9—EPExposed Thermal Pad (EP); must be connected to GND
DD
Power Pin
MCP9808
3.1Serial Data Line (SDA)
SDA is a bidirectional input/output pin, used to serially
transmit data to/from the host controller. This pin
requires a pull-up resistor. (See Section 4.0 “Serial
Communication”.)
3.2Serial Clock Line (SCL)
The SCL is a clock input pin. All communication and
timing is relative to the signal on this pin. The clock is
generated by the host or master controller on the bus.
(See Section 4.0 “Serial Communication”.)
3.3Temperature Alert, Open-Drain
Output (Alert)
The MCP9808 temperature Alert output pin is an
open-drain output. The device outputs a signal when the
ambient temperature goes beyond the user-programmed
temperature limit. (See Section 5.2.3 “Alert Output
Configuration”).
3.4Ground Pin (GND)
The GND pin is the system ground pin.
3.5Address Pins (A0, A1, A2)
These pins are device address input pins.
The address pins correspond to the Least Significant
bits (LSbs) of th e ad dre ss bi t s a nd the Mo st Significant
bits (MSbs): A6, A5, A4, A3. This is illustrated in
Table 3-2.
TABLE 3-2:MCP9808 ADDRESS BYTE
DeviceAddress CodeSlave
Address
A6 A5 A4 A3A2A1 A0
(1)
MCP98080011x
MCP9808
Note 1: User-selectable address is shown by ‘x’.
(2)
1001xxx
A2, A1 and A0 must match the
corresponding device pin configuration.
2: Contact factory for this address code.
xx
3.6Power Pin (VDD)
VDD is the power pin. The operating voltage range, as
specified in the DC electrical specification table, is
applied on this pin.
3.7Exposed Thermal Pad (EP)
There is an internal electrical connection between the
Exposed Thermal Pad (EP) and the GND pin. The EP
may be connected to the syst em gro und on the Pri nted
Circuit Board (PCB).
4.12-Wire Standard Mode I2C™
Protocol Compatible Interface
The MCP9808 Serial Clock (SCL) input and the
bidirectional Serial Data (SDA) line form a 2-wire
bidirectional, Standard mode, I
communicati on po rt (re fer t o the Digital Input/Output
Pin Characteristics and Sensor Serial Interface
Timing Specifications tables).
The following bus protocol has been defined:
TABLE 4-1:MCP9808 SERIAL BUS
PROTOCOL DESCRIPTIONS
TermDescription
MasterThe device that controls the serial bus,
typically a microcontroller.
SlaveThe device addressed by the master,
such as the MCP9808.
Transmitter Device sending data to the bus.
ReceiverDevice receiving data from the bus.
STARTA unique signal from the master to
initiate serial interface with a slave.
STOPA unique signal from the master to
terminate serial interface from a slave.
Read/Write A read or write to the MCP9808
registers.
ACKA receiver Acknowledges (ACK) the
reception of eac h byte by pol ling the bu s.
NAKA receive r Not-Acknowledges (NAK) or
releases the bus to show End-of-Data
(EOD).
BusyCommunication is not possible
because the bus is in use.
Not BusyThe bus is in the Idle state; both SDA
and SCL remain high.
Data ValidSDA must remain stable before SCL
becomes high in order for a data bit to
be considered valid. During normal
data transfers, SDA only cha nges st a te
while SCL is low.
2
C compatible
4.1.1DATA TRANSFER
Data transfers are initiated by a Start condition
(START), followed by a 7-bit device address and a
read/write bit. An Acknowledge (ACK) from the slave
confirms the receptio n of eac h byte . Each a ccess mus t
be terminated by a Stop condition (STOP).
Repeated communication is initiated after t
This device does not support sequential register
read/write. Each register needs to be addressed using
the Register Pointer.
This device supports the receive protocol. The register
can be spec ified using the pointer for the initi al read.
Each repeated read or receive begins with a Start
condition and address byte. The MCP9808 retains the
previously selected register. Therefore, it outputs data
from the previously spec ified re giste r (repeate d point er
specification is not necessary).
B-FREE
.
4.1.2MASTER/SLAVE
The bus is controlled by a master device (typically a
microcontroller) that controls the bus access and
generates the S tart and Stop co nditions. The M CP9808
is a slave device and does not control other devices in
the bus. Both master and slave devices can operate as
either transmitter or receiver. However, the master
device determines which mode is activated.
4.1.3START/STOP CONDITION
A high-to- low trans ition of t he SDA line (while S CL is
high) is the Start condition. All data transfers must be
preceded by a Start condition from the master. A
low-to-high transition of the SDA line (while SCL is
high) signifies a Stop condition.
If a Start or Stop condition is introduced during data
transmission, the MCP9808 releases the bus. All data
transfers are ended by a Stop condition from the
master.
Following the Start condition, the host must transmit an
8-bit address byte to the MCP9808. The address for the
MCP9808 temperature sensor is ‘0011,A2,A1,A0’ in
binary, where the A2, A1 and A0 bits are set externally
by connecting the corresponding pins to V
‘1’ or GND
DD
‘0’. The 7-bit address, transmitted in the serial bit stream,
must match the selected address for the MCP9808 to
respond with an ACK. Bit 8 in the address byte is a
read/write bit. Setting this bit to ‘1’ commands a read
operation, while ‘0’ commands a write operation (see
Figure 4-1).
Address Byte
SCL
SDA
See Table 3-2.
123456789
011A2A1A0
0
Start
Address
Code
Slave
Address
R/W
MCP9808 Response
A
C
K
FIGURE 4-1:Device Addressing.
4.1.5DATA VALID
After the Start condition, each bit of data in the
transmission needs to be s ettled for a tim e specified b y
t
SU-DATA
before SCL t ogg les from low -to- hig h (s ee t he
Sensor Serial Interface T iming Specifications sect ion).
4.1.6ACKNOWLEDGE (ACK/NAK)
Each receiving device, when addressed, must
generate an ACK bit after the reception of each byte.
The master device must generate an extra clock pulse
for ACK to be recognized.
The Acknowledging d ev ice pulls down the SDA l in e f or
t
SU-DATA
before the low-to-high transition of SCL from
the master. SDA also needs to remain pulled down for
t
after a high-to-low transition of SCL.
H-DATA
During read, the master must signal an End-of-Data
(EOD) to the slave, by not generating an ACK bit
(NAK), once the last bit has been clocked out of the
slave. In this case, the slave will leave the data line
released to enable the master to generate the Stop
condition.
4.1.7TIME-OUT
If the SCL stays low or high for the time specified by
t
, the MCP9808 temperature sensor resets the
OUT
serial interface. T his di ct ates th e min imum clock spee d
as outlined in the specification.
The MCP9808 has several registers that are
user-accessible. These registers include the Temperature register, Configuration register, Temperature Alert
Upper Boundary and Lower Boundary Limit registers,
Critical Temperature Limit register, Manufacturer
Identification reg ister and Device Ide ntification register .
The Te mperature register is read-only, used to access
the ambient temperature data. This register is doublebuffered and it is updated every t
Alert Upper Boundary and Lower Boundary Limit
registers are read/write registers. If the ambient
temperature drifts beyond the user-specified limits, the
MCP9808 outputs a signal using the Alert pin (refer to
REGISTER 5-1:REGISTER POINTER (WRITE-ONLY)
W-0W-0W-0W-0W-0W-0W-0W-0
————Pointer bits
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘ 1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
. The T em perature
CONV
Section 5.2.3 “Alert Output Configuration”). In
addition, the Critical Temperature Limit register is used
to provide an additional critical temperature limit.
The Configuration register provides access to
configure the MCP9808 device’s various features.
These registers are described in further detail in the
following sections.
The registers are accessed by sending a Register
Pointer to the MCP9808, using the serial interface. This
is an 8-bit write-only po inter. However, the four Least
Significant bit s are used as pointers and all u nused bit s
(Register Pointer<7:4>) need to be cleared or set to ‘0’.
Register 5-1 describes the pointer or the address of
each register.
bit 7-4W: Writable bits
Write ‘0’.
Bits 7-4 must alway s be cleare d or wr itten to ‘ 0’. T his d evice ha s add itiona l regi ste rs tha t are re se rved
for test and calibration. If these registers are accessed, the device may not perform according to the
specification.
bit 3-0Pointer bits
0000 = RFU, Reserved for Future Use (Read-Only register)
0001 = Configuration register (CONFIG)
0010 = Alert Temperature Upper Boundary Trip register (T
0011 = Alert Temperature Lower Boundary Trip register (T
0100 = Critical Temperature Trip register (T
0101 = Temperature register (T
0110 = M anufacturer ID register
0111 = Device ID/Revision register
1000 = Resolution register
1xxx = Reserved
Note 1: Some registers contain calibration codes and should not be accessed.
The MCP9808 has a 16-bit Configuration register
(CONFIG) that allows the user to set various functions for
a robust temperature monitoring system. Bits 10 through
0 are used to select the temperature alert output
hysteresis, device shutdown or Low-Power mode,
temperature bo un da ry an d c ritical temperatu re lock, and
temperature Alert output enable/disable. In addition, Alert
output condition (output set for T
temperature boundary or T
only), Alert output status
CRIT
and Alert outp ut pol arity and mode (C omparator Outp ut
or Interrupt Output mode) are user-configurable.
UPPER
and T
LOWER
user-specified temperature boundary (see
Section 5.2.2 “Temperature Hysteresis (T
HYST
The Continuous Conversion or Shutdown mode is
selected using bit 8. In Shutdown mode, the band gap
temperature sensor circuit stops converting
temperature and the Ambient Temperature register
) holds the previous temperature data (see
(T
A
Section 5.2.1 “Shutdown Mode”). Bits 7 and 6 are
used to lock the user-specified boundaries T
T
LOWER
and T
to prevent an accidental rewrite.
CRIT
UPPER
The Lock bits a re cle ared by reset ting t he powe r. Bits 5
through 0 are used to configure the temperature Alert
output pin. All functions are described in Register 5-2
(see Section 5.2.3 “Alert Output Configuration”).
The temperature hysteresis bits 10 and 9 can be used
to prevent output chatter when the ambient
temperature gradually changes beyond the
(Refer to Section 5.2.3 “Alert Output Configuration”.)
This bit can not be altered when either of the Lock bits are set (bit 6 and bit 7).
This bit can b e programmed in Shutdown mode.
In shutdown, all power-consumin g activitie s are disab led, though all registers can be writ ten to or read.
This bit cannot be set to ‘1’ when either of the Lock bits is set (bit 6 and bit 7). However, it can be
cleared to ‘0’ for continuous conversion while locked (refer to Section 5.2.1 “Shutdown Mode”).
When enabled, this bit remains set to ‘1’ or locked until cleared by an internal Reset (Section 5.3
“Summary of Power-on Default”).
This bit can be programmed in Shutdown mode.
bit 6Win. Lock: T
0 = Unlocked; T
1 = Locked; T
UPPER
UPPER
UPPER
and T
and T
and T
LOWER
LOWER
LOWER
When enabled, this bit remains set to ‘1’ or locked until cleared by a Power-on Reset (Section 5.3
“Summary of Power-on Default”).
This bit can be programmed in Shutdown mode.
bit 5Int. Clear: Interrupt Clear bit
0 = No effect (power-up default)
1 = Clear interrupt output; when read, this bit returns to ‘0’
This bit can not be se t to ‘1’ i n Shutdo wn mode, but it can be c leared af ter the dev ice enters Shu tdown
mode.
bit 4Alert Stat.: Alert Output Status bit
0 = Alert output is not asserted by the device (power-up default)
1 = Alert output is asserted as a comparator/Interrupt or critical temperature output
This bit can not be set to ‘1’ or cleared to ‘0’ in Shutdown mo de. However , if the Alert outp ut i s co nfig ured as Interrupt mode, and if th e host con troller clea rs to ‘0’, t he interrupt, using b it 5 while the d evice
is in Shutdown mode, then this bit will also be cleared ‘0’.
bit 3Alert Cnt.: Alert Output Control bit
0 = Disabled (power-up default)
1 = Enabled
This bit can not be altered when either of the Lock bits are set (bit 6 and bit 7).
This bit can be programmed in Shutdown mode, but the Alert output will not assert or deassert.
bit 2Alert Sel.: Alert Output Select bit
0 = Alert output for T
1 =T
A
> T
CRIT
only (T
UPPER
UPPER
, T
LOWER
and T
When the Alarm Window Lock bit is set, this bit cannot be altered until unlocked (bit 6).
This bit can be programmed in Shutdown mode, but the Alert output will not assert or deassert.
This bit cannot be altered when either of the Lock bits are set (bit 6 and bit 7).
This bit can be programmed in Shutdown mode, but the Alert output will not assert or deassert.
This bit cannot be altered when either of the Lock bits are set (bit 6 and bit 7).
This bit can be programmed in Shutdown mode, but the Alert output will not assert or deassert.
Writing to the CONFIG Register to Enable the Event Output Pin <0000 0000 0000 1000>b:
SCL
1234567812345678
SDA
0011
S
A
2A1A0
Address Byte
A
C
W
K
0000
0
001
Configuration Pointer
A
C
K
MCP9808MCP9808
1234567812345678
00000
MSB Data
A
00000001
C
K
LSB Data
MCP9808
000
A
C
K
MCP9808
Note: This is an example routine (see Appendix A: “Source Code”).
i2c_start();// send START command
i2c_write(Addres sByte & 0xFE);//WRITE Com man d (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
P
FIGURE 5-2:Timing Diagram for Writing to the Configuration Register (see Section 4.0 “Serial
Pointer if it was set
from the previous
read/write.
Address Byte
Configuration Pointer
MCP9808MCP9808
123456781234567812345678
SCL
SDA
0011
SP
A
2A1A0
Address ByteLSB Data
A
C
00000
R
K
00000001
MSB Data
MCP9808
A
C
K
000
MasterMaster
Note: This is an example routine (see Appendix A: “Source Code”).
i2c_start();// send START command
i2c_ write(Add r essB y te & 0 xFE);//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(Add r essB y te | 0 x01);//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
N
A
K
FIGURE 5-3:Timing Diagram for Reading from the Configuration Register (see Section 4.0 “Serial
the maximum and minimum temperature boundary or
temperature window that can be used to monitor
ambient temperature. If this feature is enabled
(Section 5.1.1 “Sensor Configuration Register
(CONFIG)”) and the ambient temperature exceeds the
specified boundary or window , the MCP9808 ass erts an
Alert output. (Refer to Section 5.2.3 “Alert Output
Configuration”).
(1)
U-0U-0U-0R/W-0R/W-0R/W-0R/W-0R/W-0
———Sign2
7
°C26°C25°C24°C
bit 15bit 8
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0U-0U-0
3
°C22°C21°C20°C2-1°C2-2°C——
2
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘ 1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 15-13Unimplemented: Read as ‘0’
bit 12Sign: Sign bit
≥ 0°C
0 =T
A
< 0°C
1 =T
A
bit 11-2T
UPPER/TLOWER/TCRIT
: Temperature Boundary bits
Temperature boundary trip data in two’s complement format.
bit 1-0Unimplemented: Read as ‘0’Note 1: This table shows two 16-bit registers for T
The MCP9808 uses a band gap temperature sensor
circuit to output anal og voltage proportiona l to absolu te
temperature. An intern al ΔΣ ADC is use d to convert th e
analog voltage to a digital word. The digital word is
loaded to a 16-bit read-only Ambient Temperature
register
two’s complemen t format.
(TA) that contains 13-bit temperature data in
)
A
In addition, the T
to reflect the Alert pin state. This allows the user to
identify the cause of the Alert output trigger (see
Section 5.2.3 “Alert Output Configuration”); bit 15 is
set to ‘1’ if T
set to ‘1’ if T
is less than T
‘1’ if T
A
The T
register bit assignment and boundary
A
conditions are described in Register 5-4.
register us es th ree bi ts ( TA<15:13>)
A
is greater than or eq ua l to T
A
is greater than T
A
LOWER
.
and bit 13 is set to
UPPER
CRIT
, bit 14 is
The TA register bits (TA<12:0>) are double-buffered.
Therefore, the user can ac cess the register , while in the
background, the MCP9808 performs an Analog-toDigital conversion. The temperature data from the ΔΣ
ADC is loaded in parallel to the T
register at t
A
CONV
refresh rate.
REGISTER 5-4:T
: AMBIENT TEMPERATURE REGISTER (→ ADDRESS ‘0000 0101’b)
A
(1)
R-0R-0R-0R-0R-0R-0R-0R-0
T
vs. T
A
CRIT
(1)
TA vs. T
UPPER
(1)
TA vs. T
LOWER
(1)
SIGN27 °C26 °C25 °C24 °C
bit 15bit 8
R-0R-0R-0R-0R-0R-0R-0R-0
3
°C22 °C21 °C20 °C2
2
-1
°C2
-2
°C
(2)
-3
(2)
2
°C
-4
(2)
2
°C
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 15T
bit 14T
bit 13T
vs. T
A
0=TA < T
1=TA ≥ T
vs. T
A
0 =T
≤ T
A
1 =TA > T
vs. T
A
0 =TA ≥ T
1 =TA < T
bit
CRIT
CRIT
CRIT
UPPER
UPPER
UPPER
LOWER
LOWER
LOWER
(1)
bit
bit
(1)
(1)
bit 12SIGN bit
≥ 0°C
0 =T
A
< 0°C
1 =T
bit 11-0T
A
: Ambient Temperature bits
A
(2)
12-bit ambient temperature data in two’s complement format.
Note 1: Bits 15, 14 and 13 are not affected by the status of the Alert Output Configuration (CONFIG<5:0> bits,
Register 5-2).
2: Bits 2, 1 and 0 may remain clear at ‘0’ dependi ng on the status of the Resolutio n regis ter (Register 5-7).
The power-up default is 0.25°C/bit; bits 1 and 0 remain clear ‘0’.
To convert the TA bits to decimal temperature, the
upper three boundary bits (T
<15:13>) must be
A
masked out. Then, determine the SIGN bit (bit 12) to
check positive or negative temperature, shift the bits
accordingly, and combine the upper and lowe r b yte s of
the 16-bit register. The upper byte contains data for
temperatures greater than +32°C while the lower byte
contains data fo r t e mp era t ure l es s t h an +3 2° C, i n cl uding fractional data. When combining the upper and
lower bytes, the upper byte must be right-shifted by
4 bits (or multiply by 2
shifted by 4 bi ts (o r m ul t ip l y b y 2
4
) and the lower byte must be lef t-
-4
). Adding the results
of the shifted values provides the temperature data in
decimal format (see Equation 5-1).
The temperature bits are in two’s compliment format,
therefore, positiv e te mpe rature data and ne gat ive tem perature data are computed differently. Equation 5-1
shows the temperature computation. The example
EXAMPLE 5-1:SAMPLE INSTRUCTION CODE
This example routine assumes the variables and I
(see Appendix A: “Source Code”):
This register is used to ide nti fy the manufacturer of the
device in order to perform manufacturer-specific
operation. The Manufacturer ID for the MCP9808 is
0x0054 (hexadecimal).
REGISTER 5-5:MANUFACTURER ID REGISTER – READ-ONLY (→ ADDRESS ‘0000 0110’b)
R-0R-0R-0R-0R-0R-0R-0R-0
Manufac turer ID
bit 15bit 8
R-0R-1R-0R-1R-0R-1R-0R-0
Manufac turer ID
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘ 1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 15-0Device Manufacturer Identification bits
1234567812345678
SCL
SDA
0011
S
A
2A1A0
Address Byte
A
C
0000
W
K
Manufacturer ID Point er
MCP9808MCP9808
123456781234567812345678
SCL
SDA
0011
SP
A
2A1A0
Address ByteLSB Data
A
C
00000
R
K
MSB Data
MCP9808
Note:It is not necessary to
A
0
110
00001010
C
K
A
C
K
MasterMaster
select the Register
Pointer if it was set
from the previous
read/write.
100
N
A
K
FIGURE 5-6:Timing Diagram for Reading the Manufacturer ID Register (see Section 4.0 “Serial
The upper byte of this register is used to specify the
device identification and the lower byte is used to
specify the device revision. The Device ID for the
MCP9808 is 0x04 (hex).
The revision begins with 0x 00 (hex) for the first release,
with the number being inc remented as revised v ersions
are released.
REGISTER 5-6:DEVICE ID AND DEVICE REVISION – READ-ONLY (→ ADDRESS ‘0000 0111’b)
R-0R-0R-0R-0R-0R-1R-0R-0
Device ID
bit 15bit 8
R-0R-0R-0R-0R-0R-0R-0R-0
Device Revision
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘ 1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 15-8Device ID: Bit 15 to bit 8 are used for device ID
bit 7-0Device Revision: Bit 7 to bit 0 are used for device revision
1234567812345678
SCL
SDA
0011
S
A
2A1A0
Address Byte
A
C
W
K
0000
0
Device ID Pointer
111
MCP9808MCP9808
123456781234567812345678
SCL
SDA
0011
SP
A
2A1A0
Address ByteLSB Data
A
C
00000
R
K
MCP9808
100
MSB Data
MasterMaster
Note:It is not necessary to
A
C
K
A
C
00000
K
select the Register
Pointer if it was set
from the previous
read/write.
N
000
A
K
FIGURE 5-7:Timing Diagram for Reading Device ID and Device Revision Register (see
Shutdown mode disables all power consuming
activities (including temperature sampling operations)
while leaving the serial interface active. This mode is
selected by setting bit 8 of CONFIG to ‘1’. In this mode,
the device consumes I
until bit 8 is cleared to ‘0’ to enable Continuous
Conversion mode or until power is recycled.
The Shutdown bit (bit 8) cannot be set to ‘1’ while the
CONFIG<7:6> bits (Lock bi ts) are set to ‘1’. However, it
can be cleared to ‘0’ or returned to Continuous
Conversion mode while locked.
In Shutdown mode, all registe rs can be read or writte n.
However, the serial bus activity increases the shutdown
current. In addition, if the device is in shutdown while
the Alert pin is asserted, t he device will ret ain the ac tive
state during shutdown. This increases the shutdown
current due to the additional Alert output current.
5.2.2TEMPERATURE HYSTERESIS
(T
A hysteresis of 0°C, +1.5°C, +3°C or +6°C can be
selected for the T
boundaries, using bits 10 and 9 of CONFIG. The
hysteresis applies for decreasi ng temperature only (hot
to cold) or as temperature drifts below the specified
limit.
The Hysteresis bits can not be changed if either of the
Lock bits (CONFIG<7:6) are se t to ‘1’.
The T
UPPER
are described graphically in Figure 5-10.
, T
HYST
UPPER
LOWER
)
5.2.3ALERT OUTPUT CONFIGURATION
The Alert output can be enabled by using bit 3 of the
CONFIG register (Alert Output Control bit) and can be
configured as either a comparator output or as an
Interrupt Output mode using bit 0 of CONFIG (Alert
Output Mode bi t). T he pol ari ty can also be spe ci fied as
active-high or active-low using bit 1 of CONFIG (Alert
Polarity bit). This is an open-drain output and requires
a pull-up r esistor.
When the ambient temperature increases above the
critical temperature limit, the Alert output is forced to a
comparator output (regardless of CONFIG<0>). When
the temperature drifts below the critical temperature
limit minus hysteresis, the Alert output automatically
returns to the state specified by CONFIG<0> bit.
. It remains in this mode
SHDN
, T
and T
and T
LOWER
boundary conditions
CRIT
temperate
CRIT
V
DD
R
PU
MCP9808
Alert Output
FIGURE 5-9:Active-Low Alert Output
Configuration.
The status of the Alert output can be read using
CONFIG<4> (Alert Output Status bit). This bit can not
be set to ‘1’ in Shutdown mode.
Bits 7 and 6 of the CONFIG register c an be used to lock
the T
UPPER
, T
LOWER
and T
registers. These bits
CRIT
prevent false triggers at the Alert output due to an
accidental rewrite to these registers.
The Alert output can also be used as a critical temperature output using bit 2 of CON FIG (Alert Output Selec t
bit). When this feature is selected, the Alert output
becomes a comparator output. In this mode, the
interrupt output configuration (Alert Output Mode bit,
CONFIG<0>) is ignored.
5.2.3.1Comparator Mode
Comparator mode is selected using bit 0 of CONFIG. In
this mode, the Alert output is asserted as active-high or
active-low, using bit 1 of CONFIG. Figure 5-10 shows
the conditions that toggle the Alert output.
If the device enters Shutdown mode with asserted Alert
output, the o utput remains as serted during S hutdown
mode. The device must be operating in Continuous
Conversion mode for t
T
LOWER
and T
boundary conditions need to be
CRIT
satisfied in order for the Alert output to deassert.
Comparator mode is useful for thermostat type
applications, such as turning on a cooling fan or
triggering a system shutdown when the temperature
exceeds a safe operating range.
In Interrupt mode, the Alert output is asserted as activehigh or active-low (depending on the polarity
configuration) when T
and T
bit 5 (Interrupt Clear bit) of CONFIG. Shutting down the
device will not res et or deassert the Aler t output. This
mode can not be selected when the Alert output is used
as a critical temperature output only, using bit 2 of
CONFIG.
This mode is designed for interrupt driven
microcontroller-based systems. The microcontroller
receiving the interrupt will have to Acknowledge the
interrupt by setting bit 5 of the CONFIG register from the
MCP9808.
limits. The output is de asserted by setting
LOWER
drifts above or below T
A
UPPER
5.2.4TEMPERATURE RESOLUTION
The MCP9808 is capable of providing temperature
data with +0.5°C to +0.0625°C resolution. The resolution can be selected using the Resolution register
(Register 5-7). It is located at address, ‘00001000’b,
and it provides measurement flexibility. A +0.0625°C
resolution is set as a POR default by the factory.
The MCP9808 does not require any additional
components besides the master controller in order to
measure temperature. However, it is recommended
that a decou pling capac itor of 0 .1 µF to 1 µF be used
between the V
ceramic capaci t or is re co mm en ded . It i s nece s sa ry f o r
the capacitor to be located as close as possible to the
power and ground pins of the device in order to provide
effective noise protec tion.
In addition , good PCB layout is key for be tter ther mal
conduction from the PCB temperature to the sensor
die. For good temperature sensitivity, add a ground
layer under the device pins, as shown in Figure 6-1.
6.2Thermal Considerations
A potential for self-heating errors can exist if the
MCP9808 SDA, SCL and Event lines are heavily
loaded with pull-ups (high current). Typically, the
self-heating error is n egl igi bl e because of the relativ el y
small current co nsu mp tion of the MCP9808. A te mper-
and GND pins. A high-frequency
DD
ature accuracy error of approximately +0.5°C could
result from self-heating if the communication pins
sink/source the maximum curre nt speci fied.
For example, if the event output is loade d to ma xim um
, Equation 6-1 can be used to determine the effect
I
OL
of self-heating.
EQUATION 6-1:EFFECT OF
SELF-HEATING
T
θ
()=
Δ
JAVDDIDD
Where:
V
OL_Alert, SDA
I
OL_Alert, SDA
At room temperature (TA=+25°C) with maximum
= 500 µA and VDD= 3.6V, the self-heating due to
I
DD
power diss ipat io n T
and +0.5°C for the TSSOP-8 package.
The software supplied herewith by Microchip Technology Incorporated (the “Company”) is intended and supplied to you, the
Company’s customer, for use solely and exclusively with products manufactured by the Company.
The software is owned by the Company and/or its supplier, and is protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil
liability for the breach of the terms and conditions of this license.
THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
APPENDIX A:SOURCE CODE
/********************************************************************
FileName: I2C.c
Processor:PIC18 Microcontrollers
Complier: Microchip C18 (for PIC18) or C30 (for PIC24)
Company:Micr oc hi p Te ch no lo gy , In c.
#include <p18cxxx.h> // This code is developed for PIC18F2550
//It can be modified to be used with any PICmicro with MSSP module
/** PRIVATE PROTOTYPES *********************************************/
void i2c_init(void);
void i2c_start(void);
void i2c_repStart(void);
void i2c_stop(void);
unsigned char i2c_write( unsigned char i2cWriteData );
unsigned char i2 c_ re ad ( un si gn ed cha r ac k );
/********************************************************************
* Function Name: i2c_init
* Return Value: void
* Parameters: Enable SSP
* Description: This fun ct io n se ts up th e SS P1 mod ul e on a
* PIC18CXXX device for use wit h a Mi cr oc hi p I2 C
********************************************************************/
void i2c_init(void) {
TRISBbits.TRISB0 = 1; // Digital Output (make it input only when reading data)
TRISBbits.TRISB1 = 1; // Digital Output
SSPCON1 = 0x28; // enable I2C Master mode
SSPCON2 = 0x00; // clear control bits
SSPSTAT = 0x80; // disable slew rate control ; di sa bl e SM Bu s
SSPADD = 19; // set baud rate to 100 kH z (F os c = 48 MHz )
/********************************************************************
* Function Name: i2c_write
* Return Value: Status byte fo r WC OL det ec ti on .
* Parameters: Single data byte for I2C 2 bu s.
* Description: This routine writes a single byte to the
* I2C2 bus.
********************************************************************/
unsigned char i2c_write( unsigned char i2cWriteData ) {
PIR1bits.SSPIF = 0; // clear interrupt
while ( SSPSTATbits. BF ) ; // wai t fo r id le con di ti on
SSPBUF = i2cWriteData; // Load SSPBUF with i2cWriteData (the value to be transmitted)
while (!PIR1bits.S SP IF ) ; // wa it for a fla g to be se t
PIR1bits.SSPIF = 0; // clear flag
return ( !SSPCON2bi ts .A CK ST AT ); // func ti on re tu rns '1 ' i f t ra ns mi ss io n i s a ck no wl ed ge d
}
/********************************************************************
* Function Name: i2c_read
* Return Value: contents of SS P2 BU F re gi st er
* Parameters: ack = 1 and nak = 0
* Description: Read a byte from I2C bus and ACK/NAK device
********************************************************************/
unsigned char i2 c_ re ad ( un si gn ed cha r ac k ) {
unsigned char i2cReadData;
PIR1bits.SSPIF = 0;// clear interrupt
while ( SSPSTATbits.BF ) ; // wait for idle condition
SSPCON2bits.RCEN = 1; // enable receive mode
while (!PIR1bits.S SP IF ) ; // wai t fo r a fl ag to be set
PIR1bits.SSPIF = 0;// clear flag
i2cReadData = SSPBUF ; // Read SSPB UF and put it in i2c Re ad Da ta
if ( ack ) { // if ack=1
SSPCON2bits.ACKDT = 0; // then tr an sm it an Ac kn ow le dg e
} else {
SSPCON2bits.ACKDT = 1; // other wi se tra ns mi t a No t Ac kn ow le dg e
}
SSPCON2bits.ACKE N = 1; // send ackn ow le dg e se qu en ce
while (!PIR1bits.S SP IF ) ; // wai t fo r a fl ag to be set
PIR1bits.SSPIF = 0;// clear flag
return( i2cReadDat a ); // return th e va lu e re ad fro m SS PB UF
Note the following details of the code protection feature on Microchip devices:
•Microchip products meet the specification contained in their particular Microchip Data Sheet.
•Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
•Microchip is willing to work with the customer who is concerned about the integrity of their code.
•Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are com mitted to continuously improving the c ode prot ection f eatures of our
products. Attempts to break Microchip’s code protection feature may be a violation of t he Digit al Mill ennium Copyright Act. If such act s
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and t he lik e is provided only f or your convenience
and may be su perseded by updates. It is you r r es ponsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life supp ort and/or safety ap plications is entir ely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless M icrochip from any and all dama ges, claims,
suits, or expenses re sulting from such use. No licens es are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
K
logo, rfPIC and UNI/O are registered trademarks of
PIC
Microchip Technology Incorporated in the U.S.A. and other
countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, chipKIT,
chipKIT logo, CodeGuard, dsPICDEM, dsPICDEM.net,
dsPICworks, dsSPEAK, ECAN, ECONOMONITOR,
FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP,
Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB,
MPLINK, mTouch, Omniscient Code Generation, PICC,
PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE,
rfLAB, Select Mode, Total Endurance, TSHARC,
UniWinDriver, WiperLock and ZENA are trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
SQTP is a service mark of Microchip T echnology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
Microchip received ISO/TS-16949:2009 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.