Page 167 - ARM Based Microcontroller Projects Using MBED
P. 167

8.6  PROJECT 4—FOUR-DIGIT 7-SEGMENT LED EVENT COUNTER     153
            8.6.2 Aim
              The aim of this project is to show how an event counter can be designed and the events
            displayed on a four-digit multiplexed 7-segment LED display. It is assumed that pressing
            the User button creates an external event.


            8.6.3 Block Diagram
              The block diagram of the project is as in Fig. 8.16.


            8.6.4 Circuit Diagram

              The circuit diagram of the project is as in Fig. 8.8. In addition, the onboard User button is
            used to create external events.


            8.6.5 The PDL
              The PDL of the program is very similar to the PDL given in Fig. 8.14, but here the count is
            incremented when the User button is pressed.

            8.6.6 Program Listing

              Fig. 8.17 shows the program listing (program: EventCounter). The program listing is very
            similar to the one given in Fig. 8.15. In this program, the User button is configured as digital
            input. In this program, the count (CNT) is incremented by one inside the main program every
            time the button is pressed. The delay has been removed from the main program. The ISR
            (function Refresh) refreshes the display at every 5ms.

            8.6.7 Suggestions for Additional Work

              Modify the program given in Fig. 8.17 so that the count starts from 1000 and counts done by
            one every time the button is pressed.



















            FIG. 8.16  Block diagram of the project.
   162   163   164   165   166   167   168   169   170   171   172