2.8inch Resistive Touch LCD

From Waveshare Wiki
Jump to: navigation, search
2.8inch Resistive Touch LCD
2.8inch Resistive Touch LCD

2.8inch Resistive Touch LCD, SPI interface, 320 x 240 Resolution
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

Instruction

This is a multicolor graphic IPS LCD, 2.8inch diagonal, 320 × 240 pixels, with a resistive touch screen.

Feature

  • Onboard touch controller, smoother touch experience than solutions that directly use AD pins for touching.
  • SPI interface, requires a few pins.
  • Programmable backlight control, power saving.
  • Comes with online development resources and manuals (examples for STM32/AVR/PIC).

Specification

Display Controller HX8347D
Touch Controller XPT2046
LCD Type IPS
Interface SPI
Resolution 320 * 240
Dimension 79.9mm x 50.8mm
Display Area 57.6mm x 43.2mm
Display Colors RGB, 65K colors
Touch Type 4-wire resistive
Power Supply 5V
Logic Level 3.3V
Backlight LED

Interface

5V 5V
GND Ground
MISO Data output of SPI interface (slaver)
MOSI Data input of SPI interface (slaver)
SCLK Clock pin of SPI interface
LCD_CS Chip select pin of LCD
LCD_DC Data/Command selection
LCD_RST LCD Reset
LCD_BL Backlight control
TP_CS Chip select pin of Touch
TP_IRQ Interrupt pin of Touch

Hardware Description

LCD & Controller

Note: The LCD driver uses HX8347D and ST7789, and ST7789 is used by default. If you find that the product cannot be displayed, please change the driver first.
The screen uses SPI communication, which saves IO resources and is suitable for accessing MCU masters with less IO. Among them:

  • Display resolution: 240 * RGB (H) * 320(V)
  • Display color
    • Full-color mode: 262K, RGB=(666) max
    • True color mode: 8-color, RGB=(111)
  • Programmable image color format
    • 12-bit/pixel: RGB=(444)
    • 16-bit/pixel: RGB=(565)
    • 18-bit/pixel: RGB=(666)
  • Interface support
    • 8/9/16/18Bits 80 series MPU interface
    • 6/16/18 RGB connectors
    • Serial interface (SPI interface)
    • VSYNC interface

Communication Protocol

2.8inch resistive LCD01.jpg
It is known from the above that 4-wire SPI communication is used, and the following communication timing diagram can be obtained by consulting the data sheet, taking the transmission of RGB556 as an example:
CSX: the slave chip selected, and the chip will be enabled only when CS is low.
D/CX: the data/command control pin of the chip, write command when DC = 0, write data when DC = 1
SDA: the transmitted data, that is, RGB data;
SCL: the SPI communication clock.
For SPI communication, data is transmitted with timing, that is, the combination of clock phase (CPHA) and clock polarity (CPOL):
The level of CPHA determines whether the serial synchronization clock is collected on the first clock transition edge or the second clock transition edge. When CPHL = 0, data acquisition is performed on the first transition edge;
The level of CPOL determines the idle state level of the serial synchronous clock. CPOL = 0, which is a low level.
As can be seen from the figure, when the first falling edge of SCLK starts to transmit data, 8-bit data is transmitted in one clock cycle, using SPI0, bit-by-bit transmission, high-order first, and low-order last.

XPT2046

The TP_IRQ pin of the 2.8-inch Resistive Touch LCD is used by the MCU to judge whether the screen is pressed. The screen is pressed to output a low level, or it is pulled up to output a high level. The main functions of XPT2046 are as follows:

  • XPT2046 is a 4-wire resistive touchscreen controller with a built-in 12-bit resolution 125KHz conversion rate step approximation A/D converter.
  • XPT2046 supports low voltage I/O interface from 1.5V to 5.25V.
  • XPT2046 can detect the pressed screen position by performing two A/D conversions, and besides, it can also measure the pressure applied to the touch screen. The built-in 2.5V reference voltage can be used as an auxiliary input temperature measurement and battery monitoring. The voltage range of battery monitoring can be from 0V to 5V.
  • XPT2046 integrates a temperature sensor on-chip. In a typical operating state of 2.7V, with the reference voltage turned off, the power consumption can be less than 0.75mW. The XPT2046 is available in tiny packages: TSSOP-16, QFN-16, and VFBGA-48. The working temperature range is -40℃~+85℃. Fully compatible with ADS7846, TSC2046, and AK4182A.

