Difference between revisions of "Touch LCD Shield"

From LinkSprite Playgound
Jump to: navigation, search
(Created page with "== Introduction == This is a multifunctional Arduino/Arduino Mega compatible resistive touch screen. It can be used as display device or sketch pad. With a SD card module in...")
 
Line 116: Line 116:
  
 
A3 - Touch Screen X+ input pin.
 
A3 - Touch Screen X+ input pin.
 +
 +
== TFT Programming  ==
 +
The '''TFT''' library provides the following Application Programming Interfaces('''API'''). The library makes use of direct access to PORT registers instead of Arduino APIs. This is to increase the speed of communication between MCU and TFT. At present, the library supports Arduino, Arduino Mega (1280 or 2560) and Seeeduino ADK Main Board compatible boards. In Mega the 8bit data port of TFT is distributed to different pins belonging to different ports. This decreases the speed of graphics drawing when compared to Arduino. The choice of port pins are purely based on Arduino / Mega port pin arrangement.
 +
 +
===General Functions===
 +
----
 +
====setXY(unsigned int poX, unsigned int poY)====
 +
Sets the cursor position to (poX,poY). This function is internally used by other graphics APIs.
 +
 +
====setPixel(unsigned int poX, unsigned int poY,unsigned int color)====
 +
Sets the (poX,poY) pixel to color ''color''. This function is internally used by other graphics APIs.
 +
 +
===Lines===
 +
 +
====drawLine(unsigned int x0,unsigned int y0,unsigned int x1,unsigned int y1,unsigned int color)====
 +
Draws a line from pixel (x0,y0) to pixel (x1,y1) with color ''color''.
 +
 +
====drawVerticalLine(unsigned int poX, unsigned int poY,unsigned int length,unsigned int color)====
 +
Draws a Horizontal Line of length ''length'' with color ''color'' starting from pixel (poX,poY).
 +
 +
====drawHorizontalLine(unsigned int poX, unsigned int poY,unsigned int length,unsigned int color)====
 +
Draws a Vertical Line of length ''length'' with color '''color''' starting from pixel (poX,poY).
 +
 +
===Rectangle===
 +
 +
====drawRectangle(unsigned int poX, unsigned int poY, unsigned int length,unsigned int width,unsigned int color)====
 +
Draws a rectangle starting from (poX,poY) of length ''length'', width ''width'' and color '''color'''.
 +
 +
====fillRectangle(unsigned int poX, unsigned int poY, unsigned int length, unsigned int width, unsigned int color)====
 +
Draws a filled rectangle starting from pixel (poX,poY) of length ''length'', width ''width'' and color '''color'''.
 +
 +
===Circle===
 +
 +
====drawCircle(int poX, int poY, int r,unsigned int color)====
 +
Draws a circle at (poX,poY) of radius '''radius''' and color '''color'''.
 +
 +
====fillCircle(int poX, int poY, int r,unsigned int color)====
 +
Draws a filled circle at (poX,poY) of radius '''radius''' and color '''color'''.
 +
 +
===Text===
 +
 +
====drawChar(unsigned char ascii,unsigned int poX, unsigned int poY,unsigned int size, unsigned int fgcolor)====
 +
Draws a character starting from (poX,poY) using inbuilt font of size '''size''' and with color ''fgcolor''. This function is used by drawString() function.
 +
 +
====drawString(char *string,unsigned int poX, unsigned int poY,unsigned int size,unsigned int fgcolor)====
 +
Draws a string of text starting from (poX,poY) using inbuilt font of size '''size''' and with color ''fgcolor''.
 +
 +
=== TouchScreen Programming  ===

Revision as of 10:08, 21 December 2012

Introduction

This is a multifunctional Arduino/Arduino Mega compatible resistive touch screen. It can be used as display device or sketch pad. With a SD card module integrated also on this shield, this shield reserves great room for other expansions to your project.

