# AM3 Analog Output Scaling

The desired range for an analog output is typically 4-20mA; however, the hardware actually generates 0-20mA and scaling is needed to make the numeric range of your choice correspond to 4-20mA.

The internal register numbers that correspond to the analog outputs can be seen by going to the Analog Outputs page under either I/O Data or I/O Setup.

The lower number, e.g. 19, corresponds to the integer register that can be written to set that output. The integer data should be in the range of 0-255 to correspond to 0-20mA. Scaling does not apply to the integer data.

The higher number, e.g. 1037, corresponds to the floating point register that can be written to set the corresponding output. The floating point data should be in the range of 0-20 to correspond to 0-20mA, assuming the slope is set to 1.0 and intercept to 0.0 on the I/O Setup :: Analog Outputs page.

If you set the slope to 0.5 on the I/O Setup page for Analog Outputs, then writing a floating point value of 40 is necessary to arrive at 20mA on the output.

Analog output scaling follows the standard slope intercept formula y=mx+b. To solve for slope m you would use the formula m = (y2-y1)/(x2-x1). Once you have slope m, solve for intercept b using b = y-mx.

Now, for example, let’s suppose we want the numeric range for our output to be 40 to 80. In other words, 40 should produce 4mA, and 80 should produce 20mA. The x values are 40 and 80, and the y values are 4 and 20 (mA).

m = (20 - 4) / (80 - 40) = 0.4

b = 20 – (0.4 * 80) = -12

Now let’s test those numbers.

First, given an input value of 40:

y = 0.4 * 40 + (-12) = 4

Then try an input value of 80:

y = 0.4 * 80 + (-12) = 20.

The above discussion referred to web pages in AM3-IP, which will apply to AM3-IP-MB and AM3-IP-BN. While AM3-SM and AM3-BN do not have web pages, the math illustrated above will still apply and may be used via the respective configuration tool.