Go Down

Topic: Would these pin connections be ok for LCD? (Read 494 times) previous topic - next topic

edpilutti

Hi,
The LCD (Hitachi 16x2) tutorials show this config for pin connections:
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

LCD data pin D4 to digital pin 5
LCD data pin D5 to digital pin 4
LCD data pin D6 to digital pin 3
LCD data pin D7 to digital pin 2

If another shield connected to the Uno is already needing to use digital pins 2 and 3, is it ok to do this:
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

LCD data pin D4 to digital pin 5
LCD data pin D5 to digital pin 4
LCD data pin D6 to digital pin 9
LCD data pin D7 to digital pin 8

There are two banks of digital pins, so not sure if mixing is ok.

Thanks much.

groundfungus

You can assign any digital pin to any LCD input, but you must make sure that the correct pins are matched to the LCD pins in the constructor.  I have done this in the past to make wiring from a standalone 329 to the LCD easier.

A.R.Ty

#2
Dec 08, 2013, 04:51 pm Last Edit: Dec 08, 2013, 04:53 pm by A.R.Ty Reason: 1
Hoi
You may the LCD parameters better understand with this:
The (mostly) 6 parameters define the following signals/Pins of the LCD:
RS
En
D4
D5
D6
D7
in this order !

So you can define every pin on the ARDUINO side but the LCD side is fix by the order of the parameters.

RS is mostly Pin4 and En mostly Pin6
D4-D7 mostly Pin11-Pin14.

Always best  to have a look in a datasheet  :D
Dum spiro, spero - if you find my posting helpful, please click my Karma :)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do you know A.R.T, the FREE Android Root Tool ?

edpilutti

Thanks much,
Pin remapping to different digital pins works well.  This is a big help, because at first I was scratching my head after realizing the GSM shield used up pins 2,3 and 7. 

floresta

Quote
You can assign any digital pin to any LCD input, but you must make sure that the correct pins are matched to the LCD pins in the constructor.

Just to clarify this a bit:
  All of the I/O pins on the Arduino are digital, including the so called 'analog' pins.
  Most of the signal pins on the LCD are I/O, only the RS and E are input only.

You can use any available Arduino I/O pin to connect to any of the LCD signal pins.


Code: [Select]
//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);      // put your pin numbers here


Don

MarkT

The only exception (on the 328 boards that bring them out) is pins A6 and A7 which are analog inputs only.
The Uno doesn't bring them out (because the DIP version of the 328 doesn't).  I think some of the Mini,
Pro Mini and Nano family of boards bring out A6/7

Not sure about the analog pins on the Mega
[ I won't respond to messages, use the forum please ]

floresta

Quote
The only exception (on the 328 boards that bring them out) is pins A6 and A7 which are analog inputs only.

That's not an exception since they are not I/O ports.

Quote
The Uno doesn't bring them out (because the DIP version of the 328 doesn't).

The DIP version doesn't bring them out because they don't exist.

Don

Go Up