ControlLogix Integer Type Conversion

Is that really your name or a tribute? Cool either way.

I am assuming that the two integers of which you speak at the high word and low word of a 32-bit integer and you want them back together.

Use the COP (copy) command if the 16-bit values are tags internal to the plc and are not written to from outside the PLC program from things like HMIs or I/O. Use the CPS (synchronous copy) command if the 16-bit values can be written to from outside the program. The synchronous copy makes sure the two integers come from the same value.

The copy command performs a byte-by-byte move of the source data to the destination without considering data type. Note that the length is in terms of the destination data type. So if you are copying two 16-bit values to a 32-bit value the length is 1. However, a single 32-bit value copied to two integers would require a length of 2.

Buy the way, this also works with REAL values.

Keith
 
It depends what result you are looking for.
If you wants just a bit pattern copy and INT are in array then use
COP INT[0] DINT 1
 
Well I posted the answer to my question before I read the responses. Thanks for the quick replies. The copy command does indeed work and is more elegant than the 2 BTDs. Thanks!
 

Similar Topics

I know there's the DTOS Function, but I have a value of "35" that is really "0035", and that's how I want it converted. Looks like the function...
Replies
2
Views
1,513
For the last day or so I have been reading on here about how to discover what bit is true in an integer. Most of the info is from Peter Nachtwey...
Replies
12
Views
13,842
Why does the controllogix redundancy modules use a single mode fiber vs multimode fiber?
Replies
1
Views
61
Hello, I have two 16 point input cards and 1 16 point output card showing module faulted on my IO tree in Logix Designer. The fault code is...
Replies
7
Views
207
Hello, My associate and I are trying to sync up two ControlLogix racks (7-slot chassis) with identical modules. We are able to see the secondary...
Replies
4
Views
185
Back
Top Bottom