Arduino Forum

Forum 2005-2010 (read only) => Software => Development => Topic started by: mak1980 on Feb 28, 2009, 11:31 pm

Title: Library for those annoying 12864 LCD screens
Post by: mak1980 on Feb 28, 2009, 11:31 pm
Hi guys, as some of you might know, there is no official library for the 12864 LCD screens If I am not mistaken, they come with an ST7920 chipset, which is cool when you want to display characters since it comes with a very easy interface for adding ASCII, but becomes insanely complicated when adding pixels for the sake of graphical development. Not only must you switch modes (that immediately presents you with a screen of random garbage, which YOU MUST clean up by passing 0x00 to every single pixel through the 8-bit interface), but you also have to deal with a complicated memory allocation system that relies on continous updating of the X and Y coordinates. Anyway, so far I created a library that initialises the screen, and then cleans it accordingly. As a result, direct access is possible. I only started working on this today, so if anyone else wants to get involved, please do! This is the first time I post in the Arduino forums, so i have no idea where to upload the code yet. I value any feedback, and welcome ideas.
Cheers


Title: Re: Library for those annoying 12864 LCD screens
Post by: halley on Mar 02, 2009, 04:50 am
Well, now that you've made your first post, you can post images and URLs... Im sure we'd all like to see more.  If you don't have a place for hosting images on your own, go see www.photobucket.com or the like.  If you want to post a library, see the http://arduino.cc/playground for a Wiki environment in which you can share your labors.
Title: Re: Library for those annoying 12864 LCD screens
Post by: mak1980 on Mar 02, 2009, 10:43 am
Excellent =D

As soon as I have something worth showing (e.g. at least a Bresenham algorithm for lines), Ill start posting right away. Cheers for that.
Title: Re: Library for those annoying 12864 LCD screens
Post by: westfw on Mar 06, 2009, 08:50 am
Does this help?
 http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225239439/13#13
It's very general; draws line based on a function that draws a point, but at least it's fully fleshed out with all the possible quadrants and directions that it's possible to draw a line in (which is better than most Bresenham examples on the net.)  (I didn't write it; I found it!)
Title: Re: Library for those annoying 12864 LCD screens
Post by: mak1980 on Mar 06, 2009, 12:44 pm
Thanks dude. This is what I have implemented so far:

Lines (Breseham)
Circles (Mid - Circle algorithm)
Rectangles  
Filled Rectangles


I even made a simple animation of a square bouncing on the sides of the screen (pong style).
Next up is being able to draw bitmaps, and switching from gfx mode to ASCII mode.

I am away from home till Sunday, but I will upload at least the source code and some pictures as soon as I get back. Hopefully more people will get involved with the development of the library.

Thanks for the advice guys =D

M
Title: Re: Library for those annoying 12864 LCD screens
Post by: TheThiefMaster on Mar 09, 2009, 06:38 pm
I'm getting an LCD screen with the same chip, be interesting to see what I can make it do :)
It looks to me like the address it writes to auto-increments, so you can set the coordinates to the start of a line and then write the whole line, is this right?
Title: Re: Library for those annoying 12864 LCD screens
Post by: mak1980 on Mar 10, 2009, 12:06 am
Yes, that is exactly how it works.
X coordinates increment, HOWEVER, they increment 8 pixels each time you enable.
Y coordinates never increment, which is the "norm" anyway.

Here is an example:
Assuming the following order:
{RS, RW, DB0, DB1, DB2, DB3, DB4, DB5, DB6, DB7}

0010000000 // SET Y COORDINATE to 0 (128 = first line)
Enable
0010000000 // SET X COORDINATE to 0 (128 = start)
Enable

1010100101 // Draw some pixels
Enable // Coordinate has moved 8 pixels now
1011111111 // Draw a full line of pixels
Enable // Coordinate has moved 8 pixels again

0010000001 // SET Y COORDINATE to 0 (129 = second line)
Enable
0010000000 // SET X COORDINATE to 0 (start)
Enable

Since I only came back today, I hope to upload the first version of the library by tomorrow.

Only thing I haven't implemented yet, is a way to enable the second part of the screen (second chip). It seems that it has some very stupid way of enabling the second screen (unlike most graphic LCDs that simply require you to enable CS2, rather than CS1). Once you reach the end of screen 1, it automatically puts you into screen 2. Thats sooooo annoying (although it probably isn't too hard to code).




Title: Re: Library for those annoying 12864 LCD screens
Post by: mak1980 on Mar 10, 2009, 07:47 pm
OK, I'm ready to post the first version of the library. It comes with an example PONG game.
My only concern is that I have no experience working with wiki pages. Can someone help me create the page on the Arduino playground? Ill start uploading pictures in photobucket.

Thanks =D


Title: Re: Library for those annoying 12864 LCD screens
Post by: mak1980 on Mar 10, 2009, 07:54 pm
http://i557.photobucket.com/albums/ss20/mak1980/dsc00467.jpg

Pong game

=D
Title: Re: Library for those annoying 12864 LCD screens
Post by: mak1980 on Mar 13, 2009, 03:06 am
I have uploaded the code, and many examples to the Arduino Playground. Thanks for the support guys. Enjoy =D

http://www.arduino.cc/playground/Code/LCD12864
Title: Re: Library for those annoying 12864 LCD screens
Post by: fabiodive on Sep 15, 2009, 05:13 pm
Hi Marcus,
do you know if your library is compatible with ST7565 also?

I have got an LCD from POWERTIP code PE12864-004, it is driven by a ST7565,

thank you

Fabio
Title: Re: Library for those annoying 12864 LCD screens
Post by: The_Bongmaster on Dec 29, 2009, 08:03 am
I just got one of these screens for xmas from my GF :) it came with a demo board with a pre-programmed pic16f57 on.

it was from Sure electronics, the demo board displays an alternating checkerboard on the lcd.

screen is WG12864A.

i downloaded the library from the wiki, installed it, and uploaded the pong sketch to a 168 on a boarduino, but im getting nothing,, the wiring instructions on the wiki were confusing at best.
wiring pin3 up the same as i do with my 16x2 lcd's just gives me a blank screen. anyone got a schematic of wiring this type of LCD to an arduino properly?.. with less confusion :)

would be nice to play pong again XD
Title: Re: Library for those annoying 12864 LCD screens
Post by: The_Bongmaster on Dec 31, 2009, 10:47 am
i got things working on the other library (ks0108glcd)

thnx anyway XD

is there a pong game or any other sketch available for the other lib?
Title: Re: Library for those annoying 12864 LCD screens
Post by: spinnaay on Aug 02, 2010, 10:30 pm
Hi Everyone,

Big thanks to Marcus and everyone for getting this screen up and running. I have got mine working.

I have two questions regarding this screen.

Is there any development on the fonts. I want to use this screen but I want to write to it in really terms and change the font size if possible.

Can some one explain the exact screen layout. It's quite hard to get my head round the exact grid that I can use to position things on the screen.

I might be in the wrong department though if this screen can not handle fonts and such. Should I switch to a KS0108?

Thanks again.

Thom