1

A long time ago I ordered this transparent OLED display (from a chinese supplier on alibaba) planning on interfacing it with an Arduino but didn't really have the skills to get the project going.

I have the datasheet (linked below) for the driver and it seems to come with a schematic on it which takes the output from the OLED and gives me 8-bit wiring. My plan is to use the adafruit GFX library with it and probably steal the code from this adafruit TFT.

Please, someone tell me if this has no hope of working but my plan as it stands is:

1) draw up the datasheets schematic into Kicad, and get it printed onto a PCB (I am worried that if I breadboard/protoboard it, ill have all kinds of issues coming from my poor perfboarding skills and I want to be able to narrow down my problems. I know it's bad practise to print a PCB before doing any breadboarding but I don't think ill successfully manage it)

2) wire up the output pins from the new PCB in the same way that the adafruit board and try and use the same code.

3) Here are where the problems come I think as I am proficient at simple code (I'm probably being ignorant to the fact that 'simple' code is still way above my level) e.g functions/loops etc... but writing code like adafruits example for displays is way above my level. I hope that I can just edit some of Adafruits existing example code and it will just work.

A few years ago I asked a similar question on the Arduino forum but then I was much worse at programming and had less of an idea where to start.

If any of you can provide insight into if this will work or any better ideas then I am all ears.

Thanks

Documents containing datasheets and example code - https://drive.google.com/drive/folders/1ZTmipJKRKWNMudYVQ5ATxixbQtKD4hQm?usp=sharing

Schematic Provided


edit: there is also a file called example_code.txt which contains a lot of (I dont know what I'm talking about really) hex commands.

edit 2: - ILI9341 Mock Example

/***************************************************
  This is our GFX example for the Adafruit ILI9341 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/


#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

void setup() {
  Serial.begin(9600);
  Serial.println("ILI9341 Test!"); 

  tft.begin();

  // read diagnostics (optional but can help debug problems)
  uint8_t x = tft.readcommand8(ILI9341_RDMODE);
  Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDMADCTL);
  Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDPIXFMT);
  Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDIMGFMT);
  Serial.print("Image Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDSELFDIAG);
  Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); 

  Serial.println(F("Benchmark                Time (microseconds)"));
  delay(10);
  Serial.print(F("Screen fill              "));
  Serial.println(testFillScreen());
  delay(500);

  Serial.print(F("Text                     "));
  Serial.println(testText());
  delay(3000);

  Serial.print(F("Lines                    "));
  Serial.println(testLines(ILI9341_CYAN));
  delay(500);

  Serial.print(F("Horiz/Vert Lines         "));
  Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
  delay(500);

  Serial.print(F("Rectangles (outline)     "));
  Serial.println(testRects(ILI9341_GREEN));
  delay(500);

  Serial.print(F("Rectangles (filled)      "));
  Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
  delay(500);

  Serial.print(F("Circles (filled)         "));
  Serial.println(testFilledCircles(10, ILI9341_MAGENTA));

  Serial.print(F("Circles (outline)        "));
  Serial.println(testCircles(10, ILI9341_WHITE));
  delay(500);

  Serial.print(F("Triangles (outline)      "));
  Serial.println(testTriangles());
  delay(500);

  Serial.print(F("Triangles (filled)       "));
  Serial.println(testFilledTriangles());
  delay(500);

  Serial.print(F("Rounded rects (outline)  "));
  Serial.println(testRoundRects());
  delay(500);

  Serial.print(F("Rounded rects (filled)   "));
  Serial.println(testFilledRoundRects());
  delay(500);

  Serial.println(F("Done!"));

}


void loop(void) {
  for(uint8_t rotation=0; rotation<4; rotation++) {
    tft.setRotation(rotation);
    testText();
    delay(1000);
  }
}

unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(ILI9341_BLACK);
  yield();
  tft.fillScreen(ILI9341_RED);
  yield();
  tft.fillScreen(ILI9341_GREEN);
  yield();
  tft.fillScreen(ILI9341_BLUE);
  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(ILI9341_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(ILI9341_RED);    tft.setTextSize(3);
  tft.println(0xDEADBEEF, HEX);
  tft.println();
  tft.setTextColor(ILI9341_GREEN);
  tft.setTextSize(5);
  tft.println("Groop");
  tft.setTextSize(2);
  tft.println("I implore thee,");
  tft.setTextSize(1);
  tft.println("my foonting turlingdromes.");
  tft.println("And hooptiously drangle me");
  tft.println("with crinkly bindlewurdles,");
  tft.println("Or I will rend thee");
  tft.println("in the gobberwarts");
  tft.println("with my blurglecruncheon,");
  tft.println("see if I don't!");
  return micros() - start;
}

unsigned long testLines(uint16_t color) {
  unsigned long start, t;
  int           x1, y1, x2, y2,
                w = tft.width(),
                h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1 = y1 = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t     = micros() - start; // fillScreen doesn't count against timing

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1    = w - 1;
  y1    = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1    = 0;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1    = w - 1;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);

  yield();
  return micros() - start;
}

unsigned long testFastLines(uint16_t color1, uint16_t color2) {
  unsigned long start;
  int           x, y, w = tft.width(), h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);
  for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);

  return micros() - start;
}

unsigned long testRects(uint16_t color) {
  unsigned long start;
  int           n, i, i2,
                cx = tft.width()  / 2,
                cy = tft.height() / 2;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(tft.width(), tft.height());
  start = micros();
  for(i=2; i<n; i+=6) {
    i2 = i / 2;
    tft.drawRect(cx-i2, cy-i2, i, i, color);
  }

  return micros() - start;
}

unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
  unsigned long start, t = 0;
  int           n, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n = min(tft.width(), tft.height());
  for(i=n; i>0; i-=6) {
    i2    = i / 2;
    start = micros();
    tft.fillRect(cx-i2, cy-i2, i, i, color1);
    t    += micros() - start;
    // Outlines are not included in timing results
    tft.drawRect(cx-i2, cy-i2, i, i, color2);
    yield();
  }

  return t;
}

unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(x=radius; x<w; x+=r2) {
    for(y=radius; y<h; y+=r2) {
      tft.fillCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int           x, y, r2 = radius * 2,
                w = tft.width()  + radius,
                h = tft.height() + radius;

  // Screen is not cleared for this one -- this is
  // intentional and does not affect the reported time.
  start = micros();
  for(x=0; x<w; x+=r2) {
    for(y=0; y<h; y+=r2) {
      tft.drawCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testTriangles() {
  unsigned long start;
  int           n, i, cx = tft.width()  / 2 - 1,
                      cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(cx, cy);
  start = micros();
  for(i=0; i<n; i+=5) {
    tft.drawTriangle(
      cx    , cy - i, // peak
      cx - i, cy + i, // bottom left
      cx + i, cy + i, // bottom right
      tft.color565(i, i, i));
  }

  return micros() - start;
}

unsigned long testFilledTriangles() {
  unsigned long start, t = 0;
  int           i, cx = tft.width()  / 2 - 1,
                   cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(cx,cy); i>10; i-=5) {
    start = micros();
    tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(0, i*10, i*10));
    t += micros() - start;
    tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(i*10, i*10, 0));
    yield();
  }

  return t;
}

unsigned long testRoundRects() {
  unsigned long start;
  int           w, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  w     = min(tft.width(), tft.height());
  start = micros();
  for(i=0; i<w; i+=6) {
    i2 = i / 2;
    tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
  }

  return micros() - start;
}

unsigned long testFilledRoundRects() {
  unsigned long start;
  int           i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(tft.width(), tft.height()); i>20; i-=6) {
    i2 = i / 2;
    tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
    yield();
  }

  return micros() - start;
}

edit 3: - ili9341 header file

/*!
 * @file Adafruit_ILI9341.h
 *
 * This is the documentation for Adafruit's ILI9341 driver for the
 * Arduino platform.
 *
 * This library works with the Adafruit 2.8" Touch Shield V2 (SPI)
 *    http://www.adafruit.com/products/1651
 * Adafruit 2.4" TFT LCD with Touchscreen Breakout w/MicroSD Socket - ILI9341
 *    https://www.adafruit.com/product/2478
 * 2.8" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341
 *    https://www.adafruit.com/product/1770
 * 2.2" 18-bit color TFT LCD display with microSD card breakout - ILI9340
 *    https://www.adafruit.com/product/1770
 * TFT FeatherWing - 2.4" 320x240 Touchscreen For All Feathers
 *    https://www.adafruit.com/product/3315
 *
 * These displays use SPI to communicate, 4 or 5 pins are required
 * to interface (RST is optional).
 *
 * Adafruit invests time and resources providing this open source code,
 * please support Adafruit and open-source hardware by purchasing
 * products from Adafruit!
 *
 *
 * This library depends on <a href="https://github.com/adafruit/Adafruit_GFX">
 * Adafruit_GFX</a> being present on your system. Please make sure you have
 * installed the latest version before using this library.
 *
 * Written by Limor "ladyada" Fried for Adafruit Industries.
 *
 * BSD license, all text here must be included in any redistribution.
 *
 */

#ifndef _ADAFRUIT_ILI9341H_
#define _ADAFRUIT_ILI9341H_

#include "Adafruit_GFX.h"
#include "Arduino.h"
#include "Print.h"
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <SPI.h>

#define ILI9341_TFTWIDTH 240  ///< ILI9341 max TFT width
#define ILI9341_TFTHEIGHT 320 ///< ILI9341 max TFT height

#define ILI9341_NOP 0x00     ///< No-op register
#define ILI9341_SWRESET 0x01 ///< Software reset register
#define ILI9341_RDDID 0x04   ///< Read display identification information
#define ILI9341_RDDST 0x09   ///< Read Display Status

#define ILI9341_SLPIN 0x10  ///< Enter Sleep Mode
#define ILI9341_SLPOUT 0x11 ///< Sleep Out
#define ILI9341_PTLON 0x12  ///< Partial Mode ON
#define ILI9341_NORON 0x13  ///< Normal Display Mode ON

#define ILI9341_RDMODE 0x0A     ///< Read Display Power Mode
#define ILI9341_RDMADCTL 0x0B   ///< Read Display MADCTL
#define ILI9341_RDPIXFMT 0x0C   ///< Read Display Pixel Format
#define ILI9341_RDIMGFMT 0x0D   ///< Read Display Image Format
#define ILI9341_RDSELFDIAG 0x0F ///< Read Display Self-Diagnostic Result

#define ILI9341_INVOFF 0x20   ///< Display Inversion OFF
#define ILI9341_INVON 0x21    ///< Display Inversion ON
#define ILI9341_GAMMASET 0x26 ///< Gamma Set
#define ILI9341_DISPOFF 0x28  ///< Display OFF
#define ILI9341_DISPON 0x29   ///< Display ON

#define ILI9341_CASET 0x2A ///< Column Address Set
#define ILI9341_PASET 0x2B ///< Page Address Set
#define ILI9341_RAMWR 0x2C ///< Memory Write
#define ILI9341_RAMRD 0x2E ///< Memory Read

#define ILI9341_PTLAR 0x30    ///< Partial Area
#define ILI9341_VSCRDEF 0x33  ///< Vertical Scrolling Definition
#define ILI9341_MADCTL 0x36   ///< Memory Access Control
#define ILI9341_VSCRSADD 0x37 ///< Vertical Scrolling Start Address
#define ILI9341_PIXFMT 0x3A   ///< COLMOD: Pixel Format Set

#define ILI9341_FRMCTR1                                                        \
  0xB1 ///< Frame Rate Control (In Normal Mode/Full Colors)
#define ILI9341_FRMCTR2 0xB2 ///< Frame Rate Control (In Idle Mode/8 colors)
#define ILI9341_FRMCTR3                                                        \
  0xB3 ///< Frame Rate control (In Partial Mode/Full Colors)
#define ILI9341_INVCTR 0xB4  ///< Display Inversion Control
#define ILI9341_DFUNCTR 0xB6 ///< Display Function Control

#define ILI9341_PWCTR1 0xC0 ///< Power Control 1
#define ILI9341_PWCTR2 0xC1 ///< Power Control 2
#define ILI9341_PWCTR3 0xC2 ///< Power Control 3
#define ILI9341_PWCTR4 0xC3 ///< Power Control 4
#define ILI9341_PWCTR5 0xC4 ///< Power Control 5
#define ILI9341_VMCTR1 0xC5 ///< VCOM Control 1
#define ILI9341_VMCTR2 0xC7 ///< VCOM Control 2

#define ILI9341_RDID1 0xDA ///< Read ID 1
#define ILI9341_RDID2 0xDB ///< Read ID 2
#define ILI9341_RDID3 0xDC ///< Read ID 3
#define ILI9341_RDID4 0xDD ///< Read ID 4

#define ILI9341_GMCTRP1 0xE0 ///< Positive Gamma Correction
#define ILI9341_GMCTRN1 0xE1 ///< Negative Gamma Correction
//#define ILI9341_PWCTR6     0xFC

// Color definitions
#define ILI9341_BLACK 0x0000       ///<   0,   0,   0
#define ILI9341_NAVY 0x000F        ///<   0,   0, 123
#define ILI9341_DARKGREEN 0x03E0   ///<   0, 125,   0
#define ILI9341_DARKCYAN 0x03EF    ///<   0, 125, 123
#define ILI9341_MAROON 0x7800      ///< 123,   0,   0
#define ILI9341_PURPLE 0x780F      ///< 123,   0, 123
#define ILI9341_OLIVE 0x7BE0       ///< 123, 125,   0
#define ILI9341_LIGHTGREY 0xC618   ///< 198, 195, 198
#define ILI9341_DARKGREY 0x7BEF    ///< 123, 125, 123
#define ILI9341_BLUE 0x001F        ///<   0,   0, 255
#define ILI9341_GREEN 0x07E0       ///<   0, 255,   0
#define ILI9341_CYAN 0x07FF        ///<   0, 255, 255
#define ILI9341_RED 0xF800         ///< 255,   0,   0
#define ILI9341_MAGENTA 0xF81F     ///< 255,   0, 255
#define ILI9341_YELLOW 0xFFE0      ///< 255, 255,   0
#define ILI9341_WHITE 0xFFFF       ///< 255, 255, 255
#define ILI9341_ORANGE 0xFD20      ///< 255, 165,   0
#define ILI9341_GREENYELLOW 0xAFE5 ///< 173, 255,  41
#define ILI9341_PINK 0xFC18        ///< 255, 130, 198

/**************************************************************************/
/*!
@brief Class to manage hardware interface with ILI9341 chipset (also seems to
work with ILI9340)
*/
/**************************************************************************/

class Adafruit_ILI9341 : public Adafruit_SPITFT {
public:
  Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK,
                   int8_t _RST = -1, int8_t _MISO = -1);
  Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _RST = -1);
#if !defined(ESP8266)
  Adafruit_ILI9341(SPIClass *spiClass, int8_t dc, int8_t cs = -1,
                   int8_t rst = -1);
#endif // end !ESP8266
  Adafruit_ILI9341(tftBusWidth busWidth, int8_t d0, int8_t wr, int8_t dc,
                   int8_t cs = -1, int8_t rst = -1, int8_t rd = -1);

  void begin(uint32_t freq = 0);
  void setRotation(uint8_t r);
  void invertDisplay(bool i);
  void scrollTo(uint16_t y);
  void setScrollMargins(uint16_t top, uint16_t bottom);

  // Transaction API not used by GFX
  void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);

  uint8_t readcommand8(uint8_t reg, uint8_t index = 0);
};

