More than 8 Custom Chars on LCD?


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    969


    Did you find this post helpful? Yes | No

    Default

    Is there a way to accomplish the goal of forcing the LCD to show the digits 0-9 with double height?
    The answer is NO. Not more than 4 unique double height digits at a time. Optionally, use a graphic LCD.

  2. #2
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    The double line high digits use a series of blocks that only consume the eight custom characters:
    http://www.doc.ic.ac.uk/~ih/doc/lcd/double.html
    so you can display as many digits as the display can show.

    You still couldn't make the font very detailed like you probably wanted to.
    Last edited by Art; - 9th June 2010 at 12:18.

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    969


    Did you find this post helpful? Yes | No

    Default

    Art, thanks for the link. I take back my words. I stand corrected.

  4. #4
    Join Date
    Feb 2010
    Location
    USA, New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Art,

    Thanks! That was *exactly* what I needed. Here's a (low-quality) picture of the result:

    Name:  Big_Num_LCD.jpg
Views: 3372
Size:  54.2 KB

    Complete 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
    
    nPos var byte
    
    low PORTA.1
    
    'high PORTA.2
    pause 500
    LCDOUT $FE,1
    
    'Set up the digits (http://www.darreltaylor.com/files/CustChar.htm)
    LCDOUT  $FE,$40,$01,$01,$01,$01,$01,$01,$01,$01  ' Cust Char #0 
    'LCDOUT  $FE,$40,$02,$02,$02,$02,$02,$02,$02,$02  ' Cust Char #0   
    LCDOUT  $FE,$48,$1F,$11,$11,$11,$11,$11,$11,$11  ' Cust Char #1  
    LCDOUT  $FE,$50,$1F,$10,$10,$10,$10,$10,$10,$1F  ' Cust Char #2  
    LCDOUT  $FE,$58,$01,$01,$01,$01,$01,$01,$01,$1F  ' Cust Char #3  
    LCDOUT  $FE,$60,$1F,$11,$11,$11,$11,$11,$11,$1F  ' Cust Char #4  
    LCDOUT  $FE,$68,$11,$11,$11,$11,$11,$11,$11,$1F  ' Cust Char #5  
    LCDOUT  $FE,$70,$1F,$01,$01,$01,$01,$01,$01,$1F  ' Cust Char #6  
    LCDOUT  $FE,$78,$1F,$01,$01,$01,$01,$01,$01,$01  ' Cust Char #7  
      
    GOTO MAIN_LOOP
    
    Zero:
    	LCDOUT $FE,$80+nPos,1
    	LCDOUT $FE,$C0+nPos,5
    return
    
    One:
    	LCDOUT $FE,$80+nPos,0
    	LCDOUT $FE,$C0+nPos,0
    return
    
    Two:
    	LCDOUT $FE,$80+nPos,7
    	LCDOUT $FE,$C0+nPos,2
    return
    
    Three:
    	LCDOUT $FE,$80+nPos,6
    	LCDOUT $FE,$C0+nPos,3
    return
    
    Four:
    	LCDOUT $FE,$80+nPos,5
    	LCDOUT $FE,$C0+nPos,0
    return
    
    Five:
    	LCDOUT $FE,$80+nPos,2
    	LCDOUT $FE,$C0+nPos,3
    return
    
    Six:
    	LCDOUT $FE,$80+nPos,2
    	LCDOUT $FE,$C0+nPos,5
    return
    
    Seven:
    	LCDOUT $FE,$80+nPos,7
    	LCDOUT $FE,$C0+nPos,0
    return
    
    Eight:
    	LCDOUT $FE,$80+nPos,4
    	LCDOUT $FE,$C0+nPos,5
    return
    
    Nine:
    	LCDOUT $FE,$80+nPos,4
    	LCDOUT $FE,$C0+nPos,3
    return
    
    MAIN_LOOP:
    	nPos = 0
    	GOSUB Zero
    	nPos = 1
    	GOSUB One
    	nPos = 2
    	GOSUB Two
    	nPos = 3
    	GOSUB Three
    	nPos = 4
    	GOSUB Four
    	nPos = 5
    	GOSUB Five
    	nPos = 6
    	GOSUB Six
    	nPos = 7
    	GOSUB Seven
    	nPos = 8
    	GOSUB Eight
    	nPos = 9
    	GOSUB Nine
    
    	PAUSE 2000
    GOTO MAIN_LOOP
    And thanks to everyone else for reading and commenting. You folks are the best...

    Best Regards,
    Paul

  5. #5
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    Wow, it looks a lot nicer on the LCD than it did on the web page.

  6. #6
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    And if we have a variable byte or word how to display?

  7. #7
    Join Date
    Feb 2010
    Location
    USA, New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    And if we have a variable byte or word how to display?
    Use the DIG function. The demo below counts up to 65534, showing each number for 25mS. It also blanks out any leading zeros.

    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 1600'3000
    DEFINE LCD_DATAUS 50'200
    
    TRUE        	CON 1
    FALSE       	CON 0
    
    ADCON1 = 15
    CMCON = 7
    
    TRISB = %00000000
    TRISA.0 = $0
    TRISA.1 = $0
    TRISA.2 = $0
    
    nPos var byte
    wVal var WORD
    nDig var byte
    bDoneWithLeadingZeros var bit
    
    low PORTA.1
    
    'high PORTA.2
    pause 500
    LCDOUT $FE,1
    
    'Set up the digits (http://www.darreltaylor.com/files/CustChar.htm)
    LCDOUT  $FE,$40,$01,$01,$01,$01,$01,$01,$01,$01  ' Cust Char #0 
    LCDOUT  $FE,$48,$1F,$11,$11,$11,$11,$11,$11,$11  ' Cust Char #1  
    LCDOUT  $FE,$50,$1F,$10,$10,$10,$10,$10,$10,$1F  ' Cust Char #2  
    LCDOUT  $FE,$58,$01,$01,$01,$01,$01,$01,$01,$1F  ' Cust Char #3  
    LCDOUT  $FE,$60,$1F,$11,$11,$11,$11,$11,$11,$1F  ' Cust Char #4  
    LCDOUT  $FE,$68,$11,$11,$11,$11,$11,$11,$11,$1F  ' Cust Char #5  
    LCDOUT  $FE,$70,$1F,$01,$01,$01,$01,$01,$01,$1F  ' Cust Char #6  
    LCDOUT  $FE,$78,$1F,$01,$01,$01,$01,$01,$01,$01  ' Cust Char #7  
      
    GOTO MAIN_LOOP
    
    Zero:
    	LCDOUT $FE,$80+nPos,1
    	LCDOUT $FE,$C0+nPos,5
    return
    
    One:
    	LCDOUT $FE,$80+nPos,0
    	LCDOUT $FE,$C0+nPos,0
    return
    
    Two:
    	LCDOUT $FE,$80+nPos,7
    	LCDOUT $FE,$C0+nPos,2
    return
    
    Three:
    	LCDOUT $FE,$80+nPos,6
    	LCDOUT $FE,$C0+nPos,3
    return
    
    Four:
    	LCDOUT $FE,$80+nPos,5
    	LCDOUT $FE,$C0+nPos,0
    return
    
    Five:
    	LCDOUT $FE,$80+nPos,2
    	LCDOUT $FE,$C0+nPos,3
    return
    
    Six:
    	LCDOUT $FE,$80+nPos,2
    	LCDOUT $FE,$C0+nPos,5
    return
    
    Seven:
    	LCDOUT $FE,$80+nPos,7
    	LCDOUT $FE,$C0+nPos,0
    return
    
    Eight:
    	LCDOUT $FE,$80+nPos,4
    	LCDOUT $FE,$C0+nPos,5
    return
    
    Nine:
    	LCDOUT $FE,$80+nPos,4
    	LCDOUT $FE,$C0+nPos,3
    return
    
    Blank:
    	LCDOUT $FE,$80+nPos," "
    	LCDOUT $FE,$C0+nPos," "
    return
    
    PickDigit:
    	if nDig = 0 AND bDoneWithLeadingZeros = false then
    		gosub Blank
    'LCDOUT $FE,1
    	else
    		bDoneWithLeadingZeros = true
    		select case nDig
    		case 0
    			gosub Zero
    		case 1
    			gosub One
    		case 2
    			gosub Two
    		case 3
    			gosub Three
    		case 4
    			gosub Four
    		case 5
    			gosub Five
    		case 6
    			gosub Six
    		case 7
    			gosub Seven
    		case 8
    			gosub Eight
    		case 9
    			gosub Nine
    		end select
    	endif
    return
    
    MAIN_LOOP:
    	for wVal = 0 to $FFFE 
    		bDoneWithLeadingZeros = FALSE
    		'Most significant digit
    		nPos = 0
    		nDig = wVal dig 4
    		Gosub PickDigit
    		
    		nPos = 1
    		nDig = wVal dig 3
    		Gosub PickDigit
    		
    		nPos = 2
    		nDig = wVal dig 2
    		Gosub PickDigit
    		
    		nPos = 3
    		nDig = wVal dig 1
    		Gosub PickDigit
    		
    		'Least significant digit
    		nPos = 4
    		nDig = wVal dig 0
    		Gosub PickDigit
    		
    		pause 25
    	next wVal
    goto MAIN_LOOP
    Best Regards,
    Paul

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts