There should be a set of defines of the port pins to LCD data pins , the hardware connection should be the same as defined in the code or the bytes send will be wrong.
There is no problem to connect any pin order to the data lines (even from different ports) as long as you have taken care of the pin assignment so that bits are send to the correct data lines.
You can 't just invert the data lines without making the appropriate changes in your code, it will not work.
So instead of writing: LcdSendCharacter('A');
you will write: LcdSendCharacter(reverse('A'));
Now if you are sending data in string format, like: PrintLCD("Hello world!");
then you should again have no problem, because PrintLCD() would call LcdSendCharacter() for each sending character of the "Hello world" string. Another way is to reverse the port bits directly using the reverse() function before sending them (inside LcdSendCharacter() routine), and now that I think of it this is better because you don't have to change anything in the rest of the code.
PS: LcdSendCharacter() and PrintLCD() are random names, I guess that you are already using those routines with names of your own.
And what about the LCD commands, how will they be inverted?
Alex
---------- Post added at 02:00 ---------- Previous post was at 01:56 ----------
And by the way, if you need an reverse byte function try the following
Code C - [expand]
1
2
3
4
5
6
7
/* reverse an 8 bit value, 11000000 ->00000011 */unsignedchar reverse_byte (unsignedchar input_byte){constunsignedchar lookup[16]={0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};// depending on the compiler use the proper keyword to make this a flash (ROM) variablereturn(lookup[input_byte &15]<<4)|(lookup[input_byte>>4]);}
Another way is to reverse the port bits directly using the reverse() function before sending them (inside LcdSendCharacter() routine), and now that I think of it this is better because you don't have to change anything in the rest of the code.