MAX6675 is a Temperature sensor IC (0 to 1024 °C) made by Analog Devices(Maxim Integrated). This posting will provide the OSS-ECAL(Open Source Software for Electronic Components Abstraction Layer) for MAX6675.
MCU interface : SPI
CAUTION:Please be sure to refer to the latest version of the Datasheet prior to actual design.
MAX6675
General description
The MAX6675 performs cold-junction compensation and digitizes the signal from a type-K thermocouple. The data is output in a 12-bit resolution, SPI-compatible, read-only format.
This converter resolves temperatures to 0.25°C, allows readings as high as +1024°C, and exhibits thermocouple accuracy of 8 LSBs for temperatures ranging from 0°C to +700°C.
The MAX6675 is available in a small, 8-pin SO package.
Feature
- Direct Digital Conversion of Type -K Thermocouple Output
- Cold-Junction Compensation
- Simple SPI-Compatible Serial Interface
- 12-Bit, 0.25°C Resolution
- Open Thermocouple Detection
Application
- Industrial
- Appliances
- HVAC
OSS-ECAL specification
API Function
etSTS oMAX6675( etCMD cmd, stMAX6675_O* rlt )
The oMAX6675 function is an API function that executes MAX6675 processing according to the command in the argument.
NOTE:
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_MIN | Minimum temperature error (rlt.temperature is minimum temperature) | ||
eSTS_ERR_MAX | Maximum temperature error (rlt.temperature is maximum temperature) | ||
eSTS_ERR_COMMAND_CODE | Command selection error | ||
eSTS_ERR_SPI_OBJECT | SPI object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_SPI | HAL SPI error | ||
Parameter IN | etCMD cmd | OSS-ECAL command code | |
eCMD_CONFIG | Commands to set up SPI communication for MCU. 1. Set up SPI communication for MCU. | ||
eCMD_READ | Command to read Register value, convert Register value and save to rlt. 1. SPI send & receive. 2. Stores received values in rlt.dummy and rlt.ti, rlt.id, rlt.ste. 3. Convert received data to Temperature. Temperature = (Register b14-b3) / Gain (Min, Max Limit) 3. Store Temperature in rlt.temperature. | ||
Parameter OUT | stMAX6675_O* rlt | Receive data from MAX6675 | |
float32 temperature | Register b14-b3 to float Temperature[℃] 0.0~1023.75℃ | ||
uint8 dummy | Register b15 to bit0 Dummy | ||
uint8 ti | Register b2 to bit0 THERMOCOUPLE | ||
uint8 id | Register b1 to bit0 DEVICE ID(only 0) | ||
uint8 ste | Register b0 to bit0 STATE |
etSTS oMAX6675_CONFIG(void)
The oMAX6675_CONFIG function is an API function that set up SPI communication for the MCU.
- Set up SPI communication for MCU.
NOTE:
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_SPI_OBJECT | SPI object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_SPI | HAL SPI error |
etSTS oMAX6675_READ( stMAX6675_O* rlt )
The oMAX6675_READ function is an API function that reads the Register value of MAX6675, converts the Register value and stores it in rlt.
- SPI send & receive.
- Stores received values in rlt.dummy and rlt.ti, rlt.id, rlt.ste.
- Convert received data to Temperature.
Temperature = (Register b14-b3) / Gain
(Min, Max Limit) - Store Temperature in rlt.temperature.
Return value | etSTS | OSS-ECAL status code | |
eSTS_FIN | Completed successfully | ||
eSTS_ERR_MIN | Minimum temperature error (rlt.temperature is minimum temperature) | ||
eSTS_ERR_MAX | Maximum temperature error (rlt.temperature is maximum temperature) | ||
eSTS_ERR_SPI_OBJECT | SPI object selection error | ||
eSTS_ERR_OTHERS_RUN | Other components are executing the process | ||
eSTS_ERR_HAL_OTHERS_RUN | Other application is running HAL | ||
eSTS_ERR_HAL_SPI | HAL SPI error | ||
Parameter OUT | stMAX6675_O* rlt | Receive data from MAX6675 | |
float32 temperature | Register b14-b3 to float Temperature[℃] 0.0~1023.75℃ | ||
uint8 dummy | Register b15 to bit0 Dummy | ||
uint8 ti | Register b2 to bit0 THERMOCOUPLE | ||
uint8 id | Register b1 to bit0 DEVICE ID(only 0) | ||
uint8 ste | Register b0 to bit0 STATE |
Files
Folder* | File | summary |
---|---|---|
MAX6675_HALNAME_VERSION/sample | sample.c (.cpp) | Sample Application Program |
| sample.h | Sample Application Header |
MAX6675_HALNAME_VERSION | oMAX6675.c (.cpp) | OSS-ECAL Program for MAX6675 |
| oMAX6675.h | OSS-ECAL Header for MAX6675 |
MAX6675_ARDUINO.ino | Sample application programs for Arduino | |
| oss_ecal.h | OSS-ECAL Common Header (Ver 01.01.00 or later, AUTOSAR is Ver 01.01.07 or later) |
| user_setting.c (.cpp) | Const and Table of User setting |
| user_setting.h | Header of User setting |
oHAL_i2c_stm32f4.c | HAL Program for STM32Cube FW_F4 | |
oHAL_i2c_stm32f4.h | HAL Header for STM32Cube FW_F4 | |
| readme.md | Readme |
| OSS-ECAL Terms of Use.txt | OSS-ECAL Terms of Use |
* For HALNAME, please refer to HAL Support.
HAL Support List
HAL | MCU* | Development environment* | HALNAME |
---|---|---|---|
Arduino 1.8.6 | ATmega2560 ATmega328P | Mega 2560 Rev3 Arduino Pro Mini 3.3V | ARDUINO |
ARM Mbed 6.17.0 | STM32F401RE | STM32 Nucleo-64 boards | MBED |
Infineon ModusToolbox HAL Cat1 2.4.3 | CYBLE-416045-02 | CY8CPROTO-063-BLE PSoC 6 BLE Prototyping Kit | ModusToolbox |
NXP MCUXpresso SDK iMXRT1051B_1052B ksdk2_0 | MIMXRT1052DVL6A | IMXRT1050-EVKB | iMXRT1051B1052B |
Renesas SSP 2.4.0 | R7FS7G27H3A01CFC | S7G2 SK | SSP |
STM STM32Cube FW_F4 V1.27.1 | STM32F401RE | STM32 Nucleo-64 boards | STM32F4 |
Debian(Linux) v2022.04 | TI AM335x | BeagleBone Black – Rev C | Linux |
* MCU and development environment at the time of development. Even if the same HAL is used, different MCUs and development environments may not work together.
OSS-ECAL Download
Please login before downloading. To register as a new user, please click here.
Built-in How to
How to incorporate OSS-ECAL into user programs
How to incorporate multiple OSS-ECALs in a user program (same MCU function)
How to incorporate multiple OSS-ECALs in a user program (different MCU function)
How to incorporate multiple identical electronic components into a user program
How to reduce the impact on user programs by replacing electronic components
CAUTION
The sample version of OSS-ECAL is not intended to be used with Threads (Tasks) or interrupts of different priority. Please do not use it as in the example below.
Example: If each sensor is assigned to the same ADC group and the OSS-ECAL API is executed in processes with different priorities, correct values may not be obtained.
ADC Gr0 Ch0 Temperature sensor AD22100A 100ms cycle Thread (low priority) to take in temperature
ADC Gr0 Ch1 Pressure sensor MPX5999D Event interrupts (high priority) to take pressure