Page 143 - ARM Based Microcontroller Projects Using MBED
P. 143
7.16 PROJECT 13—7-SEGMENT LED DISPLAY 129
/*****************************************************************
7-SEGMENT LED COUNTER
=====================
In this modified program a switch statement is used inside a
function to display the required number
Author: Dogan Ibrahim
Date : Augut 2018
File : SevenSeg-4
*******************************************************************/
#include "mbed.h"
PortOut Segments(PortC, 0xFF);
//
// This function displays the requirednumber
//
void Display(int N)
{
switch (N)
{
case 0:
Segments = 0x3F;
break;
case 1:
Segments = 0x06;
break;
case 2:
Segments = 0x5B;
break;
case 3:
Segments = 0x4F;
break;
case 4:
Segments = 0x66;
break;
case 5:
Segments = 0x6D;
break;
case 6:
Segments = 0x7D;
break;
case 7:
Segments = 0x07;
break;
FIG. 7.75 Program using switch statement.
(Continued)