It is currently 23 Apr 2018 16:33

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: TFT driver for S6D1121
PostPosted: 26 Aug 2017 07:16 
Offline

Joined: 01 May 2014 10:46
Posts: 36
Hello,

Now I found the perfcect display for our project, but the S6D1121 isn't supported in the TFT library.
So I'm afraid Visual GLCD can't be used.

Is there a workout, how to implement own low level drivers , so all TFT procedures can be used?

Unfortuatly there are plenty of TFT Controllers not supported in Micropascal. Regarding the UTFT library
on github https://github.com/telamon/utft it shouldn't be a big problem to implement new controllers.

Mike


Top
 Profile  
 
PostPosted: 29 Aug 2017 09:52 
Offline
mikroElektronika team
User avatar

Joined: 02 Feb 2017 14:21
Posts: 780
Hi,

Go to compiler install path\mikroPascal PRO for PIC\Uses\P18\ and find a file called __Lib_TFT_Defs.mpas.
This file contains initialization routines for the displays that we supported.
You can try adding support for your display based on our initialization scheme that you can find in this file.

Regards,

_________________
Dusan Poluga.


Top
 Profile  
 
PostPosted: 20 Sep 2017 13:20 
Offline

Joined: 01 May 2014 10:46
Posts: 36
Thank you for your help.

It's working perfect after series of tests.

I'm publishing the code here if somebody else needs it.

//***************************** S6D1121 8 bit *********************************

procedure TFT_Write_Command_S6D1121(cmd : byte);
begin
  TFT_RS := 0;
  TFT_DataPort := 0x00;
  TFT_Write_Strobe();
  TFT_DataPort := cmd;
  TFT_Write_Strobe();
end;

procedure TFT_Set_Address_S6D1121(x : word; y : word);
begin
  TFT_Write_Command_S6D1121 (0x20); TFT_Write_Data (y);    // x reg
  TFT_Write_Command_S6D1121 (0x21); TFT_Write_Data (tft_disp_width-1-x);   //y reg  values depending of rotation
  TFT_Write_Command_S6D1121 (0x22);
end;

