thanks Skimask for the reply here is my code again:

INCLUDE "bs2defs.bas"
keydata VAR b3 'relay number storage variable
serpin VAR porta.4 'serial input pin
trisa = %00010000
trisb = %00000000

loop:
gosub loop1 ' I am going to loop one to receive data on the serial pin then I am going to "keyed" to instruct the pic which relay to turn on.

goto keyed


loop1:
SERIN serpin,N2400,[254],keydata
IF keydata => 1 AND keydata <= 12 THEN GOTO keyed 'goto keyed if key is 'pressed
return