i2c to lcd interface.pdf
(
24 KB
)
Pobierz
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
VDD
SDA
SCL
INT
P7
P6
+5V
A0
A1
A2
P0
P1
P2
P3
VSS
AVR- PortD.7
Gnd
AVR- PortD.6
LCD- D4
LCD- D5
n.c.
LCD- E1 (or E on 1 and 2 line LCD)
LCD- E2 (or n.c. on 1 and 2 line LCD)
P5
LCD- RW (not used, connected to give proper voltage)
LCD- D7
Gnd
P4
LCD- RS
A0, A1 and A2 gives the addres
s 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
Plik z chomika:
Koltech
Inne pliki z tego folderu:
efy-fm-proof-article.pdf
(335 KB)
flowmeter.pdf
(129 KB)
gp2d02.pdf
(74 KB)
i2c to keyboard interface.pdf
(29 KB)
i2c to lcd interface.pdf
(24 KB)
Inne foldery tego chomika:
! Reference
Bascom 8051
BASCOM AVR
Datasheet
Inne
Zgłoś jeśli
naruszono regulamin