MCP9804 Microchip Technology, MCP9804 Datasheet - Page 25

no-image

MCP9804

Manufacturer Part Number
MCP9804
Description
Accuracy Digital Temperature Sensor
Manufacturer
Microchip Technology
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
MCP9804-E/MC
Manufacturer:
MICROCHIP
Quantity:
3 100
Part Number:
MCP9804-E/MC
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
Part Number:
MCP9804-E/MC
0
Part Number:
MCP9804-E/MS
Manufacturer:
MICROCHIP
Quantity:
12 000
Part Number:
MCP9804-E/MS
Manufacturer:
MICROCHI
Quantity:
20 000
Part Number:
MCP9804-E/MS
Quantity:
510
Part Number:
MCP9804-E/MS
0
Part Number:
MCP9804T-E/MC
Manufacturer:
MICROCHIP
Quantity:
12 000
Part Number:
MCP9804T-E/MC
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
Part Number:
MCP9804T-E/MS
Manufacturer:
MICROCHIP
Quantity:
12 000
Part Number:
MCP9804T-E/MS
0
5.1.3.1
To convert the T
upper three boundary bits (bits 15, 14 and 13) must be
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, including
fractional data. When combining the upper and lower
bytes, the upper byte must be Right-shifted by 4 bits (or
multiply by 2
by 4 bits (or multiply by 2
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
temperature data are computed differently.
1
instruction code outlined in
communication flow, also see
diagram.
FIGURE 5-5:
© 2009 Microchip Technology Inc.
shows the temperature computation. The example
Equation
This example routine assumes the variables and i2c communication subroutines are predefined:
(See Appendix A: “Source Code”)
4
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
) and the lower byte must be Left-shifted
A
bits to Temperature Conversion
UpperByte = UpperByte & 0x0F;
Temperature = 256 - (UpperByte x 16 + LowerByte / 16);
Temperature = (UpperByte x 16 + LowerByte / 16);
A
bits to decimal temperature, the
5-1.
Example Instruction Code.
-4
). Adding the results of the
Figure 5-5
Figure 5-6
Equation 5-
shows the
for timing
// send START command
//WRITE Command (see Section 4.1.4)
//also, make sure bit 0 is cleared ‘0’
// Write T
//Repeat START
// READ Command (see Section 4.1.4)
//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
//T
//Clear flag bits
//T
//Temperature = Ambient Temperature (°C)
//Clear SIGN
A
A
A
A
A
≥ T
> T
< T
< 0°C
≥ 0°C
EQUATION 5-1:
CRIT
UPPER
LOWER
Where:
A
Temperature
Temperature < 0°C
Register Address
UpperByte = T
LowerByte = T
T
A
T
=
A
256
=
T
(
A
UpperByte 2
Τ
(
Α
= Ambient Temperature (°C)
UpperByte 2
≥ 0°C
A
A
TEMPERATURE
CONVERSION
bit 15 to bit 8
bit 7 to bit 0
BYTES TO
×
×
4
+
MCP9804
4
LowerByte 2
+
www.DataSheet4U.com
LowerByte 2
DS22203A-page 25
×
×
4 –
)
4 –
)

Related parts for MCP9804