3.2 TFT LCD Screen Module: Unterschied zwischen den Versionen
(→Touch Function) |
(→Usage) |
||
Zeile 320: | Zeile 320: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
=== Example === | === Example === | ||
− | The projects and application examples. | + | The projects and application examples. |
== Bill of Materials (BOM) /parts list == | == Bill of Materials (BOM) /parts list == |
Version vom 21. Juli 2019, 23:07 Uhr
Inhaltsverzeichnis
Introduction
TFT01_3.2 is a TFT LCD Screen Module , 40pins interface , not just a LCD break but include the Touch , SD card and Flash design. So it’s a powerful extension module for your project.
The Screen include a controller SSD1289-spec.pdf, it’s a support 16bit data interface , easy to drive by many MCU like STM32 ,AVR and 8051 etc.
- TFT01 is designed with a touch controller in it . The touch IC is ADS7843 , and touch interface is included in the 40 pins breakout. We will offer two version of the module, one is with touch screen and touch controller , another is without the touch function, it will just use as a LCD screen for display- so it will be inexpensive than former.
- Another useful extension in the TFT01 is the SD Card socket . It use the SPI mode to operate the SD card, the SPI interface include in the 40pins breakout.
- There is a reserve extension design in the TFT01 , that’s the external flash . It’s leave the pad and the pins out for the SST25VF016B Flash. So when you need , you can easily add a external flash for your project .
The TFT01 layout a 40 pins interface for your project , the interface include LCD bus, SD card bus, Touch screen bus and the Flash bus.
Feature
- Extensive bus interface
- Single chip solution for a liquid crystal QVGA TFT LCD display
- 240RGBx320-dot resolution capable with real 262,144 display color
- Support MVA (Multi-domain Vertical Alignment) wide view display
- Internal oscillator and hardware reset
- Partial drive function, enabling partially driving an LCD panel at positions specified by user
- Power saving functions
- 8-color mode
- standby mode
- sleep mode
- Low -power consumption architecture
- Size:940mm * 630mm
Application Ideas
- Digital Photo Frame (DPF)
- Video terminals
- Instrumentation
- GPS
- Game consoles
- Video phones and Portable VCD, DVD
Cautions
- The I/O of the Panel is 3.3v voltage , so you had better not to directly connect it to the 5v voltage I/O .We suggest using the 30K and 20K resistor to reduce voltage.
Schematic
Specification
Pin definition and Rating
The pins named with “D_” is the touch bus , the pins named with “SD_” is SD bus, the pins named with “F_” is Flash bus.
TFT01 is work at 3.3v DC, if you need to connect the module with the 5v voltage I/O , you need to add the 30k and 20k resistors to reduce voltage.
Mechanic Dimensions
Usage
Hardware Installation
Programming
Includes important code snippet. Download the below code. You could used TFT01 Shield v1.0 and TFT-01 Mega Shield v1.1, which for Mega1280 or Mega2560 and there are enough IO for Touch and SD card function .
Demo code like :
Touch Function
The demo code used Mega Shield v1.1 on Arduino Mega, if you used TFT01 Shield v1.0 on Arduino Duemilanove, you need change the pin's define.
#define LCD_RS 38
#define LCD_WR 39
#define LCD_CS 40
#define LCD_REST 41
#define DCLK 6
#define CS 5
#define DIN 4
#define DOUT 3
#define IRQ 2
unsigned int TP_X,TP_Y;
void spistar() //SPI Start
{
digitalWrite(CS,HIGH);
digitalWrite(DCLK,HIGH);
digitalWrite(DIN,HIGH);
digitalWrite(DCLK,HIGH);
}
//**********************************************************
void WriteCharTo7843(unsigned char num) //SPI Write Data
{
unsigned char count=0;
unsigned char temp;
unsigned nop;
temp=num;
digitalWrite(DCLK,LOW);
for(count=0;count<8;count++)
{
if(temp&0x80)
digitalWrite(DIN,HIGH);
else
digitalWrite(DIN,LOW);
temp=temp<<1;
digitalWrite(DCLK,LOW);
nop++;
nop++;
digitalWrite(DCLK,HIGH);
nop++;
nop++;
}
}
//**********************************************************
unsigned int ReadFromCharFrom7843() //SPI Read Data
{
unsigned nop;
unsigned char count=0;
unsigned int Num=0;
for(count=0;count<12;count++)
{
Num<<=1;
digitalWrite(DCLK,HIGH);//DCLK=1; _nop_();_nop_();_nop_();
nop++;
digitalWrite(DCLK,LOW);//DCLK=0; _nop_();_nop_();_nop_();
nop++;
if(digitalRead(DOUT)) Num++;
}
return(Num);
}
void AD7843(void)
{
digitalWrite(CS,LOW);
WriteCharTo7843(0x90);
digitalWrite(DCLK,HIGH);
digitalWrite(DCLK,LOW);
TP_Y=ReadFromCharFrom7843();
WriteCharTo7843(0xD0);
digitalWrite(DCLK,HIGH);
digitalWrite(DCLK,LOW);
TP_X=ReadFromCharFrom7843();
digitalWrite(CS,HIGH);
}
void Lcd_Writ_Bus(char VH,char VL)
{
PORTA = VH;
PORTC = VL;
digitalWrite(LCD_WR,LOW);
digitalWrite(LCD_WR,HIGH);
}
void Lcd_Write_Com(char VH,char VL)
{
digitalWrite(LCD_RS,LOW);
Lcd_Writ_Bus(VH,VL);
}
void Lcd_Write_Data(char VH,char VL)
{
digitalWrite(LCD_RS,HIGH);
Lcd_Writ_Bus(VH,VL);
}
void Lcd_Write_Com_Data(int com,int dat)
{
Lcd_Write_Com(com>>8,com);
Lcd_Write_Data(dat>>8,dat);
}
void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2)
{
Lcd_Write_Com_Data(0x0044,(x2<<8)+x1);
Lcd_Write_Com_Data(0x0045,y1);
Lcd_Write_Com_Data(0x0046,y2);
Lcd_Write_Com_Data(0x004e,x1);
Lcd_Write_Com_Data(0x004f,y1);
Lcd_Write_Com(0x00,0x22);
}
void Lcd_Init(void)
{
digitalWrite(LCD_REST,HIGH);
delay(5);
digitalWrite(LCD_REST,LOW);
delay(15);
digitalWrite(LCD_REST,HIGH);
delay(15);
Lcd_Write_Com_Data(0x0000,0x0001); delay(1); //打开晶振
Lcd_Write_Com_Data(0x0003,0xA8A4); delay(1); //0xA8A4
Lcd_Write_Com_Data(0x000C,0x0000); delay(1);
Lcd_Write_Com_Data(0x000D,0x080C); delay(1);
Lcd_Write_Com_Data(0x000E,0x2B00); delay(1);
Lcd_Write_Com_Data(0x001E,0x00B7); delay(1);
Lcd_Write_Com_Data(0x0001,0x2B3F); delay(1); //驱动输出控制320*240 0x6B3F
Lcd_Write_Com_Data(0x0002,0x0600); delay(1);
Lcd_Write_Com_Data(0x0010,0x0000); delay(1);
Lcd_Write_Com_Data(0x0011,0x6070); delay(1); //0x4030 //定义数据格式 16位色
Lcd_Write_Com_Data(0x0005,0x0000); delay(1);
Lcd_Write_Com_Data(0x0006,0x0000); delay(1);
Lcd_Write_Com_Data(0x0016,0xEF1C); delay(1);
Lcd_Write_Com_Data(0x0017,0x0003); delay(1);
Lcd_Write_Com_Data(0x0007,0x0233); delay(1); //0x0233
Lcd_Write_Com_Data(0x000B,0x0000); delay(1);
Lcd_Write_Com_Data(0x000F,0x0000); delay(1); //扫描开始地址
Lcd_Write_Com_Data(0x0041,0x0000); delay(1);
Lcd_Write_Com_Data(0x0042,0x0000); delay(1);
Lcd_Write_Com_Data(0x0048,0x0000); delay(1);
Lcd_Write_Com_Data(0x0049,0x013F); delay(1);
Lcd_Write_Com_Data(0x004A,0x0000); delay(1);
Lcd_Write_Com_Data(0x004B,0x0000); delay(1);
Lcd_Write_Com_Data(0x0044,0xEF00); delay(1);
Lcd_Write_Com_Data(0x0045,0x0000); delay(1);
Lcd_Write_Com_Data(0x0046,0x013F); delay(1);
Lcd_Write_Com_Data(0x0030,0x0707); delay(1);
Lcd_Write_Com_Data(0x0031,0x0204); delay(1);
Lcd_Write_Com_Data(0x0032,0x0204); delay(1);
Lcd_Write_Com_Data(0x0033,0x0502); delay(1);
Lcd_Write_Com_Data(0x0034,0x0507); delay(1);
Lcd_Write_Com_Data(0x0035,0x0204); delay(1);
Lcd_Write_Com_Data(0x0036,0x0204); delay(1);
Lcd_Write_Com_Data(0x0037,0x0502); delay(1);
Lcd_Write_Com_Data(0x003A,0x0302); delay(1);
Lcd_Write_Com_Data(0x003B,0x0302); delay(1);
Lcd_Write_Com_Data(0x0023,0x0000); delay(1);
Lcd_Write_Com_Data(0x0024,0x0000); delay(1);
Lcd_Write_Com_Data(0x0025,0x8000); delay(1);
Lcd_Write_Com_Data(0x004f,0); //行首址0
Lcd_Write_Com_Data(0x004e,0); //列首址0
Lcd_Write_Com(0x00,0x22);
}
void Pant(char VH,char VL)
{
int i,j;
digitalWrite(LCD_CS,LOW);
Address_set(0,0,239,319);
for(i=0;i<320;i++)
{
for (j=0;j<240;j++)
{
Lcd_Write_Data(VH,VL);
}
}
digitalWrite(LCD_CS,HIGH);
}
void setup()
{
for(int p=22;p<42;p++)
{
pinMode(p,OUTPUT);
}
for(int p=2; p<7;p++)
pinMode(p,OUTPUT);
pinMode(DOUT,INPUT);
pinMode(IRQ,INPUT);
Lcd_Init();
Pant(0x00, 0x00);
delay(500);
}
void loop()
{
unsigned char flag;
unsigned char ss[6];
unsigned int lx,ly;
spistar();
int pacy=random(0, 7);
while(digitalRead(IRQ)==0)
{
digitalWrite(LCD_CS,LOW);
AD7843();
lx=((TP_X-340)*10/144);
if(lx>237) lx=237;
ly=320-((TP_Y-320)/11);
if(ly<0) ly=0;
Address_set(lx,ly,lx+2,ly+2);
switch(pacy)
{
case 0: for(int i=0; i<5; i++) Lcd_Write_Data(0xF8,0x00); break; //Red
case 1: for(int i=0; i<5; i++) Lcd_Write_Data(0xFF,0xE0); break; //Yellow
case 2: for(int i=0; i<5; i++) Lcd_Write_Data(0xFF,0xFF); break; //White
case 3: for(int i=0; i<5; i++) Lcd_Write_Data(0x05,0x1F); break; //Blue
case 4: for(int i=0; i<5; i++) Lcd_Write_Data(0x00,0x1F); break; //Blue-2
case 5: for(int i=0; i<5; i++) Lcd_Write_Data(0xF8,0x1F); break; //Magenta
case 6: for(int i=0; i<5; i++) Lcd_Write_Data(0x07,0xE0); break; //Green
case 7: for(int i=0; i<5; i++) Lcd_Write_Data(0x7F,0xFF); break; //Cyan
defoult:for(int i=0; i<5; i++) Lcd_Write_Data(0x00,0x00); break; //Black
}
digitalWrite(LCD_CS,HIGH);
}
}
Example
The projects and application examples.
Bill of Materials (BOM) /parts list
All the components used to produce the product.
FAQ
Please list your question here:
Support
If you have questions or other better design ideas,
Version Tracker
Revision | Descriptions | Release |
---|---|---|
v1.0 | Initial public release | date |
Bug Tracker
Bug Tracker is the place you can publish any bugs you think you might have found during use. Please write down what you have to say, your answers will help us improve our
products.
Additional Idea
The Additional Idea is the place to write your project ideas about this product, or other usages you've found. Or you can write them on Projects page.
Resources
- Link to TFT01 LCD Drive Controller Initialization
- Link to TFT01 Graphic Library
- Download SSD1289-spec.pdf
- Download TFT32_material.zip
- Download TFT01_Display_lib_stm32_gcc
- Download C51Demo
- Download TFT3_2_Mega_Pant&Touch_Demo
How to buy
Click here to buy: https://www.amazon.de/dp/B00YQ08U70?ref=myi_title_dp