SPFD54124 SPI TFT INTERFACE IN VISUAL TFT

General discussion on Visual TFT Software.
Post Reply
Author
Message
shams_iqbal
Posts: 1
Joined: 27 Oct 2014 02:07

SPFD54124 SPI TFT INTERFACE IN VISUAL TFT

#1 Post by shams_iqbal » 27 Oct 2014 03:32

Hello
I have working routines for SPFD54124 SPI TFT controller written in dspic mikrobasic compiler .using these routines i can change colour of tft screen however i am unable to implement this interface with visual tft now i have these questions
NOTE: reason to write this post here is to provide working example for every visual tft software user so they can use with custom tft controller interface and this will be very attractive for every user who is considering to use visual tft in their project
1)how visual tft generate end process data i mean what variable(name) holds data and command byte information at this point i am not interested in whole library only the hardware layer interface variable which then further connected to hardware pins to communicate with lcd controller
these are related to visual tft software >options>project settings>advance setting >set active
2)what is functional principal for set index no explanation is available why this function is used in custom interface option and how to implement in parallel or serial interface option
3)same question about write command code as like question no 2
4)same question about write data code as like question no 2
these are related to visual tft software >options>project settings>advance setting >TFT
5)how we can add option in tft connection tab for required pins in controller xml file for visual tft

6)about display resolution i can add any custom resolution and that works ok but for new controller listing it doesn't works i am restricted to change existing listed controller for my case i have used ili9342 how to fix this option i am using visual tft v3.8.0 if i change the name it still show the same old name
7)while generated code in visual tft it still adds many todo list pins description still expect that there should be huge pins in parellel interface how to fix this problem even if we comment line in code still there is error on compiling for these errors i have attached zip file of sample project created in visual tft 3.8.0
8.) i have question to this routaines shown below

Code: Select all

'**
' * @brief  Complete initializing sub procedure for TFT controller (ILI9342)
' * @param  display_width  as Width of display (in pixels).
' * @param  display_height as Height of display (in pixels).
' *}
sub procedure TFT_Init_ILI9342(dim display_width as word display_height as word)
dim temp as ^word
  if (Is_TFT_Set() <> 1) then
    TFT_Set_Index_Ptr = @TFT_Set_Index
    TFT_Write_Command_Ptr = @TFT_Write_Command
    TFT_Write_Data_Ptr = @TFT_16bit_Write_Data
  end if

  TFT_DISP_WIDTH = display_width
  TFT_DISP_HEIGHT = display_height
  if (display_width >= display_height) then
    TFT_Disp_Rotation = 0
  else
    TFT_Disp_Rotation = 90
  end if

  TFT_Set_Pen(CL_BLACK, 1)
  TFT_Set_Brush(0, 0, 0, 0, 0, 0)

  TFT_Move_Cursor(0, 0)
  TFT_Clear_Fonts()
  temp = @TFT_DataPort_Direction
  temp^ = 0
  ' Reset device
  TFT_Reset_ILI9342()
  TFT_Set_Address_Ptr = @TFT_Set_Address_ILI9342
end sub
what is the relationship of this tft init routains in case we use custom hardware interface

now hare i am going to post my custom tft init routines which i have implemented to interface with my tft module

Code: Select all

Sub PROCEDURE LCD_Init_nokia()


        'Delay_ms(10)
        'LCD_RES_Low
        'Delay_ms(10)
        'LCD_RES_High
        Delay_ms(10)
        LCD_Write_Cmd(0x01)';         //Software Reset
        Delay_ms(10)';
        LCD_Write_Cmd(17)
        Delay_ms(10)
        LCD_Write_Cmd(58)
        'Interface pixel format:bit1,2,3
        LCD_Write_Data(5)
        '
        'LCD_Write_Cmd(0x36);        //MEMORY DATA ACCESS CONTROL
        'LCD_Write_Data(0xc0);         //MEMORY DATA ACCESS CONTROL
        LCD_Write_Cmd(41)
        'Display on,0x29=ON,0x28=OFF
        LCD_Clear1()
End Sub

Sub PROCEDURE LCD_Clear1()
        'dim color_low as byte
        'dim color_high as byte
        Dim i As Integer
        'color_low=color and $00ff
        'color_high=color>>8

        LCD_Write_Cmd(42)
        ' x-addres 0to0x83
        LCD_Write_Data(0)
        'xsta:BIT0-7
        LCD_Write_Data(0)
        'xend:BIT0-7
        LCD_Write_Data(0)
        'xsta:BIT0-7
        LCD_Write_Data(131)
        'xend:BIT0-7
        LCD_Write_Cmd(43)
        ' y-address 0to0xa1
        LCD_Write_Data(0)
        'Ysta:BIT0-7
        LCD_Write_Data(0)
        'xend:BIT0-7
        LCD_Write_Data(0)
        'xsta:BIT0-7
        LCD_Write_Data(161)
        'xend:BIT0-7
        LCD_Write_Cmd(44)
        'RAMWR
        i = 0
        While (i < 21384)
            LCD_Write_Data($ff)   'RED =$F800  , GREEN=$07E0  , BLUE=$001F,WHITE=$FFFF
            LCD_Write_Data($ff)
            i = (i + 1)
        wend
End Sub

