Pin reassignment for MCUFriend

Hello ,

Im using MCUFriend library for 0x9486 library for TFT LCD .

Due to certain constraints , I need to change the A0,A1,A2,A3,A4 pins .

I tried a lot to change in MCU _special.h but couldnt .

PS : Im using ARduino mega 2650 .

God invented shields. You plug them into your Arduino and everything works.

If you really want to change from A0-A4 (PF0-PF4 on Mega2560) to A8-A12 (PC0-PC4) it is nothing more than specifying PORTC instead of PORTF.

But seriously. The shield fits the Arduino headers. You can access A8-A15 with a length of male angle header to suit any external electronics. It must be easier than rewirig a shield.

David.

Hello David ,

As going to shift on Mini Pro Mega amd PCB are made , as TFT LCD was the option added now so need those pins .

I changed this in special.h

#elif defined(AVR_ATmega2560) && defined(USE_BLD_BST_MEGA2560) //regular UNO shield on MEGA2560 using BLD/BST
#warning regular UNO shield on MEGA2560 using BLD/BST
#define RD_PORT PORTF
#define RD_PIN 0
#define WR_PORT PORTF
#define WR_PIN 1
#define CD_PORT PORTF
#define CD_PIN 2
#define CS_PORT PORTF
#define CS_PIN 3
#define RESET_PORT PORTF
#define RESET_PIN 4

to

#elif defined(AVR_ATmega2560) && defined(USE_BLD_BST_MEGA2560) //regular UNO shield on MEGA2560 using BLD/BST
#warning regular UNO shield on MEGA2560 using BLD/BST
#define RD_PORT PORTC
#define RD_PIN 0
#define WR_PORT PORTC
#define WR_PIN 1
#define CD_PORT PORTC
#define CD_PIN 2
#define CS_PORT PORTC
#define CS_PIN 3
#define RESET_PORT PORTC
#define RESET_PIN 4

Still not working ?

Is something missing .

Attached files .
Please check.

Thankyou in advance

mcufriend_shield.h (11 KB)

mcufriend_special.h (31.1 KB)

You have not enabled USE_BLD_BST_MEGA2560
So it will never use your amended SPECIAL

Most SPECIALs will issue a warning that you will see as orange text in your Build report. e.g.

#warning regular UNO shield on MEGA2560 using BLD/BST

You are very brave to create your own pcb for an ATmega2560. It is a BIG chip with lots of pins.
Of course you can route custom Arduino headers to your special wiring. The obvious route would be data bus on PORTA.

David.

Hello David ,

Did but still not working .

Any additional changes are missing ?

Also , one observation that after changing the file , once I could the orange warning .
After that I couldnt .

Again I made changes , I could observe .
Only once I see the orange warning after CHANGE.

Are any changes missing ?

PS : Driver is 9486 , if anything in related to that has to be done .

Thankyou in advance .

( Will be shifting to Pro Mini and pins are made in PCB so cant change unfortunately , Not brave :stuck_out_tongue: But designs is making me do so )

You must have the #defines correct. You have the orange warning message.

I suggest that you always start with proper shields and proper Arduino. The wiring is known. The world knows that your wiring will be correct when you plug the shield into the Arduino.

You then transfer to the Mini Pro Mega to verify the "official" shield wiring works. (this shows that your flying jumper wires are correct)

Then you do the same tests with your SPECIAL wiring.

Yes, the Arduino IDE only builds the library if it needs to. e.g. after you edit the special.h

You can force a new library compile by making a trivial edit e.g. add space, delete space, save file.

David.

Hello David ,

As to check the wiring .

When I use orignal shield wiring I get the results . And I really thankyou for that library David .

But when I Change the A0-A4 pins to A8-A12 and changing it in file special.h .
My screen is not working .
Is this something missing ?
I see the orange warning as you say .

PS : Im not changing my data pins D0-D7

I don't believe you. If you used USE_BLD_BST_MEGA2560 with the regular PF0-PF4, it shows you wired correctly.

You can see how simple it is to change one control at a time. e.g. move LCD_RD wire from PF0 to PC0 and change the RD_PORT to PORTC.

Test. And do the same for the other control pins.

Seriously. Why not use PF0-PF4 as Nature intended? (unless you want to use JTAG)

David.