Hi Ash,

If you have that much going on, your best option short of a dedicated keypad controller is probably a state machine type approach with prioritized tasks.

I know it's not BASIC, but have a look at the logic in this C example of a simple multitasking state machine, and how he prioritizes individual tasks with different time slices. The technique itself applies to any compiler.

http://www.microchipc.com/Hi-Tech_C_multitask.htm

The hardware USART will buffer up to 2 characters in the background. You just have to unload this buffer before the stop bit of the 3rd byte is received.

You have the time it takes to receive several bytes of data before servicing or removing the data from the USART buffer.

If you have the option of slowing the data rate, that may help if other tasks need more time before servicing the USART.

You also have the RCIF flag that indicates there is data in the USART buffer, so an occasional test of this bit can be used to extend time in other task sub-routines & let you know there is data waiting in the buffer.

Then you have the option of interrupts. MeLabs has a couple USART routines http://www.microengineeringlabs.com/...es/samples.htm that will buffer data in the interrupt service routine.

If interrupts just are not an option, and you don't have the time to manage all tasks with a single controller, then the dedicated keypad buffer just might be the best route. Especially if your PID routine is eating up all your overhead.