DINT to INT

RSLogix 5000 any way to get a DINT to INT.
I'm trying to send two registers. Lower Byte will be example R1 with a data type INT and Upper Byte will R2 with a data type INT.

I can't figure out how to shift the Upper Byte to the Lower Byte with BSR Function Block.
 
If your INT were an array of 2, you can simply use a COP instruction to store the DINT into your INT array (maybe with a byte-swap if they are in the wrong order). In your case where your INT's are individual tags, you will need to use the BTD instruction.
 
As dmroeder suggests, using the COP instruction is a good solution.

Even if you already have the tags defined as two separate INTs. Create an INT array with 2 elements and call it Scratchpad. Enter the following code: MOV R1 Scratchpad[0], MOV R2 Scratchpad[1], COP Scratchpad DestinationDINT 1.

It's still cleaner and easier to follow than the BTD solution.
 
It's through the COP instruction with a length of 16 and it will parse out the upper and lower byte.
I see the light.

Thank you @mellis and @dmroeder.
 
The "length" in the COP instruction is determined by the destination data type. If you are copying to one DINT, then the length is "1" (that will copy all 32 bits from the two INTs into one DINT).
 

Similar Topics

Hey all, it's my first post. I've been lurking a while. I've got ControlLogix L83E, Studio 5000 v32, pushing production counts to an old Modbus...
15
Replies
614
Views
I'm not sure the how to explain my problem but I'll do my best. For context, the customer has a scale that we need to see be able to read in the...
6
Replies
443
Views
I have created a DINT[50] that is being filed with a ratchet copy. 0-3 are the possible numbers that could be in each. Every trigger ads the new...
9
Replies
450
Views
I created an INT [100] pack named "N51" My source DINT is named "B32" I made a MOVE block to populate the contents of B32 over into N51 beginning...
2
Replies
363
Views
Greetings all. I have a DINT in my CpLX named "Alarms". It is mapped to my ABCIP in Edge but I can't figure out how to access each bit to create...
19
Replies
1,951
Views
Top