LCD
There are two LCD libraries, one requires constants to be set up in the library before use but is faster, the other is slower but more flexible
See also for i2c type display.
The hardware example is currently set up for the following ports
LCD pin | Function | Port/pin |
1 | GND | |
2 | +5V | |
3 | Contrast | GND |
4 | RS | RA0 * |
5 | RW | GND |
6 | E | RA1 * |
7 | D0 | No connection |
8 | D1 | No connection |
9 | D2 | No connection |
10 | D3 | No connection |
11 | D4 | RB0 * |
12 | D5 | RB1 * |
13 | D6 | RB2 * |
14 | D7 | RB3 * |
15 | BL A | RA2 * |
16 | BL K | GND |
Library 1
// #include "http://byvac.com/mBlib/flb/Library/2016/lib_lcd2.bas"
This will require setting up constants at the top of the file for the control lines and the data port. NOTE the data port (D4 to D7) must use consecutive pins.
Library 2
// #include "http://byvac.com/mBlib/flb/Library/2016/lib_lcd4.bas"
This can be included in any file but the array lcd.params(7) must be filled with the correct values before use for example.
function init_mylcd()
lcd.params(0) = ?RA0(0) // RS
lcd.params(1) = ?RA1(0) // E
lcd.params(2) = ?RA2(0) // BL
lcd.params(3) = ?RB0(0) // D4
lcd.params(4) = ?RB1(0) // D5
lcd.params(5) = ?RB2(0) // D6
lcd.params(6) = ?RB3(0) // D7
lcd.init()
endf
The following apply to both libraries, see also inside the file for further comments
- lcd.init() // initialise first time
- lcd.bl(n) // bacl light n=1 = on
- lcd.rc(row, column) // both start at 0
- lcd.putc(c) // send character to display
- lcd.puts("string") // send string to display
- lcd.scrollInit(line,columns,delay) // initialise scrolling
- lcd.scrollText(text$[128]) // add scrolling text
The following is for driving a 20 x 4 LCD display through a PCF8574 I2C interface, see notes in the code for more detail.
// #include "http://byvac.com/mBlib/flb/Library/2016/lib_lcd3.bas"