Creating Logic to read Text Strings

sorry prlim2000. i had no intention to do any hijacking. and thanks Ron, im still newish to this (ive been doing it about 18 months) so some stuff just hasnt passed through me yet. especially the ascii commands. sorry for the confusion and thanks for the in depth reply :)
 
prlim2000 said:
One more thing, before BMW hijacks my thread.

How do you reset the Tag String to clear out all text strings back to zero in the SINT data array (xxxxxx.DATA)?

Would I just write a zero in the first Word (xxxxxx.LEN) of the Tag String?

Yes. If you change the LEN to zero, it will effectively clear the string. Or, you could create a constant null string and copy it into your destination strings.
 
I tried that yesterday by manually writing a text string into the .data and zero-ed out the .len but nothing happen to the .data. Thats ok though, coz I realize that the .data gets written over when a new text string comes in and since I'm looking for a certain delimiter to end the string I'm looking for, I wouldnt care about the excess characters beyond that point....thanks anyway.


bmw_apprentice said:
sorry prlim2000. i had no intention to do any hijacking.

I dont really care BMW, I was just kidding...anway the more questions and more ideas, the smarter we get.
 
I got my example down to six rungs. The approach was to examine each bytes of the ProductDataString.Data[x] array to see if it was a semicolon, then use the MID instruction to extract the string data between the semicolon and the previous semicolon (or the beginning of the array).

A couple of tricky bits:

The String.Data[x] array begins at 0, but that's considered "Position 1" when you are using the MID instruction. No problem, we calculated an offset.

It's easy to totally clear a String element or array of String elements; the File Fill instruction really doesn't care what sort of data it is filling so it will happily write over all subelements (LEN, DATA[x]) in the target array.

The example is written in v15 for SoftLogix; you will of course have to import the Program and routine into your RSLogix 5000 project.
 
Simpel way

I have a simple way to do this:

jera-string.jpg


There is missing one FLL in the top for clear of the first dataset, but I think you can se the point.
The rung is set by a oneshot, so it is only active i one scan, and not started if DATA_KLAR is set.
The delimiter here is / and made as a tag, but you can change it if you want.

The flag DATA_KLAR is data ready flag for use of data in the program.

This program is running in a plant and exchanges 2 strings every second.
 
Last edited:
I took a pass at doing a ST with a While loop built in for comparison.

Looked like the max scan time on my emulator went from 20 uS to 300 uS, but that doesn't seem like a big increase. I'll try it out on a L61 controller tomorrow & post the results.

Here's the file.
 

Similar Topics

Hi Guys, I am trying to create a triangle (Sawtooth) pulse in RSlogix 5000 using counters/timers and anything else. I'm not sure what the ladder...
Replies
43
Views
17,040
I have an assignment do this week on creating a game using ladder logic. I don't have a clue as to what I could create using Ladder Logic for the...
Replies
3
Views
5,532
I am programming a PVD counter sequence in PLC ladder logic, I have several differnet ways to program it, but I was curious if there was a simpler...
Replies
1
Views
3,729
The idea here is to provide for a brief rapid influx of message codes while preventing sequentially repeating the same message. i.e. if two...
Replies
23
Views
700
Hello everyone, In a factory where we installed Citect 7.20 the computer began to show the first signs of end of life. They never considered...
Replies
0
Views
78
Back
Top Bottom