Author | Rob Hamerling, Copyright (c) 2008..2008, all rights reserved. |
Adapted-by | |
Compiler | >=2.4i |
Simple interface for HD44780 compatible alphanumeric LCD screens. Screens can range from 2x8 (2 lines, 8 chars) to 4x20. Uses 8 bit wide datapath + 2 handshake lines (total 10 PIC pins). No support for shift and characterset manipulations. Expects: - 2 pins for handshake: 'lcd_rs' and 'lcd_en' - 1 complete port for data: 'lcd_dataport'
lcd_init()
lcd_writechar(byte in data)
lcd_setcursor(byte in row, byte in col)
lcd'put(byte in c)
lcd_clearscreen()
lcd_init()
Initialize LCD * for 4-bit data mode * 2-line (/ 4-line) mode * shift right, invisible cursor
lcd_writechar(byte in data)
Write character to LCD. lcd_rs is not touched: function can be used for commands and data.
lcd_setcursor(byte in row, byte in col)
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 a second line. Set cursor position Specify row and column in base-0 notation (first line is 0).
lcd'put(byte in c)
Pseudo variable 'lcd' as alternative for lcd_writechar()
lcd_clearscreen()
Clear screen (and set the cursor to the upper left corner: row 0, column 0)
sample | 18f6310_lcd_hd44780_8.jal |