Interface design between DS75LX temperature sensor and PIC microcontroller
2026-04-06 04:55:08··#1
The DS75LX is a high-precision serial digital output temperature sensor that outputs measured temperature data via a two-wire serial bus (compatible with I2C). The DS75LX operates from 1.7V to 3.7V. In addition to basic temperature measurement, the DS75LX features a temperature alarm function, allowing users to set alarm temperature thresholds via software. The DS75LX has a temperature measurement range of -55℃ to +125℃, with an accuracy of ±2℃ when the measurement range is -25℃ to +100℃. The DS75LX also features a programmable 9- to 12-bit temperature data output format. When the output temperature data is 12 bits, its resolution reaches 0.0625℃. The sensor has three address pins, which can be set to any of three states: connected to GND, VDD, or floating, allowing for 27 address combinations. For example, when A2, A1, and A0 are connected to power, ground, and floating respectively, the DS75LX's device address is 0101110. Figure 1 shows the pinout of the DS75LX, and the functions are described in Table 1. [IMG=DS75LX Pinout]/uploadpic/THESIS/2007/12/20071218114651967525.jpg[/IMG] 2. DS75LX Working Principle The DS75LX achieves temperature measurement through a bandgap temperature sensing architecture. An on-chip Δ-Σ analog-to-digital converter directly converts the measured ambient temperature into a digital value and stores it in a temperature register. The DS75LX starts measuring temperature upon power-up, and users can configure the register contents via software to meet their measurement requirements. In addition to basic temperature measurement, the DS75LX also has a temperature alarm module. The two registers related to the temperature alarm module are the alarm threshold register Tos and the temperature hysteresis register Thyst. This module can be configured to two operating modes: comparator mode and interrupt mode. In comparator mode, if the measured temperature is higher than the value in Tos in 1, 2, 4, or 6 consecutive measurements, the OS pin is triggered and outputs a specific level according to the value of the POL bit in the configuration register, regardless of the setting value in Thyst. In interrupt mode, if the measured temperature is higher than the value in Tos or lower than the value in Thyst in 1, 2, 4, or 6 consecutive measurements, the OS pin is triggered and outputs a specific level. [IMG=DS75LX Working Principle]/uploadpic/THESIS/2007/12/2007121812102236116I.jpg[/IMG] The internal structure of the DS75LX mainly consists of the address, I/O port control unit, precision reference source, sampling regulator, and accessible registers. For users, it is only necessary to understand the address, I/O port control unit, and accessible registers of the DS75LX, because all operations of the DS75LX are implemented by reading and writing accessible registers through the serial I/O port. 3.1 DS75LX Configuration Register The DS75LX configuration register is shown in Table 2. This register is readable and writable, allowing the user to select different functions. These functions include alarm output type, temperature measurement resolution, etc. [IMG=DS75LX Configuration Register]/uploadpic/THESIS/2007/12/2007121811470755400G.jpg[/IMG] 3 DS75LX Internal Structure Explanation of the meaning of each bit in this register: The highest bit is a reserved bit, and its read value is 0; the values of bits R1 and R0 determine the number of bits of temperature data output by the DS75LX. When R1 and R0 are 00, 01, 10, or 11 respectively, the DS75LX outputs 9, 10, 11, or 12 bits of valid temperature data respectively; the values of bits F1 and F0 determine the number of consecutive temperature measurements required to trigger the OS pin. When F1 and F0 are 00, 01, 10, and 11 respectively, the corresponding number of continuous temperature measurements are 1, 2, 4, and 6. The value of the POL bit determines whether the OS pin is high or low when triggered. When POL=0, the OS pin outputs a low level when triggered; when POL is 1, the OS pin outputs a high level when triggered. When TM=0, the temperature alarm module operates in comparator mode; when TM=1, the temperature alarm module operates in interrupt mode. When SD=1, the DS75LX is in shutdown mode, and the DS75LX does not perform temperature acquisition. When SD=0, the DS75LX is in normal operating condition. All bits of this configuration register are 0 upon power-up. 3.2 Accessible Registers of the DS75LX The DS75LX has four user-accessible registers: the temperature register, the configuration register, the temperature hysteresis register, and the alarm threshold register. The temperature register is a read-only register used to store measured ambient temperature data. The alarm threshold register and the temperature hysteresis register are both read/write registers used to provide user-programmable alarm temperature values. If the ambient temperature drifts beyond the programmed setting, the temperature alarm pin outputs an alarm signal. 3.3 Register Pointer The register pointer provides the user with the address of the register to be accessed; the content of the register pointer is the address of the accessible register. Since the DS75LX contains only four accessible registers, only the lower two bits (P1, P0) of the register pointer are valid. When accessing a register, it must be ensured that the register pointer is pointing to that register. The correspondence between the values of P1 and P0 and the accessible registers is shown in Table 3. [IMG=Register Pointer]/uploadpic/THESIS/2007/12/20071218114712364760Q.jpg[/IMG] 3.4 Output Temperature Data Format The DS75LX converts the measured temperature into 16-bit binary two's complement form and stores it in a two-byte temperature register. The highest bit is the sign bit; a value of 0 indicates that the measured temperature is above 0°C, and vice versa. The lower four bits of the lower byte are unused and have a value of 0. When the DS75LX outputs 12-bit temperature data (i.e., the DS75LX has 12-bit resolution), bits 15 to 4 of the temperature register are valid temperature data. Similarly, when the resolutions are 11, 10, and 9 bits, the corresponding valid temperature data are bits 15 to 5, bits 15 to 6, and bits 15 to 7 of the temperature register, respectively. 3.5 Two-wire serial bus: Read and write operations on the DX75LX are implemented through a two-wire serial bus interface, which is compatible with the I2C bus. Figure 2 shows the timing diagram for reading the temperature and temperature threshold registers. It is assumed that the register pointer is already pointing to the temperature register; otherwise, the pointer needs to be set. The setting method is as follows: the master device generates a start bit, sends a write command containing the DS75LX address, receives an acknowledgment, and sends the register pointer byte. Note that only the lower two bits (P1 and P0 bits) of the pointer byte are valid. [IMG=Two-wire serial bus]/uploadpic/THESIS/2007/12/2007121811471925429W.jpg[/IMG] 4 DS75LX and PIC Microcontroller Interface Circuit The hardware interface circuit between the DS75LX and the PIC microcontroller is very simple, as shown in Figure 3. Since the PIC16F737 has an I2C bus interface, you only need to connect the clock and data pins of both to the corresponding pins. Both the clock and data lines must be connected to the power supply through pull-up resistors. This article assumes that the three address input pins of the DS75LX are grounded, in which case the address of the DS75LX is 1001000. [IMG= DS75LX and PIC Microcontroller Interface Circuit]/uploadpic/THESIS/2007/12/2007121811472521787U.jpg[/IMG] 5 Software Design The software design includes the initialization program for the DS75LX and the PIC microcontroller, and a subroutine for reading temperature data. Due to space limitations, the subroutine for the PIC microcontroller to read the temperature data output by the DS75LX is given below. The timing diagram for this subroutine is shown in Figure 2. C language programming is used, and the compiler is the PICC programming environment MPLAB IDE. This program can be implemented using either polling or interrupt methods. This article utilizes the polling interrupt flag SSPIF. The specific program code is as follows: [IMG=Program Code]/uploadpic/THESIS/2007/12/2007121811473239953X.jpg[/IMG] 6 Conclusion This article mainly introduces the working principle of the DS75LX digital temperature sensor and its interface design with a microcontroller. The DS75LX features high measurement accuracy and adjustable resolution. The DS75LX's chip select pin has tri-state inputs. With the same number of address pins, compared to other similar devices, the DS75LX has more address combinations available, making it very suitable for multi-point temperature measurement systems. At the same time, the DS75LX's two-wire serial interface simplifies the hardware interface design with the microcontroller. The DS75LX is compact and can be widely used in small base stations, routers, servers, and portable thermometers.