SEARCH
TOOLBOX
LANGUAGES
modified on 17 September 2014 at 17:45 ••• 29,962 views

03-05 SevenSegDisplay

From Manuals

Revision as of 17:45, 17 September 2014 by Support (Talk | contribs)
Jump to: navigation, search

This example demonstrates the BusOut function to display digits on a 7-segment display with a common cathode. It displays digits 0, 1, 2, 3 in turn.

The signals used for this example are listed below:

Signals Used and Connector Locations for Example 03-05
Signal LPC4330 PIN NAME BAM210E BAM210 BAM200E BAM200
D0 P_ J9-1 J9-1 S2-5 S2-5
D1 P_ J9-2 J9-2 S2-4 S2-4
D3 P_ J9-3 J9-3 S3-7 S3-7
D4 P_ J9-4 J9-4 S8-7 n/p
D5 P_ J9-5 J9-5 S3-8 S3-8
D6 P_ J9-6 J9-6 S3-9 S3-9
D7 P_ J9-7 J9-7 S4-6 S4-6
D0 P_ J9-1 J9-1 S2-5 S2-5

Please see schematic below for further details.

BAM210
Schematic for example 03-05
/*Program Example 3.5: Simple demonstration of 7-segment display. Display digits 0, 1, 2, 3 in turn.
                                                                       */
#include "mbed.h"
BusOut display(D0,D1,D2,D3,D4,D5,D6,D7);   // segments a,b,c,d,e,f,g,dp

int main()
{
    while(1) {
        for(int i=0; i<4; i++) {
            switch (i) {
                case 0:
                    display = 0x3F;
                    break;       //display 0
                case 1:
                    display = 0x06;
                    break;       //display 1
                case 2:
                    display = 0x5B;
                    break;
                case 3:
                    display = 0x4F;
                    break;
            }                                      //end of switch
            wait(0.2);
        }                                        //end of for
    }                                          //end of while
}  

The following image shows the built circuit on a BAM210E.