String Files VS Integer Files

Steve Meisel

Member
Join Date
Jun 2002
Location
NC
Posts
77
What is the differance between an integer file and a string file? I know that a string can hold letters, but is there any other differance? If I extract 4 integers out of a string of 20 they are the same integers that were in the string (no converting done by the processor). Maybe I am making looking too deep at this.

Thanks,

Steve
 
First off, if you identify the platform you are working on (Brand and Model and Programming Software Package and Version) you can get better answers.

In general, though, string files treat all characters the same. In many cases a "2" in a string file doesn't have a numerical value equal to "1+1". Instead, it is simply treated by the PLC as a character with the ASCII value of 50 (decimal). It looks like a "2", but you may not be able to do numerical calculations with it.

In an integer file the "2" is really the number "2" and can be added or multiplied etc. In this case the "2" is treated by the PLC as a number with the binary equivalent of 00000010.
 
I am working with slc5/04's using RSLogix500 v5.00 and AI500 8.18. I am adding a new part to a palletized assy line. The strings are used to transfer data to a basic module then on to Omron Tags on the pallets (part type, reject code, etc. and to a Technifor impact marker for the customers pn, shift code, and julian date. Mostly I like to use AI but we had an outside vendor in here couple of weeks ago and they used RS on a station and didn't limit the descriptions to 15 characters. If I convert it to AI the descriptions get trunticated. I am just trying to understand a little more about how the strings delt with by the processor. Thanks.
 
ASCII and Strings

In the AB universe, there are two types of "string" files: A (for ASCII) and ST (for String).

Each data type is used in different ASCII instructions.

There is absolutely no difference between an A file type and an N file type. A files may be used with any instruction that an N file type is used for. The only difference that I've been able to figure is that RSLogix open A files type with the ASCII radix instead of the decimal radix.

ST files are used with ACN (Concatenate), AEX (Extract), ASC (Search), ASR (Compare), ACI / AIC (String-to-Integer, Integer-to-String) and the Channel 0 instructions (ARD (Read Buffer), ARL (Read Line), AWA (Write Append), AWT (Write).

There is a slight difference between an ST file type and an N file type. Link a T or C type, the ST is structured. Whereas T and C consist of 3 words, a single ST element is 42 words long (regardless of the data in the string).

The ST is structured with the first Word is the length of the string. The next 41 words contain the (up to) 82 chararacters in the string, in ASCII format (the same as you get when you look at an N file using the ASCII radix).

You can convert one data type to the other:

COP #ST10:0 #A11:0 41

The Length part is first, so that will go into A11:0. The string will be A11:1 to A11:41.

MOV 41 A11:0
COP #A11:0 #ST10:0 1

Will convert it back. If the string that you want to store in the ST file is not 82 characters long, put replace the 41 with your string length (less than 41, or weird things happen) in A11:0.

Like Tom said, the "number" in the String is in ASCII. If you want it be a number, you need to convert it. The ACI instruction will do that.

The individual elements of the ST data type can also be referenced directly. The length is ST10:0.LEN. The first two charactors (since each charactor is one byte, and the PLC references everything by word) is ST10:0.DATA[0], the 3rd and 4th are ST10:0.DATA[1], etc.

Again there is no difference between ST10:0.DATA[0] and A11:1 - both are single word entities.

I think that more than answers your question.
 
Another note:

If you want ot use a string address on a panelview, you can't just use the base address (i.e. ST10:0) or all you will see on the screen is a number (the length of the string). If you want to display the string itself, you need to use the reference to the first character which would be something like:

ST10:0.1 (numeral one after decimal point).

I wasted a not-small while on that one one afternoon :-(

Norm Dziedzic
Belden Machine Corp.
 

Similar Topics

Hello all, i am using ab micrologix 1400 plc. I want to store the string which is scanned by barcode scanner(zebra ds108) .how...
Replies
1
Views
1,339
I am currently working with a Compactlogix and I am trying to get a barcode scan into a string file to be compared by another barcode scan later...
Replies
9
Views
3,153
Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
72
As the title says, I'm using CCW with a PV800 (and Micro850). I've made a scheduler in which a user can choose a month, day (1-31), hour (0-23)...
Replies
15
Views
451
Hello, So i managed to read the string coming from control logix and put a string display in PanelView 800. Now I am struggling to do the other...
Replies
1
Views
115
Back
Top Bottom