Need SERIN parsing help
Enginerd
Posts: 3
I am a fairly new BSII programmer and am trying to get a simple program to interface with a LabVIEW program I have written. The LabVIEW prog outputs a string to the com port without a problem (I can·get the correct string from the·BSII Debug window).
I have two 3-digit numbers I want to put into variables in the BSII. The string being sent is "P123T456" where 123 is the data I want in variable "Pan" and 456 into "Tilt"
The command I use to parse is:
Pan VAR Word
Tilt VAR Word
SERIN 0,84,[noparse][[/noparse]WAIT("P"), DEC3 Pan, DEC3 Tilt]
My variable Tilt is always the same as Pan.
I get the same results with the following:
SERIN 0,84,[noparse][[/noparse]WAIT("P"), DEC3 Pan, WAIT("T"), DEC3 Tilt]
What could I be doing wrong? Or is this not a good way to exchange data between the BSII and computer.
Your input is greatly appreciated,
Marc
I have two 3-digit numbers I want to put into variables in the BSII. The string being sent is "P123T456" where 123 is the data I want in variable "Pan" and 456 into "Tilt"
The command I use to parse is:
Pan VAR Word
Tilt VAR Word
SERIN 0,84,[noparse][[/noparse]WAIT("P"), DEC3 Pan, DEC3 Tilt]
My variable Tilt is always the same as Pan.
I get the same results with the following:
SERIN 0,84,[noparse][[/noparse]WAIT("P"), DEC3 Pan, WAIT("T"), DEC3 Tilt]
What could I be doing wrong? Or is this not a good way to exchange data between the BSII and computer.
Your input is greatly appreciated,
Marc
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
What else could be causing my two variable to be the same. I have tried renaming them. Is there a better way to parse the data?
Thank-you for your help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 1/28/2006 2:00:31 AM GMT
It is strange to note that both methods will capture the same string correctly, but only the second parses it correctly. Perhaps since the BS2 does not have a serial buffer, it misses a character when parsing? I will have to look into it further, but for now things are working.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax