GLCD in serial mode

Hello everybody.
at first i am sorry for my bad english writing.
i am using an arduino uno with GLCD that buy from this link:

now i have 2 questions ,
1_ I am using GLCD in serial mode by i2c protocol. but the GLCD has a very very low speed, how i can increase the speed?

2_ how i can using this GLCD in parallel mode? and please send a link about library.

thanks

You have a ST7920 display 12864B Parallel/Serial Graphic LCD Module

It can operate in SPI or Parallel. It does not operate in I2C mode.

Quite honestly, it works very well in SPI mode. Olokraus's u8g2 and u8glib libraries support the ST7920.
You can install from the IDE Library Manager.

Hobby Components provide an excellent service. Here is an example sketch from their support forum

Note that u8glib is being replaced by u8g2 library. I suggest that you install libraries via the Library Manager (when possible).

David.

hello david
thanks for response
i use the lcd according to link that you said , but it is so slowly,
for example when i want to draw a box , it take about 5 second !!!
what is wrong??

First off. Run every example from the u8g2 library. Select the appropriate constructor. It is nothing more than removing two Slash characters.

Study those examples that do the operations that you want to use.

If you have a problem, paste your code here.. Or attach a ZIP if it is too big.

Speed generally comes down to your program logic. I draw a pencil flowchart. Then hand-trace the logic flow. Read sensors at a sensible rate. Only update display when something has changed.

David.

thanks , i will test example and reply result.

Vahid

Hello David .
Thanks For your replies and guidance.
I study and test over and over again , and finally i can show my string and etc on the LCD.

but now i have another problems.

1- My sketch isn’t too big but when i want to upload it to my UNO board , i see this error:

Arduino: 1.8.1 (Windows 10), Board: “Arduino/Genuino Uno”

Sketch uses 32368 bytes (100%) of program storage space. Maximum is 32256 bytes.
Global variables use 458 bytes (22%) of dynamic memory, leaving 1590 bytes for local variables. Maximum is 2048 bytes.
Sketch too big

i only draw 4 frame and print some text on lcd for viewing a welcome screen and main screen.
how i can reduce sketch size??

2- When i plug the lcd to 5V DC power , i see this picture 1, and when i connect it to arduino to receive data i see picture 2. what is that 2 dark lines ???

code.txt (1.54 KB)

I built your program. I used a SW constructor to match my wiring. Sure enough, the size was too BIG. I changed one of the fonts to reduce memory.

The reason for the size is because you have used several fonts. The larger fonts take up a lot of Flash memory.

You can replace your Company logo with a bitmap.
You can use a "number" font when you want to display values.

Ug8lib has been replaced by U8g2lib. The methods are slightly different. It would be wise to use u8g2.

Regarding your horizontal lines. My display works fine. My Uno clone is powered by the USB cable.

I found that the Font Position was wrong. This is what I changed:

void draw_main_screen (void)   
{
//  u8g.setFontPosTop();  
  u8g.setFont(u8g_font_helvR08);  
  u8g.setFontPosTop();   //.kbv  
  u8g.drawStr(2, 3, "  Javad Alaemeh Hospital"); //.kbv
  ...

David.

As pointed out by David, there are too many different fonts. U8g and U8g2 includes a complete documentation of the fonts which includes the size of the font.

U8g2 has two more improvements over U8glib: Fonts are available in different sizes (different number of chars, like ranges from 32 to 127 or 32 to 255, etc). Furthermore U8g2 fonts are compressed to save another 20% to 50% of flash memory.

Oliver

Hello oliver .
you are great man , You have made a great service to humanity,
i read your post at HitHub , thanks for u8g2lib & u8glib.

I want to remove some unused symbol from fonts that import to my sketch , how i can do it??

another question , I have a float value , i want to show it on the lcd e.g. 3.5 but i see 3.50 , how i can show that value with one digit after dot?

It is regular Print.h behaviour. device.print(float_value) defaults to 2 decimal places.
If you want 1 decimal, use print(float_value, 1)

Note that many Arduino classes inherit Print class. e.g. Serial.print()

So you can always experiment with Serial before using the same style for your lcd or tft.

David.

zed71220:
I want to remove some unused symbol from fonts that import to my sketch , how i can do it??

For u8g2, I put some answers here:

Which font do you want to use?

Oliver

Hello every body.
After several effort , I couldn't reduce size of my sketch , then i decide to use arduino MEGA2560 for big Flash memory , also for speed up showing data on LCD , i switch LCD to parallel mode,

according to gallery · olikraus/u8g2 Wiki · GitHub i set PSB pin to 5V and RW pin to GND and in sketch i write this code ,U8G2_ST7920_128X64_1_8080 u8g2(U8G2_R0, 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 48, U8X8_PIN_NONE , 52);
but lcd show wrong character or don't show any thing , however arduino and other part work well (RTC SD card EEPROM).
May be definition is wrong??

In general the ST7920 is very sensitive to unstable wires. Did you solder everything? Also use short wires only.

Oliver

Hello oliver, yes i use short wire , even i use clock example on the library and LCD work very very well , but another example or my sketch not working, i am confused , and don't know what i do it.

thanks for your response .

Vahid

zed71220:
Hello oliver, yes i use short wire , even i use clock example on the library and LCD work very very well , but another example or my sketch not working, i am confused , and don't know what i do it.

thanks for your response .

Vahid

You mean, there are examples which work very good and other examples do not work?

This is strange...

Oliver

Hello Oliver , Hello David
I come back again.
I purchase a new LCD for my new project , But i don’t know how i configure it with u8g2 library.
This a link that i purchase my LCD : http://www.912688.com/supply/24781645.html#product_detail

and i attach a PDF that is a datasheet for LCD.

Thanks in advance for your guidance.

Vahid.

2008120309142469.pdf (129 KB)