Siemens fc10 to compare 2 strings

In summary, the conversation discusses a problem with scanning and comparing codes from boxes using a system that involves DB98, FC10, and VAT. The person is trying to compare only 9 bytes of the code but is having trouble with the results always being equal. They are seeking suggestions on how to solve the issue.
  • #1
Stanley_Smith
16
0
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
 
Engineering news on Phys.org
  • #2
Since nobody has replied yet, I'm guessing that none of us are familiar with the system and tools that you are using. I'd still like to help, so if you can provide a pointer or explain what DB98, FC10, VAT, etc. pertain to, perhaps I can be of help.
 
  • #3
for reaching out and sharing your issue with comparing two strings using Siemens FC10.

Firstly, it is important to note that the FC10 function block is used for comparing two operands, not two strings. In order to compare two strings, you will need to use the FC11 function block.

In your case, you have created two 9-byte strings in DB98, but you are only comparing the first 9 bytes of each string. This means that the remaining bytes in the strings are not being compared and could be causing the issue with your results always being equal.

To correctly solve your problem, you will need to use the FC11 function block and compare the entire strings instead of just the first 9 bytes. Additionally, make sure that the initial values you have entered for string2 are correct and in the correct format for comparison.

It is also worth checking the data types of your operands and ensuring they are compatible for comparison. If you continue to experience issues, consulting the Siemens help file or reaching out to their customer support for further assistance may be helpful. Best of luck with your project!
 

1) What is Siemens FC10?

Siemens FC10 is a type of programmable logic controller (PLC) manufactured by Siemens. It is used to automate industrial processes and control machinery.

2) How does Siemens FC10 compare 2 strings?

Siemens FC10 has a built-in function that allows for string comparison. It compares two strings character by character and returns a boolean value indicating whether they are equal or not.

3) Can Siemens FC10 compare strings of different lengths?

Yes, Siemens FC10 can compare strings of different lengths. If the strings are not equal in length, the comparison will stop at the last character of the shorter string.

4) What is the advantage of using Siemens FC10 to compare strings?

The advantage of using Siemens FC10 to compare strings is that it is a reliable and efficient method. The comparison is done within the PLC, eliminating the need for external devices or software. It also allows for quick and accurate decision-making in industrial processes.

5) Are there any limitations to using Siemens FC10 for string comparison?

One limitation of using Siemens FC10 for string comparison is that it can only compare strings with a maximum length of 255 characters. Additionally, it can only compare ASCII characters, so special characters or symbols may not be accurately compared.

Similar threads

  • Programming and Computer Science
Replies
18
Views
2K
  • Special and General Relativity
3
Replies
75
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
4K
  • Programming and Computer Science
Replies
1
Views
7K
Replies
66
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Programming and Computer Science
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
16K
  • Programming and Computer Science
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
3K
Back
Top