# lcd_hd44780_common

common library for HD44780 based LCD

Author | Richard Zengerink, Copyright © 2008..2011, all rights reserved.
Adapted-by | Joep Suijs, Rob Hamerling
Compiler | 2.4n

Description

    Common API for HD44780 based LCD

Dependencies

No dependency found

## Summary

### Global variables/contants

- `const LCD_DISPLAY_SHIFT_LEFT = 0b_0001_1000`
- `var volatile byte lcd_pos = 0`
- `const LCD_DISPLAY_SHIFT_RIGHT = 0b_0001_1100`
- `const LCD_RETURN_HOME = 0b_0000_0010`
- `const LCD_CURSOR_SHIFT_R_VAL = 0b_0001_0100`
- `const LCD_SET_DDRAM_ADDRESS = 0b_1000_0000`
- `const LCD_SET_CGRAM_ADDRESS = 0b_0100_0000`
- `const LCD_CLEAR_DISPLAY = 0b_0000_0001`
- `const LCD_DISPLAY_ONOFF = 0b_0000_1000`
- `const LCD_CURSOR_SHIFT_L_VAL = 0b_0001_0000`

### Procedures

- `lcd_clear_screen()`
- `lcd_clear_line(byte in line)`
- `lcd_writechar(byte in data)`
- `lcd_shift_right(byte in nr)`
- `lcd_define(byte in pos, byte in str[])`
- `lcd_cursor_blink_display(bit in cursor, bit in blink, bit in display)`
- `lcd_cursor_shift_right(byte in nr)`
- `lcd_shift_left(byte in nr)`
- `lcd_clearscreen()`
- `lcd_home()`
- `lcd_write_char(byte in data)`
- `lcd_cursor_position(byte in line, byte in pos)`
- `lcd'put(byte in data)`
- `lcd_cursor_shift_left(byte in nr)`
- `lcd_progress(byte in line, byte in amount, byte in pattern)`

Private

- `_lcd_restore_cursor()`

### Functions

Private

- `_lcd_line2index(byte in line) return byte`

## API details

### Global variables/contants

- `const LCD_DISPLAY_SHIFT_LEFT = 0b_0001_1000`

  No documentation found

- `var volatile byte lcd_pos = 0`

  No documentation found

- `const LCD_DISPLAY_SHIFT_RIGHT = 0b_0001_1100`

  No documentation found

- `const LCD_RETURN_HOME = 0b_0000_0010`

  No documentation found

- `const LCD_CURSOR_SHIFT_R_VAL = 0b_0001_0100`

  No documentation found

- `const LCD_SET_DDRAM_ADDRESS = 0b_1000_0000`

  No documentation found

- `const LCD_SET_CGRAM_ADDRESS = 0b_0100_0000`

  No documentation found

- `const LCD_CLEAR_DISPLAY = 0b_0000_0001`

      constants to control the lcd

- `const LCD_DISPLAY_ONOFF = 0b_0000_1000`

  No documentation found

- `const LCD_CURSOR_SHIFT_L_VAL = 0b_0001_0000`

  No documentation found

### Procedures

- `lcd_clear_screen()`

      lcd_clear_screen - clears the LCD

- `lcd_clear_line(byte in line)`

      lcd_clear_line - clears the line "line" of the LCD

- `lcd_writechar(byte in data)`

      Deprecated

- `lcd_shift_right(byte in nr)`

      lcd_shift_right - shifts the complete display one position to the right

- `lcd_define(byte in pos, byte in str[])`

      lcd_define - Create a custom character

      The characters can be placed on position 0-7 of the character ram
      .
      pos: position of the character
      str[]: array containing the custom character
      .
      (0xFF is a common pattern)

- `lcd_cursor_blink_display(bit in cursor, bit in blink, bit in display)`

      lcd_cursor_blink_display - (re)sets cursor blink and puts display on/off
      .
      params:
      cursor:  enable or disable the fixed underline cursor
      blink:   enable or disable blinking of the block-cursor (so block blinking or off)
      display: enable or disable the whole display

- `lcd_cursor_shift_right(byte in nr)`

      lcd_cursor_shift_right - shifts cursor one position to the right

- `lcd_shift_left(byte in nr)`

      lcd_shift_left - shifts the complete display one position to the left

- `lcd_clearscreen()`

      Deprecated

- `lcd_home()`

      lcd_home - cursor returns home(line 0, position 0)

- `lcd_write_char(byte in data)`

      lcd_write_char - write one char to LCD

- `lcd_cursor_position(byte in line, byte in pos)`

      lcd_cursor_position - Specify row and column (0-based)
      .
      About cursor positions: the LCDs are internally 2x40 char devices.
      The first line starts at offset 0, the second line at offset 64 (0x40).
      With 4 line devices the third and fourth line are addressed as extensions
      of the first and second line by adding an offset. For a 4x20 line device
      the offset is 20, for a 4x16 line display the offset is 16 or 20.
      Declare the constant LCD_CHARS as appropriate for your screen
      (you may have to specify 20 even if your display has only 16 chars!).
      .
      Note: Some 1x16 LCDs are implemented as 2x8 line LCDs, which means that
      the second half of the line has to be handled as the second line.

- `lcd'put(byte in data)`

      lcd'put - write one char to screen (pseudo var, enables streams)

- `lcd_cursor_shift_left(byte in nr)`

      lcd_cursor_shift_left - shifts cursor one position to the left

- `lcd_progress(byte in line, byte in amount, byte in pattern)`

      lcd_progress- Displays a progress bar

      The progress bar starts at position 0 of a line.
      line: line on which progress bar is displayed
      amount: number of bar chars that are displayed
      (0xFF is a common pattern)

Private

- `_lcd_restore_cursor()`

      _lcd_restore_cursor - sets the cursor to the position in the shadow register
      (this routine is only used inside this file)

### Functions

Private

- `_lcd_line2index(byte in line) return byte`

      _lcd_line2index - internal function - calculate index from line number

## Related samples

No sample found