Converting ASCII data into Real Raw data

Vaitheeswaran

Member
Join Date
May 2019
Location
Madurai
Posts
20
Hello all,

We need to convert ASCII data into Real Raw data, here we use Trimble GPS and need to get the position data. We use SCADAPack 357 controller and Isagraf for getting the data's from the GPS. Where i get the position data in ASCII but i have to convert it into Real type data.

Suggest some ideas!!!


Thanks and Regards,
Vaitheeswaran Elango
[email protected]
 
You already have a post for this, I'm not sure what you are expecting but the samples of communication you provided do not seem to make sense. As I said in the last post you will have to create some code (probably in "C") within the Scada to locate the data and convert it from ASCII to reals. Not familiar with Scadapack however as there seems to be many communication messages you will have to find messages that contain the relevant data for example maybe a message will contain a particular code like "PD" which means following data is position. Then iterate through the message until start of latitude, extract the ASCII data i.e. 10.00 then convert it to a real number. I'm sure that the scripting language in Scadapack is capable of this.
 
Parky please go through my last mail, in that i had asked how to compare a character with the string. However i had done that part using Functional Block Diagram itself. Now I have position databytes as ASCII code and I want to convert it into a real raw data (ie): I have been trying to display my position data in SCADA or HMI, where i get my Position data from gps as ASCII in Isagraf but i need the data to be as 13.0827° N, 80.2707° E.
 
Well once you have the string i.e. s = "123.4567" then in "C" code its
#include <stdlib.h>
x = atof(s); ASCII to Float conversion
or
x = float(s);

in VB
x = float.Parse(s);
This all depends if your extracted value is hex i.e. 31 32 33 2E 34 35 36 37
or "123.4567" as a string
I do not know what type of scripting and functions are in Scadapack but there should be some functions for converting, if not then you could take each individual character and convert them in two ways i.e. if hex then convert each hex value to integer i.e. "31" then subtract 30 and multiply it a factor depending on it's place for example the 1 in 123 is x 100 2 is x 10 and so on or you could create a long integer by removing the decimal point to get 1234567 then convert it to real or float and divide it by 10000.
Hope this helps
 

Similar Topics

I am trying to take data recieved through Channel 0 on a PLC5 as an Ascii string then convert it to a decimal number in the PLC The string is...
Replies
2
Views
3,830
We are pulling time through Modbus from 3 reg. the data we are getting back to the PLC is 12593 for hours, 13105 for minutes, and 8240 for...
Replies
3
Views
1,167
Have an unusual one here, guys... I have a remote machine that is sending my 1769-L33ER five 16-bit integers that represent 10 ASCII characters...
Replies
4
Views
2,205
Is there a way to convert these integers (17476,16688,13110,12598) to Ascii character (DDA03616)? 17476 = 4444hex = DD on ascii chart 16688 =...
Replies
7
Views
6,722
Hey guys, I hope you can help me. Not sure if I am totally missing something here but is there an easy way to convert an integer into ASCII in...
Replies
4
Views
8,507
Back
Top Bottom