active Posted June 23, 2016 Report Posted June 23, 2016 Hello... We need to parse a text string to search for a single character within the string. This will then be used to trigger an SMS output. The incoming string is variable length with the last part also unknown content. The string header is known format. The terminator, (ETX) is 0xOD 0xOA, (CR LF). We can successfully scan a properly, fully, defined string however we cannot figure out how to simply look for the first character for example find "A" in the start of the string or deal with a variable string. Also once we see an "A" in the start of a string we still need to copy the entire string from the buffer to memory. Any ideas or input is welcome......
s.pratt Posted June 23, 2016 Report Posted June 23, 2016 Hello, When you receive the string, do you convert 1 character to 1 element? Is so, you can compare the first MI of teh buffer vector to the HEX or Decimal equivalent of an "A" (hex = 0x41, dec = 65). Is the compare is true, trigger a bit, and on the positive transition of that bit, store the string into a separate vector. You will have to create the second vector to be the length of the maximum amount of string space you will need. Please let me know if this helps.
active Posted July 7, 2016 Author Report Posted July 7, 2016 Thanks s.pratt We went down that path after we posted on the forum we were trying to be too clever (not normally a problem) and use protocol scan but that only seems to work when matches complete string.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now