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.
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).