How to use LCD TFT Arduino shield BL-TFT240320PLUS LCD  Using Arduino with LCD TFT QVGA BL-TFT240320PLUS.
BL-TFT240320PLUS design as LCD TFT arduino shield. It can plug into Arduino Diecimila. It's contain LCD QVGA and sd card. It can use as a terninal, dataloge, etc..
Version 2. contain on board DS1307 I2C RTC.

Arduino pin interface
BL-TFT240320PLUS interface is 8 or 16 bit mode. In order to use with arduino. Set jumper to 8 bit mode. Arduino pin interface description below.
| Arduino 168 |
TFT |
Discription |
| Digital 0 |
DB0 |
LCD data0 |
| Digital 1 |
DB1 |
LCD data1 |
| Digital 2 |
DB2 |
LCD data2 |
| Digital 3 |
DB3 |
LCD data3 |
| Digital 4 |
DB4 |
LCD data4 |
| Digital 5 |
DB5 |
LCD data5 |
| Digital 6 |
DB6 |
LCD data6 |
| Digital 7 |
DB7 |
LCD data7 |
| Digital 15 |
LATCH |
8 bit latch interface mode |
| Digital 17 |
WR |
Write pin |
| Digital 18 |
RS |
Instruction mode. 0 = instruction, 1 = data |
| Digital 19 |
CS |
LCD module selection |
| Reset |
RST |
LCD reset |
| - |
8 bit mode |
8/16 bit mode. select to 8 bit mode |
.jpg) 
SD card interface
Interface SD card with SPI port
| Arduino 168 |
SD |
Discription |
| MISO |
DO |
SD data out |
| MOSI |
DI |
SD data in |
| SCK |
SCLK |
SD clock |
| SS |
SDCE |
SD chip select |
Other PIN interface
BL-TFT240302PLUS module have free pin. for arduino board to use as analog input and digital I/O.
BL-TFT240302PLUS V1
- analog input 0 ( digital pin 14 )
- analog input 2 ( digital pin 16 )
BL-TFT240302PLUS V2
- analog input 3 ( digital pin 17 )
- I2C pin on analog input 4,5 ( digital pin 8,19 ) connect to on board DS1307 RTC.
Software library
TFT class. There are 2 class.
- Graphic and driver class is low level driver to interface with TFT and simple graphic library.
Function and variable
lcdTft();
void Reset(void);
void WrCmd(uint8_t data);
void WrDat(word val);
void setCursor(word x, word y);
void setArea(word x1, word y1, word x2, word y2);
void setColor(word penColor) { Color = penColor; };
word getColor(void) { return (unsigned int)Color; };
void PutPixel(word x, word y);
void Rect(word left, word top, word right, word bottom, word color);
void Clear(word pencolor);
word getMaxX() {return (unsigned int)SCREEN_HOR_SIZE-1;};
word getMaxY() {return (unsigned int)SCREEN_VER_SIZE-1;};
void Line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2);
void Rectangle(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int radius);
void RectangleFill(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int radius);
void CircleFill(unsigned int x, unsigned int y, unsigned int radius, unsigned char fill);
void Circle(unsigned int x, unsigned int y, unsigned int radius, unsigned char fill);
- Font class is font class to draw font on TFT. It's best on ontEditor written by H. Reddmann.
Function and variable
uint16_t FgColor; //Text fg color
uint16_t BkColor; //Text bk color
uint8_t FixFont; //Text type 0=Proportional , 1=Fixed
uint8_t Transparence; // Transparent 0=No, 1=Yes
uint8_t ScaleX; //X size of font
uint8_t ScaleY; //Y size of font
uint8_t CharSpace; //CharSpace between char
unsigned int cursorX; // x position
unsigned int cursorY; // y position
lcdFont();
void Font(uint8_t *pointer);
void PutChar(uint8_t c);
void Puts(char *Text);
unsigned int CalcTextWidth(char *Text);
unsigned int CalcTextHeight(char *Text);
void Number(uint32_t src, uint8_t digit, uint8_t decimal, uint8_t Parameter);
#define STYLE_NONE 0
#define STYLE_NO_ZERO 1
#define STYLE_NO_SPACE 2
void Text(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, char * str, uint8_t style);
void TextBox(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, char * str, uint8_t style);
// text box
#define ALINE_LEFT 0
#define ALINE_CENTER 1
#define ALINE_RIGHT 2
// border style
#define BORDER_NONE 0x00
#define BORDER_RECT 0x04
#define BORDER_FILL 0x08
#define BORDER_BEVEL 0xF0 // bevel radius 0x00(rectangle), 0x10-0xF0(radius size)
Using TextBox style can combile ALINE_CENTER | BORDER_RECT | BORDER_FILL.
For display text in streaming method www.circuitidea.com/Article/using-streamming-for-arduino-lcd-shield.html
touchscreen
Touch screen dirver is ads7843. using 3 point calibrate and save matrix data to eeprom. Change eeprom location by modify #define EE_MATRIX_ADDR
Function and variable
touchscreen(); // init class and read metrix from eeprom
POINT screenPoint; // touch screen point
POINT displayPoint; // display(LCD) view point
MATRIX matrix;
void Reset(void); // init and reset touch chip
void getMatrix(void); // read matrix from eeprom
void setMatrix(void); // write matrix to eeprom
void sampling(POINT * pScreen, unsigned char nTest); // get samppling point
void readPoint(void); // reading touch point
Sd Card class
Sd card for small and fast. We use Petit FatFs for Chan. It is read only. Using warp class to init interface. Petit FatFs must be in same location for compile and link. FatFs function use direct call fatfs function. If you need fat object use Sdcard::fatfs.
Function and variable
FATFS fatfs; // FatFs object interface for c language compile and link
SDcard();
uint8_t mount(void); // SD card mount
DS1307
On board contain DS1307 I2C RTC for time application. using DS1307.cpp - library for DS1307 rtc. Created by matt.joyce@gmail.com, December, 2007.
Function and variable
DS1307();
void get(int *, boolean);
int get(int, boolean);
int min_of_day(boolean);
void set(int, int);
void start(void);
void stop(void);
void get_sram_data(byte *);
void set_sram_data(byte *);
byte get_sram_byte(int);
void set_sram_byte(byte, int);
Download
Source code (Arduino library, LCD and demo. Must use with SD card library) and schematic www.circuitidea.com/dev-board/BL-TFT240320PLUS.html
Source code V2 (Arduino library, LCD, touch screen and demo. Must use with SD card library) and schematic http://www.circuitidea.com/dev-board/BL-TFT240320PLUS-V2.html
|