ST7735S TFT Display with PIC16F887 example – CCS C

Interfacing PIC16F887 with ST7735 TFT display
Interfacing PIC16F887 with ST7735S TFT display

This is an example for connecting the ST7735 1.8″ color TFT display with PIC16F887 microcontroller. The compiler used in this project is CCS PIC C compiler.
The ST7735 needs a driver which can be found in the topic below:
ST7735 SPI TFT Display Driver for CCS PIC C compiler

After downloading the driver file just put it on the project folder.
The ST7735 uses SPI communication protocol and the PIC16F887 has one SPI module.
Generally the SPI protocol uses 3 lines: SCK (serial clock), SDI (serial data in) and SDO (serial data out) but for interfacing the ST7735 TFT we use only 2 lines: SCK and SDO.
The PIC16F887 has one SPI module with SCK mapped to RC3 pin (#18) and SDO mapped to RC5 (#24).

Components Required:

  • PIC16F887 microcontroller
  • ST7735 1.8″ TFT display
  • 20MHz crystal oscillator
  • 2 x 22pF ceramic capacitor
  • 5 x 1k ohm resistors
  • Protoboard
  • 5V Power supply source
  • Jumper wires

Interfacing PIC16F887 with ST7735 TFT display circuit:
Example circuit diagram is shown below.

PIC16F887 ST7735S TFT display circuit

TFT pin-out are shown in the circuit diagram above.
In this project I used 20MHz crystal oscillator which is the PIC16F887 maximum speed for highest SPI data transfer rate (5Mbit/s). Lower crystal frequencies can be used or even the internal oscillator of the microcontroller.
5 x 1K ohm resistors are needed because basically the ST7735 works with 3.3V and the PIC16F887 works with 5V , it may be damaged if it connected directly to the microcontroller. The TFT is supplied with +5V because its board contains AMS1117 3.3V voltage regulator.

Interfacing PIC16F887 with ST7735 TFT display CCS C code:
The code has been tested with CCS PIC C compiler version 5.051.
ST7735 TFT driver is needed to compile the code.

Finally the following video shows the ST7735 and PIC16F887 in a protoboard circuit:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.