Analog input configuration lets your PLC read real-world signals like temperature or pressure. It converts electrical signals (4-20mA or 0-10V) into numbers your program can use.
You want to measure temperature from a sensor that outputs 4-20mA.
You need to read a pressure sensor that sends 0-10V signals.
You want to monitor liquid level using an analog sensor.
You need to convert sensor signals into digital values for control.
You want to set up alarms based on sensor readings.
Syntax
PLC Programming
AnalogInputConfig(channel, signalType, minValue, maxValue)
// channel: input channel number
// signalType: '4-20mA'or'0-10V'
// minValue: sensor minimum value (e.g., 0 degrees)
// maxValue: sensor maximum value (e.g., 100 degrees)
The configuration maps electrical signals to real-world units.
Make sure to select the correct signal type for your sensor.
Examples
Configures channel 1 for a 4-20mA sensor measuring from 0 to 100 units.
PLC Programming
AnalogInputConfig(1, '4-20mA', 0, 100)
Configures channel 2 for a 0-10V sensor measuring from -50 to 50 units.
PLC Programming
AnalogInputConfig(2, '0-10V', -50, 50)
Sample Program
This program sets up channel 1 for a 4-20mA sensor. It then simulates reading 12mA and converts it to a value between 0 and 100.
PLC Programming
// Simple PLC program to read and scale analog input
// Configure channel 1for4-20mA sensor measuring 0-100 units
AnalogInputConfig(1, '4-20mA', 0, 100)
// Read raw input value (simulated here as12mA)
rawValue = 12.0
// Scale raw 4-20mA to engineering units
scaledValue = ((rawValue - 4) / (20 - 4)) * (100 - 0) + 0
// Output scaled value
Print('Scaled sensor value: ' + scaledValue + ' units')
OutputSuccess
Important Notes
Always verify sensor wiring matches the configured signal type.
Scaling formulas convert electrical signals to meaningful units.
Test with known input values to confirm correct configuration.
Summary
Analog input configuration connects sensors to your PLC.
Choose the right signal type (4-20mA or 0-10V) for your sensor.
Scaling converts raw signals into useful measurements.
Practice
(1/5)
1. What is the typical current range used for analog input signals in industrial PLCs?
easy
A. 0-5V
B. 10-30mA
C. 4-20mA
D. 0-24V
Solution
Step 1: Understand common analog signal standards
Industrial sensors commonly use 4-20mA current loops for analog signals because they are less affected by electrical noise.
Step 2: Compare options with standard ranges
Among the options, only 4-20mA is the standard current range for analog inputs in PLCs.
Final Answer:
4-20mA -> Option C
Quick Check:
Standard analog current signal = 4-20mA [OK]
Hint: Remember: 4-20mA is the classic industrial current signal [OK]
Common Mistakes:
Confusing voltage and current ranges
Choosing 0-5V as standard current signal
Thinking 10-30mA is common
2. Which of the following is the correct way to configure a 0-10V analog input in a PLC program?
easy
A. Set input range to 0-24V and scale raw value accordingly
B. Set input range to 4-20mA and scale raw value accordingly
C. Set input range to 0-5V and scale raw value accordingly
D. Set input range to 0-10V and scale raw value accordingly
Solution
Step 1: Identify the signal type
For a 0-10V sensor, the PLC input must be configured to accept voltage signals from 0 to 10 volts.
Step 2: Apply correct scaling
The raw input value must be scaled based on the 0-10V range to convert it into meaningful units.
Final Answer:
Set input range to 0-10V and scale raw value accordingly -> Option D
Quick Check:
0-10V input needs 0-10V range setting [OK]
Hint: Match sensor type with input range setting [OK]
Common Mistakes:
Using 4-20mA range for voltage input
Choosing 0-5V range for 0-10V sensor
Ignoring scaling after setting range
3. Given a 4-20mA input scaled to 0-100 units, what is the scaled value if the raw input is 12mA?
medium
A. 50
B. 60
C. 40
D. 70
Solution
Step 1: Understand scaling formula for 4-20mA
The formula to scale current (I) to units is: scaled = ((I - 4) / (20 - 4)) * 100