#endif // _ADAFRUIT_ILI9341H_

3 Answers 3

1

The critical part, assuming your hardware works, is getting the software going. Not all OLEDs are the same, and different ones need different commands to get them working.

You can't just take a random OLED and use a random library - it needs a driver to make it work.

In this case it's the DA8620 that is the main chip that you want to worry about, and your chosen library has to implement the commands and methodologies for that specific chip.

Now, you have a file that contains those commands (all the "hex commands"), and if you can't find an existing library to work with the DA8620 then you will have to write or adapt one while referring to those commands. You can find out more about what the commands all mean by referencing the datasheet, which lists all the commands and their parameters (from page 78 onwards), so you should be able to relate those to what an existing library needs and map things accordingly while keeping the right power-up sequences.

11
  • Thanks for the info. Unfortunately, the DA8620 seems to be niche and also discontinued so it's very tricky to find any information let alone an Arduino driver. If I decided to try and adapt an existing library, for example, the Adafruit GFX, would it be so easy as changing some commands in the library to match the commands written in the datasheet? I assume that is not how it works at all and I am probably way out of my depth here. How would I go about changing a library? Thanks Jun 7, 2020 at 14:12
  • @VosemMedia That is probably exactly how it works. Find what the library does, and then find the commands that do that job in the datasheet and match those to the examples in the file of commands you have.
    – Majenko
    Jun 7, 2020 at 14:13
  • Okay, thankyou. Do you have any reccomendations for libraries to start with? Do you think that one I linked earlier would be an okay starting point? Thanks Jun 7, 2020 at 17:06
  • The Adafruit one is good because it is split into sections - one for the drawing primitives (the GFX library) and the other for the OLED driver.
    – Majenko
    Jun 7, 2020 at 17:07
  • Okay, I edited in an adafruit GFX example code for some irrelivent 2.4" tft. It references some functions like tft.setTextColor and tft.println. I need to edit those functions right? Or am I on the completely wrong line and should be looking somewhere else. If im not, would these magical commands be in Adafruit_GFX.h or Adafruit_ILI9341.h? Thanks Jun 7, 2020 at 17:29
