Редактирование проекта

Инструменты редактирования проекта дают вам возможность изменять общие параметры проекта и настройки проекта Visual TFT.

Общие настройки проекта

В этом окне вы можете изменить частоту генератора MCU, тип сборки, биты конфигурации и настройки прерывания для выбранного устройства.

Когда вы закончите настройку своего устройства, вы можете сохранить эту конфигурацию в качестве схемы, используя кнопку Save Scheme.
Если вам нужна эта схема в другом проекте, вы можете загрузить ее, используя кнопку Load Scheme.

Edit Project Window

Настройки проекта Visual TFT

Настройки визуального TFT-проекта. В настройках Visual TFT вы можете настроить следующее:

Edit Project Window

Общие

Вкладка «Общие параметры» разделена на три основные части: «Настройки устройства», «Настройки дисплея» и «Тип сенсорной панели»:

General Options

Настройки устройства В Настройках устройств пользователь может добавить пользовательский код инициализации, необходимый для активного проекта.

Настройки дисплея. В настройках дисплея пользователь может выбрать желаемый дисплейный контроллер и размер дисплея.

Visual TFT поддерживает следующие TFT-контроллеры:

Himax HX8347G, HX8347D, HX8352A,

Solomon Systech SSD1963,

Renesas SP R61526,

Sitronix SST7715R,

Ilitek ILI9340, ILI9341, ILI9342 и ILI9481,

FTDI FT800, FT801, FT810, FT811, FT812 и FT813

TIVA



Тип контроллера сенсорной панели Пользователь может выбирать между типом контроллера сенсорной панели по умолчанию, расположенным на досках mikroElektronika, типом сенсорной панели STMPE610, контроллером сенсорной панели FT8xx и контроллером сенсорной панели TSC2006.

TFT

Эта вкладка используется для настройки параметров TFT-соединения для выбранного TFT-контроллера:

Himax, Solomon Systech, Renesas SP, Sitronix, Ilitek

Configure the TFT Module Connections by inputting the following information :

TFT Module Connections

FT8xx

Configure the FT8xx Module Connections by inputting the following information :

FT8xx Module Connections

Connections :

To configure the FT8xx connections, input the required data :

Display Parameters :

To configure the FT8xx display parameters, input the required data :

FT8xx Display Parameters

Clock :

To configure the FT8xx clock, input the required data :

FT8xx Clock

RGB Color :

To configure the FT8xx RGB Color, input the required data :

FT8xx RGB Color

Backlight :

To configure the FT8xx backlight parameters, input the required data :

FT8xx Backlight

TIVA

Configure the TIVA module by inputting the following information :

Configuring TIVA module

Display Parameters and Timings:

To configure the TIVA display parameters and settings, input the required data :

TIVA Display Parameters And Timings

DMA and EPI Settings :

To configure the DMA and EPI Settings, input the required data :

DMA and EPI Settings

Set Active

This tab is used to set the custom TFT communication routines, Set_Index, Write_Command, Write_Data and an auxiliary routine which will be used during custom TFT initialization :

Set Active Tab

This tab will be available when the Custom TFT communication routines option from the General tab is checked.

Touch Panel

This tab is used to configure the touch panel connections and settings and can have various input fields depending on the selected touch panel controller :

Default mikroElektronika Touch Panel Controller

For default mikroElektronika Touch Panel Controller, this tab is consisted of the following :

Touch Panel Settings

A/D Settings :

To configure the ADC module, input the required data :

Configure ADC Module

Upon the data input, the text box will be populated with the appropriate code.

Connections :

To configure the Touch Panel Module Connections, input the required data :

Touch Panel Connections

Calibration :

Calibration can be performed manually, i.e. each time the code is executed or automatically with the predefined constants :

Touch Panel Connections

Set the Touch Sensitive Area by entering the coorinate values XMin, XMax, YMin and YMax.

For calibrating touch panel each time after reset choose Manual calibration. If you want to avoid calibration at the start of the program choose Preset and set the values of these constants.

STMPE610 Touch Panel Controller

For STMPE610 Touch Panel Controller, this tab is consisted of the following :

STMPE610 Touch Panel Settings

A/D Settings :

