GLCD library version 3 (end of life - no longer supported)

I tried to use a Pacific Display Devices 12232-10, a 122x32 module that uses 2x sed1520, but I don't think it can be made to work with the current version on glcd without a lot of work. Please correct me if I'm wrong.

I figured out that 122x32 modules using the sed1520 fall roughly into two types:

The first type has an internal oscillator, brings out 2 enable lines (E1 and E2). It's a 68-Family MPU style interface. The VK5121 module in the example provided with the library is this type.

The second type of module has separate chips selects (CS1 and CS2) and needs and external 2 kHz clock. It's a 80-Family MPU style interface. The Pacific Display Devices 12232-10 module is this type.

Support for this type (I think the specific sed1520 variant is called sed1520-faa) would be great but I understand it may be outside of the scope of the upcoming release. If so, it might be a good idea to put some comments about supported types in the documentation or maybe just comments in the code itself to prevent confusion.

As I find time, I'll look at the code again and see if I can figure out what modifications are necessary to make it work. If I can get it to work, I'll be happy to donate the code. Considering my work schedule and lack of familiarity with the current code, it may be a while.

its the sparkfun's GLCD

why?

i have check the conections

i tried to change pin14 to A0 and 15 to A1 etc

but then its not compile

thanks a lot

I'm wondering if you can give a little help to an issue that isn't part of the official package. I'm trying to run the LCD via a shift register in order to free up some pins that I will need, following the instructions on this post. As you know, a lot of the codebase has changed, as well as some of the general layout, and as a result, these code changes don't work perfectly. In order to account for the layout changes this is in the glcd.cpp file.

The main problem I'm encountering is with the last piece of code in that post, the lcdDataShiftOut function. When compiling using the ks0108:: prefix, I get the error that ks0108 hasn't been declared, which is to be expected. When I run it with the glcd:: prefix, I get the error "no member function declared in class 'glcd'". When running without either prefix, it gives errors that FastWriteLow and FastWriteHigh weren't declared in that 'scope'. The problem is, I'm not sure where or how to declare them. Can anyone offer some advice for this? Thanks.

i found it

just a broken wire

this code

GLCD.DrawCircle(31,31,31,BLACK);
GLCD.DrawLine(31,31,31,0);

creates a vertical line not a horizontal

so it is GLCD.DrawLine(X0,Y0,Y1,X1);

This may be a really silly question. Is there a document that shows all the commands for these glcd screens? Or do you just have to pick apart the examples. IV got my screen working but im having trouble getting complex functions to materialize.

Thanks, swiffty

Any possibility of support for newer OLED displays?
I just picked up a Newhaven NHD-2.7-12864UCY3 display... It's a 128x64 panel driven by a SSD1325 controller (display datasheet) (controller datasheet). It has options for 6800-based, 8080-based and serial interfaces. I tried the 6800 setup as it is very similar to the type 2 wiring for the GLCD library. The exceptions being a couple of no-connection pins (contrast-related pins), the backlight pins are used to define the interface type, and there's only one chip-select line which has had its position swapped with reset (/CS on 17, /RES on 16). I'm getting no image with chip select on 33 or 34 of a Seeduino Mega running on 3.3V (for the sake of compatibility with the display)... I guess hoping it would just work was going too far. :stuck_out_tongue:

[edit]Added missing URL[/edit]

herctrap:
this code
GLCD.DrawLine(31,31,31,0);
creates a vertical line not a horizontal

from the reference doc:

void DrawLine (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t color=BLACK)

As I read it, the second pair of values for DrawLine are coordinates not sizes, so I would expect the given code to draw a vertical line.

Is there some way to change pin assignments without editing the .h files? I tried doing a #define in my sketch but it doesn't seem to make any different. Also tried #undef and #define.

Thanks...

swifftyb:
This may be a really silly question. Is there a document that shows all the commands for these glcd screens? Or do you just have to pick apart the examples. IV got my screen working but im having trouble getting complex functions to materialize.

Thanks, swiffty

The library includes lots of documentation. It includes a pdf file as well as a html documentation. The html documentation
has more detail and supports searching as well as many hyper-links to make navigating through the documentation easier.
The documentation includes documentation on every function as well as information on troubleshooting and diagnostics,
how to create bitmap files, and even custom fonts.
The location of the documentation is mentioned in the readme.txt file included in the library package.
Have a look at the readme file.
But basically, the documentation is the glcd/doc directory and you can click on file
GLCDref.htm to view it.

--- bill

wbphelps:
Is there some way to change pin assignments without editing the .h files? I tried doing a #define in my sketch but it doesn't seem to make any different. Also tried #undef and #define.

Thanks...

