LCD 128x64 ST7920 using u8glib

This is exactly the model I've purchased:

http://www.ebay.com/itm/1PCS-12864-128X64-Dots-Graphic-Matrix-LCD-Module-Display-LCM-Blue-Backlight-/261034188078?ssPageName=ADME:L:OC:IT:3160

Do you mean I should connect V0, also PIN3, to the Arduino 5V but passing trought a 10K resistor (or potentiometer)? It's clear I'm a beginner :wink:

Thank's for the help, Simon

Hi Simon

Put the wiper of a variable 10K pot to V0, one end to VSS (ground) and the other end to VOUT of the display.
Adjust the variable potentiometer to get optimal result.

Oliver

Thank you, I'll try it out and let you know!

Simon

Hi again!

It doesn't work :frowning: Let me say again how I've connected it:
First I've tested the POT if it's working: I've taken a POT, connected one side on V5, the other pin on ground. Then, checking the central pin I can read / control Volts between 0 and 5.2, simply turning the shaft pot.
So this should confirm the pot is OK.
Then I've connected all as follow:

PIN 1 on LCD [VSS] to Ground
PIN 2 on LCD [VDD] to 5V (powered by ardiuno)
PIN 3 on LCD [V0] to middle pin of the POT
PIN 4 on LCD [RS] to D10 (arduino)
PIN 5 on LCD [R/W] to D11 (arduino)
PIN 6 on LCD [E] to D13 (arduino)
PIN 15 on LCD [PSB] to Ground
PIN 18 on LCD [VOUT] to PIN3 Pot

Pot:

PIN 1 to 5V (powered by arduino)
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to PIN 18 on LCD [VOUT]

I've tried to read Volts on PIN 2 of the Pot, but it's always to zero, even if I turn shaft pot.
Is there a way to check if the LCD is at least working? I.e. connecting it in a way to power it totally on ; or read some Volts on some pins of the LCD... I dunno...

Suggestions?

And what are PIN 19 [BLA] (Backlight power supply positive) and PIN 20 [BLK] (Backlight power supply negative)?

Thank's for the help!

Simon

PIN 1 to 5V (powered by arduino)
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to PIN 18 on LCD [VOUT]

should be:
PIN 1 to GND
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to PIN 18 on LCD [VOUT]

And what are PIN 19 [BLA] (Backlight power supply positive) and PIN 20 [BLK] (Backlight power supply negative)?

I assume, that this will turn on backlight.

Oliver

It sounds like you need to power the backlight. Unless you can establish that your display already includes a backlight series resistor, I suggest you connect a resistor of at least 47 ohms in series with it when connecting it to a 5V supply.

To see whether you need to connect a contrast adjustment potentiometer, look on the back of the display and see if there is already a tiny potentiometer there.

I think it's better to show you directly a picture of the LCD, maybe you can help me better.

Thank's, Simon

From the photo of the back I can see that your display does not have a contrast pot fitted (it would be at the position marked VR1 if it did). So you do need to provide one yourself.

Ok, well, then how should I connect the pot in my case? Not the way I've descrived before? I'm a little confused :slight_smile:

Thank's a lot for your help!

Simon

Ps @olikraus: I've seen your answer only now, sorry. I'll try the way you suggested too! Still confused about backlight.

Step forward :slight_smile:

Now I was able to turn backlight on simply as follow:

PIN 19 [BLA] to 5V
PIN 20 [BLK] to Ground

So the backlight turns on and I can see much, much better!

PINS CONNECTIONS:

PIN 1 on LCD [VSS] to Ground
PIN 2 on LCD [VDD] to 5V (powered by ardiuno)
PIN 3 on LCD [V0] to middle pin of the POT
PIN 4 on LCD [RS] to D10 (arduino)
PIN 5 on LCD [R/W] to D11 (arduino)
PIN 6 on LCD [E] to D13 (arduino)
PIN 15 on LCD [PSB] to Ground
PIN 18 on LCD [VOUT] to PIN3 Pot (*)
PIN 19 on LCD [BLA] to 5V
PIN 20 on LCD [BLK] to Ground

Pot:
PIN 1 to 5V (powered by arduino)
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to PIN 18 on LCD [VOUT]

(*)
tested also: In this way I can register 0-5.2V on PIN 2 of POT
Pot:
PIN 1 to 5V (powered by arduino)
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to Ground

Now I miss how to adjust the contrast. The solutions proveded doesn't work, even if it's not so important. The backlight has helped very much!

If someone has another idea :slight_smile:

TY

Simon

Try connecting the pot like this:

Pins 1, 2 to Vo
Pin 3 to Vout

assuming pin 2 is the wiper. Use a 10K pot. That's how it is shown on the data ST7920 sheet.

Don't connect 5V directly across the BLA and BLK backlight pins unless you have established that there is a series resistor on the display. To do this, use a multimeter to measure the resistance between the BLA edge connector pin and the K connection on the side of the board, and between BLA and A.

dc42:
Try connecting the pot like this:

Pins 1, 2 to Vo
Pin 3 to Vout

assuming pin 2 is the wiper. Use a 10K pot. That's how it is shown on the data ST7920 sheet.

I'm using a 10k pot, but nothing. As suggested it's:

PIN 1 to PIN 3 on LCD [V0]
PIN 2 to PIN 3 on LCD [V0]
PIN 3 to PIN 18 on LCD [VOUT]

Doesn't work.

dc42:
Don't connect 5V directly across the BLA and BLK backlight pins unless you have established that there is a series resistor on the display. To do this, use a multimeter to measure the resistance between the BLA edge connector pin and the K connection on the side of the board, and between BLA and A.