To configure the STMPE610 ADC, input the required data :

Configure STMPE610 ADC

Module Settings :

To configure the STMPE610 module settings, input the required data :

STMPE610 Module Settings

Touchscreen is always set in XYZ mode, in any other mode it will not work properly.

Enable Interrupts :

To configure the STMPE610 interrupts, input the required data :

STMPE610 Interrupts

Calibration :

Calibration can be performed manually, i.e. each time the code is executed, or automatically with the predefined constants :

Touch Panel Calibration

Set the Touch Sensitive Area by entering the coorinate values XMin, XMax, YMin and YMax.

For calibrating touch panel each time after reset choose Manual calibration. If you want to avoid calibration at the start of the program choose Preset and set the values of these constants.

If the user wishes to enter calibration contants, it is advisable that the calibration is performed in the landscape display orientation.

Resistive FT800, FT810 and FT812 Touch Panel Controller

For the resistive FT800, FT810 and FT812 Touch Panel Controller, this tab is consisted of the following :

FT800, FT810 and FT812 Touch Panel Settings

A/D Settings :

To configure the FT800, FT810 and FT812 ADC, input the required data :

Configure FT800, FT810 and FT812 ADC

Calibration :

Calibration can be performed manually, i.e. each time the code is executed, or automatically with the predefined constants :

Touch Panel Calibration

Calibrate the Touch Sensitive Area by entering the transform coefficients - A, B, C, D, E and F.

For calibrating touch panel each time after reset choose Manual calibration. If you want to avoid calibration at the start of the program choose Preset and set the values of these constants.

Capacitive FT801, FT811 and FT813 Touch Panel Controller

For capacitive FT801, FT811 and FT813 Touch Panel Controller, this tab is consisted of the following :

FT801 and FT810 Touch Panel Settings

Settings : Calibration :

Calibration can be performed manually, i.e. each time the code is executed, or automatically with the predefined constants :

Touch Panel Calibration

Calibrate the Touch Sensitive Area by entering the transform coefficients - A, B, C, D, E and F.

For calibrating touch panel each time after reset choose Manual calibration. If you want to avoid calibration at the start of the program choose Preset and set the values of these constants.

TSC2006 Touch Panel Controller

For TSC2006 Touch Panel Controller, this tab is consisted of the following :

TSC2006 Touch Panel Settings

Connections :

To configure the TSC2006 connections, input the required data :

Configure TSC2006 connections

A/D Settings :

To configure the TSC2006 ADC, input the required data :

Configure TSC2006 ADC

Calibration :

Calibration can be performed manually, i.e. each time the code is executed, or automatically with the predefined constants :

Touch Panel Calibration

Calibrate the Touch Sensitive Area by entering the appropriate coefficients value.

For calibrating touch panel each time after reset choose Manual calibration in Settings Window (F12). If you want to avoid calibration at the start of the program choose Preset and set the values of these constants.

Resources

This tab enables user to choose the location of his resources (images and fonts). User can choose to store them Internally (in the MCU code memory) or to store them Externally in the resource file located on some external media (MMC/SD card, for example).

Touch Panel Connections

By storing the resources in the external memory, Flash memory consumption is significantly reduced. It is possible to use vast amount of constants, whose size is considerably larger than the size of the MCU Flash memory.
During the code generation process, the resources used are stored in the .RES file located in the project folder.

In order to use them from the external memory, user must transfer this file to this memory.

NoteNote

If SD/MMC card is used as an external resource, bear in mind that it has to be properly formatted to FAT16 and empty before transfering the resource file.

The reading of the resource file from the external memory consists of the following code blocks :

External Memory Global Declarations Block - FAT16

mikroC Code

// MMC/SD Connections
sbit Mmc_Chip_Select at GPIOD_ODR.B3;
// end of MMC/SD Connections

// TFT Get Data globals
char Ext_Data_Buffer[512];
unsigned long currentSector = -1, res_file_size;
// end of TFT Get Data globals

mikroPascal Code

// MMC/SD Connections
var Mmc_Chip_Select : sbit at GPIOD_ODR.B3;
// end of MMC/SD Connections

