
Corey (Customer) asked a question.

Corey (Customer) asked a question.
Hi Corey,
Yes, this is possible. One way to do this is to set up comparisons using the compare instruction. The result will turn on a bit indicating a match.
The information can easily be moved to the comparison area using the (Copy) block move.
Regards,
Garry
https://accautomation.ca/series/click-plc/

Would you mind expounding on this solution, if you wouldn't mind? I can see in the Compare instruction where I can compare individual characters but I don't really see how to compare a range of characters against another range of characters.
As for using the Copy (Block) instruction, what are the Source and Destination fields supposed to be?
Thanks.
Hi @jeremychoate (Customer)
The following example will show what I am describing above.
I hope this helps you out.
Regards,
Garry
The Click PLC Learning Series can be found here:

Thanks Garry. I definitely see how Rung 1 works as a “brute force” solution when you know the length of both strings you’re comparing. I’m not following Rungs 2 and 3, though.
It seems that in order to compare strings with the CLICK, you must know the length of the strings you wish to compare, ahead of time, as opposed to PLCs that use the String data type, where you just compare the Strings directly.
It would seem that for longer strings, it might be elegant to use a FOR loop with the number of iterations being the length of the string and using pointer addressing for the character addresses being compared.
However, this still requires us to know the length ahead of time.
Thanks for the clarification.

You can use the search function to find the length of the string if you have a certain char to look for. Since it's a barcode scanner, if it's variable length with a termination char, the read function will provide you with the string length.


Attached is a sample project which brings together the ideas expressed above.
The ASCII Serial Port "Received Data Length" is available at SD50, SD60, SD140, SD142, SD144, SD146 depending on the serial port selected. When using the termination code option, those characters will be automatically trimmed from the Data Destination registers.
In this sample the buffer is zeroed with nulls before the string is moved, and then null is Searched to find the string length. The string compare is performed inside a For-Next in a subroutine and the result stored into C1.
Copyright © 1999-2023 AutomationDirect. ALL RIGHTS RESERVED
Hi Corey,
Yes, this is possible. One way to do this is to set up comparisons using the compare instruction. The result will turn on a bit indicating a match.
The information can easily be moved to the comparison area using the (Copy) block move.
Regards,
Garry
https://accautomation.ca/series/click-plc/