Microprocessors Unit II
Microprocessors Unit II
Microprocessors Unit II
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
INTRODUCTION TO TASM/MASM
EXP.NO:1
Editor
Assembler
Linker
Debugger
EDITOR:
An editor is a program, which allows you to create a file containing the assembly
language statements for your program. As you type in your program the editor stores the ASCII
codes for the letters and numbers in successive RAM locations. When you have typed in all of
your programs you then save the file on a floppy of hard disk. This file is called source file. The
next step is to process the source file with an assembler. In the MASM/TASM assembler you
should give your source file name the extension .ASM
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
ASSEMBLER:
An assembler program is used to translate the assembly language mnemonics for
instructions to the corresponding binary codes. When you run the assembler it reads the source
file of your program the disk where you saved it after editing on the first pass through the source
program the assembler determines the displacement of named data items the offset of labels and
this information in a symbol table. On the second pass through the source program the assembler
produces the binary code for each instruction and inserts the offset etc that is calculated during
the first pass. The assembler generates two files on floppy or hard disk. The first file called the
object file is given the extension. OBJ. The object file contains the binary codes for the
instructions and information about the addresses of the instructions. The second file generated by
the assembler is called assembler list file. The list file contains your assembly language
statements the binary codes for each instructions and the offset for each instruction. In
MASM/TASM assembler MASM source file name ASM is used to assemble the file. Edit source
file name LST is used to view the list file which is generated, when you assemble the file.
LINKER:
A linker is a program used to join several object files into one large object file and
convert to an exe file. The linker produces a link file, which contains the binary codes for all the
combined modules. The linker however doesnt assign absolute addresses to the program, it
assigns is said to be re-locatable because it can be put anywhere in memory to be run. In
TASM/MASM LINK source filename is used to link the file.
DEBUGGER:
A debugger is a program which allows you to load your object code program into
system memory, execute the program and troubleshoot are debug it the debugger allows you to
look at the contents of registers and memory locations after your program runs. It allows you to
change the contents of register and memory locations after your program runs. It allows you to
change the contents of register and memory locations and return the program. A debugger also
allows you to set a break point at any point in the program. If you inset a breakpoint the
debugger will run the program up to the instruction where the breakpoint is set and stop
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
execution. You can then examine register and memory contents to see whether the results are
correct at that point. In MASM, MD filename is used to debug the file.
PROCEDURE TO USE TASM:
Copy the TASM software into any one of the drives(C,D,E, or F).
Change the operating mode to DOS mode by following steps.
------> Click on start
------> Click on run
-------> Type CMD (and press enter key)
The following screen will be displayed
C: / Documents and settings/svew>-Chang directry to tasm using CD TASM
Create a source file using the following syntax: C:/TASM>EDIT
A blank screen will display now type your ALP as shown below.
Eg:-Write a program for the addition of two 8 bit numbers.
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
N1 DB 00H
N2 DB 00H
RES DB 00H
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV AL, N1
MOV BL, N2
ADD AL, BL
MOV RES, AL
INT 3H
CODE ENDS
END START
After typing the program save with a file name of your choice with an extension.asm
And quit from editor this file is called as source file.
To generate an object file (filename.obj) and list file (filename.lst)
Syntax C:/TASM>tasm filename.asm (object file is generated)
C:/TASM>tasm/l filename.asm
If there are no errors in your program, this will create an object (binary) file named add.obj.other
wise, TASM will display an error message which indicates the line numbers where errors appear
together with descriptions of the errors.
4
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
8-Bit Addition
Input:
0000: 08h
0001: 02h
Output: 0002: 0Ah
8-Bit Subtraction
Input:
0000: 08h
0001: 02h
Output: 0002: 06h
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
8-Bit multiplication
8-Bit Division
Input:
0000:08h
0001:02h
Output: 0002:04h
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
16-Bit Addition
Input: 0000:08h
0002:02h
Output: 0004:04h
16-Bit Subtraction
Input:
0000:08h
0002:02h
8
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
CODE ENDS
END START
Output: 0004:04h
16-Bit Multiplication
Input:
0000:08h
0002:02h
Output: 0004:04h
16-Bit Division
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
Input:
0000:08h
0002:02h
Output: 0004:04h
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
back:inc si
inc di
inc bx
mov al,[si]
mov dl,[di]
adc al,dl
mov [bx],al
loop back
nop
int 03h
code ends
end start
******************
INPUT:
IP1: 11223344H
IP2: 55667788H
OUTPUT:
RES: 6688AACCH
Program No: 2(j)
Assume cs:code,ds:data
data segment
ip1 dd 55667788h
ip2 dd 11223344h
res dd 00000000h
data ends
code segment
start: mov ax,data
mov ds,ax
mov si,offset ip1
11
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
******************
INPUT:
IP1: 55667788H
IP2: 11223344H
OUTPUT:
RES: 44444444H
ASCII Addition
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
code segment
start: mov ax,data
mov ds,ax
xor ax,ax
mov al,asc1
mov bl,asc2
add al,bl
aaa
or ax,3030h
mov res,ax
int 3H
code ends
end start
****************
INPUT: ASC1: 09H
ASC2: 06H
OUTPUT:
RES: 3135H
ASCII Subtraction
Assume cs:code,ds:data
data segment
asc1 db 09H
asc2 db 06H
res dw 00h
data ends
code segment
13
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
ASCII Multiplication
Assume cs:code,ds:data
data segment
asc1 db 06H
asc2 db 02H
res dw 00h
data ends
code segment
start: mov ax,data
14
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
mov ds,ax
xor ax,ax
mov al,asc1
mov bl,asc2
mul bl
aam
or ax,3030h
mov res,ax
int 3H
code ends
end start
****************
INPUT: ASC1: 06H
ASC2: 02H
OUTPUT:
RES: 3132H
ASCII Divisions
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
mov ds,ax
xor ax,ax
mov al,asc1
mov bl,asc2
aad
div bl
or ax,3030h
mov res,ax
int 3H
code ends
end start
****************
INPUT: ASC1: 09H
ASC2: 03H
OUTPUT:
RES: 3033H
RESULT: Hence we obtained the arithmetical operations, multi byte operations, ASCII operations.
AIM: To write an ALP to perform arithmetical, multi byte, ASCII operations using TASM
Assembler.
APPARATUS:
1. Tasm assembler
2. PC
Program No: 3(a)
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
*************
INPUT: OP1:01h
OP2:01h
OUTPUT:
RES:01h
Logical OR operation
assume cs:code,ds:data
data segment
op1 dw 00h
op2 dw 00h
res dw 00h
data ends
code segment
start: mov ax,data
mov ds,ax
17
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
mov ax,op1
mov bx,op2
or ax,bx
mov res,ax
int 3h
code ends
end start
*************
INPUT: OP1:01h
OP2:00h
OUTPUT:
RES:01h
Program No: 3(c)
Assume cs:code,ds:data
data segment
op1 dw 00h
res dw 00h
data ends
code segment
start: mov ax,data
mov ds,ax
mov ax,op1
not ax
mov res,ax
int 3h
code ends
end start
*************
INPUT: OP1:04h
18
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
OUTPUT:
RES: FBh
Program No: 3(d)
Assume cs:code,ds:data
data segment
op1 dw 00h
op2 dw 00h
res dw 00h
data ends
code segment
start: mov ax,data
mov ds,ax
mov ax,op1
mov bx,op2
xor ax,bx
mov res,ax
int 3h
code ends
end start
*************
INPUT: OP1:01h
OP2:00h
OUTPUT:
RES:01h
Program No: 3(e)
RCL
Assume cs:code,ds:data
data segment
op1 db 0h
cnt db 00h
res db 00h
data ends
code segment
start: mov ax,data
mov ds,ax
19
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
sub ax,ax
mov al,op1
mov cl,cnt
rcl al,cl
mov res,al
int 3h
code ends
end start
*************
INPUT: OP1:25h
cnt:03h
OUTPUT:
RES:28h
Program No: 3(f)
RCR
Assume cs:code,ds:data
data segment
op1 db 0h
cnt db 00h
res db 00h
data ends
code segment
start: mov ax,data
mov ds,ax
sub ax,ax
mov al,op1
mov cl,cnt
rcr al,cl
mov res,al
int 3h
code ends
end start
*************
20
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
INPUT: OP1:25h
cnt:03h
OUTPUT:
RES:44h
ROL
Assume cs:code,ds:data
data segment
op1 db 0h
cnt db 00h
res db 00h
data ends
code segment
start: mov ax,data
mov ds,ax
sub ax,ax
mov al,op1
mov cl,cnt
rol al,cl
mov res,al
int 3h
code ends
end start
*************
INPUT: OP1:25h
cnt:03h
OUTPUT:
RES:29h
Program No: 3(h)
ROR
Assume cs:code,ds:data
data segment
op1 db 0h
21
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
cnt db 00h
res db 00h
data ends
code segment
start: mov ax,data
mov ds,ax
sub ax,ax
mov al,op1
mov cl,cnt
ror al,cl
mov res,al
int 3h
code ends
end start
*************
INPUT: OP1:25h
cnt:03h
OUTPUT:
RES:A4h
Program No: 3(i)
SAR
Assume cs:code,ds:data
data segment
op1 db 0h
cnt db 00h
res db 00h
data ends
code segment
start: mov ax,data
mov ds,ax
sub ax,ax
mov al,op1
mov cl,cnt
sar al,cl
mov res,al
22
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
int 3h
code ends
end start
*************
INPUT: OP1:25h
cnt:03h
OUTPUT:
RES:04h
Program No: 3(j)
SHL
Assume cs:code,ds:data
data segment
op1 db 00h
cnt db 00h
res db 00h
data ends
code segment
start: mov ax,data
mov ds,ax
sub ax,ax
mov al,op1
mov cl,cnt
shl al,cl
mov res,al
int 3h
code ends
end start
*************
INPUT: OP1:25h
cnt:03h
OUTPUT:
RES:28h
Program No: 3(k)
SHR
23
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
Assume cs:code,ds:data
data segment
op1 db 0h
cnt db 00h
res db 00h
data ends
code segment
start: mov ax,data
mov ds,ax
sub ax,ax
mov al,op1
mov cl,cnt
shr al,cl
mov res,al
int 3h
code ends
end start
*************
INPUT: OP1:25h
cnt:03h
OUTPUT:
RES:04h
Program No: 3(l)
PACKED TO ASCII
Assume cs:code,ds:data
data segment
ip1 db 56h
res dw 00h
data ends
code segment
start:mov ax,data
mov ds,ax
xor ax,ax
mov al,ip1
24
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
mov dl,al
and al,0f0h
mov cl,4
ror al,cl
mov bh,al
and dl,0fh
mov bl,dl
add bx,3030h
mov res,bx
int 03h
code ends
end start
************
INPUT: OP1:56h
OUTPUT:
RES:3536h
PAC`KED TO UNPACKED
assume cs:code,ds:data
data segment
ip1 db 56h
res dw 00h
data ends
code segment
start:mov ax,data
mov ds,ax
xor ax,ax
mov al,ip1
25
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
mov dl,al
and al,0f0h
mov cl,4
ror al,cl
mov bh,al
and dl,0fh
mov bl,dl
mov res,bl
int 03h
code ends
end start
*************
INPUT: OP1:56h
OUTPUT:
RES:0506h
REAULT: Hence we obtained the logical, shift, rotate operations by using assembler.
ASCENDING ORDER
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
list db 76h,34h,23h,22h,02h,49h,15h,00h,00h
cnt db 08h
data ends
code segment
start: mov ax,data
mov ds,ax
mov cl,cnt
up: mov dl,cnt
mov si,offset list
xor ax,ax
again: mov al,[si]
cmp al,[si+1]
jl next
xchg al,[si+1]
mov [si],al
next: inc si
dec dl
jnz again
dec cl
jnz up
int 3h
code ends
end start
Input: ds: 76 34 23 22 02 49 15 00 00
Output: ds: 0000:00 00 02 15 22 23 34 49 76 08.
Program No: 4(b)
BLOCK TRANSFER
Assume cs:code,ds:data,es:extra
data segment
ipstr db 'empty vessels make much noise',24h
data ends
extra segment
opstr db 100h dup(00)
extra ends
code segment
start: mov ax,data
27
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
mov ds,ax
mov ax,extra
mov es,ax
mov si,offset ipstr
mov di,offset opstr
cld
mov cx,29
rep movsb
nop
int 03h
code ends
end start
*******************
STRING LENGTH
Assume cs:code,ds:data
data segment
string1 db 'empty vessels make more noise$'
strlen equ($-string1)
org 0100h
res db 00h
cort db 'strlength found correct$'
incort db 'strlength found incorrect$'
data ends
code segment
28
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
start:mov ax,data
mov ds,ax
sub cl,cl
mov bl,strlen
mov si,offset string1
back: lodsb
inc cl
cmp al,'$'
jnz back
mov res,cl
int 3h
code ends
end start
*******************
STRING COMPARISION
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
string2 db 'empty$'
extra ends
code segment
start: mov ax,data
mov ds,ax
mov ax,extra
mov es,ax
mov si,offset string1
mov di,offset string2
cld
mov cx,strlen
repe cmpsb
jz next
mov ah,09h
mov dx,'u'
int 21h
jmp exitp
next:mov ah,09h
mov dx,'e'
int 21h
exitp:nop
mov res,dl
mov ah,4ch
int 21h
code ends
end start
*******************
Program No: 4(e)
STRING REVERSE
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
end start
**************
INPUT: string1: empty
OUTPUT: string2: ytpme
RESULT: Hence we obtained ascending order, block transfer, string operations.
a) Read a character(s) from keyboard and echo using DOS function calls
31
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
Assume cs:code,ds:data
data segment
msg db 'enter characters from keyboard (# to end):','$'
data ends
code segment
start:mov ax,data
mov ds,ax
mov ah,09h
mov dx,offset msg
int 21h
next:mov ah,08h
int 21h
mov ah,02h
mov dl,al
int 21h
cmp al,'#'
jne next
mov ah,4ch
mov al,00h
int 21h
code ends
end start
********************
OUTPUT: enter the character from keyboard: o/p string #
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
c) Display a message on screen using only code segment, and press any key
to return.
assume cs:code
code segment
start: jmp skip
msg db 'S.V.ENGINEERING COLLEGE FOR WOMEN','$'
skip: mov ax,cs
mov ds,ax
mov ah,09h
mov dx,offset msg
int 21h
mov ah,08h
int 21h
mov ah,4ch
mov al,00h
int 21h
code ends
end start
********************
OUTPUT: S.V.ENGINEERING COLLEGE FOR WOMEN (press any key to return)
33
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
34
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
INTERFACING
35
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
INTERRUPTS
MOV AX,0000H
MOV CS,AX
MOV ES,AX
MOV CS,AX
MOV SP,3000H
MOV DX,DFFC8H
MOV AL,17H
OUT DX,AL
MOV DX,0FFCAH
MOV AL,48H
OUT DX,AL
MOV AL,03H
OUT DX,AL
MOV AL,00H
OUT DX,AL
STI
HERE: JMP
ORG 3000H
CLI
MOV SI,4000H
MOV AL,0A
MOV [SI],AL
STI
IRET
INT 3H
ORG 3100H
CLI
MOV SI,4100H
MOV AL,0B
MOV [SI],AL
STI
IRET
INT 3H
ORG 3200H
CLI
MOV SI,4002H
MOV AL,0C
36
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
MOV [SI],AL
STI
IRET
INT 3H
ORG 3300H
CLI
MOV SI,4003H
MOV AL,0D
MOV [SI],AL
STI
IRET
INT 3H
ORG 3400H
CLI
MOV SI,4004H
MOV AL,0E
MOV [SI],AL
STI
IRET
INT 3H
ORG 3500H
CLI
MOV SI,4005H
MOV AL,0F
MOV [SI],AL
STI
IRET
INT3H
ORG 3600H
CLI
MOV SI,4006H
MOV AL,10
MOV [SI],AL
STI
IRET
INT 3H
ORG 3700H
CLI
MOV SI,4007H
37
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
MOV AL,11
MOV [SI],AL
STI
IRET
INT 3H
*******************
OUTPUT:
38
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
CALL DLY
LOOP BC2
JMP BCK
PUSH CX
MOV CX, 0000
L1: LOOP L1
POP CX
RET
**********************
INPUT:
ORG 2100H: ASC SVEW
OUT PUT: SVEW
40
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
42
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
8251- USART
M53 equ 0FFC6
TM0 equ DFFC0
M51 EQU 0FFCA
V51 EQU 0FFC8
MOV AL, 36
MOV DX, 0FFC6
OUT DX, AL
MOV DX, 0FFC0
MOV AL, 0A
OUT DX, AL
MOV AL, 00
MOV DX, AL
MOV SP, 3000
MOV DX, 0FFCA
OUT DX, AL
OUT DX, AL
OUT DX, AL
OUT DX, AL
CALL DLY
MOV AL, 40
OUT DX, AL
CALL DLY
MOV AL, 0CE
OUT DX, AL
CALL DLY
MOV AL, 27
OUT DX, AL
CALL DLY
MOV SI, 2100
STS: MOV DX, 0FFCA
* IN AL, DX
AND AL, 81
CMP AL, 81
JNE STS
MOV AL, [SI]
INC SI
43
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
CMP AL, 00
JE OVR
MOV DX, 0FFC8
OUT DX, AL
JMP STS
OVR: INT 03H
DLY: MOV CX, 2
L1: LOOP L1
RET
***********************
INPUT: 2100:
OUTPUT:
44
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
MICROCONTROLLER 8051
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
SERIAL COMMUNICATION
46
SV COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
MICROPROCESSOR & MICROCONTROLLER LABMANUAL
TRANSMITTER
MOV R2,#05
MOV DPTR,#8500
MOVX A,@DPTR
L1: LCALL 11AEH
INC DPTR
DEC R2
CJNE R2,#00,8005(L1)
L2: SJMP L2
INPUT:
RECEIVER
MOV R2,#05
MOV DPTR,#9500
L1: LCALL 12A5H
MOVX @DPTR,A
INC DPTR
DEC R2
CJNE R2,#00,L1
L2: SJMP L2
OUTPUT:
47