Hello, i have a problem

sorry for my english, i dont speak, ok

i'm using 16F876 and serial comunication, I wait for a string of bytes, my command is:

SERIN2, RX,Baud,100,NEXT,[WAIT(INICAD),STR DATAS\SIZE\ENDCAD]
I=0
Y=1
IF DATAS[I]=COMMAND THEN
While I<= DATAS[Y]
.
.
.
I=I+1
WEND
ENDIF

where:
Baud=84 NEXT=NEXT LAbel INICAD=$AA SIZE=20 ENDCAD=$FF
COMMAND=$BB

if datas[y]=1,2,3,4,5,6,7,8 or 9 it works perfectly, but datas[y]=10 or more dont's function correctly, why???

i need convert Hex to decimal??? How?

Thanks.
Dave
Mexico City.