ILI9341V STM32F103C8

General discussion on mikroPascal PRO for ARM.
Author
Message
Vit2
Posts: 77
Joined: 15 Apr 2015 10:00

ILI9341V STM32F103C8

#1 Post by Vit2 » 14 Nov 2020 10:35

Hello!
What am I doing wrong?
Can't display text.
Do you have a working example?

program ILI9341VTest;

// TFT module connections
var TFT_DataPort : word at GPIOB_ODR;
TFT_RST : sbit at GPIOB_ODR.B4; // RESET
TFT_RS : sbit at GPIOB_ODR.B5; // DC/RS
TFT_CS : sbit at GPIOB_ODR.B3;
TFT_RD : sbit at GPIOB_ODR.B7; // SDO(MISO)
TFT_WR : sbit at GPIOB_ODR.B6; // SDI(MOSI)
TFT_BLED : sbit at GPIOB_ODR.B8;
// End TFT module connections
{ Declarations section }

procedure Init_MCU();
begin
SPI1_Init_Advanced(_SPI_FPCLK_DIV64, _SPI_MASTER OR _SPI_8_BIT OR _SPI_CLK_IDLE_LOW OR
_SPI_FIRST_CLK_EDGE_TRANSITION OR _SPI_MSB_FIRST OR _SPI_SS_DISABLE OR _SPI_SSM_ENABLE OR
_SPI_SSI_1, @_GPIO_MODULE_SPI1_PA567);

Delay_100ms();
TFT_Init_ILI9341_8bit(320, 240);
end;

begin
Init_MCU();
SPI1_Init();
TFT_Fill_Screen(CL_TEAL);
TFT_Write_Text('TEST', 75, 80);

while TRUE do
begin
TFT_Set_Brush(1, CL_RED, 0, 0, 0, 0);
TFT_Circle(160, 114, 40);
TFT_Write_Text('ILI9341', 136, 106);
end;
end.
Attachments
20201114_102807.jpg
20201114_102807.jpg (3.61 MiB) Viewed 3274 times

dibor
Posts: 208
Joined: 29 Dec 2014 18:59

Re: ILI9341V STM32F103C8

#2 Post by dibor » 15 Nov 2020 09:57

Hi.
I think ME do not has SPI library for this TFT LCD.
Please ask users for right library.

Vit2
Posts: 77
Joined: 15 Apr 2015 10:00

Re: ILI9341V STM32F103C8

#3 Post by Vit2 » 15 Nov 2020 16:17

Hello!
Thanks for the answer.
Other developers have all sorts of libraries for displays, such as ST7920, or ILI9341.
ME do not want to do send to libstock before asking I was already there. They do everything for their boards.
They think if a person needs to let him do it himself. Good examples in Pascal AVR.

Maybe there is a library for ILI9431, share.
Thanks.

dibor
Posts: 208
Joined: 29 Dec 2014 18:59

Re: ILI9341V STM32F103C8

#4 Post by dibor » 16 Nov 2020 08:23

