Over the years, vendors have introduced a large assortment of temperature-measuring semiconductor devices with varying interfacing techniques. One of the latest of these, Maxim’s MAX6577, can measure temperature over a range of −40°C to 125°C. The device has a single-wire interface and requires few external components. It converts temperature into a square wave with a frequency proportional to the absolute temperature (K).
The MAX6577 can be interfaced to a PC through its parallel port (see the figure). A 0.1-µF ceramic bypass capacitor, placed close to the power pins of IC1, is used to minimize the effect of external noise.
The frequency of the output square wave (fOUT = 1/tOUT and temperature (K) = fOUT) is calculated by the PC’s 8254’s counter2. This device operates with a clock frequency of 1.1931817 MHz (TIMER_FREQUENCY). Normally used for tone generation through the PC’s speaker, counter2 can be enabled or disabled by setting bit-0 of port 61h to one or zero, respectively. In this sensor application, counter2 operates in mode 2. It can be configured by loading the timer’s control register at port 043h with a value of 0b4h. Initially, counter2 is loaded with ffffh at port 042h in two cycles.
During operation, the input data is read continuously. With the first rising edge of the data stream, counter2 is enabled by setting bit-0 of port 61h high. Once enabled, its contents autodecrement by one count every 0.8380958 µs (1/1.1931817 MHz). The input data is then repeatedly sampled to check for the data’s transition from 1 to 0 logic. With the first falling edge, counter2 is disabled by setting bit-0 of port 61h low. As a result, the auto-decrement mode of counter2 also is disabled.
Once this occurs, counter2’s count is read back in two cycles from port 042h. The total number of counts, or elapsed_count, during which the input square wave was high, is then obtained. Using this value, the frequency of the square wave can be easily calculated (i.e., TIMER_FREQUENCY/2*elapsed_count). Therefore, the temperature (K) can be determined. The table demonstrates the relationship of output frequency to sensor temperature.
Before starting the next read cycle, counter2 is reinitialized with a count of ffffh. This process continues until the user presses the Q/q key, which terminates the program.
The software for reading the temperature data from the MAX6577 singlewire temperature sensor has been written in C (Turbo C++, version 3.0) and assembly. It was tested in MS-DOS mode of Win95 on a 450-MHz Pentium II. One of the convenient features of this software is that it can be easily modified to read data from the MAX6576 temperature sensor. This sensor converts temperature into a square wave whose period is proportional to temperature.