I am trying to use SERIN2 and get 1 byte at a time! The data being received could be any lenght up to 32 bytes. I have tried the following but it seems to fail. Can anyone tell me if this will work? K will be to send the characters out another port.

Code:
mainloop:
    for i = 0 to 31
        serin2 GPIO.1,84,1000,mainloop,[str receive\1]
        command[i] = receive
        k = k + 1
        if (command[i] == 13) then goto process
    next i

process:
    SEROUT2 GPIO.0,84,["packet len", dec k, " ",  str command\k,13]
goto mainloop
Thanks in advance,

Scott