TFT 16-bit Library
Thin film transistor liquid crystal display (TFT-LCD) is a variant of liquid crystal display (LCD) which uses thin-film transistor (TFT) technology to improve image quality (e.g., addressability, contrast).
TFT LCD is one type of active matrix LCD, though all LCD-screens are based on TFT active matrix addressing.
TFT LCDs are used in television sets, computer monitors, mobile phones, handheld video game systems, personal digital assistants, navigation systems, projectors, etc.
The mikroBasic PRO for ARM provides a library for working with the following display controllers :
- Himax HX8347D, HX8347G and HX8352A,
- Solomon Systech SSD1963,
- Ilitek ILI9340, ILI9342 and ILI9481.

- All display controllers are initialized with 65,536 colors (R(5),G(6),B(5)) and require two full ports for operation (due to the 16-bit interface).
- This library is valid only for Stellaris devices.
External dependencies of TFT 16-bit Library
The following variables must be defined in all projects using TFT 16-bit Library: | Description : | Example : |
---|---|---|
dim TFT_16bit_DataPort_Lo as byte sfr external |
TFT Data Port Low. | dim TFT_16bit_DataPort_Lo as byte at GPIO_PORTD_DATA |
dim TFT_16bit_DataPort_Hi as byte sfr external |
TFT Data Port High. | dim TFT_16bit_DataPort_Hi as byte at GPIO_PORTE_DATA |
dim TFT_16bit_DataPort_Lo_Direction as byte sfr external |
Direction of the TFT Data Port Low. | dim TFT_16bit_DataPort_Lo_Direction as byte at GPIO_PORTD_DIR |
dim TFT_16bit_DataPort_Hi_Direction as byte sfr external |
Direction of the TFT Data Port High. | dim TFT_16bit_DataPort_Hi_Direction as byte at GPIO_PORTE_DIR |
dim TFT_16bit_WR as byte sfr external |
Write signal. | dim TFT_16bit_WR as sbit at GPIO_PORTF_DATA4_bit |
dim TFT_16bit_RD as byte sfr external |
Read signal. | dim TFT_16bit_RD as sbit at GPIO_PORTF_DATA3_bit |
dim TFT_16bit_CS as byte sfr external |
Chip Select signal. | dim TFT_16bit_CS as sbit at GPIO_PORTF_DATA2_bit |
dim TFT_16bit_RS as byte sfr external |
Command/Register Select signal. | dim TFT_16bit_RS as sbit at GPIO_PORTF_DATA1_bit |
dim TFT_16bit_RST as byte sfr external |
Reset signal. | dim TFT_16bit_RST as sbit at GPIO_PORTF_DATA0_bit |
dim TFT_16bit_WR_Direction as byte sfr external |
Direction of the Write pin. | dim TFT_16bit_WR_Direction as sbit at GPIO_PORTF_DIR4_bit |
dim TFT_16bit_RD_Direction as byte sfr external |
Direction of the Read pin. | dim TFT_16bit_RD_Direction as sbit at GPIO_PORTF_DIR3_bit |
dim TFT_16bit_CS_Direction as byte sfr external |
Direction of the Chip Select pin. | dim TFT_16bit_CS_Direction as sbit at GPIO_PORTF_DIR2_bit |
dim TFT_16bit_RS_Direction as byte sfr external |
Direction of the Register Select pin. | dim TFT_16bit_RS_Direction as sbit at GPIO_PORTF_DIR1_bit |
dim TFT_16bit_RST_Direction as byte sfr external |
Direction of the Reset pin. | dim TFT_16bit_RST_Direction as sbit at GPIO_PORTF_DIR0_bit |
Library Routines
- TFT_Init_HX8347D
- TFT_Init_HX8352A
- TFT_Init_SSD1963
- TFT_Init_ILI9340
- TFT_Init_ILI9342
- TFT_Init_ILI9481
- TFT_Init_HX8347G_16bit
- TFT_Init_HX8347D_Custom
- TFT_Init_HX8352A_Custom
- TFT_Init_SSD1963_Custom
- TFT_Init_ILI9340_Custom
- TFT_Init_ILI9342_Custom
- TFT_Init_ILI9481_Custom
- TFT_Init_HX8347G_16bit_Custom
- TFT_16bit_Set_Index
- TFT_16bit_Write_Command
- TFT_16bit_Write_Data
- TFT_16bit_Set_Reg
- TFT_16bit_Set_Ext_Buffer
- TFT_16bit_Set_Active
- TFT_16bit_Set_Default_Mode
- TFT_16bit_Set_Font
- TFT_16bit_Set_Ext_Font
- TFT_16bit_Write_Char
- TFT_16bit_Write_Text
- TFT_16bit_Fill_Screen
- TFT_16bit_Set_Pen
- TFT_16bit_Set_Brush
- TFT_16bit_Dot
- TFT_16bit_Line
- TFT_16bit_H_Line
- TFT_16bit_V_Line
- TFT_16bit_Rectangle
- TFT_16bit_Rectangle_Round_Edges
- TFT_16bit_Circle
- TFT_16bit_Image
- TFT_16bit_Ext_Image
- TFT_16bit_Partial_Image
- TFT_16bit_Ext_Partial_Image
- TFT_16bit_Image_Jpeg
- TFT_16bit_RGBToColor16bit
- TFT_16bit_Color16bitToRGB
- TFT_16bit_Rotate_180
TFT_Init_HX8347D
Prototype |
sub procedure TFT_Init_HX8347D(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes HX8347D display controller in 16-bit working mode for Stellaris devices. Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' TFT module connections dim TFT_16bit_DataPort_Hi as byte at GPIO_PORTE_DATA TFT_16bit_DataPort_Lo as byte at GPIO_PORTD_DATA TFT_16bit_RST as sbit at GPIO_PORTF_DATA0_bit TFT_16bit_RS as sbit at GPIO_PORTF_DATA1_bit TFT_16bit_CS as sbit at GPIO_PORTF_DATA2_bit TFT_16bit_RD as sbit at GPIO_PORTF_DATA3_bit TFT_16bit_WR as sbit at GPIO_PORTF_DATA4_bit TFT_16bit_BLED as sbit at GPIO_PORTF_DATA5_bit TFT_16bit_DataPort_Hi_Direction as byte at GPIO_PORTE_DIR TFT_16bit_DataPort_Lo_Direction as byte at GPIO_PORTD_DIR TFT_16bit_RST_Direction as sbit at GPIO_PORTF_DIR0_bit TFT_16bit_RS_Direction as sbit at GPIO_PORTF_DIR1_bit TFT_16bit_CS_Direction as sbit at GPIO_PORTF_DIR2_bit TFT_16bit_RD_Direction as sbit at GPIO_PORTF_DIR3_bit TFT_16bit_WR_Direction as sbit at GPIO_PORTF_DIR4_bit TFT_16bit_BLED_Direction as sbit at GPIO_PORTF_DIR5_bit ' End TFT module connections ' Initialize 240x320 TFT display TFT_Init_HX8347D(240, 320) |
TFT_Init_HX8352A
Prototype |
sub procedure TFT_Init_HX8352A(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes HX8352A display controller in 16-bit working mode for Stellaris devices. Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' TFT module connections dim TFT_16bit_DataPort_Hi as byte at GPIO_PORTE_DATA TFT_16bit_DataPort_Lo as byte at GPIO_PORTD_DATA TFT_16bit_RST as sbit at GPIO_PORTF_DATA0_bit TFT_16bit_RS as sbit at GPIO_PORTF_DATA1_bit TFT_16bit_CS as sbit at GPIO_PORTF_DATA2_bit TFT_16bit_RD as sbit at GPIO_PORTF_DATA3_bit TFT_16bit_WR as sbit at GPIO_PORTF_DATA4_bit TFT_16bit_BLED as sbit at GPIO_PORTF_DATA5_bit TFT_16bit_DataPort_Hi_Direction as byte at GPIO_PORTE_DIR TFT_16bit_DataPort_Lo_Direction as byte at GPIO_PORTD_DIR TFT_16bit_RST_Direction as sbit at GPIO_PORTF_DIR0_bit TFT_16bit_RS_Direction as sbit at GPIO_PORTF_DIR1_bit TFT_16bit_CS_Direction as sbit at GPIO_PORTF_DIR2_bit TFT_16bit_RD_Direction as sbit at GPIO_PORTF_DIR3_bit TFT_16bit_WR_Direction as sbit at GPIO_PORTF_DIR4_bit TFT_16bit_BLED_Direction as sbit at GPIO_PORTF_DIR5_bit ' End TFT module connections ' Initialize 240x320 TFT display TFT_Init_HX8352A(240, 320) |
TFT_Init_SSD1963
Prototype |
sub procedure TFT_Init_SSD1963(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes SSD1963 display controller in 16-bit working mode for Stellaris devices. Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' TFT module connections dim TFT_16bit_DataPort_Hi as byte at GPIO_PORTE_DATA TFT_16bit_DataPort_Lo as byte at GPIO_PORTD_DATA TFT_16bit_RST as sbit at GPIO_PORTF_DATA0_bit TFT_16bit_RS as sbit at GPIO_PORTF_DATA1_bit TFT_16bit_CS as sbit at GPIO_PORTF_DATA2_bit TFT_16bit_RD as sbit at GPIO_PORTF_DATA3_bit TFT_16bit_WR as sbit at GPIO_PORTF_DATA4_bit TFT_16bit_BLED as sbit at GPIO_PORTF_DATA5_bit TFT_16bit_DataPort_Hi_Direction as byte at GPIO_PORTE_DIR TFT_16bit_DataPort_Lo_Direction as byte at GPIO_PORTD_DIR TFT_16bit_RST_Direction as sbit at GPIO_PORTF_DIR0_bit TFT_16bit_RS_Direction as sbit at GPIO_PORTF_DIR1_bit TFT_16bit_CS_Direction as sbit at GPIO_PORTF_DIR2_bit TFT_16bit_RD_Direction as sbit at GPIO_PORTF_DIR3_bit TFT_16bit_WR_Direction as sbit at GPIO_PORTF_DIR4_bit TFT_16bit_BLED_Direction as sbit at GPIO_PORTF_DIR5_bit ' End TFT module connections ' Initialize 240x320 TFT display TFT_Init_SSD1963(240, 320) |
TFT_Init_ILI9340
Prototype |
sub procedure TFT_Init_ILI9340(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes ILI9340 display controller in 16-bit working mode for Stellaris devices. Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' TFT module connections dim TFT_16bit_DataPort_Hi as byte at GPIO_PORTE_DATA TFT_16bit_DataPort_Lo as byte at GPIO_PORTD_DATA TFT_16bit_RST as sbit at GPIO_PORTF_DATA0_bit TFT_16bit_RS as sbit at GPIO_PORTF_DATA1_bit TFT_16bit_CS as sbit at GPIO_PORTF_DATA2_bit TFT_16bit_RD as sbit at GPIO_PORTF_DATA3_bit TFT_16bit_WR as sbit at GPIO_PORTF_DATA4_bit TFT_16bit_BLED as sbit at GPIO_PORTF_DATA5_bit TFT_16bit_DataPort_Hi_Direction as byte at GPIO_PORTE_DIR TFT_16bit_DataPort_Lo_Direction as byte at GPIO_PORTD_DIR TFT_16bit_RST_Direction as sbit at GPIO_PORTF_DIR0_bit TFT_16bit_RS_Direction as sbit at GPIO_PORTF_DIR1_bit TFT_16bit_CS_Direction as sbit at GPIO_PORTF_DIR2_bit TFT_16bit_RD_Direction as sbit at GPIO_PORTF_DIR3_bit TFT_16bit_WR_Direction as sbit at GPIO_PORTF_DIR4_bit TFT_16bit_BLED_Direction as sbit at GPIO_PORTF_DIR5_bit ' End TFT module connections ' Initialize 240x320 TFT display TFT_Init_ILI9340(240, 320) |
TFT_Init_ILI9342
Prototype |
sub procedure TFT_Init_ILI9342(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes ILI9342 display controller in 16-bit working mode for Stellaris devices. Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' TFT module connections dim TFT_16bit_DataPort_Hi as byte at GPIO_PORTE_DATA TFT_16bit_DataPort_Lo as byte at GPIO_PORTD_DATA TFT_16bit_RST as sbit at GPIO_PORTF_DATA0_bit TFT_16bit_RS as sbit at GPIO_PORTF_DATA1_bit TFT_16bit_CS as sbit at GPIO_PORTF_DATA2_bit TFT_16bit_RD as sbit at GPIO_PORTF_DATA3_bit TFT_16bit_WR as sbit at GPIO_PORTF_DATA4_bit TFT_16bit_BLED as sbit at GPIO_PORTF_DATA5_bit TFT_16bit_DataPort_Hi_Direction as byte at GPIO_PORTE_DIR TFT_16bit_DataPort_Lo_Direction as byte at GPIO_PORTD_DIR TFT_16bit_RST_Direction as sbit at GPIO_PORTF_DIR0_bit TFT_16bit_RS_Direction as sbit at GPIO_PORTF_DIR1_bit TFT_16bit_CS_Direction as sbit at GPIO_PORTF_DIR2_bit TFT_16bit_RD_Direction as sbit at GPIO_PORTF_DIR3_bit TFT_16bit_WR_Direction as sbit at GPIO_PORTF_DIR4_bit TFT_16bit_BLED_Direction as sbit at GPIO_PORTF_DIR5_bit ' End TFT module connections ' Initialize 240x320 TFT display TFT_Init_ILI9342(240, 320) |
TFT_Init_ILI9481
Prototype |
sub procedure TFT_Init_ILI9481(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes ILI9481 display controller in 16-bit working mode for Stellaris devices. Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' TFT module connections dim TFT_16bit_DataPort_Hi as byte at GPIO_PORTE_DATA TFT_16bit_DataPort_Lo as byte at GPIO_PORTD_DATA TFT_16bit_RST as sbit at GPIO_PORTF_DATA0_bit TFT_16bit_RS as sbit at GPIO_PORTF_DATA1_bit TFT_16bit_CS as sbit at GPIO_PORTF_DATA2_bit TFT_16bit_RD as sbit at GPIO_PORTF_DATA3_bit TFT_16bit_WR as sbit at GPIO_PORTF_DATA4_bit TFT_16bit_BLED as sbit at GPIO_PORTF_DATA5_bit TFT_16bit_DataPort_Hi_Direction as byte at GPIO_PORTE_DIR TFT_16bit_DataPort_Lo_Direction as byte at GPIO_PORTD_DIR TFT_16bit_RST_Direction as sbit at GPIO_PORTF_DIR0_bit TFT_16bit_RS_Direction as sbit at GPIO_PORTF_DIR1_bit TFT_16bit_CS_Direction as sbit at GPIO_PORTF_DIR2_bit TFT_16bit_RD_Direction as sbit at GPIO_PORTF_DIR3_bit TFT_16bit_WR_Direction as sbit at GPIO_PORTF_DIR4_bit TFT_16bit_BLED_Direction as sbit at GPIO_PORTF_DIR5_bit ' End TFT module connections ' Initialize 240x320 TFT display TFT_Init_ILI9481(240, 320) |
TFT_Init_HX8347G_16bit
Prototype |
sub procedure TFT_Init_HX8347G_16bit(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes HX8347G display controller in 16-bit working mode for Stellaris devices. Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' TFT module connections dim TFT_16bit_DataPort_Hi as byte at GPIO_PORTE_DATA TFT_16bit_DataPort_Lo as byte at GPIO_PORTD_DATA TFT_16bit_RST as sbit at GPIO_PORTF_DATA0_bit TFT_16bit_RS as sbit at GPIO_PORTF_DATA1_bit TFT_16bit_CS as sbit at GPIO_PORTF_DATA2_bit TFT_16bit_RD as sbit at GPIO_PORTF_DATA3_bit TFT_16bit_WR as sbit at GPIO_PORTF_DATA4_bit TFT_16bit_BLED as sbit at GPIO_PORTF_DATA5_bit TFT_16bit_DataPort_Hi_Direction as byte at GPIO_PORTE_DIR TFT_16bit_DataPort_Lo_Direction as byte at GPIO_PORTD_DIR TFT_16bit_RST_Direction as sbit at GPIO_PORTF_DIR0_bit TFT_16bit_RS_Direction as sbit at GPIO_PORTF_DIR1_bit TFT_16bit_CS_Direction as sbit at GPIO_PORTF_DIR2_bit TFT_16bit_RD_Direction as sbit at GPIO_PORTF_DIR3_bit TFT_16bit_WR_Direction as sbit at GPIO_PORTF_DIR4_bit TFT_16bit_BLED_Direction as sbit at GPIO_PORTF_DIR5_bit ' End TFT module connections ' Initialize 240x320 TFT display TFT_Init_HX8347G_16bit(240, 320) |
TFT_Init_HX8347D_Custom
Prototype |
sub procedure TFT_Init_HX8347D_Custom(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes HX8347D display controller in 16-bit working mode for Stellaris devices without setting the TFT_16bit_DataPort_Lo and TFT_16bit_DataPort_Hi direction.
Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' Set custom working mode TFT_16bit_Set_Active(@TFT_16bit_Set_Index_Custom, @TFT_16bit_Write_Command_Custom, @TFT_16bit_Write_Data_Custom) ' Initialize 240x320 TFT display TFT_Init_HX8347D_Custom(240, 320) |
TFT_Init_HX8352A_Custom
Prototype |
sub procedure TFT_Init_HX8352A_Custom(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes HX8352A display controller in 16-bit working mode for Stellaris devices without setting TFT_16bit_DataPort_Lo and TFT_16bit_DataPort_Hi direction.
Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' Set custom working mode TFT_16bit_Set_Active(@TFT_16bit_Set_Index_Custom, @TFT_16bit_Write_Command_Custom, @TFT_16bit_Write_Data_Custom) ' Initialize 240x320 TFT display TFT_Init_HX8352A_Custom(240, 320) |
TFT_Init_SSD1963_Custom
Prototype |
sub procedure TFT_Init_SSD1963_Custom(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes SSD1963 display controller in 16-bit working mode for Stellaris devices without setting TFT_16bit_DataPort_Lo and TFT_16bit_DataPort_Hi direction.
Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' Set custom working mode TFT_16bit_Set_Active(@TFT_16bit_Set_Index_Custom, @TFT_16bit_Write_Command_Custom, @TFT_16bit_Write_Data_Custom) ' Initialize 240x320 TFT display TFT_Init_SSD1963_Custom(240, 320) |
TFT_Init_ILI9340_Custom
Prototype |
sub procedure TFT_Init_ILI9340_Custom(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes ILI9340 display controller in 16-bit working mode for Stellaris devices without setting TFT_16bit_DataPort_Lo and TFT_16bit_DataPort_Hi direction.
Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' Set custom working mode TFT_16bit_Set_Active(@TFT_16bit_Set_Index_Custom, @TFT_16bit_Write_Command_Custom, @TFT_16bit_Write_Data_Custom) ' Initialize 240x320 TFT display TFT_Init_ILI9340_Custom(240, 320) |
TFT_Init_ILI9342_Custom
Prototype |
sub procedure TFT_Init_ILI9342_Custom(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes ILI9342 display controller in 16-bit working mode for Stellaris devices without setting TFT_16bit_DataPort_Lo and TFT_16bit_DataPort_Hi direction.
Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' Set custom working mode TFT_16bit_Set_Active(@TFT_16bit_Set_Index_Custom, @TFT_16bit_Write_Command_Custom, @TFT_16bit_Write_Data_Custom) ' Initialize 240x320 TFT display TFT_Init_ILI9342_Custom(240, 320) |
TFT_Init_ILI9481_Custom
Prototype |
sub procedure TFT_Init_ILI9481_Custom(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes ILI9481 display controller in 16-bit working mode for Stellaris devices without setting TFT_16bit_DataPort_Lo and TFT_16bit_DataPort_Hi direction.
Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' Set custom working mode TFT_16bit_Set_Active(@TFT_16bit_Set_Index_Custom, @TFT_16bit_Write_Command_Custom, @TFT_16bit_Write_Data_Custom) ' Initialize 240x320 TFT display TFT_Init_ILI9481_Custom(240, 320) |
TFT_Init_HX8347G_16bit_Custom
Prototype |
sub procedure TFT_Init_HX8347G_16bit_Custom(dim display_width, display_height as word) |
---|---|
Returns |
Nothing. |
Description |
Initializes HX8347G display controller in 16-bit working mode for Stellaris devices without setting TFT_16bit_DataPort_Lo and TFT_16bit_DataPort_Hi direction.
Parameters :
|
Requires |
External dependencies of the library from the top of the page must be defined before using this function. |
Example |
' Set custom working mode TFT_16bit_Set_Active(@TFT_16bit_Set_Index_Custom, @TFT_16bit_Write_Command_Custom, @TFT_16bit_Write_Data_Custom) ' Initialize 240x320 TFT display TFT_Init_HX8347G_16bit_Custom(240, 320) |
TFT_16bit_Set_Index
Prototype |
sub procedure TFT_16bit_Set_Index(dim index as byte) |
---|---|
Returns |
Nothing. |
Description |
Sets controllers register address to be written in next cycle. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
' Access register at the location 0x02 TFT_16bit_Set_Index(0x02) |
TFT_16bit_Write_Command
Prototype |
sub procedure TFT_16bit_Write_Command(dim cmd as byte) |
---|---|
Returns |
Nothing. |
Description |
Sets value of controller register (address must be previously defined with TFT_16bit_Set_Index routine). Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
' Write a command TFT_16bit_Write_Command(0x02) |
TFT_16bit_Write_Data
Prototype |
sub procedure TFT_16bit_Write_Data(dim _data as word) |
---|---|
Returns |
Nothing. |
Description |
Write 16bit value on TFT Data bus. This is 16-bit communication so it is done in a single cycles. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
' Send data TFT_16bit_Write_Data(0x02) |
TFT_16bit_Set_Reg
Prototype |
sub procedure TFT_16bit_Set_Reg(dim index, value as byte) |
---|---|
Returns |
Nothing. |
Description |
Sets address and value of specific controller register. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
' 65K Color Selection TFT_16bit_Set_Reg(0x17, 0x05) |
TFT_16bit_Set_Ext_Buffer
Prototype |
sub procedure TFT_16bit_Set_Ext_Buffer(dim getExtDataPtr as ^TTFT_16bit_Get_Ext_Data_Ptr) |
---|---|
Returns |
Nothing. |
Description |
Function sets pointer to the user function which manipulates the external resource. Parameters :
User function prototype should be in the following format: Parameters used in the function have the following meaning :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Set_Ext_Buffer(@ReadExternalBuffer) |
TFT_16bit_Set_Active
Prototype |
sub procedure TFT_16bit_Set_Active(dim Set_Index_Ptr as ^TTFT_16bit_Set_Index_Ptr, dim Write_Command_Ptr as ^TTFT_16bit_Write_Command_Ptr, dim Write_Data_Ptr as ^TTFT_16bit_Write_Data_Ptr) |
---|---|
Returns |
Nothing. |
Description |
This function sets appropriate pointers to a user-defined basic routines in order to enable multiple working modes. Parameters :
|
Requires |
None. |
Example |
sub procedure TFT_16bit_Set_Index_Custom(dim index as byte) TFT_16bit_RS = 0 ' Write to port TFT_16bit_DataPort_Lo = index ' Strobe TFT_16bit_WR = 0 asm nop end asm TFT_16bit_WR = 1 end sub sub procedure TFT_16bit_Write_Command_Custom(dim cmd as byte) { TFT_16bit_RS = 1 ' Write to port TFT_16bit_DataPort_Lo = cmd ' Strobe TFT_16bit_WR = 0 asm nop end asm TFT_16bit_WR = 1 end sub sub procedure TFT_16bit_Write_Data_Custom(dim _data as word) { TFT_16bit_RS = 1 ' Write to port TFT_16bit_DataPort_Hi = Hi(_data) TFT_16bit_DataPort_Lo = Lo(_data) ' Strobe TFT_16bit_WR = 0 asm nop end asm TFT_16bit_WR = 1 end sub TFT_16bit_Set_Active(@TFT_16bit_Set_Index_Custom, @TFT_16bit_Write_Command_Custom, @TFT_16bit_Write_Data_Custom) |
TFT_16bit_Set_Default_Mode
Prototype |
sub procedure TFT_16bit_Set_Default_Mode() |
---|---|
Returns |
Nothing. |
Description |
This function sets TFT in default working mode. Parameters :
|
Requires |
None. |
Example |
TFT_16bit_Set_Default_Mode() TFT_Init_HX8352A(320, 240) |
TFT_16bit_Set_Font
Prototype |
sub procedure TFT_16bit_Set_Font(dim activeFont as ^far const byte, dim font_color as word, dim font_orientation as byte) |
||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||||||||
Description |
Sets font, its color and font orientation. Parameters :
|
||||||||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||||||||
Example |
TFT_16bit_Set_Font(@TFT_16bit_defaultFont, CL_BLACK_16bit, FO_HORIZONTAL_16bit) |
TFT_16bit_Set_Ext_Font
Prototype |
sub procedure TFT_16bit_Set_Ext_Font(dim activeFont as longword, dim font_color as word, dim font_orientation as byte) |
||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||||||||
Description |
Sets font, its color and font orientation. Font is located in an external resource Parameters :
|
||||||||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||||||||
Example |
TFT_16bit_Set_Ext_Font(173296, CL_BLACK_16bit, FO_HORIZONTAL_16bit) |
TFT_16bit_Write_Char
Prototype |
sub procedure TFT_16bit_Write_Char(dim ch, x, y as word) |
---|---|
Returns |
Nothing. |
Description |
Writes a char on the TFT at coordinates (x, y).
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Write_Char("A",22,23) |
TFT_16bit_Write_Text
Prototype |
sub procedure TFT_16bit_Write_Text(dim byref text as string, dim x, y as word) |
---|---|
Returns |
Nothing. |
Description |
Writes text on the TFT at coordinates (x, y). Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Write_Text("TFT 16-bit Library DEMO, WELCOME !", 0, 0) |
TFT_16bit_Fill_Screen
Prototype |
sub procedure TFT_16bit_Fill_Screen(dim color as word) |
||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||
Description |
Fills screen memory block with given color. Parameters :
|
||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||
Example |
TFT_16bit_Fill_Screen(CL_BLACK_16bit) |
TFT_16bit_Dot
Prototype |
sub procedure TFT_16bit_Dot(dim x, y as integer, dim color as word) |
||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||
Description |
Draws a dot on the TFT at coordinates (x, y). Parameters :
|
||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||
Example |
TFT_16bit_Dot(50, 50, CL_BLACK_16bit) |
TFT_16bit_Set_Pen
Prototype |
sub procedure TFT_16bit_Set_Pen(dim pen_color as word, dim pen_width as byte) |
||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||
Description |
Sets color and thickness parameter for drawing line, circle and rectangle elements. Parameters :
|
||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||
Example |
TFT_16bit_Set_Pen(CL_BLACK_16bit, 10) |
TFT_16bit_Set_Brush
Prototype |
sub procedure TFT_16bit_Set_Brush(dim brush_enabled as byte, dim brush_color as word, dim gradient_enabled, gradient_orientation as byte, dim gradient_color_from, gradient_color_to as word) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description |
Sets color and gradient which will be used to fill circles or rectangles. Parameters :
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example |
' Enable gradient from black to white color, left-right orientation TFT_16bit_Set_Brush(0, 0, 1, LEFT_TO_RIGHT_16bit, CL_BLACK_16bit, CL_WHITE_16bit) |
TFT_16bit_Line
Prototype |
sub procedure TFT_16bit_Line(dim x1, y1, x2, y2 as integer) |
---|---|
Returns |
Nothing. |
Description |
Draws a line from (x1, y1) to (x2, y2). Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Line(0, 0, 239, 127) |
TFT_16bit_H_Line
Prototype |
sub procedure TFT_16bit_H_Line(dim x_start, x_end, y_pos as integer) |
---|---|
Returns |
Nothing. |
Description |
Draws a horizontal line on TFT. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
' Draw a horizontal line between dots (10,20) and (50,20) TFT_16bit_H_Line(10, 50, 20) |
TFT_16bit_V_Line
Prototype |
sub procedure TFT_16bit_V_Line(dim y_start, y_end, x_pos as integer) |
---|---|
Returns |
Nothing. |
Description |
Draws a vertical line on TFT. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
' Draw a vertical line between dots (10,5) and (10,25) TFT_16bit_V_Line(5, 25, 10) |
TFT_16bit_Rectangle
Prototype |
sub procedure TFT_16bit_Rectangle(dim x_upper_left, y_upper_left, x_bottom_right, y_bottom_right as integer) |
---|---|
Returns |
Nothing. |
Description |
Draws a rectangle on TFT. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Rectangle(20, 20, 219, 107) |
TFT_16bit_Rectangle_Round_Edges
Prototype |
sub procedure TFT_16bit_Rectangle_Round_Edges(dim x_upper_left, y_upper_left, x_bottom_right, y_bottom_right, round_radius as word) |
---|---|
Returns |
Nothing. |
Description |
Draws a rounded edge rectangle on TFT. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Rectangle_Round_Edges(20, 20, 219, 107, 12) |
TFT_16bit_Circle
Prototype |
sub procedure TFT_16bit_Circle(dim x_center, y_center, radius as integer) |
---|---|
Returns |
Nothing. |
Description |
Draws a circle on TFT. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Circle(120, 64, 110) |
TFT_16bit_Image
Prototype |
sub procedure TFT_16bit_Image(dim left, top as word, dim image as far const byte, dim stretch as byte) |
---|---|
Returns |
Nothing. |
Description |
Displays an image on a desired location. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Image(0, 0, @image, 1) |
TFT_16bit_Ext_Image
Prototype |
sub procedure TFT_16bit_Ext_Image(dim left, top as word, dim image as longword, dim stretch as byte) |
---|---|
Returns |
Nothing. |
Description |
Displays an image from an external resource on a desired address. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Ext_Image(0, 0, 153608, 1) |
TFT_16bit_Partial_Image
Prototype |
sub procedure TFT_16bit_Partial_Image(dim left, top, width, height as word, dim image as far const byte, dim stretch as byte) |
---|---|
Returns |
Nothing. |
Description |
Displays a partial area of the image on a desired location. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
' Draws a 10x15 part of the image starting from the upper left corner on the coordinate (10,12) TFT_16bit_PartialImage(10, 12, 10, 15, @image, 1) |
TFT_16bit_Ext_Partial_Image
Prototype |
sub procedure TFT_16bit_Ext_Partial_Image(dim left, top, width, height as word, dim image as longword, dim stretch as byte) |
---|---|
Returns |
Nothing. |
Description |
Displays a partial area of the image, located on an external resource, on a desired location of the screen. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Ext_Partial_Image(159,0,160,120,0,1) |
TFT_16bit_Image_Jpeg
Prototype |
sub function TFT_16bit_Image_Jpeg(dim left, top as word, dim image as ^const byte) as byte |
---|---|
Returns |
|
Description |
Displays a JPEG image on a desired location. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Image_Jpeg(0, 0, @image) |
TFT_16bit_RGBToColor16bit
Prototype |
sub function TFT_16bit_RGBToColor16bit(dim rgb_red, rgb_green, rgb_blue as byte) as word |
---|---|
Returns |
Returns a color value in the following bit-order : 5 bits red, 6 bits green and 5 bits blue color. |
Description |
Converts 5:6:5 RGB format into true color format. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
color16 = TFT_16bit_RGBToColor16bit(150, 193, 65) |
TFT_16bit_Color16bitToRGB
Prototype |
sub procedure TFT_16bit_Color16bitToRGB(dim color as word, dim rgb_red, rgb_green, rgb_blue as ^byte) |
---|---|
Returns |
Nothing. |
Description |
Converts true color into 5:6:5 RGB format. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Color16bitToRGB(start_color, @red_start, @green_start, @blue_start) |
TFT_16bit_Rotate_180
Prototype |
sub procedure TFT_16bit_Rotate_180(dim rotate as byte) |
---|---|
Returns |
Nothing. |
Description |
Rotates the TFT display. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
' Rotate TFT display for 180 degrees TFT_16bit_Rotate_180(1) ' Initialize TFT display TFT_Init_HX8352A(240, 320) |
What do you think about this topic ? Send us feedback!