About the Demo

2.8inch Resistive Touch LCD supports access to our OpenX05R, PIC16F877A/PIC18F4520, OpenM128, Open103C, and other development boards.
Note: The LCD driver has used two models: HX8347D and ST7789. By default, ST7789 is used. If you find that the display cannot be displayed, please change the driver first.
Change the driver method: open the LCD_Driver.h file, comment #define ST7789_DEVICE on line 80, and remove //#define HX8347_DEVICE comment on line 81, as shown in the following figure.
2.8inch resistive lcd2501.png

Hardware Connection

OpenX05R-C

2.8inch Resistive Touch01.png

2.8inch Resistive Touch LCD Open405R-C
5V 5V
GND GND
MISO PA6
MOSI PA7
SCLK PB3
LCD_CS PB7
LCD_DC PB8
LCD_RST PB2
LCD_BL PB6
TP_CS PA9
TP_IRQ PB4

There are several examples provided, demo codes can be downloaded from #Demo codes.

This example is based on Waveshare Open405R-C.

  • Remove four LED jumpers, then insert the 2.8-inch LCD into Open405R-C.
  • Open the TouchPanel project, which is under the Open405R-C directory. Compile and download it to the development board.
  • After downloading, press the reset button of the OpenX05-C board, you can see that prompt information is printed on the LCD:
Please use the stylus to clock the cross on the screen. The cross will always move until the screen adjustment is completed.
  • You need to calibrate the touchscreen by touch pen following the prompt.
  • After calibrating, now you can try to draw on the touchscreen.

For more details, you can refer to the codes.

OpenM128

2.8inch Resistive Touch LCDOpenM128.png
This example is based on Waveshare OpenM128.

  • Connect the LCD to OpenM128 according to the figures below:
2.8inch Resistive Touch LCD OpenM128
5V 5V
GND GND
MISO PB2/DIN
MOSI PB3/DOUT
SCLK PB1/CLK
LCD_CS PD6/CS
LCD_DC PB5/RS
LCD_RST PB6/RESET
LCD_BL PE5/PWM
TP_CS PB4
TP_IRQ PE4/IRQ

  • Connect the ISP programmer to the OpenM128 board and power on it.
  • Open the project on Atmel Studio 7.0 software.
  • Compile and flash code to OpenM128.
2.8inch Resistive Touch LCD-003.png    

Open103C

This example is based on Waveshare Open103C.

  • Connect LCD to Open103C according to the figures below:
2.8inch Resistive Touch LCD Open103C
5V 5V
GND GND
MISO PB14
MOSI PB15
SCLK PB13
LCD_CS PB12
LCD_DC PB8
LCD_RST PB9
LCD_BL PB0
TP_CS PA15
TP_IRQ PB1
2.8inch Resistive Touch LCD-005.png
  • Connect the ST-Link programmer to Open103C and power on it.
  • Open project, compile, and flash codes to Open103C.
2.8inch Resistive Touch LCD-006.png

Open16F877A/Open18F4520

This example is based on Waveshare Open16F877A/Open18F4520.

  • Connect the LCD to Open16F877A/Open18F4520 according to the figures below:
2.8inch Resistive Touch LCD OpenPIC16F877A/Open18F4520
5V 5V
GND GND
MISO RC4
MOSI RC5
SCLK RC3
LCD_CS RA1
LCD_DC RA2
LCD_RST RD0
LCD_BL 3.3V
TP_CS RA4
TP_IRQ RA0
2.8inch Resistive Tou007.png

Steps:

  1. Use jumper caps to connect VCC and 3.3V, use PICkit3 to connect Open18F4520.
  2. Connect the 2.8inch Resistive Touch LCD to the 2.8inch LCD interface of Open18F4520.
  3. Turn on the power switch, and use MPLAB X IDE v4.15 to open the project and download the demo.

Display

2.8inch Resistive Touch LCD20.png

Resource

Documents

Drawing

Demo codes

Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 AM GMT+8 (Monday to Friday)