arm how-to guide interfacing 7seg with lpc2148 arm … ·  · 2014-12-022014-12-02 · fig. 1...

12
ARM HOW-TO GUIDE Interfacing 7SEG with LPC2148 ARM

Upload: phamkhanh

Post on 16-Mar-2018

224 views

Category:

Documents


1 download

TRANSCRIPT

ARM HOW-TO GUIDE

Interfacing 7SEG with

LPC2148 ARM

Join the Technical Community Today!

http://www.pantechsolutions.net

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-S

EG D

isp

lay

7-SEG Driver LPC2148 LINES 7-SEG PWR Selection

A P1.16

B P1.17

C P1.18

D P1.19

E P1.20

F P1.21

G P1.22

DP P1.23

CL1 P0.10

CL2 P0.11

CL3 P0.12

CL4 P0.13

Make switch SW31 for select

‘7SEG’

P0.12

P0.10P0.11

P0.14P0.13

P0.15

SW31

7SEG27SEG1

RS

7SEG37SEG4

RW

CS1

GRST

CS2

EN

GLCD/7SEG

Join the Technical Community Today!

http://www.pantechsolutions.net

Circuit Diagram to Interface 7 segment with LPC2148

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.

SEG4SEG5

SEG3

SEG6

SEG0

SEG7

SEG2SEG1

SEG5SEG6

SEG3

SEG7

SEG4

R24330E

R25330E

R26330E

R27330E

R28330E

R29330E

R30330E

R31330E

SEG0

SEG2

SEG1

SEG5

SEG4

SEG3

SEG7

SEG6

SEG[0..7] SEG[0..7]SEG[0..7]

7 SEGMENT DISPLAY

SEG[0..7]

U4

7 SEG DISP

E1 D2

CA

3

C4

DP5

B6 A7

CA

8

F9

G10

U5

7 SEG DISP

E1 D2

CA

3

C4

DP5

B6 A7

CA

8

F9

G10

C36

22pf

3.3V

C37

22pf

X13

12MHz

LPC2148

U16

VSS16

VD

DA

7

VSS218

VD

D3

23

VSS325

VD

D2

43

VSS442

VR

EF

63

XT

AL1

62

XT

AL2

61

VSSA59

VD

D1

51

VSS550

P0.1339P0.1238P0.1137P0.1035

P1.1616

P1.1712

P1.188

P1.194

P1.2048

P1.2144

P1.2240

P1.2336

U6

7 SEG DISP

E1 D2

CA

3

C4

DP5

B6 A7

CA

8

F9

G10

U7

7 SEG DISP

E1 D2

CA

3

C4

DP5

B6 A7

CA

8

F9

G10

Q2

1

2

3

Q3

1

2

3

Q4

1

2

3

Q5

1

2

3

SEG0

R19 1K

SEG1

R20 1K R21 1K R22 1K

SEG2SEG3SEG4

SEG6SEG5

SEG1

SEG7

SEG3

SEG0

SEG5SEG4

SEG2SEG1

SEG6SEG7

SEG2

SEG0

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

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.

Did you enjoy the read?

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.