Skip to main content

I2C and LM75 Temperature Sensor communication example


(C) COPYRIGHT 2015 WIZnet Co.,Ltd.

  • file : I2C/I2C_Temperture_LM75A/readme.md
  • author : IOP Team
  • version : V1.0.0
  • date : 1-May-2015
  • brief : Description of the I2C and LM75 Temperature Sensor communication example.

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, WIZNET SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.


Example Description#

This example provides a description of how to use I2C to communicate with a LM75 I2C temperature sensor is mounted on the evaluation board and used to get instantaneous external temperature.


Directory contents#

  • I2C/I2C_Temperture_LM75A/main.c (Main program)
  • I2C/I2C_Temperture_LM75A/W7500x_it.c (Interrupt Handlers)
  • I2C/I2C_Temperture_LM75A/W7500x_it.h (Interrupt Handlers Header file)
  • I2C/I2C_Temperture_LM75A/W7500x_conf.h (Library Configuration file)
  • I2C/I2C_Temperture_LM75A/MDK//W7500x_I2C_Temperture_LM75A.uvproj (Project file)
  • I2C/I2C_Temperture_LM75A/GCC/Makefile (GCC Make file)

Hardware and Software environment#

--W7500-- --LM75--
| | | |
| SDA |------| SDA |
| SCL |------| SCL |
| | | |
| | | |
--------- ---------

LM75 Pin Configuration#

-----
SDA |1 8| VCC
SCL |2 7| A0
OS |3 6| A1
GND |4 5| A2
-----

LM75 Pin Description#


PINSYMBOLDESCRIPTION
1SDADigital I/O. I2C serial bi-directional data line. Open Drain
2SCLDigital input. I2C serial clock input.
3OSOvertemp Shutdown output. Open Drain.
4GNDGround. To be connected to the system ground.
5A2Digital input. User-defined address bit2.
6A1Digital input. User-defined address bit1.
7A0Digital input. User-defined address bit0.
8VCCPower supply.

LM75 register#

REG NAMEAddrR/WRST ValueDESCRIPTION
Temp0x00R/W0x0000Configuration Register.
Contains a single 8-bit data byte.
To set the device operating condition
Default = 0.
Conf0x01RN/ATemperature Register.
Contains two 8-bit data bytes.
To store the measured Temp data.
Thyrs0x02R/W0x5000Over-temp Shutdown threshold Register.
Contains two 8-bit data bytes.
To store the over-temp shut-down Tos limit.
Default = 80c
Tos0x03R/W0x4B00Hysteresis Register.
Contains two 8-bit data bytes.
To store the hysteresis Thyst limit.
Default = 75C.

LM75 Device Address#

--- --- --- --- --- --- ---
| 1 | 0 | 0 | 1 |A2 | A1| A0|
--- --- --- --- --- --- ---
LSB

LM75 Temp register table#

Temp MS byteTemp LS byte
MSBLSBMSBLSB
B7B6B5B4B3B2B1B0B7B6B5B4B3B2B1B0
Temp data(11bits)Not Used
MSBLSBMSBLSB
D10D9D8D7D6D5D4D3D2D1D0XXXXX

How to use it ?#

In order to make the program work, you must do the following :

  • Open your preferred toolchain.
  • Rebuild all files and load your image into target memory.
  • Run the example.
  • WIZwiki W7500 where the Flash memory density ranges 128Kbytes.
  • If you have any questions, please use the forum site.

Flow Chart#

  • Master Init
  • Slave address send from W7500 to LM75
  • START enable
  • Confirm the Ack Receive
  • Send the data from W7500 to LM75
  • Restart enable
  • Confirm the Ack Receive
  • Receive the data
  • Transmit the Ack transmission
  • STOP enable

ยฉ COPYRIGHT 2015 WIZnet Co.,Ltd.