OK, let's go with the learning ... idea ...

Here's the changes to add 1 more display to what we already have.
Mostly, it's just "more of the same".

These are the same 3 sections that were modified the last time.
New changes are in red ...

Main Program
Code:
;----[ Change these to match your LCD ]---------------------------------------
LCD_DB4   VAR PORTB.0
LCD_DB5   VAR PORTB.1
LCD_DB6   VAR PORTB.2
LCD_DB7   VAR PORTB.3
LCD_RS    VAR PORTB.4

LCD_E1    VAR PORTB.5
LCD_E2    VAR PORTB.6
LCD_E3    VAR PORTD.0   

LCDEN     VAR BYTE BANK0  ; Enable bits for each LCD
  LCD1EN  VAR LCDEN.0
  LCD2EN  VAR LCDEN.1
  LCD3EN  VAR LCDEN.2

LCD_Lines     CON 2     ; # of Lines on LCD,  1 or 2 (Note: use 2 for 4 lines)
LCD_DATAUS    CON 50    ; Data delay time in us 
LCD_COMMANDUS CON 2000  ; Command delay time in us 

INCLUDE "LCD_AnyPin.pbp"  ; *** Include MUST be AFTER LCD Pin assignments ****
LOW LCD_E1              ; Start with Enables OUTPUT LOW
LOW LCD_E2
LOW LCD_E3
LCD_AnyPin.pbp
Code:
ASM
LCD_Port_HNIB  macro           ; Port definition for LCD High Nibble
    Vbit   LCDCDFLAG, _LCD_RS  ; Select Command/Data register
    DelayUS  2
    NOP
    Vpin   4, _LCD_DB4         ; Put the High Nibble on the bus
    Vpin   5, _LCD_DB5
    Vpin   6, _LCD_DB6
    Vpin   7, _LCD_DB7
    DelayUS  2

    btfsc    _LCD1EN           ; Set enable(s) High
    bsf      _LCD_E1
    btfsc    _LCD2EN
    bsf      _LCD_E2
    btfsc    _LCD3EN
    bsf      _LCD_E3
    DelayUS  5                 ; hold for 5us
    bcf      _LCD_E1           ; Enable(s) Low - Clocks data
    bcf      _LCD_E2
    bcf      _LCD_E3
  endm
;-----------------------    
LCD_Port_LNIB  macro           ; Port definition for LCD Low Nibble 
    Vpin   0, _LCD_DB4         ; Put the Low Nibble on the bus
    Vpin   1, _LCD_DB5
    Vpin   2, _LCD_DB6
    Vpin   3, _LCD_DB7
    DelayUS  2

    btfsc    _LCD1EN           ; Set enable(s) High
    bsf      _LCD_E1
    btfsc    _LCD2EN
    bsf      _LCD_E2
    btfsc    _LCD3EN
    bsf      _LCD_E3
    DelayUS  5                 ; hold for 5us
    bcf      _LCD_E1           ; Enable(s) Low - Clocks data
    bcf      _LCD_E2
    bcf      _LCD_E3
  endm
ENDASM

LCD_AnyPin.pbp
Code:
;----[Initialize the LCD]-------------------(DO NOT Change)-------------------
LCD_Init:
@   OutputPort  LCD_Port_HNIB    ; Set LCD bus to OUTPUT
    LCDEN = %111                 ; Initialize all LCD's at the same time
    LOW LCD_RS                   ; Start with RS LOW
    Char = 3   : gosub  LCDsendShortCOM : @  DelayUS 6000
                 gosub  LCDsendShortCOM : @  DelayUS 1000
                 gosub  LCDsendShortCOM : @  DelayUS 1000
    Char = 2   : gosub  LCDsendShortCOM : @  DelayUS 1000  ; Start 4-bit mode
    Char = $28 : gosub  LCDsendCOM  ; Function Set, 4-bit, 2-line, 5x7
    Char = $0C : gosub  LCDsendCOM  ; Display ON
    Char = $01 : gosub  LCDsendCOM  ; Clear Screen
    Char = $06 : gosub  LCDsendCOM  ; Entry Mode
    LCD_Initialized = 1             ; LCD has been Initialized
goto LCDAfterInit
And then, to use it.
It still works the same as before.
But now it's easier to treat the Enable bits like a binary number.
With each bit representing a different display ...
Code:
    LCDEN = %001
    LCDOUT $FE,$80, "Display 1"
    
    LCDEN = %010
    LCDOUT $FE,$80, "Display 2"

    LCDEN = %100
    LCDOUT $FE,$80, "Display 3"
    
    LCDEN = %111
    LCDOUT $FE,$C0, "ALL Displays"
And that should be it.<hr>
Now, Even though this all works fine ...
I don't like it.

After making all the changes to get 3 LCD's to work.
It's still limited to 3 LCD's.
If you want 4, then you have to go modify it again.
Then if you want to use 2 LCD's on another project. It'll throw a bunch of errors, that won't make sense 6 months from now.

Then there's the Timing options.
What if the cable is longer? Or shorter? How do you adjust the delays?

So what I've done, is create a new module that should incorporate everything learned here, and allow everyone to have up to 8 LCD's on long or short cables without to much hassle.

But it takes longer to post the thread, than it does to write the program.
And I Gotta work tomorrow too.

Feel free to use the code I just posted (it should work)
Or you may want to wait for my next post in the PBP Extensions forum. (day or two)<hr>
P.S. It's unfortunate that we still won't know the answer to your first question.
Quote Originally Posted by wildbilly
What is the maximum cable length of cable that can be used between Pic and LCD?
Uhhh, 40 ft, as far as we can say.
But who knows?
<br>