PLC5 indirect unlatch

smittyinky2

Member
Join Date
Nov 2018
Location
Indy
Posts
2
I am trying to convert an old PLC5 program. I have several instances in the unlatch instruction where they give a B file on top of the unlatch and a indirect N file address under the unlatch. Please see attached screen shot.

What bit, word or whatever is unlatched by this instruction with this syntax?

Thanks for they help in advance.

Smitty

unlatch.png
 
Maybe best illustrated by example. If, for example, N21:31 holds the value 147, then the bit reference would be B28/147 or B28:9/3.
 
Welcome to the forum.

I have never run across this before, something new everyday.
what are you trying to convert the program to?

unless I am wrong, someone correct me if I am,
you are unlatching a bit in file B28 as specified by the number stored in file N21 word 31.
so if N21 word 31 has 467 in it, you are trying to unlatch bit B28/467.

james
 
Maybe best illustrated by example. If, for example, N21:31 holds the value 147, then the bit reference would be B28/147 or B28:9/3.

I like this approach. It might be worth noting where N21:31 is getting its value from. Is a value being moved into it from somewhere else in the logic, or is a value being fed into it from an HMI?
 
I would think that B28 would be the unlatched bit.
But why a Numeric is below it I don't know.

I have a PLC-5 within which constants are stored in places
like N7:66 - which contains a 'centering constant' for lane 7, value of 30.
Poet.
 
smittyinky2, I didn't see it mentioned, but are you converting this to a Logix processor?
If so, is B28 converted to an array of type DINT or BOOL? I have seen this type of logic in PLC5 before converted to Logix, but the logic was obsolete so I never saw it in action.

IF it's a type BOOL, N21:31 (converted to N21[31]) could be used as the straight up indirect address but could cause grief if B28 were ever referenced in word format elsewhere in your program.

IF it's a type DINT, then you are going to have to break N21[31] down into a word/bit equivalent in order to make this work. The obsolete code I mentioned earlier was this format. Let me know if this is what you're doing and I can look up & post the specifics.
 
This will work too, but you have to make an tag called N21_31 as a dint or int to use a pointer:
B28[((N21_31 AND 16#FFFFFFF0) / 16)].[N21_31 AND 15]
 
Other folk have answered the whys and wherefores of how to translate the code...

But the visual appearance of the rungs are set in the PLC5 software, hence the B28 is above the line and the N21:31 is below..

Go to the <View> menu and then <Properties> and <Address Display>, then Bit Address format shows either as "Single Line" or "Split Line"...change to Single Line to have the full address showing above the line.

If you are online, you can also set the "show Indirect Address value" for diagnostic purposes.
 
Last edited:
This will work too, but you have to make an tag called N21_31 as a dint or int to use a pointer:
B28[((N21_31 AND 16#FFFFFFF0) / 16)].[N21_31 AND 15]

Ideally, to keep the functionality intact, the tag N21_31 should be an alias to N21[31].

While Logix5000 is not able to handle double indexes ("B28[N21[31]]"), the alias makes the inner indirect a specific memory location, and the result is only a single index.

The technique of indexing bits within a DInt/Int/SInt array varies by type:

SIntArray[(MyIndex AND NOT 7) / 8].[MyIndex AND 7]

IntArray[(MyIndex AND NOT 15) / 16].[MyIndex AND 15]

DIntArray[(MyIndex AND NOT 31) / 32].[MyIndex AND 31]
 
Last edited:

Similar Topics

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,903
Can anyone explain to me what this would mean in a COP instruction? Source: #N[N187:4]:[N187:5] Dest: #N[N187:1]:0 Length: 20 I am doing a...
Replies
6
Views
2,173
what would be the simplest way to convert this to CLX Thanks
Replies
17
Views
3,716
PLC5 to ControlLogix translated FALs are broken by indirect reference: Hi folks, I’m new to PLC’s, I’ve been learning support on some PLC5 heat...
Replies
15
Views
10,969
I have an indirect PLC5 code conversion I can not figure out how to convert to CLX Anyone have a solution Thanks
Replies
11
Views
4,126
Back
Top Bottom