48 lines
2.6 KiB
Markdown
48 lines
2.6 KiB
Markdown
I²C adapter for Hitachi HD44780-based LCD modules, such as LCM1602.
|
|
|
|
purpose
|
|
=======
|
|
|
|
LCM1602 are simple LCD modules, with 2 lines, and 16 characters each.
|
|
There are very common, cheap, and sufficient to display text for simple projects.
|
|
The LCD is driven by a Hitachi HD44780.
|
|
Its interface requires 6 to 12 lines, and very good knowledge of the protocol and its timing.
|
|
Also, most LCM1602 operate at 5V, while most micro-controllers operate at 3.3V.
|
|
|
|
The I²C to HD44780 adapter removes all the burden:
|
|
|
|
- it requires only 2-lines for the I²C bus, which can be shared with other I²C devices
|
|
- it takes care of proper LCD initialisation, with corresponding timing
|
|
- you don't need to drive the data lines yourself, contrary to the I²C LCD backpack
|
|
- you can directly send ASCII text to be display on the 2 lines
|
|
- you can still send raw HD44780 messages
|
|
- it can control the back light, with brightness setting
|
|
- it includes LCD contrast setting
|
|
- it can operate at 5V (required by the LCD) with 3.3V I²C interface (required by most MCU)
|
|
|
|
usage
|
|
=====
|
|
|
|
Connect or solder the I²C to HD44780 adapter on the back of the LCM1602 LCD using the pins on the top.
|
|
The side with all the parts must still be visible and pointing downwards.
|
|
|
|
Connect the I²C to HD44780 adapter to your micro-controller using the I²C pins on the left.
|
|
Provide the LCD operating voltage on VCC, most of the time 5V.
|
|
|
|
You can set the LCD contrast by turning the potentiometer labeled CONTRAST.
|
|
This needs to be adjusted depending on the operating voltage, angle, and temperature.
|
|
|
|
The I²C lines should be pulled up by your board, since this is just one slave device and your board is the master.
|
|
This also allows you to operate the I²C bus at 3.3V, even if the LCD operates at 5V.
|
|
If you don't want to pull up the I²C lines externally, you can solder 1-10 kOhm 0603 chip resistors on the I²C to HD44780 adapter board, at the place marked I²C PU.
|
|
The I²C lines will then be pulled up to the LCD operating voltage.
|
|
|
|
By default, the I²C to HD44780 adapter is reachable at I²C address 0x47.
|
|
You can set the 3 last bits to 0 by creating a solder bridge at the place marked 2 1 0.
|
|
|
|
By default the LCD is initialized as 2-lines, 5x8 dots, no cursor or blinking.
|
|
To display text on line 1, select the I²C to HD44780 adapter I²C slave, write 1 followed by the ASCII text.
|
|
To display text on line 2, select the I²C to HD44780 adapter I²C slave, write 2 followed by the ASCII text.
|
|
In case the display is in a very weird state and does not update text, you can re-initialize it by writing 0 after selecting it.
|
|
More commands are described in the [firmware](https://git.cuvoodoo.info/kingkevin/stm8s/src/branch/i2c_hd44780).
|