2

Is the SPI communication method feasible? I have found a chip at present, and it seems that the driver can be transplanted directly. You can look at this chip. https://nl.mouser.com/ProductDetail/Newhaven-Display/NHD-169-BREAKOUT?qs=wnTfsH77Xs6v7mYjAGElxw%3D%3D

1

Your initial code.txt file is flawed.

The pdf file has the code in multiple columns on each page, and not all the columns are filled.

This is the code (i think it is correct)

  1. Example of Initial Code
Command(0x11);
Data(0x00);

Delay_ms(255);   // Delay 255ms or more

Command(0xC5);
Data(0x01);

Command(0xC4);
Data(0x2F);

Command(0xC0);
Data(0x10);
Data(0x00);

Command(0x26);
Data(0x00);

Command(0x2A);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0xEF);

Command(0x2B);
Data(0x00);
Data(0x00);
Data(0x01);
Data(0x3F);

Command(0x36);
Data(0x08);

Command(0xC0);
Data(0x50);
Data(0x00);

Command(0x3A);
Data(0x65);    //Pixel Format 16bit data
//Data(0x67);  //Pixel Format 24bit data

Command(0xBB);
Data(0x4D);
Data(0x97);
Data(0x1C);

Command(0xC1);
Data(0x01);

Command(0xC6);
Data(0x6B);
Data(0x02);
Data(0x00);
Data(0x06);
Data(0x06);
Data(0x06);

