Indirect Addressing

derrickjp7

Member
Join Date
Apr 2019
Location
Minneapolis, MN
Posts
16
I'm converting a program from RS500 up to Studio5000. As an example, an address in RS500 like N133:80.1 is being created in Studio as a Tag N133 with an array of 80 DINTS. We then call that address within the Studio program 133[80].1.

All is fine until I came across some indirect addressing in RS500,

N87:[N137:2]

If I were to convert this into our Studio format it would be N87:[N137[2]]. This however does not work, I get "Invalid expression or tag" or "Invalid array subscript specifier." Any suggestions on how to format the indirect addressing? Any instructions that could be used?

Thanks for the help!
 
You have to get rid of the ":", you are no longer working with Memory files, just arrays.

Try: N87[N137[2]]

BTW, I hate it when folks do conversions like this, re-using the old platform memory scheme. It's like your mule died, so you buy a new truck to pull your wagon.
 
You can't use nested square brackets.
You need to use a dummy tag:
MOV N137[2] Dummy
Then you can use N87[Dummy]
 
I had already tried eliminating the ":" but that also doesn't work

I don't have a choice in how its re-tagged, the customer gets what they want

You can't use nested square brackets.
You need to use a dummy tag:
MOV N137[2] Dummy
Then you can use N87[Dummy]

A co-worker showed me this method, which works. I was just hoping there was a cleaner way of doing it. This may have to be the option though
 
I'm converting a program from RS500 up to Studio5000. As an example, an address in RS500 like N133:80.1 is being created in Studio as a Tag N133 with an array of 80 DINTS. We then call that address within the Studio program 133[80].1.

N133:80 is the 81st element of that Integer file, the index starts at zero, so the conversion (if that was the last Integer) would have created an array of 81 DINTs, 0 thru 80.

You have to be ultra careful with conversions. Notice how it created a DINT array, not an INT array ?

Those INTs in the logic are signed integers, and if you inspect bit 15 to see if they are negative (very common, its cheaper than a LES instruction), then the conversion to DINTs will have shifted the sign bit to bit 31, so it won't work.... Lots of other things to be wary of, as well.
 

Similar Topics

Howdy folks, I am an Allen Bradley guy currently living in an Emerson world. Working with Rx3i on PacSystems Machine Edition v. 9.6? i think...
Replies
3
Views
610
Hello, I'm very new to programming with absolutely zero schooling in this field and pretty hands off training in my new role, it's been fun...
Replies
4
Views
663
Hello Friends, I am trying to index M Bits, however GX Works2 is not allowing it with following message. https://ibb.co/zPcqj6M...
Replies
3
Views
1,372
Hi All, which the best way to do the indirect addressing in an optimize DB? Ccurrently this is my partial code inside an FB...
Replies
7
Views
2,267
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...
Replies
12
Views
1,949
Back
Top Bottom