Quote Originally Posted by Pesticida View Post
You mean i must do for example something like this:
Mystring var byte [24] ' maximal 24 bytes
String_Lenght var byte
But I must count how Long is my string from start $ to End Line feed.
For Example Ihave this $OK:CALL
String_Lenght for this example is 9 with Line feed
if Mystring[String_Lenght-2] = 76 then Character2 'L
Character2:
if Mystring[String_Lenght-3] = 76 then Character3 'L
Character3:
if Mystring[String_Lenght-4] = 65 then Character4 'A
Character4:
if Mystring[String_Lenght-5] = 67 then Character3 'C

and so on

but I think this is not the good way ,this is to complicated for several strings!
There is no String_Length function, you have to count backwards from the end to find the length of the string manually.
One easy-ish way I can think of...
You have X number of possible messages to be returned.
Add up the character values of each possible character in that message.
When a complete message is received and you have added up the individual characters, the message either may or may not match a number already in a table you have preconstructed for that purpose.
Example:
Message received is 'OK' + LF
ASCII value's are O = 79, K = 75, LF = 10, therefore the message is 79+75+10 = 164.
After you've added them all up you get 164. Go to a Select Case..... Case 164 .... blah blah blah... and there you go.
Problem is...here's another message...
Message received is 'AY' + LF
A = 65, Y = 89, LF = 10, message = 65+89+10 = 164...the code would see the same message, so you'd have to actually go 'inside' the received message to figure out which one it is...
Or you could just use a number of LOOKUP statements to figure it out.