08-01-2016 12:47 PM - edited 08-01-2016 12:49 PM
So I am actually receiving the numeric value 3215851520, then using a type cast to convert it to a string which results in the "¿® " or BFAE 0000 in hex.
So basically I am searching for 3215851520 in the full incoming string. However, when the robot sends it, it comes as the "¿® "..
08-01-2016 12:49 PM
In your input string it is BFAE2020 and searching for BFAE0000, hence you are not getting.
08-01-2016 12:52 PM
Space characters are hex 20.
Null characters are hex 00.
They are not the same character.
08-01-2016 12:56 PM
Udka,
Yes I see that now... Not sure why it's like that because I am sending the decimal number "44735" as a Unsigned 4 byte integer. LV converts this among the other stuff to a string, and you get the weird characters.
I am then searching for the number 44735 that gets converted using byte and word swaps. The output number from those swaps is "3215851520". (see attached) That number is taken and converted to a string and you get the "¿® " from the type cast conversion...
08-01-2016 12:59 PM
Raven,
How is it that when I receive the string as a number 44735 it is "BFAE 2020 " but when I convert in LV the 44735 number it becomes "BFAE 0000 "?
08-01-2016 01:08 PM
I don't know. Where are you converting from integers to strings in your sending code? LabVIEW isn't doing that. Your story is missing a piece of the puzzle. This started out with a question about search and replace string not working the way you thought it was.
Not the story has evolved into something about sending data, but you haven't shown any other parts of your code.
08-01-2016 01:25 PM
Ok let me try to start over to try to clear up the confusion lol..
I am receiving a bunch of stuff from a robot (ASCII, Unsigned bytes, etc.). LV receives all of this and converts it to a string using a custom built "Extract Polymorphic" VI. The format from the robot is like this: \nl * Sync MsgLength Msg ID, "Msg text". This long string is then parsed into sections to try to take out the Sync number (44735), the length of the string from the robot, and the message number (Msg ID, which in my case is 205). All 3 of these (Sync, MsgLength, and Msg ID) get sent from the robot as Unsigned 4 byte integers. When LV takes those and converts them, you get the weird characters. So basically, I am trying to see if I received the sync number, and display the text of Msg Text, the Msg ID number, and the length of the string. I originally was just asking about the Search and Replace portion because that was where my error was, I wasn't getting the proper sync number out which resulted in the offset past replacement being incorrect which affected everything else...
Whew, sorry for the essay answer. Attached is my "String Parsing" VI and my Endian converter VI, I guess I should have just showed that at first...
Thanks for the help and your patience with me!
SM
08-01-2016 01:41 PM
How is the data being sent from the robot to the PC? That part is still missing. Is it serial? TCP/IP? WIFI? wireless radio signal?
I'm wonder if the transmission protocol is doing some replacement of your 00 bytes to a space.
08-01-2016 01:42 PM
Sorry, TCP/IP and sockets
08-01-2016 01:46 PM
Hi SteMob,
I have to agree with RavensFan: your message contains spaces (ASCII 32) where you expect null bytes (ASCII 00).
Please make sure your sender and the transmission channel is working as expected. Once you receive the correct byte array you can do the parsing…