Big characters on HD44780 4x20


Results 1 to 24 of 24

Threaded View

  1. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    OK, a 0000-9999 up-counter, 746 Word on a 16F877A
    Code:
    DEFINE LOADER_USED 1
    Define OSC 4
    DEFINE LCD_DREG PORTD     ' LCD data port 
    DEFINE LCD_DBIT 4         ' LCD data starting bit 0 or 4 
    DEFINE LCD_RSREG PORTD    ' LCD register select port 
    DEFINE LCD_RSBIT 2        ' LCD register select bit 
    DEFINE LCD_EREG PORTD     ' LCD enable port 
    DEFINE LCD_EBIT 3         ' LCD enable bit 
    DEFINE LCD_BITS 4         ' LCD bus size 4 or 8 
    DEFINE LCD_LINES 4        ' Number lines on LCD 
    DEFINE LCD_COMMANDUS 2000 ' Command delay time in us 
    DEFINE LCD_DATAUS 50      ' Data delay time in us 
    
    goto VariableDefinition
    asm
    Comm=0xFE
    EOL=0xFC
    Dx=0x14
    
    CustChar 
            dt Comm,64,31,31,31,31,0,0,0,0      ; Cust Char #0  
            dt Comm,72,0,0,0,0,31,31,31,31      ; Cust Char #1  
            dt Comm,80,31,31,31,15,7,3,1,0      ; Cust Char #2  
            dt Comm,88,31,31,31,30,28,24,16,0   ; Cust Char #3  
            dt Comm,96,0,16,24,28,30,31,31,31   ; Cust Char #4  
            dt Comm,104,0,1,3,7,15,31,31,31     ; Cust Char #5  
            dt Comm,112,31,31,31,31,31,31,31,31 ; Cust Char #6  
            dt Comm,120,0,0,0,14,31,31,31,14    ; Cust Char #7  
            dt EOL ; end of Custom character
    
    Zero    dt 5,0xFF,0xFF,4,EOL
            dt 0xFF,Comm,Dx,Comm,Dx,0xFF,EOL
            dt 0XFF,Comm,Dx,Comm,Dx,0xFF,EOL
            dt 2,0xff,0xff,3,EOL
            dt 5
    
    One     dt Comm,Dx,5,0xff,EOL
            dt Comm,Dx,Comm,Dx,0xff,EOL
            dt Comm,Dx,Comm,Dx,0xff,EOL
            dt Comm,Dx,Comm,Dx,0xff,EOL
            dt 5;3
    
    Two     dt 0,0,0,4,EOL
            dt Comm,Dx,Comm,Dx,Comm,Dx,0xff,EOL
            dt 5,0,0,0,EOL
            dt 0xff,1,1,1,EOL
            dt 5
          
    Three   dt 0,0,0,4,EOL
            dt Comm,Dx,1,1,0xff,EOL
            dt Comm,Dx,0,0,0xff,EOL
            dt 1,1,1,3,EOL
            dt 5    
    
    Four    dt 0xff,EOL
            dt 0xff,Comm,Dx,Comm,Dx,0xff,EOL
            dt 0,0,0,0xff,EOL
            dt Comm,Dx,Comm,Dx,Comm,Dx,0xff,EOL
            dt 5    
    
    Five    dt 5,0,0,0,EOL
            dt 0xff,EOL
            dt 0,0,0,4,EOL
            dt 1,1,1,3,EOL
            dt 5    
    
    Six     dt Comm,Dx,5,0,0,EOL
            dt 0xff,EOL
            dt 0xff,0,0,4,EOL
            dt 2,1,1,3,EOL
            dt 5    
    
    Seven   dt 0,0,0,0xff,EOL
            dt Comm,Dx,Comm,Dx,1,0xff,EOL
            dt Comm,Dx,Comm,Dx,0,0xff,EOL
            dt Comm,Dx,Comm,Dx,Comm,Dx,0xff,EOL
            dt 5    
            
    Eight   dt 5,0,0,4,EOL
            dt 2,1,1,3,EOL
            dt 5,0,0,4,EOL
            dt 2,1,1,3,EOL
            dt 5
    
    Nine    dt 5,0,0,4,EOL
            dt 2,1,1,0xff,EOL
            dt Comm,Dx, Comm,Dx,Comm,Dx,0xff,EOL
            dt Comm,Dx,1,1,3,EOL
            dt 5
                    
    Punto   dt EOL
            dt EOL
            dt EOL
            dt 7,EOL
            dt 2
    endasm
    VariableDefinition:
        CustChar    con EXT
        Zero        con EXT
        One         con EXT
        Two         con EXT
        Three       con EXT
        Four        CON EXT
        Five        CON EXT
        Six         CON EXT
        Seven       CON EXT
        Eight       CON EXT
        Nine        CON EXT
        Punto       CON EXT
                
        Clr         CON 1
        Comm        Con EXT
        EOL         con EXT
        Dx          con EXT
        Line        var byte[4]
            line[0]=$80
            line[1]=$C0
            line[2]=$94
            line[3]=$D4
        
        offset      var byte
        index       var byte
        Char        var byte
        ActualLine  var byte
        Addr        var word
        CounterA    var word       
        CounterB    var byte
        Number      var byte
        Pattern     var word[11]
            pattern[0]=zero
            pattern[1]=one
            Pattern[2]=two
            pattern[3]=three
            pattern[4]=four
            Pattern[5]=Five
            Pattern[6]=Six
            Pattern[7]=Seven
            pattern[8]=eight
            pattern[9]=Nine
            pattern[10]=Punto
            
        pause 500
    DumpCustChar:
        addr=0
        char=0
        repeat
            lcdout char
            reaDCODE custchar+addr,char
            addr=addr+1
            until char=eol
    
    Main:  
        countera=0
        repeat
            offset=0
            lcdout comm,clr
            counterb=3
            repeat
                number=countera dig counterb
                gosub displaynumber
                counterb=counterb-1
                until counterb=255
            pause 10
            countera=countera+1
            until countera>9999
            goto main
    
    DisplayNumber:
        actualline=0
        index=0
        lcdout comm,line[actualline]+offset
        Loop:
            readcode pattern[number]+index,char
            if char!=eol then 
                if actualline<4 then
                    lcdout char
                    else
                        offset=offset+char
                        Goto GetOut
                    endif
                else
                    actualline=actualline+1
                    if actualline<4 then lcdout comm,line[actualline]+offset
                endif
            index=index+1
            goto loop
        GetOut:
            RETURN
    Last edited by mister_e; - 4th January 2007 at 01:41.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Only the first 8 characters.
    By timseven in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd September 2009, 02:43
  2. Big big big memory or tiny SDs!
    By Ron Marcus in forum Off Topic
    Replies: 9
    Last Post: - 25th May 2007, 19:02
  3. Led scrolling display: How to mirror characters?
    By mahia2005 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th May 2007, 04:25
  4. LCD 16 characters inline: only first 8 work
    By Mugel in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th October 2006, 23:07
  5. LCD 4x20 HD44780
    By inteco in forum mel PIC BASIC
    Replies: 13
    Last Post: - 27th June 2006, 17:52

Members who have read this thread : 0

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