Page 139 - ARM Based Microcontroller Projects Using MBED
P. 139
7.16 PROJECT 13—7-SEGMENT LED DISPLAY 125
FIG. 7.70 Project built on a breadboard.
BEGIN
Configure PORT C lower byte as a group
Define segment patterns
CNT = 0
DO FOREVER
Send CNT to display
Wait 1 second
IF CNT = 10 THEN
CNT = 0
ENDIF
ENDDO
END
FIG. 7.71 Program PDL.
7.16.7 Program Listing
The program listing (program: SevenSeg) is shown in Fig. 7.72. At the beginning of the pro-
gram PORT C lower byte is grouped into variable Segments using the PortOut statement.
The segments to be turned ON for a required number to be displayed are given in array LEDS.