How to change LCD pins by editing LCD library files ?

Hello

I'm a newbie and I want to change the LCD pins by editing the library files . Since the SD CARD MODULE also uses some of the pins used by the LCD panel . Since SD CARD module pins can't be changed ( SPI ), I thought of changing the default pins of LCD .

**My current LCD to ATMEGA328 pin configuration is as below . **

  • LCD RS pin to digital pin 12
  • LCD Enable pin to digital pin 11
  • LCD D4 pin to digital pin 5
  • LCD D5 pin to digital pin 4
  • LCD D6 pin to digital pin 3
  • LCD D7 pin to digital pin 2
  • LCD R/W pin to ground
  • 10K resistor:
  • ends to +5V and ground
  • wiper to LCD VO pin (pin 3)

What I want is as follow,

  • LCD RS pin to digital pin 0
  • LCD Enable pin to digital pin 1
  • LCD D4 pin to digital pin 8
  • LCD D5 pin to digital pin 7
  • LCD D6 pin to digital pin 6
  • LCD D7 pin to digital pin 5
  • LCD R/W pin to ground
  • 10K resistor:
  • ends to +5V and ground
  • wiper to LCD VO pin (pin 3)

But digital pin 0 and 1 are marked as RX-0 and TX-1 ; so if it's impossible to use digital pin 0 and 1 for RS and E , even digital pin 9 and 10 is also fine .

Thanks,
Dileesha.

You don't need to change the library. The pins are set up when you create your lcd object. From the LCD tutorial at http://arduino.cc/en/Tutorial/LiquidCrystal:

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

Just change the numbers between parentheses to your corresponding pin numbers and you're set. Pick any free pins on your board; it doesn't really matter if they're next to each other or not - though it helps keep things tidy. For example, I use pins 14-19 on my board, which results in the code:

LiquidCrystal lcd(14, 15, 16, 17, 18, 19);

Thanks @jrial .

I just figured out and made it work .

Thanks ,