Documente Academic
Documente Profesional
Documente Cultură
EEET-2251
Table of Contents
1 Introduction........................................................................5
1.1 Example Digital Systems......................................................7
1.2 Basic Educational Theory.....................................................8
1.3 Occupational Health & Safety............................................12
2 Basic Electronics...............................................................13
2.1 Components, Schematics and Wiring Diagrams................14
2.2 Construction Techniques....................................................18
2.3 DC Voltage, Current, Power and Resistance......................22
2.4 Kirchoff's Laws...................................................................27
2.5 The Multimeter...................................................................29
2.6 Time Varying (AC) Voltages..............................................31
2.7 Diodes, LEDs, BJTs, & FETs.............................................33
2.8 Capacitors............................................................................36
2.9 Inductors..............................................................................38
2.10 Switches and Relays.........................................................39
2.11 Integrated Circuits.............................................................42
2.12 HC Logic...........................................................................44
3 Digital Electronics.............................................................45
3.1 Combinational Logic..........................................................46
3.2 Boolean Algebra.................................................................50
3.3 Combinational Logic Minimization...................................52
3.4 Simulators............................................................................59
3.5 State Diagrams....................................................................60
3.6 Sequential Logic.................................................................65
3.6.1 Synchronous Logic............................................................66
3.6.2 Synchronous Logic Example 1..........................................71
3.6.3 Synchronous Logic Example 2..........................................72
3.6.4 Finite State Machine Using Memory.................................79
3.6.5 Timing Calculations...........................................................80
3.7 Digital Device Zoo..............................................................82
3.8 Logic Families & Compatibility.........................................85
3.9 Programmable Logic...........................................................89
4 Testing and Debugging....................................................91
4.1 Specific Testing/Debug Methods.......................................94
4.2 Intermittent Faults...............................................................98
4.3 Digital Design Construction & Debugging......................100
4.3.1 Time Management...........................................................100
4.3.2 Simulation........................................................................100
4.3.3 Basic Soldering................................................................100
4.3.4 Devices & Wiring............................................................101
4.3.5 Breadboards.....................................................................101
Copyright © Pj Radcliffe 2018 Page 2
EEET-2251 Digital Systems Design 1 :
1 Introduction
Before talking about the course content there are fundamental
principles about university education that you must understand.
QUESTION: what makes a graduate attractive to an employer at the job application and
interview? You need to know this as not all graduates get a job!
• Marks average better than 65-70%.
• Professional skills: reliable, timely, good work ethic, easy to manage, works well in a team
or as an individual, pleasant and helpful, knows when to report, shows initiative.
• Communication skills: both written and oral, and the ability to work with clients.
• Design ability: be able to work with clients to create a requirements statement, propose a
solution path at a system level, propose subsystems, implement subsystems and systems,
test and commission a subsystem and system.
The professional and communication skills are sometime called the “soft skills”.
EMPLOYERS are quite clever and they have good ways to evaluate your abilities. They value
demonstrated achievements over potential ability.
Marks are used as a hurdle to be allowed to the next level of evaluation. You must get over
each hurdle, and acquire real engineering and soft skills in order to get a job.
IMPLICATIONS FOR YOU: your university career must be a dedicated period where you as
an individual must strive to identify and acquire all of the above attributes. Marks are only one
part of the equation.
Make sure you build a portfolio of proven abilities that you can take to the job interview.
Consider the following statements on your CV, perhaps backed up by photos-
• As an optional activity I …
• I designed and built the communications system for RMIT's electric racing car.
• I designed and built a novel power controller for solar panels.
• I designed and built an Android controlled front door lock.
HOW WILL THIS COURSE HELP YOU? This course will help you become an employee
who is attractive to an employer, and help you get ready for later courses.
The emphasis of this course is design though there is opportunity to gain other attributes as
well.
• Design process: you will learn and practice the process of reading requirements analysis,
system design, subsystem design, implementation, and testing.
• Formal methods: you will learn formal methods such as block diagrams, state diagrams,
and more.
• Basic knowledge: you will learn the basics of electronic and digital systems.
• Actual design: you will use formal methods to build real electronic and digital circuits.
• Professional behavior: we will talk about and practice some important behaviors valued in
industry.
GO FURTHER? These notes give a bare outline of what you should master. Particularly if
you are interested, use the web or a good text book to learn more. If you find anything
confusing again consult these references.
Illustration 5: Quadcopter
Learning things and doing the work yourself is hard Delayed Gratification: the ability
work but worthwhile. The ability to work now, for to ignore immediate desires (avoid
benefits later, is called “delayed gratification” and is a work) to gain a superior long term
key feature of successful people. gain (competency and a job).
HAVE A GOAL: self motivation and learning is improved if you have a goal. There are a
whole range of goals and activities to discover goals-
• Employers: what employers do you like? Check www.adzuna.com.au and www.seek.com.
Next work out what technical and professional skills the employers are after and work on
those skills.
• Marks: always a good goal and the first filter for job interviews.
• Enjoy: what areas inspire you? Work on them and see if you can turn it into a career.
PROACTIVE: in primary school you waited for the teacher to give you material and to tell
you what to do. Professionals take charge of their own education, they use the resources
available but plan what to do and then execute those plans.
Question: do you just wait to be told what to do?
IMPORTANT !!! This section is the most important part of the notes and I urge you to reread
it carefully and think how you can become a better professional.
In this course exam questions will be asked about this material!
Your job interviews will certainly focus on this material!
AUSTRALIA has strict laws that require Different Times, Different Cultures
management and workers to be proactive in
identifying hazards and removing hazards. All What is acceptable OH&S varies with
staff should have OH&S training. Enterprises time and with culture.
must develop OH&S guidelines that minimize • Germany brought in the first
hazards. workers protections in 1884.
Employers must have OH&S insurance and Before that there was no
premiums rise significantly for a bad accident compensation for workplace
record. accidents and many workplaces
had appalling accident records.
All RMIT staff must pass an OH&S on-line test
every 2 years. The following is copied from that • In Australia there were 184
course! accidental deaths at work in 2014.
7000 deaths each year are related
to work related diseases.
Hazards can generally be put into five main Total costs are estimated at 5%
categories: GDP.
1. Environmental (e.g. lighting, noise, air quality, • Australia has tough OH&S laws,
temperature); and low accident rates.
2. Materials (e.g. wood, metals, fabrics, plastics, • Many 3rd world countries have
chemicals);
much worse OH&S which reduces
3. Design and management of programs (e.g. employers costs but can devastate
supervision, scheduling, facilities); workers.
4. Equipment and machines (e.g. tools, machinery,
electrical, plant and equipment);
See http://www.safeatwork.org.au/about-us/what-ohs
5. Work processes (e.g. safe work instructions, how
we perform activities, training and induction).
RMIT Students are required to work within the RMIT guidelines. You will be required to
watch the OH&S video and read OH&S rules before you can be in the labs.
2 Basic Electronics
This chapter aims to help
Aside: Associative Memory
you understand the basics of
electricity and the components The human brain has a remarkable ability to link facts
that you will use in your projects. and so help you generate solutions to problems.
As in the box opposite, you must Have you ever thought about a problem and then some
build up your knowledge base in time later the solution “pops” into your mind? Quite
order to be good at design and unconsciously your brain has been pattern matching the
solving problems. problem statement and your knowledge. When it finds a
match this is placed into your conscious mind.
If you succeed in building your
knowledge base then engineering To use this remarkable ability you must clearly state the
becomes something you can problem in your own mind, and have a huge knowledge
understand, control, and fix if it of the problem domain (engineering). You must start
goes wrong. If you do not have building your knowledge base now and continue adding
this knowledge base then to it all your life.
engineering becomes very Associative memory, or intuitive problem solving, is
confusing and you will be lost if only one method of solving problems but a particularly
the lab instructions are the powerful one.
slightest bit wrong or incomplete.
WATER ANALOGY: to help you gain a conceptual or gut feel for electricity it is useful to
form an analogy with water. The match between water and electricity is not ideal but enough to
give you that feel.
Water-Electricity Analogy
Water Based Feature Electrical equivalent.
Water flows through pipes. Electrons are like an electron fluid that
flows through conductive wires (usually a
metal). Electrons do not flow through
insulators (usually non-metals).
Plumbing devices control the flow of water, Electrical devices can control the flow of
for example thin pipes, and one way valves. electricity and have a water equivalent, for
example resistors and diodes.
Loop? Water may have a source but it can be Loop! Electricity sources have two
left anywhere. There is no need for water to terminals, electrons must flow out one and
be returned to the source. via a conductive loop back into the other.
The water-electricity analogy is not perfect,
but good enough to be very useful.
KEY DIFFERENCES: the symbols are similar for most simple IEEE ANSI
electronic components with the exception of resistors and logic gates. Resistor Symbol
ANSI SYMBOLS are shown on the next page. Detailed explanations of the component types
is be given later.
DIGITAL GATES have quite different representation. Below are the IEC, ANSI US, and a
German standard.
• Bare copper wire can be cut easily cut and bent into shape. Be careful to only use this
approach when there is no danger of short circuits between this wire and other wires or
component leads. Off cuts from resistors can be used as short links.
SOLDERING USES low melting point metals that can be melted with a soldering iron and
spread across metal surfaces. When the solder cools the metal pieces are held together with an
electrically conductive metal bond.
Make sure you view the soldering video to understand more about this process. Incorrect
technique may result in bonds that break (usually just before you are being marked), or look
good but have no electrical contact.
Electronic solders are low melting point alloys and must be eutectic; they go from solid to
liquid without a paste state of mixed solid and liquid. Lead-tin solder melts at about 188 deg C
and is no longer favored due to lead toxicity. Lead free solder based on Tin-Copper-Silver
melts around 230 deg C and is more brittle than Tin-Lead. Most solders also contain a flux
which dissolves any metal oxide which stops solder bonding to a surface.
MATRIX BOARD is a circuit board with a regular matrix of holes, usually 0.1 inch pitch to
match the leg separation of integrated circuits. Some boards have copper rings on each side of
the board, and copper through the holes to help soldering. Components are connected by
bending their legs and soldering, and by adding wires and soldering.
Matrix board is robust and a good technique if you are reasonably certain of your circuit.
Changes are quite possible though slower than a breadboard.
DC POWER SUPPLIES: all DC (Direct Current) power supplies have a plus (+) and minus (-)
terminal.
• Electrons flow from the – the the + terminal.
• Conventional current is said to flow from the + to
the – terminal.
Yes this is silly, but electricity was used long
before the negatively charged electron was
discovered. Rather than rewrite the text books
about which way current flowed, the concept of
conventional current and electron current
(opposite direction) was developed. Illustration 18: Conventional and Electron Currents
All circuit theory uses conventional current which
flows from + to -.
Examples of DC power supplies include-
• Primary batteries can supply voltages in the range of 1 to 3
volts, and can be put in series to increase voltages. They
convert chemical energy to electrical energy and when
exhausted are thrown away, or even better recycled.
• Secondary batteries and like primary batteries but can be
recharged.
• Power supplies are generally powered from mains
electricity (which is not DC) and convert this to DC. A Illustration 19: Batteries
good example are the 5 volt USB chargers used by most
phones and tablets.
• DC lab power supplies are usually mains electricity
powered and deliver one or more independent DC
supplies. They have meters to show you voltage and
current in any supply, can adjust voltage, and may set an
upper current limit (so as not to destroy circuits).
POWER AND ENERGY: the power that comes out of a Illustration 20: Lab DC Power Supply
battery or power supply can be calculated from the voltage
and current.
P=V*I V = voltage in volts, I = current in amps, P = power in watts.
E=P*t E=energy in joules, t = time period in seconds.
Other energy units ( power * time) are amp-hours (A-h), milliamp-hours (ma-h), and kilowatt-
hours (kW-h). Examples include-
• A 1.5v AAA alkaline battery has a capacity of 1-2 A-h.
• A typical lead-acid car battery is 40 A-h.
RESISTANCE is a basic feature of water pipes and electrical conductors. Some energy is lost
as the current flows through.
equation P=V*I
P = V2/R = I2*R
COLOR CODES: resistors are frequently defined by color codes. You will need to learn these
codes, though as a slow back up you can use a multi-meter to measure their values.
Loop 2
Loop 1
one circuit of the loop and pick up a net velocity. It
r4
could loop around and around the loop steadily
building up energy without limit and violate r2
conservation of energy laws. r5
WHERE WILL YOU USE A MULTIMETER? Your electronic projects will seldom work
the first time. You will use the multimeter to work out what has gone wrong. The normal
approach is to start with the inputs and work towards the outputs. Connect the black lead to
zero volts and use the red lead to probe your circuit. First check batteries or power supply at
the point where it is connected to your circuit, then check other places. You will find common
problems such as-
• Misconnected and broken wires.
• Things connected the wrong way round, such as the battery.
• Wrong value component, for example you misread the resistor color code.
Ammeter
Variable
Voltage A Voltmeter
VI CURVES: if you have two multimeters then
you can create a Voltage-Current (V-I) graph for
a component. It's best to use a laboratory power R V
supply where you can easily vary the voltage.
Note that voltage and current can go negative
I
(the power supply gets turned around). For
Illustration 38: Measuring VI Curve
resistors the graph is a straight line but this is not
so for many other devices.
V (Voltage)
X
X
X
X
X I (Current)
FREQUENCY: if the waveform has a repeating shape, such as the mains sine-wave, then it is
said to have a frequency.
Frequency in Hertz (Hz) = number of repeated cycles per second.
kHz = kilohertz = 1e3 =1000 Hz
MHz = megahertz = 1e6 = 1,000,000 Hz
GHz = gigahertz = 1e9 = 1,000,000,000 Hz
THz = terrahertz = 1e12 = 1,000,000,000,000 Hz
DIODES conduct electricity in one direction but not the other cathode
Electrical
direction. In water analogy terms they are a one way valve.
current.
Forward bias: if the voltage from anode to cathode is positive the
Water
diode will conduct and is said to be forward biased. anode
There will be a fixed forward voltage drop that depends on the
Illustration 44: Diode Analogue
material, typically 0.65 volts for silicon.
Reverse bias: if the voltage from anode to cathode is negative
the diode will not conduct and is said to be reverse biased.
There will be a leakage current back through the diode which
depends on the technology, typically nanoamps for silicon.
A diode must be inserted the right way, it is a polarized Illustration 45: Diode Images
device. Note the bar on the diode bodies which matches the
bar on the diode symbol cathode.
Germanium diodes can be used for small currents and have a forwards drop of 0.3 volts.
Schottky diodes ( Si-metal) have a drop of 0.1 volts.
Water
Controlled
Common bipolar transistors can switch base current.
currents ranging from microamps to 20 emitter
amps. The beta ( β) ranges from 20 to Illustration 48: BJT
around 300.
Ib Ic
c
b
0.65v
e drop
e.
Ic = β * Ib
Illustration 49: NPN BJT Model
The gate voltage must move beyond the threshold voltage + gate Controlled
Controlling current.
Vt to get any current to flow. MOSFETs are more voltage.
complicated that the simple linear model shown below - source
but this is a good mental model to start with.
P Channel MOSFET
MOSFETs are better at handling high power and high
drain
frequencies than BJTs. BJTs tend to be cheaper than an
equivalent MOSFET. - gate Controlled
Controlling current.
voltage.
Packing for MOSFETs looks very similar to BJTs, only + source
the part number marking is different. Illustration 52: MOSFET Device
2.8 Capacitors
A capacitor is a 2 terminal device that
Water tank Capacitor Symbol
stores electric charge, usually by having two analogy. construction.
conducting surfaces close to each other.
Using the water analogy a capacitor is like a Water
large water tank with an outlet at the bottom. Water
• The water pressure at the tank outlet is
Illustration 55: Capacitance
like the voltage across an electronic
capacitor.
Hydraulic Diaphragm
• If the outlet is opened then a lot of water (electricity) Model of Capacitance
can be supplied at the given water pressure (voltage).
If the the outlet is open a long time the water level and
water pressure fall.
• A tank can be emptied, or filled up via the outlet.
CAPACITOR TYPES: there is a huge variety of capacitors varying from picofarads (10-12 of a
farad) to thousands of farads. There are also many different construction methods which leads
to different properties. There are two types you will be dealing with-
• Ceramic capacitors may look like any of the seven left hand capacitors in the diagram
below. They can be inserted in either direction. Ceramics are usable at high and low
frequency.
Common values are between 10 picofarad (pf = 10-12 of a Farad) and 100 nanofarad ( nF =
10-9 of a Farad).
• Electrolytic capacitors are general of larger value but do not work well at higher
frequencies. The three right hand capacitors below are typical electrolytic capacitors.
*** Electrolytics are polarized, the + lead must be connected to a voltage more positive
than the other lead. Some capacitors label the negative lead (-) instead.
Common values range from 10 microfarad (uF = 10-6 Farad) to a Farad.
VALUES: most capacitors have their value written on them, though working out what the
marking means can be difficult. A few have color bars and can be read as per the resistor color
code.
Capacitors often have a maximum rated voltage (note the red capacitor above). Exceeding this
voltage may cause damage.
2.9 Inductors
An inductor is a two terminal device that
stores energy in its magnetic field. This field is Inductor water analogue.
created by electric current flowing through the
device.
Using the water analogue an inductor is like a
long pipe where the weight of water flowing
Water with weight and inertia.
down the pipe has a lot of inertia.
• If the water in the pipe is not flowing then it
takes some energy to get it up to speed. Inductor symbol
Illustration 59: Inductance
• If water is flowing, and the end of the pipe
is suddenly closed, then the water pressure
at the closure can rise dramatically, perhaps even bursting the outlet ( for an inductor
causing a spark or damaging a component).
CONSTRUCTION: inductors are made from coils of wire and often have a ferrous core which
increases their inductance.
NO/NC: NO (Normally Open) switches are those that are an open circuit normally. When they
are pushed or activate the are closed to make a short circuit.
NC (Normally Closed) are the reverse way around, normally closed and open on activation or a
push.
BREAK/MAKE: a switch or contact which is open circuit is said to be in the “break” state.
A switch or contact which is a short circuit is said to be in the “make” state.
LATCHED SWITCHES use the same physical action to cycle between their available states.
Some light switches are like a click biro, push to turn on, the same push a second time turns the
switch off.
V & I LIMITS: switches all have voltage and current limits. If the voltage is too high there
may be electrical arcing. If the current is too high then the mechanical contacts will be
damaged by sparking or electrical heating.
Driving a large capacitive load is a problem as capacitors can supply a lot of current and
damage the contacts. A series resistor is often used to limit the current.
Driving a large inductive load is a problem as when the inductor is turned off it can generate a
spark and damage the contacts. Diodes are often used to allow a path for the inductor current.
MOORE'S LAW: in the early 1960's competitive pressures encouraged manufacturers to cram
more and ever smaller transistors onto a chip to get more complex functionality, lower costs,
and lower power drain. This led to Moore's law ( Moore was the joint founder of Intel); that
transistor density would double every two years. Moore's law has led to the most amazing
growth in digital IC complexity and decreased costs of manufacture.
2.12 HC Logic
The labs will use the HC logic family and this section will introduce you to the basics of
how these gates work. The later chapter on Digital Electronics will explain logic gates in detail.
POWER: the IC needs power to function properly. For the NAND gate above pin 7 must be
connected to zero volts, and pin 14 to +5 volts. This power can come from the clock board.
INPUTS AND OUTPUTS: +5 volt HC logic inputs must be Pin 1 Pin 2 Pin 3
driven either high ( > 3.5 volts) or low ( < 1.5 volts). The
0 0 1
output will be either high or low and depends on the inputs
as per the following truth table. 0 1 1
1 0 1
1 1 0
BASIC CONNECTIONS: the image below shows some
basic connections to get the power to the IC and drive the
inputs. The inputs and output can be observed with a multi-
meter, or a series resistor and LED.
3 Digital Electronics
In digital electronics the state of any point
240v AC Mains Logic
can be considered to be a zero or a one. With most
logic implementations, the logical state corresponds A B
to a voltage range. Z
These ones and zeros may be manipulated by logic 240v Lamp 1 = 240 volts.
gates to achieve a given purpose. In the diagram mains 0 = 0 volts.
opposite the switches and the HC logic gate are
performing the same function; only when both
inputs A and B are active will the output Z be 5 volt HC (CMOS) Logic
active. A 1 > 3.85 volts.
B & Z 0 < 1.35 volts.
Illustration 71: Logic Voltages
LOGIC GATES can be built from switches,
diodes, or bought as semiconductor gates in integrated circuits.
COMBINATIONAL LOGIC outputs depend solely on the inputs and have no memory of past
events. There is no feedback path from an output back to the inputs.
SEQUENTIAL LOGIC outputs may depend on inputs plus the memory of past events. To
achieve this memory there will be some feedback of an output back to the inputs.
BINARY: digital logic uses the binary number system. If you have not been introduced to this
before please read the appendix section which talks about number systems.
SWITCH NOTATION: switches shown as open are called Normally Open and require a
logical one to close them. Switches shown as closed are called Normally Closed and require a
logical one to open them.
Gate Truth Symbol ( IEC / Boolean Logic Switch & Diode Equivalent
Table ANSI) Alternatives
AND A B
AB Z Z=A.B
Source Load
00 0 Z=A*B
01 0 Z = AB
A
10 0 Z=A&B +voltage
11 1 Z=A^B B
A&B
Z=1 if all Z = A AND B
inputs=1. 0v
OR Source
AB Z Z=A+B A
00 0 Z=A|B B Load
01 1 Z=AvB
10 1 Z = A OR B A
11 1 0v
B
Z=1 if any A or B
input=1. 0v
Gate Truth Symbol ( IEC / Boolean Logic Switch & Diode Equivalent
Table ANSI) Alternatives
NOT
Z = NOT A
A Z Z=A Source Load
0 1 Z=!A .
1 0 Z = ⌐A
Z = A'
NAND
AB Z Z=A.B Source
00 1 Z=A*B
01 1 Z = !( A * B)
A
10 1 B
Load
11 0 .
Z=0 if all
input=1.
NOR
AB Z Z=A+B
00 1
A B
Z=!(A|B)
01 0
Source Load
10 0 .
11 0
Z=1 if all
input=0.
XOR
AB Z Z = A XOR B A B
00 0 Z=A^B
01 1 Z=AÅB Source Load
10 1
.
11 0
Z=1 if all
odd number
of inputs =1.
Gate Truth Symbol ( IEC / Boolean Logic Switch & Diode Equivalent
Table ANSI) Alternatives
XNOR
AB Z Z = A XNOR B A B
00 1 Z = ! ( A ^ B)
01 0 Z=AÅB Source Load
10 0 Z=A≡B
.
11 1
Z=1 if all
even number
of inputs =1.
MUCH MORE: many more logic functions are available in ICs that can be purchased off the
shelf. Its worth scanning through data books / web listings of logic functions.
LOGIC FAMILIES: a logic family is a range of logic devices all built with the same
technology. There are many family types but there the two you will probably come across
include-
• TTL based families are older technologies that are seldom used but still found in legacy
systems. Note the LS00 data sheet for an example of this logic.
• CMOS based devices dominate the market now because of their low power drain, high
speed, high input resistance, and good noise immunity.
All microprocessors are now CMOS and most glue logic should be CMOS.
DATA SHEETS: every digital IC will have a data sheet produced by the manufacturer. We
will work through the data sheet to illustrate key properties of real devices.
We will look at the HC00 data sheet and note-
• Truth table and logic diagram.
• The pins used for power and where the gate inputs and outputs appear.
• Maximum ratings, which may only be reached in peculiar situations.
• Recommended conditions.
• Logic levels, especially the difference between output voltages and input voltages.
• Rise time and delay of the gate.
EXERCISES: use a truth table to work out the output (Z) given the inputs (A,B,C …)
1 A 1 A B C Z Y X W
A Z Y
C & C ≥1 0 0 0
C C
B & =1 0 0 1
B
0 1 0
0 1 1
C C
A & X & 1 0 0
A W 1
A ≥1 & 0 1
& A &
B B 1 1 0
C & C 1 1 1
&
B B
Illustration 72: Combination Logic Exercise
EXERCISE: you can sometimes reduce the IC count in a design by reusing gates in a novel
manner.
• Your design needs an inverter gate and you could add an HC06 package. You have a
single 2 input NAND gate free. Show two ways in which it could be used as an inverter.
• As above but you have a single 2 input XOR gate, consider also a NOR gate.
• You need a 2 input NAND gate and have one 3 input NAND gate free. Show two ways
to wire up the NAND gate to server as a 2 input gate.
LAWS: there are a number of laws that will help you manipulate Boolean algebra expressions.
Many are similar to normal algebra where AND (.) is like multiplication, and OR (+) is like
addition. The variables in the table can only take on values 0 (low) or 1 (high).
EXAMPLES: starting from the left in the diagram below, use the laws above to; simplify the
circuit to one gate, determine if the NAND-AND circuits are equivalent and determine if this is
a way to make a triple input NAND (useful for your labs?). Simplify the remaining circuits.
The tutorials will give you further practice at Boolean algebra.
1 A 0 B
B & & &
A A
& &
C >=1
1 0 A
A >=1 &
& A C
C
&
B
Illustration 73: Boolean Logic Simplifications
K-MAP PRINCIPLE: these notes will use Karnaugh maps (K-maps) to design and simplify
logic.
K-maps are built on the premise that any truth table can be built from a layer of AND gates
followed by a summing OR gate.
In the truth table below each row which generates a 1 is represented by an AND gate. All the
AND gates are summed using an OR gate to produce the output.
De Morgan's theorem can be used to change both gate layers to NAND gates (change the OR
gate to an AND and invert inputs and outputs, the inversion bubbles on the inputs can be
moved to the outputs of the first row of AND gates).
A A A
Index A B C Z
0 0 0 0 0
B & B & B &
1 0 0 1 0
C C C
Z Z Z
2 0 1 0 0 A >=1 A & A &
3 0 1 1 0 B & B & B &
4 1 0 0 0 C C C
5 1 0 1 1
6 1 1 0 1 A A A
7 1 1 1 1 B & B & B &
C C C
Illustration 74: AND-OR Combinational Logic Implementation
MERGING AND GATES: K-Maps show how AND gates can be merged to save gates and
reduce the number of inputs per gate. The K-Map below represents the circuit just given.
• A K-Map is a redrawing of the truth table in a special format.
• In the diagram below note cells ABC 101 represent one 3 input AND, and 111 another
such gate.
• The blue loop around these two cells in the K-Map below shows that in reality the value of
B does not matter, but A must be 1 and C must be 1. Two 3 input AND gates can be
replaced by one 2 input AND gate with inputs A and C.
• Similar reasoning on cells 111 and 110 merges in another gate.
BC B B
& &
00 01 11 10 A Z A Z
>=1 &
0 0 0 0 0 A A
A & &
1 0 1 1 1 C C
EXAMPLES of mapping rings are shown below for 2 inputs, 3 inputs and 4 inputs.
Note that mapping rings can wrap around edges and corners, exams nearly always check your
ability to spot this wrapping around.
B BC CD
0 1 00 01 11 10 00 01 11 10
0 0 0 0 1 0 0 1 00 1 1 1 1
A A
1 1 1 1 1 0 1 X 01 0 1 1 1
AB
11 0 0 0 0
Z=A Z = C + A.B 10 1 1 1 0
CD
00 01 11 10 Z = A.D + A.C + B.C + B.D
00 1 . 1 1
01 . . . .
AB
11 . . 1 . Z = B.D + A.B.C + A.B.C.D
10 1 . . 1
Illustration 76: K-Map Examples of Mapping Rings
Echo Line A 1
D &
E=0 E=1 C
CD CD A
C Z
00 01 11 10 00 01 11 10 Echoed & &
D
00 0 0 1 0 0 0 1 0 Group. B 1
A 01 0 0 1 0 0 0 1 0
A
B 11 0 0 0 0 0 0 0 0 Z = CDA + ABDE + CDAB &
D
10 0 0 1 0 0 1 1 0 E
Echoed one.
Consider the mapping ring C.D./A in the figure above. The reasoning for this term is as
follows-
• Looking at the rows the value of A must be zero, the value of B does not matter, thus /A
must be in the term.
• Looking at the columns C and D must be one thus the term becomes C.D./A
• The ring is echoed between E=0 and E=1 K-maps so E does not matter and does not
need to be in the term.
PRACTICE: K-Maps are best learned by practice. You will practice them in the labs and
tutorials. The worked problems at the end of these notes will help you a great deal and ensure
you learn key ideas. Try other sources of worked problems until you feel you have mastered
the technique.
TRUTH TABLE TO K-MAP: it is very easy to make a mistake when translating the truth
table to a K-Map. One way to reduce errors is shown in the work sheet below.
• Fill in the output(s) for each row in the truth table.
• Note the top K-Map shows the position of each truth table index in the K-Map. Use this as
a guide to translate each row of the truth table into the K-Map.
• Apply mapping rings as described and write the Boolean equations for each output.
If your problem does not need five variables then fill up the truth table as necessary and ignore
the unused cells in the K-Map.
44Variable
VariableTruth
TruthTable
TabletotoK-Map
K-MapWorksheet
Worksheet
P CD Q CD
00 01 11 10 00 01 11 10
00 00
01 01
AB AB
11 11
10 10
3.4 Simulators
Consider you have designed and built a digital circuit. You power it up and ... it doesn't
work! Is the mistake in the design, or the construction? Where do your start to fix the
problem? Do you just rebuild it and hope?
When a problem is too big then find a way to reduce the size or scope of the problem. In this
case you can use a simulation tool check the design works, and if it does not then quickly
redesign the circuit until it does work. With full confidence that the design is right then any
problems with the real circuit are due to construction and you can use hardware debugging
methods to find the fault (see the section on Testing & Debugging).
LOGISIM is a simple
simulator with a small learning
curve that suits this course.
Quick start learning path-
• Use the live Linux USB
as this has all the tools
and examples set up.
• Double click on the
Extras folder and
navigate to EEET2251
and the More folder.
• Double click on any
*.circ files, start with the
simple_logic.circ file.
• Click on the hand (top Illustration 80: LogiSim Simulator
left) and then click inputs
(square boxes) and observe changes in the circuit.
• Click on the pointer (top left) and then on an input (box), output (circle), or gate and
change properties such as the label and position.
• Read the help file which is excellent.
• Try to build a few very simple circuits yourself.
REALITY MISMATCH: simulators never match reality exactly and you need to be aware of
their limitations and oddities.
In Logisim the D flip-flops have a preset and reset on the bottom edge but these are active high
not active low like your HC74 flip-flops. Your simulation must add an inverter to match the
real flip-flop.
FAILURE WARNING: the vast majority of students who fail this course do so because they
cannot get the labs working. The root cause is that they do not learn to use the simulator and
they do not learn how to debug their circuits with a multi-meter.
Don't let this fate befall you, take the time to learn the simulator and how to debug.
Copyright © Pj Radcliffe 2018 Page 59
EEET-2251 Digital Systems Design 1 : Digital Electronics
A single
A STATE is simply a unique condition of a system. The system traffic
light has
output depends on the state, and may depend on external inputs as several
well. legitimate
states,
including
inactive.
A STATE DIAGRAM shows how the system moves between states
given some stimuli. This stimuli might be a clock edge for digital
electronics, or a call to a function for a software implementation.
State diagrams are also called "transition graphs" or "transition diagrams".
SIGNAL POLARITY: the label on a vector names a condition that must be true before that
condition can be followed. For a software state machine the polarity is obvious, the vector
represents a function which must return TRUE in order for the vector to be followed.
Hardware state machines are less clear and it is easy to make mistakes. There are two useful
conventions to clarify a hardware state diagram-
• “-L”: Active low signals all have “-l” or “-L” on the end, for example RESET-L requires a
logic zero to cause the reset condition to be active.
Active high is assumed if there is no “-L” but “-H” or “-h” can clarify a name.
• Case: active low signals are lower case, or start with lower case, and active high signals are
upper case, or start in upper case. For example “Reset” or “RESET” is active high, “reset”
active low.
A term such as RESET is the logic inversion of RESET and RESET=0 indicates the reset
function is active.
This approach is useful in that signals can be reduced to one or two letter abbreviations
which can make diagrams and tables much simpler, for example “R” is active high reset
and “r” is active low reset.
*** When you draw hardware state diagrams it is strongly recommended that you use the
“case” method of showing polarity. This really will help you reduce mistakes.
PULSE MODE SEQUENTIAL LOGIC: changes in inputs cause pulses which change the
state of memory elements. This form of sequential logic is seldom used.
CLOCK MODE
SEQUENTIAL
LOGIC uses
flipflop elements,
each of which can
store one bit of
information. The
only time an output Illustration 85: Rising Edge Triggered D Flipflop
can change is on
either the rising or falling edge of the clock input. Usually all the clock inputs are connected to
a master clock.
Clock mode logic is often called synchronous logic as usually all flipflop clocks are connected
together so all memory elements change at the same time. These circuits can be best modeled
by an FSM (Finite State Machine) for both analysis and design.
THESE NOTES will show how to design clock mode sequential logic (synchronous logic).
While not quite as fast as level mode it can be used to make much larger systems and is much
easier to design.
SYNCHRONOUS
COUNTER: flipflops are often
used to make counters where
the outputs always change at
the same time.
The counter opposite is a 3 bit
binary counter using JK
Illustration 89: Synchronous Counter
flipflops.
ASYNCHRONOUS
FLIPFLOP CIRCUITS are
common and can provide a
simpler circuit but the outputs
do not change at the same
point in time. These counters Illustration 90: Ripple Counter
are often called ripple counters
as the outputs change one after the other up the chain of flipflops. The ripple counter above is
about to make the transition from 3 to 4 (least significant bit is on the left). Bit 0 will change
first, then bit 1 and finally bit 2 (on the right). The change from 110 (3) to 001 (4) will go
through several short intermediate states; first 010, then 000, and finally 100.
If it is not acceptable to have short periods where the state is wrong or changing then ripple
counters are not a suitable implementation.
Q1 11 10
A DESIGN METHOD for synchronous logic is as follows. (Use this in your labs.)
• Define the problem: consult your client, look at other systems, look at all operational
modes, think of all failure modes. Define all inputs and outputs.
• Draw a state diagram that represents the system. Try to number the states such that there is
a close match to the required outputs in order to minimize the output logic.
• Check feasibility: the number of state bits required ( and thus flipflops required) is-
# state bits = roundup( log2N) where N is the number of states.
For example 4 states requires two flipflops, but 5 to 8 states requires three flipflops.
Now check the number of input bits.
If ( #input bits + #state bits) > 5 then K-Map techniques cannot be used to design the
flipflop input logic. In this case see the topic below “Reducing State+Input Bits”.
• Draw a state table based on the state diagram as follows. If using D flipflops the required
flipflop input is the same as the next state so these two columns can be merged. Use the
don't care state X where possible to simplify the logic and compress several rows together.
See the synchronous logic example to see some very useful rules for creating a truth table.
REDUCING INPUT/STATE BITS is essential to simplify the hardware and to keep the input
logic design simple enough to design with K-Maps. Some useful techniques include-
• Reset and preset: your flipflops may have a reset and/or preset pin. Consider using this to
achieve a known, usually stop/idle state. This may eliminate one input from the state
diagram.
For the tank filling example the End switch might be connected to the reset pin of all
flipflops thus reducing the state+input bits from six to five.
• Combine inputs: find ways to combine inputs. In the tank filling example the End and
Begin switches are two momentary action switches. Consider this as one switch which has
two positions, start (1) and stop (0). This eliminates one more input bit. Given that End
forces the idle state via reset then the Begin input may not be necessary thus both the Begin
and End inputs have been eliminated from the state diagram.
• SR captures pulses: if the input is a pulse then the state machine must remember the pulse
has occurred and this takes extra states. A separate SR flipflop can capture the pulse, for
example a low pulse on the S input, and turn it into a constant level. At some point the SR
flipflop must be cleared by pulsing the R input.
• Merge states if possible. This may require small changes to the functionality.
• Mealy? Check each output to see if it is dependent on inputs. If so try to create output
logic that uses inputs and the current state and see if that produces less states and so less
flipflops.
• Separate Timer: consider a situation where a delay is required and this is achieved by
using several states in a row. This might be replaced with a separate timer which starts
when a given output becomes active, and supplies a timeout input to the state machine.
• Quine-McClusky and other minimization methods can be used.
REDUCING BITS FAILS: as problems get more complex it becomes impossible to reduce
the (#state bits + #input bits) to a reasonable value. Possible solutions include-
• Algorithmic State Machines (ASM) use addressable memory instead of flipflops and can
cope with more inputs while still being easy to design. A small 8 kilobyte memory
element has 13 inputs and eight outputs and costs about US$2.50.
An ASM can reduce or even eliminate input and output logic.
See a later section in these notes about ASMs.
• Microprocessor + Software: if the state machine does not have to operate too fast then a
single chip microprocessor may do the job and be far more flexible as changes to the
system become software changes rather than hardware changes.
A small microprocessor such as the 18 pin Atmel Tiny26 costs about US$2 and can
provide much more functionality than a K-Map designed state machine or an ASM.
See http://www.atmel.com/devices/attiny26.aspx.
You need to take courses on software and microprocessors to design with microprocessors.
PROBLEM: the required circuit is a simple up-down counter with the sequence 00,01,10,11.
If the input Up is high then it counts up, otherwise it counts down. If the state is 00 and Up is
low then the state stays in 00, if the state is 11 and Up is high then the state stays in 11.
Use D flipflops for your implementation.
SOLUTION: use the design process described in the previous section; draw a state diagram,
then a state table, and then use K-Maps to create the logic required for the flipflop inputs and
any outputs. Finally simulate the design to prove it works.
Up Up Up Up Up
00 01 10 11
Up Up Up
D1 = Q0.Up + Q1.Up + Q1.Q0
PROBLEM STATEMENT: a small logic system is required to ignite large fireworks. Very
high reliability is required so a microprocessor solution has been rejected as the software may
crash. The only alternative left is a digital hardware solution. The key requirements and
functionality is listed below-
• The output must drive an igniter coil that must glow for 1 second.
• There is a momentary action “fire” switch and a separate momentary action “abort” switch.
The fire switch starts the count down, abort stops it at any point.
• The count down must be for 10 seconds.
Discussion: the igniter period of one second suggest that the clock input should be 1 Hertz to
get a one second period. The count down could be achieved by using ten states. The state
diagram would then become as below. There are several issues-
• Clarification: the exact functionality should be checked with the client, walk them through
the state diagram if they are willing. This often raises questions, for example should the
one second ignition state Cnt10 be allowed to abort? Is the timeout liable to change or is it
always 10 seconds? Should the ignition be at the start of the tenth second (as in the
diagram) or at the end of the tenth second?
• Excess input+state bits: there are two buttons and four state bits thus 6 bits of input for the
input logic to handle. This is beyond K-Map design. See the “Reducing Bits” in a
previous section for a range of solutions.
Idle Idle Idle Idle
Abort Abort Abort Abort
Idle: 0000 Cnt1: 0001 Cnt2: 0010 Cnt3: 0011 Cnt4: 0100
F: 0 F: 0 F: 0 F: 0 F: 0
Fire
Idle Idle Idle Idle
Abort Abort Abort Abort
Cnt8: 1000 Cnt7: 0111 Cnt6: 0110 Cnt5: 0101
F: 0 F: 0 F: 0 F: 0
Idle Idle
Clock = 1Hz
Abort Abort
F=Fire.
Cnt9: 1001 Cnt10: 1010 Fire,Abort=momentary
F: 0 F:1 switches.
TIMER SOLUTION: in order to reduce the input+state bits a timer will be used to replace the
long string of delay states. Look at the data sheet for the HC193 counter. It has a preset-able
counter which has a carry overflow. The parallel load input pin, when low, causes the counter
to load a preset value, and the output pin carry goes high when the final count of 1111 binary
wraps around to 0000. The preset value should thus be (16-desired count).
THE STATE DIAGRAM shown below becomes much simpler with only 3 states requiring 2
state bits and three external inputs. The inputs to the combinational logic that drives the flipflop
inputs thus has 5 bits of input and can be designed with a K-Map. Several other things have
been done to get closer to the real system-
• High or low? It is important to remember if a signal has an effect when high or low. The
case method of indicating polarity will be used. For example the “fire” input is active low
and causes firing to start when it goes low. “Carry” indicates a timer overflow when it goes
high.
• The state numbering has been set to match the outputs to try to reduce the output logic.
Ignite
Circuit Block Diagram
fire pload
Timer & State Diagram
State
abort Machine Carry
Clock
abort
Cnt: 01 Carry Clock = 1 Hz
Idle: 00 Fire: 11
Ip: 00 Ip: 01 I=Ignite output. p=Timer Load.
Ip: 11
Carry=timer output.
fire abort,fire = momentary switches.
State=Q1Q0
Illustration 96: Simplified Fireworks Igniter System
MISSING STATE? The state 10 does not appear on the state diagram! It may be possible for
this state to exist, for example on power up. All unused states must have an acceptable output
(Ignite=0), and move immediately to an acceptable state (Idle).
VECTOR AMBIGUITY: consider the vector labeled fire, in order to follow this vector what
are the values of the other 2 inputs abort and Carry? The diagram does not make this clear.
Your understanding of the circuit and product function will help you decide. In this case if
abort and fire are both active (low) then abort takes precedence and stops the move to count.
Carry should have no effect, it should be impossible as the counter is held in a parallel load
state.
In general think about the state of all inputs when translating a vector to the truth table.
TRANSLATION from State Diagram to Truth Table and K-Maps can be very error prone.
The logic driving the flipflop inputs is particularly difficult. The truth table on the next page
and the resulting K-Maps have several features that help minimize errors-
• The truth table lists all possible input values to the combinational logic that creates the
flipflop inputs. This way nothing will get missed.
• The state bits are listed first in the inputs list thus exit vectors from an individual state are
all grouped together. Heavy lines in the table separate out the states.
• The state has commas between the groups of bits that make up the K-Map rows and
columns so that it is easier to relate a truth table row to a K-Map cell.
In this problem the grouping is
Q1 Q0, a f, C; Q1Q0 refers to the Y axis of the K-Map, a f the X axis, and C the echo
line.
• On the truth table, for each state fill in the next state initially to be the same as the current
state.
Fill in the outputs, which are all the same for a given state.
Look at each vector leaving a state and identify which row(s) that represents, and fill in the
appropriate next state.
• Draw a K-Map with the truth table index
number in each cell. There is a pattern to Echo Line
the numbering which makes the filling in
much quicker. This will guide you as to C=0 C=1
where to put each truth table row in the K-
af af
Maps.
• Draw an empty K-Map for each flipflop 00 01 11 10 00 01 11 10
input. Using the Index K-Map and the 00 0 2 6 4 1 3 7 5
truth table, start filling in the empty K- 01 8 10 14 12 9 11 15 13
Maps. Q1Q0
11 24 26 30 28 25 27 31 29
When each K-Map is filled in look for
mapping rings. 10 16 18 22 20 17 19 23 21
Create Boolean equations from the
mapped K-Map. Illustration 97: Index to K-Map Cell
Echo Line
C=0 C=1
af af
Index Map 00 01 11 10 00 01 11 10
00 0 2 6 4 1 3 7 5
01 8 10 14 12 9 11 15 13
Q1Q0
11 24 26 30 28 25 27 31 29
10 16 18 22 20 17 19 23 21
OUTPUT LOGIC: the state diagram tried to use the state bits directly as outputs but the
unwanted 10 state has ruined that. The F output will require combinational logic (F = Q1 . Q0)
but the parallel load output p = Q0.
SIMULATION: with complex designs such as this it's so easy to make a mistake and then find
your construction does not work. It can be almost impossible to find out what has gone wrong;
your design, or your construction.
One solution is to simulate your design to eliminate design problems, and then build the system
only after the simulation works. Below is the simulation of the firework igniter problem using
Logisim, a simple and free package which you can use for your own projects.
FLIPFLOP PRESET AND RESET? Remember that the flipflops may have a preset and
reset inputs. It may be possible to connect an input to one of these pins and so eliminate that
input from the state machine. This was not useful for the fireworks problem.
is first applied the capacitor holds the reset output low for a while,
eventually charging up via the resistor to logic high and allowing the flipflops to operate. The
diode ensures the capacitor discharges quickly when power goes down. The switch provides a
manual reset option.
FLEXIBLE: oh dear, design change, the count has to have a gray code order. Using
combinational logic this means a complete redesign, for a memory based system just change
the data stored in the memory element.
SLOWER: memory elements are slower than 2 or 3 layers of combinational logic. A memory
element may take 150 nanoseconds (ns) to convert an address to data, but two layers of HC
gates will delay only 40 ns.
Clock
Flipfop Inputs
(after input logic) valid Invalid values valid
Flipfop Outputs
(current state and
output)
SETUP AND HOLD TIMES: the flipflop setup time has been introduced, additionally a
flipflop input has a hold time where the input must be held stable for a period after the clock
edge. All circuits must be checked to ensure a flipflop setup and hold time requirements are
satisfied.
EXERCISE: see the section titles “Synchronous Logic Example 1”. Use the HCT data sheets
to work out each of the three key delays and so work out the maximum clock speed allowed.
METASTABILITY: if a flipflop's setup or hold time is violated then the flipflop may not
change state cleanly, it may generate a small pulse or even a slow ramp, the output is said to be
metastable. The diagram illustrates the metastable output of a flipflop.
Metastability in Flipflops
Flipflops require the data input to be stable for a "setup time" before a clock edge and a
"hold time" after the clock edge. Failure to observe this limitation will result in
metastability. This "no change" period is called the metastability window period.
D Q
EXTERNAL INPUTS
always run the risk of Double Buffering to Eliminate Metastability
causing metastable
behavior as they are not System Clock
Clock
f1 f2
synchronized with the
clock. One of the Ext. Input
simplest solutions is to D Q D Q
Single
double buffer external External
asynchronous
Single
bufered
Double
bufered
Bufered Setup f2
inputs as below. input. input. input. Double
Bufered.
Settled : the frst flipflop has snapped out of metastability by the time the second flipflop
samples the frst flipflops output. Following devices can safely sample the second
flipflop's output using the system clock
SCHMIDT TRIGGER
Fixed Threshold Schmidt Trigger Variable Threshold
INPUTS have a zero-
one threshold which Voltage Voltage Output
moves to eliminate Fixed
Output
Upper Threshold
noise. See the HC14 Threshold
Active
data sheets for more Upper
Threshold
details.
Lower
Threshold Lower Threshold
Active
Time Time
Input
Input
Illustration 109: Schmidt Trigger Inputs
A PISO SHIFT REGISTER captures parallel data, and then shifts it out one bit at a time. A
microprocessor can control a string of these devices using only 3 control lines to capture a large
number of inputs. See the HC165 data sheet.
MUCH MORE !! This section only lists a few of the many logic devices available. See the
reference at the start of this section to see a list of what is available.
LOGIC FAMILIES listed below include a number of ancient types that are no longer used in
new designs. CMOS variants dominate logic design today.
• RTL (Resistor-Transistor Logic) is an old slow logic used in the late 1950s.
RTL logic was used in the Apollo spacecraft which had the first computer built from
integrated circuits. http://en.wikipedia.org/wiki/Apollo_Guidance_Computer
• DTL (Diode-Transistor Logic) is another old family used in the early 1960s.
• TTL logic (Transistor-Transistor Logic) was the work horse of digital systems from the
early 1960s until the mid 1980s. The variants LSTTL (Low power Schottky TTL) and
STTL (Schottky TTL) improved power consumption or speed over the basic TTL form.
• ECL logic (Emitter Coupled Logic) is an extremely fast logic where the bipolar transistors
never turn fully on or off. Gate delays under 1 nanosecond are possible but power
consumption is very high compared to other logic families.
• CMOS logic (Complementary Metal Oxide Semiconductors) used Field Effect Transistors
(FETs) rather than BJTs of the earlier logic families. This dramatically reduced power
and reduced input currents. CMOS was first used in around 1970 and is now the dominant
logic family. It is the basis of most microprocessors, programmable logic, and logic gates.
HC logic is a form of CMOS logic.
4000 SERIES CMOS LOGIC can take use power supplies from 3 volts to 15 volts but is
slower than HC logic. The wide variation in power supply makes them very suited to battery
operation. For a list of the gates available see
http://en.wikipedia.org/wiki/List_of_4000_series_integrated_circuits
Each gate type can come in buffered (suffix B) or unbuffered form (no suffix). The buffered
form has a strong output drive but is a little slower than the unbuffered form. Most parts sold
today are the buffered form.
CAN FAMILIES TALK? Digital logic requires digital outputs to be recognized by digital
inputs. What can go wrong if the digital devices come from different families or are powered
from a different power supply?
• Input over-voltage: if the power supply voltage is different between two devices then an
input may be driven by a voltage higher than its own power supply. This may cause
problems including damaging the input.
Consider a 5 volt HC gate driving into a 3.3 volt powered Raspberry Pi. The 5 volt from
the HC gate will damage the 3.3v powered Raspberry Pi logic.
Some logic is tolerant of input over-voltage, and there are level shifter chips available.
A voltage divider made of two series resistors can also solve the problem.
• Noise margin: some families have poor output drive and the output voltage may not be
enough to be reliably recognized by the input of a different family.
Try calculating the noise margin for 5 volt TTL logic driving 5 volt HC logic.
You should find the noise margin on the high drive is negative indicating that TTL
cannot reliably drive high into an HC gate.
The solution here may be to use HCT logic (HC with TTL input thresholds). A pull up
resistor on th TTL output often works but is not a guaranteed solution.
See-
https://learn.sparkfun.com/tutorials/logic-levels
http://www.ti.com/lit/sg/sdyu001ab/sdyu001ab.pdf
CMOS LOGIC TYPES are shown below. The characteristics of TTL (which is not CMOS) is
shown for the purpose of comparison.
See http://www.ti.com/lit/sg/sdyu001ab/sdyu001ab.pdf
POWER AND SPEED of key logic families Logic Propagation Power per
is shown opposite. delay (ns) gate
Family
CMOS power depends on voltage and @1MHz
operating frequency. Approximately- (mW)
Power = k.V2.f RTL 500 10
k=constant. DTL 25 10
V=power supply voltage.
f =frequency of operation. TTL 10 2
CMOS at low frequencies has very low power HC/HCT 9 0.5
dissipation. ECL 1 60
Other logic families have a rising power
Illustration 116: Logic Family Power
dissipation with frequency but the rise is much
less than *f.
CMOS can be made much more power efficient than HC/HCT as listed above.
NAMES, NAMES, names: many companies that manufacture FPGAs have created their own
name for the device. The list you see below is only a few of them-
• PLA (Programmed Logic Array) where both the AND and OR array are programmable.
• PAL (Programmable Array Logic), as in the previous page the AND array is programmable
the OR array is fixed.
• PLD (Programmable Logic Device), a more generic name.
• CPLD (Complex Programmable Logic Device).
• GAL (Generic Array Logic), electrically erasable and re-programmable.
WHAT ROLE FOR DISCRETE LOGIC? Given the advantages of programmable logic
why use discrete logic any more? There are several good reasons-
• The methods used to design discrete logic can be used within FPGAs so it is important to
learn traditional combinational logic design.
• “Glue logic” are logic gates that sit between a microprocessor and the outside world or
other devices. This logic is usually simple and an FPGA would be an expensive and power
hungry solution.
Glue logic often requires high current or high voltage output drives, and inputs which can
handle electrical punishment. FPGA chips do not have this capability and so discrete logic
is still used for glue logic.
HOW BIG DO THEY GET? FPGA chips can be huge with well over 1 million logic
elements as well as embedded memory, and complete microprocessors. The biggest are worth
thousands of dollars.
See the Stratix family of FPGA from Altera as https://www.altera.com/products/fpga/stratix-
series/stratix-10/overview.html
HOW SMALL DO THEY GET? Small FPGAs may have eight outputs and can cost 50 cents
but they are are surface mount parts and cannot be bought as “pin-hole” components.
DEVELOPMENT TOOLS: FPGA development can be complex and difficult. Shop around
and ensure the development tools are easy to use and within your budget. Start by looking at
well known suppliers such as Xilinx, Lattice Semiconductor, and Altera. Many of their tools
are free and of very good quality.
For small tasks you can draw logic schematic diagrams using these tools and program the
FPGA chip. For larger tasks you should learn a hardware programming language such as
VHDL (later courses here at RMIT will teach VHDL).
Special Break: management is very unhappy and want to talk to you, now …
MATCH YOUR CONSEQUENCES: you need to plan your testing methods that suit the
scale of the activity, and the consequences of failure. Small systems with no consequences
may stay ad-hoc. Larger systems with huge consequences of failure (eg heart pacemaker)
require complex, well planned, and costly testing systems.
MANAGEMENT CALL: it is up to management to decide on just how much time, labor, and
money to allow for testing. If testing is not adequate then the fault lies with the resources
management allowed and almost never with the technical or engineering staff.
Caveat: management must have been properly informed of the likelihood of problems and the
consequences. This is a key responsibility for an engineer.
WHAT IS A FAULT? There are two main views about what constitutes a fault-
• Specification violation: behavior or attributes violate the specification.
• Reasonable expectations: the system does not behave as the client could reasonably expect
it to.
There are many situations in which “reasonable expectations” are legally enforceable.
Case study: an Australian company provided a telephone system to China that had one
problem; it caught on fire if the temperature dropped blow about -15 degrees C. The
supplier replied that the temperature of operation was not specified. The court found that
the supplier knew the location of installations and should have been aware of the
temperature range required.
WHY DO ERRORS SLIP THROUGH? There are many causes of errors in hardware and
software-
• Mis-specification : customer needs and requirements are wrong or have been missed. This
is usually the most significant and costly cause of errors.
• Documentation or on-line help may not match the system behavior, or may be inadequate
to guide the user.
• Combinations & sequences : combinations of inputs and input sequence variations are not
tested. In most real systems the number of combinations can be huge and it is not possible
to test every combination.
• States not tested : each unique combination of data within a system defines a state. It is
totally impractical to test the vast number of states in a big system. Almost inevitably
some untested states will be entered by the user, and some of these may be faulty.
• Untested items : because of time, labor, or budget constraints testing may not manage to
test all hardware, and execute and test all the code that the user manages to invoke.
• Operational environment for the user may not match the testbed.
• Load problems : the timing, type, and size of the load on the real system may not match the
testing regime.
• Test code/hardware left active : test code and test hardware can be accidentally left in the
operational unit and so cause problems.
• No experience: testing is much improved by having experienced people on the team; those
who have tested previously and/or know the problem domain well.
Copyright © Pj Radcliffe 2018 Page 92
EEET-2251 Digital Systems Design 1 : Testing and Debugging
INDEPENDENT TESTING: the human mind finds it difficult to serve two different goals.
The creator of a design will find it hard to strive to find weaknesses in that design.
An independent and experienced tester will have the drive and motivation to find faults and
may not be hampered with misunderstandings held by the designer.
Most larger projects will hire testers from a company other than the hardware or software
supplier in order to try and catch as many errors as possible.
TEST BEFORE THE END: there are many ways in which a design can be tested before a
prototype has been created. The tests below are usually much more cost effective than testing a
completed prototype.
• Simulate the hardware or software to ensure the design is correct. In most cases it is easier
and quicker to run a simulation than test the real equipment.
• Peer review: get others to review the requirements analysis and design proposal before
implementation. Experienced designers will often pick up problems in a few minutes that
will save days of effort later.
In software this approach can eliminate up to 80% of errors if done carefully.
• Checklists: many companies develop checklists of good design practices, known problems,
and general guidelines. These can be very useful to new engineers and are still used even
by experienced engineers.
TEST PLAN: write down at least the equipment required, and what inputs to apply and what
outputs to expect. A well written test plan has many advantages-
• Check/approve: other professionals can check and approve the plan.
(Politically what does this imply?)
• Operation of the test plan can be by others, usually less skilled and less costly staff.
• Saves time especially if the test must be done several times.
• Next time: the plan is often a useful start for the next product to be tested.
AUTOMATE: regression testing will test all features of a system after even a small change
because it has been observed that repairs will often fix the obvious fault but accidentally
introduce new faults.
Regression testing is VERY important in real products but it is painful and labor intensive to
run the full battery of tests after every small change to the product. One approach is to create
test tools that can automatically apply stimuli and check for responses.
There are commercial test tools available though for digital systems it is easy to create one
yourself.
TRADITIONAL PROBLEM SOLVING theory offers a good checklist to help handle faults.
• Define the observations : ensure the observations are accurate and repeatable.
• Is there really a problem? The real problem may be a misunderstanding, failure to read
instructions, or ignorance. No problem may exist.
• Define the boundary : in all ways possible-
➢Define what is, and what isn't the problem.
➢Localize the problem to a small part of the system.
➢Timing and relationships to other events should be clarified.
➢Simplify the situation and eliminate extraneous factors.
• Impact analysis : analyze who is affected by the problem and any solution. Ensure all
affected parties are kept informed. Think about the response from all stakeholders.
• Quick fix : is there a quick fix that can be justified? Who needs it first?
• Fix what : what needs to be fixed, and what should be left as is?
Not all faults need to be fixed or are cost effective to fix.
• Monitor : when a repair is made check it really does work and has not affect other features
of the system.
• Long term fix : if a quick fix was made what is the long term fix?
CHECK THE QUICK AND OBVIOUS : a little experience will usually show that some
things are quick and easy to test and often the cause of a fault. It makes sense to check these
things first. Examples include-
• Has power got to the hardware and all ICs?
• Is this software routine even getting called?
• Are the inputs correct? Which outputs are wrong?
• Have any gate inputs been left floating?
STEP BY STEP testing is simple and obvious – yet many technocrats cannot do it!
Start testing at the external inputs.
• Change the inputs to all possible states to ensure the external inputs work.
• Test one step away from the external inputs, again check all input combinations have the
desired effect.
• Keep moving one step away from the inputs until all outputs are observed.
If a fault is found at any point then try repair methods such as disconnection, replacement, or
redesign.
Input
( OK) Output
1/8 1/4 3/8 1/2 5/8 3/4 7/8
( faulty)
Measure @1/2 ( OK) OK ?
BASELINING : often during testing and development, the designer will get quite confused and
nothing will seem to work. To the designer the system seems to be out of control. A good
solution to this dilemma may be to "baseline" the system.
A baseline is a system which has known properties ( which may include known faults). When
an out of control system is "baselined" it may have sections removed or made inactive. This
will return it to a baselined state. Once the baseline operation has been verified then the
additional features can be turned on and checked one at a time.
INTERVENTION : there are many times when there is insufficient information available. The
usual solution is to intervene in the system in such a way as to gather more information.
Examples include-
• For hardware add indicator LEDs at crucial points.
For software add print or write statements that show code executed and variable changes.
• Add temperature, voltage, or vibration loggers to the system.
• Change some parameter or function in the system and analyze the change in performance.
Novice debuggers tend to be too slow and too conservative in the degree of intervention used to
isolate and characterize faults.
KNOW THY TOOLS: most areas of technology have a range of testing and debugging tools.
It's worthwhile spending a little extra time now to learn these tools as later on they can you a lot
of time. In your time at university you should learn at least the following-
• Digital hardware: multimeter, logic analyzer, logic probe, logic pulser.
• Analogue hardware: multimeter (volts, amps, ohms), oscilloscope, and signal generator.
• Software: single step debugger, test coverage analyzer, timing profile analyzer, memory
leak detector, stack and heap profiler.
If you do not know these terms then go an read about each.
• Unit based measurement : discrete items can be given a probability of having no faults (p).
The probability of "n" items in a row showing no faults is simply pn.
Eg. One telephone call in 1000 fails, a software fix is introduced and 2500 calls are made
without loss. What is the probability that the fault is not fixed ( it was just a lucky run and
the fault is not fixed) ?
pn = 0.999 2500 = 8.2%, there is a 1 in 12 chance it was just good luck.
GARBAGE COLLECTORS will scan for a known problem and then take steps to ameliorate
or solve the problem. This does not fix the problem but will reduce or eliminate the negative
effects of the problem.
SAFETY INTERLOCKS are a form of garbage collection where the aim is to ensure nothing
dangerous happens.
Example: electric clothes dryers, even complex software controlled units, have a thermal
cut-out in series with the heating element. This simple mechanical unit will turn off the
heating element if the dryer gets too hot.
4.3.2 Simulation
Consider you have designed and built a circuit and it does not work. Is it a design fault?
Is it a construction fault? What do you do to fix the problem? Where do you even start?
When problems are complex you must use the engineering principle of "divide and conqueror"
a big problem into smaller problems.
First simulate your design to be sure it fully works. There will be a small learning curve in
using the simulator but you will quickly be able to see if your design is correct. If there is a
problem you can redesign until it all works. If you constructed unit fails then you can now be
sure that any faults are construction faults and look for common construction faults.
An earlier section looked at the Logisim simulator which is adequate for this course.
• Clean metal: ensure metal is clean, if not scrap or sandpaper till clean.
• Soldering video: soldering is not difficult but there is a technique to it. Learn this from
technique and practice it before working on your first board.
The most important hint is to hold the iron against both items for 2-3 seconds, then apply
solder the the solder to where the iron and one metal element meet.
• Have a schematic so you can build from it and debug against it.
Remember to include all power supply connections to the ICs.
• No floating: all IC inputs must be tied high or low for the gate to work properly.
A floating ( unconnected) input can drift high or low and cause odd operation.
• /reset and /preset on flip-flops must be tied high so the device can function normally.
• IC orientation: make sure you know where pin 1 starts. Look at the data sheet to be
certain.
4.3.5 Breadboards
Common problems include-
• Power runs: most breadboards have two power run down both edges of the board.
Typically one is for +5v/+3.3v and the other 0v.
Some boards have a break in the middle that you must bridge with wire. If you fail to do
this then the bottom half of the power run wont be connected.
• Connections: wire need to be inserted 2-3 mm to make a good connection. Wires that
“just reach” probably do not, or give intermittent connections that do not survive
transport.
• Transport? Breadboards are notoriously unreliable and can fail if knocked or bumped.
Consider how to transport a breadboard to minimize such problems.
• Simulation as mentioned should be your first step to ensure the design is correct.
Without simulation, when the circuit does not work, is it the design or construction
which is wrong?
• Add LEDs (with current limiting resistors) to key points of your circuit so you can see at
a glance what is happening. With state machines it can be useful to have LEDs on the
flip-flop outputs (current state ) and flip-flop inputs (next state).
• Multi-meter: this is your primary debugging tool. Use it to check all voltage points are
correct.
Setup: using a clip, connect the black zero volt lead to zero volts on the clock board. Set
the meter to DC volts and the 20 volt range. Ensure the black lead is in the common
socket, and the red lead in the voltage socket.
Start testing at the clock board where you should see the full power supply voltage.
Work from there to measure the power pins of the IC, then the input pins of the IC, then
the IC output pins.
• Compare circuit to simulation: ensure you have LEDs on flip-flop outputs (the current
state) and flip-flop inputs (the next state). Compare these to your simulation. If a next
state is wrong, work from the flip-flop input back through the gates to see where the
circuit differs from the simulations.
• Build-test-build-test … Try to build your circuit in stages and check each stage before
going further. For example wire up your switches and check with the multi-meter that
they work.
• Base-lining: if your complex circuit does not work then try simplifying the circuit,
perhaps on another board. In this simple version try to work out what is wrong.
Example: in a lab requiring a state machine a student had not realized that a flip-
flop required /reset and /preset to be held high to be inactive. They built a flip-
flop with a 0/1 input and looked for a 0/1 output. The observations allowed staff
to quickly work out what was wrong.
YOUR LEDs: as described having your own LEDs connected to key points is an excellent
debugging tool.
LOGIC PULSER: this device puts a pulse high or low on a circuit, overdriving an IC for a few
microseconds. You can see the effects using a logic probe with a pulse stretcher.
5 Interface Electronics
Electronic signals can be very easily corrupted by interference leading to noise in
analogue systems, data corruption in digital systems, and destruction of devices. This is a real
world problem that ruin “theoretically” good designs.
In this section we will look at the causes of these problems and some solutions. Only the very
basics will be covered and later courses will go into much more depth. You will find some
useful lecture notes that go a lot further on the Linux live-DVD, see
/home/extras/lecture_notes/Electronics_Digital/Electronic_Problems.pdf
CAPACITIVE COUPLING: any two conductors close to each other Stray Capacitive Coupling
will have a finite capacitance between them. For example two tracks on
a printed circuit board will have a small capacitance between them. Noise Victim
Source Circuit
Capacitors let high frequencies through and so a high frequency noise
source can capacitively couple noise into a victim.
Illustration 126: Noise
This can become a problem as clock frequencies get into the megahertz and Victim
region.
Parallel Wires
Radius r C =
π
a
cosh
-1
x = Ln (x + 2
x - 1 )
cosh
-1
( 2r
) Farad / m
"a"
between
centres.
L High Freq. =
π
cosh
-1
( a
2r
) Henry/m
INDUCTIVE COUPLING: any conductive loop can generate a magnetic field, which can be
received by another loop. Cables and wires form surprisingly large loops and can pick up
everything from mains hum to high frequency noise.
Loop Inductance
2. b 2.a
L square = a.Ln + b.Ln
d d
"b"
"a" "C"
"d"
"d" –7 8. C
L round = 6.14 x 10 xC x Ln -2
d
Illustration 128: Loop Inductance
ACCIDENTS AND ABUSE: the real world is full of accidents and deliberate abuse but well
designed electronic systems should be able to cope. The designer needs imagination and
experience to work out what could go wrong, and how to economically solve the problem.
Case Study: to disable a poorly designed burglar alarm smash the front keypad with a brick
and use an external mains power point to connect mains power to a variety of wires. The
mains power will blowup a poorly designed system and stop any alarm outputs.
Case Study: consider car electronics which is based on 12 volts, what happens when a 12
volt signal is accidentally input to your 5 volt HC logic? The logic is destroyed
immediately!
STORED ENERGY: capacitors and inductors can store energy and in some cases this
will cause problems.
Damage : the flyback voltage from an inductor will cause sparking and erosion on
mechanical contacts and may destroy semiconductor devices.
Speed : using only a diode the energy in the inductor takes some time to drain away. This
may mean that a relay takes too long to release. This period can be reduced by adding a
small resistor or zener in series with the diode or by replacing the diode with a spark
gap. Either approach gives some voltage transients which should be checked.
Vcc=+12v Vcc=+12v
Capacitors try to keep The additional
the voltage across diode limits
Vi - -
themselves constant Vi to one diode
+ +
and will supply large drop above Vcc.
Vi
0v currents to try and 0v The resistor
achieve this. limits the
In this circuit the Vi is current flow
maintained by the into the IC.
capacitor while the Some ICs may
power supply turns Vcc need schottky
Vi
of. The IC appears to diodes with a
have its input raised Vi 0.2v drop for
Vcc
well above the power proper
supply voltage. This protection.
usually destroys the
IC.
BUILT IN DIODES: most digital integrated circuits have built in diodes which solve the
above problem and limit the effects of Electro-Static Discharge (ESD).
Printer Motor
STAR POINT EARTHS (zero volts) ensure
that the high currents from noisy circuits do
Case EMI & ESD shield. Reference
not interfere with the sensitive analogue and 0v
digital circuitry. Never allow zero volt (earth)
or power supply loops. Mains Earth
Illustration 132: Star Point Earthing
This technique is very important and is used in
all well designed electrical systems. Even on a
PCB the digital and analogue zero volts are separated so the more sensitive analogue signals do
not receive digital interference.
PROTECTING INPUTS: there are many ways to protect inputs. The circuits below have
been used to interface to the parallel port of a PC, a 5 volt logic digital IO port. “PP input” is a
digital input to the computer, “PP output Hi” is a +5 volt source.
Conservative buffering
offers more protection
against voltages outside the
0v to 5v range.
PROTECTING OUTPUTS can be done in a similar manner. The circuits below have been
used to buffer the PC parallel port output logic. “PP output” is a 5 volt logic output.
UNIVERSITY EDUCATION DOES NOT HELP: yes we said this before and it's worth
saying again. At university you only work on small projects and so small project methods get
ingrained into your mind. When these methods are applied to larger problems the result is a
disaster.
Case study : letters to the editor in IEEE Computer August 2002 page 8 reports bright
young PhDs who were convinced they could control a new pilot pharmaceutical plant from
their IBM-PC. Issues such as reliability, timing, and scalability were ignored, probably
due to lack of experience.
As a young engineer stay sensitive to the issue of complexity overload and watch carefully the
work practices of successful engineers and managers.
USEFUL TOOLS AND METHODS for handling complexity are listed below. You should
get practice with all of these somewhere in your university courses. Many of the tools manage
information, people and materials which is a key part of real engineering.
• Gantt charts can map time and resources for tasks to make a map of how the project should
proceed. Monitoring actual activity against initial plans can give early warning of
problems and delays.
• Issue tracking tools can keep track of all the small tasks that must be done and ensure
nothing gets missed or lost.
• Configuration management tools keep track of all the versions of hardware, software, and
documentation. Without this information it is impossible to support customer sites, or even
to extend an existing product.
• Requirements tracking tools that ensure that every part of the requirements document is
getting implemented and tested.
• High level modeling methods help to model the system at a high level of abstraction which
can simplify a system. Examples include state diagrams and UML (Universal Modeling
Language).
• Mind map tools that help improve your problem solving and help communicate your ideas
to others.
• Divide and conquer methods: ways to split a big complex system into subsystems. Block
diagrams and data flow diagrams are both very useful methods.
3D 3D Acceleration
User Brake
Accelerometer
Sensor
Vehicle
Steering Steering Angle Dynamics
Angle Sensor Estimator
Braking Desired
Wheel Speed 3D
Dynamics
Wheel Speed
Rotation Hydraulic Brake Brake Slip
Sensor Control Pressure Determination
Brake
Hydraulic On/Off/Pulse Hydraulic
Brake Hydraulic
Fluid
Brake Pump Hydraulic
Per Wheel Fluid Resevoir
EASY TO UNDERSTAND : FBD models a system in a way that most people find very easy
to understand. Most stakeholders can easily understand FBD with no training; this alone may
make FBD worth using.
ANALYSIS MODE AND DESIGN MODE : FBD can be used in four steps-
• Model what exists as a block diagram (not needed for a new system).
• Analysis mode : propose a new system without making implementation choices except
where the client mandates a decision. Each box describes an abstract function.
This digram shows what the system must do but not how to do it.
• Implementation selection : each generic block in the analysis mode FBD is examined
and alternatives listed and considered. The best set of alternatives is selected.
• Design Mode : the analysis mode FBD is redrawn with all the selected alternatives and
the diagram is elaborated to define the system structure.
This diagram defines how the system will work be built.
At each stage non-technical stakeholders can be involved. The systematic consideration of
alternatives can often help develop new and novel solutions to problems.
KEY QUALITY INDICATORS: it's easy to tell if the block diagram is of good quality-
• Good naming: all naming of blocks and vectors is clear and obvious.
• Vectors named: block diagrams aimed at helping designers will also name the vectors.
• Minimal interface: the vectors between blocks should be as simply as possible and where
possible conform to industry standards, for example power is 12 volts not 16.5 volts.
This is a key attribute of a good design an can result in many benefits-
➢Each block can be made highly independent from other blocks. Each block can be
developed in parallel thus saving development time and shortening time to market.
➢A block where all inputs and outputs match industry standards might be something
which can be purchased.
• Data oriented: the vectors should represent information, energy, or materials and seldom
control information.
• No decisions are shown (no diamonds as from a flow chart). These are hidden inside a
block.
Decisions such as if-then-else keep on changing as your design evolves.
If you draw out these then your diagram quickly becomes overly complex, out of date and
useless.
The basic building blocks do stay the same so a block diagram continues to be useful.
MULTIPLE VECTOR FORMS: it is quite possible to mix different energy forms, for
example a red vector may be hydraulic, blue, electrical, and green a mechanical input.
EXTENDED FBD give more information and can be directly linked to a document, or a
chapter of a document.
DATABASES/FILE symbol should be used sparingly. It is intended to store data over time
where that data must be shared between processes.
DATA FLOW DIAGRAMS (DFD): FBD have a lot in common with an old software design
tool called Data Flow Diagrams. FBD extend beyond DFD and are much more useful in the
engineering context.
0.3
FBD EXAMPLE : consider a simple broadcast radio receiver design using the FBD method-
• Generic : in analysis mode all vectors and blocks are generic in nature and do not state
an implementation, unless the stakeholders have mandated a particular alternative.
• Clear naming is vital. For example “Full RF Spectrum” gives a hint that there are other
RF transmitters and RF interference to be considered.
• Extra text : The analysis specification will typically have a section called “System
Definition” that starts with the analysis mode FBD. Subsections for each block then
define key properties of the block and the vectors that connect to the block.
• Alternatives are considered after the blocks are all defined, and all system level
requirements are defined, for example operational temperature range and input signal
levels.
Amp. RF DSP A-D Digital DSP demod Digital DSP D-A Analogue
energy. conversion. RF software. audio conversion Audio
• Choices have been made from the alternatives for each block on the analysis FBD.
• Changes : it is common to get blocks merged and split. In the example RF energy
capture has been split into antenna and RF amplifier. RF band selection and
demodulation have been merged into a DSP.
• Child diagrams : on any FBD a block can be shown in more detail on a child diagram.
CONSULTING EXAMPLE: in this exercise you will draw three FBDs. The first will
represent the current description as drawn from the client's rambling description. The second
will be an analysis mode FBD which looks at a logical view of information and materials flow.
The third diagram will be a design mode diagram where you develop a solution and explain it
by using a FBD.
Client description: we are having a lot of trouble with our stationary ordering an need a
new system. Bill goes to each of our four departments and writes a list of everything
required and bring it back here. Carole then creates a consolidated list, costs each item (eg
50 pens) and adds up the cost of all items. She then sends the list to Mary for approval.
Bill now orders the approved list from the provider and when it is delivered unpacks the
box and sorts the stationary into four boxes, one for each department. Bill then delivers
the boxes to their respective departments.
Start work? No !!! It is incredibly uncommon for clients to give you the whole story. You
need to find ways to help them to tell you more to get the full picture. Here are some example
questions to ask-
• Have there been problems? If so was there a solution?
• What is the key thing you want to achieve as a result of any changes?
• Can I check some of the small details with the other people affected by the project.
What next: draw each diagram listed below and then consult back with your clients.
• FBD of what currently exists.
• FBD or logical system ( functionality but not how or who does what).
• FBD of new system (how it will now work).
Department 1 Individual
Dept Needs All
Dept Needs
Department 2 Carole collates
Bill Collect Needs and costs.
Department 3 Collated,
costed needs.
Department 4
Mary approves.
Goods distributed
Approved needs.
Bill distributes goods.
Bill Orders.
Supplier Order to supplier.
Goods delivered.
Logical FBD
Individual Collated,
Dept Needs costed needs.
Order to supplier.
Illustration 145: Office Ordering Current and Analysis Mode FBD
NOW FOR THE MAGIC: the hallmark of a good engineer is that creative streak that
produces a clever new system. In this case there is a heavy usage of paper and people, which is
unusual today where personal computers and the Internet are everywhere. Some ideas which
may help include-
• Can the departments fill in a spreadsheet with their needs? Perhaps the approver Mary
could set this up. A spreadsheet can collated needs and even provide an order form from
the individual department spreadsheets. Online systems such as Google forms and
documents could be used.
• Can the supplier send a package per department. The higher delivery cost will be less than
the labor costs of unpacking and distributing.
THE PROPOSED SYSTEM is much simpler, quicker, and will cost less labor time-
Supplier.
Individual department Order to supplier.
deliveries.
Illustration 146: Office Ordering Proposed FBD
IN YOUR FUTURE at university you will find FBD an excellent way to describe complex
systems so that reviewers and markers can quickly grasp what you are doing. Later in industry
you will find them just as useful.
Task to Perform.
STANDARDS : there are several international
standards for flow charting, most achieved just as
control flowcharts were being considered obsolete.
The best known are ISO 1028 "Information Processing False
Test
- Flowchart Symbols" and the ANSI X3.5-1970
standard (now superseded by ISO 5807:1985).
True
LIKE A STATE DIAGRAM? A flow chart may seem to act like a state diagram in that an
arrow is followed if the condition is true. There are several big differences-
• Each square does not define the state of the system just a task to be completed.
• The system does not wait at a square until there is an activating signal (like a clock edge)
and a true condition on an arrow. Instead the task is competed and the exit arrow is
followed.
[condition before
ELEMENTS of an activity chart include- transition allowed]
flowchart.
• Synchronization bars show when
parallel operation can start and when
it must end. Tea in Boil
Get cup.
pot. water.
[ask peoples
preferences]
WHEN TO USE : an activity diagrams is
just another form of flowchart and like Hot water in pot
Add sugar
and milk.
flowcharts they should not be used as a & allow to stand.
MORE: Activity charts have more features such as the ability to send a signal, and to block
until a signal is received. See http://cse.csusb.edu/dick/cs557/r1.html and
http://www.agilemodeling.com/artifacts/activityDiagram.htm
Example: consider a small system that aims to alert deaf people to the sound of a siren. A
microphone feeds into a threshold circuit that works out the background noise level. A separate
circuit extracts the frequencies found in the siren signal. Finally a detection algorithm looks at
the energy in the siren frequencies and the noise level, then decides if there is an alarm sound
present. If a siren is detected a light is flashed.
The flow chart and block diagram solutions are shown below.
start
Microphone
Get siren
sample Frequency Frequency
analysis. spectrum.
Noise and
Update siren sound. Detection
threshold algorithm.
Adaptive
threshold
Siren
Filter input for setting.
threshold. Siren
siren sound.
status.
N Alarm light.
Siren Y
Light alarm.
Present?
Illustration 149: Flowchart versus Block Diagram Solution
Questions-
• Which solution is better at showing how the system works?
• Which solution is the best basis to start further design work?
• Which solution will help you split up the work so that the work can be done in parallel?
In each case the block diagram is the better solution BUT in most cases people end up drawing
a flow chart.
HOW TO STOP DRAWING FLOWCHARTS? This is easy for some people but quite
difficult for others. It depends on what skills you have learned so far more than native
intelligence. For example if you have worked a lot with procedural activities such as
programming then it's very hard to avoid drawing a flow chart.
Simple rules to help include-
• Every block must transform energy, information, or materials.
• Every vector must be named to describe the nature of this energy, information, or
materials.
• Decisions are always hidden inside a block.
(This can be hard for those who are good programmers!)
PRACTICE is needed to become good at drawing block diagrams. Make the most of tutorials
and the worked problems.
NATURAL PROBLEM SOLVING : the human mind tends to link from an initial problem
statement right down to a detailed cause. The intermediate steps are unconscious and usually
ignored. Why-why diagrams help the user to discover these intermediate causes and generate
more detailed causes.
COMMENTS
• Excellent communication mechanism : how-how and why-why diagrams are very good at
helping people understand a complex situation.
• Group discussion : the creation of why-why or how-how diagrams can be done by an
individual or by a group. In group discussions a large white-board is useful.
• Equivalence : the how-how and why-why diagrams are usually equivalent except one states
a problem and the other a solution. Only use one to the other.
• Staff attitude : the drawing of a why-why diagram can lead to a negative atmosphere. A
how-how diagram can be more positive.
• General causes must be considered first, interspersed with dives into detail and back up.
This stops tunnel vision, generates more ideas, and gives a better structure to the
problem/solution definition.
• Diagrams can get big, use a large page or put details on separate pages.
FREEMIND is an excellent free mind-map tool that can draw how-how and why-why
diagrams. It has problem that is annoying for 5 minutes, navigation and editing is based on
control key combinations. See Help->Key Documentation PDF to find essential hot keys to
move up and down and swap sides. This approach is actually better for regular use so it ceases
to be an annoyance quite quickly.
UNIVERSITY EDUCATION DOES NOT HELP: yes we said this before and it's worth
saying again. At university you only work on small projects and so small project methods get
ingrained into your mind. When these methods are applied to larger problems the result is
usually a disaster.
Project life cycles will not be that useful at university but in real industry they are essential.
• Concept and deals is where people start to understand what the project is, and make initial
checks and tentative deals with stake holders (those affected by the project).
• Analysis determines what the problem is, what a solution must achieve, risks, and so
generates specifications for the product and product test. It also helps to refine initial
planning estimates. Analysis looks at “what” must be built not “how” it will be built.
Many formal life-cycles ignore the vital market analysis or business case analysis.
Technology plans without purpose or market is a recipe for disaster.
• Product Design is the major concern of most technical staff. It determines “how” to build
and “how” to test the product.
• Product construction takes the design details and creates the real product.
• Product test covers the testing of the product against specifications, relevant operational
scenarios, and known problem areas.
• Operations, maintenance, and extension : covers the commissioning, operation in the field,
the rectification of errors, and modifications to help the product better serve the customer.
OVERLAP & TIME TO MARKET : most real world projects will overlap phases and
activities to get a quicker time to market ( a vital commercial goal).
The key risk is that work at one point will force a rework of work already done.
DO PROCESSES MATTER? A life cycle approach is a process which directs work. How
important are processes compared to other aspects of a project such as good management?
Barry Boehm's COCOMO II software estimation method has looked at the contribution of
many factors to project success and failure. According to Connell (IEEE Software Nov/Dec
2000), statistical analysis shows that bad project processes or methodology will increase effort
by a factor of 1.43. It is notable that this factor, while important, is less than other influences
such as analyst capability ( 2.00), personnel continuity (1.59), and analyst experience (1.51).
While processes do matter, a company with high quality motivated people and poor processes
will outperform a company with lower quality people and good processes. It is even better to
have good people and good processes!
Validation
ITERATION : the model
shows that work in any
phase normally causes Product
Design
changes to the design at the
previous stage. This comes Verifcation
DOD-STD-2167A: in the
1970s the US military was beset by horrible cost overruns and project failures. They developed
a very detailed life-cycle based on the waterfall approach and this did help a great deal. The
foreword to 2167A indicates that "this standard will provide a basis for Government insight into
the contractor's development, testing, and evaluation efforts.".
The specifications are full of acronyms. The reader will need to make frequent reference to the
appendices which explain the acronyms.
The life-cycle is best explained by the following diagrams-
*
PDR FQR
Software
Requirements *
Coding &
Unit Test. Software
Component
Source : Pg 10, DOD-STD-2167A 1988. Test. Software Product Use
Confguration & Deployment.
EEET-2251 Digital Systems Design 1 :
Item Test.
Page 135
Project Life Cycles
DOD-STD-2167A : Detailed Software Lifecycle.
System System Software Preliminary Detailed Coding & Component Confguration System
Requirements Design Requirements Design Design. Unit Integration Item Integration
Analysis. Test. & Testing. Testing. & Testing.
Phase
Analysis.
Software Software •
*
System System Software Preliminary Critical Test Functional &
Requirements Design Specifcation Design Design Readiness Physical
Review. Review. Review. Review. Review. Review. Confg Audits.
Reviews
Product
DOD-STD-2167A
Functional Allocated
Baseline Development Confguration.
Baseline. Baseline. Baseline.
EEET-2251 Digital Systems Design 1 :
Page 136
Project Life Cycles
EEET-2251 Digital Systems Design 1 : Project Life Cycles
BILLION $ DIAGRAMS: the 2167A life-cycle diagrams have been called “billion dollar
diagrams” because they seek to avoid billions of dollars of money lost in wasted development
by the US military. Note especially the 4 lessons noted in the diagrams.
ROLL YOUR OWN: Unlike many life-cycle standards, 2167A mandates particular documents
be generated, reviews be done at particular times, and good practices are followed. There are
useful lists of good practices especially for management of a project. The standard must be
tailored to suit each application by using the tailoring guide MIL-HDBK-287.
COST : Martin has studied many military projects that use 2167A based and concludes that
satisfying 2167A adds between 30% and 50% to the cost of a project [COAD91, pg 207].
This cost is seen as worthwhile because the 2167A approach dramatically increased the amount
of software delivered that is actually useful, and reduced defects.
Costs can be dramatically lowered if the documentation requirements are reduced. This is
especially applicable to smaller projects.
THE BIG PROBLEM …. The waterfall life-cycle was a great improvement on the previous
approaches to managing projects, especially software projects, but it was discovered there was
one killer problem-
The specifications are not tested until the customer uses the product!
If the specification was wrong then the project will have to be abandoned
or an expensive rework cycle started.
In reality most specifications are wrong or miss key items and so a likely outcome is a defective
product that must be reworked. This rework represents a great deal of lost prestige, time, and
money.
The Breakdown-Buildup model that follows illustrates this problem in more detail.
Procedure Working
defnitions. units.
GET IT RIGHT EARLY : the cost of fixing faults varies tremendously. Barry Boehm
[BOEH81] collected data from several software and engineering organizations which suggested
that on average fault costs are-
VARIATION : there is considerable variation between projects, the figure of 100:1 varies
from 5:1 for small non-critical programs up to astronomical figures for failed NASA space
probes
(Boehm & Basili, IEEE Computer, Jan 2001, p 135-137).
Spiral management summary : Boehm suggests that each loop should be planned and reported
in summarized point form. His generic headings include-
* Objectives. * Constraints. * Alternatives
* Risks. * Risk resolution. * Risk resolution results.
* Plans for next phase. * Commitment (resources for next phases)
* Validation or verification results.
STARTS AT STEP 1? Some workers suggest the spiral loop sequence should be really steps
4,1,2,3. In other words the first phase is the planning phase.
WIN-WIN SPIRAL MODEL [IEEE Software, July 1996, pg 78] [IEEE Computer, July 1998,
pg 33-44]. Software lifecycles are often criticized for being too introverted and technology
oriented as they ignore customers and marketing considerations. In response to this Boehm has
modified his Spiral Model to create the Win-Win Spiral model. The phases for each iterative
loop now become-
1. Identify next level stake holders.
2. Identify stake holders win conditions ( interviews, specifications, ...)
3. Reconcile win conditions, establish objectives, constraints, risks and alternatives.
4. Evaluate product and process alternatives. Resolve risks.
5. Define next level of product and process including partitions (subsystems).
6. Validate product and processes definitions ( initially specifications, later on prototypes
and finally the code).
7. Review and commit : check feasibility, decision to continue, make resource and time
commitments for the next cycle.
Prototyping Lifecycle
Changes required.
• No specification : helps cope with those clients who just wont write or read a complete
specification.
WHAT IS EACH LOOP? Each loop should be short and result in something the client can
evaluate. If possible get clients to evaluate the prototype on a regular basis. Loops may be-
• Development of a basic written specification, try to keep these short and leave GUI
specifics to later prototypes.
• Simulations of the final product using paper, a quick screen painter, even a word
processor. Consider using hardware and software that the final product lacks to speed
development.
The aim is to show look and feel of the final product not create the final product.
This approach is useful if the final product development process is slower and more costly
than the use of simulation tools such as Matlab or a word processor.
• Some element of functionality using the real system.
• An incremental change or new item of functionality.
• The final loop creates the delivered product.
THROW AWAY & EVOLUTIONARY : throw away prototypes are those where the code or
hardware will not be used in the next phase, only the look and feel is kept. Evolutionary
prototypes are where the code or design will be used after the demonstration.
AGILE DEVELOPMENT life cycles are basically a prototyping life cycle with extra rules
and processes added. Most software is written using an agile life cycle, typically SCRUM or
XP (Extreme Programming).
Most agile approaches write test cases before the hardware or software is created. This has
been found to dramatically reduce defects.
8 Worked Problems
This section contains worked problems to help you consolidate your understanding of
each area. If you feel your understanding of a topic is good then you can leave these problems
until closer to exam. If you feel less certain then try them directly after the lecture covers the
material, and then again later just before the exam.
The problems here focus on processes and procedures you must be able to use. Straight
memory based questions can be seen in the exam hints guide.
Consider looking on the web for examples and worked problems. There is a lot out there.
DON'T PEEK! If you just peek at the answers you may as well throw away these worked
problems as you will ruin any educational value. Have a solid try your self first, look at the
lecture notes, look at your lab work, and only when finished or stuck look at the answers.
CONVERSION BETWEEN BINARY AND DECIMAL is a key skill and will no doubt get
practiced in any exam. In most of this course the numbers were limited to 5 binary bits (0-31
decimal) because that is the limit of K-Maps. In later work you will normally work with 8 bit
binary (0-255 decimal) as that is what most low end microprocessors use. See the appendix for
the notes on binary to decimal conversion.
Convert to decimal (easy): 00110, 01001, 11100, 10101, 01010, 11001, 00011, 00000
Convert to binary (harder): 123, 80, 128, 200, 250, 99, 100
GRAY CODE has one particular feature, state that feature and where Gray codes can be
useful.
Create a Gray code for three binary bits (ensure the wrap around from last to first also works).
Simplify: C + BC
Simplify: AB + BC(B + C)
SWITCH LOGIC: using SPDT switches design a circuit intended for mains power. There are
two switches driving one light bulb, from either switch it must be possible to turn the light on
and off. What logic function best describes the operation of these switches?
TRUTH TABLE: the following problem was posed in the lecture notes. If you have not tried
to do it please try now.
1 A 1 A B C Z Y X W
A Z Y
C & C ≥1 0 0 0
C C
B & =1 0 0 1
B
0 1 0
C 0 1 1
C 1 0 0
A & X A &
≥1 W 1 0 1
A A &
& & 1 1 0
B B
C & C 1 1 1
&
B B
Illustration 160: Combination Logic Exercise
Cropper Printer Interlock: the old printing presses had no safety interlocks and so it was
possible to have it squash or chop of the fingers of an unwary printer. Imagine two large metal
plates which carry an engraving of what is to be printed. These are coated with ink, a piece of
paper inserted and the plates squashed together. When the plate are separated the paper has the
ink imprinted on it's surface.
This small logic circuit aims to add an interlock to stop the
motor if there is a problem. +5v
• There is a foot switch to make the printer press the
plates against the paper. This input is F and is active
high, a logic one indicates the switch has been a
pressed. Z
b Logic
• There are two safety switches which check if the Gates
safety guard screen has been pulled down so the f
printers hands cannot be between the plates. These
inputs are A and B and are also active high.
• For the printer to start a run the foot switch must be
active and one or both of the guard switches. This 0v
output is Z and is active high. Illustration 161: : Printer Safety Interlock
Your Task: draw a truth table for the logic function, draw a K-Map and minimize the logic,
draw the gates for an AND-OR implementation and an all NAND
implementation. Z AB
BC
00 01 11 10
Hints: to make sure your answers look the same as the ones in the 0 1 . . 1
A
F
answer section label your truth table with the headings "Index F A B 1 . 1 1 .
Z Comments " where the comments list what is happening with the
circuit. Your K-Map should have the layout as opposite. Illustration 162: : Suggested
Layout
Extension: create the logic using switches between a 240v power source and the start print
power input. Can you simplify it to 3 switches?
MANY ONES: draw a K-Map where the only cell which is 0 is A=1,B=1,C=1 and D=1.
Using K-Maps create a minimal Boolean equation.
Now invert the K-Map so the only cell with a 1 is A,B,C,D=1.
Verify that the first solution is an inversion of the second solution.
A) Draw a schematic of the switches so that there is one input to the combinational logic of the
synchronous circuit, an active high input called Problem which is high if the dead man pedal is
not in the middle position. Draw the truth table for the two switches and the one output and
state which logic function you have created with this configuration.
B) Using the single input from the switches, P, as an input to the combinational logic design a
synchronous circuit using D flipflops that will implement the specification above. Use “W” for
the warning output and “b” for the braking output. Assume you have a one second square wave
available.
C) Outline any weaknesses you see in the proposal, practical design considerations, and any
ways in which the design might be simplified.
Draw a Functional Block Diagram of the system. Be careful to label the boxes and vectors
with meaningful names. Include mandated solutions but keep other blocks generic.
Create a risk analysis table. Experienced and successful project managers always track risks
and actively seek to eliminate those risks. Create a table where column one lists risks to the
proper operation of the system, and column two what action might be taken to eliminate that
risk.
After finishing your risk table state whether the project looks feasible, or should be abandoned.
CONVERSION BETWEEN BINARY AND DECIMAL is a key skill and will no doubt get
practiced in any exam. In most of this course the numbers were limited to 5 binary bits (0-31
decimal) because that is the limit of K-Maps. In later work you will normally work with 8 bit
binary (0-255 decimal) as that is what most low end microprocessors use.
Convert to decimal (easy): 00110, 01001, 11100, 10101, 01010, 11001, 00011, 00000
Answers: 6, 9, 28, 21, 18, 25, 3, 0
Convert to binary (harder): 123, 80, 128, 200, 250, 99, 100
Answers: 1111011, 01010000, 10000000, 11001000, 11111010, 01100011, 01100100
GRAY CODE has one particular feature, state that feature and where Gray codes can be
useful.
Create a Gray code for three binary bits (ensure the wrap around from last to first also works).
Answer: Gray coded numbers only have one bit change between adjacent numbers. This can be
very useful for mechanical shaft encoders to avoid false states.
It helps to write out the number of 1's to use for each number. The pattern used here was-
0, 1, 2, 1, 2, 3, 2, 1
There are several possible gray codes for 3 bits, here are two-
000, 001, 011, 010, 110, 111, 101, 100
000, 100, 110, 010, 011, 111, 101, 001
Simplify: C + BC:
Expression Rule(s) Used
C + BC Original Expression
C + (B + C) DeMorgan's Law.
(C + C) + B Commutative, Associative Laws.
T+B Complement Law.
T Identity Law.
(A + C)A(D + D) + AC + C Distributive.
(A + C)A + AC + C Complement, Identity.
A((A + C) + C) + C Commutative, Distributive.
A(A + C) + C Associative, Idempotent.
AA + AC + C Distributive.
A + (A + T)C Idempotent, Identity, Distributive.
A+C Identity, twice.
You can also use distribution of or over and starting from A(A+C)+C to reach the same result
by another route.
TRUTH TABLE: the following problem was posed in the lecture notes. Here is the solution.
1 A 1 A B C Z Y X W
A Z Y
C & C ≥1 0 0 0 1 0 0 0
C C
B & =1 0 0 1 0 0 0 0
B
0 1 0 1 0 1 1
0 1 1 1 0 1 1
C C
A & X & 1 0 0 1 0 0 0
A W 1
A ≥1 & 0 1 1 0 1 1
& A &
B B 1 1 0 1 1 0 0
C & C 1 1 1 1 0 1 1
&
B B
Illustration 165: : Truth Table Solutions
Cropper Printer Interlock: the old printing presses had no safety interlocks and so it was
possible to have it squash or chop of the fingers of an unwary printer. Imagine two large metal
plates which carry an engraving of what is to be printed. These are coated with ink, a piece of
paper inserted and the plates squashed together. When the plate are separated the paper has the
ink imprinted on it's surface.
This small logic circuit aims to add an interlock to stop the
motor if there is a problem. +5v
• There is a foot switch to make the printer press the
plates against the paper. This input is F and is active
high, a logic one indicates the switch has been a
pressed. Z
b Logic
• There are two safety switches which check if the Gates
safety guard screen has been pulled down so the f
printers hands cannot be between the plates. These
inputs are A and B and are also active high.
• For the printer to start a run the foot switch must be
active and one or both of the guard switches. This 0v
output is Z and is active high. Illustration 166: : Printer Safety Interlock
Your Task: draw a truth table for the logic function, draw a K-Map and minimize the logic,
draw the gates for an AND-OR implementation and an all NAND
implementation. Z AB
BC
00 01 11 10
Hints: to make sure your answers look the same as the ones in the 0 1 . . 1
A
F
answer section label your truth table with the headings "Index F A B 1 . 1 1 .
Z Comments " where the comments list what is happening with the
circuit. Your K-Map should have the layout as opposite. Illustration 167: : Suggested
Layout
Extension: create the logic using switches between a 240v power source and the start print
power input. Can you simplify it to 3 switches?
0v
Z AB
BC F F
& A & Z
00 01 11 10 A Z
>=1 &
0 1. . . 1. F F
A
F & &
1 . 1 1 1. B B
Z = F.B + F.A = F. (A + B) A
F
Start Print
240v power B
Illustration 168: : Cropper Printer Solution
Index f b g w comments
w BC
fb
0 0 0 0 1 all pushed, stop
1 0 0 1 1 go inactive, stop 00 01 11 10
2 0 1 0 1 legitimate forward, w off 0 1 1. 1. 1.
A
g
3 0 1 1 1 go inactive, stop 1 1. 1 1 1.
4 1 0 0 . legitimate bwd, w on.
5 1 0 1 1 go inactive, stop w=g+b+f
6 1 1 0 1 go active, no fwd or bwd w = /g . f . /b
7 1 1 1 1 go inactive, stop
b b 1
w w
f 1 >=1 f &
g g 1
AND - OR Implementation All NAND Implementation
• Z: the bigger the group of 1's the simpler the logic. If a 1 is mapped multiple times that is
good.
• Y: diagonal patterns can sometimes be simplified using XOR gates.
• X: this really should be done on an 8 cell K-Map!
• W: remember to look for mapping that wraps around the ends and corners.
R=1 R=1
0 1 2 3 4
Index Key
5 6 7
0 1 3 2
4 5 7 6
Index q2q1q0 d2d1d0
0 0 0 0 0 0 1 q1q0
1 0 0 1 0 1 0 d2
00 01 11 10
2 0 1 0 0 1 1
3 0 1 1 1 0 0 0 . . 1 .
q2
4 1 0 0 1 0 0 1 1 1 1 1
5 1 0 1 1 0 1
6 1 1 0 1 1 0 q1q0
d1
7 1 1 1 1 1 1 00 01 11 10
0 . 1 . 1
d2 = q2 + q1.q0 q2
1 . . 1 1
d1 = q2.q1 + q1.q0 + q2.q1.q0
d0 = q2.q0 + q2.q0 q1q0
d0
00 01 11 10
0 1 . . 1
q2
1 . 1 1 .
Note that for analysis the K-Maps are not needed, it is easier to take the Boolean logic equation
for each flipflop input, apply the 8 possible values of q2q1q0, and write the result directly into
the truth table. Assume a cell is zero unless an AND term gives a one.
The counter is a synchronous modulo 5 counter that counts from 0 to 4 and stops at 4. An
asynchronous active high reset sets the state back to zero and any stage. States 5, 6, and 7 are a
problem as they lockup in that state. Given the operation of the reset pin this may or may not
be a problem on power up when the device could power up in one of these lock-up states.
A) Draw a schematic of the switches so that there is one input to the combinational logic of the
synchronous circuit, an active high input called Problem which is high if the dead man pedal is
not in the middle position. Draw the truth table for the two switches and the one output and
state which logic function you have created with this configuration.
B) Using the single input from the switches, P, as an input to the combinational logic design a
synchronous circuit using D flipflops that will implement the specification above. Use “W” for
the warning output and “b” for the braking output. Assume you have a one second square wave
available.
C) Outline any weaknesses you see in the proposal, practical design considerations, and any
ways in which the design might be simplified.
B. Logic Solution
The state diagram is a string of eight states counting out the 7 seconds, this requires 3 flipflops.
If P is low the state always goes to zero, if P is one the states count up to 7 and stay there if P
is high. The outputs W and b become active as per the problem description.
Dead
DeadMan
ManPedal
PedalSolution
Solution
Index Inputs Outputs
QQQ DDD
210P 210Wb Cell Q0P
0 0000 00001 Position 00 01 11 10
1 0001 00101 Map 00 0 1 3 2
2 0010 00001
QQ 01 4 5 7 6
3 0011 01001 21 11 12 13 15 14
----------------------
10 8 9 11 10
4 0100 00001
5 0101 01101
6 0110 00001 D2 Q0P D1 Q0P
7 0111 10001 00 01 11 10 00 01 11 10
---------------------- 00 . . . . 00 . . 1 .
8 1000 00011 QQ 01 . . 1 . QQ 01 . 1 . .
9 1001 10111 21 11 . 1 1 . 21 11 . 1 1 .
10 1010 00011 10 . 1 1 . 10 . . 1 .
11 1011 11011
----------------------
12 1100 00011
D0 Q0P W Q0P
13 1101 11111
00 01 11 10 00 01 11 10
14 1110 00010
15 1111 11110 00 . 1 . . 00 . . . .
QQ 01 . 1 . . QQ 01 . . . .
21 11 . 1 1 . 21 11 1 1 1 1
D2 = Q2.P + Q1.Q0.P
D1 = Q1.Q0.P + Q2.Q0.P + Q1.Q0.P 10 . 1 . . 10 1 1 1 1
D0 = Q0.P + Q2.Q1.P
W = Q2 Q0P
b = Q0 + Q2 + Q1
b
00 01 11 10
00 1 1 1 1
QQ 01 1 1 1 1
21 11 1 1 . .
10 1 1 1 1
State 00 could be a problem as once in state 00 there is no way to get out, it is a lockup state.
It is possible the circuit will power up in this state and never move out thus preventing normal
operation.
Analysis mode FBD This expresses what must be achieved not how to do it.
water_level_alarm
Signal heart_beat
Water level water_level Communications
conditioning
measurement. link.
& analysis
signals_to_central
power_to_all_blocks
Energy source.
Alternatives This task is usually done by experienced engineers who have a life time of
experience and reading which helps them generate novel and workable solutions.
Water Level Indicator: water turbine, camera and level post, thermisters (thermal contact with
water changes resistance), DC conductivity probes, capacitive (AC) conductivity probes, float
switches (several at key heights).
Signal conditioning: has two parts, sanitizing electrical signals (getting rid of interference) and
deciding if there is an alarm state. This depends a lot on the water level indicators used.
Most likely this will require a small microprocessor which can also drive the communications
link and drive the hear beat signal which shows the system is alive and active.
Communications link: HF radio, satellite phone, 4G phone.
Energy source: water turbine, battery, solar panel.
Alternative Selection
All the water level indicators are susceptible the tropical environment and flooding so choose a
camera set well above the river. Single images can be analyzed for river height, and then
compressed and sent as required. The camera is pointed to a post that has heights written on it.
A small microprocessor can handle the image processing and driving the communications link.
The communications link is very dependent on the local communications infrastructure. In
Copyright © Pj Radcliffe 2018 Page 174
EEET-2251 Digital Systems Design 1 : Worked Problems
order the preference would be 4G phone, HF radio, then satellite phone. Any units would need
a low power mode. In this example we will use an HF radio.
The energy source is probably best as solar with a storage battery. This can be made fully
sealed which is robust and has no moving parts.
Implementation FBD
A FBD does not show everything, just the main energy, information, and materials flows.
Control and decisions are usually omitted, for example the FBD has not shown power control to
the radio and CCD camera, or deciding if to sending an image via the radio. This can be
described in the text description that should be developed for each block when using the FBD
approach.
The microprocessor software deserves to be designed at a system level. FBD can be useful
when the database and program structural requires are low which is true in this case.
HF_radio
compressed_image_data
line_of_sight heart_beat
River height
CCD camera.
post. post_image
Microprocessor
charge_management
power battery_charge
Solar cell Charge
Energy source.
controller
power_to_all_blocks
Is there a flaw?
Actually there is a bad flaw in the system which means this design is not suitable for the
intended purpose. Can you work out what it is?
• What is the best way to ensure such flaws are found early in the project?
• Why is it important to find such defects early in the project?
• Can project life cycles help uncover such flaws?
Are there solutions to this flaw? Have a think about it ...
Draw a Functional Block Diagram of the system. Be careful to label the boxes and vectors
with meaningful names. Include mandated solutions but keep other blocks generic.
Create a risk analysis table. Experienced and successful project managers always track risks
and actively seek to eliminate those risks. Create a table where column one lists risks to the
proper operation of the system, and column two what action might be taken to eliminate that
risk.
After finishing your risk table state whether the project looks feasible, or should be abandoned.
1.0 5.0
Application software. 3 hr battery
back up for
2.1 web_commands 5.1 PC_ PC.
2.0 power
Windows OS
+ web server. 7.2 mains
9.1 local_
ethernet 6.0 7.0
sensor 3 hr battery
_node 7.2 mains
7.1 node back up.
_power
8.0 7.0
controller 3 hr battery 7.2 mains
_node 7.1 node back up.
_power
9.0 10.0
gateway remote_doctor
9.2 www
Note : there are multiple PCs and nodes of the ethernet, and multiple remote doctors.
Comments
• Two node types? The distinction between sensor and controller nodes is probably not
warranted. Either type of node will probably have reads and writes so the term
equipment_node may be better, and replace both type of nodes on the FBD.
• Abstract? The diagram captures the clients mandatory requirements but keeps the other
items generic (eg. the web server is not defined as a specific product).
• Ward focus weak : the diagram doesn't directly show local doctors, nurses, ward equipment
and ward beds. If the diagram is to be shown to customers or clients it may be wise to add
these things in.
Index f b g w x Y Z comments
w BC
fb
0 0 0 0 1 1 . . all pushed, stop
1 0 0 1 1 1 . . go inactive, stop 00 01 11 10
2 0 1 0 1 . . 1 legitimate forward 0 1 1. 1. 1.
A
g
3 0 1 1 1 1 . . go inactive, stop 1 1. 1 1 1.
4 1 0 0 . 1 1 . legitimate bwd
5 1 0 1 1 1 . . go inactive, stop w=g+b+f
6 1 1 0 1 1 . . no fwd or bwd, stop w = /g . f . /b
7 1 1 1 1 1 . . go inactive, stop
x BC
fb Y BC
fb Z BC
fb
00 01 11 10 00 01 11 10 00 01 11 10
0 1 . 1. 1 0 1. . . 1 0 1. 1. . 1.
A
g A
g A
g
1 1. 1 1 1. 1 . 1. 1. . 1 . 1. 1. .
Note /a is an inversion of a.
Answer: a microprocessor or PC running software cannot be trusted to run this circuit. Any
crash or glitch may cause the wrong two FETs to turn on, form a short from 0v to +5v, and
blow the FETs.
9 Appendix 1
This section contains useful notes which are not part of the main lecture notes.
The Hindu-Arabic number system that we use today evolved in India sometime before the 9th
century. It had two key concepts that are common to all our number systems-
• A digits value or weighting depends which column it is in.
• The digit zero represents a nil value.
For example 5308 =8 x 1 + 0 x 10 + 3 x 100 + 5 x 1000
Each column has a WEIGHTING , from right to left these are 1, 10, 100, 1000. Note
factor of ten between each column and the fact there are 10 number symbols (0 to 9). This
leads to the Hindu-Arabic numeral system being called decimal (deci meaning 10 based). The
system is said to have BASE or RADIX ten. It is quite possible to have bases other other than
ten as we shall see.
A radix containing R possible digits (including 0) with C columns can represent the
numbers from 0 to (RC -1). For example a 3 digit decimal number can represent the numbers 0
to (103 -1) = 999.
The column weighting principle is the reason for the simple methods we have for adding,
subtracting, multiplying and dividing. Operations we consider trivial (such as 1234 x 6789)
would be a major problem using most other number systems such as Roman numerals.
The basic Hindu-Arabic system has been embellished by the addition of a DECIMAL
POINT Numbers to the right of the decimal point are fractions. The column weighting left to
right is 1/10, 1/100, 1/1000 etcetera.
A further embellishment is the use of the minus sign which indicates an "owing" or
negative value.
Example 101100 = 0 x 1 + 0 x 2 + 1 x 4 + 1 x 8 + 0 x 16 + 1 x 32
Note the column weighting (going right to left) is 1,2,4,8,16,32 ... . The binary number
system works by exactly the same rules as the decimal system does. The only difference is that
only digits 0 and 1 are used.
UNSIGNED binary numbers do not represent negative binary numbers only positive ones.
A binary number with N binary digits can represent the numbers from 0 to (2N -1).
SIGN MAGNITUDE is simply adding an extra bit to indicate whether the number is
positive or negative. Unfortunately there is no simple algorithm or rule to do the addition of
a positive to a negative number. There are two representations of 0 !! For a 5 bit number
both 10000 and 00000 mean zero. Sign magnitude is seldom used because of the these
limitations.
The number range that can be represented is +(2N-1 -1) to -(2N-1 -1).
This transformation is equivalent to inverting all bits then adding 1. The number
range that can be represented is +(2N-1 -1) to -(2N-1). Two's complement suffers from none
of the disadvantages that the other number systems do. There is only one version of 0 and
the subtraction procedure is simply applying 2's complement to the numbers to be made
negative then adding. 2's complement is the way nearly all microprocessors handle negative
numbers. Note that all negative numbers will have their top bit set to 1.
OVERFLOW may occur when carry tries to extend into a column that has no hardware to
service it. Consider the following 4 bit binary adder.
Example 1101 13
+0011 + 3
(1)0000 = 0 ??? (overflow error)
SIGN ERROR may occur when adding two large numbers. The result has the wrong sign
due to the finite number of columns. The following example shows a two's complement
addition misbehaving, the carry overflows into the sign bit to cause an error.
RIPPLE CARRY occurs when the addition is done one bit at a time with carry "rippling"
from one bit to the next. The carry operation may propagate from the Least Significant Bit
(LSB) to the Most Significant Bit (MSB). In many machines the longest ripple carry time
limits how fast the arithmetic operations can be performed.
Several number systems have been invented to avoid this problem. They use extra
redundant bits so the carry cannot propagate more than a few bits. These systems all suffer
from NUMBER ALIASES whereby a number can have two or more binary representations.
The logic circuitry to perform arithmetic operations becomes quite complicated but such
systems have been built.
Digital circuits can be designed such that the entire arithmetic add operation occurs at one
time. The number of gates required to do this increases exponentially for the number of bits
in the digital word so this approach is only practical for a small number of bits. Several of
these instantaneous carry arithmetic blocks may be placed in series to increase the size of
the word but a ripple carry is required between blocks. This block by block ripple carry is
much faster than bit by bit ripple carry.
A B A B
CARRY LOOKAHEAD can help speed up the ripple carry associated with 2's complement
arithmetic. Each adder needs an additional output called "propagate carry" which is true if the
output is all ones thus a carry in would propagate to create a carry out. Given this information a
lookahead generator can determine how to set the carry in inputs to each adder. This is shown
in the following diagram-
A B C A B C A B C
Carry
Lookahead Carry Generator
Within each adder block there is no ripple carry. Given the carry out and propagate
carry out from each adder the lookahead generator can determine if a carry in is
required for each adder block.
The total timing cost is one ripple carry delay plus one lookahead generator delay.
The same circuit using ripple carry would take 3 ripple carry delays to settle to a
valid output.
OCTAL is a base 8 number using digits 0 to 7. An octal digit can represent three binary
bits. This reduces the digits you must write by a factor of three. DEC computers (Digital
Equipment Corporation) are based around octal numbering.
123octal = 3 x 1 + 2 x 8 + 1 x 64 = 83 decimal
HEXADECIMAL represents 4 binary bits and thus needs 16 digits, these are 0 to 9 then
A,B,C,D,E,F. Hexadecimal or just "hex" is used more commonly than octal and is almost
universally used for microprocessors.
123hex = 3 x 1 + 2 x 16 + 1 x 256 = 291 decimal
Conversion to decimal has been performed above. The original number has each of its
digits multiplied by the column weighting. -
Converting from decimal to other bases or conversion between other bases can be more
difficult. The method of remainders is best shown by example -
791.7310 3355.4214 6
As with all engineering endeavors it is best to check the result by another means - in this
case conversion back to the previous base.
HEXADECIMAL & OCTAL TO & FROM BINARY conversion is particularly easy. Each
group of 3 binary bits is one octal digit. Each group of four binary bits is one hexadecimal
digit. The example below shows how easy this is.
GRAY CODE has a unique property that Binary Code Gray Code
only one digit alters for each count 0: 000 000
increment. Even the overflow back to zero 1: 001 001
only alters one bit. There are always 2: 010 011
several ways of creating a gray code for a 3: 011 010
given number of bits. 4: 100 110
5: 101 111
6: 110 101
7: 111 100
Gray code is used for shaft encoders for position sensors. Consider a binary coded shaft
where the sensors are slightly misaligned. The transition from 111 to 000 should occur cleanly
but due to misalignment there might be a false intermediate state , say 111 to 100 then to 000.
This false state would send any control system wild. Gray coded position sensors have none of
this difficulty as only one bit changes at a time.
10 References
The references here will make useful reading if you are having trouble with the notes or
want extension material.
ELECTRONIC COMPONENTS
• http://www.mikroe.com/old/books/keu/00.htm is an excellent on-line book that explains
basic electronic components.
11 Index
4000 Series..................................................85 GRAY CODE............................................186
A monostable...............................................83 Group IQ effect.............................................9
AC...............................................................31 Hands-on.......................................................8
Accidents and abuse..................................106 HEXADECIMAL......................................184
Activity diagrams......................................125 Hold time.....................................................80
Algorithmic State Machines........................70 How-How..................................................128
Alternating Current......................................31 Inductive coupling.....................................106
ASM............................................................70 Inductor.......................................................38
Asynchronous logic.....................................65 Intermittent faults..................................93, 98
Baselining....................................................96 Latches........................................................83
Binary..........................................................45 Level mode..................................................65
Binary search...............................................96 Life-cycle...................................................131
Boolean algebra...........................................50 Light Emitting Diodes.................................33
Boolean logic...............................................46 Logic families..............................................48
Breakdown - Build-up...............................138 Logisim........................................................77
Business case.............................................132 Mains electricity..........................................31
Capacitive coupling...................................105 Market analysis.........................................132
Capacitor.....................................................36 Matrix board................................................20
Checklists....................................................94 Metastability................................................81
Clock mode.................................................65 Momentary..................................................39
Color codes..................................................26 Moore's Law................................................42
Combinational logic....................................45 Multimeter...................................................29
Continuous improvement............................10 Observability...............................................94
Controllability.............................................94 Occupational Health and Safety..................12
Copying.........................................................8 OCTAL......................................................184
Correlation analysis.....................................99 OH&S..........................................................12
De Morgan...................................................52 Optocouplers.............................................110
Decoupling capacitors...............................109 PAL.............................................................89
Delayed Gratification....................................9 Peer review..................................................94
Diodes..........................................................33 Plagiarism......................................................8
Electro-magnetic Interference...................105 Power supply noise....................................106
Electrostatic Discharge..............................106 Power-up state.............................................78
EMC..........................................................109 Problem solving...........................................95
Evolutionary prototypes............................145 Programmable Array logic..........................89
Extended State Diagrams............................62 Programmable logic....................................89
Fault.............................................................92 Project life cycles......................................131
Fault costs..................................................139 Prototyping life-cycle................................142
Floating........................................................49 Pulse............................................................78
Flow charts................................................124 Pulse Mode..................................................65
Flux..............................................................20 Reducing input/state bits.............................70
Frequency....................................................32 Regression testing.......................................92
Garbage collectors.......................................99 Remembering................................................8
Glue logic....................................................90 Resilience....................................................10