Interfacing PIC18F4550 with 1.8″ TFT display
This post shows how to connect ST7735S TFT display to PIC18F4550 microcontroller and display different things (numbers, text, lines, circles …..). The compiler used is CCS PIC C.
To interface PIC18F4550 with the ST7735 TFT display we need a small library (driver) which can be downloaded from its original post at the following url:
ST7735 SPI TFT Display Driver for CCS PIC C compiler
Or you can just download it directly from the following link:
ST7735 SPI TFT Display Driver
Put the downloaded C file in your project folder.
- PIC18F4550 Microcontroller
- ST7735R (or S) 1.8″ SPI TFT Display
- 5 x 1K Resistors (If the system is 3.3V there is no need for these resistors)
- Power Supply Source (+5V or +3.3V)
- Jumper Wires
PIC18F4550 internal oscillator is used in this project and MCLR pin function is disabled.
The system power supply is 5V and if you are using a microcontroller TFT display of 3.3V remove all the 1K resistors (5 resistors) from the circuit and connect the TFT display directly to the microcontroller.
Interfacing PIC18F4550 with ST7735S 1.8″ SPI TFT display CCS C code:
PIC18F4550 SPI module is used for to communicate with the TFT display. SPI module uses the following pins:
SDI (RB0): data input pin (not used in this project)
SCK (RB1): clock line
SDO (RC7): data output
// TFT module connections
#define TFT_CS PIN_B2
#define TFT_DC PIN_B3
// End TFT module connections
My TFT display is ST7735R Black Tap (ST7735S) and for initializing this type of TFT display I used the following line:
If you have a TFT display with green or red tabs or a TFT with ST7735B controller read the driver topic above.
Note that green, red and black tabs have the same controller ST7735R.
The microcontroller runs with its internal oscillator at 8MHz.
This code is tested with CCS PIC C compiler PCWHD versions 4 and 5.
For more detail: Interfacing PIC18F4550 with 1.8″ TFT display