0% found this document useful (0 votes)
1K views1 page

I2c To LCD Interface

This document describes how to interface an LCD to an AVR microcontroller using an I2C PCF8574 I/O expander module. With only two pins from the microcontroller, the PCF8574 module translates signals to control the LCD. The library replaces BASCOM LCD calls and requires defining the I2C pins, PCF8574 address, and a byte to control the LCD lines. The PCF8574 connects the LCD data and control lines to the microcontroller I2C pins.

Uploaded by

TTM_SOBI
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views1 page

I2c To LCD Interface

This document describes how to interface an LCD to an AVR microcontroller using an I2C PCF8574 I/O expander module. With only two pins from the microcontroller, the PCF8574 module translates signals to control the LCD. The library replaces BASCOM LCD calls and requires defining the I2C pins, PCF8574 address, and a byte to control the LCD lines. The PCF8574 connects the LCD data and control lines to the microcontroller I2C pins.

Uploaded by

TTM_SOBI
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

I2C to LCD interface

Here follows a short description on how to use my i2c_lcd library, with this you could use any
AVR circuit with a LCD with minimal extra hardware. The interface from the i2c to LCD
consists of a PCF8574 8bit I/O module, so with only 2 pins you could interface to the LCD.
The library replaces BASCOM:s LCD calls, so you only need to address the library and
configure the i2c pins and that’s it.

What you need to add in the beginning of your program is the following:

$lib "Lcd_i2c.lib"
Const Pcf8574_lcd = &H40
Config Scl = Portd.6
Config Sda = Portd.7
Dim _lcd_e As Byte
_lcd_e = 128

Yes, there is one thing added, the _lcd_e byte, it’s used to control which half of a 4-line LCD
to use, with 128 controlling the upper half (or a 2-line LCD) 64 controls the lower half and
192 when you what to control both halves at the same time (Cls, Deflcdchar)

The PCF8574 is connected as follows:

PCF8574
A0 VDD +5V
A1 SDA AVR- PortD.7
Gnd A2 SCL AVR- PortD.6
LCD- D4 P0 INT n.c.
LCD- D5 P1 P7 LCD- E1 (or E on 1 and 2 line LCD)
P2 P6 LCD- E2 (or n.c. on 1 and 2 line LCD)
LCD- D7 P3 P5 LCD- RW (not used, connected to give proper voltage)
Gnd VSS P4 LCD- RS

A0, A1 and A2 gives the address of the chip


A0 A1 A2 Pcf8574_lcd
0 0 0 &H40
1 0 0 &H42
0 1 0 &H44
1 1 0 &H46
0 0 1 &H48
1 0 1 &H4A
0 1 1 &H4C
1 1 1 &H4E

You might also like