# 12 bit AD value converted to 16 bit holding register

A

#### Alan Thomas

Most PLC's read analog values via a 12-bit A/D then post the results into a 16 bit holding register. Somehow they expand the 12 bit value to use all 16 bits of the holding register. How is this done? How is the sign bit represented?

M

#### Michael Griffin

On March 18, 2002 02:23 pm, Alan Thomas wrote:
<clip>
> Most PLC's read analog values via a 12-bit A/D then post the results into
> a 16 bit holding register. Somehow they expand the 12 bit value to use
> all 16 bits of the holding register. How is this done? How is the sign
> bit represented?
<clip>

They simply put a 12 bit value into a 16 bit register. The remaining 4 bits may or may not get used for other purposes (e.g. status bits for broken wire indication). The actual binary representation will vary between manufacturers, or even between different models from the same manufacturer. You would need to look up the manual for the particular PLC you are interested in to see how that one works.

The above refers to a raw binary representation. You can scale this up or
down to engineering units by multiplying or dividing (span) and adding or dividing (offset). This doesn't increase the actual resolution however, it just puts it into useful units such as millimeters or newtons.

--

************************
Michael Griffin
************************

S

#### Steve Myres, PE

They just multiply by 16. The least significant four digits are generally meaningless.

H

#### Hakan Ozevin

Some of them shift the 12 bits value by 3 bits to the left and add a sign bit as MSB.
The rest just copy the 12 bits value to an 16 bits register (adding a sign bit).

R

#### Rick Daniel

The standard method of representing a bipolar value is 2's complement binary. Technically the most significant bit is the sign bit, but it's a
little more complex than that. The way you would transfer a 12 bit number into a 16 bit register, and maintain the sign, is simply to put the 12 bits into the most significant 12 bits of the 16-bit register and set the 4 least significant bits to 0. If you do this, no other conversion is necessary, and the value plus sign is maintained.

If your measurement range is +/- 10 volts, for example, the the voltage represented by the 12 bit number will be 10*N/2048. Once you tranfer the
number to a 16-bit register as above, the value becomes 10*N/32768. Either way the measurement will come out right.

Rick Daniel
Intelligent Instrumentation

www.instrument.com