- •1.1 TODO LIST
- •2. PROGRAMMABLE LOGIC CONTROLLERS
- •2.1 INTRODUCTION
- •2.1.1 Ladder Logic
- •2.1.2 Programming
- •2.1.3 PLC Connections
- •2.1.4 Ladder Logic Inputs
- •2.1.5 Ladder Logic Outputs
- •2.2 A CASE STUDY
- •2.3 SUMMARY
- •2.4 PRACTICE PROBLEMS
- •2.5 PRACTICE PROBLEM SOLUTIONS
- •2.6 ASSIGNMENT PROBLEMS
- •3. PLC HARDWARE
- •3.1 INTRODUCTION
- •3.2 INPUTS AND OUTPUTS
- •3.2.1 Inputs
- •3.2.2 Output Modules
- •3.3 RELAYS
- •3.4 A CASE STUDY
- •3.5 ELECTRICAL WIRING DIAGRAMS
- •3.5.1 JIC Wiring Symbols
- •3.6 SUMMARY
- •3.7 PRACTICE PROBLEMS
- •3.8 PRACTICE PROBLEM SOLUTIONS
- •3.9 ASSIGNMENT PROBLEMS
- •4. LOGICAL SENSORS
- •4.1 INTRODUCTION
- •4.2 SENSOR WIRING
- •4.2.1 Switches
- •4.2.2 Transistor Transistor Logic (TTL)
- •4.2.3 Sinking/Sourcing
- •4.2.4 Solid State Relays
- •4.3 PRESENCE DETECTION
- •4.3.1 Contact Switches
- •4.3.2 Reed Switches
- •4.3.3 Optical (Photoelectric) Sensors
- •4.3.4 Capacitive Sensors
- •4.3.5 Inductive Sensors
- •4.3.6 Ultrasonic
- •4.3.7 Hall Effect
- •4.3.8 Fluid Flow
- •4.4 SUMMARY
- •4.5 PRACTICE PROBLEMS
- •4.6 PRACTICE PROBLEM SOLUTIONS
- •4.7 ASSIGNMENT PROBLEMS
- •5. LOGICAL ACTUATORS
- •5.1 INTRODUCTION
- •5.2 SOLENOIDS
- •5.3 VALVES
- •5.4 CYLINDERS
- •5.5 HYDRAULICS
- •5.6 PNEUMATICS
- •5.7 MOTORS
- •5.8 COMPUTERS
- •5.9 OTHERS
- •5.10 SUMMARY
- •5.11 PRACTICE PROBLEMS
- •5.12 PRACTICE PROBLEM SOLUTIONS
- •5.13 ASSIGNMENT PROBLEMS
- •6. BOOLEAN LOGIC DESIGN
- •6.1 INTRODUCTION
- •6.2 BOOLEAN ALGEBRA
- •6.3 LOGIC DESIGN
- •6.3.1 Boolean Algebra Techniques
- •6.4 COMMON LOGIC FORMS
- •6.4.1 Complex Gate Forms
- •6.4.2 Multiplexers
- •6.5 SIMPLE DESIGN CASES
- •6.5.1 Basic Logic Functions
- •6.5.2 Car Safety System
- •6.5.3 Motor Forward/Reverse
- •6.5.4 A Burglar Alarm
- •6.6 SUMMARY
- •6.7 PRACTICE PROBLEMS
- •6.8 PRACTICE PROBLEM SOLUTIONS
- •6.9 ASSIGNMENT PROBLEMS
- •7. KARNAUGH MAPS
- •7.1 INTRODUCTION
- •7.2 SUMMARY
- •7.3 PRACTICE PROBLEMS
- •7.4 PRACTICE PROBLEM SOLUTIONS
- •7.5 ASSIGNMENT PROBLEMS
- •8. PLC OPERATION
- •8.1 INTRODUCTION
- •8.2 OPERATION SEQUENCE
- •8.2.1 The Input and Output Scans
- •8.2.2 The Logic Scan
- •8.3 PLC STATUS
- •8.4 MEMORY TYPES
- •8.5 SOFTWARE BASED PLCS
- •8.6 SUMMARY
- •8.7 PRACTICE PROBLEMS
- •8.8 PRACTICE PROBLEM SOLUTIONS
- •8.9 ASSIGNMENT PROBLEMS
- •9. LATCHES, TIMERS, COUNTERS AND MORE
- •9.1 INTRODUCTION
- •9.2 LATCHES
- •9.3 TIMERS
- •9.4 COUNTERS
- •9.5 MASTER CONTROL RELAYS (MCRs)
- •9.6 INTERNAL RELAYS
- •9.7 DESIGN CASES
- •9.7.1 Basic Counters And Timers
plc karnaugh - 7.1
7. KARNAUGH MAPS
Topics:
• Truth tables and Karnaugh maps
Objectives:
•Be able to simplify designs with Boolean algebra and Karnaugh maps
7.1INTRODUCTION
Karnaugh maps allow us to convert a truth table to a simplified Boolean expression without using Boolean Algebra. The truth table in Figure 7.1 is an extension of the previous burglar alarm example, an alarm quiet input has been added.
Given
A, W, M, S as before
Q = Alarm Quiet (0 = quiet)
Step1: Draw the truth table
S |
M |
W |
Q |
|
A |
|
|
|
|
|
|
0 |
0 |
0 |
0 |
|
0 |
0 |
0 |
0 |
1 |
|
0 |
0 |
0 |
1 |
0 |
|
0 |
0 |
0 |
1 |
1 |
|
0 |
0 |
1 |
0 |
0 |
|
0 |
0 |
1 |
0 |
1 |
|
0 |
0 |
1 |
1 |
0 |
|
0 |
0 |
1 |
1 |
1 |
|
0 |
1 |
0 |
0 |
0 |
|
0 |
1 |
0 |
0 |
1 |
|
1 |
1 |
0 |
1 |
0 |
|
0 |
1 |
0 |
1 |
1 |
|
0 |
1 |
1 |
0 |
0 |
|
0 |
1 |
1 |
0 |
1 |
|
1 |
1 |
1 |
1 |
0 |
|
0 |
1 |
1 |
1 |
1 |
|
1 |
plc karnaugh - 7.2
Figure 7.1 Truth Table for a Burglar Alarm
Instead of converting this directly to a Boolean equation, it is put into a tabular form as shown in Figure 7.2. The rows and columns are chosen from the input variables. The decision of which variables to use for rows or columns can be arbitrary - the table will look different, but you will still get a similar solution. For both the rows and columns the variables are ordered to show the values of the bits using NOTs. The sequence is not binary, but it is organized so that only one of the bits changes at a time, so the sequence of bits is 00, 01, 11, 10 - this step is very important. Next the values from the truth table that are true are entered into the Karnaugh map. Zeros can also be entered, but are not necessary. In the example the three true values from the truth table have been entered in the table.
Step 2: Divide the input variables up. I choose SQ and MW
Step 3: Draw a Karnaugh map based on the input variables
|
M W (=00) MW (=01) |
MW (=11) |
MW (=10) |
S Q (=00) |
|
|
|
SQ (=01) |
|
|
|
SQ (=11) |
1 |
1 |
1 |
SQ (=10) |
|
|
|
Added for clarity
Note: The inputs are arranged so that only one bit changes at a time for the Karnaugh map. In the example above notice that any adjacent location, even the top/bottom and left/right extremes follow this rule. This is done so that changes are visually grouped. If this pattern is not used then it is much more difficult to group the bits.
Figure 7.2 The Karnaugh Map
When bits have been entered into the Karnaugh map there should be some obvious patterns. These patterns typically have some sort of symmetry. In Figure 7.3 there are two patterns that have been circled. In this case one of the patterns is because there are two bits beside each other. The second pattern is harder to see because the bits in the left and right hand side columns are beside each other. (Note: Even though the table has a left and right hand column, the sides and top/bottom wrap around.) Some of the bits are used more than once, this will lead to some redundancy in the final equation, but it will also give a simpler
plc karnaugh - 7.3
expression.
The patterns can then be converted into a Boolean equation. This is done by first observing that all of the patterns sit in the third row, therefore the expression will be ANDed with SQ. Next there are two patterns in the second row, one has M as the common term, the second has W as the common term. These can now be combined into the equation. Finally the equation is converted to ladder logic.
Step 4: Look for patterns in the map |
|
|
|
|
|
|
|||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MW |
|
|
|
|
M is the common term |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
M |
W |
MW |
MW |
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
S |
|
Q |
|
|
|
|
|
|
|
|
|
|
||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SQ |
|
|
|
|
|
|
|
|
all are in row SQ |
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SQ |
1 |
|
|
|
1 |
1 |
|
|||||||||||||
|
|
|
|
|
|
||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
|
SQ |
|
|
|
|
|
|
|
|||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
is the common term |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
W |
|
Step 5: Write the equation using the patterns |
A = S Q ( M + W)
Step 6: Convert the equation into ladder logic
M |
|
S |
|
Q |
A |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
W
Figure 7.3 Recognition of the Boolean Equation from the Karnaugh Map
Karnaugh maps are an alternative method to simplifying equations with Boolean algebra. It is well suited to visual learners, and is an excellent way to verify Boolean algebra calculations. The example shown was for four variables, thus giving two variables for the rows and two variables for the columns. More variables can also be used. If there were five input variables there could be three variables used for the rows or columns with the pattern 000, 001, 011, 010, 110, 111, 101, 100. If there is more than one output, a Karnaugh map is needed for each output.
plc karnaugh - 7.4
Aside: A method developed by David Luque Sacaluga uses a circular format for the table. A brief example is shown below for comparison.
A |
B |
C |
D |
X |
|
|
|
|
|
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
1 |
1 |
|
|
|
|
|
Convert the truth table to a circle using the Gray code for sequence. Bits that are true in the truth table are shaded in the circle.
1001 |
1000 |
0000 |
|
||
|
0001 |
|
|
|
|
1011 |
|
0011 |
|
|
|
1010 |
|
0010 |
|
|
|
1110 |
|
0110 |
1111 |
|
0111 |
1101 |
|
0101 |
|
1100 |
0100 |
|
|
Look for large groups of repeated patterns.
1. In this case ’B’ is true in the bottom half of the circle, so the equation becomes,
X= B ( … )
2.There is left-right symmetry, with ’C’ as the common term, so the equation becomes
X= B C ( … )
3.The equation covers all four values, so the final equation is,
X= B C
Figure 7.4 Aside: An Alternate Approach
7.2SUMMARY
•Karnaugh maps can be used to convert a truth table to a simplified Boolean equation.