ivandelaghetto
10,081 views
56 slides
Feb 14, 2016
Slide 1 of 56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
About This Presentation
Traffic light controller Design using mealy and moore model.
Size: 2.61 MB
Language: en
Added: Feb 14, 2016
Slides: 56 pages
Slide Content
University of Mauritius
Faculty of Engineering
Department of Electrical and Electronic Engineering
Programme: BEng(Hons) Electrical and electronic Engineering
(Year 3)
Module: Electronic System Design
TRAFFIC LIGHT CONTROLLER DESIGN
IVAN TIM OLOYA:0900153
KAVI GOPAUL:0913166
WILLIAM ULRICH JOUBERT:0900145
Date Submitted : 03/07/2013
1
1. Literature Review
1.1 State Machines
State machines, also known as finite state machines are circuits that can performs different sets
of sequences of operation controlled by a clock and other inputs.
The state machine can be divided into
(i) Completely specified FSM
(ii) Incompletely specified FSM
Unlike the other, the CS FSM is one which every internal states are defined for each and every
input possibilities.
The type of output of the CSFSM can be categorised as
(i) Mealy Model : where output is dependent upon the present states and the inputs.
(ii) Moore Model : where output is dependent upon present states only.
For designing states machines, once the type of CSFSM has been decided the state diagram showing the
sequence of operation can be obtained and its state table can be easily obtained. Furthermore the state
table can be minimized by using either row matching method or implication chart method. Once the
final state table is obtained designing the system can statrt.
1.2 Programmable Logic Devices (PLD)
A PLD contains a large number of logic gates within a single a package, but allows a user to determine
how they are interconnected; this technology is known as un-committed logic. Since the gate are not
committed to any specific function at the time of manufacture, the various gates within a device and the
interconnections are arranged within one or more arrays. For this reason this form of logic is also known
as array logic. There are many forms of array logic, some of the most widely used include;
a) PLA programmable logic array
b) PAL programmable array logic
c) GAL genetic array logic
d) PROM programmable read only memory
e) CPLD complex programmable logic device
f) FPGA field programmable gate array
1.3 Existing Model
1.3.1 Specification
In this model, a traffic light controller is needed to control the traffic between a main street
and a side street.
2
The main street needs to have green light for 30s followed by 5s transitional caution light
and finally red light. The side street needs to have red light as long as there is green light or
yellow light on the main and green light when the main has a red.
Figure 1.1 Sequence of operation
The table below summarises the sequence and duration
Duration/s Main Side
30 Green (MG) Red (SR)
5 Yellow (MY) Red (SR)
30 Red (MR) Green (SG)
5 Red (MR) Yellow (SY)
Table 1.1 sequence and duration
The controller needs to have six defined outputs and a timer to control the duration of the
lights.
Figure 1.2 Block diagram of the traffic light controller
1.3.2 Steps used in designing the system
1. Timer, T
T has a frequency,f1 , and duty ratio,D, to control sequence duration of 30s followed by 5s.
3
(i) Frequency ,f1
??????
1=
1
35
=0.0286 �??????
(ii) duty ratio, D
�=
30
35
=0.857
When T is high, this corresponds to duration of 30s and when T is low, the duration will be 5s.
Figure 1.3 Timer duration control
2. Finding state equations and output equations.
To find the state equations and output equations the state diagram is required. The controller has four
possibilities of output between the main and side street hence they are defined as states and are
assigned a variable as per the table below.
State Representation
S0 MG and SR
S1 MY and SR
S2 MR and SG
S3 MR and SY
Finally the state diagram is as follows.
Figure 1.4 State Diagram
4
For simplicity only the high outputs of the respective states has been used .
3. State table
The state table is obtained from the state diagram and the states are assigned as per the table
below.
The new model will designed using the similar concept of the existing model and the
feature to be added is the pedestrian lights. The procedures to be followed are:
1. Find the possible outputs
2. Identify the sequence hence the state diagram
3. State table and excitation table
4. State equations and output equations
5. Logic design
1. According to the specifications the possible outputs are summarised in the table
below
TRANSISTION
TIME(T)/SECONDS
MAIN ROAD (M) SIDE ROAD (S) PEDESTRIAN(P)
25 GREEN (G) RED(R) RED(R)
5 YELLOW (Y) RED(R) RED(R)
25 RED(R) GREEN (G) RED(R)
5 RED(R) YELLOW (Y) RED(R)
25 RED(R) RED(R) GREEN (G)
5 RED(R) RED(R) GREEN (G)
2.1 sequence of operation and duration of each states
2.1.2 State Diagram
Fig 2.2 state diagram of the controller
�0
MGSRPR
�1
MYSRPR
�2
MRSGPR
�5
MRSRPY
�3
MRSYPR
�4
MRSRPG
�=1/C=X
T=0/C=X
T=1/C=
X
T=0/C=
X
�=
0/C=X
6
Hence the following state transition table and excitation table are obtained.
NEXT
STATES
OUTPUT
Z
T C
PRESENT
STATES
00 01 10 11
S0 S1 S1 S0 S1 MGSRPR
S1 S1 S1 S2 S2 MYSRPR
S2 S3 S3 S2 S2 MRSGPR
S3 S3 S3 S0 S4 MRSYPR
S4 S5 S5 S4 S4 MRSRPG
S5 S5 S5 S0 S0 MRSRPY
2.1 state transition table for the controller
7
Table 2.2 Excitation table of the controller
From the excitation table the flip flop equations and the output equations can be obtained and
minimised using k-map.
PRESENT STATE INPUT NEXT STATE OUTPUT Flip Flop i/p
Q2 Q1 Q0 T C Q2
+
Q1
+
Q0
+
MR MY MG SR SY SG PR PY PG D2 D1 D0
0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 1
0 0 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 0 0 1
0 0 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0
0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0
0 0 1 0 0 0 0 1 0 1 0 1 0 0 1 0 0 0 0 1
0 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 0 0 0 1
0 0 1 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
0 0 1 1 1 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
0 1 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1
0 1 0 0 1 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1
0 1 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0 0 1 0
0 1 0 1 1 0 1 0 1 0 0 0 0 1 1 0 0 0 1 0
0 1 1 0 0 0 1 1 1 0 0 0 1 0 1 0 0 0 1 1
0 1 1 0 1 0 1 1 1 0 0 0 1 0 1 0 0 0 1 1
0 1 1 1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0
0 1 1 1 1 1 0 0 1 0 0 0 1 0 1 0 0 1 0 0
1 0 0 0 0 1 0 1 1 0 0 1 0 0 0 0 1 1 0 1
1 0 0 0 1 1 0 1 1 0 0 1 0 0 0 0 1 1 0 1
1 0 0 1 0 1 0 0 1 0 0 1 0 0 0 0 1 1 0 0
1 0 0 1 1 1 0 0 1 0 0 1 0 0 0 0 1 1 0 0
1 0 1 0 0 1 0 1 1 0 0 1 0 0 0 1 0 1 0 1
1 0 1 0 1 1 0 1 1 0 0 1 0 0 0 1 0 1 0 1
1 0 1 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0
1 0 1 1 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0
1 1 0 0 0 X X X X X X X X X X X X X X X
1 1 0 0 1 X X X X X X X X X X X X X X X
1 1 0 1 0 X X X X X X X X X X X X X X X
1 1 0 1 1 X X X X X X X X X X X X X X X
1 1 1 0 0 X X X X X X X X X X X X X X X
1 1 1 0 1 X X X X X X X X X X X X X X X
1 1 1 1 0 X X X X X X X X X X X X X X X
1 1 1 1 1 X X X X X X X X X X X X X X X
A programmable logic array is a kind of programmable logic device used to implement combinational
circuits. The structure of the PLA is shown in (design of FPLA). This show an arrangement with five inputs
(Q2, Q1, Q0, T, P) which are inverted to produce 5 pairs of complementary inputs. The signals are then
each connected through an array of fusible links. These fuses are initially all intact, but they may be
blown selectively to determine the pattern of connections between the inputs. Signals and the AND
gates. In this way each AND gate corresponds to an individual minterm. A second array of fuses is used
to connect the outputs of the AND gates to a collection of OR gates. These OR gates combine the
relevant minterms to produce various outputs.
In order to represent symbolically the large number of gates and interconnections within a typical
device, it is conventional to adopt a more compact notation that reduces a large number of
interconnecting wires within various array.
The symbols used when drawing logic arrays are shown in (design of FPLA). Here a single line is drawn to
represent all inputs to the gate and a cross used to indicate those inputs lines that are connected to that
gate.
18
The product terms were obtained from the moore model design in section 2
Figure 3.2 Design of FPLA
4. Implementation on the GAL
The system to be implemented on the GAL is a sequential circuit. The sequence of
operation from the state table and the output equations obtained from the moore
20
model will be used to program the GAL in wincupl. Since there are 9 outputs 2
G16V8 ICs is used to implement the system.
1.4.1 design file for first IC
On the first IC the flip flop states will be generated and it will also contain the
output for the main red.
(a) Program file
Name ESD ASS ;
PartNo 00 ;
Date 26-Feb-13 ;
Revision 01 ;
Designer Engineer ;
Company UOM ;
Assembly None ;
Location REDUIT ;
Device g16v8 ;
==========================================================================
=====
Symbol Table
==========================================================================
=====
Pin Variable Pterms Max Min
Pol Name Ext Pin Type Used Pterms Level
--- -------- --- --- ---- ------ ------ -----
C 3 V - - -
CLK 1 V - - -
FOLLOW 0 I 1 - -
GO 0 I 1 - -
MODE 0 F - - -
MR 15 V 2 7 1
NOPED 0 I 1 - -
PED 0 I 1 - -
Q0 12 V - - -
Q0 d 12 X 2 8 1
Q1 13 V - - -
Q1 d 13 X 3 8 1
Q2 14 V - - -
Q2 d 14 X 3 8 1
T 2 V - - -
state 0 F - - -
MR oe 15 D 1 1 0
LEGEND D : default variable F : field G : group
I : intermediate variable N : node M : extended node
U : undefined V : vari able X : extended
variable
T : function
1.4 Design file for second IC
The second IC will contain the rest of the outputs that is the main yellow and
green,side red,yellow and green and the pedestrian also.
Name output ;
PartNo 00 ;
Date 03-Mar-13 ;
Revision 01 ;
Designer Engineer ;
Company Home ;
Assembly None ;
Location ;
Device g16v8 ;
CUPL(WM) 5.0a Serial# 60008009
Device g16v8s Library DLIB -h-40-9
Created Mon Mar 04 22:25:25 2013
Name output
Partno 00
Revision 01
Date 03-Mar-13
Designer Engineer
Company Home
Assembly None
Location
==========================================================================
=====
Expanded Product Term s
==========================================================================
=====
U0 =>
Q0 & !Q1 & !Q2
U1 =>
!Q0 & !Q1 & !Q2
U2 =>
!Q1
31
U3 =>
Q0 & Q1
U4 =>
!Q0 & Q1
U5 =>
!Q2
U6 =>
!Q0 & Q2
U7 =>
Q0 & Q2
==========================================================================
=====
Symbol Table
==========================================================================
=====
Pin Variable P terms Max Min
Pol Name Ext Pin Type Used Pterms Level
--- -------- --- --- ---- ------ ------ -----
Q0 2 V - - -
Q1 3 V - - -
Q2 4 V - - -
U0 12 V 1 8 1
U1 13 V 1 8 1
U2 14 V 1 8 1
U3 15 V 1 8 1
U4 16 V 1 8 1
U5 17 V 1 8 1
U6 18 V 1 8 1
U7 19 V 1 8 1
LEGEND D : default variable F : field G : group
I : intermediate variable N : node M : extended node
U : undefined V : variable X : extended
variable
T : function
Fig 4.1 Results onbtained on Winsim
4.8 Hardware Analysis
Initially the debounce switch input is low and T is varied manually. The first
output is that of state S0 that is MG,SR and PR is high.
The last LED will be used for the PG and PY output since the board contain an LED less than the
controller. Then T is set low and state S1 is obtained.
State S1
T is set high and the following output is obtained
State S2
36
T is then set low.
State S3
T is set high
State S0
After this state debounce switch input is set high.
State S1
State S2
State S3
37
State S4
The last LED is representing the PG output and the PY was low when tested.
State S5
Last LED representing PY and PG was low.
The two ICs of 20 pins were placed in the IC test socket of 40 pins. For the first IC, pin number 0
to 10 of the IC test socket represents pin number 0 to 10 of the IC. Pin 31 to 40 of the IC test
socket corresponds to the pin number 11 to 20 of the first IC.
For the second IC pin 1 to 10 corresponds to 11 to 20 of the IC test socket and 11 to 20
corresponds to 21 to 30 of the IC test socket. The table below summarises the pin relationship
between the Ics and the IC test socket.
IC Pins IC test socket Pins
first 1 – 10 1 – 10
11 – 20 31 – 40
second 1 – 10 11 – 20
11 – 20 21 – 30
Table 4.1 Pins relationship between IC and IC test socket
38
APPENDIX
Datasheets for Quad 2-input AND Gate (74LS08)
39
40
APPENDIX A3
Datasheet for 3-input AND Gate(74LS11)
41
42
APPENDIX A4
Datasheet for Dual 4-input AND Gate (74LS21)
43
44
APPENDIX A5
Datasheet for Quad-2 input OR Gate (74LS32)