Command(0xC9);
Data(0xF0);

Command(0xE0);
Data(0xC0);
Data(0x00);

Command(0xE2);
Data(0x00);

Command(0xE8);
Data(0x23);
Data(0x00);
Data(0x00);

Command(0xEB);
Data(0xC0);

Command(0xD9);
Data(0x40);
Data(0x00);

Command(0xD1);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);

Command(0xDF);
Data(0x35);
Data(0xAD);
Data(0x1C);
Data(0xE7);
Data(0x18);
Data(0xC6);
Data(0x14);
Data(0xA5);
Data(0x18);
Data(0xC6);
Data(0x14);
Data(0xA5);
Data(0x18);
Data(0xC6);
Data(0x14);
Data(0xA5);
Data(0x18);
Data(0xC6);
Data(0x14);
Data(0xA5);
Data(0x18);
Data(0xC6);
Data(0x14);
Data(0xA5);
Data(0x14);
Data(0xA5);
Data(0x18);
Data(0xC6);
Data(0x14);
Data(0xA5);
Data(0x18);
Data(0xC6);
Data(0x14);
Data(0xA5);
Data(0x18);
Data(0xC6);
Data(0x10);
Data(0x84);
Data(0x1C);
Data(0xE7);
Data(0x14);
Data(0xA5);
Data(0x10);
Data(0x84);
Data(0x1C);
Data(0xE7);
Data(0x08);
Data(0x42);
Data(0x0C);
Data(0x63);
Data(0x08);
Data(0x42);
Data(0x0C);
Data(0x63);
Data(0x10);
Data(0x84);
Data(0x08);
Data(0x42);
Data(0x0C);
Data(0x63);
Data(0x08);
Data(0x42);
Data(0x0C);
Data(0x63);
Data(0x10);
Data(0x84);
Data(0x14);
Data(0xA5);
Data(0x08);
Data(0x42);
Data(0x08);
Data(0x42);
Data(0x14);
Data(0xA5);
Data(0x0C);
Data(0x63);
Data(0x08);
Data(0x42);
Data(0x14);
Data(0xA5);
Data(0x08);
Data(0x42);
Data(0x08);
Data(0x42);
Data(0x0C);
Data(0x63);
Data(0x08);
Data(0x42);
Data(0x14);
Data(0xA5);
Data(0x14);
Data(0xA5);
Data(0x08);
Data(0x42);
Data(0x0C);
Data(0x63);

