Pages: 1 [2] 3 4 ... 21   Go Down
Author Topic: GLCD library version 3  (Read 75241 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. smiley-razz

[edit]Added missing URL[/edit]
« Last Edit: June 11, 2011, 06:44:43 pm by bobski » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 63
Posts: 2641
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 63
Posts: 2641
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Makes perfect sense, glcd is amazingly fast.

What is the driving need?

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

Thanks,
William
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (0.94 KB - downloaded 10 times.)
« Last Edit: June 13, 2011, 10:56:26 pm by larrykluger » Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 63
Posts: 2641
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Near Rotterdam in Holland
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What happened to the "Pinout D panels" that were described on http://www.arduino.cc/playground/Code/GLCDks0108??
I have the same display as described on http://www.mcselec.com/index.php?option=com_content&task=view&id=189&Itemid=57 and was trying to hook it up to de V3 GLCD library.
Any ideas???
Logged

Best regards,

Alban

P.S. sorry for asking silly questions... I'm a mechanical engineer and not an electronics engineer smiley-wink


www.reptile-addict.nl

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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:

Code:
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:

Code:
#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);


Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 63
Posts: 2641
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What happened to the "Pinout D panels" that were described on http://www.arduino.cc/playground/Code/GLCDks0108??
I have the same display as described on http://www.mcselec.com/index.php?option=com_content&task=view&id=189&Itemid=57 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  smiley-sad
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





Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 63
Posts: 2641
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

If you know of a better way, I'd be happy to hear it. I'm fairly new to coding so there are lots of basic tricks that slip by me. I tried a few other things but none seemed to work, hence finally resorting to using floating point.
Logged

Pages: 1 [2] 3 4 ... 21   Go Up
Jump to: