Help - Search - Members - Calendar
Full Version: ASCII string Concatenate
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
Kiwi Sparky
Looking to combine multiple ASCII strings (aprox 12 characters) together to from 1 string (1 line of printout)to be printed as a recipt style printout (using SLC5/04)
E.G

Fruit Type: Bananas Line Number: 999

Where the word Fruit Type: = String 1
Where the word Bananas = String 2
Where the word Line Number: = String 3
Where the number 999 = String 4 (Used ACI instruction to get integer to string)

If String 1 was concatenated (ACN instruction)with string 2 and sent to String 100(storage), would the result be
Fruit Type: Bananas
or something else? How do I adress this move to get a result like this?
I was hoping my next step would be to (ACN) string 100 to string 3 and store back in string 100. Giving the result : Fruit Type: Bananas Line Number:
Would this work?
Then (ACN) string 100 to string 4 and store back in string 100 to give the final result
Fruit Type: Bananas Line Number: 999
Total line aprox 40 characters

Any help or hints would be greatly appreciated. I haven't had a lot to do with string manipulation etc

Sample code of similar manipulation would be greatly appreciated.

Need to then send this string to 1734232ASC via devicenet to printer after string is formed, but thats a whole new post and a whole lot more questions.
TWControls
You are right on the money. In my image your result would be ST9:7
Kiwi Sparky
QUOTE(TWControls @ Aug 22 2006, 12:22 PM) [snapback]38790[/snapback]

You are right on the money. In my image your result would be ST9:7


Do you have to use a new buffer for the destination everytime? can you use same location as source a? eg
Source a ST9:1
Source b ST9:2
Dest ST9:1
TWControls
You can't reuse ST9:1 because it would overwrite your static text of "Fruit Type"

But you should be able to use the destination of ST9:5 for all of them.

Before you do that though I would suggest you keep it like it is until you work out the bugs. This way you can see the result of each string being combined
Kiwi Sparky
QUOTE(TWControls @ Aug 22 2006, 12:40 PM) [snapback]38793[/snapback]

You can't reuse ST9:1 because it would overwrite your static text of "Fruit Type"

But you should be able to use the destination of ST9:5 for all of them.

Before you do that though I would suggest you keep it like it is until you work out the bugs. This way you can see the result of each string being combined



Yes, your right I dont want write over ST9:1, bad example used on my part. But the using ST9:5 as buffer for all added strings answers my last question.

The charactres will line up in correct order with the ACN. No fancy adressing required?
eg string 1 then string 2 etc
TWControls
It will add the Source B string to the end of the Source A string
Kiwi Sparky
QUOTE(TWControls @ Aug 22 2006, 01:16 PM) [snapback]38796[/snapback]

It will add the Source B string to the end of the Source A string

Thankyou
No way of testing my application at the moment, just preparing code for when I can get equipment.
TWControls
One thing I missed earlier is depending on where the number (999 in your sample) is coming from you may need to use the AIC instruction. Where is the number coming from?

What were have worked on is still good. It would be a conversion before we combined the strings
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.