Well. I'm a beginner, using the multimeter too.. I've set the multimeter to OHM (?) 2K and I can read these values:
Between BLK and K = 0.010
Between BLA and A = 0.020

So does it means it has series resistor and I don't need anything to connect it directly to 5V?

Thank's

Simon

If it's a 3.5-digit multimeter on the 2K range, then the 0.010 and 0.020 readings mean 10 and 20 ohms. The backlight has 30 ohms series resistance already, which is fairly typical for running fro 5V, and you don't need an external series resistor.

I just checked my own display, and it also has 10 and 20 ohm series resistors.

EDIT: looking at your photo of the back of the board, you have exactly the same board that I do, except that my board has a pot at position VR1 and doesn't have the 0 ohm resistor at position R6. You can see the 10 and 20 ohm series resistors, they are R13 and R14.

I can see why the contrast adjustment doesn't work. The Vo pin is not connected on your board because jumper J1 is open (same as on mine), but unlike my board, yours does not have the 10K pot - although the pads have been tinned as though it should have been fitted. Similarly, the Vout pin is not connected - it goes to the resistor at position R12, which is not fitted.

The best suggestion I have is to source a pot of the correct size to fit at VR1, and remove the 0 ohm resistor R6 which is shorting it out. The pot on my board has a resistance of 18K end to end but is set at 2K. So a 10K pot (which is what the ST7920 datasheet shows) would be fine.

Thank you for the help, at least now I know (more or less) why the contrast is not working. The contrast is btw enough ok, also I'll think if it's the case to made these mods. Important is the backlight is working and I don't need other resistors.

Thank's a lot for the support!

Simon

Hi,
I have the same problem of contrast.
My lcd is like Simon's lcd.
There are news?

Thanks

Hi all,

I am facing an issue with ST7920 LCD. I am not able to display any data on to the LCD. The SYSCLK is 100 MHZ. I am using 8 bit parallel mode operation with the STM32F4xx Discovery board. I have followed the exact initialization given in the Datasheet. Then I am trying to write to the first location that is 0x80 and nothing is being displayed. . Here is my main and initialization function . I am attaching the LCD datasheet. It would be great if anyone can help me.

int Write_DATA(unsigned char string){

//printf("string = %c\r\n",string);

GPIOA->BSRRL=(1<<1);//RS=H
GPIOA->BSRRH=(1<<2);//RW=L
Delay(1);

GPIOA->BSRRL = (1<<3);//E=H
Delay(1);//1ms wait
GPIOD->ODR = string;
GPIOA->BSRRH = (1<<3);//E=L

Delay(1);//1ms wait

return 0;
}//End of Write_Data Function

/*

  • Breif : This function Write the Commad Instruction for the LCD
  • Param : 16 bit command opcaode
  • Retval : None
    */

int Command_WRITE(uint8_t cmd){

//Check_BUSY();
Delay(40); //1000us wait
//not checking for busy
GPIOA->BSRRH = (1<<1)|(1<<2);//RS & Rw LW

GPIOA->BSRRL = (1<<3); // make Enable = H
Delay(1); //100us wait
GPIOD->ODR = cmd;//write the data to the bus D0-D7
GPIOA->BSRRH = (1<<3);//Make Enable = L

return 0;
}//End of Command_Write Function

int Initialize_LCD(){

Delay(100); //40ms delay
///////////////////reset - B////////////////
GPIOA->BSRRH = (1<<4); //clear
Delay(100); //1ms delay
GPIOA->BSRRL = (1<<4); //PA4 (RESET ) high
//////////////////END//////////////////////

////////////////FUN SET 1 B////////////////////
Command_WRITE(0x32);//Function set one selects 8bit
Delay(1); //150us delay
//////////////////END//////////////////////////

/////////////////FUN SET 2 B//////////////////
Command_WRITE(0x32);//Function set two
Delay(1); //40us delay
//////////////////END//////////////////////////

//////////////////////////////////////////////
Command_WRITE(0x0F);//Display on/off
Delay(1); //150us delay
/////////////////////////////////////////////

//////////////////////////////////////////////
Command_WRITE(0x01);//Display clear
Delay(11); //11ms delay
//////////////////////////////////////////////

/////////////////////////////////////////////
Command_WRITE(0x06);//Entry mode set
///////////////////////////////////////////////////

return 0;
}//End of LCD Init Function

int main(void){

Gpio_INIT(); //Initialize the GPIOS connection

if (SysTick_Config(SystemCoreClock / 1000))
{
/* Capture error */
while (1);
}

Initialize_LCD(); //Initalize the LCD
Command_WRITE(0x80);
Write_DATA('H');
Write_DATA('E');
Write_DATA('L');
Write_DATA('L');
Write_DATA('O');
Write_DATA(' ');
Write_DATA('W');
Write_DATA('O');
Write_DATA('R');
Write_DATA('L');
Write_DATA('D');
// write_init();
// fill_array();
// update_screen();

return 0;

}//End of main function

Thanks
Rahul

12864_LCDController_datasheet.pdf (504 KB)

Surely, life would be easier with SPI mode.
Less pins. And it is trivial to change the SCK speed.

Of course, 8-bit parallel mode should work too. It just seems like hard work.

Oh, and I am not familiar with this library. Does it really support STM32F4 ?

David.

Edit. I see that you have put the same question in two places. This is guaranteed to p*ss people right off. Please remove one of the messages.

Dear all,
I got a problem:
if I write command as below:
Command 0x30 // RE=1, basic instruction
Command 0x08 // display off, cursor off, blink off
Command 0x34 //
I hold my program right here and the LCD will display the abnormal display, why???

if I write command as below:
Command 0x30 // RE=1, basic instruction
Command 0x08 // display off, cursor off, blink off
Command 0x30 //
The LCD is fine.