// TFT Get Data globals
var Ext_Data_Buffer : array[512] of byte;
var currentSector : longint;
var res_file_size : dword;
// end of TFT Get Data globals

mikroBasic Code

' MMC/SD Connections
dim Mmc_Chip_Select as sbit at GPIOD_ODR.B3
' end of MMC/SD Connections

' TFT Get Data globals
dim Ext_Data_Buffer as byte[512]
dim currentSector as longint
dim res_file_size as longword
' end of TFT Get Data globals

External Memory Global Declarations Block - FAT32

mikroC Code

// Extern memory interface
// MMC/SD Connections
sbit Mmc_Chip_Select           at GPIOD_ODR.B3;
// end of MMC/SD
// VTFT Get Data globals
short rfHandle;
char* rfName;
unsigned long rfStartSect;
// end of VTFT Get Data
// End of extern memory interface

mikroPascal Code

// Extern memory interface
// MMC/SD Connections
var Mmc_Chip_Select:           sbit at GPIOD_ODR.B3;
// end of MMC/SD
// VTFT Get Data globals
var rfHandle:    short;
var rfName:      string[14];
var rfStartSect: dword;
// end of VTFT Get Data
// End of extern memory interface

mikroBasic Code

' Extern memory interface
' MMC/SD Connections
dim Mmc_Chip_Select           as sbit at GPIOD_ODR.B3
' end of MMC/SD
' VTFT Get Data globals
dim rfHandle    as short
dim rfName      as string[14]
dim rfStartSect as longword
' end of VTFT Get Data
' End of extern memory interface

External Memory Initalization Block - FAT16

mikroC Code

void Init_Ext_Mem() {
// Initialize SPI
SPI3_Init_Advanced(_SPI_FPCLK_DIV64, _SPI_MASTER | _SPI_8_BIT | _SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION | _SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_ENABLE | _SPI_SSI_1, &_GPIO_MODULE_SPI3_PC10_11_12);
Delay_ms(10);

// Initialize MMC
if (!Mmc_Fat_Init()) {
  // Reinitialize SPI at higher speed
  SPI3_Init_Advanced(_SPI_FPCLK_DIV2, _SPI_MASTER | _SPI_8_BIT | _SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION | _SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_ENABLE | _SPI_SSI_1, &_GPIO_MODULE_SPI3_PC10_11_12);

  // Open resource file for read
  Mmc_Fat_Assign("%FILE_NAME", 0);
  Mmc_Fat_Reset(&res_file_size);
}
}
    

mikroPascal Code

procedure Init_Ext_Mem();
  begin
currentSector := -1;
// Initialize SPI
SPI3_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_SPI3_PC10_11_12);
Delay_ms(10);

// Initialize MMC
if (Mmc_Fat_Init() = 0) then
  begin
    // Reinitialize SPI at higher speed
      SPI3_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_SPI3_PC10_11_12);

    // Open resource file for read
    Mmc_Fat_Assign('%FILE_NAME', 0);
    Mmc_Fat_Reset(res_file_size);
  end;
  end;

mikroBasic Code

sub procedure Init_Ext_Mem()
currentSector = -1
' Initialize SPI
SPI3_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_SPI3_PC10_11_12)
Delay_ms(10)

' Initialize MMC
if (Mmc_Fat_Init() = 0) then
  ' Reinitialize SPI at higher speed
  SPI3_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_SPI3_PC10_11_12)

  ' Open resource file for read
  Mmc_Fat_Assign("%FILE_NAME", 0)
  Mmc_Fat_Reset(res_file_size)
end if
end sub

%FILE_NAME is the resource file name.

External Memory Initalization Block - FAT32

mikroC Code

