How to Read Analog Input Current (4-20mA)
This tutorial shows you how to read an analog input current (4-20mA), display the raw reading, and convert the signal to more meaningful values on the User Interface.
Software Required
Hardware Required
- HMC4070A-M – Other HMC2000/HMC4000 models can also be used
- HMC3-M1212P0200 V2 – Other HMC3 I/O modules with Analog Inputs can also be used
- 24 VDC Power Supply (4010-0011)
Wiring and Circuit Design
Analog Input 4-20mA (2) Wire Voltage Output
Red Wire: 24V Power from Power Supply
Black Wire: Output Signal to PLC/Controller
Blue Wire: 0V on Sensor to Negative Power Supply
Analog Input 4-20mA (3) Wire Voltage Output
Red Wire: 24V Power from Power Supply
Black Wire: Output Signal to PLC/Controller
Blue Wire: 0V on Sensor to Negative Power Supply
2nd Blue Wire: Ground to Negative Power Supply
Software Code
IEC Ladder Diagram
Structured Text
Another type of IEC Language you can use:
Pressure_Real := any_to_real ( Slot01_CH0_AnalogIPReg );
Pressure_Scaled := ScaleLin ( Pressure_Real, 0.0, 65000.0, 0.0, 100.0 ) ;
User Interface
Sample Project
The project shown above was designed for the specific hardware mentioned at the beginning of the tutorial and is intended to provide you guidance when programming your unit. If you are using models other than the ones specified in this sample project, similar steps can be duplicated within your own project.
Download MAPware Sample Project
Resources & Documentation
HMC/MAPware-7000 Resources
- MAPware-7000 Getting Started Guide
- MAPware-7000 Programming Manual
- IEC 61131-3 Programming Guide for MAPware-7000
- HMC3 I/O Module Guide
More
See our Support Center for a complete list of Quick Start and Installation Guides
Additional Resources
The following table shows the cross reference values for the Raw Register Value in MAPware and what current or voltage it corresponds to depending on the analog input type configured for the channel. This may be different from module to module so please refer to the HMC3 I/O module guide and find your specific module part number to see those corresponding values.
Expansion Module Register Value | 0 to 20mA | 4 to 20mA | 0 to 10V | 0 to 5V |
---|---|---|---|---|
0 | 0mA | 4mA | 0V | 0V |
16384 | 5mA | 8mA | 2.5V | 1.25V |
32768 | 10mA | 12mA | 5V | 2.5V |
49152 | 15mA | 16mA | 7.5V | 3.75V |
65535 | 20mA | 20mA | 10V | 5V |