# Setting up an SCP in RSLogix 500

An SCP (Scale with Parameters) is a really handy instruction in RSLogix 500. It scales any range of values to a range defined by the programmer.

One of the common uses of the SCP instruction is to take the value from an analog input and scale it to an engineering value.

In the example below, you can see how the output from a set of scales can be scaled to show the actual weight of the tank.

In RSLogix 500, double-click on 0000. This opens up the ASCII editor.

Type SCP in the box and press enter. SCP stands for “Scale with Parameters”. It allows you to take an analog input from a sensor and scale it to the output units you want. *[Note: You could certainly insert the instruction using the toolbar. I just wanted to show how to use the ASCII editor to insert an instruction.]*

Before we start scaling, let’s take a moment to see how the Allen-Bradley NI4 converts a 0-10VDC signal to a number. The NI4 is an analog-to-digital processor that takes the 0-10VDC signal and converts it to a number between 0 and 16384.

The NI4 will yield a number from 0 to 16384 that is directly proportional to the 0 to 10VDC signal that is applied at the input.

In other words, zero volts on the input of the NI4 means that the NI4 will provide 0 as a value to the PLC. Ten volts on the input will yield 16384. Five volts on the input will yield half of 16384, or 8192, and so on.

The SCP instruction starts out looking like this.

Each of the six parameters (Input, Input Min., Input Max., Scaled Min., Scaled Max. and Output) has two fields associated with them. Each field is currently filled with a question mark. The first field is a value that you assign. The second field is the actual value returned by the processor.

**Setting up an SCP to calculate Tank Weight**

The Input parameter is the value that will be scaled. Let’s use this SCP instruction for the Scales. The input we will use is the address we assigned to the analog input card; that is, I:1.0.

The Input Min parameter is the value that is read by the analog card when there is no liquid in the tank. With our scales, this value is 0.

The Input Max is the value that is read by the card when the tank is full. Our Mixing tank weighs 2000 lbs. when it is full of liquid. We measured the voltage that the Scale put out when the tank was full and found it to be 10 volts.

So, in this case, 2000 lbs. in the tank equals 10 volts, which means the NI4 will read out 16384 when the tank has 2000 lbs. of liquid in it.

The Scaled Min parameter is the lowest value you want the SCP to calculate in the units you want. In this case, it is 0, and we are using pounds as our units.

The Scaled Max parameter is the highest value you want the SCP to calculate. For the Scales in our project, it is 2000.

The Output parameter is typically an address where you want to store the result of the SCP. We are going to put it in the N7 file (integer). We will store it specifically in N7:0.

Here is how the SCP instruction for our Scales looks.

Admittedly, the numbers rarely work out like this, but for simplicity’s sake, I made them easy to work with.

The real beauty of the SCP is apparent after you go online. Let’s say that you couldn’t really calibrate the scales previously by using voltmeter.

After you go online, and you are getting live data from the SCP instruction, you can visually verify that the tank is empty.

Hoverer, you are reading 133 from the NI4. You simply enter 133 as the Input Min parameter.

When the tank is full, you see that the reading is 14733. Enter 14733 as the Input Max parameter and the SCP will calculate the rest for you.

The important thing to remember is that the value in N7:0 is the actual weight of the tank in pounds. We will use that when we program the setpoint logic.

This is how N7:0 is used. In the example below, we want to add 1275 pounds of water to a tank. As long as the weight of the tank (N7:0) is below 1275 pounds, the city water valve will remain open.

*Excerpted from PLC Programming with RSLogix 500*