The leader in industrial automation and control solutions

Instruction Parameters

Supported PLC Series

PLC-AESPLC-FBPLC-ES

Supported Data Registers

MXYKLFTCSZRQD@DConstant
S
D
P
n

Supported Flags

FlagBitSupport
ErrorF11.0
ZeroF11.1
CarryF11.2

Number of Steps

Steps
5

Operands

OperandDescription
SThe first operand.
Entries are only WORD data registers.
This is the data to be scaled.

The signed value range is -32,768 ~ 32,767 (216).
The unsigned value range is 0 ~ 65,535 (216-1).
The Hexadecimal value range is H0000 ~ HFFFF.
DThe second operand.
Entries are only WORD data registers.
This is where the result of the scaling is saved.
PThe third operand.
Entries are only WORD data registers.
This is the data table that defines the linear function for scaling.
This requires 4 WORD data registers.
nThe fourth operand.
Entries are WORD data registers or constants.
This is the number of data registers, starting at D, to scale.

Notice

Error Flag (F11.0) Notice

The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type. F11.0 turns ON when the value of S exceeds the scaling range defined in P or when D exceeds its defined range. The value assigned to n must not exceed the range of the corresponding data register. If the assigned value exceeds the range of the area assigned to the data registers S and D, it may cause a PLC CPU STOP command.

Scaling Table (P)

The P operand data register stores data in the following:

Data RegisterDescriptionAxis
PRange start point of the data to be scaled.
Raw minimum value.
Start S
X
P+1Range end point of the data to be scaled.
Raw maximum value.
End S
X
P+2Range start point of scaled data.
Scaled minimum value.
Start D
Y
P+3Range end point of scaled data.
Scaled maximum value.
End D
Y

Scaling Equations

The equations for scaling are as follows:

  • Destination (D) = Source (S) × Gradient + Offset
  • Gradient = (End D – Start D) ÷ (End S – Start S)
  • Offset (Y-intercept) = End D – Gradient × End S

Instruction Behavior

The SCL and SCLP instructions behave as follows:

  • When the data assigned to the data register S exceeds the range between Start S and End S, the data is converted into the value assigned to Start D or End D.
    • The value is converted to Start D when the value assigned to the data register S is less than Start S.
    • The value is converted to End D when the value assigned to the data register S is greater than End S.
  • When Gradient is negative, the data assigned to the data register S is converted into the value assigned to End D and Start D.
    • The value is converted to End D when the value assigned to the data register S is less than Start S.
    • The value is converted to Start D when the value assigned to the data register S is greater than End S.
  • The value assigned to n must not exceed the range of the corresponding data register.
    • If the assigned value exceeds the range of the area assigned to the data registers S and D, it may cause a PLC CPU STOP command.

Ladder Diagram Examples

SCL

The SCL instruction scales n number of WORD data registers starting from the data register, S, on a linear function defined by the data table, P. The

The SCL instruction scales n number of WORD data registers starting from the data register, S, on a linear function defined by the data table, P. The scaled data is saved into n number of WORD data registers starting at D.

When the contact, M1.0, is powered ON (1), the instruction scales 6 REAL data registers starting at D0 by the data register, D20, and saves the result

When the contact, M1.0, is powered ON (1), the instruction scales 6 REAL data registers starting at D0 by the data register, D20, and saves the result in the data register, D30.

Ladder Diagram Example for MapleLogic SCL/SCLP instruction.

Result

Result for MapleLogic SCL/SCLP instruction.

SCLP

The SCLP one-shot instruction scales n number of WORD data registers starting from the data register, S, on a linear function defined by the data tabl

The SCLP one-shot instruction scales n number of WORD data registers starting from the data register, S, on a linear function defined by the data table, P. The scaled data is saved into n number of WORD data registers starting at D. Every time this instruction executes, it energizes the output only once.

When the contact, M0.1, is powered ON (1), the instruction scales 6 REAL data registers starting at D40 by the data register, D60, and saves the resul

When the contact, M0.1, is powered ON (1), the instruction scales 6 REAL data registers starting at D40 by the data register, D60, and saves the result in the data register, D70.

Ladder Diagram Example for MapleLogic SCL/SCLP instruction.

Result

Result for MapleLogic SCL/SCLP instruction.