Maxim Integrated / MAX31725_Accurate_Temperature_Sensor

Dependents:   MAX31725_High_Temperature_Accurate_IC

Embed: (wiki syntax)

« Back to documentation index

MAX31725 Class Reference

Digital thermometer, thermostat, temperature sensor. More...

#include <max31725_cpp.h>

Public Member Functions

 MAX31725 (I2C &i2c_bus, uint8_t slave_address)
 Constructor for MAX31725 Class.
 ~MAX31725 ()
 Default destructor for MAX31725 Class.
int read_cfg_reg (uint8_t *value)
 Read register of device at slave address.
int read_reg16 (int16_t *value, char reg)
 Read register of device at slave address.
float read_reg_as_temperature (uint8_t reg)
 Reads the temperature registers.
int write_cfg_reg (uint8_t cfg)
 Writes to the configuration register.
int write_trip_low_thyst (float temperature)
 Writes to the THYST register.
int write_trip_high_tos (float temperature)
 Writes to the TOS register.
float celsius_to_fahrenheit (float temp_c)
 Converts Celsius degrees to Fahrenheit.

Protected Member Functions

int write_reg16 (int16_t value, char reg)
 Write a value to a register.

Detailed Description

Digital thermometer, thermostat, temperature sensor.

Version:
1.0000.0002

The MAX31725, MAX31726 temperature sensors provides accurate temperature measurements. Extended format allows for high temperature readings up to 150°C. The MAX31725 can operate in a low powered mode by utilizing the shutdown and one-shot mode. 8-pin TQDFN 3x3 mm package Accuracy is +-0.5°C from -40°C to +105°C (-40°F to +221°). Operating temperature: -55°C to +150°C (-67°F to +302°). VDD: 2.5V to 3.7V.

 #include "mbed.h"
 #include "max32630fthr.h"
 #include "max31725.h"
 #include "USBSerial.h"
 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); 
 I2C i2cBus(P3_4, P3_5);
 int main()
 {
     float temperature;
     DigitalOut rLED(LED1, LED_OFF);
     DigitalOut gLED(LED2, LED_OFF);
     DigitalOut bLED(LED3, LED_OFF);
     gLED = LED_ON;
     MAX31725 temp_sensor(i2cBus, MAX31725_I2C_SLAVE_ADR_00);
     i2cBus.frequency(400000);
        temperature =
            temp_sensor.read_reg_as_temperature(MAX31725_REG_TEMPERATURE);
        printf("Temperature = %3.4f Celsius, %3.4f Fahrenheit\r\n", 
            temperature, temp_sensor.celsius_to_fahrenheit(temperature));
 }

Definition at line 78 of file max31725_cpp.h.


Constructor & Destructor Documentation

MAX31725 ( I2C &  i2c_bus,
uint8_t  slave_address 
)

Constructor for MAX31725 Class.

Allows user to use existing I2C object

On Entry:

Parameters:
[in]i2c_bus- pointer to existing I2C object
[in]i2c_adrs- 7-bit slave address of MAX31725

On Exit:

Returns:
None

Definition at line 44 of file max317275_cpp.cpp.

~MAX31725 ( void   )

Default destructor for MAX31725 Class.

Destroys I2C object if owner

On Entry:

On Exit:

Returns:
None

empty block

Definition at line 53 of file max317275_cpp.cpp.


Member Function Documentation

float celsius_to_fahrenheit ( float  temp_c )

Converts Celsius degrees to Fahrenheit.

Parameters:
temp_c- the temperature in Celsius degrees
Returns:
temperature in Celsius degrees

Definition at line 203 of file max317275_cpp.cpp.

int read_cfg_reg ( uint8_t *  value )

Read register of device at slave address.

Parameters:
[out]value- Read data on success
Returns:
0 on success, negative number on failure

Definition at line 59 of file max317275_cpp.cpp.

int read_reg16 ( int16_t *  value,
char  reg 
)

Read register of device at slave address.

Parameters:
[out]value- Read data on success
reg- Register address
Returns:
0 on success, negative number on failure

Definition at line 84 of file max317275_cpp.cpp.

float read_reg_as_temperature ( uint8_t  reg )

Reads the temperature registers.

Parameters:
reg- the address of the temperature register
Returns:
temperature in degrees Celsius

Definition at line 118 of file max317275_cpp.cpp.

int write_cfg_reg ( uint8_t  cfg )

Writes to the configuration register.

Parameters:
cfg- configurate word
Returns:
0 on success, negative number on failure

Definition at line 164 of file max317275_cpp.cpp.

int write_reg16 ( int16_t  value,
char  reg 
) [protected]

Write a value to a register.

Parameters:
value- value to write to the register
reg- register address
Returns:
0 on success, negative number on failure

Definition at line 138 of file max317275_cpp.cpp.

int write_trip_high_tos ( float  temperature )

Writes to the TOS register.

Parameters:
temperature- the temperature in Celsius degrees
Returns:
0 on success, negative number on failure

Definition at line 194 of file max317275_cpp.cpp.

int write_trip_low_thyst ( float  temperature )

Writes to the THYST register.

Parameters:
temperature- the temperature in Celsius degrees
Returns:
0 on success, negative number on failure

Definition at line 185 of file max317275_cpp.cpp.