Graphic LCD support?


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Graphic LCD support?

    I first I tried so I just used a lookup instead of eeprom ....
    Here's the code
    Code:
    trisb=0
    trisd=0           
    portb=0
    portd=0 
    symbol RW=portb.3
    symbol RS = portb.2
    symbol E = portb.4
    symbol CS1 = portb.0
    symbol CS2 = portb.1
    symbol RST = portb.5
    Symbol LCDDATA=portd
    i var byte
    X var byte
    Y var byte
    pocetak:
    call init
    
     LCDDATA=0
     call clr
     cs1=0
     x=1
     call setx
    
     y=0
     call sety
     for i=0 to 63 
        Lookup i, [$00,$00,$FE,$FE,$FE,$FE,$1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E,$FE,$FE,$FC,$F8,$00,$FE,$FE,$FE,$FE,$0E,$0E,$0E,$0E,$0E,$0E,$0C,$00,$00,$00,$FE,$FE,$FE,$FE,$0E,$0E,$0E,$0E,$0E,$0E,$0E,$FE,$FC,$F8,$F0,$00,0,$FE,$FE,$FE,$FE,$0E,$0E,$0E,$0E,$0E,$0E,$FE,$FE,$FC,$F8], LCDDATA
        call pod
     next i
     x=2
     y=0
     call sety
     call setx
     for i=0 to 63 
        Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$FF,$FF,$7F,$3F,$00,$FF,$FF,$FF,$FF,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$00,$00,$E0,$FF,$FF,$FF,$FF,$E0,$E0,$C0,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$00,0,$FF,$FF,$FF,$FF,$80,$80,$80,$80,$80,$80,$FF,$FF,$FF,$FF], LCDDATA
        call pod
     next i
      x=3
      y=0
     call sety
     call setx
     for i=0 to 63 
        Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$01,$01,$01,$01,$01,$01,$01,$00,$00,$01,$FF,$FF,$FF,$FF,$01,$01,$01,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$00,0,$FF,$FF,$FF,$FF,$07,$07,$07,$07,$07,$07,$FF,$FF,$FF,$FF], LCDDATA
        call pod
     next i
    
      x=4
      y=0
     call sety
     call setx
     for i=0 to 63 
        Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$00,$00,$FF,$FF,$FF,$FF,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$FF,$FF,$FF,$FF,$00,0,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF], LCDDATA
        call pod
     next i
     
     LCDDATA=0
     cs1=1 
     cs2=0
     
      x=1
     call setx
     for i=0 to 63 
        Lookup i, [$00,$00,$FE,$FE,$FE,$FE,$1E,$1E,$1E,$1E,$1E,$1E,$1E,$1E,$FE,$FE,$FC,$F8,$00,$FE,$FE,$FE,$FE,$1E,$1E,$1E,$1E,$1E,$1E,$FE,$FE,$FC,$F8,$00,$FE,$FE,$FE,$FE,$0E,$0E,$0E,$0E,$0E,$0E,$0E,$FE,$FE,$FC,$F8,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00], LCDDATA
        call pod
     next i
     x=2
     call setx
     for i=0 to 63 
        Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$00,$FF,$FF,$FF,$FF,$80,$80,$80,$80,$80,$80,$FF,$FF,$FF,$FF,$00,$FF,$FF,$FF,$FF,$80,$80,$80,$80,$80,$80,$80,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00], LCDDATA
        call pod
     next i
      x=3
     call setx
     for i=0 to 63 
        Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$00,$FF,$FF,$FF,$FF,$07,$07,$07,$07,$07,$07,$FF,$FF,$FF,$FF,$00,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00], LCDDATA
        call pod
     next i
      x=4
     call setx
     for i=0 to 63 
        Lookup i, [$00,$00,$FF,$FF,$FF,$FF,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$FF,$FF,$FF,$FF,$00,$FF,$FF,$FF,$FF,$E0,$E0,$E0,$E0,$E0,$E0,$FF,$FF,$FF,$FF,$00,$00,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$E0,$FF,$FF,$FF,$FF,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00], LCDDATA
        call pod
     next i
     PAUSE 5000
     
    cs1=1
    cs2=1
     CALL CLr
     x=0
     y=0
     call setx
     call sety
     LCDDATA=0   
     CS2=1
     cs1=0
      y=10
      x=1
     call setx
     call sety
     for i=0 to 63 
        Lookup i, [$00,$7E,$12,$1E,$00,$00,$7E,$4A,$4A,$4A,$00,$7E,$42,$42,$3C,$00,$60,$40,$7E,$00,$60,$1C,$12,$1C,$60,$00,$7E,$42,$7E,$00,$7E,$4A,$7E,$00,$5E,$52,$7E,$00], LCDDATA
        call pod
     next i
     
      y=26
      x=3
     call setx
     call sety
     
     for i=0 to 37 
        Lookup i, [$00,$3E,$40,$3C,$02,$3C,$40,$3E,$00,$00,$3E,$40,$3C,$02,$3C,$40,$3E,$00,$00,$3E,$40,$3C,$02,$3C,$40,$3E,0,64,0,$7E,$4A,$4A,$4A,$00,$7E,$40,$40,$00], LCDDATA
        call pod
     next i
     
     cs2=0
     cs1=1
    
     x=3
     call setx    
    for i=0 to 63 
        Lookup i, [$7E,$4A,$4A,$4A,$00,$7E,$10,$18,$24,$42,$02,$7E,$02,$02,$00,$7E,$0A,$1A,$6E,$00,$3C,$42,$42,$42,$3C,$00,$7E,$0C,$30,$7E,$00,$00,$7E,$00,$7E,$10,$18,$24,$42,$00,$60,$1C,$12,$1C,$60,$00,$40,$00,$7E,$48,$78,$00,$60,$1C,$12,$1C,$60,0], LCDDATA
        call pod
     next i
     cs2=1
     cs1=1
    pause 2000 
    for i=63 to 32 step -1
     LCDDATA=192+i
     call kom
     pause 400
    next i
    
    goto pocetak
    end
    
    
    Init:
     x=0
     y=0
     rw=0
     cs1=0
     cs2=0
     e=1
     LCDDATA=0
     rst=0
     pause 1
     rst=1
     cs1=1
     cs2=1
     
     call Dispon
     LCDDATA=192
     call kom
    return
    
    Pod:
        rs=1
        e=0
        pauseus 1
        e=1
    return
    Kom:
        rs=0
        e=0
        pauseus 1
        e=1
    return
    
    SetX:
        LCDDATA=184+x
        call Kom
    return
    
    SetY:
        LCDDATA=64+y
        call Kom
    return
    
    Clr:
     for x=0 to 7
      call setx
      y=0 
      call sety
     LCDDATA=0
     for i=0 to 63
      call pod
     next i
     next x
    return
    
    DispOff:
    LCDDATA=62
    call kom
    return
    
    DispOn:
    LCDDATA=63
    call kom
    return

    But then the problem was that every time I want to print something, I have to draw a picture of the entire display, or create the font, and for each letter copy 5 bytes. Then I found a forum for the LCD of Nokia 3310, and tried to correct for KS0108.
    I hope to be able to finish it, but now I am busy doing other things, so...

  2. #2
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Default Re: Graphic LCD support?

    Hi guys,

    I have been talking to our friend pedja089 about the lib in the first lib.

    I did some good improvements, and now, I can print strings and Variables correctly.

    I have already started writing some basic graphic routines, and I would like to publish it here as a contribution if our friend pedja089 agree with it, and I think he will.

    To test it I did a small simple digital clock, just to check if printing is working.

    The code compiles ok when I use a 18F4550 as a target controller. The hex's size is about 4500 bytes.

    But, when I change to the 16F877, (which has 8kb available) it always show me the following erros :

    Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (6573)
    Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (7420)
    Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (436C)
    Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (6F63)
    Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (6800)
    Message[303] c:\teste_~1\glcd_p~1.asm 207 : Program word too large.Truncated to core size. (7820)

    The line 207 in the Asm code is :

    data Str, 0

    from the macro :

    PrintStr macro x, y, Str
    local TheString, OverStr
    goto OverStr
    TheString
    data Str, 0
    OverStr
    MOVE?CB x, _GLCD_X
    MOVE?CB x, _GLCD_SX
    MOVE?CB y, _PosY
    MOVE?CW TheString, _GLCD_Addr
    L?CALL _GLCD_StringOut
    endm

    I admit that I am absolutely noob on writing/uderstanding assembler.

    Does some one have any ideao of what is wrong with this Macro.

    Is this restricted to 18F series ?

    Thank you !

    regards,

    Sérgio

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


    Did you find this post helpful? Yes | No

    Default Re: Graphic LCD support?

    Yup 18F don't work the same way for embedded strings. You may want to have a look at least at the following.

    http://www.pbpgroup.com/modules/wfse...p?articleid=10

    Notice the use of da vs Data and how to retrieve them.

    You could also have a look at my NOKIA driver/wrapper.
    http://www.picbasic.co.uk/forum/show...?t=327&page=54
    Last edited by mister_e; - 11th May 2012 at 09:42.
    Steve

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

  4. #4
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Default Re: Graphic LCD support?

    Thank you Mister_e !


    I will spend some time this weekend trying to make the Lib better.

    I would like to make it work with 16F series (877 and above) and 18F and make it public.

    There are a lot of nice and cheap KS0108 for sale on eBay. I bought some from the seller Wide Hk and they are small and nice. Perfect for embeded solutions.

    Well, let´s study the posts and try to fix it !

    regards,

    Sérgio

  5. #5
    Join Date
    Jun 2005
    Location
    Up the bush, Western Plains, NSW Au
    Posts
    216


    Did you find this post helpful? Yes | No

    Default Re: Graphic LCD support?

    I know there are heaps of different GLCD controller types around, but surely the gurus at MELabs could toss a coin and pick one that they consider to be the most popular (KS0108?) and do some GLCDOUT type stuff for that controller? After all, they did exactly that when they selected the Hitachi 447?? (whatever) controller they wrote the LCDOUT stuff for? That has proven quite usable?
    My 2 cents worth, but I won't hold my breath.
    Peter Moritz.
    Up the bush, Western Plains,
    New South Wales,
    Australia.

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Graphic LCD support?

    Or a couple of different libraries to cover a few flavors of GLCDs. Like other compilers do.

    Ioannis

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Graphic LCD support?

    Sure, if they did it I wouldn't protest against it.
    But, as you say, there are plenty of graphic LCD controllers but basically only ONE standard for characters based displays and that IS the HD44780 (or compatibles). It's also a lot easier to drive than the graphical controllers, trust me I've tried with the RA6963C and the SSD1307. One issue is that the HD44780 basically just works and doesn't care about the number of characters per line etc, it doesn't care about the size (appart from number of lines) of the panel it's actually driving. But the graphical controllers are usually quite flexible when it comes to resolution of the panel and needs to be configured properly (not to mention timings, multiplex ratios etc etc.

    My experience with MeLabs is that what they do they do properly and to do a general purpose GLCD driver to their standars is a LOT of work.

    I wonder what they ARE working on at MELABS HQ nowadays, there's been no updates to compiler for 18 months. Darrels recent and unfortunate passing must have put a real dent in available resources

    /Henrik.

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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