7 Segment Display Interfacing With Arm7

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

ARM HOW-TO GUIDE

Interfacing 7SEG with


LPC2148 ARM
Contents at a Glance
ARM7 LPC2148 Slicker Board ...........................................3
Seven Segment Display ....................................................3
Interfacing Seven Segment Display ..................................4
Interfacing Seven Segment with LPC2148 .........................5
Pin Assignment with LPC2138 ..........................................5
Circuit Diagram to Interface 7 segment with LPC2148.......6
Source Code ....................................................................6
C Program to 7 Segment Display using LPC2148 ...............7
Testing the I2C – Seven segment with LPC2148 ................9
General Information ...................................................... 10

Join the Technical Community Today!


http://www.pantechsolutions.net
ARM7 LPC2148 Slicker Board

The ARM7 LPC2148 Slicker board is specifically


designed to help students to master the required skills in
the area of embedded systems. The kit is designed in such
way that all the possible features of the microcontroller will
be easily used by the students. The kit supports in system
programming (ISP) which is done through serial port.

NXP’s ARM7 (LPC2148), ARM Slicker Kit is proposed to


smooth the progress of developing and debugging of
various designs encompassing of High speed 32-bit
Microcontrollers.

Seven Segment Display

A seven segment display is the most basic electronic


display device that can display digits from 0-9. The most
common configuration has an array of eight LEDs arranged
in a special pattern to display these digits. They are laid out
as a squared-off figure ‘8’.

Join the Technical Community Today!


http://www.pantechsolutions.net
Interfacing Seven Segment Display

Fig. 1 shows how to interface the seven segments with


microcontroller. A seven segment is generally available in
ten pin package. While eight pins correspond to the eight
LEDs, the remaining two pins (at middle) are common and
internally shorted. These segments come in two
configurations, namely, Common cathode (CC) and
Common anode (CA).

Fig. 1 Interfacing 7segment to Microcontroller

Join the Technical Community Today!


http://www.pantechsolutions.net
Interfacing Seven Segment with LPC2148

We now want to display a four digit number in LPC2148


Slicker Board by using seven segment displays. The seven
segment display is connected with LPC2138 controller.

In LPC2148 Slicker Kit, 4 nos. of common anode seven


segment displays are controlled by seven segment drivers.

Pin Assignment with LPC2138


7-SEG Driver LPC2148 LINES 7-SEG PWR Selection

A P1.16
B P1.17
C P1.18
D P1.19
7-SEG Display

E P1.20
F P1.21
G P1.22
DP P1.23
CL1 P0.10
CL2 P0.11
CL3 P0.12
CL4 P0.13
SW31

7SEG4
7SEG3
7SEG2

Make switch SW31 for select 7SEG1


GRST
EN
P0.15
P0.14
RW P0.13
‘7SEG’ RS
CS2
P0.12
P0.11
CS1 P0.10

GLCD/7SEG

Join the Technical Community Today!


http://www.pantechsolutions.net
Circuit Diagram to Interface 7 segment with LPC2148
3.3V
63
51
43
23
7

U16
VDD1
VDD2
VDD3
VDDA
VREF

35
6 P0.10 37
18 VSS1 P0.11 38
25 VSS2 P0.12 39

1
42 VSS3 P0.13 R19 1K R20 1K R21 1K R22 1K
50 VSS4 2 Q2 2 Q3 2 Q4 2 Q5
59 VSS5
VSSA 16

3
LPC2148 P1.16 12 SEG[0..7]
P1.17 8
P1.18 4 330E R24 SEG0
P1.19 48 U4 U5 U6 U7

8
P1.20 44 330E R25 SEG1
P1.21 40 SEG0 7 SEG0 7 SEG0 7 SEG0 7

CA

CA

CA

CA

CA

CA

CA

CA
P1.22 36 330E R26 SEG2 SEG1 6 A SEG1 6 A SEG1 6 A SEG1 6 A
XTAL2

XTAL1

P1.23 SEG2 4 B SEG2 4 B SEG2 4 B SEG2 4 B


330E R27 SEG3 SEG3 2 C SEG3 2 C SEG3 2 C SEG3 2 C
SEG4 1 D SEG4 1 D SEG4 1 D SEG4 1 D
330E R28 SEG4 SEG5 9 E SEG5 9 E SEG5 9 E SEG5 9 E
61

62

SEG610 F SEG610 F SEG610 F SEG610 F


