×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Siemens FC10 string compare
2

Siemens FC10 string compare

Siemens FC10 string compare

(OP)
Hi,

I'm scanning a code from each box to compare and see if the box scanned is a "good" box. The whole code is about 21 bytes and I only want to compare 9 bytes since those 9 bytes differentiate between the 2 types of box. I created (2) 9-byte strings in DB98, string1[9] starts at 0.0 and string2[9] starts at 12.00.
I entered 9 "good" characters in the initial value column for string2. String 1's value will be read from the scanner. FC10 is used to compare the two strings. The problem is that the results are always equal(true) doesn't matter which boxes was scanned !!! In the VAT table, string2's first character which is 0 actually starts at db98.dbb 14, not 12. According to Siemens help file, the first byte in a string is to show maximum length of the string, the second byte shows the actual string length. HELP !!! is there any suggestion on how to correctly solve my problem? Thank you

RE: Siemens FC10 string compare

I have had to do this in the past.  2 ways.  For only a few bytes use equal to byte or integer function.  If you have a lot to compare you may want to create your own FB to do the compare for any given number of bytes for a match.

RE: Siemens FC10 string compare

2
If your string starts at 0.0 (or 12.0) then you should put manually at 1.0 (or 13.0) actual number of valid characters (in your case 9 ?). Otherwise there's zero so FC10 sees two empty strings (even if you enter something) and result of such a comparison is always "true".

Regards,

Jacek

Do it right or don't do it at all.

RE: Siemens FC10 string compare

While this topic is up i had a situation where the actual amount in the string varies.

The structure
String[4]= 1234
Start adress MB0
This will use 6 bytes

MB0 Maximum Amount of char
MB1 Actual Amount used in String
MB2 |First Char if String

Addr  MB0---1------2--------3--------4--------5

Load   4----4----16#31----16#32----16#33----16#34

Note the String values from MB2 is ASCII equivelant Values in Hex

Regards

RP   

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

RE: Siemens FC10 string compare

(OP)
Thank you all.

Jacekd, I manually entered (9), the number of valid character in my VAT table and got the compare function to work. Is modifying in the VAT table the right way/only way? What must I do to manually enter number of valid character in the strings to get the FC to work?

Thank you all in advance,   

RE: Siemens FC10 string compare

Surely no. But to solve your problem quickly, I'd advise you to write these 9's from your program into the DB directly.
Otherwise you have two ways:
- using functions from library (like I_STRNG) which are aware of how a string data type should be properly assembled
- writting your own functions - but this requires knowledge of indirect addressing in S7.

Regards,

Jacek

Do it right or don't do it at all.

RE: Siemens FC10 string compare

(OP)
I ran into another problem. The accepted code is made of the trigger byte and the "good" barcode scanned. The accepted code's used to open the safety gate. Now every time I scanned a good barcode, the logic opened the gate; but my timer wouldn't reset and the gate remained opened. I think I should make the trigger byte good for only one scan so I can reset the timer and closed the gate after one minute. Am I on the right track ?

Thanks,
Stan

RE: Siemens FC10 string compare

Looks promising.
Which timer (type) do you use ?

Regards,

Jacek

Do it right or don't do it at all.

RE: Siemens FC10 string compare

(OP)
I used On Delay Timer, what's the symbol of the one-shots in Siemens look like again? Thanks,

RE: Siemens FC10 string compare

Have a look at the S_PEXT S5 timer. You won't need the one-shot then.
If you ask of symbol of the one-shot in LAD then you have two options: -(P)- or POS. But check manual to be sure. It's been long time since I used LAD.

Regards,

Jacek

Do it right or don't do it at all.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources