Go Down

Topic: Graphic ST7565 Negative LCD 128x64 (Read 2190 times) previous topic - next topic


Hi people

I was going to program a Graphic ST7565 Negative LCD 128x64 to display 4 numbers that are read from 4 sensors at each of the 4 corners of the LCD. However, I can't figure out how I can navigate through pixels on the LCD, by looking at the library file. It seems that there are function(s) for it, but I cant figure out which one(s).

Any help will be appreciated :)


Can you post the code you made sofar,
and a link to the library you use
and a link to the datasheet of the LCD if possible.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Aug 03, 2013, 08:33 am Last Edit: Aug 03, 2013, 08:36 am by JimboJohn Reason: 1
Here's a link to where I downloaded the library:


Here's a link to the datasheet:


Also this is the webpage on adafruit website where I found those links. ( I bought the LCD off that website):


I still haven't written any code, because unlike GLCD library pdf file, I couldn't find any good documentations on how the functions work in this LCD model.

I appreciate any hints or help. :D


A quick look shows that there is at least a game of life example that does the some pixel addressing

the .h file shows quite a straight forward interface. it has functions to draw lines and write text etc.
Code: [Select]

void st7565_init(void);
  void begin(uint8_t contrast);
  void st7565_command(uint8_t c);
  void st7565_data(uint8_t c);
  void st7565_set_brightness(uint8_t val);
  void clear_display(void);
  void clear();
  void display();

  void setpixel(uint8_t x, uint8_t y, uint8_t color);
  uint8_t getpixel(uint8_t x, uint8_t y);
  void fillcircle(uint8_t x0, uint8_t y0, uint8_t r,
  uint8_t color);
  void drawcircle(uint8_t x0, uint8_t y0, uint8_t r,
  uint8_t color);
  void drawrect(uint8_t x, uint8_t y, uint8_t w, uint8_t h,
uint8_t color);
  void fillrect(uint8_t x, uint8_t y, uint8_t w, uint8_t h,
uint8_t color);
  void drawline(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
uint8_t color);
  void drawchar(uint8_t x, uint8_t line, char c);
  void drawstring(uint8_t x, uint8_t line, char *c);
  void drawstring_P(uint8_t x, uint8_t line, const char *c);

  void drawbitmap(uint8_t x, uint8_t y,
  const uint8_t *bitmap, uint8_t w, uint8_t h,
  uint8_t color);

Think it is just time to write some code, I don't have such a display so I cannot test it.
Here is some code that should get you started
Code: (not tested) [Select]

#define BACKLIGHT_LED 10

// don't know how you connect the thing
// pin 9 - Serial data out (SID)
// pin 8 - Serial clock out (SCLK)
// pin 7 - Data/Command select (RS or A0)
// pin 6 - LCD reset (RST)
// pin 5 - LCD chip select (CS)
ST7565 glcd(9, 8, 7, 6, 5);

void setup()
  Serial.println("Set backlight");
  digitalWrite(BACKLIGHT_LED, HIGH);


  glcd.display(); // show splashscreen


  glcd.drawstring(20,20, "hello");

  glcd.drawline(0,0,0,60, 0);
  glcd.drawline(0,0,60,60, 1);
  glcd.drawline(0,60,60,60, 2);
void loop(){};
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Sorry for late reply.

Thanks again for the code. I tried to upload the code and I got this error:

sketch_aug14a.ino: In function 'void drawGabrielsp138()':
sketch_aug14a:55: error: 'st7565_buffer' was not declared in this scope
sketch_aug14a.ino: In function 'void drawGlider()':
sketch_aug14a:67: error: 'st7565_buffer' was not declared in this scope

Then I put this piece of code in and the error was gone:

extern uint8_t st7565_buffer[1024];

However, nothing was displayed on the lcd, even though the code compiled and uploaded successfully.

I will fiddle with it more and let you know of my progress.


Me again.

The reason it wasnt showing anything was a loose wire...... my baaaaaaad!!!

But, something interesting happens.When i write:


it only displays "h". But when I write:


it displays "hello".

any ideas what could be happening here??


I will go out on a limp here and assume this is because when you use drawString, the x,y coordinates actually refer to column and row, not a pixel based x,y.
Usually a single character is considered to be 6 pixels wide and 8 pixels in height.
Try something like glcd.drawstring(2,2,"Hello"); and see what happens.


The fact that it wasn't displaying was a loose wire (clumsy me!!!!! :smiley-sweat:). However, you are correct about it working in column and row system. I have discovered that it does not go over 7 rows and the screen is divided to around 100 columns. each column is as thick as one character.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131