20x4 LCD needs to be connected to 6 PINS

Hi
I bought this one, WH2004A-TMI-CT, besides power and ground, it must be connected to 6 pins, some of thenm PWM:

Do I have to precisely use those pins?

I'm planning to use the Arduino for a DCC (digital controlled model railroad) and they say pins 5 and 10 are to be dedicated for this purpose (it is related to use a "modified" PWM, so to speak).

Thanks

Do I have to precisely use those pins?

No. You can use any available I/O pin for any of the six LCD signals. All you have to do is make sure that the 'constructor' and your connections match.

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);      // put your pin numbers here

Don

So I can use a MEGA that comes with 50+ digital pins.

Thanks.

rva1945:
So I can use a MEGA that comes with 50+ digital pins.

Thanks.

Yes, that is correct I believe. It could be something like this:

LiquidCrystal lcd(24, 22, 16, 31, 12, 9)

as long as the wires match up!

Not sure why you would want a Mega2560.

An alternative is to use an I2C "backpack" to the display which means you only use two pins which are also common to any other I2C device you connect such as a RTC - or a second (third, fourth etc.) display.

Dead cheap!