LCD 16×2 using I2C in LPC2148
In this tutorial, I am going to show you How to connect LCD using I2C with an ARM7 mcrocontroller. I am using LPC2148 but the process is same for other ARM7 devices. PCF8574 acts as an I2C extender and is being used to connect LCD with the LPC2148.
First of all let’s see the connections between the PCF8574 and the LCD.
As shown in the figure, connect the first pin of the PCF8574 to the VSS of the LCD, 2nd pin to the VCC and so on. The input pins of the PCF8574 i.e. SCL and SDA should be connected with the SCL and SDA of the microcontroller. LPC2148 do not have internal pull-ups so we need to connect external pull-up resistors (around 4k) with the SCL and SDA pins. More connections are given below…
Data transmission via I2C require some steps to be followed. They are as follows:
Start -> Write Address -> Write data -> Stop to write data to the slave. I am going to cover only writing data to the slave and not reading from slave.
The following are the functions used during an I2C transmission:
The following are the functions used for writing data to the LCD:
Copy all these header files to a location and add the path to the C/C++ in the project setting as shown in the picture below
You can see the “hello!” is printed on the display in the proteus. For more working, see the video below
. . . . . DOWNLOAD . . . . .
You can buy me acontrollerstech
coffeeSensor by clicking DONATE OR Just click DOWNLOAD to download the code
- WavePlayer using STM32 Discovery January 16, 2021
- How to use SPI in LPC2148 December 26, 2020
- STM32 ADC MULTI CHANNEL WITHOUT DMA December 24, 2020
- Send and Receive data to PC without UART (STM32 USB COM) December 10, 2020
- STM32 GPIO INPUT Configuration December 4, 2020
- STM32 GPIO OUTPUT Config using REGISTERS November 24, 2020