LM35 is an integrated-circuit temperature device with an output voltage linearly proportional to the centigrade temperature. As LM35 is not calibrated in Kelvin, user does not require to subtract large constant voltage from the output to obtain convenient centigrade scaling.
So here I am starting I2C tutorial in STM32. I know it’s early because we still need to go through some basic things before jumping to I2C but the problem is LCD. It takes a whole lot of efforts to interface LCD using conventional methods, but by using I2C, we can do it really easy. I will cover other ways to interface LCD later in upcoming tutorials. Before using I2C to interface LCD, let’s first write a simple code to know about I2C functions.
To change the address we are provided with A0, A1 and A2 pins.
By default these three pins are high so the address by default is 01001110 which is 0x4E. To change the address of this device, you have to connect any/all of these three pins to ground, which is provided just above them. So let’s say you connected A0 to ground, new address will be 01001100 which is 0x4B. In this manner, we can connect upto 8 LCDs to the same line.
First start (S) is transmitted by microcontroller. Next uc sends address of the device, on receiving address, device sends the A (ack) signal back to uc.
Next uc sends data bits (04, 00, 24, 20). After receiving each data byte, device sends the A(ack) to uc.
At last uc sends P( stop) signal to indicate the end of communication.