Sub PROCEDURE LCD_SET_XY(DIM  x AS BYTE, dim y AS BYTE)
        LCD_Write_Cmd(42)
        ' x-addres
        LCD_Write_Data(0)
        'xsta:BIT0-7
        LCD_Write_Data((x + 2))
        'xsta:BIT0-7
        LCD_Write_Data(0)
        'xend:BIT0-7
        LCD_Write_Data(131)
        'xend:BIT0-7
        LCD_Write_Cmd(43)
        ' y-address
        LCD_Write_Data(0)
        'xend:BIT0-7
        LCD_Write_Data(y)
        'Ysta:BIT0-7
        LCD_Write_Data(0)
        'xend:BIT0-7
        LCD_Write_Data(161)
        'xend:BIT0-7
        LCD_Write_Cmd(44)
        'RAMWR
End Sub

Sub PROCEDURE LCD_Write_Data(DIM Data2 AS BYTE)
        LCD_SCK=0'_Low
        LCD_CS=0'_Low
        nop
        nop
        LCD_SDA=1'_High
        nop
        nop
        LCD_SCK=1'_High
        nop
        nop
        nop
        nop
        nop
        LCD_SCK=0'_Low
        nop
        nop
        nop
        nop
        nop
        lcd_write_byte(data2)
        LCD_CS=1'_High
End Sub

Sub PROCEDURE LCD_Write_Cmd(DIM Cmd AS BYTE)
        LCD_SCK=0'_Low
        LCD_CS=0'_Low
        nop
        nop
        LCD_SDA=0'_Low
        nop
        nop
        nop
        nop
        nop
        LCD_SCK=1'_High
        nop
        nop
        nop
        nop
        nop
        LCD_SCK=0'_Low
        nop
        nop
        nop
        nop
        nop
        lcd_write_byte(cmd)
        LCD_CS=1'_High
End Sub

sub procedure lcd_write_byte(dim va as byte)
    lcd_sda=va.7  'shift msb 7th to serial data port
    LCD_SCK=1'_High
    nop
    nop
    nop
    nop
    nop
    LCD_SCK=0'_Low
    nop
    nop
    lcd_sda=va.6  'shift msb 6th to serial data port
    LCD_SCK=1'_High
    nop
    nop
    nop
    nop
    nop
    LCD_SCK=0'_Low
    nop
    nop
    lcd_sda=va.5  'shift msb 5th to serial data port
    LCD_SCK=1'_High
    nop
    nop
    nop
    nop
    nop
    LCD_SCK=0'_Low
    nop
    nop
    lcd_sda=va.4  'shift msb 4th to serial data port
    LCD_SCK=1'_High
    nop
    nop
    nop
    nop
    nop
    LCD_SCK=0'_Low
    nop
    nop
    lcd_sda=va.3  'shift msb 3rd to serial data port
    LCD_SCK=1'_High
    nop
    nop
    nop
    nop
    nop
    LCD_SCK=0'_Low
    nop
    nop
    lcd_sda=va.2  'shift msb 2nd to serial data port
    LCD_SCK=1'_High
    nop
    nop
    nop
    nop
    nop
    LCD_SCK=0'_Low
    nop
    nop
    lcd_sda=va.1  'shift msb 1st to serial data port
    LCD_SCK=1'_High
    nop
    nop
    nop
    nop
    nop
    LCD_SCK=0'_Low
    nop
    nop
    lcd_sda=va.0  'shift msb 0th to serial data port
    LCD_SCK=1'_High
    nop
    nop
    nop
    nop
    nop
    LCD_SCK=0'_Low
    nop
    nop

end sub
how to add these function in _lib_tft_defs.mbas file to make it compatible with visual tft
i hope mikroe team will pay attention to my post for their mutual interest to promote their product

every person who had experience in custom tft controller interface in visual tft and mikroe products is welcome to participate in my thread
Attachments
mikroBasic PRO for DSPIC.zip
example project file
(79.05 KiB) Downloaded 226 times

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: SPFD54124 SPI TFT INTERFACE IN VISUAL TFT

#2 Post by filip » 31 Oct 2014 13:57

Hi,
2)what is functional principal for set index no explanation is available why this function is used in custom interface option and how to implement in parallel or serial interface option
3)same question about write command code as like question no 2
4)same question about write data code as like question no 2
TFT_Set_Index - Sets controllers register address to be written in next cycle.
TFT_Write_Command - Sets value of controller register (address must be previously defined with TFT_Set_Index)
TFT_Write_Data - Write a value (8-bit or 16-bit, depending on the type of communication) on TFT Data bus.
5)how we can add option in tft connection tab for required pins in controller xml file for visual tft
Which pins do you wish to add, maybe I can make a small example of this ?
6)about display resolution i can add any custom resolution and that works ok but for new controller listing it doesn't works i am restricted to change existing listed controller for my case i have used ili9342 how to fix this option i am using visual tft v3.8.0 if i change the name it still show the same old name
This issue is on our bug list, it should be solved in next version of the Visual TFT.

As for the custom TFT display/driver, the init routine should be written according to your controller's datasheet.
This is a library that supports only parallel interface, but for the serial I'm not really sure how to achieve this, I will have to look into that.

Regards,
Filip.

Post Reply

Return to “Visual TFT General”