Translating Temperature from Binary to Decimal
The procedure for converting temperature values for the DS1854/57/58 begins with reading the values stored in bytes 60h (MSB of the temperature) and 61h (LSB of the temperature). These two bytes contain the most recent temperature reading. The 12 upper bits are considered significant. The lower 4 bits are available to read, however the resolution attained by reading those bits is generally not useful since the best resolution is 0.0586°C. This resolution is not required by most applications since the temperature look-up table for the resistors only changes with every 2°C of change. Therefore, the 4 lower bits should be masked with 0's when read to avoid constant minor changes in temperature calibration. The bit weights and masking of the 4 lower bits are shown in Table 1.Table 1. Bit weight of digital temperature and masking
60h (Temperature MSB) | 61h (Temperature LSB) | ||||||||||||||
S | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 2-1 | 2-2 | 2-3 | 2-4 | 2-5 | 2-6 | 2-7 | 2-8 |
S | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 2-1 | 2-2 | 2-3 | 2-4 | 0 | 0 | 0 | 0 |
The left most bit is the sign bit and indicates whether or not the 2's complement binary number is positive or negative. If this bit is 0, then the temperature is positive. If the bit is 1, then the temperature is negative. The next 11 bits contain the value of the temperature and are translated into decimal differently depending on whether the values are positive or negative.
Positive Temperature Translation
The following is an example of how to translate a positive temperature value from hex to decimal. In this example, the values in addresses 60h and 61h are read to be 3Ch and 50h respectively. Combine these two bytes to get the hex value of 3C50h (after masking the lower 4 bits). Next, translate the hex data into binary. The binary equivalent of 3C50h is 0011 1100 0101 0000. Since the upper bit is 0, the temperature is positive. Table 2 shows the translation from hex to binary and the masking of the lower 4 bits.Table 2. Positive number (upper bit = 0) translation
HEXIDECIMAL DATA | BINARY DATA | MASKED BINARY DATA |
3C50h | 0011 1100 0101 0000 | 0011 1100 0101 0000 |
Since the sign bit is 0, the temperature is positive and requires no 2's complement transformation. Therefore, the value can be translated directly into a decimal number using a calculator. The binary number 0011 1100 0101 0000 is equal to the decimal value of 15440. The decimal value must be divided by 256 (or multiplied by 2-8) to calculate the correct decimal temperature value. Dividing the decimal value 15440 by 256 results in a decimal temperature value of 60.3125°C.
Negative Temperature Translation
Converting a negative temperature value (upper bit = 1) is a little more involved. An example is if addresses 60h and 61h contained the data D3h and 60h (lower 4 bits are masked). The first step is to convert the hex values into binary. Table 3 shows the translation from hex to binary and the masking of the 4 lower bits.Table 3. Negative number (upper bit = 1) translation
HEXIDECIMAL DATA | BINARY DATA | MASKED BINARY DATA |
D360h | 1101 0011 0110 0000 | 1101 0011 0110 0000 |
The next step is to take the 2's complement of the masked binary value. This is done by first inverting the masked binary data and then adding 1 to the least significant bit. Inverting the binary number 1101 0011 0110 0000 results in 0010 1100 1001 1111. Adding 1 to the right most bit results in the binary number 0010 1100 1010 0000. This binary number is equal to the decimal number 11424. Because the sign bit indicates the temperature is a negative value, the translated decimal value is divided by -256. So, the decimal value 11424 is divided by -256, resulting in a decimal temperature value of -44.625°C.
Alternate Method
An alternate method that is described in the DS1854/57/58 data sheets is a quick way to convert the binary temperature data into a decimal temperature value. Combine the MSB and LSB values in 60h and 61h as an unsigned binary value. Determine the decimal value of this unsigned binary value, then divide by 256. If the result is less than 128, then this is the °C decimal value of the temperature. If this value is greater than or equal to 128, then subtract 256 to get the decimal °C value of the temperature.VCC Translation
The VCC value is stored in address locations 62h and 63h. The voltage data is read as an unsigned 16-bit value. Again, while all 16 bits are available to read, only the upper 12 bits are considered significant. Because the scaling factor used for the VCC translation is 100µV, the resolution of the 12 bits is 1.6mV. Using more bits to attain a finer resolution would produce inaccurate voltage values since those values would be below the noise floor of the converter. Thus, the 4 lower bits are masked with 0's. Table 4 shows the bit weights of the VCC data and the masking of the 4 lower bits. With the lower 4 bits masked, the maximum range is 65520. Multiplying this value by the scaling factor of 100µV results in the maximum sca led voltage value of 6.5520V.Table 4. VCC bit weights and masking
62h (VCC MSB) | 63h (VCC LSB) | ||||||||||||||
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 0 | 0 | 0 | 0 |
As an example, the values read from 62h and 63h are found to be D7A0h. Translating this number into a decimal results in a value of 55200. Multiplying this value by the scaling factor of 100µV results in the scaled voltage value of 5.520V.
Monitored Analog Input (MON) Translations
The analog input pins MON1, MON2, and in the case of the DS1858, MON3 are unsigned 16-bit numbers, and are translated using a method similar to the VCC translation. As with the VCC translation, the lower 4 bits are masked with 0's because the resolution attained using those bits would produce inaccurate voltage values since those values would be below the noise floor of the converter. Table 5 shows the bit weights of the analog input bytes and the masking of the 4 lower bits. With the lower 4 bits masked, the maximum range is 65520, which translates to a voltage range of 0V to 2.499V when it is multiplied by the scaling factor of 38.147µV.Table 5. Monitored analog input bit weights and masking
64h (MON1 MSB) | 65h (MON1 LSB) | ||||||||||||||
66h (MON2 MSB) | 67h (MON2 LSB) | ||||||||||||||
68h (MON3 MSB, DS1858 only) | 69h (MON3 LSB, DS1858 only) | ||||||||||||||
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 0 | 0 | 0 | 0 |
As an example, the hex value of 9E70h is read from the two address locations. After masking the 4 lower bits with 0's, the binary value is determined to be 1001 1110 0111 0000. The decimal equivalent is 40560. Multiplying this value by the scaling factor of 38.147µV results in the scaled voltage value of 1.547V.
Previous article:Regenerated DS1847/DS1848 Resistance Calibration Constants - Regener
Next article:Interfacing CNC Ports and Resistor Laser Drivers - Interfacing Dig
- Popular Resources
- Popular amplifiers
Latest Analog Electronics Articles
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
MoreSelected Circuit Diagrams
MorePopular Articles
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
MoreDaily News
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
Guess you like
- Just a few words
- Is there any video or material about the calculation process of converting 220V to 12V 9V 5V through a transformer in the peripheral circuit of a single-chip microcomputer?
- Can someone tell me what kind of controller should be used for this automatic servo crane?
- Structure of optical devices and chips
- GitHub stores open source code repositories in Arctic caves
- Has anyone done OTA online upgrade for RL78?
- Millimeter wave radar IWR1443
- mpy starts supporting USB for STM32L432
- Voltage follower composed of op amp
- [Hua Diao Experience] 08 Series of tests on the hardware control pinpong library of Xingkong board (Part 1)