Sei sulla pagina 1di 8

LAB 1 Microcontroller &

Application
Objective:
Familiarization with the Kiel Development System and Data Transfer & Arithmetic
instructions

Procedure:
1 .Follow Steps given in the Keil Startup pdf Manual for Keil Development
Familiarization

Program 1
Put Some Value in the internal RAM address 30H, 31H, 32H of the Microcontroller

Register and Data Status


Addres Instruction
s

Affected Register &


Memory Value

MOV
A,#30H
MOV
A,30H
MOV
R0,#31H
MOV A,R0
MOV
A,@R0
MOV
R5,#32H
MOV
A,@R5

What is the difference between the first and second instructions are
they the same?

Why this program did did not compile? What is the change that is
made to the program?

Program 2
Modify and Observe the Port pin values in the Keil Environment

Register and Data Status

MOV A,P0
MOV
R0,P1
MOV@R0,
A
Program 3

Addres Instruction
s

Affected Register &


Memory Value

Register and Data Status


Address Instruction

Affected Register
& Memory Value

MOV
DPTR,#1E1FH
MOV A,83H
MOV B,82H
MOV PSW,#18H
MOV R6,A
MOVR7,A

What is the logic behind the first three Instructions?

Program 4
Write a Program to copy data

1.
2.
3.
4.

From internal memory address 31H to Port 0


Use Indirect Addressing to write to put value AAH to address 42H
Location 44H to 45H
From PORT 1 to PORT 2

Register and Data Status


Address

Instruction

Affected Register & Memory Value

Program 5
Modify Program 1 and add this Instruction

Register and Data Status


Address

Instruction

Affected Register &


Memory Value

XCH A,R0
XCH A,@R1
XCHD A,@R1

Program 6
Modify the Internal Register of 30H,31H and run the program

Register and Data Status


Address Instruction

Affected Register
& Memory Value

MOV R0,#30H
MOV R1,#30H
INC R1
INC @R1
MOV A,@R0
ADD A, @R1
INC R1
MOV @R1,A
MOV A,@R0
ADDC A,@R1
INC R1
MOV @R1,A

What is the problem with this code? Explain with an example.

Program 7
Design a Program using above with SUBB instruction and DEC Instruction
with 2 parameters in 30H and 31H. Document this 3 cases
1. The end result is positive number
2. The end result is zero
3. The end result is negative number

Program 8

Register and Data Status


Address

Instruction

Affected Register &


Memory Value

MOV A, #05H
MOV B,
#0A0H
MUL AB
MOV
A,#088H
MOV B,#02H
DA A

Modify the above program for three cases and discuss the output
1. A * B is greater than 255
2. A/B where B is zero
3. Where after division A is greater than 99 what is the effect DA A
instruction

Potrebbero piacerti anche