MCU_friend changing the LCD_pins in the libraries

Hi, I am using a 2.8" TFT shield V3, I've been able to get it to operate quite well with an Arduino Mega, however, I have an issue with the LCD_Digital pins being on the 2 to 9 as I need these pins for the operation of other components. I want to change the definition of the pins in the library to digital pins 21 to 28, however, I have had trouble determining where they are or how to do that without destabilizing the library.

I have no idea what a 2.8" TFT shield V3 is. Please provide a link or photo (of pcb side)

God invented Shields for the Arduino. You plug the shield into the corresponding female header sockets.

If you want to run a TFT on a Mega, buy a Mcufriend mega2560 shield. It plugs into a Mega2560.

I can see no point in routeing LCD_D# pins to 21-28

There is a USE_MEGA_8BIT_PROTOSHIELD SPECIAL which maps LCD_D0..D7 to 22..29

But quite honestly, you can access pins 22-53 with a Uno Shield in place. You can also access A8-A15 and 14-21. Surely it is easier to connect external electronics to those pins.

David.

mooseman32: I have an issue with the LCD_Digital pins being on the 2 to 9 as I need these pins for the operation of other components.

Then you seriously need to explain why you would want to do that.

Clearly, if you are using a shield, the pin allocation is already fixed.

Yeah, sorry new to the forum and all so I guess I was a bit vague. I have a link of this guy who has pictures of the same LCD screen. (not sure how to add photos to the forum)

https://forums.ghielectronics.com/t/fez-panda-iii-and-tft-2-3-display/20627

I need to use the PWM of 13 to 2 for PWM control and for use with the SoftwareSerial library (it seems my serial pins are bit fucked). David, I think using the USE_MEGA_8BIT_PROTOSHIELD SPECIAL which maps LCD_D0..D7 to 22..29 I think should work. The main thing question is "do I just uncomment the definition in the special.h file so it looks like below?"

//#define USE_SSD1289_SHIELD_DUE

define USE_MEGA_8BIT_PROTOSHIELD

//#define USE_MEGA_8BIT_SHIELD // 4.7sec Mega2560 Shield

Because the #elif that seems to map LCD_D0..D7 to 22..29 seems to have two conditions.

elif defined(AVR_ATmega2560) && defined(USE_MEGA_8BIT_PROTOSHIELD)

Yes. You have uncommented the define correctly. The SPECIAL will work on both Mega2560 and Due.
So your home-made Adapter can be plugged into either board.

David.

Ok, so I uncommented mcufriend_special lines that were suggested and included it in the graphictest_kbv example, however, the pins 2 to 9 are still set up as the LDC_digital pins. I’ve attached the files if you want to take a look, did I do something wrong or misunderstood something? I’ve got to admit I don’t understand a lot of the code.

MCUFRIEND_special.h (44.6 KB)

graphictest_kbv.ino (17.9 KB)

From the how_to file:

17. If you do not have a standard Uno Shield, you can add a SPECIAL to the mcufriend_special.h
    Edit mcufriend_shield.h:  #define USE_SPECIAL
    Edit mcufriend_special.h: e.g. #define USE_MEGA_16BIT_SHIELD
    If your "special" is write-only,  the library can not read the ID.  It always returns 0xD3D3
	
18. Please run LCD_ID_readreg.ino to verify your non-standard wiring.  Paste the defines to a Forum message.

You have omitted mcufriend_shield.h
You have edited mcufriend_special.h correctly i.e. for your Protoshield

You do not include mcufriend_special.h in any sketch. I doubt if it would find it. It might cause havoc.

Make the Protoshield. Edit the defines in LCD_ID_readreg.ino to verify your non-standard wiring. This should read registers 100% correctly. It has nothing to do with any library. It uses regular digitalWRite()

David.

Thank you very much, David, I just tested on an Arduino ADK and it works great, it's even faster than with the original pins.