Beagle Bone 128x64 Graphic LCD
I have a BeagleBoneBlack and im trying to find a way to control a 128x64 Graphic LCD using python(This display, more specifically http://www.newhavendisplay.com/specs/NHD-12864AZ-NSW-BBW-TR.pdf), and i dont know exactly how to do it.
Last time that i used this display i was working with a PIC16F877A using the MikroC compiler and it has a library specifically for this GLCD display so it was bearly easier. I searched superficially for some solution but i dont find anything, do you guys know some solution or i have to create my own library to this application?
-
Hi Golding52,
Unfortunately we do not have resources on our end for operating our 128x64 Graphic LCD in Python. It may be necessary to create your own library in order to do so.
Attached below is sample code written for our 128x64 AZ-series Graphic LCD using an Arduino.
I hope this can be helpful as a reference to help progress your software development./*****************************************************************************
*
/ Program for writing to Newhaven Display's 128x64 Graphic Chip-On-Board with the NT7108C Controller.
/ Supported 128x64 Display Family: AZ, MZ, and WG Models
/ This code is written for the Arduino Uno R3 using Parallel Interface
/
/ Newhaven Display invests time and resources providing this open source code,
/ Please support Newhaven Display by purchasing products from Newhaven Display!
* Copyright (c) 2018, Newhaven Display International
*
* This code is provided as an example only and is not guaranteed by Newhaven Display.
* Newhaven Display accepts no responsibility for any issues resulting from its use.
* The developer of the final application incorporating any parts of this
* sample code is responsible for ensuring its safe and correct operation
* and for any consequences resulting from its use.
*
*****************************************************************************/
/*************************************
Images
**************************************/
unsigned char nhd[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x18, 0x18, 0x98, 0xD8, 0xD8, 0xD8, 0xD8, 0xD8, 0xD8, 0xD8,
0xD8, 0xD8, 0x00, 0xF8, 0xF8, 0xE0, 0x80, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0xF8, 0x98,
0xD8, 0xD8, 0x40, 0x00, 0x00, 0x18, 0x78, 0xE0, 0x80, 0xC0, 0x78, 0xF8, 0xC0, 0x80, 0xF0, 0xF8,
0x18, 0x00, 0x00, 0xF8, 0xF8, 0xC0, 0xC0, 0xC0, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x80, 0xE0, 0x78,
0x38, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x38, 0xF0, 0xC0, 0x00, 0xC0, 0xE0, 0x78, 0x18, 0x00, 0x80,
0xE0, 0xF0, 0xD8, 0xD8, 0xD8, 0xD8, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0x70, 0xE0, 0x80, 0xF8, 0xF8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xC0, 0xE0, 0xE0, 0xE0, 0xC0, 0x88, 0x1E, 0x3F, 0x3F, 0x3F, 0x3F, 0x1E, 0x0C,
0x0C, 0x0C, 0x0C, 0x0C, 0x8C, 0xCE, 0xC6, 0x73, 0x7B, 0x19, 0x0C, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x80, 0x87, 0x87, 0x80, 0x83, 0x87, 0x07, 0x00, 0x00, 0x00, 0x80, 0x83, 0x06, 0x06,
0x06, 0x06, 0x86, 0x80, 0x80, 0x80, 0x80, 0x83, 0x87, 0x07, 0x00, 0x00, 0x87, 0x87, 0x83, 0x80,
0x80, 0x80, 0x00, 0x07, 0x07, 0x00, 0x80, 0x80, 0x07, 0x07, 0x00, 0x00, 0x06, 0x07, 0x03, 0x01,
0x81, 0x83, 0x07, 0x06, 0x04, 0x00, 0x80, 0x80, 0x03, 0x07, 0x07, 0x81, 0x80, 0x00, 0x00, 0x00,
0x01, 0x03, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x03, 0x07, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3F, 0x3F, 0x31, 0x31, 0x31, 0x33, 0x3F, 0x0E, 0x00, 0x00, 0x3F, 0x3F, 0x00, 0x00,
0x00, 0x00, 0x37, 0x37, 0x35, 0x35, 0x3D, 0x3D, 0x19, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x0C, 0x08,
0x0D, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x20, 0x20, 0x20, 0x00, 0x00, 0x30, 0x3C, 0x1F,
0x19, 0x1B, 0x1E, 0x38, 0x20, 0x00, 0x01, 0x01, 0x07, 0x3E, 0x3E, 0x03, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x06, 0x0C, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x1E, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x1E, 0x16, 0x12, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1E, 0x0A, 0x1E, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x0C, 0x18, 0x1E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x0E, 0x0E, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1E, 0x1E, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x12, 0x12, 0x1E,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x06, 0x0C, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0E,
0x0E, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/**************************************************************
* DEFINITIONS
***************************************************************/
#define CS1 11 //Chip Selection IC1 (1 0) Left side
#define CS2 12 //Chip Selection IC2 (0 1) Right side
#define RST 13 //Active Low Reset
#define RW 9 //Low Write Signal
#define RS 8 //Reg Select 1- Data 0-instruction
#define E 10 //Operation Enable Falling Edge
//#define LED 11
/*******************************************
* Basic Functions *
*******************************************/
void comleft(char c){ //command left
PORTD = c;
digitalWrite(CS1, HIGH);
digitalWrite(RW , LOW );
digitalWrite(RS , LOW );
digitalWrite(E , HIGH);
delay(1);
digitalWrite(E , LOW );
digitalWrite(CS1, LOW);
}
void comright(char c){ //command right
PORTD = c;
digitalWrite(CS2, HIGH);
digitalWrite(RW , LOW );
digitalWrite(RS , LOW );
digitalWrite(E , HIGH);
delay(1);
digitalWrite(E , LOW );
digitalWrite(CS2, LOW);
}
void writeleft(char d){ //data left
PORTD = d;
digitalWrite(CS1, HIGH);
digitalWrite(RW , LOW );
digitalWrite(RS , HIGH);
digitalWrite(E , HIGH);
delay(1);
digitalWrite(E , LOW );
digitalWrite(CS1, LOW);
}
void writeright(char d){ //data right
PORTD = d;
digitalWrite(CS2, HIGH);
digitalWrite(RW , LOW );
digitalWrite(RS , HIGH);
digitalWrite(E , HIGH);
delay(1);
digitalWrite(E , LOW );
digitalWrite(CS2, LOW);
}
/******************************************
* Initialize *
******************************************/
void init1(){
//digitalWrite(RST, HIGH);
digitalWrite(RST, LOW);
delay(1);
digitalWrite(RST, HIGH);
digitalWrite(E, LOW);
digitalWrite(RS, LOW);
digitalWrite(RW, LOW);
digitalWrite(CS1, LOW);
digitalWrite(CS2, LOW);
comleft(0x3F); //Display On
comright(0x3F); //Display On
}
/*****************************************
* Display *
*****************************************/
//
void disp(const unsigned char *pic) //show Newhaven Display Logo
{
int page;
page = 0xB8;
for(int page = 0xB8; page < ((0xB8) + 8) ; page++){
comleft(page);
comright(page);
comleft(0x40);
comright(0x40);
for(int i = 0; i < 64; i++){
writeleft(*pic);
pic++;
}
for(int i = 0; i < 64; i++){
writeright(*pic);
pic++;
}
//page++;
}
}
void checkerboardLeft() //show checkerboard pattern on left side
{
int page;
page = 0xB8;
unsigned int j;
for(int j = 0; j < 8; j++){
comleft(page);
comright(page);
comleft(0x40);
comright(0x40);
for(int i = 0; i < 32; i++){ //Split from 64 -> 32, but 2 write functions makes up to equate 64 pixels.
writeleft(0xAA);
writeleft(0x55);
}
page++;
}
}
void checkerboardRight() //show checkerboard pattern on right side
{
int page;
page = 0xB8;
unsigned int j;
for(int j = 0; j < 8; j++){
comleft(page);
comright(page);
comleft(0x40);
comright(0x40);
for(int i = 0; i < 32; i++){ //Split from 64 -> 32, but 2 write functions makes up to equate 64 pixels.
writeright(0xAA);
writeright(0x55);
}
page++;
}
}
void setup() {
DDRD = 0xFF; //Enabling Arduino Port for Data pins
// digitalWrite(LED, HIGH);
pinMode(CS1, OUTPUT);
pinMode(CS2, OUTPUT);
pinMode(RST, OUTPUT);
pinMode(RW , OUTPUT);
pinMode(RS , OUTPUT);
pinMode(E , OUTPUT);
init1();
}
void loop() {
disp(nhd);
delay(2000);
checkerboardLeft();
delay(1000);
checkerboardRight();
delay(2000);
}Best,
0
Please sign in to leave a comment.
Comments
1 comment