Today 13:14
Forum: Proton 24
Starter: charliecoultas
Views: 0
Replies: 4
Today 13:06
Forum: Proton Plus Compiler v3
Starter: AlbertoFS
Views: 0
Replies: 26
Today 12:28
Forum: GPS
Starter: AlbertoFS
Views: 0
Replies: 8
Today 00:00
Forum: Proton Plus Compiler v3
Starter: analogdevice
Views: 0
Replies: 1
Yesterday 14:34
Forum: Proton Plus Compiler v3
Starter: joesaliba
Views: 0
Replies: 0
+ Reply to Thread
Page 3 of 6 FirstFirst 12345 ... LastLast
Results 21 to 30 of 54

Thread: SPI GLCD Help needed1937 days old

  1. #21
    Senior Member DaveS's Avatar
    Join Date
    Aug 2004
    Posts
    935
    Thumbs Up
    Received: 11
    Given: 2
    Total Downloaded
    1.07 GB

    0 Not allowed!

    Default Re: SPI GLCD Help needed

    As last post __LCD_WRITEBYTE_
    I haven't tested this
    @ __LCD_WRITEBYTE_
    Cursor_Y = WREG
    Cursor_X = GEN
    DataByte = GENH
    GoTo Write_Byte_Routine
    Return
    Last edited by DaveS; 2nd May 2012 at 23:34.
    Regards
    Dave

  2. #22
    Senior Member barak's Avatar
    Join Date
    Apr 2008
    Posts
    743
    Thumbs Up
    Received: 48
    Given: 11
    Total Downloaded
    783.11 MB

    0 Not allowed!

    Default Re: SPI GLCD Help needed

    OK, finally had some time and now everything works. Not the most elegant solution but it works OK and covers all the key commands as well as custom fonts in the FontConverter table structure. Thank you all for the help. Flosi, digging into the assembler was the best idea. Iíll try to put something on the wiki. Meanwhile, here are the disable and redirect portions:
    Code:
    Declare LCD_Type graphic'  
        '---[disable PDS GLCD lib]-----------------------     
        #disable Print,_
        GLCD_CLS,_
        GLCD_READ,_
        GLCD_READTEXT,_
        GLCD_WRITE,_
        GLCD_PIXEL,_
        GLCD_PLOT,_
        GLCD_CURSOR,_
        GLCD_CIRCLE,_
        GLCD_BOX,_
        GLCD_LINE,_
        GLCD_LOW_LEVEL
        '================================================
        GoTo EndOfGLCD                                  ' jump over all functions
        '================================================
    GlcdLibRedirect:
        '---[Redirect PDS GLCD lib]----------------------
        Asm 
        '------------------------------------------------
        GLCD@CLS                                        ' Cls - clear the screen and the memory image
        GoTo ClsRedirect                  
        Return
        '------------------------------------------------
        GLCD@CUR                                        ' Cursor ypos, xpos - Position the cursor on graphic LCD
        Movwf xpos                                      ' WREG = XPOS
        Movff GEN, ypos                                 ' GEN = YPOS (Line)            
        GoTo CursorRedirect                  
        Return
        '-----------------------------------------------
        Print                                           ' Print or Print at ypos, xpos 
        Movwf strbyte                                   ' WREG = character to display, strbyte must be put back to WREG at the end of the sub in case of repeating char
        GoTo PrintRedirect            
        Return
        '------------------------------------------------
        __LCD_PLOT_                                     ' Plot ypos, xpos
        Movwf xpos                                      ' WREG = XPOS
        Movff GEN, lpos                                 ' GEN = lpos is the row number 0-63 (Not Page/Line!)            
        Bsf pix_bit                                     ' set bit plot a pixel
        GoTo PlotRedirect                  
        Return
        '-----------------------------------------------
        __LCD_UNPLOT_                                   ' UnPlot ypos, xpos
        Movwf xpos                                      ' WREG = XPOS
        Movff GEN, lpos                                 ' GEN = lpos is the row number 0-63 (Not Page/Line!)            
        Bcf pix_bit                                     ' clear bit to unplot
        GoTo PlotRedirect                  
        Return
        '-----------------------------------------------
        __LCD_LINE_                                     ' Line set_clear, x-start, y-start, x-end, y-end
        Movwf y1                                        ' WREG = YPOS end
        Movff GENH, x1                                  ' GENH = XPOS end
        Movff GEN2H, lpos                               ' GEN2H = YPOS start
        Movff GEN2, xpos                                ' GENH = XPOS start
        Bsf pix_bit                                     ' set bit plot a pixel
        Btfss BPF,2                                     ' test BPF Bit 2 - skip next if bit is 1
        Bcf pix_bit                                     ' clear bit to unplot
        GoTo LineRedirect
        Return
        '-----------------------------------------------
        __LCD_CIRCLE_                                   ' Circle set_clear, xpos, ypos, radius
        Movwf radius                                    ' WREG = radius
        Movff GEN2, x0                                  ' GEN2 = YPOS
        Movff GEN2H, y0                                 ' GEN2H = XPOS 
        Bsf pix_bit                                     ' set bit plot a pixel
        Btfss BPF,2                                     ' test BPF Bit 2 - skip next if bit is 1
        Bcf pix_bit                                     ' clear bit to unplot
        GoTo CircleRedirect
        Return
        '------------------------------------------------
        __LCD_BOX_                                      ' box set_clear, xpos, ypos, size (only a square - see Rectangle below)
        Movwf radius                                    ' WREG = radius
        Movff GEN2, x0                                  ' GEN2 = YPOS
        Movff GEN2H, y0                                 ' GEN2H = XPOS 
        Movff BPF, pix_byte                             ' BPF to a var bit#2 is the plot/unplot flag
        GoTo BoxRedirect
        Return
        '------------------------------------------------
        __LCD_WRITEBYTE_                                ' LCDWrite ypos, xpos,[byte,{byte etc...}]
        Movwf Char                                      ' the byte to write at page
        Movff GEN, ypos                                 ' load to page var
        Movff GENH, xpos                                ' load to col var
        Incf GENH                                       ' col +1 for next then byte if any
        GoTo LCDWriteRedirect
        Return
        '-----------------------------------------------
        EndAsm

  3. #23
    Senior Member barak's Avatar
    Join Date
    Apr 2008
    Posts
    743
    Thumbs Up
    Received: 48
    Given: 11
    Total Downloaded
    783.11 MB

    0 Not allowed!

    Default Re: SPI GLCD Help needed

    OK its on the Wiki, just need a moderator to publish

  4. #24
    Moderator wastrix's Avatar
    Join Date
    May 2008
    Posts
    2,874
    Thumbs Up
    Received: 2
    Given: 3
    Total Downloaded
    0

    0 Not allowed!

    Default Re: SPI GLCD Help needed

    It's published, thanks.
    "If you have an important point to make, don't try to be subtle or clever. Use a pile driver."
    - Winston Churchill
    If you want to contact me, please email me, don't PM me.

  5. #25
    Senior Member DaveS's Avatar
    Join Date
    Aug 2004
    Posts
    935
    Thumbs Up
    Received: 11
    Given: 2
    Total Downloaded
    1.07 GB

    0 Not allowed!

    Default Re: SPI GLCD Help needed

    Hi Barak

    You beat me to it, here's where I got to it's not finished, but it works with 16F and 18F devices covered Lcdread and Pixel haven't done box yet got stuck on LineTo losing pos Start or End forget at moment.
    My goal was to mimic exactly what you would get if using the compiler driver so I knocked up a driver for the KS0108 will cover 64x64, 128x64, 192x64, 128x128 eventually.
    Still to do alias some of the drawing vars, I had problems so not done yet.
    So for a base template for other drivers, we just do what the compiler driver does, it then should be easy to change for a different controller chip.
    Then we can add fancy stuff later such as variable width & height chars, should have a define to select simple or any size width & height chars.
    I also have my own routine for printing variable any size width & height chars or images this prints in whole bytes not pixels so hopefully should be faster, should also work with a Toshiba screen with slight mods, I will share this later.

    I think it's a bit early to publish, I would like to see a common lcd driver template

    KS0108_Driver.zip
    Regards
    Dave

  6. #26
    Senior Member barak's Avatar
    Join Date
    Apr 2008
    Posts
    743
    Thumbs Up
    Received: 48
    Given: 11
    Total Downloaded
    783.11 MB

    0 Not allowed!

    Default Re: SPI GLCD Help needed

    Hi Dave,
    It looks like your KS0108 driver is on a bigger scale then my SPI-GLCD specific piece of code. Feel free to integrate anything from my demo into your driver so it can also support ST7565 based GLCDs (the can be parallel or SPI).
    The demo is not a real "driver", it's based on a commercial project that I'm currently working on.
    Check the wiki at http://www.protonbasic.co.uk/content...65R-Controller It explains the project and you can download the demo code from a link on the wiki.

    Overall, I feel that it can be done more elegantly and efficiently, if I could only figure a way to intercept and redirect only the actual communications with the LCD so all the library commands will be done in the original compiler routines.

    I don't know much about AMICUS but since it uses 18F2XK2X, I'm sure it quickly gets low on I/O's so SPI GLCD may be a better way to go. Also, the cost of LCDs with ST7565 controller is really low, I have quotes from China for a 128x64 SPI GLCD with back light for as low as $3 a piece at 100pcs!
    These considerations, I hope, will motivate Les to add, in his "spare time", support of SPI GLCDs with ST7565 controller. Either by adding an option to the GLCD_Type that will internally route to SPI and ST7565 controller commands, or by developing a real driver like the one in Amicus18_Colour_Glcd_Shield (it will be way simpler for ST7565).

  7. #27
    Senior Member DaveS's Avatar
    Join Date
    Aug 2004
    Posts
    935
    Thumbs Up
    Received: 11
    Given: 2
    Total Downloaded
    1.07 GB

    0 Not allowed!

    Default Re: SPI GLCD Help needed

    Hi Barak

    Excellent job done with your driver.

    I picked the KS0108 chip because I could test in Isis.
    When I get time I will finish it and if it's good enough to use as a base template for other drivers.
    I dont think you can use the compilers build in drawing routines, because it's calling for other labels such as SETUP@LCD etc, although could add these, to much to figure out for me.
    Personaly I think Les is better off spending time on the compiler, than writing glcd drivers.
    Regards
    Dave

  8. #28
    Junior Member PhilJ1's Avatar
    Join Date
    Jul 2007
    Posts
    93
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default Re: SPI GLCD Help needed

    I've been trying to compile the demo as posted and I'm coming up with all sorts of errors - I'm using IDE 2.0.1.0, Compiler is 3.5.2.3 win 7 64bit - is anybody else ?

  9. #29
    Senior Member barak's Avatar
    Join Date
    Apr 2008
    Posts
    743
    Thumbs Up
    Received: 48
    Given: 11
    Total Downloaded
    783.11 MB

    0 Not allowed!

    Default Re: SPI GLCD Help needed

    It was developed with the beta version. I just compiled it with no errors on beta version 3.5.3.9 (ide 2.0.1.2)

  10. #30
    Junior Member PhilJ1's Avatar
    Join Date
    Jul 2007
    Posts
    93
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default Re: SPI GLCD Help needed

    GLCD_Spi_err.jpg

    Thanks for getting back to me, after upgrading to the same version as you have - I get the above problem - I simply downloaded your Demo from the wiki and tried to compile - hope you can advise

    Cheers

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. SPI - (Can't belive a search on SPI yields no results?)
    By Peter Truman in forum Proton Plus Compiler v3
    Replies: 12
    Last Post: 30th September 2012, 10:12
  2. Replies: 7
    Last Post: 21st June 2012, 16:43
  3. Cheap GLCD needed
    By Tim in forum The Lounge
    Replies: 15
    Last Post: 8th September 2009, 18:10
  4. Another connector needed.
    By See_Mos in forum Wanted and For Sale
    Replies: 0
    Last Post: 17th July 2009, 09:01
  5. advice needed
    By C_Moore in forum The Lounge
    Replies: 7
    Last Post: 4th July 2006, 15:48

Members who have read this thread : 105

Actions :  (Set Date)

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

Tags for this Thread

Posting Permissions

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