Next we will design the alarm control. When A goes to 1, a three-digit decade counter will be cleared. When that reaches 1000, a second flip flop, B, will be set. When B is set and D goes to 1, we will start to count to 1000 again. If, by the time the counter gets to 1000, A does not go to 0, the alarm will sound; flip flop N will go to 1. Both B and N are cleared when A goes to 0. A diagram of the system is shown below.