Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

sIEMENS s7 STRING cONVERSION

Status
Not open for further replies.

Rheinhardt

Industrial
Oct 13, 2004
64
Hi All,
I'm currently busy on a project where i must take a number of char type objects and convert them to a decimal number for comparison reasons.

i tried the standars Step 7 STRNG to INT conversion with no good values.

I understand the string concept like followoing.
Variable type STRING[5]
STRING[ABCDE]

byte 0 Max No of Char
byte 1 Actual amount in String
byte 2 A
byte 3 B
byte 4 C
byte 5 D
byte 6 E

Is there any tip or trick to getting this conversion going
I would really appreciate any help.

If there are any requests i'll post my code on this topic.

Kind Regards

Rheinhardt


--Off all the things i've lost , i miss my mind the most--
 
Replies continue below

Recommended for you

Can you just subtract 48 from the data and multiply?

For example the string you are receivinge is "1234"
So you would take byte 1 "1" (ASCII 49) - 48 = 1 x 1000
then add byte 2 "2" (ASCII 50) - 48 = 2 x 100

and so forth.

Is this an ST program?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor