# lcd_hd44780_pcf8574

LCD library for HD44780 compatible LCDs, interfaced with pcf8574

Author | Joep Suijs, Copyright © 2011..2011, all rights reserved.
Adapted-by |
Compiler | >=2.4g

Description

       i2c bus interface for HD44780 compatible alphanumeric LCD screens.
       Tested on the DFRobot 'i2c/twi lcd 1602 module'
       See bits on lcd_shadow for the connection from the pcf8574 to the LCD.
     --
       Directions for use of this library in application programs
       (in this sequence):
       1. Setup i2c master (include i2c_hardware or include i2c_software)

       2. Declare the following constants:
             const byte LCD_ROWS     = 2              -- 1, 2 or 4 lines
             const byte LCD_CHARS    = 16             -- 8, 16 or 20 chars per line

       3. Include this library.

       4. Call lcd_init() to initialize the lcd controller.

       Above is an example for a 2x16 LCD, connected to pin d0

       See hd_44780_common for the LCD API.

Dependencies

- delay
- lcd_hd44780_common

## Summary

### Global variables/contants

- `var bit lcds_enable at lcd_shadow:2`
- `var bit lcds_backlight at lcd_shadow:3`
- `var bit*4 lcds_nibble at lcd_shadow:4`
- `var bit lcds_rs at lcd_shadow:0`
- `var bit lcds_rw at lcd_shadow:1`
- `var byte lcd_shadow`

### Procedures

- `lcd_backlight(bit in onoff)`
- `lcd_init()`
- `write_lcd_shadow()`
- `lcd_backlight_variable(byte in value)`

Private

- `__lcd_write_nibble( byte in value )`
- `__lcd_write( byte in value )`
- `_lcd_write_command(byte in value)`
- `_lcd_write_data(byte in value)`

### Functions

## API details

### Global variables/contants

- `var bit lcds_enable at lcd_shadow:2`

  No documentation found

- `var bit lcds_backlight at lcd_shadow:3`

  No documentation found

- `var bit*4 lcds_nibble at lcd_shadow:4`

      Mapping of pcf8574 to LCD

- `var bit lcds_rs at lcd_shadow:0`

  No documentation found

- `var bit lcds_rw at lcd_shadow:1`

  No documentation found

- `var byte lcd_shadow`

  No documentation found

### Procedures

- `lcd_backlight(bit in onoff)`

      lcd_backlight - turn backlite on/off

- `lcd_init()`

- `write_lcd_shadow()`

      write_lcd_shadow() - write content of shadow to lcd (actually: pca8574)

      note: i2c errors are ignored here, since there the lcd api has no way
      to propagate them to the user.

- `lcd_backlight_variable(byte in value)`

      lcd_backlight_variable - set backlight level

Private

- `__lcd_write_nibble( byte in value )`

      sends low nibble from value to the LCD
      can be used for both commands and data
      (requires no wait cycli inbetween upper and lower nibble)
      (this routine is only used inside this file)

- `__lcd_write( byte in value )`

      sends byte from value to register of the LCD
      (this procedure is only used inside this file)

- `_lcd_write_command(byte in value)`

      sends command byte in value to LCD
      for slow commands an extra delay should be added

- `_lcd_write_data(byte in value)`

      sends data byte in value to LCD
      for slow commands an extra delay should be added

### Functions

## Related samples

Here are the list of samples which use this library:

16f648a | 16f648a_lcd_hd44780_pcf8574.jal
16f723 | 16f723_lcd_hd44780_pcf8574.jal
16f73 | 16f73_lcd_hd44780_pcf8574.jal
16f877 | 16f877_lcd_hd44780_pcf8574.jal
16f877a | 16f877a_lcd_hd44780_pcf8574.jal
16f88 | 16f88_lcd_hd44780_pcf8574.jal
18f14k50 | 18f14k50_lcd_hd44780_pcf8574.jal
18f2450 | 18f2450_lcd_hd44780_pcf8574.jal
18f2520 | 18f2520_lcd_hd44780_pcf8574.jal
18f2550 | 18f2550_lcd_hd44780_pcf8574.jal
18f2620 | 18f2620_lcd_hd44780_pcf8574.jal
18f452 | 18f452_lcd_hd44780_pcf8574.jal
18f4550 | 18f4550_lcd_hd44780_pcf8574.jal
18f4620 | 18f4620_lcd_hd44780_pcf8574.jal
18f67j50 | 18f67j50_lcd_hd44780_pcf8574.jal