Class HD44780Lcd

java.lang.Object
com.diozero.devices.HD44780Lcd
All Implemented Interfaces:
DeviceInterface, AutoCloseable

public class HD44780Lcd
extends Object
implements DeviceInterface

LCD with HD44780 controller.
Code based on this Raspberry-Pi Spy article, Python code.

Another source of information: https://gist.github.com/DenisFromHR/cc863375a6e19dce359d.

HD44780 Datasheet.

  • Constructor Details

  • Method Details

    • getColumnCount

      public int getColumnCount()
    • getRowCount

      public int getRowCount()
    • isBacklightEnabled

      public boolean isBacklightEnabled()
    • setBacklightEnabled

      public HD44780Lcd setBacklightEnabled​(boolean backlightEnabled)
    • setCursorPosition

      public HD44780Lcd setCursorPosition​(int column, int row)
    • setCharacter

      public HD44780Lcd setCharacter​(int column, int row, char character)
    • setText

      public HD44780Lcd setText​(int row, String text)
      Send string to display
      Parameters:
      row - Row number (starts at 0)
      text - Text to display
      Returns:
      This object instance
    • addText

      public HD44780Lcd addText​(String text)
    • addText

      public HD44780Lcd addText​(char character)
    • addText

      public HD44780Lcd addText​(int code)
    • clear

      public HD44780Lcd clear()
      Clear the display
      Returns:
      This object instance
    • returnHome

      public HD44780Lcd returnHome()
      Return the cursor to the home position
      Returns:
      This object instance
    • entryModeControl

      public HD44780Lcd entryModeControl​(boolean increment, boolean shiftDisplay)
      Control text entry mode.
      Parameters:
      increment - The cursor or blinking moves to the right when incremented by 1 and to the left when decremented by 1.
      shiftDisplay - Shifts the entire display either to the right (I/D = 0) or to the left (I/D = 1) when true. The display does not shift if false. If true, it will seem as if the cursor does not move but the display does.
      Returns:
      This object instance
    • autoscrollOn

      public HD44780Lcd autoscrollOn()
    • autoscrollOff

      public HD44780Lcd autoscrollOff()
    • isIncrementOn

      public boolean isIncrementOn()
    • isShiftDisplayOn

      public boolean isShiftDisplayOn()
    • displayControl

      public HD44780Lcd displayControl​(boolean displayOn, boolean cursorEnabled, boolean blinkEnabled)
    • displayOn

      public HD44780Lcd displayOn()
    • displayOff

      public HD44780Lcd displayOff()
    • cursorOn

      public HD44780Lcd cursorOn()
    • cursorOff

      public HD44780Lcd cursorOff()
    • blinkOn

      public HD44780Lcd blinkOn()
    • blinkOff

      public HD44780Lcd blinkOff()
    • isCursorEnabled

      public boolean isCursorEnabled()
    • isBlinkEnabled

      public boolean isBlinkEnabled()
    • cursorOrDisplayShift

      public HD44780Lcd cursorOrDisplayShift​(boolean displayShift, boolean shiftRight)
      Cursor or display shift shifts the cursor position or display to the right or left without writing or reading display data. This function is used to correct or search the display. In a 2-line display, the cursor moves to the second line when it passes the 40th digit of the first line. Note that the first and second line displays will shift at the same time. When the displayed data is shifted repeatedly each line moves only horizontally. The second line display does not shift into the first line position.
      Parameters:
      displayShift - Shift the display if true, the cursor if false.
      shiftRight - Shift to the right if true, to the left if false.
      Returns:
      This object instance
    • shiftDisplayRight

      public HD44780Lcd shiftDisplayRight()
    • shiftDisplayLeft

      public HD44780Lcd shiftDisplayLeft()
    • moveCursorRight

      public HD44780Lcd moveCursorRight()
    • moveCursorLeft

      public HD44780Lcd moveCursorLeft()
    • createChar

      public HD44780Lcd createChar​(int location, byte[] charMap)
    • close

      public void close() throws RuntimeIOException
      Description copied from interface: DeviceInterface
      Close this device
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface DeviceInterface
      Throws:
      RuntimeIOException