-
Notifications
You must be signed in to change notification settings - Fork 1
I2C_LCD
Table of content
The 8039 Assembler file i2c_lcd.src is an example to write text on a LCDisplay (4bit addressing) with an i2C protocol. The interface between I2C and the 4bit parallel data will be managed by an globasl I21C portexpander pcf8574.
The I2C portexpander has an 8bit bidirectional GPIO port and a 3bit address.
The I2C Addresspins are connected with pullup-resistors, without changing the
write default address are 01001110 = $4E.
On the internet i found diversity circuits between portexpander and LCD connections.
I bought mine from AZ-Delivery.
Port connections
Expander | LCD | Remark for LCD |
---|---|---|
P10 | RS | Register Select |
P11 | R/W | Read (high) or Write (low) mode |
P12 | E | Enable Display (data must be valid on falling edge) |
P13 | K | LCD background light |
P14 | DB4 | Databit 0 (4bit mode) |
P15 | DB5 | Databit 1 (4bit mode) |
P16 | DB6 | Databit 3 (4bit mode) |
P17 | DB7 | Databit 4 (4bit mode) |
At PowerUp, the LCDisplay must be run through an sequential init sequence with defined delays.
- See in detail the HD44780U LCD 4bit initsequence.
The LCDisplay are able to work in 8bit or 4bit datamode. When a 4bit datamode are select, then write first the high nibble and afterwards the low nibble of the command (RS=0) or data byte (RS=1).
Only on the fourth try to set the command "Function Set", the setting of the interface data length of 8bit or 4bit
(DL: 1=8bit, 0=4bit) are valid.
- See in detail the HD44780U LCD Datasheet.
There are an interesting links about the LCD mystery on the webpage of Donald Weiman.
NOTE: On falling edge of pin E, the address or data must be stable at that point..
The LCD Controller HD44780U can address the memory for max. 80 Characters.
The memory are organized into two memory lines. The amount of lines can
be configured within the bit "N" in the LCD "Function Set" command (N=1: 2 lines, N=0: 1 line).
An 4x20 LCDisplay memory are organized in:
- $00 - $13 addressing row one.
- $14 - $27 addressing row two.
- $28 - $3F (memory gap).
- $40 - $53 addressing row three.
- $54 - $67 addressing row four.
See Schematic details below:
See the SALEAE logicdata files for the Assembler file within the MC1000_I2C repository.
Display Output
Write of "Function Set" (2 x 4bit)
Complete Sequence
Custom Footer
MC1000 with Intel 8039