v3 dec 2011 GLCD on 1284p with Arduino 1.0

%99+ of all issues getting the glcd up and working is simple wiring errors.
Often it is the control and data wiring, but another common error
is the potentiometer wiring. And occasionally the wrong data sheet
is used and nearly everything is wrong which can cause the power
connections to be wrong.
(Wrong power connections or severely incorrect pot wiring can instantly
damage a glcd module)

There is no need to use anything but the diag output at this point.
(no need to hook up leds, scope, analyzer etc...)
Everything you need can be determined from the diag output.

There are two potential issues here.

  • Arduino Pin mapping.
  • glcd to AVR wiring.

You should ensure that the pin mapping is correct first.
Look at the diag output and each pin.
You will see an Arduino pin # followed by an AVR port/pin in PIN_Pb format
where P is the port and b is the bit.
Verify that each Arduino pin # is being properly mapped to the correct AVR port and bit #
for the processor you are using.

Then look at the output and make sure that your wiring matches the printout.
You are currently using port D for the control lines and B for the data lines.
Just make sure you have wired up the glcd the way diags reports.
The reported arduino pin #s are irrelevant with respect to getting the wiring correct.
All that mattes is the PIN_Pb values. So look at those and make sure
you have wired up each glcd pin function to the specified AVR port and pin
reported by diags.

So my guess at this point is that your glcd wiring does not match
the pin connections that the diag sketch is reporting or
the potentiometer is wired incorrectly creating a short,
or the incorrect datasheet was used to determine the glcd pin connections.


The way the mapping works, even if the Arduino pin mapping is wrong, glcd always
still uses what it reports in the PIN_Pb values.

So if say pin 24 should map to PORTA bit 0 but instead was incorrectly mapped to PORTA bit 7,
and glcd diags reports PIN_A7, then PORT A bit 7 is the exact port and bit being used by the library.

So in the end all that really matters is that the glcd wiring matches the PIN_Pb pins reported
by the diag sketch. The Arduino pin mapping only affects how the pin numbers you specify
in the the glcd pin configuration files get mapped to AVR ports and pins.
glcd does not use any Arduino or core code to access pins.
It simply uses a pin mapping to get some information (if pins are specified using Arduino pin #s),
Then, it runs as fast as possible away from anything Arduino and uses the Atmel information
and raw port access to do everything.

If you want 100% certainty and avoid any/all the Arduino pin number BS/non-sense, then
you can always use PIN_Pb format to specify your pins in the glcd configuration files.
When using PIN_Pb format, glcd uses none of the Arduino supplied or core provided files
for any of the pin mapping. It uses only the atmel supplied header files.

For example, instead of using Arduino pin 0 on a 1284P, you could use PIN_B0 to specify the pin
on PORT B bit 0.

--- bill