Author | Joep Suijs, Copyright © 2011..2011, all rights reserved. |
Adapted-by | |
Compiler | >=2.4g |
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.
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
__lcd_write_nibble( byte in value )
__lcd_write( byte in value )
_lcd_write_command(byte in value)
_lcd_write_data(byte in value)
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
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
__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