
Many people struggle with analog signals in PLC programming. The wiring and how to use an analog input or output in your PLC program can be tricky. I’m writing this article because many want to learn how to use analog signals in PLC programming. Analog signals are used widely in PLC programs. So how do you connect that 4-20mA analog transmitter to your PLC and use it in your PLC program? How do you scale an analog signal in Ladder? This article aims to give answers to this specifically with an S7 300 with TIA
Wiring the transmitter to the Analog Card

The example here uses a transmitter with a 4-20 mA output. Connected to the transmitter is a 3 wire PT 100 temperature sensor. The transmitter is calibrated to a range of 0-150 degrees. What this means is that when the temperature is 0 degrees the output of the transmitter will be 4 mA, and 20 mA by 150 degrees. Below the wiring has been done on a card with a single Analog input only.

The transmitter is often needed because the sensor in itself cannot provide us with an analog signal. Or at least not one that fits a PLC analog input. It is possible to buy analog input modules where you can connect a temperature sensor for example directly. But most often you will have a voltage or current input module where you connect a transmitter.
Setting up the Hardware in TIA

In our example, we have an S7 300 with an Analog input card that has been set to receive a current 4 - 20ma as the input. The key variable in this example is a start Address of 272.

Scaling with the SCALE Function Block in TIA

Siemens for example has build-in function blocks specifically for scaling. The block is simply called SCALE and has 5 inputs and 3 outputs. But I’ll only focus on 3 of the inputs and 1 of the outputs. The HI_LIM and LOW_LIM are the limits for your engineering value. For example if you want to scale your analog signal to 0-150 degrees, the LOW_LIM should be 0 and HI_LIM 150. At the input called IN is where the raw value from the analog input goes. The variables associated with this scale block are shown below in a Datablock associated with the scaling.

Finally the result of the scaling will be sent to the output of the block (OUT) and from here the value will continually update as often as the cycle time of the PLC CPU will permit. A youtube video of comparing the Analog input in TIA vs simatic manager is shown below by selectin the following link:

https://www.youtube.com/watch?v=tgK5dxXPIOo&t=2s
