From looking at the diag output, your schematic, and your
pin table (great information BTW).
I see a few things that look off.
It looks like there might be a misunderstanding of the Mega header.
The pins on the header are numbered/labeled like this:
VCC VCC
22 23
24 25
26 27
28 29
30 31
32 33
34 35
36 37
38 39
..........
52 53
GND GND
Its hard to tell, but In the photo, it looks like you are using a 14 pin connector to plug into the
mega header and your connector is plugged in at the top
which is VCC and not pins 22 and 23.
From looking at your wiring table vs the diag output,
It looks like the RS/DI and RST/RESET wires are reversed.
and R/W and CS2 reversed.
If I look at your table it seems to indicate that you intended to wire it up like this:
22,data0 23,data4
24,data1 25,data5
26,data2 27,data6
28,data3 29,data7
30,RST/RESET 31,RS/DI
32,CS2 33,R/W
34,E 35,CS1
But the library was configured like this:
22,data0 23,data4
24,data1 25,data5
26,data2 27,data6
28,data3 29,data7
30,RS/DI 31,RST/RESET
32,R/W 33,CS2
34,E 35,CS1
Look at the diag output and you will see the pins that are configured
for each glcd function.
They don't seem to match up with the wiring table you showed.
The diag output is directly from the pins you assign in the config file file.
I think it should work once the header is aligned in the proper holes
(if it isn't already) and then when you fix the discrepancies between
RS/DI and RST/RESET
and
R/W and CS2
One other thing that I noted from the diag output.
(see the part about "Data mode"? It indicates bit i/o vs byte i/o)
While you can use any pins you want for any of the glcd functions.
if you assign the data lines all to the same AVR port such each glcd pin
is connected to the matching AVR port bit, then the library will us 8 bit accesses
to write the port.
So rather than having to do 8 individual bit set/clear operations per byte it can
set all bits at once which will increase the performance of the library.
With Arduino and its goofy pin numbering scheme of naked constants it is impossible
to know which pins to use to make this happen without going through some contortions.
If you want to see which pins to use, to make this happen,
you have to look at the pins_arduino.h file.
On Arduino 1.0 for a mega, that file is in hardware/arduino/variants/mega/pins_arduino.h
Then you will want to pick the arduino pin # to assign the glcd data bits to match up with the
AVR port bits.
So if you wanted to use AVR port A
then you would use 22 - 29 for data0 to data7
(This is what the supplied ks0108 pin file does for mega)
So for your 14 pin connector, to get 8 bit i/o to the glcd you would use
this configuration instead:
22,data0 23,data1
24,data2 25,data3
26,data4 27,data5
28,data6 29,data7
30,RS/DI 31,RST/RESET
32,R/W 33,CS2
34,E 35,CS1
The data lines will need be assigned like this in order to get 8 bit i/o.
The control pins can be in any order, I just showed them
in the same order you used in your config file.
--- bill