Command(0xD0);
Data(0x9F);
Data(0x19);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0x9F);
Data(0x19);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0x9F);
Data(0x19);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0x9F);
Data(0x19);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x0D);
Data(0x94);
Data(0x28);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x04);
Data(0x16);
Data(0xFF);
Data(0x00);
Data(0x04);
Data(0x16);
Data(0xFF);
Data(0x00);
Data(0x04);
Data(0x16);
Data(0x8F);
Data(0x35);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x04);
Data(0x20);
Data(0xFF);
Data(0x00);
Data(0x04);
Data(0x20);
Data(0xFF);
Data(0x00);
Data(0x04);
Data(0x20);
Data(0x8C);
Data(0x42);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x04);
Data(0x2A);
Data(0xFF);
Data(0x00);
Data(0x04);
Data(0x2A);
Data(0xFF);
Data(0x00);
Data(0x04);
Data(0x2A);
Data(0x8A);
Data(0x50);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x08);
Data(0x33);
Data(0x88);
Data(0x64);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x08);
Data(0x46);
Data(0xFF);
Data(0x00);
Data(0x08);
Data(0x46);
Data(0xFF);
Data(0x00);
Data(0x08);
Data(0x46);
Data(0x7C);
Data(0x67);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x44);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x44);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x44);
Data(0x6E);
Data(0x74);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x54);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x54);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x54);
Data(0x64);
Data(0x90);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x5E);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x5E);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x5E);
Data(0x5A);
Data(0x92);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x5F);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x5F);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x5F);
Data(0x52);
Data(0x94);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x61);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x61);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x61);
Data(0x4C);
Data(0x95);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x65);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x65);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x65);
Data(0x47);
Data(0x97);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x62);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x62);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x62);
Data(0x42);
Data(0x99);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x64);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x64);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x64);
Data(0x3E);
Data(0x9A);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x66);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x66);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x66);
Data(0x3A);
Data(0x9C);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x65);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x65);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x65);
Data(0x37);
Data(0x9D);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x68);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x68);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x68);
Data(0x34);
Data(0x9F);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x6A);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x6A);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x6A);
Data(0x32);
Data(0xA0);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x6B);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x6B);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x6B);
Data(0x2F);
Data(0xA2);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x70);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x70);
Data(0xFF);
Data(0x00);
Data(0x10);
Data(0x70);
Data(0x2D);
Data(0xA4);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x72);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x72);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x72);
Data(0x2B);
Data(0xA6);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x75);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x75);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x75);
Data(0x29);
Data(0xA7);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x76);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x76);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x76);
Data(0x28);
Data(0xA8);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x79);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x79);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x79);
Data(0x26);
Data(0xAA);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x81);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x81);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x81);
Data(0x25);
Data(0xAC);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x81);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x81);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x81);
Data(0x23);
Data(0xAE);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x87);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x87);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x87);
Data(0x22);
Data(0xAF);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x89);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x89);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x89);
Data(0x21);
Data(0xB1);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x8D);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x8D);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x8D);
Data(0x20);
Data(0xB2);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x89);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x89);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x89);
Data(0x1F);
Data(0xB4);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x8E);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x8E);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x8E);
Data(0x1E);
Data(0xB6);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x93);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x93);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x93);
Data(0x1D);
Data(0xB8);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x98);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x98);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x98);
Data(0x1C);
Data(0xBA);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x95);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x95);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x95);
Data(0x1B);
Data(0xBC);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x95);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x95);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x95);
Data(0x1B);
Data(0xBC);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x91);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x91);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x91);
Data(0x1A);
Data(0xBE);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x9A);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x9A);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0x9A);
Data(0x19);
Data(0xC0);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0xA8);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0xA8);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0xA8);
Data(0x19);
Data(0xC0);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0xA0);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0xA0);
Data(0xFF);
Data(0x00);
Data(0x0C);
Data(0xA0);
Data(0x17);
Data(0xC6);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0x2C);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0x2C);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0x2C);
Data(0x16);
Data(0xC9);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0x45);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0x45);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0x45);
Data(0x14);
Data(0xD0);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0x7F);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0x7F);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0x7F);
Data(0x11);
Data(0xDE);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0xF0);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0xF0);
Data(0xFF);
Data(0x00);
Data(0x02);
Data(0xF0);
Data(0x0F);
Data(0xEB);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0x00);
Data(0x03);
Data(0x54);
Data(0xFF);
Data(0x00);
Data(0x03);
Data(0x54);
Data(0xFF);
Data(0x00);
Data(0x03);
Data(0x54);

