Pages: [1]   Go Down
Author Topic: Change LCD Pins on Mega  (Read 1140 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello I have a arduino Mega board that I am using to control my preamp.  I just started learning arduino and programing and need bit of help.  I have a 4x20 LCD HD44780 screen and I want to change the default pin outs on the arduio to run it.  I have heaps of spare pins as Im using a mega.  It wants to run on pins 12, 11, 5, 4, 3, 2. these pins are in use for something else (rotary encoder and pga2310 volume controller)   How do I change the pin outs??

Thank you in advance for your help
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the fast reply :-D

How Do I change the pin definitions in the LCD library,  I cant find an reference to pin numbers in the LCD lib files.  I tried moving the encoder and it wont work, think its something to do with the way it uses interrupts,  I used the standard encoder code from the playground.  Sorry for all the questions but I am still new to this.  Thanks for your help ? 
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16548
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are using the LiquidCrystal library functions, you just specify the pins you want to use in the initial setup. Here is from a example partial code, (just showing setup function)  file in the library:

Quote
// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);  // here is where you tell it what pins you want to use
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

Here are the what the standard pin numbers are called and the function they perform for the display:

Quote
The circuit:
 * 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)
« Last Edit: February 20, 2011, 12:18:45 am by retrolefty » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you so much for your help.  It works great smiley
Logged

Pages: [1]   Go Up
Jump to: