Electronics and Communication Department: Embedded System
Electronics and Communication Department: Embedded System
INDEX
CONTENT Page
Number
OBJECTIVE 3
INTRODUCTION 3
BLOCK DIAGRAM 5
CIRCUIT DIAGRAM 6
PROGRAM CODE 7
CONCLUSION 9
Page |3
OBJECTIVE
INTRODUCTION
A)
SEVEN SEGMENT DISPLAY
Code1:
#include”lpc214.h”
#include”delay.h”
int main()
{
int a, b, c, d, e;
unsigned char arr[] = {0xbf, 0x86, 0xdb, 0xcf, 0xe6, 0xed, 0xfd, 0x87, 0xff, 0xef};
IODIRO = 0xffffffff;
while(1)
for(a=0; a<=9;a++)
{
for(b=0; b<=9;b++)
{
for(c=0; c<=9;c++)
{
for(d=0; d<=9;d++)
{
for(e=0; e<=50;e++)
{
IOCLRO =0xFFFFFFFF;
IOSETO = arr[d]<<16 | 0x0100;
delay_ms(3);
IOCLRO = 0xFFFFFFFF;
IOSETO = arr[c]<<16 | 0x0200;
delay_ms(3);
Page |6
IOCLRO = 0xFFFFFFFF;
IOSETO = arr[b]<<16 | 0x0400;
delay_ms(3);
IOCLRO = 0xFFFFFFFF;
IOSETO = arr[a]<<16 | 0x0800;
delay_ms(3);
}
}
}
}
}
}
Page |7
B)
Flow Chart:
Page |8
Code2:
area prog,code,readonly
entry
main
ldr r1,value1
ldr r2,value2
mov r3,#0
loop
ldrb r5,[r1],#1
add r3,r3,r5
cmp r1,r2
bne loop
area prog,data,readonly
value1 dcd &00009000
value2 dcd &0000900A
end
Page |9
Output:
Figure 1: Code
Figure 3: Registers
In the end we used post indexing to add all the elements of the array using
pointer scheme and stored the result in register R5. It was the sum of first 10
numbers which in Hexadecimal turns out to be 37.