This note discusses the use of the
Both devices provide for a single component interface between a K-type thermocouple and a processor using an SPI serial interface. Both provide cold-junction compensation and open thermocouple detection. Both are packaged in an 8-pin SOIC package and are about $5.00 in small quantities.
The MAX6674 provides a 10-bit digital quantity over the range of 0 - 128 degrees C with a resolution of 0.125 degrees. The MAX6675 provides 12-bit resolution over the range of 0 - 1024 degrees C with a resolution of 0.25 degrees C.
Program MAX667x_1.BAS illustrates a simple loop which continually measures the temperature and diplays it to the terminal in degrees F. Note that the device type may either be set as a MAX6674 or MAX6675. The only difference is the technique for calculating the temperature.
The interface protocol is SPI, read only. CS is brought low to begin a sequence. For each of 16 bits, SCK is brought high and the Master In Slave Out (MISO) input is read. The sequence is terminated by bringing CS back to a logic one. Although, the BX24 provides the capability for multiple SPI channels to be shared with the BX24's EEPROM, I opted to simply "bit bang" the implementation.
Both the MAX6674 and 6675 provide a means for detecting if the thermocouple is open. For the MAX6674 this is a high in bit 4. For the MAX6675 this is a high in bit 2. However, note that this capability requires that the minus side of the thermocouple be grounded. This capability is not illustrated in the following but may easily be implemented;
If (GetBit(V, 4) = 1) Then Debug.Print "Open Thermocouple" End If
' MAX667x_1.Bas ' ' Illustrates an interface with the Maxim MAX6674 and 6675 K-type Thermocouple to Digital ' Converter. ' ' BX24 MAX667x ' ' Term 13 <---- MISO -------- SO (term 7) ' Term 14 -------- SCK --------- SCK (term 5) ' Term 15 -------- CS ---------- /CS (term 6) ' ' Continually performs temperature measurements and displays in degrees F to the terminal. ' ' copyright, Duncan O'Neil and Peter H Anderson, Morgan State University, Baltimore, MD, ' Jan, '04 const CS as Byte = 13 const SCK as Byte = 14 const MISO as Byte = 15 const MAX6674 as Byte = 0 const MAX6675 as Byte = 1 Sub Main() Dim Device as Byte, N as Byte Dim V as Integer Dim Tc as Single, Tf as Single Device = MAX6674 ' may also be defined as MAX6675 Do Call PutPin (SCK, 0) ' idle Call PutPin (CS, 1) Call PutPin (MISO, 2) V=0 Call PutPin (CS,0) ' begin communication sequence For N=1 to 16 ' two byte Call PutPin (SCK,1) ' clock high V = V * 2 + CInt(GetPin (MISO)) ' read MISO Call PutPin (SCK,0) Next Call PutPin (CS,1) ' end of communication sequence If Device = MAX6675 Then V = V\8 ' consider only the high 13 bits Tc = CSng(V) * 0.25 ' low two bits are quarters Else ' its a MAX6674 V = V\32 Tc = CSng(V) * 0.125 End If Tf = 1.8 * Tc + 32.0 Debug.Print CStr(V); " "; Fmt(Tf, 2) ' 2 signicant figures after dec point Call Sleep (1.0) Loop End Sub