I posted about the All Electronics LCD-101 display in February 2018. The other day, I noticed that they were back in stock, so I decided to dust off where I last left off with the display. I had designed an I2C backpack with a contrast voltage driver for the display and modified the test Arduino code that I had to work with the backpack. The code was incomplete, so I needed to pick up where I left off, start over, or look at extending another library. I did look at the U8g2 library (https://github.com/olikraus/U8g2_Arduino) but it does not work well with the display. It may be because it is expecting the display to be 240 x 128 rather than 256 x 128.
LCD Pins
Pin No.
Symbol
Level
Function
JP2 Pin
I2C bit
1
FG
0V
Frame Ground
1
N/A
2
Vss(Gnd)
0V
Ground
1
N/A
3
Vdd(Vcc)
+5V
Power supply voltage for logic and LCD
2
N/A
4
Vo
–
Operating voltage for LCD (variable)
N/A
N/A
5
/RES
H/L
Reset signal
3
A0
6
/RD
H/L
Read signal
4
A1
7
/WR
H/L
Write signal
5
A2
8
/CS
H/L
Chip select signal
6
A3
9
A0
H/L
Data type select signal
7
A4
10
DB0
H/L
Display data bit 0
8
B0
11
DB1
H/L
Display data bit 1
9
B1
12
DB2
H/L
Display data bit 2
10
B2
13
DB3
H/L
Display data bit 3
11
B3
14
DB4
H/L
Display data bit 4
12
B4
15
DB5
H/L
Display data bit 5
13
B5
16
DB6
H/L
Display data bit 6
14
B6
17
DB7
H/L
Display data bit 7
15
B7
A0
/CS
/WR
/RD
/RES
I2C A4
I2C A3
I2C A2
I2C A1
I2C A0
Binary MASK
HEX
Decimal
Valid Op
Valid Result
Function/Note
X
X
X
X
0
11110
0x1E
30
OR
11110
Reset
X
0
0
0
1
01111
0x0F
15
AND
00001
Invalid State
X
0
1
1
1
01111
0x0F
15
AND
00111
No Operation
X
1
X
X
1
01001
0x09
9
AND
01001
No Operation
0
0
0
1
1
00011
0x03
3
EQUAL/XOR
00011
Display data and parameter write
0
0
1
0
1
00101
0x05
5
EQUAL/XOR
00101
Status flag read
1
0
0
1
1
10011
0x13
19
EQUAL/XOR
10011
Command write
1
0
1
0
1
10101
0x15
21
EQUAL/XOR
10101
Display data and cursor address read
A0
/CS
/WR
/RD
/RES
Mask
Valid Result
A4
A3
A2
A1
A0
Binary
HEX
Decimal
Valid Op
Binary
HEX
Decimal
Function/Note
X
X
X
X
0
11110
0x1E
30
OR
11110
0x1E
30
Reset
X
0
0
0
1
01111
0x0F
15
AND
00001
0x01
1
Invalid State
X
0
1
1
1
01111
0x0F
15
AND
00111
0x07
7
No Operation
X
1
X
X
1
01001
0x09
9
AND
01001
0x09
9
No Operation
0
0
0
1
1
00011
0x03
3
EQUAL/XOR
00011
0x03
3
Display data and parameter write
0
0
1
0
1
00101
0x05
5
EQUAL/XOR
00101
0x05
5
Status flag read
1
0
0
1
1
10011
0x13
19
EQUAL/XOR
10011
0x13
19
Command write
1
0
1
0
1
10101
0x15
21
EQUAL/XOR
10101
0x15
21
Display data and cursor address read
12 June 2022 Update
I had a question about this display, so I have updated the GitLab repository at https://gitlab.com/richteel/LCD-101/ to include the I2C Backpack that I designed for the LCD with a negative charge pump for the contrast and I2C or SPI interface for Arduino and Raspberry Pi. You may order the black PCB from Oshpark at https://oshpark.com/shared_projects/LwLCCjaW.
The schematic for the backpack is in the LCD-101/LCD-101 2020/I2C Backpack folder and is named I2C Backpack.pdf.
All Electronics has a rather large LCD display which will work great in a Jeopardy! like game that I am building. The display should be rather easy to use with an Arduino or Raspberry Pi but searching for Arduino or Raspberry Pi projects using the display turns up very few details. Fortunately the SED1330F datasheet is fairly well written. With some experimentation, it is possible to figure out how to get it to work. Especially helpful is table 32 in section 9.1.2. Some of the parameters need to be changed but it is a great example of how to get the display to work.
Here is a very short video of the LCD running from an Arduino UNO. The video starts with the display showing the result from the test2 function from the sample code below. I then upload the code again with the test2 function call commented out and the testDataSheetSection9 function call uncommented.
test2(511);testDataSheetSection9();
#include
// All Electronics LCD-101
// HG25504 with SED1330F
// LCD Pins
#define d0 14
#define d1 15
#define d2 2
#define d3 3
#define d4 4
#define d5 5
#define d6 6
#define d7 7
#define res 8
#define rd 9
#define wr 10
#define cs 11
#define a0 12
// LCD Comands
#define SYSTEM_SET 0x40
#define SLEEP_IN 0x53
#define DISP_OFF 0x58
#define DISP_ON 0x59
#define SCROLL 0x44
#define CSRFORM 0x5D
#define CGRAM_ADR 0x5C
#define CSRDIR_R 0x4C
#define CSRDIR_L 0x4D
#define CSRDIR_U 0x4E
#define CSRDIR_D 0x4F
#define HDOT_SCR 0x5A
#define OVLAY 0x5B
#define CSRW 0x46
#define CSRR 0x47
#define MWRITE 0x42
#define MREAD 0x43
// LCD Parameters
#define LCD_RES_W 256
#define LCD_RES_H 128
#define CHAR_BITS_WIDE 8
#define CHARS_PER_LINE 32//8 bit
#define TEXT_ROWS 16
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Hello world");
delay(2000);// Give reader a chance to see the output.
// Set pins for output
setDataPinsForOutput();
pinMode(res, OUTPUT);
pinMode(rd, OUTPUT);
pinMode(wr, OUTPUT);
pinMode(cs, OUTPUT);
pinMode(a0, OUTPUT);
lcdReset();
lcdInit();
testDataSheetSection9();
//test2(511);
}
void loop() {
// put your main code here, to run repeatedly:
}
/*** Functions ***/
void clearGraphicsLayer() {
// Set Start at 03E8H
lcdWriteCommand(CSRW);
lcdWriteData(0x03);
lcdWriteData(0xE8);
// Write 00H (blank data) for 8000 bytes
lcdWriteCommand(MWRITE);
for(int i=0; i<8000; i++) {
lcdWriteData(0x00);
}
}
void clearTextLayer() {
// Set Start at 0000H
lcdWriteCommand(CSRW);
lcdWriteData(0x00);
lcdWriteData(0x00);
// Write 20H (space character) for 1000 bytes
lcdWriteCommand(MWRITE);
for(int i=0; i<1000; i++) {
lcdWriteData(0x20);
}
}
void lcdInit() {
Serial.println("Step 3");
// 3 Initialize LCD Sequence
lcdWriteCommand(SYSTEM_SET); // C
lcdWriteData(0x30); // P1 M0, M1, M2, W/S, IV, T/L, & DR
lcdWriteData(0x87); // P2 FX & WF
lcdWriteData(0x07); // P3 FY
lcdWriteData(0x1F); // P4 (C/R) Address range covered by one line
lcdWriteData(0x23); // P5 (TC/R) Length of one line
lcdWriteData(0x7F); // P6 (L/F) Frame height in lines
lcdWriteData(0x20); // P7 (APL)
lcdWriteData(0x00); // P8 (APH)
}
void lcdReset() {
digitalWrite(res, LOW);
// Set init state for wr & cs
digitalWrite(wr, LOW);
digitalWrite(cs, LOW);
delay(50);
}
void lcdWriteCommand(byte command) {
lcdWriteCtrl(0x05);
lcdWriteJustData(command);
digitalWrite(wr, HIGH); // Latch Data
//delay(10);
}
void lcdWriteCtrl(byte ctrl) {
digitalWrite(cs, LOW);
digitalWrite(res, HIGH);
digitalWrite(a0, ctrl & 0x04);
digitalWrite(wr, ctrl & 0x02);
digitalWrite(rd, ctrl & 0x01);
}
void lcdWriteData(byte data) {
lcdWriteCtrl(0x01);
lcdWriteJustData(data);
digitalWrite(wr, HIGH); // Latch Data
//delay(10);
}
void lcdWriteJustData(byte data) {
digitalWrite(d7, (data & 0x80) == 0x80);
digitalWrite(d6, (data & 0x40) == 0x40);
digitalWrite(d5, (data & 0x20) == 0x20);
digitalWrite(d4, (data & 0x10) == 0x10);
digitalWrite(d3, (data & 0x08) == 0x08);
digitalWrite(d2, (data & 0x04) == 0x04);
digitalWrite(d1, (data & 0x02) == 0x02);
digitalWrite(d0, (data & 0x01) == 0x01);
}
void setDataPinsForOutput() {
pinMode(d0, OUTPUT);
pinMode(d1, OUTPUT);
pinMode(d2, OUTPUT);
pinMode(d3, OUTPUT);
pinMode(d4, OUTPUT);
pinMode(d5, OUTPUT);
pinMode(d6, OUTPUT);
pinMode(d7, OUTPUT);
}
void testDataSheetSection9() {
Serial.println("Running Test 2");
Serial.println("Step 4");
// 4 Set display start address and display regions
lcdWriteCommand(SCROLL);
lcdWriteData(0x00); // P1 (SAD 1 L)
lcdWriteData(0x00); // P2 (SAD 1 H)
lcdWriteData(0x80); // P3 (SL 1)
lcdWriteData(0x00); // P4 (SAD 2 L)
lcdWriteData(0x10); // P5 (SAD 2 H)
lcdWriteData(0x80); // P6 (SL 2)
lcdWriteData(0x00); // P7 (SAD 3 L)
lcdWriteData(0x04); // P8 (SAD 3 H)
//lcdWriteData(0x00); // P9 (SAD 4 L)
//lcdWriteData(0x30); // P10 (SAD 4 H)
Serial.println("Step 5");
// 5 Set Horizontal Scroll position
lcdWriteCommand(HDOT_SCR);
lcdWriteData(0x00);
Serial.println("Step 6");
// 6 Set display overlay format
lcdWriteCommand(OVLAY);
lcdWriteData(0x01);
Serial.println("Step 7");
// 7 Set display off
lcdWriteCommand(DISP_OFF);
lcdWriteData(0x56);
Serial.println("Step 8");
// 8 Clear data in first layer with 20H (space character)
clearTextLayer();
Serial.println("Step 9");
// 9 Clear data in second layer with 00H (blank data)
clearGraphicsLayer();
Serial.println("Step 10");
// 10 Set cursor address
lcdWriteCommand(CSRW);
lcdWriteData(0x00);
lcdWriteData(0x00);
Serial.println("Step 11");
// 11 Set Cursor type
lcdWriteCommand(CSRFORM);
lcdWriteData(0x04);
lcdWriteData(0x86);
Serial.println("Step 12");
// 12 Set display on
lcdWriteCommand(DISP_ON);
Serial.println("Step 13");
// 13 Set Cursor direction - Right
lcdWriteCommand(CSRDIR_R);
Serial.println("Step 14");
// 14 Write characters
lcdWriteCommand(MWRITE);
lcdWriteData(0x20);
lcdWriteData(0x45);
lcdWriteData(0x50);
lcdWriteData(0x53);
lcdWriteData(0x4F);
lcdWriteData(0x4E);
Serial.println("Step 15");
// 15 Set cursor address
lcdWriteCommand(CSRW);
lcdWriteData(0x00);
lcdWriteData(0x10);
Serial.println("Step 16");
// 16 Set Cursor direction - Down
lcdWriteCommand(CSRDIR_D);
Serial.println("Step 17");
// 17 Fill square
lcdWriteCommand(MWRITE);
for(int i0=0; i0<9; i0++) {
lcdWriteData(0xFF);
}
Serial.println("Step 18");
// 18 Set cursor address
lcdWriteCommand(CSRW);
lcdWriteData(0x01);
lcdWriteData(0x10);
Serial.println("Step 19");
// 19 Fill square
lcdWriteCommand(MWRITE);
for(int i0=0; i0<9; i0++) {
lcdWriteData(0xFF);
}
Serial.println("Step 20");
// 20 Set cursor address
lcdWriteCommand(CSRW);
lcdWriteData(0x02);
lcdWriteData(0x10);
Serial.println("Step 21");
// 21 Fill square
lcdWriteCommand(MWRITE);
for(int i0=0; i0<9; i0++) {
lcdWriteData(0xFF);
}
Serial.println("Step 22");
// 22 Set cursor address
lcdWriteCommand(CSRW);
lcdWriteData(0x03);
lcdWriteData(0x10);
Serial.println("Step 23");
// 23 Fill square
lcdWriteCommand(MWRITE);
for(int i0=0; i0<9; i0++) {
lcdWriteData(0xFF);
}
Serial.println("Step 24");
// 24 Set cursor address
lcdWriteCommand(CSRW);
lcdWriteData(0x04);
lcdWriteData(0x10);
Serial.println("Step 25");
// 25 Fill square
lcdWriteCommand(MWRITE);
for(int i0=0; i0<9; i0++) {
lcdWriteData(0xFF);
}
Serial.println("Step 26");
// 26 Set cursor address
lcdWriteCommand(CSRW);
lcdWriteData(0x05);
lcdWriteData(0x10);
Serial.println("Step 27");
// 27 Fill square
lcdWriteCommand(MWRITE);
for(int i0=0; i0<9; i0++) {
lcdWriteData(0xFF);
}
Serial.println("Step 28");
// 28 Set cursor address
lcdWriteCommand(CSRW);
lcdWriteData(0x06);
lcdWriteData(0x10);
Serial.println("Step 29");
// 29 Fill square
lcdWriteCommand(MWRITE);
for(int i0=0; i0<9; i0++) {
lcdWriteData(0xFF);
}
Serial.println("Step 30");
// 30 Set cursor address
lcdWriteCommand(CSRW);
lcdWriteData(0x00);
lcdWriteData(0x01);
Serial.println("Step 31");
// 31 Set Cursor direction - Right
lcdWriteCommand(CSRDIR_R);
Serial.println("Step 32");
// 32 Write more text
lcdWriteCommand(MWRITE);
lcdWriteData(0x44);
lcdWriteData(0x6F);
lcdWriteData(0x74);
lcdWriteData(0x20);
lcdWriteData(0x4D);
lcdWriteData(0x61);
lcdWriteData(0x74);
lcdWriteData(0x72);
lcdWriteData(0x69);
lcdWriteData(0x78);
lcdWriteData(0x20);
lcdWriteData(0x4C);
lcdWriteData(0x43);
lcdWriteData(0x44);
Serial.println("Done with Datasheet Section 9 Sample");
}
void test2(int testNum) {
Serial.println("Running Test 2");
Serial.println("Step 4");
// 4 Set display start address and display regions
lcdWriteCommand(SCROLL);
lcdWriteData(0x00); // P1 (SAD 1 L)
lcdWriteData(0x00); // P2 (SAD 1 H)
lcdWriteData(0x80); // P3 (SL 1)
lcdWriteData(0x00); // P4 (SAD 2 L)
lcdWriteData(0x10); // P5 (SAD 2 H)
lcdWriteData(0x80); // P6 (SL 2)
lcdWriteData(0x00); // P7 (SAD 3 L)
lcdWriteData(0x04); // P8 (SAD 3 H)
Serial.println("Step 5");
// 5 Set Horizontal Scroll position
lcdWriteCommand(HDOT_SCR);
lcdWriteData(0x00);
Serial.println("Step 6");
// 6 Set display overlay format
lcdWriteCommand(OVLAY);
lcdWriteData(0x01);
Serial.println("Step 7");
// 7 Set display off
lcdWriteCommand(DISP_OFF);
lcdWriteData(0x56);
Serial.println("Step 8");
// 8 Clear data in first layer with 20H (space character)
clearTextLayer();
Serial.println("Step 9");
// 9 Clear data in second layer with 00H (blank data)
clearGraphicsLayer();
Serial.println("Step 10");
// 10 Set cursor address
lcdWriteCommand(CSRW);
lcdWriteData(0x00);
lcdWriteData(0x00);
Serial.println("Step 11");
// 11 Set Cursor type
lcdWriteCommand(CSRFORM);
lcdWriteData(0x04);
lcdWriteData(0x86);
Serial.println("Step 12");
// 12 Set display on
lcdWriteCommand(DISP_ON);
//lcdWriteData(0x16);
Serial.println("Step 13");
// 13 Set Cursor direction - Right
lcdWriteCommand(CSRDIR_R);
Serial.println("Step 14");
// 14 Write characters
writeNumbers(testNum);
Serial.println("Done with Test 2");
}
void writeNumbers(int numQty) {
byte numZero = 0x30;
int idx = 0;
byte data = 0x00;
byte offset = 1;
lcdWriteCommand(MWRITE);
while(idx < numQty) {
if(offset > 9)
offset = 0;
data = numZero + offset;
lcdWriteData(data);
offset++;
idx++;
}
}
I plan to post more information as the project progresses. I do want to mention a few things that I found out in regards to the display.
You may wonder if the HG25504 is single or dual-panel display. It is a one panel display. This becomes obvious when you look at the ICs on the back of the display. The columns are driven by four HD66204FC Dot Matrix LCD column driver with 80-channels. If each column was used on these chips, they could drive 320 columns. This is 64 more columns than the display has but no where near 512 columns which would be required for a dual-panel configuration.
Included ICs and function
HD66204FC (Qty 4) Dot Matrix LCD column driver with 80-channels
HD66205FC (Qty 2) Dot Matrix LCD common driver with 80-channels
SED1330F (Qty 1) LCD Controller
HY6264A (Qty 1) Static RAM (8K bytes)
KA324D (Qty 1) Quad Operational Amplifier
Vo (LCD Contrast Voltage) – You really do need to apply at least -10V to Vo in respect to ground. There are some posts regarding this display stating that tying it to ground is enough but it is not. I had applied a negative voltage but was only seeing something when Vo was near ground potential. I was able to initialize the LCD but could not see anything displayed. I knew the screen was initialized because with Vo being close to ground potential, I saw one or more lines on the LCD when it was initially powered up. When I initialized the LCD, the line(s) were gone. I was getting frustrated as I could not display anything on the screen after initializing it. When I finally used a different power supply, I could see that I had been doing things right.
Power Requirements (You may have different results)
LCD Contrast (-10.5VDC @ 3.5mA)
LCD Logic (5VDC @ 10mA)
Arduino Uno (5VDC @ 10mA
The SED1330F supports 8080 and 6800 family processors. This matters as the LCD is wired for one or the other and the control lines change function based on the wiring of the LCD. Section 2.4.3 of the datasheet specifies that SEL1 and SEL2 determine the operation. Both SEL1 and SEL2 are connected to ground on the LCD therefore it is operating in 8080 mode.
You must be logged in to post a comment.