SEARCH
TOOLBOX
LANGUAGES
modified on 17 September 2014 at 17:54 ••• 29,959 views

03-05 SevenSegDisplay

From Manuals

(Difference between revisions)
Jump to: navigation, search
 
(2 intermediate revisions not shown)
Line 1: Line 1:
-
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.
+
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.  
-
Please see schematic below for further details.
+
The signals used for this example are listed below:
 +
{| border="1" cellpadding="5" cellspacing="2" align="center" style="text-align: center;"
 +
|+ align="bottom"|'''Signals Used and Connector Locations for Example 03-05'''
 +
|'''Signal'''
 +
|'''LPC4330 PIN NAME'''
 +
|'''BAM210E'''
 +
|'''BAM210'''
 +
|'''BAM200E'''
 +
|'''BAM200'''
 +
|'''Used for'''
 +
|-
 +
|D0
 +
|P6_5
 +
|J9-1
 +
|J9-1
 +
|S2-5
 +
|S2-5
 +
|Segment A
 +
|-
 +
|D1
 +
|P6_4
 +
|J9-2
 +
|J9-2
 +
|S2-4
 +
|S2-4
 +
|Segment B
 +
|-
 +
|D2
 +
|P1_7
 +
|J9-3
 +
|J9-3
 +
|S3-7
 +
|S3-7
 +
|Segment C
 +
|-
 +
|D3
 +
|P4_0
 +
|J9-3
 +
|J9-3
 +
|S3-7
 +
|S3-7
 +
|Segment D
 +
|-
 +
|D4
 +
|P6_9
 +
|J9-4
 +
|J9-4
 +
|S8-7
 +
|n/p
 +
|Segment E
 +
|-
 +
|D5
 +
|P5_5
 +
|J9-5
 +
|J9-5
 +
|S3-8
 +
|S3-8
 +
|Segment F
 +
|-
 +
|D6
 +
|P5_7
 +
|J9-6
 +
|J9-6
 +
|S3-9
 +
|S3-9
 +
|Segment G
 +
|-
 +
|D7
 +
|P7_6
 +
|J9-7
 +
|J9-7
 +
|S4-6
 +
|S4-6
 +
|Segment DP
 +
|-
 +
|}
 +
 
 +
The following schematic can be used to build the circuit with a BAM210E or BAM210.
[[Image:BAM210_03_05_SCH.png|center|alt=BAM210|frame|<div align="center">'''Schematic for example 03-05''']]
[[Image:BAM210_03_05_SCH.png|center|alt=BAM210|frame|<div align="center">'''Schematic for example 03-05''']]

Current revision as of 17:54, 17 September 2014

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 Used for
D0 P6_5 J9-1 J9-1 S2-5 S2-5 Segment A
D1 P6_4 J9-2 J9-2 S2-4 S2-4 Segment B
D2 P1_7 J9-3 J9-3 S3-7 S3-7 Segment C
D3 P4_0 J9-3 J9-3 S3-7 S3-7 Segment D
D4 P6_9 J9-4 J9-4 S8-7 n/p Segment E
D5 P5_5 J9-5 J9-5 S3-8 S3-8 Segment F
D6 P5_7 J9-6 J9-6 S3-9 S3-9 Segment G
D7 P7_6 J9-7 J9-7 S4-6 S4-6 Segment DP

The following schematic can be used to build the circuit with a BAM210E or BAM210.

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.