Display BMP images from SD card on ST7735 TFT screen
This example shows how to display Bitmap (BMP) image files from SD card on ST7735 1.8″ (128×160) TFT screen using PIC18F4550 microcontroller and CCS PIC C compiler.
To build this project we need the ST7735 TFT driver, SD card driver and FAT16 library. The three source files must be added to the project folder (or CCS C driver folder) in order to compile the C code.
The ST7735 driver is update to support the display of BMP images from the SD card.
The ST7735 TFT display driver topic:
ST7735 SPI TFT Display Driver for CCS PIC C compiler
The SD card driver topic:
MMC/SD Card driver for CCS PIC C compiler
The FAT16 library topic:
FAT16 Library for CCS C compiler
Some posts related to this project if you want to go through them.
Interfacing PIC18F4550 with 1.8″ TFT display
- PIC18F4550 microcontroller
- SD Card with FAT16 file system ( <= 2GB)
- ST7735R (or S) 1.8″ TFT screen
- AMS1117 3.3V voltage regulator
- 8MHz crystal oscillator
- 2 x 22pF ceramic capacitor
- Push button
- 3 x 3.3K ohm resistor
- 3 x 2.2K ohm resistor
- 2 x 10K ohm resistor
- 5 x 1K ohm resistor
- 100nF ceramic capacitor
- 10uF polarized capacitor
- 5V Power source
- Jumper wires
The microcontroller PIC18F4550 has 1 SPI module only, both the ST7735 TFT and the SD card share the same SPI module. We could use software SPI but the hardware SPI is much faster.
The AMS1117 3.3V voltage regulator steps down the 5V into 3.3V, it is used to supply the SD card with 3.3V. Also there are 3 voltage dividers in the circuit, each voltage divider consists of 3K3 and 2K2 resistors, it is used to get about 3V from the outputs of the PIC18F4550.
The ST7735 board also has AMS1117 3.3V regulator which can be used to supply the SD card.
Connecting the PIC18F4550 data pins directly to the SD card without the voltage dividers may damage the SD card. The only pin which is connected directly from the microcontroller to the SD card is the SDI pin (MISO).
The PIC18F4550 runs with 8MHz crystal oscillator and with the PLL enabled the microcontroller now becomes run @ 48MHz and this is the maximum frequency of this type. With the frequency of 48MHz we get an SPI data transfer rate of 12Mbps.
The ST7735 D/C (Data/Command) pin is connected to pin RD0 and CS (Chip Select) pin is connected to pin RD1. The other pins which are DIN (Data IN) and CLK (Clock) are connected to hardware SPI pins of the MCU.
For more detail: Display BMP images from SD card on ST7735 TFT screen
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw
Current Project / Post can also be found using:
- how to expand the memory of pic 18f4550