?2011 Microchip Technology Inc.
DS25095A-page 25
MCP9808
5.1.3.1
T
A
Bits to Temperature Conversion
To convert the T
A
bits to decimal temperature, the
upper   three   boundary   bits   (T
A
<15: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癈 while the lower byte
contains data for temperature less than +32癈, 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
4
) and the lower byte must be left-
shifted by 4 bits (or multiply by 2
-4
). Adding the results
of the shifted values provides the temperature data in
decimal format (see Equation 5-1).
The temperature bits are in twos compliment format,
therefore, positive temperature data and negative tem-
perature data are computed differently. Equation 5-1
shows the temperature computation. The example
instruction code, outlined in Example 5-1, shows the
communication flow; also see Figure 5-5 for the timing
diagram.
EQUATION 5-1:    BYTES TO
TEMPERATURE
CONVERSION
EXAMPLE 5-1:
SAMPLE INSTRUCTION CODE
Where:
T
A
=  Ambient Temperature (癈)
UpperByte  =  T
A
bit 15 to bit 8
LowerByte  =  T
A
bit 7 to bit 0
Temperature T
A
e 0癈
Temperature < 0癈
T
A
UpperByte   2
4
LowerByte   2
4
?/DIV>
+
?/DIV>
(
)
=
T
A
256    UpperByte   2
4
LowerByte   2
4
?/DIV>
+
?/DIV>
(
)
=
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(0x05);
// Write T
A
Register Address
i2c_start();
//Repeat START
i2c_write(AddressByte | 0x01);
// READ Command (see Section 4.1.4 Address Byte)
//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
//Convert the temperature data
//First Check flag bits
if ((UpperByte & 0x80) == 0x80){
//T
A
?T
CRIT
}
if ((UpperByte & 0x40) == 0x40){
//T
A
> T
UPPER
}
if ((UpperByte & 0x20) == 0x20){
//T
A
< T
LOWER
}
UpperByte = UpperByte & 0x1F;
//Clear flag bits
if ((UpperByte & 0x10) == 0x10){
//T
A
< 0癈
UpperByte = UpperByte & 0x0F;
//Clear SIGN
Temperature = 256 - (UpperByte x 16 + LowerByte / 16);
}else
//T
A
?0癈
Temperature = (UpperByte x 16 + LowerByte / 16);
//Temperature = Ambient Temperature (?/SPAN>C)
This example routine assumes the variables and I
2
C" communication subroutines are predefined
(see Appendix A: Source Code):
相關(guān)代理商/技術(shù)參數(shù) |
參數(shù)描述 |
MCP98242 |
制造商:MICROCHIP 制造商全稱:Microchip Technology 功能描述:Memory Module Temperature Sensor w/EEPROM for SPD |
MCP98242_09 |
制造商:MICROCHIP 制造商全稱:Microchip Technology 功能描述:Memory Module Temperature Sensor w/EEPROM for SPD |
MCP98242-BE/MC |
制造商:Microchip Technology Inc 功能描述:TEMP SENSOR DGTL SERL (2-WIRE, - Bulk |
MCP98242-BE/MNY |
制造商:MICROCHIP 制造商全稱:Microchip Technology 功能描述:Memory Module Temperature Sensor w/EEPROM for SPD |
MCP98242-BE/ST |
功能描述:板上安裝溫度傳感器 JEDEC DIMM Serial output temp sensor RoHS:否 制造商:Omron Electronics 輸出類型:Digital 配置: 準(zhǔn)確性:+/- 1.5 C, +/- 3 C 溫度閾值: 數(shù)字輸出 - 總線接口:2-Wire, I2C, SMBus 電源電壓-最大:5.5 V 電源電壓-最小:4.5 V 最大工作溫度:+ 50 C 最小工作溫度:0 C 關(guān)閉: 安裝風(fēng)格: 封裝 / 箱體: 設(shè)備功能:Temperature and Humidity Sensor |