Multitask?

Ok, so I am creating a Digital Command Control System for my model Trains. This involves me getting input from a keypad (4 X 4), and potentiometors. Also i will be displaying information on a Liquid Crystal Screen. So you know that basis of how the DCC system works, it sends 0's and 1's to the train by varying the voltage. But in short, a zero means that a digital pin will be on for 100 microseconds and then off for 100 microseconds. a one, is on for 58 microseconds and off for 58 microseconds. I have programmed how the sending of that information and how it will be done. Now i need to get the keypad interfaced and the LCD.

How i want the keypad to work:
The data sheet for the keypad is here: https://www.jameco.com/Jameco/Products/ProdDS/169245.pdf
Keys A, B, C, D correspond to trains A, B, C, D. In DCC there is Addressing, and Functions. They keypad will be the Addressing input and be the function interface because the functions are on a on/off basis.
So, when you first need to interface with a train, you must push A, B, C, or D. Then, if you want to change it's address you must push # and its ID number. if you want to use a function you must push "star" and the function number.

How the LCD will work:
The LCD is the readout of all the trains. It must display its address, Speed, and what functions are on. When you push A, B, C, or D on the keypad, the LCD must display that Train right then. The display will not change unless there is no activity in the keypad for 10 seconds. However, during those 10 seconds, the speed and functions must continue to change as the user changes them.
The LCD is also the readout to the user. When you go to change the address, it must ask what you want to change it to, and as you enter in the new address, it must display what you have typed. (there must be a backspace & Enter) and it must ask you what function you want to change and what its statuses are.

Final Notes:
The largest address is 255
I will include a copy of the current program

DCC_Unit_1.ino (10.4 KB)