procedure TFT_Reset_S6D1121();
begin
  // Hold in reset
  TFT_RST := 0;
  // Set reset pin as output
  TFT_RST_Direction := 0;

  // Enable data access
  TFT_RS := 1;
  // Set RS pin as output
  TFT_RS_Direction := 0;

  // Disable LCD
  TFT_CS := 1;
  // Set LCD CS pin as output
  TFT_CS_Direction := 0;

  TFT_RD_Direction := 0;
  TFT_WR_Direction := 0;
  TFT_RD := 1;
  TFT_WR := 1;

  Delay_100ms();
  TFT_RST := 1;
  Delay_100ms();
  Delay_100ms();
  TFT_CS:=0;
  TFT_Write_Command_S6D1121(0x11); TFT_Write_Data (0x2004);
  TFT_Write_Command_S6D1121(0x13); TFT_Write_Data (0xCC00);
  TFT_Write_Command_S6D1121(0x15); TFT_Write_Data (0x2600);
  TFT_Write_Command_S6D1121(0x14); TFT_Write_Data (0x252A);
  TFT_Write_Command_S6D1121(0x12); TFT_Write_Data (0x0033);
  TFT_Write_Command_S6D1121(0x13); TFT_Write_Data (0xCC04);
  TFT_Write_Command_S6D1121(0x13); TFT_Write_Data (0xCC06);
  TFT_Write_Command_S6D1121(0x13); TFT_Write_Data (0xCC4F);
  TFT_Write_Command_S6D1121(0x13); TFT_Write_Data (0x674F);
  TFT_Write_Command_S6D1121(0x11); TFT_Write_Data (0x2003);
  TFT_Write_Command_S6D1121(0x30); TFT_Write_Data (0x2609);
  TFT_Write_Command_S6D1121(0x31); TFT_Write_Data (0x242C);
  TFT_Write_Command_S6D1121(0x32); TFT_Write_Data (0x1F23);
  TFT_Write_Command_S6D1121(0x33); TFT_Write_Data (0x2425);
  TFT_Write_Command_S6D1121(0x34); TFT_Write_Data (0x2226);
  TFT_Write_Command_S6D1121(0x35); TFT_Write_Data (0x2523);
  TFT_Write_Command_S6D1121(0x36); TFT_Write_Data (0x1C1A);
  TFT_Write_Command_S6D1121(0x37); TFT_Write_Data (0x131D);
  TFT_Write_Command_S6D1121(0x38); TFT_Write_Data (0x0B11);
  TFT_Write_Command_S6D1121(0x39); TFT_Write_Data (0x1210);
  TFT_Write_Command_S6D1121(0x3A); TFT_Write_Data (0x1315);
  TFT_Write_Command_S6D1121(0x3B); TFT_Write_Data (0x3619);
  TFT_Write_Command_S6D1121(0x3C); TFT_Write_Data (0x0D00);
  TFT_Write_Command_S6D1121(0x3D); TFT_Write_Data (0x000D);
  TFT_Write_Command_S6D1121(0x16); TFT_Write_Data (0x0007);
  TFT_Write_Command_S6D1121(0x02); TFT_Write_Data (0x0013);
  TFT_Write_Command_S6D1121(0x03); TFT_Write_Data (0x0009);       // Rotation
  TFT_Write_Command_S6D1121(0x01); TFT_Write_Data (0x0127);
  TFT_Write_Command_S6D1121(0x08); TFT_Write_Data (0x0303);
  TFT_Write_Command_S6D1121(0x0A); TFT_Write_Data (0x000B);
  TFT_Write_Command_S6D1121(0x0B); TFT_Write_Data (0x0003);
  TFT_Write_Command_S6D1121(0x0C); TFT_Write_Data (0x0000);
  TFT_Write_Command_S6D1121(0x41); TFT_Write_Data (0x0000);
  TFT_Write_Command_S6D1121(0x50); TFT_Write_Data (0x0000);
  TFT_Write_Command_S6D1121(0x60); TFT_Write_Data (0x0005);
  TFT_Write_Command_S6D1121(0x70); TFT_Write_Data (0x000B);
  TFT_Write_Command_S6D1121(0x71); TFT_Write_Data (0x0000);
  TFT_Write_Command_S6D1121(0x78); TFT_Write_Data (0x0000);
  TFT_Write_Command_S6D1121(0x7A); TFT_Write_Data (0x0000);
  TFT_Write_Command_S6D1121(0x79); TFT_Write_Data (0x0007);
  TFT_Write_Command_S6D1121(0x07); TFT_Write_Data (0x0051);
  TFT_Write_Command_S6D1121(0x07); TFT_Write_Data (0x0053);
  TFT_Write_Command_S6D1121(0x79); TFT_Write_Data (0x0000);
  TFT_Write_Command_S6D1121(0x22);
  TFT_CS:=1;
end;

procedure TFT_Init_S6D1121_8bit(display_width : word; display_height : word);
begin
  __controller := _8BIT_CONTROLLER;
  if (Is_TFT_Set() <> 1) then
    begin
      TFT_Set_Index_Ptr := @TFT_Set_Index;
      TFT_Write_Command_Ptr := @TFT_Write_Command_S6D1121;
      TFT_Write_Data_Ptr := @TFT_Write_Data;
    end;

  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;

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

  TFT_Move_Cursor(0, 0);
  TFT_Clear_Fonts();
  TFT_Set_DataPort_Direction();
  TFT_Reset_S6D1121();
  TFT_Set_Address_Ptr := @TFT_Set_Address_S6D1121;
end;


Top
 Profile  
 
PostPosted: 20 Sep 2017 17:09 
Offline

Joined: 11 Feb 2011 17:22
Posts: 150
Mike
Thanks for posting your code. Is this a modification of the compiler TFT DEF file or are you using this as an include file and not checking tft defs in the library?

Thanks


Top
 Profile  
 
PostPosted: 22 Sep 2017 10:50 
Offline
mikroElektronika team
User avatar

Joined: 02 Feb 2017 14:21
Posts: 780
Hi,

Thank you for sharing your work!

Regards,

_________________
Dusan Poluga.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: