traffic light controller

14
By: Eng Ahmed Salad Osman Traffic Light Controller

Upload: eng-ahmed-salad-osman

Post on 13-Apr-2017

368 views

Category:

Technology


0 download

TRANSCRIPT

By: Eng Ahmed Salad Osman

Traffic Light Controller

Traffic light controller• There are four states–NG: north south green–NY: north south yellow– EG: east west green– EY: east west yellow

First take NC : no car on the way Take C :car on the wayThere are four inputs

(NC,NC)(NC,C)(C,NC)(C,C)

format(north south, east west)

• There are four outputs– North south green : east west red– North south yellow : east west red , yellow– North south red : east west green– North south red , yellow : east west yellow

(-, NC)

(G, R)

(-, C)

(Y, R and y)

(-, -) (R, G)

(NC, -)

(C, -)

(Y and R, Y

(-, -)

State Diagram

State transitionState Input Next State Output

NG (-, NC) NG (G,R)

NG (-,C) NY (Y, R and Y)

NY (-,-) EG (R,G)

EG (NC,-) EG (R,G)

EG (C,-) EY (R and Y , Y)

EY (-,-) NG (G,R)

format(north south, east w

est)

Codinginputs coding

(NC,NC) 00

(NC,C) 01

(C,NC) 10

(C,C) 11

States coding

NG 00

NY 01

EG 10

EY 11

State Input Nest state output

S S I I N N R Y G R Y G

0 0 - 0 0 0 0 0 1 1 0 0

0 0 - 1 0 1 0 1 0 1 1 0

0 1 - - 1 0 1 0 0 0 0 1

1 0 0 - 1 0 1 0 0 0 0 1

1 0 1 - 1 1 1 1 0 0 1 0

1 1 - - 0 0 0 0 1 1 0 0

0 1 0 1 S0 S1 1 1 1

1 1 1 1

1 1 1 1

S0 S1

I 0 I 101 1000 11

00

01

11

10

1 1

1 1

S0 S1

I 0 I 101 1000 11

00

01

11

10

Ns0

Ns1

=

..

1 1 1 1

1 1 1 1

S0 S1

I 0 I 101 1000 11

00

01

11

10

1 1

1 1

S0 S1

I 0 I 101 1000 11

00

01

11

10

R

Y

𝑅=𝑠1

𝑦=𝑠0 .𝑠1. 𝐼 1+¿ 𝑠0 .  𝑠1 . 𝐼0¿

1 1

1 1 1 1

S0 S1

I 0 I 101 1000 11

00

01

11

10

1 1 1 1

1 1 1 1

S0 S1

I 0 I 101 1000 11

00

01

11

10

G

R1

.+.

𝑅1=¿ 𝑠0⊕𝑠1¿

1 1

1 1

S0 S1

I 0 I 101 1100 10

00

01

10

11

1 1 1 1

1 1

S0 S1

I 0 I 101 1000 11

00

01

11

10

Y1

G1

𝑌 1=𝑠0 .𝑠1 . 𝐼 1+¿ 𝑠0 .  𝑠1 . 𝐼0¿

.+.

Question

?