Page 263 - Programmable Logic Controllers, Fifth Edition - Mobile version
P. 263
N7:1.
L1 Input SW Ladder logic program • The result, 377, is placed in the destination address,
SCL
SW SCALE Figure 11-22 shows an example of an analog input to
Source N7:0 a PLC, and the SCP instruction used to scale its data.
100
Rate (/10000) 25000 The execution of the instruction can be summarized as
follows:
O set 127
• A strain-gage pressure transducer is connected to
Destination N7:1 input I:1.0.
377
• The gage measures pressure from 0 to 1000 psi and
provides an analog output of 0 to 10V.
Figure 11-21 SLC 500 SCL (scale) instruction.
• The unscaled range is 0 to 32,767, and the output is
loaded into N7:20.
perform this task. Both instructions use the same formula
to perform the scaling function, which is: • When executed, the SCP instruction places a num-
ber between 0 and 1000 into N7:20 (destination)
y = mx + b
based on the input signal (0 to 10V) coming from
Where: y is the output the transducer into the analog input module.
m is the scaling rate Figure 11-23 shows an example of an analog output
x is the input from a PLC, and the SCP instruction used to scale its data.
b is the offset The execution of the instruction can be summarized as
Scaling rate (m) = (scaled Max − scaled Min) / (input Max − follows:
input Min) Offset (b) = (scaled Min) − (input Min x m)
The ladder rung of Figure 11-21 is an example of the • A proportional control valve is connected to the
use of the SCL instruction. When rung conditions are true, PLC output O:1.0.
this instruction multiplies the source by a specified rate. • A 4 to 20 mA signal operates the valve from closed
The rounded result is then added to an offset value and to 100% open.
placed in the destination. The execution of the instruction • The percent open is in location N7:21.
can be summarized as follows: • The PLC analog module provides a 4 to 20 mA
• When input switch SW is closed the SCL instruc- output signal for a number between from 6,242 to
tion is executed. 31,208.
• The number 100 stored at the source address, N7:0, • The SCP directs analog output O:1.0 to provide a
is multiplied by the rate 25,000, divided by 10,000, 4 to 20 mA signal, which is scaled to the valve posi-
and added to 127. tion based on a number between 0 and 100.
Scale analog input
SCALE W/PARAMETERS Analog
Strain-gage Input
Input I:1.0 pressure
0 < transducer Module
Input Min. 0 Input I:1.0
0 < Applied Transmitter ADC
pressure
Input Max. 32767
32767 <
Scaled Min. 0
0 <
Scaled Max. 1000
1000 < Scaled output N7:20
Scaled Output N7:20
0 < 0 000000000000000
15 0
Figure 11-22 Scale analog input using the SCP instruction.
244 Chapter 11 Math Instructions
pet73842_ch11_234-251.indd 244 03/11/15 4:07 PM