I have been trying to familiarise myself with using a GLCD with ks0108 controller and with Bill’s help back here I got it all working ok. I am now at the stage where I would like to try and use Oliver’s M2tklib. I had a look at the tutorials at Google Code Archive - Long-term storage for Google Code Project Hosting. but I am at a bit of a loss as to what code to actually use to even get the basic hello world example working. I have the glcd.h and M2tk.h files, in their respective libraries, in my Arduino libraries folder and I downloaded the m2ghglcd.h file and saved it in notepad as type all files, but I am unsure as to where to put this file. I know my wiring is correct as I can successfully run the hello world code in the M2tklib library with this constructor –
U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
Can someone please tell me what I am missing here, and please no funny replies XD
Thanks Pedro
Hi Pedro
Let me clarify things a little bit:
There are two different graphics libraries for the KS0108 based displays: "GLCDv3" and "U8glib"
Both do support KS0108 128x64 displays. Both have there pros and cons. And both are supported by m2tklib, however, you can not install m2tklib for both types of libraries.
That means, you have to decide: Use GLCDv3 or U8glib.
After this decision you can download and install the correct variant of m2tklib:
m2tklib_arduino_glcd_1.10.zip for GLCDv3 or
m2tklib_arduino_u8g_1.10.zip for u8glib.
From your previous post you where mentioning "GLCD" (which looks like Bill's GLCDv3 lib), but in your example you have used U8GLIB_KS0108_128 (which is obviously the U8glib library).
So it might have happend, that you wanted to use Bills GLCDv3 library, but accidently downloaded m2tklib_arduino_u8g_1.10.zip, which will unfortunately not work.
Additionally you do not need to download any additional files. Everything is included and placed in the correct folder if you download the correct variant of m2tklib.
From now on, i assume, that you want to use GLCDv3. I also assume, that GLCDv3 is already correctly installed.
To solve your problem please do the following
- Locate the m2tklib folder and remove it completly (with all the subdirectories)
- Download m2tklib_arduino_glcd_1.10.zip and unzip this file in the libraries folder of your Arduino tree
- Start Arduino IDE and execute the hello world example, which should now work
Just some small words on the pros and cons of GLCD and u8glib (Bill, please correct me if i am wrong). GLCD is a lightning fast library. It has almost no additional memory consumtion and is excellent supported by Bill. My own library u8glib has some different rendering approach, is slower, uses more RAM, but also supports SPI based display controllers. Concerning m2tklib, u8glib has two more advantages: (A) Because of the different rendering approach, there will be no flickering of the screen and (B) the fonts are more precisly rendered with u8glib. In fact i designed u8glib after i wrote m2tklib, because i needed more accurate font rendering procedures to make the text appear more perfectly rendered within the text fields of m2tklib. Still GLCD is fully supported with m2tklib.
Hope this helps,
Oliver
Thanks for that Oliver.
I somehow got confused and ended up with the wrong version of M2tklib. Now that I have got the correct one installed I will play around with your menus and see how I go. Thank you for all your work on this library,. Both you and Bill spend a lot of time supporting the Arduino community and helping the members. We all appreciate your efforts,
Pedro.
olikraus:
(A) Because of the different rendering approach, there will be no flickering of the screen and (B) the fonts are more precisly rendered with u8glib. In fact i designed u8glib after i wrote m2tklib, because i needed more accurate font rendering procedures to make the text appear more perfectly rendered within the text fields of m2tklib.
Oliver, can you explain a bit more on rendering "perfectness".
Is it really that u8glib supports a different font format and rendering style which allow it to potentially render some better
looking glyphs than the "thiel" format that glcd uses
rather than the glcd rendering not being accurate?
ug8lib does include many more and better fonts and can do really nice rendering orientations/rotations
but I'm not understanding about the rendering accuracy comparison of the included fonts.
Unless I'm missing some edge cases that are not working correctly, glcd should render the glyphs correctly anywhere you want.
Any sized character glyph "as defined by the font data" should be perfectly rendered
on any pixel boundary and the text areas allow positioning the text columns/rows on any pixel boundary.
I'm curious to understand any rendering issues you may have seen.
I'd also like to work with you to try to collapse down m2tklib so it doesn't have
to be customized or separate libraries to work with alternate graphic libraries.
It shouldn't be that difficult to do with some C++ class inheritance and virtual functions.
Users then include the proper class constructor in their sketch to get the interface they want/need.
(This is how things are handled in fm's liquidcrystal library to handle different interfaces: 4bit, shift register, i2c, etc...).
I'll get in touch with you off line.
--- bill
Hi
I was not accurate enough on the font rendering topic. In fact i meant "accurate glyph positioning" instead of "font rendering". Font rendering will be perfect in both libraries.
Is far as i remember the problem was, that the font structures of GLCD did not provide all information on the ascend and decent height of the individual characters. Also it was difficult to derive width and x-offset of the glyphs. This is important for large none-monospaced fonts. But all in all it was not a big problem for GLCD: I was able to derive these numbers manually and also the fonts known to me in GLCDv3 are monospaced fonts (as far as i remember).
It shouldn't be that difficult to do with some C++ class inheritance and virtual functions.
M2tklib (and also u8glib) had been designed as pure C libraries. In both cases the C++ interface are simple wrappers around the C API. With GLCD and M2tklib, it is like this:
M2tk C++ API calls the M2tk C API
M2tk C API calls the M2tk GLCD graphics handler (calling convention in C)
M2tk GLCD graphics handler translates the calls back to C++ to call the GLCDv3 API
GLCDv3 does the graphics output on the target device.
On the other hand: GLCD + M2tklib examples are very simple. I make use of the existing GLCD object, so the user does not need to do anything except creating the M2tklib constructor.
Oliver