12MHz SEG7 5 G SEG7 5 G SEG7 5 G SEG7 5 G
330E R29 SEG5
DP DP DP DP
330E R30 SEG6 7 SEG DISP 7 SEG DISP 7 SEG DISP 7 SEG DISP
C36 X13 C37
330E R31 SEG7 SEG[0..7] SEG[0..7] SEG[0..7]
22pf 22pf

7 SEGMENT DISPLAY

Source Code

The Interfacing seven segment displays with LPC2148


program is very simple and straight forward, which display a
four digit number in seven segment display .The C programs
are developed in Keil software. Here we are increment a
counter and display this value loaded into seven segment
driver in LPC2148 ARM Slicker Board.

Join the Technical Community Today!


http://www.pantechsolutions.net
C Program to 7 Segment Display using LPC2148
***************************************************************************************
Title : Program to Seven Segment display
***************************************************************************************

#include <LPC214x.h>
#include <stdio.h>
#include "7SEG.H"

unsigned int thou,hun,ten,single;


unsigned int x;

void main(void)
{
PINSEL0 = 0;
PINSEL1 = 0;
PINSEL2 &= 0x0000000C;
IODIR0 |= 0x0F << 10 ; // P0.10 - P0.13 Control Lines
IODIR1 |= 0xfF << 16; // P1.16 - P1.23 are Outputs
while(1)
{
if(x == 300)
{
x=0;
single++;
if(single>9)
{
single=0;
ten++;
if(ten>9)
{
ten=0;
hun++;
if(hun>9)
{
hun=0;
thou++;
if(thou>9)

Join the Technical Community Today!


http://www.pantechsolutions.net
thou=0;
}
}
}
}

x++;

Segment_Disp(&IOPIN1, 16,thou, hun, ten, single);


}
}

void DelayMs(unsigned int count)


{
unsigned int i,j;
for(i=0;i<count;i++)
{
for(j=0;j<3000;j++);
}
}

To compile the above C code you must need the KEIL


software. They must be properly set up and a project with
correct settings must be created in order to compile the
code. To compile the above code, the C file must be added
to the project.

In KEIL, you want to develop or debug the project


without any hardware setup. You must compile the code for
generating HEX file. In debugging Mode, you want to check
the port output without LPC2148 Slicker Board.

Join the Technical Community Today!


http://www.pantechsolutions.net
The Flash Magic software is used to download the hex
file into your microcontroller IC LPC2148 through UART0.

Testing the I2C – Seven segment with LPC2148

Give +3.3V power supply to LPC2148 Slicker Board; the


four seven segment display is connected with the LPC2148
Slicker Board. First check the entire seven segments LED’s
are properly working or not. Here we are display just 1234
in four seven segment. The entire seven segments receive it
through I2C & display it in order.

If any data is not coming in seven segments, then you


just check the entire seven segments LED’s are working or
not. Change the seven segment driver IC & Check the I2C
connections. Check the four seven segments connections.
Otherwise you just check the code with debugging mode in
KEIL. If you want to see more details about debugging just
see the videos in below link.

 How to Create & Debug a Project in KEIL.

Join the Technical Community Today!


http://www.pantechsolutions.net
General Information

For proper working use the components of exact values


as shown in Circuit file. Wherever possible use new
components.
Solder everything in a clean way. A major problem
arises due to improper soldering, solder jumps and
loose joints.
Use the exact value crystal shown in schematic.
More instructions are available in following articles,

 Interfacing UART with LPC2148 Microcontroller.


 Interfacing Keys with LPC2148 Microcontroller.
 User Manual of LPC2148 Slicker Board.
 Tutorial of how to create & Debug a project in KEIL.

Join the Technical Community Today!


http://www.pantechsolutions.net
Did you enjoy the read?
Pantech solutions creates information packed technical
documents like this one every month. And our website is a rich
and trusted resource used by a vibrant online community of
more than 1,00,000 members from organization of all shapes
and sizes.

Join the Technical Community Today!


http://www.pantechsolutions.net
What do we sell?
Our products range from Various Microcontroller
development boards, DSP Boards, FPGA/CPLD boards,
Communication Kits, Power electronics, Basic electronics,
Robotics, Sensors, Electronic components and much more . Our
goal is to make finding the parts and information you need
easier and affordable so you can create awesome projects and
training from Basic to Cutting edge technology.

Join the Technical Community Today!


http://www.pantechsolutions.net

You might also like