Not really. The glcd library does not use any of the arduino core code to drive the lcd pins. It converts the defines in the header
files to direct AVR pin i/o at compile time. The advantage of this is speed. Direct i/o is MUCH faster than using the arduino core code.
( digitalRead(), digitalWrite() functions)
It does come with some drawbacks. One of them being that the all the pins must be defined when the library code
is built, which is built separately from the sketch so it is not possible to re-define the pins inside a sketch file or runtime
inside a sketch.

What is the driving need?
Are you looking for a way to preserve your pin changes when updating the library?

--- bill

Makes perfect sense, glcd is amazingly fast.

bperrybap:
What is the driving need?

I2C on A4,A5. Everything else I can move.

Thanks,
William

Hi Bill,

Thank you for your time on this great update.

I just installed v3 RC2 on my Teensy++ v2 and it works great. It shows 16.4 FPS.

A request -- Please consider including the ks0108_Teensy++.h config file, attached.

Thanks again for your time on this project.

Regards,
Larry

ks0108_Teensy++.h (965 Bytes)

larrykluger:
Hi Bill,

Thank you for your time on this great update.

I just installed v3 RC2 on my Teensy++ v2 and it works great. It shows 16.4 FPS.

A request -- Please consider including the ks0108_Teensy++.h config file, attached.

Thanks again for your time on this project.

Regards,
Larry

I'm not understanding what this teensy++ config file would be used for.
(with respect to the latest glcd library)

Maybe if you explained a bit more what you are needing, it would help.

=== more details.

The way things are configured in the latest version of the library is very different from the previous version.
The define names are different and now every glcd pin can be defined separately.
teensy++ should work "out of the box" by selecting the teensy or teensy++
board type in the Arduino IDE (with teensyduino installed).
The IDE will set the processor type and the glcd library auto-configuration
header files will key off that to automatically select an appropriate pin configuration file.
The final pin configuration file included for teensy/teensy++ boards glcd/config/ks0108_Teensy.h
supports both teensy and teensy++

A bit of detail:
glcd/glcd_Config.h includes the top level configuration file. By default this is set to include
glcd/config/ks0108_Panel.h which is the top level auto-configuration file for a ks0108 glcd panel.
The ks0108_Panel.h header file will then use the processor type
(which is set by selecting the board type in the Arduino IDE)
to determine which pin configuration file to include.
If you have your board type set to teensy or teensy++ then glcd/config/ks0108_Teensy.h
is included. Then inside glcd/config/ks0108_Teensy.h there are ifdefs to select which set of defines are used
to define the pins for teensy vs teensy++.

Michael and I set up the pin defines in the teensy pin configuration file as Paul had requested so it matches the
pin descriptions in his examples and on his web pages for both the teensy and teensy++.

NOTE:
Paul has not yet updated the teensy website yet, for the latest version of the glcd library. He
has a modified version of the ks0108 v2 library available on his site for use with teensyduino.

From looking at the header file you attached, the supplied teensy/teensy++ pin configuration
file appears to use the same pins, but the file you attached seems to be more in a form for the
older version 2 of the library.
Thats why I'm a bit confused as to what this header file would be used for?

--- bill

Hi Bill,

Thank you for an informative reply. I've tested it, and you're 100% right, stock GLCD v3 rc2 works great with the Teensy++ v2. No extra files are needed.

I was confused when I saw that the v2 glcd lib had two separate .h files for teensy and teensy++. -- So I copied over the v2 header file as you surmised.
Anyhow, as Emily Litella used to say, "Never mind."

Thanks and regards,

Larry

This library looks awesome - thanks for all the hard work.

Out of curiosity does it support KS0713 chips? I've seen some people say that they're compatible with KS0108 and others say no.

What happened to the "Pinout D panels" that were described on Arduino Playground - GLCDks0108??
I have the same display as described on AN #148 - LCD display with touchscreen and AVR - MCS Electronics and was trying to hook it up to de V3 GLCD library.
Any ideas???

I made a function that creates a bar graph, for anyone interested. To use it, simply add this to your glcd.cpp file:

void glcd::BarGraph(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t fullval, uint8_t currentval){
	float range = (float)width / (float)fullval;
	int currentwidth = currentval * range;
	GLCD.DrawRect(x, y, width, height);
	for (int i = 1; i < height; i++) {
		GLCD.DrawHLine(x, y+i, currentwidth);}
	GLCD.FillRect(x+currentwidth+1, y+1, width-currentwidth-2, height-2, WHITE);
}

And this to your glcd.h file:

void BarGraph(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t max, uint8_t current);

Here is an example, that fills the graph as a clock counts up:

#include <glcd.h>
#include "fonts/fixednums15x31.h"

long sec = 0;
int min = 0;
long starttime;

	
void setup() {

	GLCD.Init(NON_INVERTED);
	GLCD.ClearScreen(); 
}


