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

372                             15. Mbed RTOS PROJECTS














                 FIG. 15.6,  CONT’D


                         15.5 PROJECT 2—REFRESHING A 7-SEGMENT DISPLAY

                 15.5.1 Description

                   As we have seen in the project in Chapter 8.2, the digits of a multidigit 7-segment LED need
                 to be refreshed at about every 5–10ms so that the human eye sees both digits to be ON at all
                 times. The CPU has to spend all of its time to the refreshing process and as a result it cannot do
                 any other tasks. In this project we use a multitasking approach where the refreshing process
                 will be implemented in a separate task. In this project the display will count from 00 to 99
                 continuously with 1s delay between each count.

                 15.5.2 Aim

                   The aim of this project is to show how a multidigit 7-segment display can be refreshed in a
                 multitasking environment.


                 15.5.3 Block Diagram
                   The block diagram of the project is as in Fig. 8.1.


                 15.5.4 Circuit Diagram

                   The circuit diagram of the project is as in Fig. 8.3 where the display segments are connected
                 to PORT C pins of the development board, and an NPN transistor is used to control the dis-
                 play digits.


                 15.5.5 Program Listing

                   The program listing (program: RTOS7Segment) is shown in Fig. 15.7. The program is basi-
                 cally very similar to the one given in Fig. 8.5, except that here the display refreshing is done as a
                 separatetask.Atthebeginningoftheprogramheaderfilesmbed.handrtos.hareincludedinthe
                 program and the RTOS library is loaded to the program. The interface between the 7-segment
                 display and the development board are then defined as in the program in Fig. 8.5 and global
   381   382   383   384   385   386   387   388   389   390   391