Vous êtes sur la page 1sur 5

Microcontroller Lab

VI Sem. B.Tech. Biomedical Engineering

Experiment No.1
Introduction to 8051 Simulation software and Familiarization of 8051
instruction set.
Execute the following programs using 8051 simulator and examine the registers and memory
locations involved.

1.

MOV A, #55H
MOV R0, A
MOV R1, A
MOV R2, A
MOV R3, #99H
MOV A, R3

2.

MOV R5, #0AH


MOV R7, #28
MOV A, #00H
ADD A, R5
ADD A, R7

3.
DATA1:
DATA2:
DATA3:
DATA4:
DATA6:

ORG 500H
DB
28
DB
00111010B
DB
39H
ORG
510H
DB
2591
ORG
518H
DB
MANIPAL INSTITUTE

4.

MOV
MOV
MOV
MOV
MOV

R0,
R1,
R2,
R7,
R5,

#99H
#85H
#3FH
#63H
#12H

5.

MOV
MOV
MOV
MOV
MOV
MOV
MOV
MOV
PUSH
PUSH

00,
01,
02,
07,
R5,
R6,
R1,
R4,
6
1

#99H
#85H
#3FH
#63H
#12H
#25H
#12H
#0F3H
; sp=sp+1 and R6 is copied to Stack

1
Department of Biomedical Engineering, Manipal Institute of Technology, Manipal 576 104

Microcontroller Lab

VI Sem. B.Tech. Biomedical Engineering

6.

MOV
MOV
ADD
DA

A, #47H
B, #25H
A, B
A

7.

CLR
MOV
MOV
SUBB

C
A, #3FH
R3, #23H
A, R3

; clear carry
; data 3Fh into A
; copy 23h into R3
; A-R3 = A

8.

MOV
MOV
MUL

A, #25H
0F0H, #65H
AB

; data 25h into A


; data 65h into B
; AB=A: B

9.

MOV
MOV
DIV

A,
#95H
0F0H, #10H
AB

; data 95h into A


; data 10H into B (direct addressing mode)
; Abint quotient in A: int remainder in B

10.

MOV
MOV
MOV

A, #44H
P1, A
P2, A

11.

BACK:

; load data 44h to accumulator


; transfer data from acc to port1
; transfer data to port2

MOV R0, #30H


MOV R1, #50H
MOV R3, #10
MOV A, @R0
MOV @R1, A
INC
R0
INC
R1
DJNZ R3, BACK

; source pointer
; destination pointer
; counter
; get a byte from source
; copy it to destination
; increment source and destination pointer
; repeat for all 10 bytes

2
Department of Biomedical Engineering, Manipal Institute of Technology, Manipal 576 104

Microcontroller Lab

VI Sem. B.Tech. Biomedical Engineering

APPENDIX A
The 8051 Microcontroller Hardware

Fig.1. 8051 microcontroller block diagram


(Courtesy: Kenneth J. Ayala, The 8051 Microcontroller Architecture, Programming, & Applications)

3
Department of Biomedical Engineering, Manipal Institute of Technology, Manipal 576 104

Microcontroller Lab

VI Sem. B.Tech. Biomedical Engineering

The 8051 programming Model

Fig.2. 8051 Microcontroller programming Model


(Courtesy: Kenneth J. Ayala, The 8051 Microcontroller Architecture, Programming, & Applications)

4
Department of Biomedical Engineering, Manipal Institute of Technology, Manipal 576 104

Microcontroller Lab

VI Sem. B.Tech. Biomedical Engineering

APPENDIX B
Table 1. 8051 Instruction Opcodes in Hexadecimal Order (Courtesy: ESA Pvt Ltd)

5
Department of Biomedical Engineering, Manipal Institute of Technology, Manipal 576 104

Vous aimerez peut-être aussi