The built in LCD driver for the PIN mode is written to support a worst case scenario where you use random pins of the microprocessor to drive the LCD pins.
This makes it easy to design your PCB but it needs more code.
When you want to have less code you need fixed pins for the LCD display.
With the statement $LIB "LCD4E2.LBX" you specify that the LCD4.LIB will be used.
The following connections are used in the asm code:
Rs = PortB.0
RW = PortB.1 we don’t use the R/W option of the LCD in this version so connect to ground
E = PortB.2
E2 = PortB.3 the second E pin of the LCD
Db4 = PortB.4 the data bits must be in a nibble to save code
Db5 = PortB.5
Db6 = PortB.6
Db7 = PortB.7
You can change the lines from the lcd4e2.lib file to use another port.
Just change the address used :
.EQU LCDDDR=$17 ; change to another address for DDRD ($11)
.EQU LCDPORT=$18 ; change to another address for PORTD ($12)
See the demo lcdcustom4bit2e.bas in the SAMPLES dir.
Note that you still must select the display that you use with the CONFIG LCD statement.
See also the lcd4.lib for driving a display with 1 E line.
A display with 2 E lines actually is a display with 2 control chips. They must both be controlled. This library allows you to select the active E line from your code.
In your basic code you must first select the E line before you use a LCD statement.
The initialization of the display will handle both chips.
Note that LBX is a compiled LIB file. In order to change the routines you need the commercial edition with the source code(lib files). After a change you should compile the library with the library manager.