void Init_Ext_Mem() {
  rfHandle    = -1;
  rfName      = "Resource.RES";
  rfStartSect = 0;

  // ensure ft8xx is not selected (because of shared SPI lines)
  // adjust this code to suite hw configuration
  FT800_CS_Direction = 0;
  FT800_CS = 1;

  // Init MMC SPI interface at low speed
  SPI3_Init_Advanced(_SPI_FPCLK_DIV64, _SPI_MASTER | _SPI_8_BIT | _SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION | _SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_ENABLE | _SPI_SSI_1, &_GPIO_MODULE_SPI3_PC10_11_12);
  
  // Init FAT32 stack
  if (!FAT32_Init()) {
    // Reinitialize SPI at higher speed
     SPI3_Init_Advanced(_SPI_FPCLK_DIV2, _SPI_MASTER | _SPI_8_BIT | _SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION | _SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_ENABLE | _SPI_SSI_1, &_GPIO_MODULE_SPI3_PC10_11_12);

    // Open resource file for read
    rfHandle    = FAT32_Open(rfName, 0x01);
    rfStartSect = FAT32_ClustToSect(fat32_fdesc[rfHandle]._1stClust);
  }
}
    

mikroPascal Code

procedure Init_Ext_Mem();
begin
  rfHandle    := -1;
  rfName      := 'Resource.RES';
  rfStartSect := 0;

  // ensure ft8xx is not selected (because of shared SPI lines)
  // adjust this code to suite hw configuration
  FT800_CS_Direction := 0;
  FT800_CS := 1;

  // Init MMC SPI interface at low speed
  SPI3_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_SPI3_PC10_11_12);

  // Init FAT32 stack
  if (FAT32_Init() = 0) then begin
    // Reinitialize SPI at higher speed
    SPI3_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_SPI3_PC10_11_12);

    // Open resource file for read
    rfHandle    := FAT32_Open(@rfName, 0x01);
    rfStartSect := FAT32_ClustToSect(fat32_fdesc[rfHandle]._1stClust);
  end;
end;

mikroBasic Code

sub procedure Init_Ext_Mem()
  rfHandle    = -1
  rfName      = "Resource.RES"
  rfStartSect = 0

  ' ensure ft8xx is not selected (because of shared SPI lines)
  ' adjust this code to suite hw configuration
  FT800_CS_Direction = 0
  FT800_CS = 1

  ' Init MMC SPI interface at low speed
  SPI3_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_SPI3_PC10_11_12)

  ' Init FAT32 stack
  if (FAT32_Init() = 0) then 
    ' Reinitialize SPI at higher speed
    SPI3_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_SPI3_PC10_11_12)

    ' Open resource file for read
    rfHandle    = FAT32_Open(@rfName, 0x01)
    rfStartSect = FAT32_ClustToSect(fat32_fdesc[rfHandle]._1stClust)
  end if
end sub

Get Data from the External Memory Block - FAT16

mikroC Code

char* TFT_Get_Data(unsigned long offset, unsigned long count, unsigned long *num) {
unsigned long start_sector;
unsigned long pos;

start_sector = Mmc_Get_File_Write_Sector() + offset/512;
pos = (unsigned long)offset%512;

if(start_sector == currentSector+1) {
  Mmc_Multi_Read_Sector(Ext_Data_Buffer);
  currentSector = start_sector;
} else if (start_sector != currentSector) {
    if(currentSector != -1)
  Mmc_Multi_Read_Stop();
  Mmc_Multi_Read_Start(start_sector);
  Mmc_Multi_Read_Sector(Ext_Data_Buffer);
  currentSector = start_sector;
}

if(count>512-pos)
  *num = 512-pos;
else
  *num = count;

return Ext_Data_Buffer+pos;
}
    

mikroPascal Code

function TFT_Get_Data(offset, count : dword; var num : dword) : ^byte;
var start_sector: dword;
pos : dword;
begin
  start_sector := Mmc_Get_File_Write_Sector() + offset div 512;
  pos := dword(offset) mod 512;

  if(start_sector = currentSector+1) then 
    begin
      Mmc_Multi_Read_Sector(Ext_Data_Buffer);
      currentSector := start_sector;
    end
  else if(start_sector <> currentSector) then
    begin
      if(currentSector <> -1) then
        Mmc_Multi_Read_Stop();
      Mmc_Multi_Read_Start(start_sector);
      Mmc_Multi_Read_Sector(Ext_Data_Buffer);
      currentSector := start_sector;
    end;

  if(count>512-pos) then 
    num := 512-pos
  else
    num := count;

  result := @Ext_Data_Buffer+pos;
end;

mikroBasic Code

