Vending machine example

The problem is to design a Nabs dispenser. The Nabs machine has two inputs, x and y, which encode the following information:

x y Meaning
0 0 nothing is happening
0 1 nickel inserted
0 1 dime inserted
1 1 Nabs button pushed

There is a single output, z. When z is 0, the machine produces nothing. When z is 1, the machine outputs a package of Nabs.

Assume that Nabs cost 15 cents. Nabs are returned only if the Nabs button is pushed after 15 cents are deposited. Assume that this %!@%$# machine returns no change and just keeps any money you deposit over 15 cents.

Draw the finite state machine for the Nabs dispenser below.

The state table

The Equations

Implementation with D flip-flops

Nabs with D flip-flops

Press here to retrieve a copy.

Implementation with JK flip-flops

Nabs with JK flip-flops

Press here to retrieve a copy.

Back to the Handout index

x y A B z A B JA KA JB KB
0 0 0 0 0 0 0 0 ? 0 ?
0 0 0 1 0 0 1 0 ? ? 0
0 0 1 0 0 1 0 ? 0 0 ?
0 0 1 1 0 1 1 ? 0 ? 0
0 1 0 0 0 0 1 0 ? 1 ?
0 1 0 1 0 1 0 1 ? ? 1
0 1 1 0 0 1 1 ? 0 1 ?
0 1 1 1 0 1 1 ? 0 ? 0
1 0 0 0 0 1 0 1 ? 0 ?
1 0 0 1 0 1 1 1 ? ? 0
1 0 1 0 0 1 1 ? 0 1 ?
1 0 1 1 0 1 1 ? 0 ? 0
1 1 0 0 0 0 0 0 ? 0 ?
1 1 0 1 0 0 1 0 ? ? 0
1 1 1 0 0 1 0 ? 0 0 ?
1 1 1 1 1 0 0 ? 1 ? 1