Vous êtes sur la page 1sur 12

Embedded system

EXPERIMENT NO.1
Aim: Study of arm processor architecture.
Apparatus: Computer system, keiluvision software.
Block Diagram:

Page 1

1149891

Embedded system

Theory:The ARM is a 32-bit Reduced Instruction Set Computer (RISC) instruction set
architecture (ISA) developed by ARM Limited. It was known as the Advanced RISC Machine,
and before that as the Acorn RISC Machine. The ARM architecture is the most widely used 32bit ISA in terms of numbers produced. There are no data processing instructions that directly
manipulate data in memory. Thus data processing is directly carried out solely in registers. These
are typical RISC architecture features:
A uniform register file load/store architecture, where data processing operates only on
register contents, not directly on memory contents.
Simple addressing modes, with all load/store addresses determined from register contents
and instruction fields only.
Enhancements to a basic RISC architecture enable ARM processors to achieve a good balance of
high performance, small code size, low power consumption and small silicon area.
Result: Arm processor architecture is studied.

Page 2

1149891

Embedded system

EXPERIMENT NO.2

Aim: Write a program to add two 8 bits numbers.


Apparatus: Computer system, keiluvision software.
Program:
MOV A, #05H
MOV B, #02H
ADD A, B
END
Explanation:
1. MOV A, #05H- This instruction will move the value 05H into register A
2. MOV B, #02H-This instruction will move the value 02H into register B
3. ADD A,B-This instruction will add 05H and 02H and the result will be stored in
accumulator(A).
Result: The contents of accumulator is 07H.

Page 3

1149891

Embedded system

EXPERIMENT NO.3
Aim: Write a program to subtract two 8 bits numbers.
Apparatus: Computer system, keiluvision software.
Program:
MOV A, #05H
MOV B, #02H
SUB A,B
END
Explanation:
1. MOV A, #05H- This instruction will move the value 05H into register A
2. MOV B, #02H-This instruction will move the value 02H into register B
3. SUB A,B-This instruction will subtract 05H and 02H and the result will be stored in
accumulator(A).
4. END-This instruction will terminate the program.
Result: The contents of accumulator is 03H.

Page 4

1149891

Embedded system

EXPERIMENT NO.4
Aim:Write a program to find 2s compliment of a number.
Apparatus:Computer system, keiluvision software.
Program:
MOV A,#02H
CPL A
INC A
END
Explanation:
1.
2.
3.
4.

MOV A, #02H- This instruction will move the value 02H into register A.
CPL A- This instruction performs the compliment of the contents in A i.e 02H.
INC A-This instruction will increment the contents of A.
END-This instruction will terminate the program.

Result: 2s compliment of 02H is calculated.

Page 5

1149891

Embedded system
EXPERIMENT NO.5
Aim: Write a program to check whether the no. is even or odd.
Apparatus: Computer system, keiluvision software.
Program:
MOV A,#04H
ANL A,#01H
JNZ NEXT
MOV A,#00H
NEXT: MOV A,01H
END
Explanation:
1. MOV A, #04H- This instruction will move the value 04H into register A
2. ANL A,#01H-This instruction performs the logical AND operation on the contents of A
i.e 04H and 01H
3. JNZ NEXT-This instruction checks the results of accumulator(A) and jumps to NEXT
label if contents in A are not equal to zero.
4. MOV A,#00H-This instruction will clear the contents of A.
5. NEXT: MOV A,01H-This instruction will move the value 01H into register A
6. END -This instruction will terminate the program
Result: Number is even.

EXPERIMENT NO.6
Page 6

1149891

Embedded system
Aim: Write a program to find factorial of a number.
Apparatus: Computer system, keiluvision software.
Program:
MOV A,#01H
MOV R0,#01H
UP: MOV B,R0
MUL A,B
INC R0
CJNE R0,#06 ,UP
END
Explanation:
1.
2.
3.
4.

MOV A, #01H- This instruction will move the value 01H into register A
MOV R0,#01H-This instruction will move the value 01H into register RO
UP: MOV B,R0 --This instruction will move the value of register RO into register B
MUL A,B--This instruction multiplies the value of register A and B and stores the result

in register A
5. INC R0--This instruction will increment the value of register RO
6. CJNE R0,#06H ,UP--This instruction compares the value of register RO and number 06H
if both are not equal then jump to label UP
7. END -This instruction will terminate the program
Result:Factorial of a number is calculated.

EXPERIMENT NO.7
Aim:Write a program for multiplication using technique of repeated addition.
Apparatus:Computer system,keiluvision software.
Page 7

1149891

Embedded system
Program:
MOV RO, #02H
MOV R1, #10H
MOV A, #00H
HERE: ADD A, R0
DJNZ R1, HERE
END
Explanation:
1.
2.
3.
4.
5.

MOV RO,#02H-This instruction will move the value 02H into register RO
MOV R1,#10H-This instruction will move the value 10H into register R1
MOV A,#00H-This instruction will move the value 00H into register A
HERE: ADD A,R0-This instruction will add the contents of register RO and A
DJNZ R1, HERE-This instruction will decrement the value of register R1 and will jump

to label HERE until its value is not equal to zero.


6. END -This instruction will terminate the program.

Result:The contents of accumulator is 20.

EXPERIMENT NO.8
Aim: Write a program to perform binary to gray conversion.
Apparatus: Computer system, keiluvision software.
Program:

Page 8

1149891

Embedded system
MOV A, #07H
MOV B, #07H
ADD A, B
ORL A, B
RR A
ANL A, #0FH
END
Explanation:
1. MOV A,#07H-This instruction will move the value 07H into register A
2. MOV B,#07H-This instruction will move the value 07H into register B
3. ADD A, B-This instruction will add 07H and 07H and the result will be stored in
accumulator (A).
4. ORL A, B-This instruction performs the logical OR operation on registers A and B.
5. RR A-This instruction performs the rotate right operation on accumulator (A).
6. ANL A,#0FH-This instruction performs the logical AND operation on registers A and
0FH
7. END-This instruction terminates the program.
Result: Binary to gray conversion is performed.

EXPERIMENT NO.9
Aim: Write a program create table of a number.
Apparatus: Computer system, keiluvision software.
Program:
MOV RO, #01H
UP: MOV B, #07H
Page 9

1149891

Embedded system
MOV A, RO
MOV A, B
MOV R1, A
CLR A
INC RO
CJNE RO, #0BH, UP
END
Explanation:
1.
2.
3.
4.
5.
6.
7.
8.

MOV RO,#01H-This instruction will move the value 01H into register RO
UP:MOV B,#07H-This instruction will move the value 07H into register B
MOV A,RO-This instruction will move the value of register RO into A
MOV A,B-This instruction will move the value of register B into A
MOV R1,A-This instruction will move the value of register A into R1
CLR A-This instruction will clear the value of A
INC RO-This instruction will increment the value of register R0
CJNE RO, #0BH, UP-This instruction will compare the contents of register R0 with

OBH if not equal then jump to label UP.


9. END-This instruction will terminate the program.
Result: Table of a number is created.

EXPERIMENT NO.10
Aim: Write a program to count number of 1s and 0s.
Apparatus: Computer system, keiluvision software.
Program:
MOV RO, #00H
MOV R1, #00H
MOV R2, #08H
MOV A, #04H
L1: RLC A
Page 10

1149891

Embedded system
JNC L2
INC RO
L2: DJNZ R2, L1
MOV A, #08H
CLR C
SUBB A, RO
MOV R1, A
END
Explanation:
1.
2.
3.
4.
5.
6.
7.

MOV RO,#00H- This instruction will move the value 00H into register RO
MOV R1,#00H- This instruction will move the value 00H into register R1
MOV R2,#08H- This instruction will move the value 08H into register R2
MOV A,#04H- This instruction will move the value 04H into register A
L1: RLC A-This instruction will rotate the accumulator left with carry.
JNC L2-This instruction will jump to L2 if no carry is there.
INC RO-This instruction will increment the value of register RO

8. L2: DJNZ R2, L1- This instruction will decrement the value of register R2 and will jump
to label L1 until its value is not equal to zero.
9. MOV A, #08H- This instruction will move the value 08H into A.
10. CLR C- This instruction will clear the C.
11. SUBB A, RO- This instruction will subtract thevalue of A and R0 and the result will be
stored in A.
12. MOV R1, A- This instruction will move the value of A into register R1.
13. END-This instruction will terminate the program.
Result: Number of 1s and 0s is counted.

Page 11

1149891

Embedded system

Page 12

1149891

Vous aimerez peut-être aussi