When you run the program in the CPIC you will find that it works well. The first time you press and release the button the light is lit. The second time the light goes out. In reality the program in the CPIC would not work well, because of bounce in the switches. Because of the way that the CPIC works the switches always change from on to off instantaneously.

In real life a mechanical switch will bounce very slightly when it closes and opens. This means that while it is moving there is an instant when the program will get a signal which changes rapidly from on to off. This is a common problem in systems where a computer must read the state of an input from a switch and it means that our perfect program is no good as it stands. When we press and release our button the noise causes the program to rapidly toggle the state of the light.

Run program 2.3 and note that it doesn't work very well! Turning the light on and off becomes a game of skill!