In this guide we show how to render menu items using LiquidCrystalIO library, onto displays compatible with HD44780 (often referred to as LCD). This rendering driver is built into the core menu designer download, meaning it’s available out of the box.
The LiquidCrystalIO library is a fork of the LiquidCrystal library, with a few additional capabilities. Most importantly, updating HD44780 displays is slow, think 270Khz slow. This library avoid long pauses by using task manager for managing these delays, so is uniquely able to keep your tasks running in the mean time. In addition you can configure exactly what type of IO device you are using too.
First, ensure your menu structure is saved and then choose Code -> Generate Code from the menu. Once the code generation dialog appears, to the right of the current display type will be a button named “Change”. Click this button and choose one of the following new drivers by clicking select on the right.
Image showing LiquidCrystalIO renderer choices
The “display direct or other i2c” option is for the situation where you either have a non-standard i2c backpack or are using Arduino pins other than the DFRobot layout.
The “commonly available i2c option” is for standard I2C backpacks, that adhere to the regular layout.
The last option is for when you have a DF Robot shield wired to an 8bit device.
Depending on which of the above options you picked, some additional properties may be added:
For Display direct or non-standard I2C
Image showing property choices for Adafruit_GFX rendering
D4-D7, RS and EN pins: These set the pins onto which you have connected the various display pins. Take note from your wiring of which pins you have used and configure them here.
LCD_BACKLIGHT: Optionally allows the backlight pin to be set If you don’t have a backlight leave as -1.
LCD_PWM_PIN: Allows for automatic use of PWM contrast, see the link to the wiring guide above (leave at -1 if not used).
LCD_IO_DEVICE: If you’re using a non-standard I2C / SPI expander arrangement, you can set it up in your sketch as an IoAbstractionRef and refer to it here. See configuring an IoAbstractionRef for that device. This parameter can be left blank, but if it is set, you must create an IoAbstractionRef as a global variable in your code.
See the takeOverDisplay example packaged with the menu library.
For Commonly available I2C
Image showing property choices for Adafruit_GFX rendering
LCD_WIDTH, LCD_HEIGHT: Set these to the width and height of your display. For example 16x2 or 20x4.
I2C_ADDRESS: Sets the I2C address that your display is on, often 0x20.
PIN_LAYOUT: I2C displays mainly fall into two categories, either with EN on pin0, or RS on pin 0. Try each of these if you are not sure. If your display does not work with either, use the above “display direct or non standard i2c option”.
For commonly available backpacks there are fewer configuration items to change. Firstly, the width and height of the display must be set along wi
We use cookies to analyse traffic and to personalise content. We also embed Twitter, Youtube and Disqus content on some pages,
these companies have their own privacy policies.
Please see our privacy policy should you need more information
or wish to adjust your settings.