GLCD Serial interface

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
dr. au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

Post by dr. au-fait »

Hex file attached. This is from the Arduino temp folder after compiling - I have not tried using it directly. It might not even be the correct file, but the time stamp was right on the nose.

With Arduino, the library must be in your documents/arduino/libraries folder, so in this case the folder containing the unzipped library would be:

documents/arduino/libraries/GLCDSP7920

The demo code itself would be in:

documents/arduino/GLCDSP7920

Restart the Arduino software, then open the sketch GLCDSP7920. It should then compile correctly. The LCDA reference is in the library which the Aduino software is not finding on your system.
Attachments

[The extension hex has been deactivated and can no longer be displayed.]


User avatar
dr. au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

Post by dr. au-fait »

Here's my actual Arduino folder in my W7 profile:

Code: Select all

Documents\Arduino\GLCDST7920\GLCDST7920.ino
Documents\Arduino\GLCDST7920\splash_bmp.h
Documents\Arduino\libraries\GLCDSP7920\LCD12864RSPI.cpp
Documents\Arduino\libraries\GLCDSP7920\LCD12864RSPI.h

User avatar
cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

Post by cherno »

Okay, the compilation now works as it should. But I still can't upload it (avrdude: stk500_getsync(): not in sync: resp=0x00).
I managed to upload the *.hex file and if it works, I've wired the display in the wrong way.
I don't know what pins may be equal, or which that can be used. :?

If it's not too much to ask, could you please take a look at these PDFs and maybe come up with something?
As I'm still pretty new this, I don't fully understand everything.

The ATMega128: link
PDF for the MPU in the *.zip

Cheers,
Cherno
Attachments
LK_Schem.zip
(329.79 KiB) Downloaded 97 times

User avatar
dr. au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

Post by dr. au-fait »

This is probably what you're after:
arduino_pinout.png
arduino_pinout.png (10.7 KiB) Viewed 1907 times

User avatar
cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

Post by cherno »

Oh, how stupid of me!
I forgot to write that the PDFs are for what I use. :oops:

I did however try and wire the display in all ways I can come up with from looking at the Duemilanove (Not just my OC1+INT0 and PB1+PD2).
I'm all out of ideas as of now.

But if it's SPI, how come it doesn't use SCK, MOSI and the others?

Cheers,
Cherno

User avatar
dr. au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

Post by dr. au-fait »

Could be that the library code bit-bangs it instead of using the built-in SPI resources. I haven't looked at it that closely. Wouldn't it be PB0/1, and not PB1/2?

User avatar
cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

Post by cherno »

I don't know. It feels like I've tried it several times already. I just can't it to work correctly.

In other news: I saw the first sign of life I have ever seen in my display! I'm not entirely sure what I did, I tried rewiring the RW and E wires and the display suddenly started "blinking" and showed some small symbols (A dot and another that I can't quite remember) and there was a blinking "cursor", like the pipeline-looking fella when you're writing, except this one was BIG(on the width, so more like FAT).
When I tried to replecate it, it didn't work, however. :(

But still, it feels like I'm a little closer to getting it to work! And all thanks to you! :D
The pins I wired RW and E to are SCK and maybe MOSI, it was in that area, it happend quite abruptly.
The SCK and MOSI are the following on my board: PB1/PCINT1 and PB2/PCINT2, if that's to any help.

Chhers,
Cherno

User avatar
dr. au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

Post by dr. au-fait »

I was able to capture the lines of interest on a logic analyzer. Looks like the Arduino pin 3 is the clock, pin 9 is the data, and pin 8 is enable. Maybe you could compare that with yours. Note the code shows a 10mS delay between commands. This seems to be important, as is the 100mS delay after the first initialize() command. Here's a screen capture of the signals produced when the code below is executed (Pin 7 is the trigger pin for the logic analyzer):

Code: Select all

digitalWrite(7, HIGH); //trigger
LCDA.CLEAR();
7920sig_clr_char.png
7920sig_clr_char.png (112.43 KiB) Viewed 1866 times
If you want to download the Salae software, the actual data file is also attached for a more interactive experience. The data file actually contains the output for this section of code from the demo program:

Code: Select all

digitalWrite(7, HIGH)//trigger;
LCDA.CLEAR();
delay(10);
LCDA.DisplayString(0,0,line1,16);
delay(10);
LCDA.DisplayString(1,0,line2,16);
delay(10);
LCDA.DisplayString(2,0,line3,16);
delay(10);
LCDA.DisplayString(3,0,line4,16);
Attachments
7920-clr_charx4.zip
(141.68 KiB) Downloaded 96 times

User avatar
dr. au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

Post by dr. au-fait »

Okay, this is weird. The data sheet seems to be way off from the observed data. Where that leaves you I don't know, but it confuses the hell out of me. Must be magic.
7920ser_mode.png
7920ser_mode.png (52.57 KiB) Viewed 1864 times

User avatar
dr. au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

Post by dr. au-fait »

After a second look, this does make sense. The controller looks at only the upper nibble of each byte on commands and data, so two bytes need to be sent for each one. The clear command is 0x01. It's a basic command as opposed to an extended one, which is 0x30. Commands are preceded by 0xf8.

