Hallo to all
my question is how to input 4-digit with 4x3 matrix keypad on 4-digit 7-segment corectly

I am working on project with 4-digit 7-segment display and 4x3 matrix keypad (1,2,3,4,5,6,7,8,9,0,#,*) and 16f876. I have a trouble with writing on 7-seg display desired data.
If i have to write 1234 for example , i see on the 7-seg 4321.
Please advise me what to do.
thanks .