A tft addin for pbp3


Closed Thread
Results 1 to 40 of 142

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    I won't speak for Richard but I'd take this as the opportunity you've been looking for to finally justify the upgrade PBP3 - you've now found a feature it has that you want/need ;-)

    /Henrik.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    I won't say its impossible but


    lets take one simple usercmd

    GLCDSTR 2,2,buff
    macro called is

    GLCDSTR?CCB macro Xin ,Yin ,Bin
    MOVE?CW Xin , _X
    MOVE?CW Yin ,_Y
    MOVE?CB high Bin, FSR1H ;load highbyte
    MOVE?CB low Bin, FSR1L ;load low byte
    L?CALL tft_str_out
    endm

    translation to pbp2.6


    X=2
    Y=2
    @ MOVE?CB high _buff, FSR1H ;load highbyte
    @ MOVE?CB low _buff, FSR1L ;load low byte
    call tft_str_out
    not too difficult but its messy and could get very ugly very quickly , as henrik says an upgrade looks good

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    Would love to upgrade, but being a casual user, and between jobs, upgrading is simply not an option for me at the monemt

  4. #4
    Join Date
    Feb 2013
    Posts
    1,122


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    Just found this thread! I like idea very much, and I'd like to contribute, but my programming skills aren't that good. However, I'm way better on graphics, so I can create better looking fonts with chars of different dimensions. Just point me to font file so I can have look how it is organized.

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    the fonts are really 8x8 fronts but the alpha/numeric char only use 7x8 with the last bit always o (for chr spacing)
    there are two fonts in this thread the first is chr 32-90 and the second chr 32-127. I have a extended font (attached) that has
    a radio button arrows ,play,stop,pause,speaker on/off symbols ,these use the full 8x8

    this is the routine to display font chars
    Code:
    g
    cga:
        g_fontoffset = (g_chr-font_begin)*8   +  fontaddr 
        
        if   (x+textsize*7) > width  then return
        if   (y+textsize*8) > height  then return
        if      (g_chr <font_begin) ||  (g_chr >font_end )   then return
        for ROW=0 to 7    ;font height   this would need to be a var set to font height size
            readcode g_fontoffset +ROW,ctemp  ;this would need to be able to "unpack" different font with bits
            for PIXEL=0 to 7   ;font width ; font width var req here too
                X1= X+PIXEL
                X0=X1
                Y0=Y+7-ROW
                Y1=Y0
                IF   TEXTSIZE  ==1 THEN
                    GOSUB SETWINDOW
                    if ctemp.0[PIXEL]  then
                          ;SETPIXEL X+PIXEL,Y+7-ROW ,FG
                          TFT_CMD_IN= FG>>8
                          GOSUB TFT_DATA
                          TFT_CMD_IN= FG
                          GOSUB TFT_DATA
                    ELSE
                          ;SETPIXEL X+PIXEL,Y+7-ROW ,BG
                          TFT_CMD_IN= BG>>8
                          GOSUB TFT_DATA
                          TFT_CMD_IN= BG
                          GOSUB TFT_DATA
                    ENDIF
               ELSE
                    X0=X+PIXEL*TEXTSIZE 
                    Y0=Y+( 7-ROW )*TEXTSIZE 
                    X1= TEXTSIZE 
                    Y1= TEXTSIZE
                    if ctemp.0[PIXEL]  then
                         FrG=fg
                         GOSUB frectc
                    ELSE
                         FrG=BG
                         GOSUB frectc
                    ENDIF
                ENDIF
            NEXT
        next
        x=x+textsize*7       ;auto increment x for str function ;  and font width here too
    RETURN
    the arduino utft code can handle variable width fonts by storing a second table along with the font . that table records the h/w of every chr in the font and ascii val of the first and last chr in the font too.
    its pretty straight forward but not trivial task to change the pgm to do that ; however all the text box code for buttons etc would need to be altered too
    Attached Files Attached Files

Similar Threads

  1. Replies: 0
    Last Post: - 25th September 2013, 18:33
  2. code examples / libraries for ILI9320 2.8" TFT LCD Module
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 6th June 2013, 08:50
  3. I really need some help with PBP3
    By Ramius in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th February 2012, 16:05
  4. What's with PBP3?
    By BrianT in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th August 2011, 17:09
  5. Experience of driving TFT screens?
    By isaac in forum General
    Replies: 1
    Last Post: - 26th September 2008, 00:15

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