ST7735 TFT Vertical Scrolling example with CCS C Compiler

This post shows how to make the ST7735 SPI TFT display vertically scrolling using PIC18F4550 microcontroller and CCS PIC C compiler.
The CCS C codes below are tested with versions 4.068 and 5.051.
For this project we need a driver for the ST7735 TFT display which can be found in the following post:
ST7735 SPI TFT Display Driver for CCS PIC C compiler

And the following post show how to interface ST7735 TFT display with PIC18F4550 microcontroller:
Interfacing PIC18F4550 with 1.8″ TFT display

TFT: Thin-Film Transistor.
LCD: Liquid Crystal Display.
SPI: Serial Peripheral Interface.
MOSI: Master Out Slave In.
MISO: Master In Slave Out.
SCK: Serial Clock
DIY: Do-It-Yourself

ST7735 TFT Vertical Scrolling with PIC18F4550 circuit:
The circuit schematic of all our examples below is as shown in the following image.

ST7735 TFT vertical scrolling with PIC18F4550

Hardware Required:

  • PIC18F4550 microcontroller   —> datasheet
  • ST7735 TFT display
  • 8MHz crystal oscillator
  • 2 x 22pf ceramic capacitor
  • 5 x 1k ohm resistor
  • Bread board & jumper wires
  • 5V source
  • PIC Microcontroller programmer (PICkit 3, PICkit 4…)

PIC18F4550 MCLR pin function is disabled in the code.

ST7735 TFT top to bottom and bottom to top vertical scrolling:
To make the TFT scrolls first we have to set the window that we would like to scroll, this is done using the following command:
setScrollDefinition(TFA, BFA, _scroll_direction);
Where TFA is top fixed area and BFA is bottom fixed area (in pixel)
_scroll_direction can be 0 or 1( 0 for to to bottom and 1 for bottom to top).
setScrollDefinition(40, 20, 1);
That makes the TFT display area from pixel 40 to pixel 140 (160 – 20) scrolls from bottom to top.
If TFA = BFA = 0 the whole screen is selected to scroll as shown in the example below.
Another command is required to make the TFT scrolls which is:
Where _vsp is an unsigned int8 number which controls the level of the scroll.
Example 2:
The following example shows how to make TFT scrolls from top to bottom:
Here TFT = BFA = 0.

ST7735 TFT Vertical Scrolling with PIC18F4550 video:
The following video shows the result of top to bottom scrolling of the ST7735 display.

If the line: setScrollDefinition(TFA, BFA, top_to_bottom); changed to:
setScrollDefinition(TFA, BFA, bottom to top);
then we will see the following result:

ST7735 TFT Vertical Scrolling example:
This is an other example for ST7735 TFT vertical scrolling.
In this example the scrolling direction is from bottom to top.
After every scrolling process the microcontroller deletes the data that may appear in the bottom of the screen by drawing a horizontal line.

Example video:
The video below shows example result.

Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

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

Scroll to Top