A var byte
Message var byte[23]
GetPacket:
'Find start of packet
SERIN Pin,Mode,Timeout,Label, A
if A<> $C8 then GetPacket
'Keep looking until we find $C8
'Now get the 23 data bytes
for a = 1 to 23
SERIN Pin,Mode,Timeout,Label, message[A]
next A
'At this point you have an array of 23 bytes
'Message[1] is the function to be executed
'Message[2 - 23] are the PWM values
Your code goes here
goto GetPacket
You will need to do some work to find which serial input mode supports 38,400 bps, MSB first or LSB first, number of stop bits, etc.
There are alternative commands using WAIT (myvar) that can reduce the code above but the function is essentially the same.
HTH
BrianT
Bookmarks