ethernet shield and 2.8 " tft lcd shield
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ethernet shield and 2.8 " tft lcd shield

by james95 on Mon Jun 10, 2013 4:16 pm

Recently i bought the the 2.8 " tft lcd shield touchscreen with microSD card.
The testprogram with bmps woof, miniwoof and tiger ran correctly.

But i want to use the shield simultaneously with the arduino ethernet shield.
I also want to use the sd card from the ethernet shield.

I read in the forum that pin D4 is used by both shields, so it must be changed
-for example- to D1.

Therefore i changed the 4 macros of the pin_magic.h in the uno section:

// These are macros for I/O operations...
//scanf - only to test that the compiler looks here...

// Write 8-bit value to LCD data lines
//#define write8inline(d) { \
// PORTD = (PORTD & B00101111) | ((d) & B11010000); \
// PORTB = (PORTB & B11010000) | ((d) & B00101111); \
// WR_STROBE; } // STROBEs are defined later

#define write8inline(d) { \
PORTD = (PORTD & B00111101) | ((d) & B11000010); \
PORTB = (PORTB & B11000010) | ((d) & B00111101); \
WR_STROBE; } // STROBEs are defined later

// Read 8-bit value from LCD data lines
//#define read8inline() (RD_STROBE, (PIND & B11010000) | (PINB & B00101111))
#define read8inline() (RD_STROBE, (PIND & B11000010) | (PINB & B00111101))


// drawing method. The default state has them initialized for writes.
//#define setWriteDirInline() { DDRD |= B11010000; DDRB |= B00101111; }
#define setWriteDirInline() { DDRD |= B11000010; DDRB |= B00111101; }

//#define setReadDirInline() { DDRD &= ~B11010000; DDRB &= ~B00101111; }
#define setReadDirInline() { DDRD &= ~B11000010; DDRB &= ~B00111101; }

#else // Uno w/Breakout board

Unfortunately there's an error message, when starting tft_bmpshield / serial monitor:
ÿUnknown LCD driver chip: 832A
If using the Adafruit 2.8" TFT Arduino shield, the line:
should appear in the library header (Adafruit_TFT.h).
If using the breakout board, it should NOT be #defined!
Also if using the breakout, double-check that all wiring
matches the tutorial.

Thanks for any help!
Posts: 2
Joined: Mon Jun 10, 2013 3:33 pm

Re: ethernet shield and 2.8 " tft lcd shield

by adafruit_support_rick on Sat Jun 22, 2013 8:23 am

Did you also rewire the shield? You don't mention that. You must clip the pin or cut the trace to the pin you are re-mapping, and solder in a jumper from the new pin.

I see what you did with pin_magic. Unfortunately, I don't think it's that simple. You have exchanged PD4 for PD1, but you have not accounted for the change in bit position in the data byte. Instead of assigning LCD data bit 4 to PD1, you have assigned LCD data bit 4 to PB4, and LCD data bit 1 to PD1.

Rather than moving bit 4 to the PORTB expression, you will have to add another step which separately masks PD1 and shifts it to the data bit 4 position on a read, and vice-versa on a write.

Posts: 34754
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Please be positive and constructive with your questions and comments.