Library for interfacing Texas Instruments TMP112 family temperature sensors
The TMP112 family of devices are digital temperature sensors designed for high-accuracy, low-power, NTC/PTC thermistor replacements where high accuracy is required. -) I2C interface with communication speed up to 2.85 MHz -) Four user selectable addresses (chosen by chip pin) -) Temperature range: -40 to 125°C -) Resolution: 12 Bits (0.0625°C)
typical I2C clock speed to be used (400kHz, I2C Fast-Mode)
Available TMP112 I2C addresses
Configuration Register configuration bits
Number of fault conditions required to generate an alert (Configuration register, bit 11-12)
Conversion Rate Settings (Configuration register, bit 6-7)
Initializes i2c communication with the TMP112 and prepares the TMP112 for use
First copies the I2C port and address to the transferred empty device handle. Afterwards the configuration register is read to ensure that the TMP112 is present. Finally, the configuration register is set to PowerOn default settings (i.e. Continuos conversion mode with a conversion rate of 4Hz)
Activates the TMP112 by modifing the configuration register
Triggers a single conversion
Reads temperature from the TMP112
Writes the temperature limits to the TLOW and THIGH registers of the TMP112. Optionally, it is also possible to specify whether the comperator mode or the interupt mode should be used, as well as the number of fault conditions required to generate an alert
Reads the current value of the temperature limits from the TMP112, which are stored in the TLOW and THIGH registers
Sets the TMP112 into shutdown mode. (i.e. all device circuitry other than the serial interface are switched off) and thus grants minimum power consumption
When accessing the configuration register, only the SD bit is set. All other bits of the register remain unchanged
absolute maximum I2C clock speed (2.85MHz, I2C High-Speed-Mode)
Pointer addresses of the registers available in the TMP112 (Address | R/W | Default | Description)
Reads a value from a TMP112 register
This function checks the given register and converts the byte array to be read into a s32 cell. The first byte after slave address containing pointer address information is sent to the TMP112. After that, the TMP112 responds with the requested data frames after the second slave address byte. See the read word format in the datasheet for the timing diagrams.
Writes a value to a TMP112 register
This function checks the given register and converts the value to be written into an array of bytes. The first byte after slave address contains pointer address information, followed by the actual data to be written. See the write word format in the datasheet for the timing diagrams.