Digital Systems. Topic?: Pump Design Problem

Digital Systems Topic ?: Pump Design Problem Objectives • To design a State Machine to Control two pumps using JK flip-flops – Design the state dia...
5 downloads 0 Views 922KB Size
Digital Systems

Topic ?: Pump Design Problem

Objectives • To design a State Machine to Control two pumps using JK flip-flops – Design the state diagram – Design the state table – Design the circuit using JK flip-flops – Implement the circuit in schematic capture • Simulate/test the circuit

8/18/2010

2

Design Description/Specifications • Pump Controller 1.

2.

L4 L3

3. L2

4.

Pump 1 is to be turned on (P1=1) whenever the fluid level reaches level 2 (L2=1) or higher. Pump 1 is turned off (P1=0) whenever the fluid level falls below level 1 (L1=0) Pump 2 is to be turned on (P2=1) whenever the fluid level reaches level 4 (L4=1) or higher. Pump 2 is turned off (P2=0) whenever the fluid level falls below level 3 (L3=0) Assume an initial state in which both pumps are off and the fluid level is below level 2 Develop a state machine using JK flip-flops

L1

Pump 1 Pump 2

8/18/2010

3

FSM Design Steps 1. 2.

Obtain the specifications of the desired circuit Derive the states of the machine and develop a state diagram 1. 2.

3. 4.

Develop the state table from the state diagram Decide on the number of state variables needed to represent all states 1.

5.

Minimize the number of states if possible

Choose the type of flip-flops that will be used in the implementation 1. 2.

6.

Should show all possible states Provide the conditions for which the circuit moves from one state to the next

Derive the next-state logic expressions to develop the Input Logic Circuit Derive the logic expressions for the Output Logic Circuit

Implement the design

8/18/2010

4

State Diagram 1.

A P1=0,P2=0

L2=1

L1=0

2.

B P1=1,P2=0

L4=1

3. L3=0

4.

Pump 1 is to be turned on (P1=1) whenever the fluid level reaches level 2 (L2=1) or higher. Pump 1 is turned off (P1=0) whenever the fluid level falls below level 1 (L1=0) Pump 2 is to be turned on (P2=1) whenever the fluid level reaches level 4 (L4=1) or higher. Pump 21 is turned off (P2=0) whenever the fluid level falls below level 3 (L3=0) Assume an initial state in which both pumps are off and the fluid level is below level 2 Develop a state machine using JK flip-flops

C P1=1,P2=1

8/18/2010

5

State Table A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

If L1 = 0, then all of the other sensors are also 0 If L4 = 1, then all of the other sensors are also 1 Generally: If a sensor is 1, all sensors below it are also 1 If a sensor is 0, then all sensors above it are also 0

8/18/2010

6

State Table A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

8/18/2010

So, if the FSM is in state A and L1=0, then all of the other sensors are 0, and L1 is the only one that is important to recognize as an input Likewise, if L2 =1, then L1 is not important to recognize as an input

7

State Table A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

8/18/2010

Determine the J and K inputs: If current state P2=0, and the next state P2=0, then J needs to be 0, but K could be 0 or 1, so place a 0 for J and * (don’t care) for K

8

State Table A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C

Determine the J and K inputs: If current state P1=0, and the next state P1=1, then J needs to be 1, but K could be 0 or 1

P1=1,P2=1

8/18/2010

9

State Table A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C

Determine all the J and K inputs Then combine those that have the same value in the cell

P1=1,P2=1

8/18/2010

10

State Table A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

Then the logic for the others must be determined:

C P1=1,P2=1

8/18/2010

11

State Table A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

Then the logic for the others must be determined: For example: look at this cell If L1=0 the FSM must stay in State A, but if L2=1, the FSM must go to state B If L1=0, so are all the other sensors, so we could say: When J1=0, L2=0. When J1=1, L2=1, so J1=L2

8/18/2010

12

State Table A P1=0,P2=0

L2=1

L1=0

L2

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

8/18/2010

Then the logic for the others must be determined: For example: look at this cell If L1=0 then L4=0 also. This means that J2=L4

13

State Table A P1=0,P2=0

L2=1

L1=0

L2 L4

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

8/18/2010

