Digital Electronics Project
Digital Electronics Project
OUTPUTS
Variables Description
R1 Main road’s red light
Y1 Main yellow light
G1 Main green light
R2 Side road’s red light
Y2 Side yellow light
G2 Side green light
W Walk symbol (pedestrians can cross the road)
W0 (W bar) Stop symbol for pedestrians ( Red hand
symbol)
C Countdown of 4 s for the pedestrians already
crossing to finish before the main signal goes
yellow again.
- TS input is a timer for 4 seconds used between changes from green to yellow
or yellow to red or for the pedestrian crossing countdown. All these relations
are explained in this state diagram below.
̅𝑠)P
(TL + V ̅
STATE DIAGRAM: -
State 1:-
Grey code: 000
Main signal: green
Side signal: red
̅S
T Pedestrian sign: RED HAND
Ts Ts
State 6:-
Grey code: 001 State 2:-
Main signal: yellow Grey code: 001
Side signal: red Main signal: yellow
Pedestrian sign: RED HAND Side signal: red
Pedestrian sign: RED HAND
̅S
T
̅S
T
State 4:-
Grey code: 001
Main signal: red
̅L
T Side signal: green
Pedestrian sign: WALK ̅S
T
BLOCK DIAGRAM:-
Let’s work backwards and first look at the combinational logic, assume that a
certain grey code has been sent by the sequential logic circuit which acts as the
input for the combinational part.
(Grey code -----> states)
Grey code: A2 A1 A0
Where A2 is MSB and A0 is LSB
STATE DECODER
Gray code Decoding function States
A2 A1 A0 S1 S2 S3 S4 S5 S6
0 0 0 Ā2 Ā1 Ā0 1 0 0 0 0 0
0 0 1 Ā2 Ā1 A0 0 1 0 0 0 0
0 1 1 Ā2 A1 A0 0 0 1 0 0 0
0 1 0 Ā2 A1 Ā0 0 0 0 1 0 0
1 1 0 A2 A1 Ā0 0 0 0 0 1 0
1 1 1 A2 A1 A0 0 0 0 0 0 1
IMPLEMENTAION IN MULTISIM: -
Figure (6): Sequential logic diagram for the 3 bit gray code counter
Now since the States can recycle amongst themselves and upon certain conditions
move on to the next state, there must be a feedback loop between the output of the
counter and the input logic.
To figure out the exact associated input logic with the counter we must first Find
the logic expressions for each of the input of the D flip flops (D0, D1, D2). And
since the D flip-flop just copies the input ,this input is nothing but the final grey
code (A2 A1 A0).
D2=A2, D1=A1, D0=A0
TRUTH TABLE FOR COUNTER (consists of 3 FLIP-FLOPS)
0 0 0 0 0 1 ̅LP + T
T ̅ L V𝑠 0 0 1
0 0 1 0 0 1 TS 0 0 1
0 0 1 1 1 0 ̅S
T 1 1 0
0 1 1 0 1 1 TS 0 1 1
0 1 1 0 1 0 ̅S
T 0 1 0
0 1 0 0 1 0 TL 0 1 0
0 1 0 1 1 0 ̅L
T 1 1 0
1 1 0 1 1 0 TS 1 1 0
1 1 0 1 1 1 ̅S
T 1 1 1
1 1 1 1 1 1 TS 1 1 1
1 1 1 0 0 0 ̅S
T 0 0 0
Based on;
Now we must find out the logic functions for D1, D2, D3. Building Karnaugh
maps can be a bit tricky here as the outputs has different conditions( specifically
for D0, while D1, ,D2 are straightforward). Another simpler way to do it can be
using truth tables .
Since D depends on the present state, the input conditions and the inputs we can
draw the following 3 tables from the main truth table of the counter given above to
extract their logic functions
FOR D0:-
A2 A1 A0 conditions TL TS VS P D0
0 0 0 ̅LP + T
T ̅L 0 - 1 1 1
V𝑠
0 0 1 TS - 1 - - 1
0 1 1 TS - 1 - - 1
1 1 0 ̅S
T - 0 - - 1
1 1 1 TS - 1 - - 1
SOP EXPRESSION:-
̅LP + T
D0=( (T ̅ L V𝑠) . Ā2 Ā1 Ā0 ) + (Ā2 Ā1 A0 TS ) + (Ā2 A1 A0 TS ) +
(A2 A1 Ā0 T̅ S) + (A2 A1 A0 TS )
For D1:-
A2 A1 A0 conditions TL TS VS P D1
0 0 1 ̅S
T - 0 - - 1
0 1 1 TS - 1 - - 1
0 1 1 ̅S
T - 0 - - 1
0 1 0 TL 1 - - - 1
0 1 0 ̅L
T 0 - - - 1
1 1 0 TS - 1 - - 1
1 1 0 ̅S
T - 0 - - 1
1 1 1 TS - 1 - - 1
0 0 1 ̅S
T - 0 - - 1
0 1 0 ̅L
T 0 - - - 1
1 1 0 TS - 1 - - 1
1 1 0 ̅S
T - 0 - - 1
1 1 1 TS - 1 - - 1
SOP EXPRESSION:-
̅ S ) + ( Ā2 A1 Ā0 T
D2=( Ā2 Ā1 A0 T ̅ L) +(A2 A1 Ā0 TS ) + (A2 A1 Ā0 T
̅ S ) + (A2
A1 A0 TS ).
̅ S ) + ( Ā2 A1 Ā0 T
D2=( Ā2 Ā1 A0 T ̅ L) +(A2 A1 Ā0) + (A2 A1 A0 TS ).