04-12-2015 06:06 AM
I have the following String returned by a MODBUS instrument :
My embedded data is 0104 , 7530, 7530, 7530 which is shown inside green brackets.
I want to convert them into relevant numeric data of 260, 30000, 30000, 30000.
Have been trying to do that with a VI as attached. Not getting there right. Any help would help !!
( The attached VI is attempting to convert only the first data which is 0104)
Solved! Go to Solution.
04-12-2015 08:32 AM
Here's one solution to your question.
04-12-2015 11:22 AM
04-13-2015 10:07 AM
I tried the solution that you suggested... but the results were not as expected. Maybe I am doing something wrong. Need to study the code when I am more relaxed...
the code in LV12 is attached.
04-13-2015 10:08 AM
Hi GerdW,
Yes if it was in Hex it could have been simple. But the feed is from a TCP read.
04-13-2015 10:16 AM
Raghunathan wrote:
Yes if it was in Hex it could have been simple. But the feed is from a TCP read.
It doesn't matter where the data is coming from. All that matters is the format of the data from the read. That information is what people have been asking for.
04-13-2015 10:38 AM
The data format is string. A point I thought to emphazise by saying its from a TCP Read - which as per LV Help is a string.
04-13-2015 10:45 AM - edited 04-13-2015 10:47 AM
The string is just an array of bytes. What is the format of the data in this byte array that shows up as a string? I recommend you get a normal message from your instrument and save that string data to a file and post the file. Also tell us what you expect the output to be.
04-14-2015 10:21 AM - edited 04-14-2015 10:24 AM
Finally the solution.
Maybe from an expert programmer point of view, not very smart or compact code but nevertheless does the job. The project can atleast proceed.
( Possibly the Indexes can be taken as an array and a FOR loop can make the code small and compact )
04-14-2015 01:37 PM - edited 04-14-2015 01:39 PM
Hi Raghunathan,
yes, a VI which does the same things by copying code again and again is not very smart…
One more suggestion:
Hint: You should always get the habit of showing the string display mode, especially for your strings containing hex formatted numbers…