void loop() {

	gText ClockArea;
	ClockArea.DefineArea(20, 0, 6, 1, fixednums15x31);
	ClockArea.CursorToXY(2,0);
	
	sec = (millis() - starttime) / 1000;
	if (sec > 59) {
		min++;
		sec = 0;
		starttime = millis();
	}
	if (min < 10) {
		ClockArea.print(0);}
	ClockArea.print(min);
	ClockArea.print(":");
	if (sec < 10) {
		ClockArea.print(0);}
	ClockArea.print(sec);
	GLCD.BarGraph(10, 40, 108, 8, 59, sec);
}

Syntax:

GLCD.BarGraph(toprightx, toprighty, width, height, fullvalue, currentvalue);

Alban:
What happened to the "Pinout D panels" that were described on Arduino Playground - GLCDks0108??
I have the same display as described on AN #148 - LCD display with touchscreen and AVR - MCS Electronics and was trying to hook it up to de V3 GLCD library.
Any ideas???

To honest, I've never really been a fan of the A, B, C.... display types. I know that it can make it easier to hook up panels
for less technical folks but it comes with some potential serious consequences. The biggest being if people start
to simply try them one after the other or simply pick the wrong one,
rather than compare it to the real datasheet to determine which one is the correct one,
it is possible that their display will be damaged.

The other issue that we ran into recently (which is what you are probably noticing) is the ks0108 playground is a "wiki"
page that is open for anyone to edit. The table has been updated/extended - which is what we wanted. Unfortunately, the
updates to the table were done incorrectly and have caused a deviation from the original table
and a deviation from the documentation included with the library.
i.e. the A, B, C, D.... display types on the wiki page no longer match the display types in the included library documentation.
This is very problematic because when they don't match, if someone says I have type "X" or vendor display "Y" is type "Z"
and they go by the table on the wiki, it can cause someone to wire it up incorrectly, which might damage the display.
The table on the wiki also currently does include the pinouts for the Teensy boards, whereas
the table included in the library HTML & PDF documentation does.
New table entries must always be added to end of the table and existing table entries cannot be modified.
Since the wiki is open for anyone to update,
I'm not sure how to really resolve this other than to remove the ability for people to update the wiki
or simply remove the table from wiki all together and only supply it with the library itself.

The safest thing to do is to always go by the data sheet and the "GLCD functions"
and Board type columns rather than use the display panel type columns in the table.
In other words, ignore the panel types columns in the table and match up your modules glcd pin functions
with the appropriate pins column for your board type.
It is simply a matter of looking at the table in a slightly different way.

To do this, you will be looking at your data-sheet, along with the "GLCD function" column
and then the appropriate board type column in table in the documentation included in the library.
(I prefer the HTML documentation)

So for example, if you want to know where to wire up the pin for glcd data bit 0,
scan down the "GLCD function" column until you see D0.
Then scan over to the board type you have.
If you have a standard Arduino board, you can see that glcd function pin D0 gets hooked up
to arduino pin 8.
Regardless of the panel, or panel type (A, B, C,....X...) glcd function pin D0 is always hooked up
to pin 8 on a standard Arduino. The columns for the different panel types were accounting for the
different pin numbers for glcd function pin D0 on the different glcd modules.

In your case, I would recommend that you hook up your display using this method.
Actually, I'd recommend this method for everyone, but some folks just want a simple table :frowning:
The reason I prefer this method is that it works for any glcd module as long as you have the
data-sheet.


Assuming your data-sheet is correct. (That pinout is very rare BTW).
Then start hooking up the pins by matching up your glcd functions to the correct
"arduino" pin. Assuming you have standard Arduino, here is are a few examples
to get you started.

Use the table that is included HTML documentation.

Pin 1 on your GLCD is cs1 (This is the same as CSEL1 in the table)
If you look in the table in the "GLCD Function" column, scan down until
you see the "CSEL1" entry. Then scan left until you get to the column
for your board type. Assuming you have a standard arduino, you will
see that CSEL1 connects to Arduino pin 14/Analog-0

So that means that GLCD pin 1 (CS1/CSEL1) connects to Arduino Pin 14/Analog-0.

Anther pin.
GLCD pin 6 is Cd - (same as D_I)
[ Cd is command/data; D_I is for Data/Instruction - but are the same]
So scanning through the table, GLCD pin 6 (Cd/D_I) would be hooked up to Arduino pin 17/Analog-3

A few more pins for example
GLCD pin 8 Enable, would go to the EN Function or Arduino pin 18/Analog-4
GLCD pin 9 Db0, would go to the D0 Function or Arduino pin 8


If you have a mega or a Teensy, then use the appropriate board type column.

Hope that helps.

--- bill

thehobojoe:
I made a function that creates a bar graph, for anyone interested. To use it, simply add this to your glcd.cpp file:

While this works well, it will be expensive in terms of code space because of the use of floating point.
It should be possible to re-arrange the calculations to use simple integer math.

--- bill