MCP9808 MICROCHIP [Microchip Technology], MCP9808 Datasheet - Page 25

no-image

MCP9808

Manufacturer Part Number
MCP9808
Description
Manufacturer
MICROCHIP [Microchip Technology]
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
MCP9808-E/MS
Manufacturer:
MICROCHIP
Quantity:
1 690
Part Number:
MCP9808-E/MS
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
Part Number:
MCP9808T-E/MC
Manufacturer:
MICROCHIP
Quantity:
12 000
Part Number:
MCP9808T-E/MS
Manufacturer:
MICROCHIP
Quantity:
12 000
5.1.3.1
To convert the T
upper three boundary bits (T
masked out. Then, determine the SIGN bit (bit 12) to
check positive or negative temperature, shift the bits
accordingly, and combine the upper and lower bytes of
the 16-bit register. The upper byte contains data for
temperatures greater than +32°C while the lower byte
contains data for temperature less than +32°C, includ-
ing 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 bits (or multiply by 2
of the shifted values provides the temperature data in
decimal format (see
The temperature bits are in two’s compliment format,
therefore, positive temperature data and negative tem-
perature data are computed differently.
shows the temperature computation. The example
EXAMPLE 5-1:
© 2011 Microchip Technology Inc.
This example routine assumes the variables and I
(see
i2c_start();
i2c_write (AddressByte & 0xFE);
i2c_write(0x05);
i2c_start();
i2c_write(AddressByte | 0x01);
UpperByte = i2c_read(ACK);
LowerByte = i2c_read(NAK);
i2c_stop();
//Convert the temperature data
//First Check flag bits
if ((UpperByte & 0x80) == 0x80){
}
if ((UpperByte & 0x40) == 0x40){
}
if ((UpperByte & 0x20) == 0x20){
}
UpperByte = UpperByte & 0x1F;
if ((UpperByte & 0x10) == 0x10){
}else
T
A
Appendix A: “Source
UpperByte = UpperByte & 0x0F;
Temperature = 256 - (UpperByte x 16 + LowerByte / 16);
Temperature = (UpperByte x 16 + LowerByte / 16);
Bits to Temperature Conversion
A
bits to decimal temperature, the
Equation
4
) and the lower byte must be left-
SAMPLE INSTRUCTION CODE
5-1).
-4
A
). Adding the results
<15:13>) must be
Code”):
Equation 5-1
// send START command
//WRITE Command (see
//also, make sure bit 0 is cleared ‘0’
// Write T
//Repeat START
// READ Command (see
//also, make sure bit 0 is Set ‘1’
// READ 8 bits
//and Send ACK bit
// READ 8 bits
//and Send NAK bit
// send STOP command
//T
//T
//T
//Clear flag bits
//T
//Clear SIGN
//T
//Temperature = Ambient Temperature (°C)
2
A
A
A
A
A
C™ communication subroutines are predefined
³ T
> T
< T
< 0°C
³ 0°C
instruction code, outlined in
communication flow; also see
diagram.
EQUATION 5-1:
CRIT
UPPER
LOWER
Temperature T
Temperature < 0°C
Where:
A
T A
Register Address
UpperByte = T
LowerByte = T
T A
=
256
=
T
(
Section 4.1.4 “Address
A
UpperByte 2
Section 4.1.4 “Address
A
(
UpperByte 2
= Ambient Temperature (°C)
≥ 0°C
A
A
BYTES TO
TEMPERATURE
CONVERSION
bit 15 to bit 8
bit 7 to bit 0
×
×
4
Example
MCP9808
+
Figure 5-5
4
LowerByte 2
+
LowerByte 2
DS25095A-page 25
Byte”)
Byte”)
5-1, shows the
for the timing
×
×
4 –
)
4 –
)

Related parts for MCP9808