04-09-2007 06:15 PM - edited 04-09-2007 06:15 PM
Message Edited by stirlsilver on 04-09-2007 06:17 PM
04-09-2007 08:49 PM
The reason it is not working the way you expect is that the scan from screen function only scans up to the next white space character. (Look up "Format Specifiers Syntax Elements" in help. I'll quote
"s—String (for example, abc). When scanning, s matches only up to the next white-space character. A space matches one or more consecutive white-space characters."
That led me to the question what is a white space character? I found in the help for White Space? function
"Returns TRUE if char represents a white space character, such as Space, Tab, Newline, Carriage Return, Form Feed, or Vertical Tab."
Well 0A is 10 for line feed or new line, 0C is 12 or form feed, 0D is 13 or carriage return.
I would recommend eliminating the scan from string function since it won't work with these special hex characters. Perhaps other functions such as string subset will work better. Or convert the string to a byte array, and index the array accordingly to get the various components.
04-09-2007 09:42 PM
04-09-2007 10:51 PM
You are doing all this way too complicated. There is absolutely no need to use "scan from string" to simply chop up a string into parts. Use string subset instead (in a loop).
You also have way too much duplicate code. You can operate on arrays directly and use array indicators for the channels. This reduces the complexity of your diagram 10 fold!!!
I don't have your serial hardware, but attached is a small code fragment (LV 8.0) that seems to do about the same thing with your string using 10% of your code. Modify as needed. Let me know if anything is not clear.
04-10-2007 04:17 AM
04-10-2007 04:27 AM - edited 04-10-2007 04:27 AM
Message Edited by stirlsilver on 04-10-2007 04:33 AM