Weird problem with 128x64 graphic lcd

Hello, i have a problem with the 128x64 graphic lcd. I'm trying to connect it through mcp23017 (Gammon Forum : Electronics : Microprocessors : Connecting a graphical LCD via a I2C/SPI using a 16-bit port expander) but it's showing this (look on the photo). Even when i connect it directly to arduino its showing the same stuff. But when i connect it to my ramps 1.4 with marlin its working normally :confused: Anyone here to help me? Thanks in advance!

Photo:

Bump

Go on. No one knows what display you have. No one knows how you have wired it. No one knows what sketch you are running.

Post a link to the display that you bought.
Insert / link / attach a photo of your wiring.
Paste / attach the sketch.

5 minutes of your life.

You will probably get a good reply within hours.

David.

When I get back to home I’ll send these immediately!

Link to the display:
http://s.aliexpress.com/mEbYn6nY
Wiring:
LCD pin 7 goes to MCP23017 pin 1 (Data bit 0)
LCD pin 8 goes to MCP23017 pin 2 (Data bit 1)
LCD pin 9 goes to MCP23017 pin 3 (Data bit 2)
LCD pin 10 goes to MCP23017 pin 4 (Data bit 3)
LCD pin 11 goes to MCP23017 pin 5 (Data bit 4)
LCD pin 12 goes to MCP23017 pin 6 (Data bit 5)
LCD pin 13 goes to MCP23017 pin 7 (Data bit 6)
LCD pin 14 goes to MCP23017 pin 8 (Data bit 7)
LCD pin 6 goes to MCP23017 pin 28 (Enable)
LCD pin 5 goes to MCP23017 pin 27 (Read/Write)
LCD pin 4 goes to MCP23017 pin 26 (Data/Instruction)
LCD pin 17 goes to MCP23017 pin 25 (Reset)
LCD pin 16 goes to MCP23017 pin 24 (CS2)
LCD pin 15 goes to MCP23017 pin 23 (CS1)

Pin 1 : LCD logic ground
Pin 2 : LCD logic power (+5V )
Pin 3 : Contrast - connect to contrast pot, middle (wiper)
Pin 18 : Negative voltage (about -9V) - connect to contrast pot, one side (see below for wiring)
Pin 19 : Power supply for LED light (+5V) (see below about possible resistor)
Pin 20 : Ground for LED light

Mcp23017 is connected through I2C.
I got the sketch with library from there: Gammon Forum : Electronics : Microprocessors : Connecting a graphical LCD via a I2C/SPI using a 16-bit port expander

Thanks and sorry for my stupidnes :confused:

Well, I don't understand Italian. But

tipo: HJ12864ZW
Controller: ST7920

suggests that you have a ST7920 controller.

The Gammon library is for a KS0108 style of controller.

But quite honestly, the ST7920 can be used as an SPI display which avoids any complicated MCP23017 adapter. And there are plenty of libraries that work with ST7920.

Of course, I may have misunderstood. A ST7920 display will have a pin called PSB (to select SPI or Parallel)
The KS0108 will have multiple Chip Select pins e.g. CS1, CS2 for a 128x64 or CS1, CS2, CS3 for a 192x64 display.

David.

I fully agree to David.

The display shown in http://s.aliexpress.com/mEbYn6nY is a ST7920 based display (PSB pin is visible in the last picture). This display can be driven by three wires directly. There are also plenty libraries for this kind of display. I am very sure, that this display will work out of the box connected directly to your board with three wires with any ST7920 library.

Oliver

Edit: An example for wiring in SPI mode is given here: http://www.buydisplay.com/download/interfacing/ERM12864-6_Interfacing.pdf

Is there any way to connect it through I2C?

Well, you could connect with I2C if you really want to. Since the ST7920 can use 4-bit parallel, 8-bit parallel, SPI, you would just use the I2C Port Expander to bit bash the appropriate pins.

You can probably use a regular I2C Adapter with 4-bit parallel e.g. PCF8574.
You would probably need to write / adapt the driver for the extended Graphics Commands instead of the HD44780 style 16x4 Character display.

As Oliver explained, you only need 3 GPIO pins to run in SPI mode.

David.

Alright thanks anyways!