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,714


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    The 2.2 " ili9341 (ili9340c how do tell) arrived today , after resoldering all the dry joints on the module it works .
    I have separated things out like this main pbp pgm --- usercommand pbpmod file , an include bas file for either st7735 or ili9341 and a font bas file


    in the pbp file
    your hardware connections
    Code:
    ;----GLOBAL----HW---------   
        SSP_IF VAR PIR3.7      ; must match your spi port 
       tft_dc_bit con  32     ;5      binary weighted pin values 
        tft_cs_bit con 16   ;4 
        tft_rst_bit con 128   ;7
        tft_port var lath ;          ; the output port for control signals
    includes

    Code:
        INCLUDE "glcd_chr.pbpmod"        ;glcdc
        include "tft-ILI9431.bas"      one or the other  not both
    ;    include "tft-ST7735.bas"      one or the other  not both
    
        INCLUDE "DT_INTS-18.bas"
        INCLUDE "ReEnterPBP-18.bas"
        INCLUDE "Elapsed_INT-18.bas"
        INCLUDE "font7x8.bas"
    in the usercommand file glcd_chr
    WIDTH con 320;160 X
    HEIGHT con 240; 128 Y
    set to appropriate values

    and this bit needs to match your spi port too a definite conditional compile potential here
    Code:
         
    TFT_CMD:
    spi_cbyte :
        tft_port =  tft_port & (~ tft_dc_bit )
    TFT_DATA:    
    spi_byte :
    @       movff    INTCON , _p_int 
    @       bcf     INTCON ,7 
        tft_port =  tft_port& (~ tft_cs_bit )
        SSP_IF = 0
        SSP2BUF = CMD 
        WHILE   SSP_IF =0 ' wait for SPI interupt flag
        wend
        tft_port = tft_port |   ( tft_dc_bit|  tft_cs_bit   )
        
    @     movff  _p_int  , INTCON 
    return

    and off you go

    I would have liked to have the hw connections and the height width in the relevant hw include file but that presented too many issues for me
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    173


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    Hi Richard,

    I am keen to replicate the great work you are doing with these TFT displays.
    I have looked on eBay for an ILI9341 display and there appears to be a gazillion of them to choose from.
    Can you share information on the eBay seller you bought your display from?

    Cheers
    Barry
    VK2XBP

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


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    hi barry ,these are what I used I'm sure the others would be ok too just make sure the I/f is spi
    http://www.ebay.com.au/itm/271683495...%3AMEBIDX%3AIT
    http://www.ebay.com.au/itm/191534577...%3AMEBIDX%3AIT

  4. #4
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    173


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    Thanks Richard.

    I have now placed an order and hope to take delivery some time in July.

    Cheers
    Barry
    VK2XBP

  5. #5
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    Very nice work Richard!
    ILI9341 based TFT display with resistive touch screen could be the module that I was searching.
    With STMPE610 touch controller (SPI/I2C) it would be easy to make systems that do not need any additional input devices (buttons/joystick).

  6. #6
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    Hi Richard

    I am little confused how to adjust code to work.
    I have a PIC18F45K22 and I plan to use it with your code but I never work with this PIC processor and I need some Help to configure it.


    From datasheet of PIC18F45K22 PORTD.0 is SPI clock and PORTD.4 i SPI data out.

    What I must change in your TFT_demo code to adjust PIC pin to work with TFT display.
    Whether the pins of TFT displays D/C and RESET connected together on the same pin of the PIC processors or not.

    Code:
    ;----GLOBAL----HW---------   
        SSP_IF VAR PIR3.7
        tft_dc_bit con  32     ;5
        tft_cs_bit con 16   ;4 
        tft_rst_bit con 128   ;7
        tft_port var lath 
      
      
      
    
        INCLUDE "glcd_chr.pbpmod"        ;glcdc
        include "tft-ILI9431.bas" 
    ;    include "tft-ST7735.bas"
        INCLUDE "DT_INTS-18.bas"
        INCLUDE "ReEnterPBP-18.bas"
        INCLUDE "Elapsed_INT-18.bas"
        INCLUDE "font7x8.bas"
        
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,           Type,   ResetFlag?
            INT_Handler   TMR1_INT,   _ClockCount,   PBP,  yes
        endm
        INT_CREATE
    
     
    ENDASM  
    @ INT_ENABLE  TMR1_INT 
      
       
     
     
     
    
    
      
      define OSC 48
     
    '   osccon=$70   '64 mhz
       OSCTUNE.6=1 
       trisb.7=0
       trish=0        ' each pin on d has a led  for debug
       trisd.6=0     ;sck
       trisd.4=0      ;sdo
      
        BOXX VAR  BYTE
        BOXY VAR  BYTE
        BOXZ VAR  BYTE
        disp var byte
        tmp var word
        buff var byte[32]
       SSP2CON1=$20  ;$20 works too
       SSP2STAT=$40
       
       ;led var latd.7
      latb.7=1
     
      ;led=1
      gosub tft_init
    
     Serout2 PORTb.7,84,["ready ",#latd, 13,10]
     glcdc  font7x8       ;SET FONT


    is this OK?

    [CODE];----GLOBAL----HW---------
    SSP_IF VAR PIR3.7 'I don't understand what it mean

    symbol tft_dc_bit = PORTB.5
    symbol tft_cs_bit = PORTB.4
    symbol tft_rst_bit = PORTB.7

    tft_port var PORTB

    SDi from display I connect to PORD.4 and SCK from display I connect to PORTD.0 on PIC processor

  7. #7
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    hi Richard,

    today arrived TFT display to me from eBay.

    I can not wait to start playing with it

    Do you can tell me if this is the correct way to connecting peripherals with a PIC processor (pic18f87J11)



    TOUCH PANEL connection to PIC

    TOUCH PANEL PIC
    T_CS PORT F.2
    T_DIN PORT F.3
    T_DO PORT F.4
    T_CLK PORT F.1
    T_IRQ PORT F.5


    TFT display connection to PIC

    TFT DISPLAY PIC
    DC PORT C.2
    CS PORT C.1
    RST PORT C.0
    MOSI PORT C.5
    SCK PORT C.3




    FLASH MEMORY W25Q32 connection to PIC
    FLASH W25Q32 PIC

    CS PORT H.0
    SO PORT D.5
    SI PORT D.4
    SCK PORT D.6




    My TFT module have a XPT2046 touch controller is this the some controller on your board?
    Model of my tft module is : TJTCM24028-SPI 2.8 TFT SPI 240X320 v1.1
    Last edited by visnja30; - 31st July 2015 at 23:33.

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


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    is the correct way to connecting peripherals with a PIC processor (pic18f87J11)
    its not the only way but its the way my demo platform is connected

    Model of my tft module is : TJTCM24028-SPI 2.8 TFT SPI 240X320 v1.1

    my tft touch module is : TJTCM24024-SPI 2.8 TFT SPI 240X320 , I got no docs with it and have not been able to identify the controller. but it has XPT2046 stamped on the chip so it looks the same as yours

  9. #9


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    I was looking on ebay and i could not find any 2.8" TJTCM24024.
    The only TJTCM24024 i could find is a 2.4"

    see here:
    http://www.ebay.com/itm/2-4-240x320-...item20eaff07d1

    Also the TJTCM24028:
    http://www.ebay.com/itm/240x320-2-8-...item41998b289b


    Maybe the 24028 means 2.8" and the 24024 means 2.4".

    @Richard,
    Can you double check you your display is really 2.4" or 2.8"?

    Thanks

    Regards
    Rui

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


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    its 2.4 TJTCM24024-SPI 2.4 TFT SPI 240X320
    http://www.ebay.com.au/itm/181500077...%3AMEBIDX%3AIT

    I should be more careful cutting and pasting
    Attached Images Attached Images  

  11. #11


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    Thanks Richard...

    Pressing buy now...

    Regards
    Rui

  12. #12
    Join Date
    May 2013
    Location
    australia
    Posts
    2,714


    Did you find this post helpful? Yes | No

    Default Re: A tft addin for pbp3

    the 2.2 board before and after the flash chip added (w25q32bv)
    Attached Images Attached Images   

Similar Threads

  1. Replies: 0
    Last Post: - 25th September 2013, 19: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, 09:50
  3. I really need some help with PBP3
    By Ramius in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th February 2012, 17:05
  4. What's with PBP3?
    By BrianT in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th August 2011, 18:09
  5. Experience of driving TFT screens?
    By isaac in forum General
    Replies: 1
    Last Post: - 26th September 2008, 01:15

Members who have read this thread : 1

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