I have a NHD-C12864B2Z-RN-FBW screen, which uses the ST7565R controller and works only using the 8080 interface. I tried using the U8G2_ST7565_NHD_C12864_1_8080 constructor but without success. After writing and uploading my own initialization code for the screen, I noticed that the screen's RAM contained data from the Hello World example that I had previously run. So I went back to the Hello World example code, added my own screen initialization, and now everything works.
Modified Hello World example:
#include <Arduino.h>
#include <U8g2lib.h>
#define D0 14
#define D1 27
#define D2 26
#define D3 25
#define D4 33
#define D5 32
#define D6 13
#define D7 5
#define WRITE 16
#define READ 17
#define A0 4
#define RESET 0
#define CS 2
U8G2_ST7565_NHD_C12864_1_8080 u8g2(U8G2_R0, D0, D1, D2, D3, D4, D5, D6, D7, WRITE, CS, A0, RESET);
void setup(void) {
u8g2.begin();
pinMode(READ, OUTPUT);
digitalWrite(READ, HIGH);
initScreen();
}
void loop(void) {
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawStr(0,20,"Hello World!");
} while ( u8g2.nextPage() );
delay(1000);
}
void initScreen() {
digitalWrite(READ, HIGH);
digitalWrite(WRITE, HIGH);
digitalWrite(CS, LOW);
digitalWrite(RESET, LOW);
delay(150);
digitalWrite(RESET, HIGH);
delay(150);
sendCommand(0x0a2); // LCD bias set to 1/9
sendCommand(0x0a0); // ADC set to reverse
sendCommand(0x0c8); // COM set to reverse
sendCommand(0x025); // resistor ratio set to large
sendCommand(0x081); // electronic volume set (contrast)
sendCommand(0x010); // electronic volume set
sendCommand(0x02f); // operating mode - all power control circuits on
sendCommand(0x0f8); // set booster ratio
sendCommand(0x000); // booster ratio to 4x
sendCommand(0x040); // start line set to 0
sendCommand(0x0af); // display on
delay(10);
}
void sendCommand(uint8_t command) {
digitalWrite(CS, LOW);
digitalWrite(A0, LOW);
digitalWrite(WRITE, LOW);
const int dataPins[8] = {D7, D6, D5, D4, D3, D2, D1, D0};
for(int i = 0; i < 8; i++) {
digitalWrite(dataPins[i], (command >> (7 - i)) & 0x01);
}
digitalWrite(WRITE, HIGH);
digitalWrite(CS, HIGH);
delay(10);
}
After this, I added my own constructor for this screen with the same initialization as in the example above, intending to add it to this repository later, but it didn't work. The screen only starts when I use the modified Hello World example.
Code I added to the library to add this screen (This is a copy of the code responsible for U8G2_ST7565_NHD_C12864_1_8080 with modified initialization to match the one I wrote.):
I have a NHD-C12864B2Z-RN-FBW screen, which uses the ST7565R controller and works only using the 8080 interface. I tried using the U8G2_ST7565_NHD_C12864_1_8080 constructor but without success. After writing and uploading my own initialization code for the screen, I noticed that the screen's RAM contained data from the Hello World example that I had previously run. So I went back to the Hello World example code, added my own screen initialization, and now everything works.
Modified Hello World example:
After this, I added my own constructor for this screen with the same initialization as in the example above, intending to add it to this repository later, but it didn't work. The screen only starts when I use the modified Hello World example.
Screen: [link] Screen documentation: [link] ST7565R documentation: [link]
Code I added to the library to add this screen (This is a copy of the code responsible for U8G2_ST7565_NHD_C12864_1_8080 with modified initialization to match the one I wrote.):
U8g2lib.h
u8g2.h
u8g2_d_setup.c
u8x8.h
u8x8_d_st7565.c