###### Intermediate

# PLC Programming Advanced Mathematical Instructions – SCP | Scale With Parameters

##### By

##### Vladimir Romanov

##### |

##### March 5, 2019

## Introduction

The SCP, also known as the scale with parameters, is an instruction which is commonly used for working with analog signals. It’s an instruction which can be utilized in ladder logic as well as function blocks. The instruction will take input, use input minimum & maximums parameters as well as outputs min/max parameters and convert the output scaling based on them.

The primary reason as to why you’d want to utilize this instruction is the fact that analog data will typically be meaningless as it comes into the Programmable Logic Controller or Input Card. The reason being is that the 4-20mA or 0 to 10 VDC signal is generally scaled to the largest scale. On an RSLogix 500 based PLC, this is typically 16

The CPT, also known as the compute, is an instruction which has ** extensive capabilities when it comes to mathematical and logic functions** in ladder logic. This instruction allows the user to input a complex string of instructions composed of computational, operational and comparison functions and computes the result which is stored in the specified register. The instruction will work with operands used in the based instructions as well as many others.

The CPT instruction has **many advantages as well as drawbacks**. Based on personal experience, you should only use this instruction if absolutely necessary and the same could not be achieved with several basic instructions. In other words, you can compute an ADD instruction through the CPT, but you shouldn’t.

The drawbacks come from the fact that it’s not easy to see what’s going on with the logic within this particular instruction. Multiple operands interact with each other which leads to a confusing execution and inability to troubleshoot or tweak when needed.

## Example & Usage of SCP

An SCP is composed of the following registers:

- Input
- Input Min
- Input Max
- Output
- Output Min
- Output Max

Each one of the registers is either an INT or a REAL value.

The input is the value which will be processed by the instruction. **The limits will dictate the lowest and the highest values which can be seen through the input register**. Do note that the instruction will allow negative values and will scale them accordingly.

The next two values specified within the instruction are the scaled parameters on the outputs side. These values will dictate the transformation applied to the input & imply the upper and lower limits of the output signal produced by the SCP.

The outputs of the instruction is a single integer or floating point value which is the transformation of the input. It can be used within the PLC logic just like any other register.

## Data Types Allowed for SCL

The SCL take an input, output as well as four parameters. It’s highly recommended to use integers for the parameters for easier conversions, but they can be specified as floats as well.

**Integer**– You may specify each operand to be of “Integer” type.**Float**– You may specify each operand to be of “Float” type.