SLC instructions ASCII

M

Thread Starter

mark

Can anyone help my understanding (lack of) a few of the following instructions for the SLC. Namely ACN, aand AIC. I have the manual, but there are not any applicable blooming examples of them in operation! So i need an overview of how they operate, and examples for each. A lot to ask but desperately required. Many thanks.
 
Mark, See if this is enough to get you going - this is what most programmers use these two instructions for.
=================================================
Example code: (three rungs)

AIC N7:0 ST10:1
ACN ST10:0 ST10:1 ST10:3
ACN ST10:3 ST10:2 ST10:3
=================================================
AIC "integer to string"

takes an integer (EX: N7:0 = 123)
and converts it into a string (EX: ST10:1 = 123)
suitable for printing, etc.
=================================================
ACN "string concatenate" ties strings together - for example:

ST10:0 = "Tank contains "

REM do not enter quote marks -
note space at end

ST10:1 = "123"

REM after performing AIC conversion
as above

ST10:2 = " gallons."

REM note space at front

ST10:3 = "Tank contains 123 gallons."

REM ready for printing after
executing example rungs
=================================================
If you need more detail, let me know. Good luck, Ron
 
The RSLogix forum over at

http://www.software.rockwell.com/forum

is another great resource for A-B specific programming information.

If you're unfamiliar with the String datatype in the SLC-500, go back and review that chapter of the Instruction Set Reference. String data types are represented with an address like "STxx:yy", where xx is the data table file number, and yy is the String element. The first Word of a String is it's Length in characters, designated in ladder logic as "STxx:yy.LEN". A String can be up to 82 characters in length.

The ACN instruction "concatenates" two strings; it adds them together.

For example:

ACN
Source A: ST12:0 "Hello "
Source B: ST12:1 "World."
Dest: ST12:2 "Hello World."

The AIC instruction converts an integer value into a string of the equivalent ASCII characters.

AIC
Source A: N10:0 12345
Dest: ST12:3 "12345"
 
Y

Yosef Feigenbaum

The ACN instruction Concatenates two strings together and places the result in the destination string.

The AIC instruction converts an integer value (source) to a string value (destination).

Hope this helps.

(8{)} ( .)
[email protected]
 
The ACN instruction joins two Strings, p.e.:

N7:0 ---- Good
N7:1 ---- Morning

ACN ---- Source A = N7:0
Source B = N7:1
Dest = N7:3

N7:3 = Good Morning

The AIC instruction converts one integer value to String.

Good Luck
 
ACN concatenates two strings. That is, it takes one ST-file address, adds the contents of another ST-file address to it, at the end, and stores the result in a third ST-file address.

Assume ST9:0 with the text "FOO" in it, and ST9:1 with "BAR".

ACN ST9:0 ST9:1 ST9:2 would add "FOO" and "BAR" and store it in ST9:2. So, after execution, ST9:2 contains "FOOBAR". The total length of the concatenated string in bytes must not exceed 82, including control characters, carriage returns, newlines, etc.

AIC converts an integer to a string. Assume N7:23 with a value of 332.

AIC N7:23 ST9:3

will store the string value "332" in string-file 9, address 3. That is no longer a number, but an ASCII representation of the number (332 would only take 9 bits to represent numerically - 101001100 - but requires three bytes to represent as a string - one for each character.)

ACI, on the other hand, takes the contents of a string file address and attempts to convert them to an integer. It will read number characters until it reaches a non-numeric character and convert the value it finds to an integer. Status bits will be set to reflect success or failure.
 
Thanks to all who replied, I must admit I was looking too complex at the functions, whereas with the examples they are extremely easy to understand now! Cheers Everyone...
 
J

Joe Jansen/TECH/HQ/KEMET/US

ACN : String Concatenate AIC : Integer to String

I have used these in an application to send data to a serial barcode printer. A lot of the string commands are primarily useful for serial comms. In this case, I needed to send out a pallet number that was being printed. The pallet number was based on a counter value, so I used AIC to convert the integer counter value (C5:1.acc) to a string value for sending out the port.

Likewise, when it came time to send out the time it was printed, I would convert the hours, minutes, and seconds from their integer values in the real-tiome clock, and concatenate them together into a single string for sending out the port.

So, in item 1, if C5:1.acc is 12345 it would be:

AIC C5:1.acc ST20:1 <-- moves the value 12345 into a string as "12345".

and in # 2, if the already integer to string converted values are located as st20:10 is hours, ST20:11 is minutes, and ST20:12 is seconds, with a : located in ST20:13, and I want it all to end up in ST20:20, I did:

ACN ST20:10 ST20:13 ST20:15 <-- Puts "HH:" in ST20:15 ACN ST20:11 ST20:13 ST20:16 <-- Puts "MM:" in ST20:16 ACN ST20:15 ST20:16 ST20:17 <-- Puts "HH:MM:" in ST20:17 ACN ST20:17 ST20:12 ST20:20 <-- Puts "HH:MM:SS" in ST20:20

A bit long winded to do, admittedly, but it got the job done.

--Joe Jansen
 
Qutoting from instruction help:

"Use the ACN instruction to combine two entire strings using ASCII strings as operands. The second string is appended to the first and the result stored in the destination."

"Use the AIC instruction to convert an integer value (-32768 to 32767) to an ASCII string."

Thats about as clear as you can get.

Bob Peterson
 
Top