Check the Label
medium
Compares a printed label with the expected text and reports why they differ.
What it teaches
Two STRINGs are equal only when they have the same length and the same characters, and upper and lower case count as different, so 'lot-4471-b' does not match 'LOT-4471-B'. When two codes look the same and do not match, compare their lengths first: 'LOT-4471-B$r' is 11 characters, not 10, because of a hidden $r from Strip the Terminator. A difference only in case is its own reason, apart from any other difference, so 'lot-4471-c' counts as a different character. The inputs stay as they are.
Parameters
| Tag | Direction | Type | Default | Description |
|---|---|---|---|---|
| Sts_Match | Output | BOOL | 0 | The label is exactly the expected text |
| Out_Reason | Output | DINT | 0 | 0 match, 1 length differs, 2 case only, 3 other text |
| Ref_Label | InOut | STRING | — | The text read from the printed label |
| Ref_Expected | InOut | STRING | — | The text the label should have |
Required behavior
- Every scan, Sts_Match is 1 when Ref_Label is exactly Ref_Expected: the same length and the same characters, with upper and lower case counted as different.
- Out_Reason says why they differ, checked in this order: 0 when they match; 1 when their lengths differ, which is how a hidden $r or a missing character shows; 2 when they have the same length and differ only in upper and lower case; 3 for any other difference.
- Never change Ref_Label or Ref_Expected.