Cmrcet Department of E.C.E. Experiment No.: 1 16 Bit Arithmetic Operations For 8086
Cmrcet Department of E.C.E. Experiment No.: 1 16 Bit Arithmetic Operations For 8086
Cmrcet Department of E.C.E. Experiment No.: 1 16 Bit Arithmetic Operations For 8086
Experiment No.: 1
16 bit arithmetic operations for 8086.
RESULT:
I/P : AX:1111H O/P :AX:3333H
:BX:2222H :BX:2222H
Experiment 1(b):
Aim: Write an ALP in 8086 to perform 16 bit subtraction operations.
Apparatus:
C.P.U.
Keyboard
Masm software
Program:
;program to perform 16 bit subtraction
data segment
a dw 2222h
b dw 1111h
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
RESULT:
I/P : AX:2222H O/P :AX:1111H
:BX:1111H :BX:1111H
Experiment 1(c):
Aim: Write an ALP in 8086 to perform 16 bit multiplication operations.
Apparatus:
C.P.U.
Keyboard
Masm software
Program:
RESULT:
I/P : AX:2211H O/P :AX:4211H
:BX:2001H :BX:2001H
:DX:0442H
Experiment 1(d):
Aim: Write an ALP in 8086 to perform 16 bit division operations.
Apparatus:
C.P.U.
Keyboard
Masm software
Program:
RESULT:
I/P : AX:2211H O/P :AX:0001H
:BX:2001H :BX:2001H
:DX:0210H
Experiment 2
Sorting an array for 8086.
Aim: Write an ALP in 8086 to perform sorting an array.
Apparatus:
C.P.U.
Keyboard
Masm software
Program:
data segment
a dw 51h,20h,10h,07h
count equ 04h
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov dx,count-1
again0:
mov cx,dx
mov si,offset a
again1:
mov ax,[si]
cmp ax,[si+2]
jl pr1
xchg [si+2],ax
xchg [si],ax
pr1:
add si,02
loop again1
dec dx
jnz again0
int 03h
code ends
end start
output:
RESULT:
Experiment 3
Searching for a number or character in a string for 8086.
Aim: Write an ALP in 8086 to search a given number in a sequence.
Apparatus:
C.P.U.
Keyboard
Masm software
Program:
assume cs:code,ds:data ,es:extra
data segment
string1 db 0ah,0dh,"enter a character:",0ah,0dh,"$"
stre db "found$"
strne db "not found$"
data ends
extra segment
string2 db "cmrcet$"
strlen dw ($-string2)
extra ends
code segment
start:mov ax,data
Experiment 4
String manipulations for 8086.
Aim: Write an ALP in 8086 to find length of given string which terminates with a special
character.
Apparatus:
C.P.U.
Keyboard
Masm software
Program:
data segment
arr db 'CMRCET#'
arr2 db '#'
data ends
assume cs:code, ds:data
code segment
start:
mov ax,data
mov ds,ax
xor cx,cx
mov si, offset arr
mov bl,arr2
up:mov al, [si]
cmp al,bl
jz go
inc si
inc cl
jmp up
go: int 03h
code ends
end start
RESULT:
I/P String: ‘length’ O/P String length: CL: 06h
RESULT: Program for displaying the system clock performed using masm software.
Experiment 6
Interfacing ADC and DAC to 8086
AIM: write an ALP in 8086 for displaying the system clock.
Apparatus:
C.P.U.
Keyboard
Masm software.
6.a) ANALOG TO DIGITAL CONVERTER INTERFACING USING INTEL 8255
; DAC FOR ADC INTERFACE
; Connect the interface over J4 of the trainer
; This program illustrates the use of counter method for A/D conversion
; The program can be executed in Standalone or Serial Mode
; Execute the program from 2000H
OUTPUT 2500AD
ORG 2000H
MOV AX,00H ;INITIALISE SEGMENT REGISTERS
MOV CS,AX
MOV ES,AX
OUTPUT 2500AD
ORG 2000H
MOV AX,0000H
MOV CS,AX
MOV ES,AX
MOV DX,0FFE6H ;Initialise all 8255
MOV AL,80H ;ports as O/P ports
OUT DX,AL
CALL FAR 0FE00:01EDH ;newline routine
JMP SHORT START ;display message string
END
RESULTS:
INPUT:
DUAL DAC INTERFACE
S - SQUARE WAVE
T - TRIAGLUAR WAVE
-T
OUTPUT:
Experiment 7
Parallel Communication between two microprocessors kits using 8255
AIM: write an ALP in 8086 for displaying the system clock.
Apparatus:
C.P.U.
Keyboard
Masm software.
Program
TRANSMITTER:
output 2500ad
org 3000h
mov dx,0ffe6h
mov al,80h
out dx,al
mov al,55h
mov dx,0ffe0h
out dx,al
int 03h
RECIVER:
output 2500ad
org 3000h
mov dx,0ffe6h
mov al,80h
out dx,al
mov dx,0ffe0h
in al,dx
int 03h
Result:
tx: rx:
G 4000 G 4000
AX=0055 AX=0955
Experiment 8
Serial Communication between two microprocessors kits using 8251
AIM: write an ALP in 8086 for displaying the system clock.
Apparatus:
C.P.U.
Keyboard
Masm software.
PROGRAM: TRANSMITTER END
output 2500ad
org 2000h
MOV AL,36
MOV DX,0086
OUT DX,AL
MOV DX,0080
MOV Ax,0Ah
OUT DX,AL
MOV AL,00
OUT DX,AL
MOV SP,3000
MOV DX,0092
OUT DX,AL
OUT DX,AL
OUT DX,AL
OUT DX,AL
CALL DELAY
MOV AL,40
OUT DX,AL
CALL DELAY
MOV AL,CEh
OUT DX,AL
CALL DELAY
MOV AL,27
OUT DX,AL
CALL DELAY
MOV SI,3100
L1:MOV DX,0092
IN AL,DX
AND AL,81
CMP AL,81
JNE L1
MOV AL,[SI]
INC SI
CMP AL,00
JE L3
MOV DX,0090
Experiment 10
Programming using arithmetic, logical and bit manipulation instructions of 8051.
Experiment 10(a):
Aim: Write an ALP in 8051 to perform arithmetic operation (addition)using 8051
assembly language programming.
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov a,#05h
mov b,#04h
add a,b
end
Result:
A = 0x09
B = 0x04
Sp = 0x07
Psw = 0x00
Experiment 10(b):
Aim: Write an ALP in 8051 to perform arithmetic operation (subtraction)using 8051
assembly language programming.
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov a,#05h
mov b,#04h
subb a,b
end
Result:
A = 0x01
B = 0x04
Sp = 0x07
Psw = 0x01
Experiment 10(c):
Aim: Write an ALP in 8051 to perform arithmetic operation (multiplication)using
8051 assembly language programming.
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov a,#05h
mov b,#04h
mul ab
end
Result:
A = 0x14
B = 0x00
Sp = 0x07
Psw = 0x00
Experiment 10(d):
Aim: Write an ALP in 8051 to perform arithmetic operation (division)using 8051
assembly language programming.
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov a,#08h
mov b,#04h
div ab
end
Result:
A = 0x02
B = 0x00
Sp = 0x07
Psw = 0x01
Experiment 10(e):
Aim: Write an ALP in 8051 to perform logical operation (AND)using 8051 assembly
language programming.
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov a,#08h
mov b,#04h
anl a,b
end
Result:
A = 0x00
B = 0x04
Sp = 0x07
Psw = 0x00
Experiment 10(f):
Aim: Write an ALP in 8051 to perform logical operation (OR)using 8051 assembly
language programming.
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov a,#08h
mov b,#04h
orl a,b
end
Result:
A = 0x0c
B = 0x04
Sp = 0x07
Psw = 0x00
Experiment 10(g):
Aim: Write an ALP in 8051 to perform logical operation (XOR)using 8051 assembly
language programming.
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov a,#08h
mov b,#04h
xrl a,b
end
Result:
A = 0x0c
B = 0x04
Sp = 0x07
Psw = 0x00
Experiment 10(h):
Aim: Write an ALP in 8051 to perform logical operation (NOT)using 8051 assembly
language programming.
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov a,#08h
cpl a
end
Result:
A = 0xf7
B = 0x00
Sp = 0x07
Psw = 0x01
Experiment 11
Program and verify Timer/Counter in 8051.
Experiment 11(a):
Aim: Write an ALP in 8051 to blink LEDs connected to Port 1 with a delay generated by
using timer 0 in mode 1 using 8051 assembly language programming.
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov a,#00h
mov tmod,#01h
up: mov tl0,#00h
mov th0,#00h
cpl a
mov p1,a
setb tr0
wait: jnb tf0,wait
clr tr0
clr tf0
sjmp up
end
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov a,#00h
mov tmod,#05h
up: mov tl0,#00h
mov th0,#00h
setb tr0
cou: mov a,tl0
mov b,th0
mov p1,a
mov p2,b
jnb tf0,cou
clr tr0
clr tf0
sjmp up
end
C.P.U.
Keyboard
Keil software
Program:
org 0000h
sjmp last
org 0003h
mov a,#55h
up: mov p1,a
cpl a
mov r0,#0ffh
d: djnz r0,d
sjmp up
reti
last: mov ie,#81h
l: mov a,#0ffh
mov p1,a
sjmp l
end
C.P.U.
Keyboard
Keil software
Program:
org 0000h
mov tmod, #20h
mov scon,#50h
mov th1,#-3h
setb tr1
again: mov sbuf,#'m'
here: jnb ti, here
clr ti
mov p0,#'s'
sjmp again
end
Result:
Apparatus:
C.P.U.
Keyboard
Keil software
Program:
Transmitter:
PORT_A EQU E800H
PORT_B EQU E801H
PORT_C EQU E802H
CWR EQU E8003H
ORG 8000H
MOV DPTR,#CWR;INITIALISE 8255
MOV A,#80H;FOR MODE 0
MOVX,@DPTR,A;ALL PORTS AS OUTPUT PORTS
MOV DPTR,#PORT_A
MOV A,#44H
MOVX @DPTR,A
LCALL 0003H
END
RECIVER:
PORT_A EQU E800H
PORT_B EQU E801H
PORT_C EQU E802H
CWR EQU E8003H
ORG 8000H
MOV DPTR,#CWR;INITIALISE 8255
MOV A,#90H;FOR MODE 0
MOVX,@DPTR,A;ALL PORTS AS OUTPUT PORTS
MOV DPTR,#PORT_A
MOVX A,@DPTR
LCALL 0003H
END
Results:
Tx: a=44
Rx:a=44
Apparatus:
C.P.U.
Keyboard
Keil software
PROGRAM:
CMD_PORT EQU 03H
PORT_A EQU 00H
PORT_B EQU 01H
GETKB EQU 142H
GETCH EQU 12A5H
ORG 8000H
ACALL INIT ;Call LCD initialize
;subroutine
MOV A,#80H ;Address for first line
CALL CMD ;display the message waiting
MOV DPTR,#DISP1 ;
MOV R3,#08H
CALL STRING
MOV A,#0C0H ;address for second line
CALL CMD ;display the message for key
MOV DPTR,#DISP2
MOV R3,#08H
CALL STRING
Results:
Press any key in keyboard that key is display on LCD Display
Apparatus:
C.P.U.
Keyboard
Keil software
PROGRAM:
OUTPUT EQU 03FAH
PUTBYTE EQU 139EH
SEG EQU 0E8H
ORG 8000H
MOV DPTR,#MESG
LCALL OUTPUT
BACK: LCALL DILIT
LCALL KSCAN
MOV A,R4
MOV 71H,A
LCALL PUTBYTE
SJMP BACK
KSCAN: MOV P2,#SEG
MOV R0,#03H
MOV A,#92H
MOVX @R0,A
Results:
Input:
Press key: 01
Output :01