String help and the Dat indexing problem
OBJ
Ser : "FullDuplexSerial"
Var
Byte RxDat[noparse][[/noparse]30] ' for serial data buffer
Pub Main
Ser.Start(USBRx,USBTx,OFF,19200)
REPEAT
IF (ser.rxcheck == "(")
GetCom
Pub Getcom | stringCount, Scrap, X
Scrap~
StringCount~
Repeat UNTIL (RxDat[noparse][[/noparse] StringCount ] := SER.rx ) == ")"
StringCount ++
Repeat X from 1 to 3
IF (textComp(@rxDat[noparse][[/noparse] 0 ],@RX[noparse][[/noparse] X ],7) == TRUE)
Case X
1 : Ser.str(string("One"))
2 : Ser.str(string("Two"))
3 : Ser.str(string("Three"))
Dat
RX[noparse][[/noparse] 1 ] BYTE "One A11",0
Rx[noparse][[/noparse] 2 ] BYTE "Two B22",0
Rx[noparse][[/noparse] 3 ] BYTE "Three 33",0
My problem is in the Dat section. I cant index through the library of commands. Is there a way to do this?

Comments
-Phil
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 USBRx = 31 ' Usb comm RX pin USBTx = 30 ' Usb comm TX pin BAUD = 19200 ' Baud rate Leng = 3 ' Size of the Table OBJ Ser : "FullDuplexSerial" Dat Val0 BYTE "D1 XX ?",0 'A string input from computer Val1 BYTE "D1 X1 ?",0 'A string input from computer Val2 BYTE "D1 Y2 S",0 Table Byte @Val0, @Val1, @Val2 Var Byte RxDat[noparse][[/noparse] 30 ] Pub Main Ser.Start(USBRx,USBTx,0,9600) REPEAT IF (ser.rxcheck == $5B) GetCom Pub Getcom | stringCount, Scrap ,X Scrap~ StringCount~ X := 0 Repeat Until (RxDat[noparse][[/noparse] StringCount ] := SER.rx ) == $5D StringCount ++ Repeat Leng IF (TextComp(@rxDat[noparse][[/noparse] 0 ],@@Table[noparse][[/noparse] X ],7) == TRUE) quit X++ Case X 0 : Ser.str(string("[noparse][[/noparse]D1 XX ?]")) 1 : Ser.str(string("[noparse][[/noparse]D1 X1 ?]")) 2 : Ser.str(string("[noparse][[/noparse]D1 Y2 S]")) Pub TextComp(stringA,stringB,Count) Repeat Count IF (Byte[noparse][[/noparse]stringA++] <> Byte[noparse][[/noparse]stringB++]) Return False Return TrueThis is it. Sorry i did not post the code a bit ago, but it did not seem like anyone was interested.
Post Edited (grasshopper) : 1/10/2009 8:44:57 PM GMT
-Phil