MPMC r20 Complete Lab Manual
MPMC r20 Complete Lab Manual
INTRODUCTION TO MASM
Aim: To Write an Assembly Language Program to perforem addition & subtract two 16-Bit
Numbers.
Apparatus:
Program:
DATA SEGMENT
X DW 4521H
Y DW 1324H
Z DW ?
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
Output: AX = 5645H
Subtraction Program:
DATA SEGMENT
X DW 4521H
Y DW 1324H
Z DW ?
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
Output: AX = 31FDH
RESULT: The Assembly Language Program to add & subtract two 16-bit numbers was successfully
executed.
Aim: To Write an Assembly Language Program to Perform Multiplication and Division of signed
and unsigned Hexadecimal numbers.
Apparatus:
DATA SEGMENT
X DW 4521H
Y DW 1324H
Z DW ?
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
DATA SEGMENT
X DW 4521H
Y DW 1324H
Z DW ?
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
DATA SEGMENT
X DW 4521H
Y DW 1324H
Z DW ?
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
DATA SEGMENT
X DW 4521H
Y DW 1324H
Z DW ?
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
RESULT: The Assembly Language Program to Perform Multiplication and Division of signed and
unsigned Hexadecimal numbers was successfully executed.
Aim: To Write an ALP to find square, cube and factorial of a given number.
Apparatus:
Factorial Program:
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
N DB 04H
RES DW ?
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
X DB 08H
SQR DW (?)
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
X DB 08H
CUBE DW (?)
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
RESULT: The Assembly Language Program to find square, cube and factorial of a given number
was successfully executed.
Aim:To Write an Assembly Language Program to find the given data is positive or negative.
Apparatus:
Program:
DATA SEGMENT
NUM DB 12H
MES2 DB 10,13,"DATA IS
NEGATIVE$"
DATA ENDS
CODE SEGMENT
INT 21H
CODE ENDS
END START
Output:DATA IS POSITIVE
RESULT: The Assembly Language Program to find the given data is positive or negative was
successfully executed.
Aim: To Write an Assembly Language Program to find the given data is Even or Odd.
Apparatus:
Program:
DATA SEGMENT
NUM DB 15H
DATA ENDS
CODE SEGMENT
INT 21H
INT 21H
INT 21H
CODE ENDS
END START
RESULT: The Assembly Language Program to find the given data is Even or Odd was successfully
executed.
Aim:To Write an Assembly Language Program to find Logical ones and zeros in a given data
Apparatus:
Program:
DATA SEGMENT
X DB 02AH
ONE DB ?
ZERO DB ?
DATA ENDS
CODE SEGMENT
INT 21H
CODE ENDS
END START
RESULT: The Assembly Language Program to find Logical ones and zeros in a given data was
successfully executed.
A.Addition of N no‘s.
Aim: To Write an Assembly Language Program to find Addition of N Numbers.
Apparatus:
DATA SEGMENT
ARRAY DB
29H,15H,32H,08H,45H,17H
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
Input: LIST
[0000]= 29H
[0001]= 15H
[0002]= 32H
[0003]= 08H
[0004]= 45H
[0005]= 17H
Output: AX=00D4H
RESULT: The Assembly Language Program to find Addition of N numbers was successfully
executed.
Apparatus:
DATA SEGMENT
LIST DB
29H,15H,32H,08H,45H,17H
COUNT EQU 06H
DATA ENDS
CODE SEGMENT
Input:LIST
[0000]= 29H
[0001]= 15H
[0002]= 32H
[0003]= 08H
[0004]= 45H
[0005]= 17H
Output: AL=45H
SMALLEST NUMBER Program:
DATA SEGMENT
LIST DB
29H,15H,32H,08H,45H,17H
COUNT EQU 06H
DATA ENDS
CODE SEGMENT
Input: LIST
[0000]= 29H
[0001]= 15H
[0002]= 32H
[0003]= 08H
[0004]= 45H
[0005]= 17H
Output: AL=08H
RESULT: The Assembly Language Program to find Largest & Smallest number was successfully
executed.
Apparatus:
DATA SEGMENT
LIST DB
29H,15H,32H,08H,45H,17H
COUNT EQU 06H
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
Input: LIST
[0000]= 29H
[0001]= 15H
[0002]= 32H
[0003]= 08H
[0004]= 45H
[0005]= 17H
Output:
[0000]= 08H
[0001]= 15H
[0002]= 17H
[0003]= 29H
[0004]= 32H
[0005]= 45H
DATA SEGMENT
LIST DB 29H,15H,32H,08H,45H,17H
COUNT EQU 06H
DATA ENDS
CODE SEGMENT
CODE ENDS
END START
Input: LIST
[0000]= 29H
[0001]= 15H
[0002]= 32H
[0003]= 08H
[0004]= 45H
[0005]= 17H
Output:
[0000]= 45H
[0001]= 32H
[0002]= 29H
[0003]= 17H
[0004]= 15H
[0005]= 08H
RESULT: The Assembly Language Program to arrange given list of numbers in Ascending and
Descending Order was successfully executed.
4. STRING OPERATIONS
A. STRING LENGTH
Aim: To Write an Assembly Language Program to Comapre two strings are equal or not using
String Prefix.
Apparatus:
Software: MASM (or) TERM 86E
DATA SEGMENT
STR1 DB "HELLO$"
MSG DB 10,13,"LENGTH OF
STRING IS:$"
LEN DB 03 DUP("$")
DATA ENDS
CODE SEGMENT
INT 21H
CODE ENDS
END START
RESULT: Assembly Language Program to find Length of the string was successfully executed.
B. STRING DISPLAY
Apparatus:
Software: MASM (or) TERM 86E
DATA SEGMENT
STRING DB 10,13,”THIS IS A
SAMPLE STRING $”
DATA ENDS
CODE SEGMENT
INT 21H
CODE ENDS
END START
CODE ENDS
END START
RESULT:Assembly Language Program to display given string are equal or not using String Prefix
was successfully executed.
C. STRING COMPARISON
Aim: To Write an Assembly Language Program to Compare two strings are equal or not using
String Prefix.
Apparatus:
Software: MASM (or) TERM 86E
DATA SEGMENT
STR1 DB "HELLO$"
MSG1 DB 10,13,"STRINGS ARE
EQUAL$"
MSG2 DB 10,13,"STRINGS ARE
NOT EQUAL$"
STR2 DB "HEPLO$"
DATA ENDS
CODE SEGMENT
ORG 1000H
START: MOV AX,DATA ;Copy Data Segment Starting Address
into AX Register
MOV DS,AX ;Copy the Content of AX into DS
MOV ES,AX ;Copy the Content of AX into ES
LEA SI,STR1 ;Copy the offset address of STR1 into
SI
LEA DI,STR2 ;Copy the address of STR1 into DI
MOV CL,05 ;Copy the Count Value 05 into CL
CLD ;Clear the Directional Flag
REP CMPSB ;Compare STR1 with STR2
JE L1 ;Jump if Equal or Zero to Address
Pointed by Label L1
MOV DX,OFFSET ;Write theString pointed by MSG2 on
MSG2 Standard Output.
MOV AH,09
INT 21H
L1: JMP L2 ;Jump to address pointed by L1
MOV DX,OFFSET ;Write theString pointed by MSG1 on
MSG1 Standard Output.
L2: MOV AH,09H
INT 21H
MOV AH,4CH ;Terminate the Current Process &
Return to DOS
INT 21H
CODE ENDS
END START
STR2= HEPLO
RESULT: Assembly language program to Compare two strings are equal or not using String Prefix
was successfully executed.
Apparatus:
Software: MASM (or) TERM 86E
Hardware: PC, Key Board/ 8086 Trainer Kit, R.P.S
Program:
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
STR1 DB "HELLO$"
MSG1 DB 10,13,"STRING IS
PALINDROME$"
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA ;Copy Data Segment Starting Address into AX
Register
MOV DS,AX ;Copy the Content of AX into DS
MOV SI,OFFSET STR1 ;Copy the offset address of STR1 into SI
MOV CL, LENGTH STR1 ;Copy the Count Value 05 into CL
MOV DI,SI ;Copy the contents of SI into DI
ADD DI,04 ;Add 04H to DI Register
L1: MOV AL,[SI] ;Copy the contents pointed by memory
location of SI into AL.
CMP AL,[DI] ;Compare the contents pointed by memory
location of DI with AL.
MOV AH,09H
INT 21H
JMP L3 ; Jump to Label L3
L2: MOV DX,OFFSET MSG2 ;Write theString pointed by MSG2 on
Standard Output.
MOV AH,09H
INT 21H
L3: MOV SI,OFFSET STR1 ;Copy the offset address of STR1 into SI
Register
RESULT: The Assembly Language Program to Reverse the given string & checking wheteher it is a
palindrome or not was successfully executed.
Aim: To Write an Assembly Language Program for designing clock using int 21h interrupt.
Apparatus:
Software: MASM (or) TERM 86E
Program:
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
HR DB ?
MIN DB ?
SEC DB ?
MSEC DB ?
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
MOV AH,2CH
INT 21H
MOV HR,CH
MOV MIN,CL
MOV SEC,DH
MOV MSEC,DL
MOV AH,09H
LEA DX,MESSAGE
INT 21H
MOV AL,HR
AND AL,AL
AAM
MOV BX,AX
CALL DISPLAY
MOV DL,':'
MOV AH,02H
INT 21H
MOV AL,MIN
AAM
MOV BX,AX
CALL DISPLAY
MOV DL,':'
MOV AH,02H
INT 21H
MOV AL,SEC
AAM
MOV BX,AX
CALL DISPLAY
MOV DL,'.'
MOV AH,02H
INT 21H
MOV AL,MSEC
AAM
MOV BX,AX
CALL DISPLAY
MOV AH,4CH
INT 21H
MOV DL,BH
ADD DL,30H
MOV AH,02H
INT 21H
MOV DL,BL
ADD DL,30H
MOV AH,02H
INT 21H
RET
DISPLAY ENDP
CODE ENDS
END START
OUTPUT:
RESULT: Assembly Language Program for designing clock using int 21h interrupt was executed
successfully.
Aim: To Write an Assembly Language Program for designing clock using DOS interrupt functions.
Apparatus:
Software: MASM (or) TERM 86E
Program:
;Used INTERRUPTS
;AH=02h
;For 2CH
; Hours is in CH
; Minutes is in CL
; Seconds is in DH
.MODEL SMALL
.DATA
.CODE
MOV DS,AX
HOUR:
MOV AH,2CH
INT 21H
MOV AL,CH
AAM
MOV BX,AX
CALL DISP
MOV DL,':'
MOV AH,02H
INT 21H
MINUTES:
MOV AH,2CH
INT 21H
MOV AL,CL
AAM
MOV BX,AX
CALL DISP
MOV DL,':'
MOV AH,02H
INT 21H
Seconds:
MOV AH,2CH
INT 21H
MOV AL,DH
AAM
MOV BX,AX
CALL DISP
MOV AH,4CH
INT 21H
DISP PROC
MOV DL,BH
ADD DL,30H
MOV AH,02H
INT 21H
MOV DL,BL
ADD DL,30H
MOV AH,02H
INT 21H
RET
DISP ENDP
END START
(OR)
.MODEL SMALL
.STACK 100H
.DATA
TIME DB '00:00:00$'
.CODE
MAIN PROC
MOV DS, AX
CALL GET_TIME
INT 21H
INT 21H
INT 21H
MAIN ENDP
GET_TIME PROC
PUSH AX
PUSH CX
INT 21H
MOV AL, CH
CALL CONVERT
MOV [BX], AX
MOV AL, CL
CALL CONVERT
MOV AL, DH
CALL CONVERT
POP CX
POP AX
RET
GET_TIME ENDP
CONVERT PROC
PUSH DX
MOV AH, 0
MOV DL, 10
DIV DL
OR AX, 3030H
POP DX
RET
CONVERT ENDP
END MAIN
OUTPUT:
CURRENT SYSTEM TIME IS : 18:36:10
RESULT: An Assembly Language Program for designing clock using DOS Interrupt functions was
executed successfully.
Aim: To Write an Assembly Language Program for designing clock by reading system time.
Apparatus:
Software: MASM (or) TERM 86E
Program:
.MODEL SMALL
.DATA
HOUR DB 2 DUP(0),':'
MIN DB 2 DUP(0),':'
SEC DB 2 DUP(0),'$'
.CODE
MOV AX,@DATA
MOV DS,AX
MOV AH,2CH
INT 21H
MOV AL,CH
AAM
ADD AX,3030H
MOV HOUR,AH
MOV HOUR+1,AL
MOV AL,CL
AAM
ADD AX,3030H
MOV MIN,AH
MOV MIN+1,AL
MOV AL,DH
AAM
ADD AX,3030H
MOV SEC,AH
MOV SEC+1,AL
MOV AH,09H
LEA DX,MSG
INT 21H
MOV AH,4CH
INT 21H
END
(OR)
.MODEL SMALL
.DATA
DA DB ?,?, '/'
.CODE
MOV AX,@DATA
MOV DS, AX
MOV AH,2CH
INT 21H
MOV AL,CH
AAM
MOV HRS, AH
MOV HRS+1, AL
MOV AL,CL
AAM
MOV MINS, AH
MOV MINS+1,AL
MOV AL,DH
AAM
MOV SEC, AH
MOV SEC+1,AL
INT 21H
MOV AL, DL
AAM
ADD AX,3030H
MOV DA,AH
MOV DA +1, AL
MOV AL, DH
AAM
MOV MON,AH
MOV MON+1,AL
MOV AL, CL
AAM
MOV YEA,AH
MOV YEA+1,AL
LEA DX,MSG
MOV AH,09H
INT 21H
MOV AH,4CH
INT 21H
END
OUTPUT:
THE TIME IS : 18:37:20
RESULT: An Assembly Language Program for designing clock by reading system time was
executed successfully.
6. STEPPER MOTOR
A. ANTI-CLOCK WISE ROTATION
Aim: To Write an ALP to 8086 processor to Interface a stepper motor and operate it in Anticlockwise
by choosing variable step-size.
Apparatus:
Hardware: PC, Key Board, 8086 Trainer Kit, R.P.S, Stepper Motor, Study Card Kit for Stepper
motor
Program:
INT 03 ;End
DELAY: MOV CX,FFFF ;Delay
L1: LOOP L1
L2: LOOP L2
L3: LOOP L3
L4: LOOP L4
L5: LO0P L5
RET
INPUT:
S2035(PressEnter)
0A,0D,53,54,45,50,43,4F,55,4E,54,20,43,4F,4D,50,4C,45,54,45,44,20,20,20,20,00
The following Program Rotates Stepper Continuously in Anti Clock Wise Direction.
RESULT: An ALP to 8086 processor to Interface a stepper motor and operate it in Anti clockwise by
choosing variable step-size was executed successfully.
Aim: To Write an ALP to 8086 processor to Interface a stepper motor and operate it in anti-clockwise
by choosing variable step-size.
Apparatus:
Hardware: PC, Key Board, 8086 Trainer Kit, R.P.S, Stepper Motor, Study Card Kit for Stepper
motor
Program:
INT 03 ;End
DELAY: MOV CX,FFFF ;Delay
L1: LOOP L1
L2: LOOP L2
L3: LOOP L3
L4: LOOP L4
L5: LO0P L5
RET
INPUT:
S2035(PressEnter)
0A,0D,53,54,45,50,43,4F,55,4E,54,20,43,4F,4D,50,4C,45,54,45,44,20,20,20,20,00
RESULT: An ALP to 8086 processor to Interface a stepper motor and operate it in Clockwise by
choosing variable step-size was executed successfully.
Apparatus:
Hardware: PC, Key Board, 8086 Trainer Kit, R.P.S, Study Card Kit for 16-Channel ADC
Program:
OR AL,CL
OUT DX,AL
MOV DX,0FFE4H
IN AL,DX
AND AL,01H
JNZ 2052
IN AL,DX
AND AL,01
JE 2057
MOV AL,40H
OR AL,CL
MOV DX,0FFE0H
OUT DX,AL
MOV DX,0FFE2H
IN AL,DX
PUSH AX
MOV AL,00H
OR AL,CL
MOV DX,0FFE0H
OUT DX,AL
POP AX
RET
CALLS 0FE00:0031H
CALLS 0FE00:01EDH
PUSH AX
LEA DX,@200D
MOV AX,DX
CALLS 0FE00:0013H
MOV AL,CL
CMP AL,0AH
JB 2092
ADD AL,06H
CALLS 0FE00:0052H
CS
LEA DX,@201B
MOV AX,DX
CALLS 0FE00:0013H
POP AX
CALLS 0FE00:0052H
CALLS 0FE00:0031H
RET
CALLS 0FE00:00A9H
CMP AL,2CH
JE 20C6
CMP AL,2DH
JE 20D0
CMP AL,0DH
JE 20DA
CMP AL,1BH
JE 20DA
JMP 20AF
INC CL
CMP CL,10H
JNE 20CF
MOV CL,00H
RET
DEC CL
CMP CL,0FFH
JNE 20D9
MOV CL,0FH
RET
INT 03
INPUT:
Apparatus:
Hardware: PC, Key Board, 8086 Trainer Kit, R.P.S, Study Card Kit for DUAL DAC
OUT DX,AL
Note: After Execution of above program, connect CRO Probe to Xout or Yout Pin on DAC, we can
view Square Wave Form on the CRO.
OUT DX,AL
Note: After Execution of above program, connect CRO Probe to Xout or Yout Pin on DAC, we can
view Triangular Wave Form on the CRO.
OUT DX,AL
Note: After Execution of above program, connect CRO Probe to Xout or Yout Pin on DAC, we can
view SAWTOOTH Wave Form on the CRO.
OUT DX,AL
Substitute θ = 0o in above formula & increment θ by 15 Degrees to get different values of Vout &
convert the Vout into Hexa decimal, then we will obtain the values given below. After entering the
above program , type “S 3000” & enter the following data.
3000: 80,A1,C0,DA,EF,FC
3006: FF,FC,EF,DA,C0,A1
300C: 80,5F,40,26,11,04
3012: 00,04,11,26,40,5F,80
After entering the above data in 3000H memory location, press reset button on the Kit. Execute the
program by giving the command “GO 2000” & Hit enter button on the Keyboard, & verify the output
on CRO, by connecting CRO Probe to Xout Pin DAC Kit.
OUTPUT:
Measure the Amplitude, time period of Square Wave, Triangular Wave & Sine Wave form displayed
on CRO & Plot the Graph.
RESULT: An ALP to 8086 processor to Interface DAC and generate Square wave & triangular wave
was executed successfully.
ORG 2000H
MOV AX,0000H
MOV CS,AX
MOV ES,AX
OUT DX,AL
MOV DX,0FFE2H
OUT DX,AL
LOOP UP
MOV DX,0FFE2H
OUT DX,AL
LOOP DOWN
MOV DX,0FFE0H
OUT DX,AL
MOV DX,0FFE2H
OUT DX,AL
MOV DX,0FFE0H
OUT DX,AL
MOV DX,0FFE2H
OUT DX,AL
MOV CX,FFH
END
RESULT: An ALP to 8086 processor to Interface DAC & generate a Square wave , triangular wave,
& Sine Wave was executed successfully.
Aim: To Write an ALP to have Parallel communication between two microprocessors using 8255
Apparatus:
Hardware: PC, Key Board, 8086 Trainer Kit-2, R.P.S, FRCS Cable
Program:
TRANSMITTER:
OUT DX,AL
MOV DX,0FFE0H
OUT DX,AL
MOV DX,0FFE2H
OUT DX,AL
MOV DX,0FFE4H
OUT DX,AL
Note: Enter the above program in 8086 Micro Processor Kit-1 from Memory Location 2000H.
RECEIVER:
IN AL,DX
Note: Enter the above program in 8086 Micro Pocessor Kit-2 from Memory Location 2000H.
After entering the transmitter & receiver programs in Kit-1 & Kit-2 Respectively,Press Reset Button on Kits.
First execute Transmitter Program in Kit-1 by using command “Go 2000” & then execute Receiver Program in Kit-2
by using command “Go 2000”. Now Press Reset Button on Receiver Kit & type “S 2050” to check the ouput in
Receiver Kit.
INTPUT: TRANSMITTER KIT
PORT A = 55H
PORT B = 66H
PORT C = CCH
OUTPUT: RECEIVER KIT
[2050] = 55H
[2051] = 66H
[2052] = CCH
RESULT: An ALP to have Parallel communication between two microprocessors using 8255 was
executed successfully.
B. SERIAL COMMUNICATION BETWEEN TWO 8086 KITS
Aim: To Write an ALP to have Serial communication between two microprocessors using 8251.
Apparatus:
Hardware: PC, Key Board, 8086 Trainer Kit-2, R.P.S, FRCS Cable, RS 232-Cable
Program:
TRANSMITTER:
ORG 2000H
MOV AL,36H ;Initilize Timer 0
MOV DX,0FFFFH
OUT DX,AL ;for mode3 operation
MOV DX,0FFF9H
MOV AL,0AH ;Load Timer0 Count
OUT DX,AL ;For 9600 baudrate
MOV AL,00H
OUT DX,AL
MOV SP,3000H
MOV DX,0FFF2H
OUT DX,AL
OUT DX,AL ;Reset 8251
OUT DX,AL
OUT DX,AL
CALL DELAY
MOV AL,40H ;Initialize 8251
OUT DX,AL ;for Asyncronous
CALL DELAY ;16xBaud,8 data bits,no parity
MOV AL,0CEH
OUT DX,AL
CALL DELAY
MOV AL,23H ;Test for DTR,RTS&
OUT DX,AL ;TxEN
CALL DELAY
MOV SI,2100H
AGAIN: MOV DX,0FFF2H ;Get USART status
IN AL,DX ;for Transmitter
AND AL,81H ;ready & DSR active
CMP AL,81H
JNE AGAIN ;If yes,Transmit
MOV AL,[SI] ;stored character
INC SI
CMP AL,00H
JE OVER
MOV DX,0FFF0H
OUT DX,AL
JMP AGAIN
OVER: INT 03H
DELAY: MOV CX,02H
L1: LOOP L1
RET
ORG 2100H
DB 'HELLO WORLD' ,00H
END
Note: Enter the above program in 8086 Micro Pocessor Kit-1 from Memory Location 2000H.
RECEIVER:
ORG 3000H
MOV AL,36H ;Initilize Timer 0
MOV DX,0FFFFH ;for mode3 operation
OUT DX,AL
MOV DX,0FFF9H
MOV AL,0AH ;Load Timer0 Count
OUT DX,AL ;For 9600 baudrate
MOV AL,00H
OUT DX,AL
MOV SP,3000H
MOV DX,0FFF2H
OUT DX,AL ;Reset 8251
OUT DX,AL
OUT DX,AL
OUT DX,AL
CALL DELAY
MOV AL,40H ;Initialize 8251
OUT DX,AL ;for Asyncronous
CALL DELAY
MOV AL,0CEH ;16xBaud,8 data bits,no parity
OUT DX,AL
CALL DELAY
MOV AL,27H
OUT DX,AL
CALL DELAY
MOV SI,3100H ;Initialize Memort to
AGAIN: MOV DX,0FFF2H ;store characters
IN AL,DX ;Get USART status
AND AL,02H ;Receiver ready?
JE AGAIN ;No,wait
MOV DX,0FFF0H ;Yes,get character from USART
IN AL,DX
CMP AL,1BH ;If char=<Esc>
MOV BL,AL
JE OVER ;Exit
Note: Enter the above program in 8086 Micro Pocessor Kit-2 from Memory Location 3000H.
Connect two Micro processor Kits by using RS-232 Male to Male Connector.
After entering the transmitter & receiver programs in Kit-1 & Kit-2 Respectively,Press Reset Button on Kits. First
execute Receiver Program in Kit-2 by using command “Go 3000” & then execute Transmitter Program in Kit-1 by
using command “Go 2000”. Now Press Reset Button on Receiver Kit & type “D2100,210A” to check the output in
Receiver Kit.
[2106] = 57 = W
[2107] = 4F = O
[2108] = 52 = R
[2109] = 4C = L
[210A] = 44 = D
RESULT: An ALP to have Serial communication between two microprocessors using 8251 was
executed successfully.
APPARATUS:
Software: Keil u Vision / Term51E
ADDITION ALGORITHM:
1. Start.
2. Copy the immediate data 45H in to A Register.
3. Copy the immediate data 38H in to B Register.
4. Add the Contents of Register A, B & Update the RESULT in A register.
5. Stop.
ADDITION PROGRAM:
ORG 0000H
OUTPUT:A = 7DH
SUBTRACTION ALGORITHM:
1. Start.
2. Copy the immediate data 48H in to A Register.
3. Copy the immediate data 33H in to B Register.
4. Add the Contents of Register A, B & Update the RESULT in A register.
5. Stop.
SUBTRACTION PROGRAM:
ORG 0000H
OUTPUT: A = 15H
RESULT:Assembly Language Program to Perform 8-bit addition & subtraction using 8051Micro
Controller was successfully executed.
APPARATUS:
Software: Keil u Vision / Term51E
ALGORITHM:
1. Start.
2. Copy the immediate data 48H in to A Register.
3. Copy the immediate data 33H in to B Register.
4. Multiply the Contents of Register A, B & Update the RESULT in B-A register.
5. Stop.
PROGRAM:
ORG 0000H
DIVISION ALGORITHM:
1. Start.
2. Copy the immediate data 48H in to A Register.
3. Copy the immediate data 33H in to B Register.
4. Divide the Contents of Register A with B & Update the RESULT in A(Quotient)& B
(Remainder) .
5. Stop.
DIVISION PROGRAM:
ORG 0000H
INPUT : A=48H,B=33H
RESULT: Assembly Language Program to Perform 8-bit Multiplication & Division using
8051Micro Controller was successfully executed.
AIM: To Perform Logical AND, OR, XOR Operations using 8051Micro Controller
APPARATUS:
ORG 0000H
OUTPUT: A= 01H
OR OPERATION ALGORITHM :
1. Start.
2. Copy the immediate data 45H in to A Register.
3. Copy the immediate data 23H in to B Register.
4. Perform OR Operation between the Contents of Register A, R0 & Update the RESULT in
A register.
5. Stop.
OR OPERATION PROGRAM:
ORG 0000H
OUTPUT:A = 67H
1. Start.
2. Copy the immediate data 45H in to A Register.
3. Copy the immediate data 23H in to B Register.
4. Perform XOR Operation between the Contents of Register A, R0 & Update the RESULT in
A register.
5. Stop.
ORG 0000H
OUTPUT: A= 66H
RESULT: Assembly Language Program to Perform Logical AND, OR & XOR operations using
8051Micro Controller was successfully executed.
APPARATUS:
ORG 0000H
ORG 0000H
RESULT: Assembly Language Program to copy data in to various register banks was executed
successfully.
AIM: Write a program to create various delays using Timer 0 & Timer 1 in different modes.
APPARATUS:
a) Write a program to create a delay of 25msec using Timer0 in mode 1 and blink all the Pins of
P0.
ORG 0000H
AGAIN:MOV P0,#0FFH
ACALL DELAY
MOV P0,#00H ;
ACALL DELAY
SJMP AGAIN ;
ORG 300H
DELAY:
MOV TMOD,#01 ;Timer 0, 16-bitmode
MOV TL0,#0FFH ;TL0=FF, low byte of timer
MOV TH0,#0A5H ;TH0=A5, the high byte
SETB TR0 ;Start timer 0
BACK: JNB TF0,BACK ;until timer rolls over
CLR TR0 ;Stop the timer 0
CLR TF0 ;Clear timer 0 flag
RET
END
(OR)
ORG 0000H
MOV TMOD,#01H ;Timer 0, 16-bitmode
AGAIN:MOV TL0,#0FFH
MOV TH0,#0A5H
MOV P0,#0FFH
ACALL DELAY
MOV TL0,#0FFH
MOV TH0,#0A5H
MOV P0,#00H
ACALL DELAY
SJMP AGAIN
ORG 300H
DELAY:SETB TR0 ;Start timer 0
BACK: JNB TF0,BACK ;until timer rolls over
CLR TR0 ;Stop the timer 0
CLR TF0 ;Clear timer 0 flag
RET
END
(or)
ORG 0000H
MOV TMOD,#01H ;Timer 0, 16-bitmode
AGAIN:MOV TL0,#0FFH ;TL0=FF, low byte MOV TH0,#0A5H ;TH0=A5, the high byte
MOV P0,#0FFH
ACALL DELAY
MOV TL0,#0FFH ;TL0=FF, low byte of timer
MOV TH0,#0A5H ;
MOV P0,#00H ;
ACALL DELAY
SJMP AGAIN ;
ORG 300H
DELAY:SETB TR0 ;Start timer 0
BACK: JNB TF0,BACK ;until timer rolls over
CLR TR0 ;Stop the timer 0
CLR TF0 ;Clear timer 0 flag
RET
END
(OR)
ORG 0000H
AGAIN: MOV TMOD,#01 ;Timer 0,16-bitmode
MOV TL0,#0FFH ;TL1=FF, low byte of timer
MOV TH0,#0A5H ;TH1=A5, the high byte
MOV P0,#0FFH
SETB TR0 ;Start timer 0
BACK: JNB TF0,BACK ;until timer rolls over
MOV P0,#00H ;
CLR TR0 ;Stop the timer 0
CLR TF0 ;Clear timer 0 flag
SJMP AGAIN ;Reload timer
END
b)Write a program to create a delay of 50 µsec using Timer1 in mode 0 and blink all the Pins of
P2.
ORG 0000H
MOV TMOD,#00H ;Timer 1, 13-bitmode
AGAIN:MOV TL1,#12H
MOV TH1,#0FEH ;TH1=FEH, the high byte
MOV P2,#0FFH
ACALL DELAY
MOV TL1,#12H ;
MOV TH1,#0FEH ;
MOV P2,#00H ;
ACALL DELAY
SJMP AGAIN ;
ORG 300H
DELAY:SETB TR1 ;Start timer 1
BACK: JNB TF1,BACK ;until timer rolls over
CLR TR1 ;Stop the timer 1
CLR TF1 ;Clear timer 1 flag
RET
END
c)Write a program to create a delay of 75msec using counter0 in mode 2 and blink all the Pins
of P1.
ORG 0000H
MOV TMOD,#02H ;Timer 0,8-bit AUTO RELOAD mode
AGAIN: MOV P1,#0FFH
ACALL DELAY
ACALL DELAY
MOV P1,#00H ;
ACALL DELAY
ACALL DELAY
SJMP AGAIN ;
ORG 300H
DELAY:MOV R0,#86H
UP:MOV TH0,#00H ;
SETB TR0 ;Start timer 0
BACK: JNB TF0,BACK ;until timer rolls over
CLR TR0 ;Stop the timer 0
CLR TF0 ;Clear timer 0 flag
DJNZ R0,UP
RET
END
d) Write a program to create a delay of 80 µsec using counter1 in mode 1 and blink all the Pins
of P3.
ORG 0000H
MOV TMOD,#10H ;Timer 1, 16-BIT MODE-1
AGAIN:MOV TL1,#0B6H ;TL1=0B6H, low byte of timer
MOV TH1,#0FFH ;TH1=FFH, the high byte
MOV P3,#0FFH
ACALL DELAY
MOV TL1,#0B6H ;TL1=0B6H, low byte of timer
MOV TH1,#0FFH ;TH1=FFH, the high byte
MOV P3,#00H ;
ACALL DELAY
SJMP AGAIN ;
ORG 300H
DELAY:SETB TR1 ;Start timer 1
BACK: JNB TF1,BACK ;until timer rolls over
CLR TR1 ;Stop the timer 1
CLR TF1 ;Clear timer 1 flag
RET
END
Note: To check the output of timers in Keil uvision, open peripherals & then select timer0 or timer1
& then open peripherals & then Select the port you want to check the delay.
To view the output wave form, open logic analyser & add the port number in settings.
RESULT: The Operations of 8051 Timers in different modes of was verifed successfully.
AIM: To Write a program to transfer a character serially with a baud rate of 9600 using
UART.
APPARATUS:
PROGRAM:
ORG 0000H
END
Note: To check the output click peripherals & select serial window, observe the Baud Rate. Now
Open serial window in keil u vision & verify that the character A is Transmitting continuously.
RESULT: Assembly Language program to transfer a character serially with a baud rate of 9600
using UART was successfully executed.
AIM: To Write a program to transfer a character serially with a baud rate of 4800 using
UART.
APPARATUS:
PROGRAM:
ORG 0000H
END
Note: To check the output click peripherals & select serial window, observe the Baud Rate. Now
Open serial window in keil u vision & verify that the character A is Transmitting continuously.
RESULT:Assembly Language program to transfer a character serially with a baud rate of 4800 using
UART was successfully executed.
AIM: To Write a program to transfer a character serially with a baud rate of 2400 using
UART.
APPARATUS:
PROGRAM:
ORG 0000H
END
Note: To check the output click peripherals & select serial window, observe the Baud Rate. Now
Open serial window in keil u vision & verify that the character A is Transmitting continuously.
RESULT:Assembly Language program to transfer a character serially with a baud rate of 2400 using
UART was successfully executed.
APPARATUS:
PROGRAM:
DJNZ R3,L1
MOV A,#0C0H
CALL CMD
MOV DPTR,#MESS
MOV R3,#08H
CALL STRING
MOV A,#02H
CALL CMD
JMP START
MOVX @R0,A
MOV A,#0FAH
MOV R0,#PORT_B
MOVX @R0,A
MOV A,#0F9H
MOV R0,#PORT_B
MOVX @R0,A
MOV A,#0FDH
MOV R0,#PORT_B
MOVX @R0,A
MOV A,#0F9H
MOV R0,#PORT_B
MOVX @R0,A
MOV R1,#10H
CALL DELAY
RET
;DELAY SUBROUTINE
DELAY: MOV R2,#02H
DLY:DJNZ R2,DLY
DJNZ R1,DLY
RET
;STRING WRITE SUBROUTINE
STRING: CLR A
MOVC A,@A+DPTR
JZ L3
CALL DWR
INC DPTR
DJNZ R3,STRING
L3: RET
MESS: DB 'IS TYPED',00H
DISP1: DB 'WAITING',00H
DISP2: DB 'FOR KEY',00H
END
RESULT: Assembly Language Program to interface16*2 LCD to 8051 was executed successfully.
APPARATUS:
PROGRAM:
RESULT: Assembly Language program to interface LCD to 8051 in 8-bit mode & Display the
Message was executed successfully.