16x4 LCD working on Uno But not on Mega?? Why?

Hi Everyone,

I have a couple of Arduino Megas as well as a couple of Unos.

I`m running a sketch without problems on the Uno. But it does not want to work on Mega. If someone can give me the Answer it would be awesome... I have been struggling with this for nearly 2 days now?

here is the sketch that I`m using. ..... VERY SIMPLE....

#include <LiquidCrystalISP.h>
LiquidCrystal lcd(9);
void setup() 
{
  lcd.begin(16, 2);
}

void loop() 
{
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Hello World"); 
}

Attached is the drawing of the 74hc595 with Arduino Uno. And it Works.

Please Someone Help

74HC595 Arduino Connection.jpg

Tiny drawing but I don't see Vcc or ground connection. Also your sketch is defining only one pin but schematic shows 3 to connect to the LCD, maybe Mega isn't assigning the 2 missing pins correctly?

When you moved the LCD to your Mega, are you sure you got the wires right?

Hi,

Thanks for the reply. Yes i`m Connecting the wires exactly as on the Uno.

Do you think the mapping is incorrect?

On the Uno it Uses Pin 9, 11, and 13.

Is this 100% the same as on the Mega? Or is it different mapping?

I think the other 2 pins is defined in the library. But i cant figure out where?

Attached is a better quality picture.

Arduino 74HC595 Connection.png

if the LCD uses SPI connection, then the SPI pins on Mega are on different pins then on Uno. on Uno pins 11, 12, 13 are SPI. and it is better to use pin 10 for Slave Select (your 9). on Mega the SPI pins are 50, 51, 52. Slave Select is 53.

the SPI pins (CLK MISO and MOSI) are on the ICSP header too. it is on the same place on Uno and Mega. Mega compatible shields use that.

Hi Jaraj.

Thank you so Much!!!

Solved!