Then the logic for the others must be determined: For example: look at this cell If L4=1 then L1=1 also. This means that K1=L1

14

State Table A P1=0,P2=0

L2=1

L1=0

L2 L4

B

/L1

P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

8/18/2010

Then the logic for the others must be determined: For example: look at this cell K2=/L3

15

J & K Inputs A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

Determine the logic to achieve the (J or K) inputs: place the values in the table into KMaps: J2

P2

P1

8/18/2010

0

*

L4

*

This is * because there is no state 2 identified and will be for all KMaps.

16

J & K Inputs A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

Determine the logic to achieve the (J or K) inputs: place the values in the table into KMaps: J2

P2

P1

8/18/2010

0

*

L4

*

J2 = L4 P1

17

J & K Inputs A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

Determine the logic to achieve the (J or K) inputs: place the values in the table into KMaps: K2

P2

P1

8/18/2010

*

*

*

/L3

K2 = L3

18

J & K Inputs A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

Determine the logic to achieve the (J or K) inputs: place the values in the table into KMaps: J1

P2

P1

L2

*

8/18/2010

*

J1 = L2

*

19

J & K Inputs A P1=0,P2=0

L2=1

L1=0

B P1=1,P2=0

L4=1

L3=0

C P1=1,P2=1

Determine the logic to achieve the (J or K) inputs: place the values in the table into KMaps: K1

P2

P1

* /L1

8/18/2010

*

K1 = L1 P2

0

20

Implementation

J2 = L4 P1

K2 = L3

J1 = L2

K1 = L1 P2

Simulation

Circuit Simulation (Compare with specifications):

Level 1 Sensor, L1=1 (white arrow): pump 1 and pump 2 are off (yellow arrows)

A L2=1

P1=0,P2=0

L1=0

B L4=1

P1=1,P2=0

L3=0

C

P1=1,P2=1

Simulation

Level 2 Sensor, L2=1 (white arrow): pump 1 goes on, but pump 2 is off (yellow arrows)

A L2=1

P1=0,P2=0

L1=0

B L4=1

P1=1,P2=0

L3=0

C

P1=1,P2=1

Simulation

Level 3 Sensor, L3=1 (white arrow): pump 1 stays on, but pump 2 is off (yellow arrows)

A L2=1

P1=0,P2=0

L1=0

B L4=1

P1=1,P2=0

L3=0

C

P1=1,P2=1

Simulation

Level 4 Sensor, L4=1 (white arrow): pump 1 stays on, and pump 2 turns on (yellow arrows)

A L2=1

P1=0,P2=0

L1=0

B L4=1

P1=1,P2=0

L3=0

C

P1=1,P2=1

Simulation

Level 4 Sensor, L4=1 (white arrow): pump 1 stays on, and pump 2 turns on (yellow arrows)

A L2=1

P1=0,P2=0

L1=0

B L4=1

P1=1,P2=0

L3=0

C

P1=1,P2=1

Simulation

Level 4 Sensor, L4=0 (white arrow): pump 1 stays on, and pump 2 stays on (yellow arrows)

A L2=1

P1=0,P2=0

L1=0

B L4=1

P1=1,P2=0

L3=0

C

P1=1,P2=1

Simulation

Level 3 Sensor, L3=0 (white arrow): pump 1 stays on, and pump 2 turns off (yellow arrows)

A L2=1

P1=0,P2=0

L1=0

B L4=1

P1=1,P2=0

L3=0

C

P1=1,P2=1

Simulation

Level 2 Sensor, L2=0 (white arrow): pump 1 stays on, and pump 2 stays off (yellow arrows)

A L2=1

P1=0,P2=0

L1=0

B L4=1

P1=1,P2=0

L3=0

C

P1=1,P2=1

Simulation

Level 1 Sensor, L2=1 (white arrow): pump 1 turns off, and pump 2 stays off (yellow arrows)

A L2=1

P1=0,P2=0

L1=0

B L4=1

P1=1,P2=0

L3=0

C

P1=1,P2=1

Summary • We designed a State Machine to Control two pumps using JK flip-flops – Developed the state diagram – Developed the state table – Developed the circuit using JK flip-flops – Implement the circuit in schematic capture • Simulated the circuit

8/18/2010

31