| 전자부품 데이터시트 검색엔진 |
|
MCP98243 데이터시트(PDF) 27 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
MCP98243 데이터시트(HTML) 27 Page - Microchip Technology |
|
27 / 62 page ![]() © 2009 Microchip Technology Inc. DS22153C-page 27 MCP9843/98243 5.1.4.1 TA bits to Temperature Conversion To convert the TA bits to decimal temperature, the 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 combinding the upper and lower bytes, the upper byte must be Right-shifted by 4bits (or multiply by 24) 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 two’s compliment format, therefore, postive temperature data and negative tem- perature data are computed differently. Equation 5-1 shows the temperature computation. The example instruction code outlined in Figure 5-6 shows the communication flow, also see Figure 5-7 for timing diagram. EQUATION 5-1: BYTES TO TEMPERATURE CONVERSION FIGURE 5-6: Example Instruction Code. Where: TA = Ambient Temperature (°C) UpperByte = TA bit 15 to bit 8 LowerByte = TA bit 7 to bit 0 Temperature ≥ 0°C Temperature < 0°C T A UpperByte 2 4 LowerByte 2 4 – × + × () = T A 256 UpperByte 2 4 LowerByte 2 4 – × + × () – = i2c_start(); // send START command i2c_write(AddressByte & 0xFE); //WRITE Command //also, make sure bit 0 is cleared ‘0’ i2c_write(0x05); // Write TA Register Address i2c_start(); //Repeat START i2c_write(AddressByte | 0x01); // 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 //Convert the temperature data //First Check flag bits if ((UpperByte & 0x80) == 0x80){ //TA ≥ TCRIT } if ((UpperByte & 0x40) == 0x40){ //TA > TUPPER } if ((UpperByte & 0x20) == 0x20){ //TA < TLOWER } UpperByte = UpperByte & 0x1F; //Clear flag bits if ((UpperByte & 0x10) == 0x10){ //TA < 0°C UpperByte = UpperByte & 0x0F; //Clear SIGN Temperature = 256 - (UpperByte x 16 + LowerByte / 16); }else //TA ≥ 0°C Temperature = (UpperByte x 16 + LowerByte / 16); //Temperature = Ambient Temperature (°C) This example routine assumes the variables and I2C communication subroutines are predefined: |
|
링크 URL |
| ALLDATASHEET 가 귀하에 도움이 되셨나요? [ DONATE ] |
Alldatasheet는? | 광고문의 | 운영자에게 연락하기 | 개인정보취급방침 | 링크 투 데이터시트 | 링크교환 | 제조사별 검색 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |