
- •Table of Contents
- •Preface
- •Chapter 1 - Ladder Diagram Fundamentals
- •1-1. Objectives
- •1-2. Introduction
- •1-3. Basic Components and Their Symbols
- •1-4. Fundamentals of Ladder Diagrams
- •1-5. Machine Control Terminology
- •1-6. Summary
- •Chapter 2 - The Programmable Logic Controller
- •2-1. Objectives
- •2-2. Introduction
- •2-4. PLC Configurations
- •2-5. System Block Diagram
- •2-6. ... - Update - Solve the Ladder - Update - ...
- •2-7. Update
- •2-8. Solve the Ladder
- •2-9. Summary
- •Chapter 3 - Fundamental PLC Programming
- •3-1. Objectives
- •3-2. Introduction
- •3-3. Physical Components vs. Program Components
- •3-4. Example Problem 1
- •3-5. Disagreement Circuit
- •3-6. Majority Circuit
- •3-7. Oscillator
- •3-8. Holding (also called Sealed, or Latched) Contacts
- •3-9. Always-ON and Always-OFF Contacts
- •3-10. Ladder Diagrams Having More Than One Rung
- •Chapter 4 - Advanced Programming Techniques
- •4-1. Objectives
- •4-2. Introduction
- •4-3. Ladder Program Execution Sequence
- •4-5. RS Flip Flop
- •4-6. One Shot
- •4-8. T Flip Flop
- •4-9. J-K Flip Flop
- •4-10. Counters
- •4-11. Sequencers
- •4-12. Timers
- •Chapter 5 - Mnemonic Programming Code
- •5-1. Objectives
- •5-2. Introduction
- •5-3. AND Ladder Rung
- •5-4. Handling Normally Closed Contacts
- •5-5. OR Ladder Rung
- •5-6. Simple Branches
- •5-7. Complex Branches
- •Chapter 6 - Wiring Techniques
- •6-1. Objectives
- •6-2. Introduction
- •6-3. PLC Power Connection
- •6-4. Input Wiring
- •6-5. Inputs Having a Single Common
- •6-6. Output Wiring
- •6-7. Relay Outputs
- •6-8. Solid State Outputs
- •Chapter 7 - Analog I/O
- •7-1. Objectives
- •7-2. Introduction
- •7-3. Analog (A/D) Input
- •7-4. Analog (D/A) Output
- •7-5. Analog Data Handling
- •7-6. Analog I/O Potential Problems
- •Chapter 8 - Discrete Position Sensors
- •8-1. Objectives
- •8-2. Introduction
- •8-3. Sensor Output Classification
- •8-4. Connecting Discrete Sensors to PLC Inputs
- •8-5. Proximity Sensors
- •8-6. Optical Proximity Sensors
- •Chapter 9 - Encoders, Transducers, and Advanced Sensors
- •9-1. Objectives
- •9-2. Introduction
- •9-3. Temperature
- •9-4. Liquid Level
- •9-5. Force
- •9-6. Pressure/Vacuum
- •9-7. Flow
- •9-8. Inclination
- •9-9. Acceleration
- •9-10. Angle Position Sensors
- •9-11. Linear Displacement
- •Chapter 10 - Closed Loop and PID Control
- •10-1. Objectives
- •10-2. Introduction
- •10-3. Simple Closed Loop Systems
- •10-4. Problems with Simple Closed-Loop Systems
- •10-5. Closed Loop Systems Using Proportional, Integral, Derivative (PID)
- •10-6. Derivative Function
- •10-7. Integral Function
- •10-8. The PID in Programmable Logic Controllers
- •10-9. Tuning the PID
- •10-10. The “Adjust and Observe” Tuning Method
- •10-11. The Ziegler-Nichols Tuning Method
- •Chapter 11 - Motor Controls
- •11-1. Objectives
- •11-2. Introduction
- •11-3. AC Motor Starter
- •11-4. AC Motor Overload Protection
- •11-5. Specifying a Motor Starter
- •11-5. DC Motor Controller
- •11-6. Variable Speed (Variable Frequency) AC Motor Drive
- •11-7. Summary
- •Chapter 12 - System Integrity and Safety
- •12-1. Objectives
- •12-2. Introduction
- •12-3. System Integrity
- •12-4. Equipment Temperature Considerations
- •12-5. Fail Safe Wiring and Programming
- •12-6. Safety Interlocks

Chapter 7 - Analog I/O
Chapter 7 - Analog I/O
7-1. Objectives
Upon completion of this chapter, you will know
”the operations performed by analog-to-digital (A/D) and digital-to-analog (D/A) converters.
”some of the terminology used to describe analog converter performance parameters.
”how to select a converter for an application.
”the difference between a unipolar and bipolar converter.
”some common problems encountered with analog converter applications.
7-2. Introduction
Although most of the operations performed by a PLC are either discrete I/O or register I/O operations, there are some situations that require the PLC to either monitor an analog voltage or produce an analog voltage. As example of an analog monitoring function, consider a PLC that is monitoring the wind speed in a wind tunnel. In this situation, an air flow sensor is used that outputs a DC voltage that is proportional to wind speed. This voltage is then connected to an analog input (also called A/D input) on the
PLC. As an example of an analog control function, consider an AC variable frequency motor drive (called a VFD). This is an electronic unit that produces an AC voltage with a variable frequency. When connected to a 3-phase AC induction motor, it can operate the motor at speeds other than rated speed. VFD’s are generally controlled by a 0-10 volt DC analog input with zero volts corresponding to zero speed and 10 volts corresponding to rated speed. PLCs can be used to operate a VFD by connecting the analog output (also called D/A output) of the PLC to the control input of the VFD.
Analog input and output values are generally handled by the PLC as register operations. Input and output transfers are usually done at update time. Internally, the values can be manipulated mathematically and logically under ladder program control.
7-3. Analog (A/D) Input
Analog inputs to PLCs are generally done using add-on modules which are extra cost items. Few PLCs have analog input as a standard feature. Analog inputs are available in unipolar (positive input voltage capability) or bipolar (plus and minus input voltage capability). Standard off-the-shelf unipolar analog input modules have ranges of
7-1

Chapter 7 - Analog I/O
0-5 VDC and 0-10 VDC, while standard bipolar units have ranges of -5 to +5 VDC and
-10 to +10 VDC.
Specifying an Analog Input
There are basically three characteristics that need to be considered when selecting an analog input. They are as follows.
Unipolar (positive only) or bipolar (plus and minus)
This is a simple decision. If the voltage being measured cannot be negative, then a unipolar input is the best choice. It is not economical to purchase a bipolar input to measure a unipolar signal.
Input range
This is relatively simple also. For this specification, you will need to know the type of output from the sensor, system, or transducer being measured. If you expect a signal greater then 10 volts, purchase a 10 volt input and divide the voltage to be measured using a simple resistive voltage divider (keep in mind that, if necessary, you can restore the value in software by a simple multiplication operation). If you know the measured voltage will never exceed 5 volts, avoid purchasing a 10 volt converter because you will be paying extra for the unused additional range.
Number of Bits of Resolution
The resolution of an A/D operation determines the number of digital values that the converter is capable of discerning over its range. As an example, consider an analog input with 4 bits of resolution and a 0-10 volt range. With 4 bits, we will have 16 voltage steps, including zero. Therefore, zero volts will convert to binary 0000 and the converter will divide the 10 volt range into 16 increments. It is important to understand that with four binary bits, the largest number that can be provided is 11112 or 1510. Therefore, the largest voltage that can be represented by a 10 volt 4-bit converter is 10 / 16 * 15 = 9.375 volts.
In other words, our 10 volt converter is incapable of measuring 10 volts. All converters are capable of measuring a maximum voltage that is equal to the rated voltage (sometimes called VREF) times (2n-1)/(2n), where n is the number of bits. Since our converter divides the
10 volt range into 16 equal parts, each step will be 10/16=0.625 volt. This means that a binary value of 0001 (the smallest increment) will correspond to 0.625 volt. This is called the voltage resolution of the converter. Sometimes we refer to resolution as the number of bits the converter outputs, which is called the bit resolution. Our example converter has a bit resolution of 4 bits. It is important to remember that the bit resolution (and voltage resolution) of an A/D converter determines the smallest voltage increment that the converter can determine. Therefore, it is important to be able to properly specify the
7-2

Chapter 7 - Analog I/O
converter. If we use a converter with too few bits of resolution, we will not be able to correctly measure the input value to the degree of precision needed. Conversely, if we specify too many bits of resolution, we will be spending extra money for unnecessary resolution.
For a unipolar converter, the voltage resolution is the full scale voltage divided by 2n, where n is the bit resolution. As a rule of thumb, you should select a converter with a voltage resolution that is approximately 25% or less of the desired resolution. Increasing the bit resolution makes the voltage resolution smaller.
Consider the table below for a 4 bit 10 volt unipolar converter.
Step10 |
Step2 |
Vout |
0 |
0000 |
0.000 |
|
|
|
1 |
0001 |
0.625 |
|
|
|
2 |
0010 |
1.250 |
|
|
|
3 |
0011 |
1.875 |
|
|
|
4 |
0100 |
2.500 |
|
|
|
5 |
0101 |
3.125 |
|
|
|
6 |
0110 |
3.750 |
|
|
|
7 |
0111 |
4.375 |
|
|
|
8 |
1000 |
5.000 |
|
|
|
9 |
1001 |
5.625 |
|
|
|
10 |
1010 |
6.250 |
|
|
|
11 |
1011 |
6.875 |
|
|
|
12 |
1100 |
7.500 |
|
|
|
13 |
1101 |
8.125 |
|
|
|
14 |
1110 |
8.750 |
|
|
|
15 |
1111 |
9.375 |
The leftmost column shows the sixteen discrete steps that the converter is capable of resolving, 0 through 15. The middle column shows the binary value. The rightmost column
7-3

Chapter 7 - Analog I/O
shows the corresponding voltage which is equal to the step times the rated voltage times
(2n-1)/(2n). For our converter, this will be the step times 10 volts x 15/16. Again, notice that even though this is a 10 volt converter, the highest voltage that it can convert is 9.375 volts, which is one step below 10 volts.
Example Problem:
A temperature sensor outputs 0-10 volts DC for a temperature span of 0-100 degrees C. What is the bit resolution of a PLC analog input that will digitize a temperature variation of 0.1 degree C?
Solution:
Since, for the sensor, 10 volts corresponds to 100 degrees, the sensors outputs 10V / 100 degrees = 0.1 volt/degree C. Therefore, a temperature variation of 0.1 degree would correspond to 0.01 volt, or 10 millivolts from the sensor. Using our rule of thumb, we would need an analog input with a voltage resolution of 10 mV x 25% = 2.5 mV (or less) and an input range of 0-10 volts. This means the converter will need to divide its 0-10 volt range into 10 V / 2.5 mV = 4000 steps. To find the bit resolution we find the smallest value of n that solves the inequality 2n>4000. The smallest value of n that will satisfy this inequality is n=12, where 2n = 4096. Therefore, we would need a 12-bit 10 volt analog input. Now we can find the actual resolution by solving for a 12-bit 10 volt converter. The resolution would be 10v / 212 = 2.44 mV. This voltage step would correspond to a temperature variation of 0.0244 degree. This means that the digitized value will be within plus or minus 0.144 degree of the actual temperature.
Determining the number of bits of resolution for bipolar uses a similar method. Bipolar converters generally utilize what is called an offset binary system. In this system, all binary zeros represents the largest negative voltage and all binary ones represents the largest positive voltage minus one bit-resolution. To illustrate, assume we have an A/D converter with a range of -10 volts to +10 volts and a bit resolution of 8 bits. Since the overall range is 20 volts, the voltage resolution will be 20 volts / 28 = 78.125 mV. Therefore, the converter will equate 000000002 to -10 volts and 111111112 will become
+10 V - 0.078125 V = 9.951875 V. Keep in mind that this will make the binary number 100000002, or 12810 (called the half-range value) be -10 V + 128 x 78.125 mV = 0.000 V.
Consider the table below for a 4 bit 10 volt unipolar converter.
7-4

Chapter 7 - Analog I/O
Step10 |
Step2 |
Vout |
0 |
0000 |
-10.000 |
|
|
|
1 |
0001 |
-8.750 |
|
|
|
2 |
0010 |
-7.500 |
|
|
|
3 |
0011 |
-6.250 |
|
|
|
4 |
0100 |
-5.000 |
|
|
|
5 |
0101 |
-3.750 |
|
|
|
6 |
0110 |
-2.500 |
|
|
|
7 |
0111 |
-1.250 |
|
|
|
8 |
1000 |
0.000 |
|
|
|
9 |
1001 |
1.250 |
|
|
|
10 |
1010 |
2.500 |
|
|
|
11 |
1011 |
3.750 |
|
|
|
12 |
1100 |
5.000 |
|
|
|
13 |
1101 |
6.250 |
|
|
|
14 |
1110 |
7.500 |
|
|
|
15 |
1111 |
8.750 |
The leftmost column shows the sixteen discrete steps that the converter is capable of resolving, 0 through 15. The middle column shows the binary value. The rightmost column shows the corresponding voltage which is equal to the step times the voltage span times (2n-1)/(2n). For our converter, this will be the step times 20 volts x 15/16. Notice that digital zero corresponds to -10 volts, the half value point 10002 corresponds to zero volts, and the highest voltage that it can convert is 8.750 volts, which is one step below +10 volts.
It is important to understand that expanding the span of the converter (span is the voltage difference between the minimum and maximum voltage capability of the converter) to cover both positive and negative voltages increases the value of the voltage resolution which in turn detracts from the precision of the converter. For example, an 8-bit 10 volt unipolar converter has a voltage resolution of 10 / 28 = 39.0625 mV while an 8-bit bipolar 10 volt converter has voltage resolution of 20 / 28 = 78.125 mV.
7-5