A tft addin for pbp3


Closed Thread
Results 1 to 40 of 142

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    MOVE?CB high (Bin), FSR2H ;load highbyte
    MOVE?CB low (Bin), FSR2L ;load low byte
    that's what I was looking for thanks pedja089

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


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    that's one down , works like a dream
    Code:
    GLCDSTR?CCB  macro Xin ,Yin ,Bin
            movlw    Xin
            CHK?RP    _X
            MOVWF     _X
            movlw    Yin
            CHK?RP    _Y
            MOVWF     _Y
            MOVE?CB high (Bin), FSR2H ;load highbyte 
            MOVE?CB low (Bin), FSR2L ;load low byte
    strloop movf POSTINC2, W ; Get a character
            bnz outstr1 ; Not null char 
            bra exstr
    outstr1 MOVWF _g_chr   
            L?CALL _gcga  
            bra   strloop
    exstr   
        endm

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    woops - looping in macro for multiple calls is a no go
    needs to be like this

    Code:
    GLCDSTR?CCB  macro Xin ,Yin ,Bin
            movlw    Xin
            CHK?RP    _X
            MOVWF     _X
            movlw    Yin
            CHK?RP    _Y
            MOVWF     _Y
            MOVE?CB high (Bin), FSR2H ;load highbyte 
            MOVE?CB low (Bin), FSR2L ;load low byte
            L?CALL  bfill
      
        endm           
    
    
      
    bfill
    Next_Char 
            movf POSTINC2, W	; Get a character
            bnz	outchr	; Not null char 
            bra exstr2
    outchr	MOVWF _g_chr 
            L?CALL _gcga  
            bra   Next_Char 
    exstr2  return

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    now have strings and circles, moved font to include file


    USERCOMMAND?S
    HOW TO USE THIS STILL ELUDES ME would be nice for display of "constant" string
    Attached Images Attached Images  
    Attached Files Attached Files

  5. #5
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    You can use label in macro and multiple call to that macro.
    Just need to define your labels as local.
    Here is local used in my example:
    Code:
    TFTSTR?B macro Bin
    	MOVE?CB	high (Bin), FSR2H ;load highbyte  
            MOVE?CB	low  (Bin), FSR2L ;load low byte  
    local tftstrloop 
    local tftStrDone
    tftstrloop movf POSTINC2, W	; Get a character, then increment pointer
            BZ  tftStrDone ;All strings must end with 0
           ;Not Null char 
            L?CALL tftWoutput; CALL print char in W to TFT 
            BRA tftstrloop ;Get next chr
          
    tftStrDone: ;Null char
    
    endm ;end of macro
    But way your done use less FLASH
    And you can make bfill little smaller
    Code:
    bfill
    Next_Char 
            movf POSTINC2, W	; Get a character
            bz	exstr2  ; Null char 
     	    MOVWF _g_chr 
                L?CALL _gcga  
                bra   Next_Char 
    exstr2  return
    To save few bytes in FLASH.
    And I'll suggest you to put TFT_ in front all labels and variable names so there is minimal chance for user to duplicate label/variable or unintentional use one of tft variables.

  6. #6
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    And for "Constant String" I don't know how to implement it with user command. But I know assembler part
    Here is use of asm macro
    PrintStr 0,0," Test Clock"
    And macro:
    Code:
    PrintStr macro x, y, Str
     local TheString, OverStr ; define local labels so you can call macro multiple times
     goto OverStr ' goto over string stored in FLASH, so processor can't execute that
    TheString ;label to get address of your string
     data Str, 0 ;add string to flash at TheString address and end string with 0
    OverStr
     MOVE?CB x, _GLCD_X
     MOVE?CB x, _GLCD_SX
     MOVE?CB y, _PosY
     MOVE?CW TheString, _GLCD_Addr ;move addres of string to word variable, don't know how it would work with device that have more than 65535K of FLASH???
     L?CALL _GLCD_StringOut 
     endm
    ENDASM
    
    GLCD_StringOut:
    Readcode GLCD_Addr, GLCD_Char ' Get a character
    if GLCD_Char = 0 then RETURN ' Look for Null char, Stop if found
    ......
    RETURN
    This is from example for nokia 3310 lcd, that I tried to get to work with GLCD with KS0108 controler.
    Last edited by pedja089; - 22nd June 2015 at 12:55.

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    Just need to define your labels as local.
    brilliant , thanks for the tip pedja089

    And for "Constant String" I don't know how to implement it with user command
    seems nobody does

    I might just stick to my flash2ram macro for now

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    now with drawline and a bit of optimising
    I will wait now for my 2.8" ILI9340C tft display to arrive and see if I can separate out a hw include for each type
    Attached Files Attached Files

  9. #9
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    Compiler know how to handle user command with string.
    So lets try to get something...
    Try this code:

    Code:
    GLCD_Addr var word
    GLCD_Char var byte
    asm   
    ;----[String]---------------------------------------------------------------
    GLCDC?S  macro Cin
     local TheString, OverStr ; define local labels so you can call macro multiple times
     goto OverStr ; goto over string stored in FLASH, so processor can't execute that
    TheString ;label to get address of your string
     data Cin, 0 ;add string to flash at TheString address and end string with 0
    OverStr
     MOVE?CW TheString, _GLCD_Addr ;move addres of string to word variable, don't know how it would work with device that have more than 65535K of FLASH???
     L?CALL _GLCD_StringOut 
     endm
    
     ENDASM
    GLCD_StringOut:
    Readcode GLCD_Addr, GLCD_Char ' Get a character
    if GLCD_Char = 0 then RETURN ' Look for Null char, Stop if found

  10. #10
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    now have the image rotation corrected , made all the x,y vars word sized (heading towards a portrait/landscape command)
    the font now has lowercase , chars 32-127. and few other subtle changes
    the image file can be located anywhere , have tested with a 127k pic18f87j11 and loading file past the 64k boundary is no problem
    Attached Files Attached Files

  11. #11
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    back in post #54 I uploaded another python script 565-pbp.py that code is a bit simpler , it just converts the data . also if you intend to use an external flash chip with my flash code then your pic18 needs to have two mssp ports . I found buffering image data between flash and tft with them on the same port was just too tedious and slow and gave up on the process , its doable but complicated .

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