Zibb
Subscribe to Control Engineering
FirstLight
Email
Print
Reprint
Learn RSS

Karnaugh mapping aids industrial control

Lyle R. Hurst, ITT Technical Institute and Gary Mintchell, Senior Editor -- Control Engineering, 1/1/2000

Industrial PLC programmers face many problems. Among them: reducing scan time so lower cost PLCs can be used; eliminating 'bugs' in ladder logic rungs; and reducing maintenance costs on old ladder logic.

Karnaugh mapping can help with all these problems. Karnaugh mapping is a systematic and pictorial way of applying Boolean algebra to reduce complex digital problems.

An example of Karnaugh mapping could begin with writing an organized statement about the conditions for going on a picnic. In this case, the alternatives are Sunday and Clear and Calm or Sunday and Clear and Windy. Common sense analysis of the logic says it doesn't matter whether the wind blows, so the picnic statement becomes Sunday and Clear, a much simpler statement (see diagram).

The picnic statement in ladder logic looks something like this:

As the ladder logic shows, the picnic rung is enabled whether it is calm or not calm-so the rung can be written in a simpler form that reduces scan time:

More complicated programs require a more systematic approach for analysis. The principles of Boolean algebra fit that requirement.

The first step is to make a clear problem statement. The next step is to construct a truth table. The truth table uses all combinations of all variables of the problem-day of week, cloudiness, and wind conditions.

An example of the truth table for the picnic problem includes numeric representations in a binary form that make the truth table easier to manipulate.

A = Day of week 1 = Sunday 0 = Other
B = Cloud cover 1 = None 0 = Cloudy
C = Wind conditions 1 = Calm 0 = Windy

4 2 1
A B C Picnic
0 0 0 0 0
1 0 0 1 0
2 0 1 0 0
3 0 1 1 0
4 1 0 0 0
5 1 0 0 0
6 1 1 0 1
7 1 1 1 1

A truth table has a column for every variable. When you let the number of variables = n, a truth table has 2 to the power n rows.

The next step is to construct a Karnaugh (K) map. The K map is square or rectangular in the proportions 2 to 1 and contains 2 to the n squares-one for each row of the truth table. The three-variable map for our picnic problem is rectangular and has eight squares-one for each row of the truth table.

The squares are numbered the same as the rows on the truth table. However, there is a method to the numbering-such that rows represented by the numbers vary by only one variable in adjacent squares. In this way, adjacent squares represent variables that can be removed.

The following is a typical three-variable map:

_
C


C

0

000

1

001

2

010

3

011

6

110

7

111

4

100

5

101

Now, the picnic's truth table can be mapped on the three-variable K map. Row numbers on the truth table correspond exactly to square numbers in the K map. Each square also has a three-digit binary number for the row on the truth table. Notice that adjacent squares vary by only one bit. The result number is represented in bold type.

_
C

C
0

0

000

0

1

001

0

2

010

0

3

011

1

6

110

1

7

111

0

4

100

0

5

101

The two paths of ladder logic are represented by lines six and seven on the truth table. Their appearance in adjacent squares on the K map indicates a condition for rung (logic) reduction. The entire rung is represented by A and B (the first and second bits) with bit C being superfluous. Therefore, if A and B are true, then we go on the picnic! This is the same result we got by applying common sense.

K maps work, but isn't common sense faster? For this level of problem, yes. However, we are laying a foundation for more challenging problems using and establishing a design methodology.

Back in the early days of computers and integrated circuits-after discrete components and before microprocessors-computer integrated circuits were built with bit slice Arithmetic Logic Units. Suppose we have a simple PLC with no math instructions and we need to add two eight-bit numbers. Do we spend $5,000 for a capable PLC or is there some technology that we can use to save money?

The specification calls for a bit slice adder. A truth table for one slice woud look like this:

A B C Carry out Sum
0 0 0 0 0 0
1 0 0 1 0 1
2 0 1 0 0 1
3 0 1 1 1 0
4 1 0 0 0 1
5 1 0 1 1 0
6 1 1 0 1 1
7 1 1 1 1 1

For this problem, two three-variable maps are needed, one for the Carry out and one for the Sum.

Carry out

 

 

Sum
_
C

C
_
C

C

0

000

1

001

_    _
A   B

0

000

1

1

001

2

010

1

3

011

_      
A   B

1

2

010

3

011

1