Hi.
You can try to modify lib.
Read here : viewtopic.php?f=162&t=56427&start=45
I have leave this compiler, and did only one project. :(

Best Wishes.

Vit2
Posts: 77
Joined: 15 Apr 2015 10:00

Re: ILI9341V STM32F103C8

#5 Post by Vit2 » 16 Nov 2020 11:00

Thank you, I'm working with him now.
They want 270$ for this compiler, but they don't want to do what people ask.

Vit2
Posts: 77
Joined: 15 Apr 2015 10:00

Re: ILI9341V STM32F103C8

#6 Post by Vit2 » 16 Nov 2020 17:08

Thank you so much rares.porutiu
Attachments
20201116_170017.jpg
20201116_170017.jpg (3.82 MiB) Viewed 3224 times

dibor
Posts: 208
Joined: 29 Dec 2014 18:59

Re: ILI9341V STM32F103C8

#7 Post by dibor » 17 Nov 2020 12:29

Good Job!
And thanks again to rares.porutiu!
-1 to ME team.

Vit2
Posts: 77
Joined: 15 Apr 2015 10:00

Re: ILI9341V STM32F103C8

#8 Post by Vit2 » 17 Nov 2020 14:50

Thanks
And more thanks aCkO.
-10 to ME team.

Vit2
Posts: 77
Joined: 15 Apr 2015 10:00

Re: ILI9341V STM32F103C8

#9 Post by Vit2 » 18 Nov 2020 19:22

Hello!
If anyone knows how to refresh the display?
Attachments
ILI9341V.PNG
ILI9341V.PNG (188.09 KiB) Viewed 3178 times

Vit2
Posts: 77
Joined: 15 Apr 2015 10:00

Re: ILI9341V STM32F103C8

#10 Post by Vit2 » 19 Nov 2020 18:50

Hello!
How do I use DMA? The help is not written.
Can an example.

Vit2
Posts: 77
Joined: 15 Apr 2015 10:00

Re: ILI9341V STM32F103C8

#11 Post by Vit2 » 20 Nov 2020 10:23

Has the weekend started?

dibor
Posts: 208
Joined: 29 Dec 2014 18:59

Re: ILI9341V STM32F103C8

#12 Post by dibor » 20 Nov 2020 17:53

Vit2 wrote:
18 Nov 2020 19:22
Hello!
If anyone knows how to refresh the display?
What do U mean refresh?
Put new data to same place(X,Y) where was old data, or U can to clear all display and rewrite display with new data, but if U use slow SPI protocol U will see display filling process.

Vit2
Posts: 77
Joined: 15 Apr 2015 10:00

Re: ILI9341V STM32F103C8

#13 Post by Vit2 » 20 Nov 2020 18:41

Code: Select all

program ILI9341VTest;

Uses  TestFont_resources;
// TFT module connections
var TFT_DataPort : word  at GPIOB_ODR;
    TFT_RST      : sbit  at GPIOB_ODR.B10;    // RESET
    TFT_RS       : sbit  at GPIOB_ODR.B1;  // DC/RS
    TFT_CS       : sbit  at GPIOB_ODR.B0;
    TFT_RD       : sbit  at GPIOA_ODR.B13; 
    TFT_WR       : sbit  at GPIOA_ODR.B12; 
    TFT_BLED     : sbit  at GPIOB_ODR.B11;
// End TFT module connections

{
A0 - Reset
A1 - DC
A2 - CS
--- SPI1 ---
A5 - SCK
A6 - MISO
A7 - MOSI
}
var
  VRef:real;
  ADC_V:word;

   Vtxt: string[23];
procedure VoltMeter;
begin
 ADC_V := ADC1_Get_Sample (0);
  Average:= ADC_V;
  Ref := 3.305 / 4096;
  V :=  (ADC_V) * Real(Ref) * 11;
  FloatToStr(V, Vtxt);
 Vtxt[4]:=0;
TFT_Write_Text('V:'+Vtxt, 80, 100);
end;

procedure Init_MCU();
begin
  GPIO_Digital_Input(@GPIOA_ODR, _GPIO_PINMASK_0);
ADC_Set_Input_Channel(_ADC_CHANNEL_0);
 ADC1_Init();
 
 GPIO_Config(@GPIOB_BASE,_GPIO_PINMASK_11,_GPIO_CFG_MODE_OUTPUT or _GPIO_CFG_SPEED_MAX or _GPIO_CFG_OTYPE_PP);
    TFT_BLED:= 0;
  // Initialize SPI module used with PortExpander
  SPI1_Init_Advanced(_SPI_FPCLK_DIV2, _SPI_MASTER  or _SPI_8_BIT or
                     _SPI_CLK_IDLE_LOW or _SPI_FIRST_CLK_EDGE_TRANSITION or
                     _SPI_MSB_FIRST or _SPI_SS_DISABLE or _SPI_SSM_ENABLE or _SPI_SSI_1,
                     @_GPIO_MODULE_SPI1_PA567);
                     
end;                             


begin
SPI1_init();
Init_MCU();
 // --------------- SYSTEM -------------------------------------
   TFT_Rotate_180(1);
 //initialize the TFT with my modified version on ILI9341 that assigns SPI versions to the output routine pointers, see modified __Lib_TFT_Defs.mpas
  TFT_Init_ILI9341_8bit_Custom_SPI(320,240);
  TFT_Fill_Screen(CL_BLUE);//$FFFF);CL_GRAY
   TFT_BLED:= 1;
 //--------------- END SYSTEM   ---------------------------------

 TFT_Set_Font(@Arial42x51_Bold, CL_WHITE, FO_HORIZONTAL);

  while TRUE do
    begin
   VoltMeter;
    end;
end.

AntiMember
Posts: 136
Joined: 02 Jan 2020 19:00

Re: ILI9341V STM32F103C8

#14 Post by AntiMember » 21 Nov 2020 09:49

The pictures show that TFT_Write_Text writes only the pixels of the character.
To erase the previous characters, you need to display them again with the background color.
Or paint over a rectangle with a background color.

Vit2
Posts: 77
Joined: 15 Apr 2015 10:00

Re: ILI9341V STM32F103C8

#15 Post by Vit2 » 21 Nov 2020 13:18

The background color does not work, the rectangular flickers strongly.

Post Reply

Return to “mikroPascal PRO for ARM General”