Micrologix 1400 concatenate 2-16bit words into a 32 bit word

Axman47

Member
Join Date
Feb 2011
Location
MN
Posts
2
Has anyone concatenated two 16-bit (B3) words into one 32-bit (L) word in a Micrologix 1400? I do not want to add the values. I need to maintain the bit pattern as it crosses the 16-bit word boundary.

Thanks.
 
Use the Copy (COP) command

e.g. COP #B3:2 #L10:1 1

Check if the words come out in the correct order in the Long variable. If not some intermediate COPying may be needed.

Relative to Mickey's post, the length should be '1'. The length is in terms of the target data type.
 
Last edited:
EDIT: See Mickey's CPW...works like a champ (in RSLogix500 Emulate)...length must be 2 which defies the rule that Bernie and I normally follow which states the length is relative to the destination element size.

Ignore the rest of this post...

I was going to suggest a COP instruction, but the ML1200, ML1400 and ML1500 don't like it when the source and destination are of different element sizes using the COP.

But where theres' a will there's a way. MUL the most significant 16 bit word by 65536 with a destination of the L element, then ADD the least significant word to it. Now there's more...if the most significant bit of the least significant word is set, then you will end up with the carry bit and you don't want that, because it will mess up the bit pattern, so here's what I ended up with that seems to work...

Now someone will probably come back with something easier.

INTS_to_LONG_ML1400.png
 
Last edited:
Concatenation of 2 16-bit words into 1 32-bit word

Thanks to all.
The CPW instruction was my first thought, but I didn't have a PLC to try it on. Wasn't sure if the 16-bit words would go into the lower half of 2 32-bit words, or if it would "stack" them into one word. Thanks for confirming and I will try both methods.

Ax
 

Similar Topics

Hey all, first time poster here. I am wondering if anyone has tried using a Keyence SR-X300 barcode scanner to a Micrologix 1400. Keyence sent...
Replies
0
Views
32
I'm using a SLC typed write from the ControlLogix5572 to the MicroLogix 1400, with path: 2, (MicroLogix IP). The ControlLogix equipment has a...
Replies
0
Views
95
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
222
Hi everyone, I hope I don't butcher this up, please feel free to critique me wherever if I do, I have an issue I would equate to "chasing...
Replies
4
Views
303
Hi everyone, I'm working on a project where I need to exchange data between a Siemens S7-1200 PLC and an Allen-Bradley MicroLogix 1400 PLC. The...
Replies
8
Views
651
Back
Top Bottom