More than 8 Custom Chars on LCD?
I'm using a standard garden-variety 2x16 LCD and a PIC18F2550. What I'd like to do is make a larger number font by putting the top half of the digit on the first line and the bottom half on the second line. Obviously, it would take a total of 20 special characters to to make all ten digits; the CGRAM only allows eight custom characters. I thought (incorrectly, as it turns out) I could re-use characters but instead it refreshes previous instances.
Here's my testing code:
Code:
' PIC18F2550
'Pin Assignments
'---------------
' Pin Name Use/Connection
'------------------------------------
' 1 MCLR Master Clear/Reset. Pull High through 4.7k
' 2 RA0/AN0 LCD RS
' 3 RA1/AN1 LCD R/W
' 4 RA2/AN2 LCD Enable
' 5 RA3/AN3 n/c
' 6 RA4/T0CKI n/c
' 7 RB5/AN4 n/c
' 8 Vss Ground
' 9 OSC1 20 MHz resonator
' 10 OSC2 20 MHz resonator
' 11 RC0/T1CKI To 32 kHz crystal
' 12 RC1/CCP2 To 32 kHz crystal
' 13 RC2/CCP1 n/c
' 14 Vusb To USB (internal USB 3.3V voltage regulator)
' 15 RC4/D- To USB (USB differential minus line)
' 16 RC5/D+ To USB (USB differential plus line)
' 17 RC6/TX To MAX232
' 18 RC7/RX To MAX232
' 19 Vss Ground
' 20 Vdd Voltage in (5V from USB)
' 21 RB0/INT LCD DB0
' 22 RB1 LCD DB1
' 23 RB2 LCD DB2
' 24 RB3 LCD DB3
' 25 RB4 LCD DB4
' 26 RB5 LCD DB5
' 27 RB6 LCD DB6
' 28 RB7 LCD DB7
' Compiler directives:
Define OSC 20
DEFINE LOADER_USED 1 'Bootloader Used
'Set receive register to receiver enabled
DEFINE HSER_RCSTA 90h
'Set transmit register to transmitter enabled, high speed BRGH
DEFINE HSER_TXSTA 24h
'Set baud rate
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTA
DEFINE LCD_EBIT 2
DEFINE LCD_BITS 8
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 3000
DEFINE LCD_DATAUS 200
ADCON1 = 15
CMCON = 7
TRISB = %00000000
TRISA.0 = $0
TRISA.1 = $0
TRISA.2 = $0
low PORTA.1
'high PORTA.2
pause 500
LCDOUT $FE,1
MAIN_LOOP:
'Big "1"
LCDOUT $FE,$40,$00,$00,$04,$0C,$04,$04,$04,$04 ' Cust Char #0, big "1" top half
LCDOUT $FE,$48,$04,$04,$04,$04,$04,$0E,$00,$00 ' Cust Char #1, big "1" bottom half
LCDOUT $FE,$80,0 ' Put it as 1st line, 1st char
LCDOUT $FE,$C0,1 ' Put it as 2nd line, 1st char
'Big "2"
LCDOUT $FE,$50,$00,$00,$0E,$11,$01,$01,$01,$02 ' Cust Char #2, big "2" top half
LCDOUT $FE,$58,$04,$08,$08,$10,$10,$1F,$00,$00 ' Cust Char #3, big "2" bottom half
LCDOUT $FE,$81,2 ' Put it as 1st line, 2nd char
LCDOUT $FE,$C1,3 ' Put it as 2nd line, 2nd char
'Big "3"
LCDOUT $FE,$60,$00,$00,$0E,$11,$01,$01,$01,$06 ' Cust Char #4, big "3" top half
LCDOUT $FE,$68,$01,$01,$01,$01,$11,$0E,$00,$00 ' Cust Char #5, big "3" bottom half
LCDOUT $FE,$82,4 ' Put it as 1st line, 3rd char
LCDOUT $FE,$C2,5 ' Put it as 2nd line, 3rd char
'Big "4"
LCDOUT $FE,$70,$00,$00,$06,$06,$0A,$0A,$12,$12 ' Cust Char #6, big "4" top half
LCDOUT $FE,$78,$12,$1F,$02,$02,$02,$02,$00,$00 ' Cust Char #7, big "4" bottom half
LCDOUT $FE,$83,6 ' Put it as 1st line, 4th char
LCDOUT $FE,$C3,7 ' Put it as 2nd line, 4th char
pause 2000
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Big "5"
LCDOUT $FE,$40,$00,$00,$1F,$10,$10,$10,$1E,$01 ' Cust Char #0, big "5" top half
LCDOUT $FE,$48,$00,$01,$01,$01,$11,$0E,$00,$00 ' Cust Char #1, big "5" bottom half
LCDOUT $FE,$84,0 ' Put it as 1st line, 5th char
LCDOUT $FE,$C4,1 ' Put it as 2nd line, 5th char
'Big "6"
LCDOUT $FE,$50,$00,$00,$06,$08,$08,$10,$1E,$11 ' Cust Char #2, big "6" top half
LCDOUT $FE,$58,$11,$11,$11,$11,$11,$0E,$00,$00 ' Cust Char #3, big "6" bottom half
LCDOUT $FE,$85,2 ' Put it as 1st line, 6th char
LCDOUT $FE,$C5,3 ' Put it as 2nd line, 6th char
'Big "7"
LCDOUT $FE,$60,$00,$00,$1F,$01,$01,$01,$01,$01 ' Cust Char #4, big "7" top half
LCDOUT $FE,$68,$02,$04,$04,$08,$08,$08,$00,$00 ' Cust Char #5, big "7" bottom half
LCDOUT $FE,$86,4 ' Put it as 1st line, 7th char
LCDOUT $FE,$C6,5 ' Put it as 2nd line, 7th char
'Big "8"
LCDOUT $FE,$70,$00,$00,$0E,$11,$11,$11,$11,$0E ' Cust Char #6, big "8" top half
LCDOUT $FE,$78,$11,$11,$11,$11,$11,$0E,$00,$00 ' Cust Char #7, big "8" bottom half
LCDOUT $FE,$87,6 ' Put it as 1st line, 8th char
LCDOUT $FE,$C7,7 ' Put it as 2nd line, 8th char
pause 2000
goto MAIN_LOOP
What I *thought* it should do is show "1234" in big numerals, pause, then show "12345678".
Instead it shows "1234" then goes back and forth between "56785678" and "12341234".
Is there a way to accomplish the goal of forcing the LCD to show the digits 0-9 with double height?
Thanks for reading...8^)
Paul