sub function TFT_Get_Data(dim offset as longword, dim count as longword, dim byref num as longword) as ^byte
dim start_sector as longword
dim pos as longword
  start_sector = Mmc_Get_File_Write_Sector() + offset div 512
  pos = longword(offset) mod 512

  if(start_sector = currentSector+1) then 
    Mmc_Multi_Read_Sector(Ext_Data_Buffer)
    currentSector = start_sector
  else if(start_sector <> currentSector) then
    if(currentSector <> -1) then
      Mmc_Multi_Read_Stop()
    end if
    Mmc_Multi_Read_Start(start_sector)
    Mmc_Multi_Read_Sector(Ext_Data_Buffer)
    currentSector = start_sector
  end if
  end if

  if(count>512-pos) then 
    num = 512-pos
  else
    num = count
  end if

  result = @Ext_Data_Buffer+pos
end sub

Get Data from the External Memory Block - FAT32

mikroC Code

char *VTFT_GetExtData(unsigned long fPos, unsigned long bytesToGet, unsigned long *pBytesGot) {
  unsigned int  scOffset;

  *pBytesGot = 0;

  if (rfHandle < 0) {
    return 0; // return with nil if handle was bad.
  }
    
  // We will utilize some of the fat32 implied features
  // (such as built in sector buffer) to reduce ram memory consumpiton.
  // You can't use this approach if this buffer is going to be used
  // from another thread (i.e. using fat32 routines in interrupt...)
  // In that case or if you have plenty of ram memory use separate
  // as large as possible data buffer.
  f32_sector.fSectNum = rfStartSect + fPos / 512;
  Mmc_Read_Sector(f32_sector.fSectNum, f32_sector.fSect);

  // 512 bytes sector buffer implied.
  scOffset = fPos % 512;
  if(bytesToGet > 512-scOffset)
    *pBytesGot = 512-scOffset;
  else
    *pBytesGot = bytesToGet;

  return &f32_sector.fSect + scOffset;
}

mikroPascal Code

function VTFT_GetExtData(fPos : dword; bytesToGet : dword; pBytesGot : ^dword): ^byte;
  var  scOffset : word;
begin
  pBytesGot^ := 0;

  if (rfHandle < 0) then begin
    result := 0; // return with nil if handle was bad.
    exit;
  end;

  // We will utilize some of the fat32 implied features
  // (such as built in sector buffer) to reduce ram memory consumpiton.
  // You can't use this approach if this buffer is going to be used
  // from another thread (i.e. using fat32 routines in interrupt...)
  // In that case or if you have plenty of ram memory use separate
  // as large as possible data buffer.
  f32_sector.fSectNum := rfStartSect + fPos div 512;
  Mmc_Read_Sector(f32_sector.fSectNum, f32_sector.fSect);

  // 512 bytes sector buffer implied.
  scOffset := fPos mod 512;
  if(bytesToGet > 512-scOffset) then
    pBytesGot^ := 512-scOffset
  else
    pBytesGot^ := bytesToGet;

  result := @f32_sector.fSect + scOffset;
end;

mikroBasic Code

sub function VTFT_GetExtData(Dim fPos as longword, Dim bytesToGet as longword, Dim pBytesGot as ^longword) as ^byte 
  Dim  scOffset as word
       sc as longword
  pBytesGot^ = 0

  if (rfHandle < 0) then
    result = 0 ' return with nil if handle was bad.
    exit
  end if

  ' We will utilize some of the fat32 implied features
  ' (such as built in sector buffer) to reduce ram memory consumpiton.
  ' You can't use this approach if this buffer is going to be used
  ' from another thread (i.e. using fat32 routines in interrupt...)
  ' In that case or if you have plenty of ram memory use separate
  ' as large as possible data buffer.
  sc = rfStartSect + fPos div 512

  Mmc_Read_Sector(sc, f32_sector.fSect)

  ' 512 bytes sector buffer implied.
  scOffset = fPos mod 512
  if(bytesToGet > 512-scOffset) then
    pBytesGot^ = 512-scOffset
  else
    pBytesGot^ = bytesToGet
   end if

  result = @f32_sector.fSect + scOffset
end sub

The generated blocks of code are located in the Driver file.

Besides these, there are two more options available :