Features

  • Big screen for easy and comfortable experience
  • Backlight controllable via programming
  • 65535 rich colors display
  • SPI pin-saving communication method
  • Full screen touch active range

Specification

Item Min Typical Max Unit
Voltage 4.5 5 5.5 VDC
Current / / 250 mA
LCD Panel Size 2.8 inch
View angle 60~120 Deg
Resolution 320x240 /
LCD color 65k /
Backlight Type LED /
LCD driver IC ILI9341 /
Interface Type SPI /
Touch Screen 4-Wire resistive touch screen /
Active area 43.2*57.3 mm
ESD contact discharge ±4 KV
ESD air discharge ±8 KV
Dimension 72.5x54.7x18 mm
Weight 24±2 g

Cautions

  • Don’t press too hard on the screen which might cause display distortion. 
  • Be careful to deposit the fragile screen.

Pins usage on Arduino


Pins Used for TFT Screen Control:
D4: TF_CS, SD card select input pin

D5: TFT_CS, TFT chip select input pin

D6: TFT_D/C, TFT Data/Command control pin

D7: BACKLIGHT, TFT backlight control pin

Pins Used for SPI Interface:
D10: SPI chip select
D11: SPI MOSI pin

D12: SPI MISO pin

D13: SPI serial clock pin

Pins Used for Touch Function:
A0 - Touch Screen Y- input pin.

A1 - Touch Screen X- input pin.

A2 - Touch Screen Y+ input pin.

A3 - Touch Screen X+ input pin.

TFT Programming

The TFT library provides the following Application Programming Interfaces(API). The library makes use of direct access to PORT registers instead of Arduino APIs. This is to increase the speed of communication between MCU and TFT. At present, the library supports Arduino, Arduino Mega (1280 or 2560) and Seeeduino ADK Main Board compatible boards. In Mega the 8bit data port of TFT is distributed to different pins belonging to different ports. This decreases the speed of graphics drawing when compared to Arduino. The choice of port pins are purely based on Arduino / Mega port pin arrangement.

General Functions


setXY(unsigned int poX, unsigned int poY)

Sets the cursor position to (poX,poY). This function is internally used by other graphics APIs.

setPixel(unsigned int poX, unsigned int poY,unsigned int color)

Sets the (poX,poY) pixel to color color. This function is internally used by other graphics APIs.

Lines

drawLine(unsigned int x0,unsigned int y0,unsigned int x1,unsigned int y1,unsigned int color)

Draws a line from pixel (x0,y0) to pixel (x1,y1) with color color.

drawVerticalLine(unsigned int poX, unsigned int poY,unsigned int length,unsigned int color)

Draws a Horizontal Line of length length with color color starting from pixel (poX,poY).

drawHorizontalLine(unsigned int poX, unsigned int poY,unsigned int length,unsigned int color)

Draws a Vertical Line of length length with color color starting from pixel (poX,poY).

Rectangle

drawRectangle(unsigned int poX, unsigned int poY, unsigned int length,unsigned int width,unsigned int color)

Draws a rectangle starting from (poX,poY) of length length, width width and color color.

fillRectangle(unsigned int poX, unsigned int poY, unsigned int length, unsigned int width, unsigned int color)

Draws a filled rectangle starting from pixel (poX,poY) of length length, width width and color color.

Circle

drawCircle(int poX, int poY, int r,unsigned int color)

Draws a circle at (poX,poY) of radius radius and color color.

fillCircle(int poX, int poY, int r,unsigned int color)

Draws a filled circle at (poX,poY) of radius radius and color color.

Text

drawChar(unsigned char ascii,unsigned int poX, unsigned int poY,unsigned int size, unsigned int fgcolor)

Draws a character starting from (poX,poY) using inbuilt font of size size and with color fgcolor. This function is used by drawString() function.

drawString(char *string,unsigned int poX, unsigned int poY,unsigned int size,unsigned int fgcolor)

Draws a string of text starting from (poX,poY) using inbuilt font of size size and with color fgcolor.

TouchScreen Programming