When using a Microcontroller in a control system the place to start is to decide what hardware you are controlling. In the Electronic Dice we will use 7 LEDs for the display and a push button to make the “throw”. Just to make the dice a little more interesting we will use a buzzer to give an audible indication of the number thrown.
The circuit for the Dice is shown in Figure 18.1, using the 16F818 with its internal 31.25kHz clock. The push button is an input connected to PortA,2. The 7 LEDs are connected to PortB and the buzzer is on A1.
Figure 18.1 Circuit diagram for the electronic dice
The truth table ...