To send the clear command we need send the 0xf8, followed by 0x30 (converted as two bytes, 0x30 + 0x00), followed by 0x01 (converted as 0x00+ 0x10). And that is exactly how it appears on the signal lines:
7920-cmd-hex.png
7920-cmd-hex.png (35.08 KiB) Viewed 1859 times
The data signals also follow that pattern except they are preceded by 0xfa. To send the letters "Sa" (0x53 + 0x61), we send 0xfa, then 0x50 + 0x30, and 0x60 + 0x10. This is seen here as the first letters of the first line "Sample Char Ln 1":
7920-data-hex.png
7920-data-hex.png (20.58 KiB) Viewed 1859 times
So much for it being magic..

User avatar
cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

Post by cherno »

I'm not familiar with Saleae. It looks like I might need some sort of equipment?
I've got access to an NI myDAQ, but I don't know how to get graphs like that. I've been trying to get the Digital Reader t owork with a blinking LED, but for some strange reason, it won't pick up the 1s-binks. :S
Using a multimeter I do see (quite obvious) changes. Don't know what's wrong.

After a closer inspection I think there might be something up with the digital reader-software, so I'm reinstalling it.
I used the multimeter on ground and the IO-pin I wired the MPU to myDAQ and I saw the same change as if I were checking directly on the MPU, so something's up..

By the way, I've installed the Saleae software, but I don't know if I can get it working the myDAQ. (It says disconnected)
Don't know what to do with it.

Cheers,
Cherno

User avatar
dr. au-fait
 
Posts: 73
Joined: Wed Apr 27, 2011 6:17 pm

Re: GLCD Serial interface

Post by dr. au-fait »

After installing Saleae, just dlouble-click on the .logicdata file I provided above. You don't need the equipment to just read the file. Or, open Saleae and select Option (top-right), then open session and select that file.

BTW, if you have a need for a good analyzer, I can't begin to tell you how much I like the Saleae. The software is fantastic, the developers will talk to you and answer questions, and seem genuinely interested in feedback. Very compact too. Mine is over two years old and gets regular use. No problems yet.

Adafruit has them here.
saleae_example.jpg
saleae_example.jpg (260.11 KiB) Viewed 1839 times

User avatar
cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

Post by cherno »

Sorry for not responding for a while.

I've been talking a bit with the professor (he who developed the MPU I'm using), and he said that I'll have to rewrite the code some.
So I spent a few hours yesterday and then realised I have no idea how to rewrite it all, so that it don't use the original shiftOut.
What I got stuck with was how to use something else than digitalWrite to write the data... :?

I asked him for some assistance, but I haven't gotten any response yet.

Cheers,
Cherno

User avatar
cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

Post by cherno »

Time for an update.. :)
I've put this small project on slow-mo/hold as for now. I really have no idea how to get it working properly.
The professor said that I should read the SPI-chapter in the datasheet for the ATMega128 (the MCU I've been using) and go from there.
Problem is, I barely know if it's working as it should. And then I'd need to get the SPI-code to work with the display.

So I decided that I'll buy an Arduino and use that as a form of support. And check signals etc.
And I can try and see if I can figure out a way to set individual pixels.
One way I think of it, when it comes to boxes/rectangles, you could just use a two-dimensional array and loop it.. or something.. Just putting my thoughts in text right now.
I'll take a better look at the codes later, when I get things to work. And if it is made in the way I hope it is (which I might be able to check through some experimenting), I may know how to take it a bit further.
But it may take some time before I can say if I can do it or not.
[What I'm hoping for, is that I can write the code similarily to the code I've written for a small ASCII-game.]

Anyway, that's it for now.

Cheers,
Cherno

User avatar
cherno
 
Posts: 11
Joined: Sun Sep 09, 2012 6:01 am

Re: GLCD Serial interface

Post by cherno »

So, I just got my Arduino yesterday. Finally!
Didn't have much time to do anything with it though, but today I did.
The first thing I did was to change/upload the blink program to make sure it worked.
Second thing: Test the display! :D
I don't know how to properly upload an image, so it'll be attached down there..

I also experimented a bit with the image's code and noticed quite quickly that the pixels are represented by binary digits (Hex in the code), so if I'm able to get some time to think more about how it all works I may be able to come up with a way to set individual pixels.
One way I can think of, is to change the picture. But this would be quite clumsy and most likely not very efficient. If you've got a picture and want to draw lines with a somewhat simple code, you may want to have the pixels in binary (at least to keep it easy for a slow and tired brain. i.e. me). It's way easier to see how the picture looks if it's in binary and not hex (you basically see the pixels, and some mumbo jumbo, i.e. ",0b").
[Some of you reading this, probably already knew what I just wrote.]

Anyway, it's working great, except for some faint vertical streaks (on my picture, they're not so faint irl).

Cheers,
Cherno

By the way, when you actually understand how the picture's code is made up, it's really easy to read and change it! :)
Attachments
The image of the bike. Also a smiley :)
The image of the bike. Also a smiley :)
20121205_221833_small.jpg (270.01 KiB) Viewed 1473 times

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”