6

110

7

111


A   B

6

110

1

7

111

4

100

6

110

    _
A   B

1

4

100

6

110

Write the boolean equation for each adjacent pair of two.

AC+BC+AB = Co

 

This one cannot be simplified, so each one gets a boolean term.

_ _    _   _              _
ABC+ABC+ABC+ABC = Sum

The ladder logic from the equation would look like this:

Putting it together-an 8-bit adder

Maintenance follows much the same approach as design, except that a truth table must be constructed from the old rung. A traditionally designed rung such as:

would have a truth table that looks like this:

  A B C D O
0 0 0 0 0  
1 0 0 0 1  
2 0 0 1 0  
3 0 0 1 1  
4 0 1 0 0  
5 0 1 0 1 1
6 0 1 1 0  
7 0 1 1 1 1
8 1 0 0 0  
9 1 0 0 1 1
10 1 0 1 0  
11 1 0 1 1  
12 1 1 0 0  
13 1 1 0 1  
14 1 1 1 0  
15 1 1 1 1 1

The truth table can then be maintenanced and K mapped to form the new rung.

The next step in PLC logic minimization may be to devise rung software or a hand held rung calculator to perform rung minimization. If PLC manufacturers decide to include this rung minimization software in their design packages, a handheld rung calculator would soon become obsolete. A feature of a rung minimization algorithm is rung entry and optimization using the engineer's favorite methods.

Good luck and good logic!

For more information, a good book on Karnaugh mapping is Computer Logic Design by M. Morris Mano, Prentice Hall, 1972. For a more complete Karnaugh mapping discussion, visit www.controleng.com .


Author Information
Lyle R. Hurst, electronics instructor, ITT Technical Institute, Arnold, Mo., and Gary Mintchell, senior editor, gmintchell@cahners.com

Email
Print
Reprint
Learn RSS

Talkback

We would love your feedback!

Post a comment

» VIEW ALL TALKBACK THREADS

Related Content

Related Content

 

By This Author

There are no other articles written by this author.

Sponsored Links

 

Advertisement
SPONSORED LINKS

More Content

  • Blogs
  • Discussions
  • Webcasts
  • Podcasts
  • Videos

Blogs

  • Peter Welander
    Pillar to Post: Peter Welander's Blog

    January 7, 2009
    Is nothing growing in manufacturing?
    Manufacturing is down. You might have already heard something to this effect, but the extent of the economic downturn in December may surprise you.......
    More
  • Paul Grayson
    AIMing for Automated Vehicles

    January 7, 2009
    Personal Rapid Transit - Part 2
    Morgantown/WVU - PRT Guideway THE GUIDEWAY This is what the guideway looks like in a recent photo. The guideway is the single most complex ......
    More
  • View All BlogsRSS

Webcasts

Engineering-driven Ethernet
This Control Engineering Roundtable Webcast will address the engineering issues you should be aware of when exploring the adoption of Ethernet or when looking to expand its use in your facility.

Bridging gaps with wireless
Discover how you can create stronger, flexible and cost-effective wireless connections for your entire plant. Register today!

View All Webcasts

Podcasts

Integration platforms such as EDDL and FDT/DTM help integrate increasingly intelligent instrumentation and devices with control and asset management systems. This audio tutorial helps you understand how these platforms operate and what they can do.
Integration Platforms: EDDL and FDT/DTM
Integration platforms such as EDDL and FDT/DTM help integrate increasingly intelligent instrumentation and devices with control and asset management systems. This audio tutorial helps you understand how these platforms operate and what they can do. Hear It Now

View All Podcasts Subscribe Now to Process Control & Instrumentation and never miss an episode
Advertisements





NEWSLETTERS

Get engineering industry news, trends, and business-critical information delivered directly to your inbox!

Click on a title below to learn more.

Weekly News (Weekly)
Process Instrumentation & Sensors (Monthly)
System Integration Monthly (Monthly)
Process & Advanced Control (Monthly)
Machine Control (Monthly)
Information Control (Monthly)
Automation Control (Monthly)
Product Review (Monthly)
Sustainable Engineering (Monthly)
Simplified Safety
Fieldbus Facts
PROFInews North American Edition
About Us   |   Advertising Info   |   Site Map   |   Contact Us   |   Useful Sites   |   FREE Subscription   |   RSS
© 2009 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy
Please visit these other Reed Business sites