Scaling example, Example using compute instructions, Scaling example example using compute instructions – Rockwell Automation 1794-XXXX FLEX I/O High-Density Analog Modules User Manual
Page 83
![background image](/manuals/580693/83/background.png)
Publication 1794-UM062A-EN-P - September 2012
Module Programming 75
Scaling Example
To scale your data to a different range:
• SLC 500 – use the scaling instruction.
• PLC-5 – determine a constant (slope) by dividing the desired prange by
the actual range. Multiply the result by your data, and add or subtract any
offset.
Example using Compute Instructions
This rung scales FLEX I/O analog data to a different range. In this example, we
want the 4…20 mA input data to represent 0…537.7
°C (32…1000°F) in the
PLC-5. N13:0 = 30,840 (7878 in hex). Two compute instructions are needed
because of the way the destination value is rounded if we use an integer location
16.00
5A5A
6188
6.00
4920
4928
4928
17.00
61E1
67A0
7.00
5550
5558
5558
18.00
6969
6DB8
8.00
6180
6188
6188
19.00
70F0
73D0
9.00
6DB0
6DB8
6DB8
20.00
7878
79E8
10.00
79E0
79E8
79E8
21.00
7FFF
7FF8
10.50
7FF0
7FF8
7FF8
Current and Voltage Mode Values
Current (mA) 4…20 mA Mode 0…20 mA Mode Voltage (V)
± 10V Mode
0…10V Mode
Input
Output
EXAMPLE
A 4…20 mA input places data at N13:0 (see figure PLC-5
Family Sample Program Structure for a 1794-OE4 Module on
page 72), with a range of 0…30,840. (30,840 = 7878 hex – see
table Current and Voltage Mode Values on page 74).
You want the 4…20 mA (0…30,840) to be 0…537.7
°C
(32…1000
°F) in the PLC-5. Use the following formula:
= {[(1000 - 32)/30,840] X N13:0} + 32
F8:0
Scaled Data (degrees) @ N30:0 = {[(Desired Range)/Actual Range] X Analog Input Data} + O ffset
= F8:0 + 32
Scaled Data (degrees) @ N30:0
(See ladder logic below)
= F8:0 + 32