2026-01-02
The 2.8-inch LCD screen has a resolution of 240*400, a vertical 16:9 aspect ratio, and uses the ILI9327 or ST7793 driver IC. It supports SPI/MCU/RGB interfaces and is a relatively mature LCD screen on the market, suitable for customers using microcontrollers. It can significantly reduce the overall cost for customers. Engineers at Shenzhen Hongjia Technology will analyze its application on microcontrollers in this article.
1. Core Screen Features
Physical size: 2.8 inches (diagonal length).
Resolution: 240 (width) x 400 (height). This is an "unconventional" resolution, vertical screen (the default driving direction is usually 240 wide, 400 high). Many GUI libraries or image conversion tools need to pay special attention to this size.
Interface types:
SPI: Serial Peripheral Interface, fewer pins (usually only SCK, MOSI, MISO, CS, DC, RST), relatively slow speed, suitable for displaying static images or scenarios with infrequent updates. This is the simplest and most common way to control this screen.
MCU 8/16-bit parallel: Parallel transmission through an 8-bit or 16-bit data bus, fast speed, high refresh rate, but requires a large number of microcontroller I/O ports. Usually used in applications requiring high refresh rates, or when the main controller itself does not have a hardware SPI interface.
2. Typical Application Scheme on Microcontrollers
Driving this type of screen usually requires two levels of software:
A. Low-level Hardware Abstraction Layer
SPI initialization: Configure the MCU's SPI peripheral, set the clock polarity, phase, data bit order, and clock frequency (usually up to tens of MHz).
GPIO initialization: Configure CS, DC, and RST as output modes.
B. Screen Driver Layer (related to the specific IC)
This is the most critical part, and the core tasks include:
Initialization sequence: Send a series of specific commands and parameters to configure the driver IC. This includes setting the color format (such as RGB565), scanning direction, power control, etc. Initialization code optimized for 240x400 resolution must be used, usually provided by the screen supplier or open-source libraries. Basic Drawing Functions:
Write Command/Write Data Functions: Commands and data are distinguished via the DC pin.
Set Window Function: Tells the driver IC the display range (x_start, x_end, y_start, y_end) for subsequent data writing.
Write Pixel/Block Write Functions: Continuously writes color data within the set window. Block writing is key to efficient refreshing.
3. Advanced Function Implementation:
Clear Screen: Fills the entire screen with a single color.
Draw Point, Draw Line, Draw Rectangle, Draw Circle: Implemented based on the basic block writing function.
Display Image: Writes pre-converted bitmap array data to a specified area.
Display Characters/Chinese Characters: Obtains dot matrix data using a font extraction tool and then draws it.
4. Precautions and Optimization Techniques
A. Memory Consumption: For a 240x400 resolution, using RGB565 color format (16 bits/pixel), a single frame buffer requires 240 * 400 * 2 = 192,000 bytes (approximately 187.5KB). This exceeds the RAM capacity of most microcontrollers. Therefore, a no-buffer or partial-buffer approach is usually adopted for dynamic drawing.
B. Refresh Speed: SPI speed is the bottleneck. Maximize the SPI clock frequency while maintaining stability. Optimizing the block write function, reducing function call overhead, and using DMA transfer can significantly improve efficiency and free up the CPU.
C. Scanning Direction: The driver IC can be set to different scanning directions (0°, 90°, 180°, 270° rotation). If the display direction is incorrect, the MADCTL (Memory Access Control) command in the initialization parameters needs to be modified.
D. Color Format: Ensure that the color format (RGB565, RGB888, etc.) used by the driver IC, your driver code, and the GUI library are consistent.
This 2.8-inch LCD screen has been mass-produced by Shenzhen Hongjia Technology, with over 600,000 units produced. Of course, our 2.8-inch displays also come in other resolutions, including 240*320, 480*640, and 480*800, etc.It boasts reliable and stable quality, with long-term supply and no production discontinuation. We welcome inquiries via email; we will provide technical support and competitive pricing.