Go Down

Topic: How to use serial GLCD with ST7920 IC (Read 1 time) previous topic - next topic

Colonel Panic

A graphic LCD from eBay arrived at my door today, and now I'm trying to interface with it. According to the datasheet for the IC, it can do serial, which is why I bought it, so I don't need all my ports taken up.

What connections need to be made between display and Arduino and are serial commands usually common between boards?
Mechanical Engineer - Mechatronics is where it's at
iPhone developer
http://www.wesg.ca

digimike

It kind of depends weather the controller IC is compatible with one of the preexisting setups and libraries that have been developed.
http://www.arduino.cc/playground/Code/LCD

You'll probably have to play around with the LCD for a bit to make sure you have it connected right. Thats the easy part. You may have to come up with your own code to take full advantage of the realty the screen offers. From what i can tell from the spec sheet this screen isn't your simple 2 or 4 line LCD. There is a project that was recently post in the exhibition section that uses a larger LCD. This may be just what your looking for.

Ran Talbott

Quote
According to the datasheet for the IC, it can do serial, which is why I bought it


I took a look at the datasheet for the chip,  and that "serial" interface looks a lot like a string of daisy-chained shift registers (on the "write" side,  at least:  I didn't delve into how it reads data back,  because that wasn't immediately obvious from the docs).

So,  to send commands to it,  you'd use shiftOut(),  roughly like this:

Code: [Select]
#define ST7290_REGSEL 0x04
#define ST7290_READ   0x02

// Set these to match the pins you're using for clock and data
#define ST7290_CLOCK_PIN      8
#define ST7290_DATA_PIN            9

/*
* send a command to the ST7290.
* reg is false if reading/writing a command register,  true if reading/writing data.
* do_read is true for reading,  false for writing.

void st7290_write(boolean reg, boolean do_read, byte data)
{
     byte cmd = 0xf8;            // Sync bits:  see page 26 of datasheet

     if (reg)
           cmd |= ST7290_REGSEL;

     if (do_read)
           cmd |= ST7290_READ;

     shiftOut(ST7290_DATA_PIN, ST7290_CLOCK_PIN, MSBFIRST, cmd);
           // Send high nybble,  followed by 4 zero bits
     shiftOut(ST7290_DATA_PIN, ST7290_CLOCK_PIN, MSBFIRST, data & 0xf0);
           // Send low nybble,  followed by 4 zero bits
     shiftOut(ST7290_DATA_PIN, ST7290_CLOCK_PIN, MSBFIRST, data << 4);
}


You'll probably want to tweak the code a little to improve performance.





Go Up