hwtLib.peripheral.displays.hd44780 package

Module of componens for HD44780 character LCD controller

Submodules

hwtLib.peripheral.displays.hd44780.driver module

class hwtLib.peripheral.displays.hd44780.driver.Hd44780CmdIntf(masterDir=DIRECTION.OUT, hdl_name: Optional[Union[str, Dict[str, str]]] = None, loadConfig=True)[source]

Bases: HandshakeSync

HDL params
  • DATA_WIDTH - default value 8 of type int

HDL IO
class hwtLib.peripheral.displays.hd44780.driver.Hd44780CmdIntfBurst[source]

Bases: HandshakedStoredBurst

HDL params
  • DATA_WIDTH - default value 8 of type int

  • INTF_CLS - default value <class ‘hwtLib.peripheral.displays.hd44780.driver.Hd44780CmdIntf’> of type type

  • REPEAT - default value False of type bool

  • DATA - default value ((0, 0, 0, 0), (0, 0, 0, 1)) of type tuple

HDL IO
schematic
__init__()[source]
set_data(intf: Hd44780CmdIntf, d)[source]
class hwtLib.peripheral.displays.hd44780.driver.Hd44780Driver(hdl_name_override: Optional[str] = None)[source]

Bases: Unit

Controller for Hitachi HD44780 based LCD displays

  • Manages command delays and IO control

  • Sends initialization sequence

  • Translates ‘n’ to a jump on next line and clean of line

  • Translates ‘f’ to a clean the display and set cursor

    to first line first char

HDL params
  • LCD_ROWS - default value 2 of type int

  • LCD_COLS - default value 16 of type int

  • LCD_DATA_WIDTH - default value 8 of type int

  • LCD_FREQ - default value 270000 of type int

  • FREQ - default value 100000000 of type int

HDL IO
HDL components
schematic
_impl()[source]
  • read on ‘en’ faling edge, write on ‘en’ rising edge

  • ‘en’ max frequency = LCD_FREQ / 10

  • rs has to be set at least 1 clk (LCD_FREQ) before rising edge of ‘en’

_io_core(data_in: Hd44780CmdIntf, cmd_timer_rst, lcd_clk_en: RtlSignal, delay_cmd_half_done: RtlSignal, delay_cmd_done: RtlSignal, delay_cmd_long_done: RtlSignal)[source]
_translate_data_in(din: Handshaked) Hd44780CmdIntf[source]

Translates special characters to a LCD commands

  • ‘n’ jump on next line and clean it with ‘ ‘

  • ‘f’ clean the LCD and reset cursor position

hwtLib.peripheral.displays.hd44780.intf module

class hwtLib.peripheral.displays.hd44780.intf.HD44780InterfaceAgent(sim: HdlSimulator, intf: Hd44780Intf)[source]

Bases: AgentBase

Agent which emulates HD44780 LCD

Variables

~.screen – character present on screen

