• No results found

Interfacing Seven Segment Display with LPC1769

N/A
N/A
Protected

Academic year: 2021

Share "Interfacing Seven Segment Display with LPC1769"

Copied!
18
0
0

Loading.... (view fulltext now)

Full text

(1)

2016

Author: Gurudatta Palankar

Reviewers:

Version: 1.0

Seven Segment Display

with

NXP LPC1769

using LPCXpresso

(2)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Step 1: Open LPCXpresso IDE.

(3)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Step 2: To create a New project. Go to File >> New >> Project. Select LPCXpresso C

project.

(4)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Step 3: Select LPC1769, C Project and give name to your project. Select target MCU as

LPC1769.

(5)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Step 4: Now select CMSIS Core library. Click on Next and keep all the other

configurations as default and Finish.

(6)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Step 5: Now we can see our project onto the workspace. Now by double clicking on

Seven_Segment.c file, we can start writing code in an editor window. Here we are going

to writing a code for blinking an LED.

(7)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Step 6: Write a code as shown below.

(8)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

CODE:

#ifdef __USE_CMSIS

#include "LPC17xx.h"

#endif

void delay(int );

int main(void)

{

LPC_GPIO0

->

FIODIR0

= 0xFF;

while(1)

{

int i;

for( i=0; i<=9; i++)

{

switch(i)

{

case 0:

LPC_GPIO0

->

FIOSET0

= 0xC0;

delay(1000);

LPC_GPIO0

->

FIOCLR0

= 0xC0;

break;

case 1:

LPC_GPIO0

->

FIOSET0

= 0xF9;

delay(1000);

LPC_GPIO0

->

FIOCLR0

= 0xF9;

break;

case 2:

LPC_GPIO0

->

FIOSET0

= 0xA4;

delay(1000);

LPC_GPIO0

->

FIOCLR0

= 0xA4;

break;

case 3:

LPC_GPIO0

->

FIOSET0

= 0xB0;

delay(1000);

LPC_GPIO0

->

FIOCLR0

= 0xB0;

break;

case 4:

LPC_GPIO0

->

FIOSET0

= 0x99;

delay(1000);

LPC_GPIO0

->

FIOCLR0

= 0x99;

(9)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

break;

case 5:

LPC_GPIO0

->

FIOSET0

= 0x92;

delay(1000);

LPC_GPIO0

->

FIOCLR0

= 0x92;

break;

case 6:

LPC_GPIO0

->

FIOSET0

= 0x82;

delay(1000);

LPC_GPIO0

->

FIOCLR0

= 0x82;

break;

case 7:

LPC_GPIO0

->

FIOSET0

= 0xF8;

delay(1000);

LPC_GPIO0->

FIOCLR0

= 0xF8;

break;

case 8:

LPC_GPIO0

->

FIOSET0

= 0x80;

delay(1000);

LPC_GPIO0

->

FIOCLR0

= 0x80;

break;

case 9:

LPC_GPIO0

->

FIOSET0

= 0x90;

delay(1000);

LPC_GPIO0

->

FIOCLR0

= 0x90;

break;

}

}

}

return 0 ;

}

void delay(int a)

{

int i, j;

for(i=0; i<5000; i++)

for(j=0; j<=a; j++);

}

(10)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Step 7: After writing code, Build the project by clicking on Build “Seven_Segment”,

on the Quickstart Panel on the bottom left of the window.

(11)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Step 8: Now, if everything goes well, connect the USB cable to LPC1769 and connect

it to your computer. To upload the project file, click on the Program flash.

(12)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Step 9: Now select the Project file Seven_segment.axf. We can find it in a Debug folder

of our project folder.

(13)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

(14)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Step 10: Now this window shows we have finally dumped our code into LPC1769.

Fig. 10

CIRCUIT EXPLAINATION:

Before connection we should be aware of what common anode and common

cathode means. As shown in the figure, in common anode we can turn ON a segment by

driving a logic 0. And in common cathode we can turn ON a segment by driving a Logic

1. We have used common anode in this project. As you can see table below, to turn ON a

specific LED we drive logic 0.

(15)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

COMMON ANODE CONFIGURATION

Fig. 12

Display

number

DP

(P0.7)

G

(P0.6)

F

(P0.5)

E

(P0.4)

D

(P0.3)

C

(P0.2)

B

(P0.1)

A

(P0.0)

Hex

values

0

1

1

0

0

0

0

0

0

0xC0

1

1

1

1

1

1

0

0

1

0xF9

2

1

0

1

0

0

1

0

0

0xA4

3

1

0

1

1

0

0

0

0

0xB0

4

1

0

0

1

1

0

0

1

0x99

5

1

0

0

1

0

0

1

0

0x92

6

1

0

0

0

0

0

1

0

0x82

7

1

1

1

1

1

0

0

0

0xF8

8

1

0

0

0

0

0

0

0

0x80

9

1

0

0

1

0

0

0

0

0x90

(16)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

PIN DETAILS:

P0.0

A

P0.1

B

P0.2

C

P0.3

D

P0.4

E

P0.5

F

P0.6

G

P0.7

DP

(17)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

OUTPUT:

Fig. 13

(18)

# 9/3, 2nd floor, SreeLaksmi Complex, opp, to Vivekananda Park, Girinagar, Bangalore - 560085, Email: [email protected], Phone: 080 - 26722726

Fig. 15

For product link:

1.

http://www.tenettech.com/product/1548/lpc1769-lpcxpresso-board

2.

http://tenettech.com/product/6655/universal-gpio-board

For more information please log on to

www.tenettech.com

References

Related documents

make simple additions, revisions and corrections to their own writing by: evaluating their writing with the teacher and other pupils rereading to check that their writing

TCSG Veterans Affairs Contact Directory Directory of system staff responsible Veterans Affairs.. TCSG System Office 1800 Century Place,

But while the results bring together these two sets of stories to provide a unified explanation of inflation’s long-run rise and fall, they also indicate that considerable

The analyses reported here indicate substantial changes to soils sampled from across a climatic gradient through the sub- and maritime Antarctic, with those from Bird

The Effect of SI on Pass Rates, Academic Performance, Retention and Persistence in Community College Developmental Reading Courses, a study done by Dalton (2011), found that

Дітей шкільного віку (підготовчий, 1 – 12 класи загальноосвітніх спеціальних шкіл для дітей з порушеннями слуху (для глухих і слабочуючих);

Treating co-occurring Axis I disorders in recurrently suicidal women with borderline personality disorder: A 2-year randomized trial of dialectical behavior therapy versus

Due to statements in the literature regarding the effectiveness, benefits, and likelihood of parents being more involved with younger children, the second hypothesis predicts that