![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#1 |
Supporting Member
|
PLC5 to Logix conversion - Double indirect addressing
Hey everyone,
Just used the PLC5/Logix migration utility to convert a program, and while addressing the PCEs, I noticed a lot of errors for "XIC (or XIO), Operand 0: Invalid expression or tag." When I clicked on it, it brought me to a section of the program where there are about a dozen instances of double indirect addressing (not sure if that's the right term or not, but it's the best I can think of ![]() I understand why this doesn't work on the Logix side, and have found a couple really good threads of people having the same (or similar) issue, and gather that the solution is probably to utilize two-dimensional arrays, but I'm having a little trouble wrapping my head around the actual implementation of it. I'm assuming that if I set it up correctly, instead of N[N377_1][N377_36].14 or N[21][49].14, I would have N[21,49].14, but there was mention of setting up intermediate DINT tags as two-dimensional arrays and using MOV instructions and I was just looking for a bit of clarification on the actual procedure of utilizing dimensional arrays to properly convert the PLC5 addressing to Logix addressing. I'll try to get some screenshots of both programs and post them here. Thanks in advance |
![]() |
![]() |
#2 |
Supporting Member
|
Screenshots of the same rungs in both programs attached
|
![]() |
![]() |
#3 |
Lifetime Supporting Member
|
the first thing I would do is export the Logix version to .L5X, open that .L5X with a text editor (Notepad or Notepad++), and to a find-and-replace of all occurrences of ][ with , (comma).
Also, the branches in the middle of Rung 0004 can be simplified, with the common [XIO N[N377:27][4].0] instructions removed from the branches and inserted onto the main rung, although there is nothing wrong with how it is, and it might be easier to read and understand. Anyway, to get to the main question, both PLC-5 and Logix programs are using two-dimensional arrays. However, since PLC-5 does not have 2D arrays per se, or even 1D arrays for that matter, they are implemented using intra-Data-File element numbers as one dimension, and contiguous Data Files and file numbers as the additional dimension. The key steps will be determining
__________________
_ Brian T. Carcich i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() v) I probably have the highest ratio of forum posts to actual applications in the field (but no longer ∞ ![]() vi) Hakuna matata. vii) Bookkeeping. Last edited by drbitboy; August 16th, 2022 at 01:43 PM. |
![]() |
![]() |
#4 |
Lifetime Supporting Member
|
Simply put, this task boils down to bookkeeping.
__________________
_ Brian T. Carcich i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() v) I probably have the highest ratio of forum posts to actual applications in the field (but no longer ∞ ![]() vi) Hakuna matata. vii) Bookkeeping. |
![]() |
![]() |
#5 | |
Supporting Member
|
Quote:
|
|
![]() |
![]() |
#6 | |
Lifetime Supporting Member
|
Quote:
PDF would be easier, as not everyone has RSLogix 5.
__________________
_ Brian T. Carcich i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() v) I probably have the highest ratio of forum posts to actual applications in the field (but no longer ∞ ![]() vi) Hakuna matata. vii) Bookkeeping. |
|
![]() |
![]() |
#7 |
Lifetime Supporting Member
|
Do the Data File numbers (BLK_I1=N377:0=N377_0, BLK_I2=N377:1=N377_1, N377:27=N377_27) change their values while the program is running?
Or perhaps, and I am guessing here, BLK_I1, BLK_I2, and N377:27 were at one time fixed (maybe hard-coded) at 20, 21, and 25, and they were change to N377 Data File Elements so the subroutine could be inserted into different existing programs if Data Files 20, 21, and 25, were already allocated?
__________________
_ Brian T. Carcich i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() v) I probably have the highest ratio of forum posts to actual applications in the field (but no longer ∞ ![]() vi) Hakuna matata. vii) Bookkeeping. |
![]() |
![]() |
#8 |
Supporting Member
|
You’re totally right, I’m used to posting programs (ML1100/1400 or Logix) that most people on here would be able to open, but not as many people would be able to open a Logix5 program. I’ll make a PDF of the program when I get a chance and post it.
I haven’t actually seen the program running, I’d have to dig in and cross reference the addresses to see if they change at any point. |
![]() |
![]() |
#9 |
Supporting Member
|
PDF of the PLC5 program attached. I was working on the converted Logix program and realized that for some reason, the conversion didn't actually create an "N" tag, only "N377[X]"/"N377_X" etc.
I created a two-dimensional DINT[100,100] "N" tag, and essentially did what drbitboy said, replacing every instance of "][" with "," which caused all of the errors to go away. Of course, all of the values of those new two-dimensional tags (e.g. N[N377_5,N377_36] which is N[25,49]) are 0, so I still have to go through the program and see if the values of those tags are dynamic or if they're initialized somewhere. |
![]() |
![]() |
#10 | |
Lifetime Supporting Member
|
Um, maybe you forgot to click the [Upload] button? Quote:
sweet hack! The rest is bookkeeping, looks like you are on your way.
__________________
_ Brian T. Carcich i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() v) I probably have the highest ratio of forum posts to actual applications in the field (but no longer ∞ ![]() vi) Hakuna matata. vii) Bookkeeping. |
|
![]() |
![]() |
#11 |
Supporting Member
|
|
![]() |
![]() |
#12 |
Lifetime Supporting Member
|
Hah!
The use of ...blah].[blah... is confined to Program File LAD 20, the Permit Window Subroutine, which has 10 rungs. And there are 46 calls (JSR U:20), just over half of which are all called with all constants. So almost certainly that routine can be replaced by an AOI. The Data File numbers in Data File N377 are all fixed numbers and never changed that I can detect. E.g. N377:27 is 54, so N[N377:27]: is N54:, which appears to contain global values, never changes.
__________________
_ Brian T. Carcich i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() v) I probably have the highest ratio of forum posts to actual applications in the field (but no longer ∞ ![]() vi) Hakuna matata. vii) Bookkeeping. |
![]() |
![]() |
#13 | |
Supporting Member
|
Quote:
If I had a bit more time (and leeway) to do so, I would try to roll my own AOI and have one AOI replace each JSR in subroutine 17, but I think we'll try this the way it is now. It's on a water treatment plant that has a lot of downtime, so we should be able to disconnect the current PLC-5 from the network and plop the ControlLogix in as a test to see if the program functions properly without actually running any equipment. As usual, thanks for your insights and help, always appreciated! |
|
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
4 threads on RS5000 indirect addressing not enough... | NotaHippie | LIVE PLC Questions And Answers | 8 | May 1st, 2019 11:11 AM |
Help With Indirect Addressing In Studio 5000 Conversion From Rs500 | kentuckytech | LIVE PLC Questions And Answers | 7 | January 21st, 2015 12:03 PM |
PLC5 Conversion to Logix - PID Question | robbo | LIVE PLC Questions And Answers | 0 | May 29th, 2013 12:10 AM |
PLC5 and Indirect Addressing | kdcui | LIVE PLC Questions And Answers | 3 | October 23rd, 2008 10:46 AM |
Ab Rs Logix Indirect Addressing | PERSPOLIS | LIVE PLC Questions And Answers | 4 | December 23rd, 2002 03:33 PM |