Hello All,
I’ve been trying to get the [SparkFun Color LCD Shield to work with the Arduino Mega2560 R3, and have thus far been unsuccessful. I know that the shield works perfectly with my UNO, and I know that it’s a PHILLIPS driver. As of now, all attempts at getting it to work with the Mega 2560 have let the LCD backlight power up, but the screen remains blank (black screen). I’ve tested all code on multiple Mega 2560 R3s, and have not seen any differences.
Library I’m using:
[ColorLCD library from github
Mods I’ve attempted:
1. Changed the line where ports are defined under the “Circle Definitions” header from
#ifdef __AVR_ATmega1280__
to
#ifdef __AVR_ATmega2560__
This didn’t fix it.
2. Reassigned the ports to the SPI signals on the Mega’s pins(D52:SCK and D51:MOSI), then jumped the Color LCD Shield’s (D13:SCK and D11:MOSI) to those, respectively, as seen in the code below. I also read somewhere that pin D53 (SS on the Mega) needs to be set to Output mode, so I add the line
pinMode(53, Output);
to the setup file of any examples. With or without it delivers the same, blank screen.
Original pin declarations:
//* Arduino Mega bit numbers
#define LCD_SCK 7 // D13//B1
#define LCD_DIO 5 // D11//B2
#define LCD_RES 5 // D8 //H5
#define LCD_CS 6 // D9 //H6
//* Arduino Mega ports
#define LCD_PORT_SCK PORTB
#define LCD_PORT_DIO PORTB
#define LCD_PORT_RES PORTH
#define LCD_PORT_CS PORTH
My modified version:
//* Arduino Mega bit numbers
#define LCD_SCK 1 // D52//B1
#define LCD_DIO 2 // D51//B2
#define LCD_RES 5 // D8 //H5
#define LCD_CS 6 // D9 //H6
//* Arduino Mega ports
#define LCD_PORT_SCK PORTB
#define LCD_PORT_DIO PORTB
#define LCD_PORT_RES PORTH
#define LCD_PORT_CS PORTH
This also didn’t work.
3. Enabling Software SPI (which goes from pins 10-13), and reverting to the old pinouts.
//* Arduino Mega bit numbers
#define MEGA_SOFT_SPI 1
#define LCD_SCK 7 // D13//B1
#define LCD_DIO 5 // D11//B2
#define LCD_RES 5 // D8 //H5
#define LCD_CS 6 // D9 //H6
Additionally unsuccessful.
Anybody have any ideas?](https://github.com/jimbloom/ColorLCDShield)](http://www.sparkfun.com/products/9363)