Logix5000 String Search

aliciab

Member
Join Date
Nov 2014
Location
Portland
Posts
6
Can anyone help me with an issue I ran into? I have a conversion from a PLC5 to a L72S. The PLC5 used a String Search (ASC) with an index to search an array of strings. I dont want to stray too far from the original code, and really don't want to modify the data in the array since it is used in other locations. I am facing some issues with the converted code.

1. I need to use an index to search and compare one string tag to another array of strings. I then attempt to use the File Search Compare (FSC) instruction.

2. The individual strings within the array contain more data than the comparison string. So I need to only compare the first 6 elements of the string tags. I don't think I can use the FSC since it will not be an exact match.

3. I try to use a Find String (FIND) since I can find the location within the string, but I can't use the index to search through all the string tags in the array.


I am stuck, please help :) I would love any and all suggestions!
 
Last edited:
So let me understand this better, you want to compare a single string tag to an array of strings but only the first 6 elements of a string?

Something like:
string_tag ---> string_array[0], string_array[1], string_array[2],

so search zero, if the first 6 elements match then stop and spit out what array number you are on, meaning index=0. If in array[0], no match keep going? Did I understand correctly? Or do you want to keep searching and fill out an array of indexes, all that match? Can you post the PLC 5 code?

To do what you want to do I am visualizing having to write some structured text loops in an RSLogix subroutine, or better yet an AOI.
 
We avoid all of this by upgrading PLC-5's (and PLC-2's/PLC-3's/SLC-500's) to SoftPLC instead of Compact/ControlLogix.

The programs, including ASCII stuff, indirect addressing and other things that don't convert to Logix well, import into the SoftPLC CPU with no changes required, especially if the I/O isn't changing. Plus all the documentation converts too.

SoftPLC also has some functions called COMGENIUS that are awesome in handling strings and ASCII data, much better than using ladder to do it. Another function is a built-in database called Property Tables that works well for recipes and sorting applications.
 
Thanks for the advice.

Cody, That is good information to have. Unfortunately we already purchased the hardware. We are using the RA conversion kit. But that is good information to know for the future.

Skhara, Yes, I am searching like this:

string_tag[230] ---> string_array[0], string_array[1], string_array[2],

String_tag[230] = 'AB1234'

Search in array
string_array[0] = 'BC5642 11-06-14'
string_array[0] = 'AB1234 11-06-14'

I need to search the array and find a string match in the Array. But only look at the first 6 elements, not the trailing spaces or date. This created an issue using FSC because it is not an exact match.
 
I need to search the array and find a string match in the Array. But only look at the first 6 elements, not the trailing spaces or date. This created an issue using FSC because it is not an exact match.
It sounds like the FIND instruction would do what you want. This will do away with the FSC instruction - you'll have to build your own looping logic.
 
Skhara, Yes, I am searching like this:

string_tag[230] ---> string_array[0], string_array[1], string_array[2],

String_tag[230] = 'AB1234'

Search in array
string_array[0] = 'BC5642 11-06-14'
string_array[0] = 'AB1234 11-06-14'

Gotcha, ok. Yes, you can do that with your own structured text loops. I will go play with this idea, thanks for the challenge.
 
Here is what I came up with,
I made an AOI and I am comparing one string tag to an array of 10 looking at the first 4 elements (0-3).

There are a million different ways to skin a cat. I stop my search as soon as I find the string that matches, in my case it is [5].

Anyway a loop inside a loop is the only way I can think of how to do this.

As far as how you interpret the results, I am sure you can get as fancy as you want.

string_search.jpg
 
I got the code to work :D

The FIND instruction did work with an array. I am not entirely sure why it didn't appear to work during my initial tests, but with some tweaks I got it working.

Thank you all so much for taking the time to help me out!

-Alicia

FIND instruction with Index.jpg
 
I got the code to work :D

The FIND instruction did work with an array. I am not entirely sure why it didn't appear to work during my initial tests, but with some tweaks I got it working.

Thank you all so much for taking the time to help me out!

-Alicia
Thanks for the feedback. Too many get their answer and just bug out, never to be heard from again.
 
Welcome to the forum, iowawoodcutter!

Given that this thread was last updated 6 years ago and the person you're requesting info from averages about 1 post per year, you'll have better odds of getting a response if you post a new thread. Some folks around here choose not to respond to new questions on very old threads.
 

Similar Topics

So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
406
Hello, I have a question on an OCR application I am doing. I am reading in 16 characters that come from a camera into the plc in its input words...
Replies
4
Views
1,262
I'm currently working on an MES interface PLC which passes around a whole bunch of strings. A lot of these strings are really just to allow for an...
Replies
0
Views
1,109
HI Guys So i am trying to write a real SINt or DINT value into a string tag. If in string browser I write it manually, no problem. But how can I...
Replies
8
Views
5,881
Sorry I'm a rookie when it comes to working with strings in RSLogix5000 I have a barcode application where I'm trying to increment a barcode...
Replies
5
Views
2,614
Back
Top Bottom