I'm trying to get NHD-C12864A1Z-FSB-FBW-HTT working with the u8glib, but I'm getting nothing the screen. It works fine with the Adafruit library. I've checked the pin mapping several times and I have connected to the Arduino correctly. I've unsuccessfully tried loading it as the following ST7565 devices: U8GLIB_DOGM128, U8GLIB_LM6059, U8GLIB_LM6063, and U8GLIB_DOGM132. Is there something I'm missing?
Below is the code used in the Adafruit and u8glib sketches. The Arduino is connected the same in both cases. The Adafruit one works, but the other does not.
Adafruit
// pin 9 - Serial data out (SID)
// pin 8 - Serial clock out (SCLK)
// pin 7 - Data/Command select (RS or A0)
// pin 6 - LCD reset (RST)
// pin 5 - LCD chip select (CS)
ST7565 glcd(9, 8, 7, 6, 5);
u8glib
U8GLIB_LM6059 u8g(8, 9, 5, 7, 6);
The Adafruit library leaves the left most column of pixels garbled. There are a few activated pixels, the rest are inactive. This makes pixel (0,0) actually located at (1,0). The rest of the screen is fine. I don't know if this is relevant information
Great. Now we need to correct the display and the Bias. I have seen that the Adafruit code and the NHD display do differ in that. I also guess that I need to implement another variant for this display. So, here is another request from me. Can you apply the U8GLIB_DOGM128 constructor?
Maybe you can also send a picture of the result with the DOGM128 constructor. Main questions are: Is the contrast as good as before? Is it better? I also expect that the wrong line will disapear but the display might be flipped (not a problem, because u8glib can rotate the screen by 180 degree) and probably the row mapping is still wrong.
If the row mapping is still wrong, i would like to use the DOGM128 as a template for further changes.
I'm making an Arduino shield for this LCD, so I'd be thrilled to see these changes make it upstream. It would be nice to point folks to u8glib. I really appreciate the work you're doing to unify the graphics libraries. I'll match the pin mapping with the u8glib default pins.
To see graphics I had to change the contrast in ug8_dev_st7576_lm6059.c, line 70 from
I have tried the U8GLIB_DOGM128 constructor. The default contrast was also poor, so I changed the contrast in u8g_dev_st7565_dogm128.c, line 59 from
0x018, /* contrast value, EA default: 0x016 */
to
0x005, /* contrast value, EA default: 0x016 */
A contrast of 0x005 in the DOGM128 constructor seems a little more washed out than the LM6059 constructor.
I've cloned your google code repo and I'm able to run ...arduino/create_release.sh. Do you want to make the changes in there and I'll test it? I can also rewire my setup to be consistent with your library.
col offset wrong by 4 pixel
--> change line 79 to "0x004"
contrast wrong
--> probably change contrast in line 68 to 0x005 (or maybe other values like 0x006 or 0x007)
--> you might also try to change the value in line 55 from 0x0a2 to 0x0a3
Once you find the best values, i would be really glad to add these values to the new device.
Also, let me know if there is something else wrong with the new NHD_C12864 device.
Changing line 79 to 0x004 worked. The pixels are aligned.
Changing line 61 (not 68) to 0x008 looked good for contrast. I played with several values. 0x009 also worked. 0x010 is where the background started getting funky.
Keep line 55 at 0x0a2. To get a reasonable screen using 0x0a3 I had to bring the contrast down to 0x003.
Some people might consider the display to be upside down, but this is the orientation in which I would like to use it. It allows buttons beneath the screen to be as close as possible. Are you cool with leaving it like this in the library? It would mean one fewer steps in my instructions.
I want to include issues 75, 79 and 81 into the next u8glib release. So i am not sure about the next release date at the moment, but everything is in the repository.
Thanks for all the testing and the pictures,
Oliver
Edit: I have also updated the reset functionality. So maybe this will also work now. Connecting the reset line to 3.3 is a little bit critical. It may work, but usually reset control by the controller or a RC circuit is better: GitHub - olikraus/dogm128: Automatically exported from code.google.com/p/dogm128
For a shield i would suggest to add the RC circuit to have one more pin for the user.
Thanks so much for your help, Oliver. I wouldn't expect my shield to be available until after December 2012, so no rush on a release.
I used the constructor as "U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8);" and connected the LCD reset pin to Arduino pin 8. Works just fine, but I will use the circuit you mention.
rdeweerd:
I'm using the library for the DFRobot ST7920 128 X 64 LCD and it works without a problem, both in serial as in parallel mode. But the weird thing is, is that the parallel mode is a bit slower. In SW serial I got a refresh rate of 6 to 7 frames per sec and in 8bit it goes down to 4 to 5.
Is this normal behavior or am I doing something wrong?
I have improved speed for the parallel mode by 30%. This fix will be available with the next regular release. Please send PM for a beta release including this fix.
I'm using u8glib for an LCD screen I pulled out of an old Dell LTO tape backup library. It turned out to be a LC7981 chipset at 240x128. I was able to modify the library files for the screen, based on some other mods I found already in the files and all is well. (U8GLIB_LC7981_240X128)
I have a question about fonts - I'd like to create my own font, both for a custom look and to save some memory by omitting characters I know I won't need. Can you post some info for how to create/add custom fonts? I've been looking at u8g_font_data.c and it looks like they're just a big bitmap with some parameters indicating the boundaries of each character, but I can't seem to get my head around the array structure.
Nice work. Glad to see that u8glib is usefull for you.
The U8glib font format not only contains the bitmat data but also a lot of glyph information for precise font rendering (mainly used for my other lib m2tklib). Some information available in the fonts are described here: Google Code Archive - Long-term storage for Google Code Project Hosting..
The U8glib font format also tries to crop the bitmap data to save as much ROM as possible. All the glyph metric calculation, the bitmap reduction and the font encoding is done by an external program: Google Code Archive - Long-term storage for Google Code Project Hosting.. Simply compile the c-file with a unix or windows c-compiler (or send me a PM if you need the executable).
Cool, thanks! I'll see if I can get anywhere with this. I have little knowledge of how fonts work, so this may be more than I have patience to do.
U8glib is a really nice library, BTW - pretty easy to use and modify. I was a little intimidated at first, but dug into the files and figured out how to create a new constructor. I have two other LCDs I've pulled out of old equipment that I'm going to try and get working. One is a little 5 x 2 character out of a Dell server (it's the little status/diag LCD). I haven't figured out what chip is on it yet. The other came from a Quantum tape library and I believe is a ST7565 128 x 64 chip-on-glass type. Both have ribbon cables so I need to get breakout boards to use them.
I tested the DFRobot st7920 witch has an spi module attatched to take care of contrast etc. and it works fine in arduino environment.
I would like to use it in pure C but the constructor requires an A0 connection,while the arduino library does not.
I have added support for the st7920 with avr to u8glib:
The test environment includes my NHD 192x32 display with ST7920 controller (upper right, the bright light from upper left makes the contrast a little bit weak). Lower left is an unused EA 132x32 display. Lower right the ATMEGA 328 with green power LED. Upper left the AVR programmer.
A beta release with support for st7920 for avr is avilable on request.