REV_CHAR_MAP = {32: ' ', 33: '!', 34: '"', 35: '#', 36: '$', 37: '%', 38: '&', 39: "'", 40: '(', 41: ')', 42: '*', 43: '+', 44: ',', 45: '-', 46: '.', 47: '/', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9', 58: ':', 59: ';', 60: '<', 61: '=', 62: '>', 63: '?', 64: '@', 65: 'A', 66: 'B', 67: 'C', 68: 'D', 69: 'E', 70: 'F', 71: 'G', 72: 'H', 73: 'I', 74: 'J', 75: 'K', 76: 'L', 77: 'M', 78: 'N', 79: 'O', 80: 'P', 81: 'Q', 82: 'R', 83: 'S', 84: 'T', 85: 'U', 86: 'V', 87: 'W', 88: 'X', 89: 'Y', 90: 'Z', 91: '[', 92: '¥', 93: ']', 94: '^', 95: '_', 96: '`', 97: 'a', 98: 'b', 99: 'c', 100: 'd', 101: 'e', 102: 'f', 103: 'g', 104: 'h', 105: 'i', 106: 'j', 107: 'k', 108: 'l', 109: 'm', 110: 'n', 111: 'o', 112: 'p', 113: 'q', 114: 'r', 115: 's', 116: 't', 117: 'u', 118: 'v', 119: 'w', 120: 'x', 121: 'y', 122: 'z', 123: '{', 124: '|', 125: '}', 126: '←', 127: '→', 162: '⌜', 163: '⌟', 164: '\\', 165: '·', 223: '°', 224: 'α', 225: 'ä', 226: 'β', 227: 'ε', 228: 'μ', 229: 'σ', 231: 'ρ', 232: '√', 235: '÷', 236: '¢', 237: 'Ⱡ', 238: 'ñ', 239: 'ö', 240: 'x̅', 242: 'θ', 243: '∞', 244: 'Ω', 245: 'ü', 246: 'Σ', 247: 'π', 255: '█'}
__init__(sim: HdlSimulator, intf: Hd44780Intf)[source]
get_str()[source]
monitor()[source]

Implement this method to monitor your interface in simulation/verification

class hwtLib.peripheral.displays.hd44780.intf.Hd44780Intf(masterDir=DIRECTION.OUT, hdl_name: Optional[Union[str, Dict[str, str]]] = None, loadConfig=True)[source]

Bases: Interface

HD44780 is an old but comonly used driver for character LCDs. It is commonly used for 16x2 character displays but does also supports a different number of characters.

HDL params
  • DATA_WIDTH - default value 8 of type int

  • ROWS - default value 2 of type int

  • COLS - default value 16 of type int

HDL IO
BUSY = 1
CHAR_MAP = {' ': 32, '!': 33, '"': 34, '#': 35, '$': 36, '%': 37, '&': 38, "'": 39, '(': 40, ')': 41, '*': 42, '+': 43, ',': 44, '-': 45, '.': 46, '/': 47, '0': 48, '1': 49, '2': 50, '3': 51, '4': 52, '5': 53, '6': 54, '7': 55, '8': 56, '9': 57, ':': 58, ';': 59, '<': 60, '=': 61, '>': 62, '?': 63, '@': 64, 'A': 65, 'B': 66, 'C': 67, 'D': 68, 'E': 69, 'F': 70, 'G': 71, 'H': 72, 'I': 73, 'J': 74, 'K': 75, 'L': 76, 'M': 77, 'N': 78, 'O': 79, 'P': 80, 'Q': 81, 'R': 82, 'S': 83, 'T': 84, 'U': 85, 'V': 86, 'W': 87, 'X': 88, 'Y': 89, 'Z': 90, '[': 91, '\\': 164, ']': 93, '^': 94, '_': 95, '`': 96, 'a': 97, 'b': 98, 'c': 99, 'd': 100, 'e': 101, 'f': 102, 'g': 103, 'h': 104, 'i': 105, 'j': 106, 'k': 107, 'l': 108, 'm': 109, 'n': 110, 'o': 111, 'p': 112, 'q': 113, 'r': 114, 's': 115, 't': 116, 'u': 117, 'v': 118, 'w': 119, 'x': 120, 'x̅': 240, 'y': 121, 'z': 122, '{': 123, '|': 124, '}': 125, '¢': 236, '¥': 92, '°': 223, '·': 165, 'ä': 225, 'ñ': 238, 'ö': 239, '÷': 235, 'ü': 245, 'Σ': 246, 'Ω': 244, 'α': 224, 'β': 226, 'ε': 227, 'θ': 242, 'μ': 228, 'π': 247, 'ρ': 231, 'σ': 229, '←': 126, '→': 127, '√': 232, '∞': 243, '⌜': 162, '⌟': 163, '█': 255, 'Ⱡ': 237}
CMD_CLEAR_DISPLAY = 1
static CMD_CURSOR_OR_DISPLAY_SHIFT(shift_or_cursor, right_left)[source]
static CMD_DDRAM_ADDR_SET(addr)[source]

set cursor position

static CMD_DISPLAY_CONTROL(display_on_off, cursor_on_off, cursor_blink)[source]
static CMD_ENTRY_MODE_SET(incr_decr: int, shift_en: int)[source]

speciies how the cursor should be modified after char write

static CMD_FUNCTION_SET(data_len, lines, font)[source]
CMD_RETURN_HOME = 2
DATA_LEN_4b = 0
DATA_LEN_8b = 1
DECR = 0
DELAY_CMD = 10
DELAY_RETURN_HOME = 410
FONT_5x10 = 1
FONT_5x8 = 0
INCR = 1
LINES_1 = 0
LINES_2 = 1
RS_CONTROL = 0
RS_DATA = 1
RW_READ = 1
RW_WRITE = 0
SC_CURSOR_MOVE = 0
SC_DISPLAY_SHIFT = 1
SHIFT_LEFT = 0
SHIFT_RIGHT = 1
_initSimAgent(sim: HdlSimulator)[source]