MicroLogix 1400 - STRING to INT

jrsnydley

Member
Join Date
Dec 2014
Location
Minnesota
Posts
155
Hey everybody, Happy New Year!

I have a PanelView Plus 600 that has a String Input Enable. This is communicating with a MicroLogix 1400 and the String Input Enable inputs to ST18:0. I am trying to move this into an Integer with the ACI instruction. The data in ST18:0 is RC 27. When I use the ACI instruction to move it into N15:2 then the data in N15:2 changes to 27. I have never used the ACI instruction before but it seems pretty straightforward. Am I missing something?
 
Hey everybody, Happy New Year!

I have a PanelView Plus 600 that has a String Input Enable. This is communicating with a MicroLogix 1400 and the String Input Enable inputs to ST18:0. I am trying to move this into an Integer with the ACI instruction. The data in ST18:0 is RC 27. When I use the ACI instruction to move it into N15:2 then the data in N15:2 changes to 27. I have never used the ACI instruction before but it seems pretty straightforward. Am I missing something?

yes, the RC.


it's not an integer value. What are you expecting the value to be?
 
Well, I guess I thought that String to Int (ACI) converted ASCII to a decimal value and put it into an integer. That is what I am trying to accomplish.
 
So, the end goal is to have 4 integers containing decimal values equivalent to the ASCII string. The string is 8 characters long.

I am trying to write this data to another processor (via a MSG instruction) within an array of INTS. When it reaches the other processor, it interprets the data there.

Is there a good way to do this or do I have to configure another MSG instruction just to write my string to the other processor?
 
Would something like this work?
Code:
 BST MOV ST18:0.DATA[0] N15:0 NXB MOV ST18:0.DATA[1] N15:1 NXB MOV ST18:0.DATA[2] N15:2 NXB MOV ST18:0.DATA[3] N15:3 BND

I don't think you need the ACI instruction to do what you want to do. The code above should extract two characters from the string at a time and place them into an integer. 8 ascii characters, 4 integers.
 
I need to clarify this for myself and maybe others
Without knowing all of the details of your application itā€™s hard to tell how to decode the data string.
The first question I would ask if the original string tag originates in the Panelview then why are you passing it to the plc as a string why not create it as the data type necessary in this case an INT array .
It looks to me like the original data is received in the Panelview from another source as a character string and you are just passing the string through to the plc.
Regardless of how the string is placed in the plc in your case in ST18:0 you now have to work with it
From the ST18:0 tells me that table ST18 in an array of strings and you are placing the string in the index 0 of that array. In the 1400 the data tables are all arrays
We must first understand what a string data type is a character / ASCII string is an array of ASCII characters stored as an array of SINTā€™s one for each character. Decimal numbers 0-255.
The data just tells the software how do display the data so us humans can more easily understand it.
Rockwell by default creates an array of 80 SINT[79] when you create a string data type
So the string ā€œRC 27ā€ would be an array of 5 characters but it is stores and an array of 80
If you simply moved or copied the value of each SINT to an INT array the data would not be what you want.
In your case you want ā€œRC 27ā€ it would be
[0] 82
[1] 67
[2] 32
[3] 50
[4] 55
If thatā€™s the values you are looking for then that would be correct and simply pass them (Copy / Move) to the INTā€™s array
While I think you really want 27, so to change the character string 27 to INT 27 you need to use the AIC function(ASCII to Integer converter) to get the correct value.
With most String data sent and received there are characters added to the data you want to send / received.
And sent as one continues stream, some devices just continuously resend the same steam over and over.
The extra characters are added to the value so you know when the value you want starts so you can strip it out of the string.
So if the INT you are looking for is 27 then you need to use AEX Function (ASCII Extract) to extract the String 027 then us the ACI (ASCII convert to Integer), you could extract each character to a separate INT tag or indexed array depending your needs.
 
I made a few assumptions based on this quote:
So, the end goal is to have 4 integers containing decimal values equivalent to the ASCII string. The string is 8 characters long.
I assumed that OP wanted the entire ASCII string, not just the "27" out of "RC 27".

The Micrologix 1400 is programmed using RSLogix 500, not Logix 5000 so strings are handled differently. Two ASCII characters can fit into one 16 bit integer. Using the solution that I provided in post 6, the String and integer equivalents can be broken down like this:
Code:
ST18:0.DATA[0] = "RC"     --> N15:0 = 21059
ST18:0.DATA[1] = " 2"     --> N15:1 = 8242
ST18:0.DATA[2] = "7\00"   --> N15:2 = 14080
ST18:0.DATA[3] = "\00\00" --> N15:3 = 0

If OP was only looking for the 27 then yes an AEX (String Extract) and ACI (String to Integer) would be used. The code would look something like this:
Code:
 BST AEX ST18:0 4 2 ST18:1 NXB ACI ST18:1 N15:4 BND
The "27" is extracted from "RC 27" starting at position 4 and extracting 2 characters. This is then stored in another string variable, ST18:1. On the next branch ST18:1 is converted to an integer and stored in N15:4.
 

Similar Topics

I'm not super familiar with the Micrologix line of processors, but I am pretty familiar with RSLogix 500. I'm trying to simply copy a string to...
Replies
4
Views
265
Hi all ! I am doing project in MicroLogix 1400 and Panleiew Component. I have to store 500 part Nos (12 digit) in Micrologix, Then use barcode...
Replies
0
Views
1,161
Have been experimenting with connecting a sick barcode scanner to a micrologix 1400 plc and been able to successfully read the barcode into a ST...
Replies
6
Views
9,291
I am using string registers with a MicroLogix 1400 and need to clear some data. The CLR (clear) command does not work. How do I do this?
Replies
3
Views
4,851
Hi, I am working with a Micrologix 1400 model 1766-L32BXB. With no input wires connected to the ā€œin12ā€ thru ā€œin19ā€, I am getting 24 volts while...
Replies
4
Views
179
Back
Top Bottom