HI wildbilly,
Sounds like your up to speed with me now.
I've been bogged down all week with work, so I'm kind of glad you had problems.
I'm sure it's not the same from your point of view.
So anyhow, I've found that the resistors used to select each display seem to act as a filter with the extra capacitance of the ribbon. The enable line gets rounded off pretty bad.
Fortunately, with "HighJack", we're not limited to just one Enable pin anymore.
We can have as many as needed. And that's the next step.
We'll use the previous "Disable" pins as the "Enable" line for each LCD. The resistors are no longer needed. Then instead of Disabling the display you don't want to write to, you'll Enable the one's you do want.
This takes a few modifications, but it's not too bad.
First, in the main program, change the LCD definitions to this ...Next, in the LCD_AnyPin file, there's a section that says "DO NOT Change anything below this line".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 LCDEN VAR BYTE BANK0 ; Enable bits for each LCD LCD1EN VAR LCDEN.0 LCD2EN VAR LCDEN.1 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
Change it to this ...
And finally, also in the LCD_AnyPin file, change LCD_Init to this ...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 DelayUS 5 ; hold for 5us bcf _LCD_E1 ; Enable(s) Low - Clocks data bcf _LCD_E2 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 DelayUS 5 ; hold for 5us bcf _LCD_E1 ; Enable(s) Low - Clocks data bcf _LCD_E2 endm ENDASMCode:;----[Initialize the LCD]-------------------(DO NOT Change)------------------- LCD_Init: @ OutputPort LCD_Port_HNIB ; Set LCD bus to OUTPUT LCDEN = 1 + 2 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
Click image to enlarge.
P.S. Until now I thought that 6 inches was the limit for LCD's. Just because somebody told me that once.
This is really cool. Thanks for the interesting things to play with.<hr>
ADDED: Oops, forgot to show you how to use it..Code:LCDEN = 1 LCDOUT $FE,1, "Display 1" LCDEN = 2 LCDOUT $FE,1, "Display 2" LCDEN = 1 + 2 LCDOUT $FE,$C0, "Both Displays"





Bookmarks