RSLogix AOI Create

Webhead

Member
Join Date
Jun 2005
Location
Central Florida
Posts
145
I've looked and quite a few posts were older so I'm starting this one....

I created my first AOI but it appears to not be functioning correctly. Can someone who has made these before take a look and tell me what I'm doing wrong???

I would attach the AOI but it says that it is an invalid file so I took screenshots of the code and parameters. I'm sure I'm missing something simple but any help would be greatly appreciated.

ASCII to Real.PNG AOI Rung.PNG AOI Parameters.PNG
 
Your SourceString should be String Type, not SINT, InOut parameter.
Your String should be Local Tag.
It can be shorter custom string, you don’t need 82 characters.
Instead of CPS and MOV use one MID instruction.

Overall, CPS is only efficient for I/O, not for regular tags.
 
Last edited:
I don't understand why the SourceString should be STRING. I am attempting to pull characters out of an array starting at V_Read_RT.DATA[1] through [5] and move them to a real number. I'm not familiar with the MID instruction can you give me an example?
 
The SourceString (not really a string) should be a SINT array with the length of the total array. It should be an InOut parameter. As with any other InOut parameter the AOI instance gets the address of the start of the array.



DestReal should be an Output type


The MID wouldn't work because the source is not a string (DINT size followed by SINT data array)

If the SourceString could change in mid scan, perhaps if received via communication, then CPS is probably appropriate otherwise COP would be sufficient.


You show a couple of different starting points for the extraction of the 5 SINTs from the array. Check again.
 
Last edited:
The SourceString (not really a string) should be a SINT array with the length of the total array. It should be an InOut parameter. As with any other InOut parameter the AOI instance gets the address of the start of the array.



DestReal should be an Output type


The MID wouldn't work because the source is not a string (DINT size followed by SINT data array)

If the SourceString could change in mid scan, perhaps if received via communication, then CPS is probably appropriate otherwise COP would be sufficient.


You show a couple of different starting points for the extraction of the 5 SINTs from the array. Check again.

MID will work if you define variables as I described above. MID is much cleaner way to manipulate with characters.
 
Here is the example. The only question is Starting element of the string.
One of your examples shows character 1, another 7, so you need to define exact real location in your source

Edit, it looks like CPS uses DATA[7], so MID Start will be 8

A001.JPG A003.JPG
 
Last edited:
Is you V_Read_RT a String? Based on the .DATA[xx] field I think yes.
then you need to pass it as a String to AOI and parse it there instead of extracting bytes before AOI
 
Contr_Conn is right, you are not working with the same data types between the AOI and the rung below it. In the AOI you are working with just SINT (one character of a string). In the rung below that you are working with the entire string even though you are addressing it to the element level.

See if this helps. Change the SourceString in your AOI to V_Read_RT.DATA[8] and see what V_AnodeCurrent_Test reads. I would suspect your output to be 7.0. (Please actually try this and report back what actually happened, I am curious if I was correct)

In the rung with just the AOI you are sending in V_Read_RT.DATA[1] and then copying that value into String.DATA[0], which again is just one element of the string. The tag String has no idea what the other elements of V_Read_RT because it was only told about the 0 in element [1]. The CPS instruction copies a 0 into String.DATA[0], the length of String is changed to 5, and then the STOR instruction should be something like Source: String = '00000' Dest: DestReal = 0.0 because 00000 as a real is still only 0.0.

In the rung below that, you are copying the contents of V_Read_RT.DATA[7], [8], [9], [10], and [11] into tstString.Data[0], [1], [2], [3], and [4]. tstString is '07.89' which the STOR instruction converts to 7.89.

So, you either need to change your input to be a STRING type rather than SINT, or just use the MID instruction to extract the information you need as Contr_Conn already suggested. The MID instruction is pretty easy to use, check out the instruction help for it. I have attached an example of how I duplicated what I think is your end goal for you at the bottom. If you still want this to be an AOI, you could create inputs to dictate the start position of the string, and the length you want to extract before converting to a real, but this seems so much easier than an AOI especially if you are going to be pulling from different parts of the string.

MID.PNG
 
I was just trying to do this in an AOI to clean up the code a little bit. Again its the first one I've created to see how easy or hard it would be.... I will have to do the testing a little later, emergency popped up so when I'm done with that I will try your ideas.
 

Similar Topics

Hi. I'll say it again, I worked mostly with Unity Pro for the last 12 years and I'm trying to convert our FBD standard to Rockwell Logix...
Replies
13
Views
1,511
There is a requirement to convert some projects back to Rslogix 5k , I want to check if I can convert version 30 AOIs to version 20 AOIs. Thanks
Replies
2
Views
1,051
Hi, Is there a way to know if an optional input is used? I am programming an AOI for customers. There are 2 inputs A and B. Input B is optional...
Replies
6
Views
1,616
Hi All, I'm working on an AOI that needs a ONS incorporated into the logic. Every time I run the instruction the ONS gets stuck on even when the...
Replies
6
Views
3,241
Hello!! I am trying to create a AOI to perform lead lag pumping operations based on run time. I do have 8 pumps out of which 6 are duty and 2...
Replies
6
Views
2,664
Back
Top Bottom