Command(0xDD);
Data(0x0B);
Data(0x0B);
Data(0x0B);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);

Command(0xDE);
Data(0x1C);

Command(0xE4);
Data(0x7F);
Data(0x7F);
Data(0x7F);
Data(0xEF);
Data(0xEF);
Data(0xEF);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0xFF);
Data(0xFF);
Data(0xFF);
Data(0x00);
Data(0x00);
Data(0x00);

Command(0xED);
Data(0x0F);

Command(0xC7);
Data(0x00);

Command(0xC8);
Data(0xA4);

Command(0xD2);
Data(0xA7);

Command(0xE2);
Data(0x09);

Delay_ms(255);
Delay_ms(255);
Delay_ms(255);

Command(0xF0);
Data(0x7E);
Data(0x54);
Data(0x45);
Data(0x53);
Data(0x54);
Data(0x21);

Command(0x51);
Data(0x16);

Command(0x50);
Data(0x00);

Command(0xCE);
Data(0x80);
Data(0x00);
Data(0xE0);
Data(0x00);
Data(0x00);
Data(0x00);

Command(0xCD);
Data(0x06);
Data(0xC7);

Delay_ms(16);   //Delay 16ms or more

Command(0xCE);
Data(0x80);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);
Data(0x00);

Command(0xCD);
Data(0x06);
Data(0xC7);

Command(0xCD);
Data(0x00);
Data(0x00);

Command(0x35);
Data(0x00);

Command(0xE0);
Data(0xD0);
Data(0x00);

Command(0x29);
Data(0x00);
3
  • So is this an updates and corrected piece of example code? Jun 8, 2020 at 7:19
  • look at the txt file you included and compare it to the code in the pdf file ... the txt file was created by copy and paste from the pdf file ... the problem is that the pdf file has the code arranged in four columns ... copy and paste of the four columns results in garbage data .... the code above matches the correct sequence in the pdf file
    – jsotola
    Jun 8, 2020 at 7:41
  • Ah okay I understand. Thankyou for correcting that. Jun 8, 2020 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.