RS-232 Receive Data

Now that we have RS-232 communication what’s the best way to filter out our receive data? We currently receive:

@253ACKATM;FF

The info I need is the ATM but that can vary depending on the pressure reading. It can vary from three characters to twelve characters.

Would I use a string table for this?

Thanks!
Shawn

The characters will be a mixture of numbers and letters.

I think I have to break it into two steps right? One where I remove the ;FF and one where I place the rest in a table starting at character 8?

As long as the characters will not include “;” you can use that as a marker to grab your information. One way to do this would be to find the index of that character and then grab all the characters after the “K” up until that index, so that it works even with longer or shorter strings.
Here’s a quick example that should do what you’re looking for:

// Find the index of the ending character ';'
end = FindCharacterInString(';', 7, MyString);

// Save the substring from index 7 to ';' into "info"
GetSubstring(MyString, 7, end-7, info);

Also, this is assuming your “@253ACK” will not change – is that the case? If that is going to get shorter or longer at any point then you’ll need to add an extra step.