12-10-2010 12:32 PM
I am Receiving DATA from Serial RX Buffer from my Instrument.
My program needs parse this DATA.
My string Buffer Indicator is: \02K=2\r\n\03 Normal Display
However, what I need to to Receive in order to input to my parsing Sub is: 024B3D330D0A03 Normal Display
Please advice, Thanks.
Solved! Go to Solution.
12-10-2010 12:49 PM
12-10-2010 01:04 PM
Reviewing your post I have to ask
Metachnet wrote:
\02K=2\r\n\03 Normal Display
Are you sure this is "Normal Display" and not "\ Code Display"?
However, what I need to to Receive in order to input to my parsing Sub is: 024B3D330D0A03
Are you sure this is a string control with normal display?
You are converting it from a 7 byte (7 char) message to a 14 char string (14 bytes). I would leave it in the original string and pass the original string to your parsing Sub and pars the 7 bytes. I think you are doing some unneeded converting.
12-10-2010 01:27 PM
I just reproduced your program and it works.
You are genius.
Thank you.
12-10-2010 01:44 PM
I'm not sure about the genius part
But if I was parsing a string, would pars the original 7 byte string instead of converting to a hex "representation" of the ASCII codes of the string.
I don't think you should have to convert it if the parsing Sub VI was written correctly.
How are you parsing the string in the Sub VI? If you post the parsing Sub VI I could advise you if there is a better way.
12-13-2010 12:42 PM - last edited on 12-14-2010 11:12 AM by Laura F.
Attached is the parser with two sub messages.
The parser will be getting the string from the Rx Serial buffer.
Thanks.
12-13-2010 02:41 PM - edited 12-13-2010 02:41 PM
It seems your messages are of the format "some command ‘=’ some data"
As in
F=3
T=00
I just wanted to ask, does seeing the commands in their hex representation '46' '52' '4B' or '54' mean more to you than seeing the commands in their original stings 'F' 'R' 'K' or 'T'
‘46' or 'F'
'52' or 'R'
'4B' or 'K'
'54' or 'T'
I think leaving them in the original format and NOT converting them to the hex representation will make your code easier to read. Your case structure will have labels F R K or T instead of labels like 46 52 4B and 54.
Look at using “Match Regular Expression” to pars out the command and data from the '=' and all the control chars.
12-13-2010 04:59 PM
Make sense,
Thank you.