Académique Documents
Professionnel Documents
Culture Documents
LAB MANUAL
8-Bit Addition
8-Bit Subtraction
8-Bit Multiplication
8-Bit Division
Algorithm
8-Bit Addition
Step 1: Get two 8-bit data from the input memory locations to AL and BL registers.
Step 2: Clear CL register to store the carry condition.
Step 3: Add the contents of BL to AL register and store the result in AL.
Step 4: Check carry flog, If CF = 0 then go to step 6.
Step 5: Increment CL register by 1.
Step 6: Store the contents of sum and carry to output memory locations.
Step 7: Stop the execution.
8-Bit Subtraction
Step 1: Get two 8-bit data from the input memory locations to AL and BL registers.
Step 2: Clear CL register to store the carry condition.
Step 3: Subtract the contents of AL from BL register and store the result in AL.
Step 4: Check carry flog, If CF = 0 then go to step 6.
Step 5: Increment CL register by 1.
Step 6: Store the contents of sum and carry to output memory locations.
Step 7: Stop the execution.
8-Bit Multiplication
Step 1: Get two 8-bit data from the input memory locations to AL and BL registers.
Step 2: Clear AH register to store the higher order product.
Step 3: Multiply the contents of BL with AL register and store the product in AX.
Step 4: Store the contents of product to output memory locations.
Step 5: Stop the execution.
8-Bit Division
Step 1: Get two 8-bit data from the input memory locations to AL and BL registers.
Step 2: Clear AH register to store the reminder.
Step 3: Divided the contents of BL from AL register and store thequiescentin AX.
Step 4: Store the contents of reminder and quiescent to output memory locations.
Step 5: Stop the execution.
1
MPMC Lab CS6412
8-Bit Subtraction
Memory Address Label Mnemonics Opcodes Comments
1000 H MOV AL, [1100 H] A0 (AL) [1100 H]
1001 H 00
1002 H 11
1003 H MOV BL, [1101H] 8A (BL) [1101H]
1004 H 1E
1005 H 01
1006 H 11
1007 H MOV CL, 00H B1 (CL) 00H
1008 H 00
1009 H SUB AL, BL 2A (AL) (AL) - (BL)
100A H C3
100B H JNC loop-1 73 If CF=0, then go to loop-1
100C H 02
100D H INC CL FE (CL) (CL) + 1
100E H C1
100F H loop-1 MOV [1200 H], AL A2 [1200 H](AL)
1010 H 00
1011 H 12
1012 H MOV [1201H], CL 88 [1201H](CL)
1013 H 0E
1014 H 01
1015 H 12
1016 H HLT F4 Stop the execution
2
CS6412 MPMC Lab
8-Bit Multiplication
8-Bit Division
3
MPMC Lab CS6412
8-Bit Addition
Input Output
Address Data Address Data
1100H 1200H
1101H 1201H
1100H 1200H
1101H 1201H
8-Bit Subtraction
Input Output
Address Data Address Data
1100H 1200H
1101H 1201H
1100H 1200H
1101H 1201H
8-Bit Multiplication
Input Output
Address Data Address Data
1100H 1200H
1101H 1201H
1100H 1200H
1101H 1201H
8-Bit Division
Input Output
Address Data Address Data
1100H 1200H
1101H 1201H
1100H 1200H
1101H 1201H
4
CS6412 MPMC Lab
Procedure
Program Entry:
Reset M Enter Program Starting Address ENTER KEY Enter
Opcode SPACE BAR Enter Opcode SPACE BAR ...
SPACE BAR
Input Data Entry:
Reset M Enter Input Data Address ENTER KEY Enter
Input Data SPACE BAR Input Data SPACE BAR ...
SPACE BAR
Program Execution:
Reset G Enter Program Starting Address ENTER KEY
To Verify Output Data:
Reset M Enter Output Data Address ENTER KEY
SPACE BAR ... SPACE BAR
Result:
The above programs were successfully executed and results were verified.
5
MPMC Lab CS6412
Programs
16-Bit Addition
16-Bit Subtraction
16-Bit Multiplication
16-Bit Division
6
CS6412 MPMC Lab
Algorithm
16-Bit Addition
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: Clear CL register to store the carry condition.
Step 3: Add the contents of BX to AX register and store the result in AX.
Step 4: Check carry flog, If CF = 0 then go to step 6.
Step 5: Increment CL register by 1.
Step 6: Store the contents of sum and carry to output memory locations.
Step 7: Stop the execution.
16-Bit Subtraction
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: Clear CL register to store the carry condition.
Step 3: Subtract the contents of AX from BX register and store the result in AX.
Step 4: Check carry flog, If CF = 0 then go to step 6.
Step 5: Increment CL register by 1.
Step 6: Store the contents of sum and carry to output memory locations.
Step 7: Stop the execution.
16-Bit Multiplication
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: Clear DX register to store the higher order product.
Step 3: Multiply the contents of BX with AX register and store the product in DX and
AX.
Step 4: Store the contents of product to output memory locations.
Step 5: Stop the execution.
16-Bit Division
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: Clear DX register to store the reminder.
Step 3: Divided the contents of BX from AX register and store thequiescentin AX.
Step 4: Store the contents of reminder and quiescent to output memory locations.
Step 5: Stop the execution.
7
MPMC Lab CS6412
16-Bit Subtraction
Memory Address Label Mnemonics Opcodes Comments
1000 H MOV AX, [1100 H] A1 (AX) [1100 H]
1001 H 00
1002 H 11
1003 H MOV BX, [1102 H] 8B (BX) [1102 H]
1004 H 1E
1005 H 02
1006 H 11
1007 H MOV CL, 00H B1 (CL) 00H
1008 H 00
1009 H SUB AX, BX 2B (AX) (AX) - (BX)
100A H C3
100B H JNC loop-1 73 If CF=0, then go to loop-1
100C H 02
100D H INC CL FE (CL) (CL) + 1
100E H C1
100F H loop-1 MOV [1200 H], AX A3 [1200 H](AX)
1010 H 00
1011 H 12
1012 H MOV [1202 H], CL 88 [1202 H](CL)
1013 H 0E
1014 H 02
1015 H 12
1016 H HLT F4 Stop the execution
8
CS6412 MPMC Lab
16-Bit Multiplication
Memory Address Label Mnemonics Opcodes Comments
1000 H MOV AX, [1100 H] A1 (AX)[ 1100 H]
1001 H 00
1002 H 11
1003 H MOV BX, [1102 H] 8B (BX)[ 1102 H]
1004 H 1E
1005 H 02
1006 H 11
1007 H MOV DX, 0000H BA (DX)0000H
1008 H 00
1009 H 00
100A H MUL BX F7 (DX:AX)(AX) * (BX)
100B H E3
100C H MOV [1200 H], AX A3 [1200 H] (AX)
100D H 00
100E H 12
100F H MOV [1202 H],DX 89 [1202 H] (DX)
1010 H 16
1011 H 02
1012 H 12
1013 H HLT F4 Stop the execution
16-Bit Division
Memory Address Label Mnemonics Opcodes Comments
1000 H MOV AX, [1100 H ] A1 (AX)[ 1100 H]
1001 H 00
1002 H 11
1003 H MOV BX, [1102 H] 8B (BX)[ 1102 H]
1004 H 1E
1005 H 02
1006 H 11
1007 H MOV DX, 0000H BA (DX)0000H
1008 H 00
1009 H 00
100A H DIV BX F7 (DX:AX)(AX) / (BX)
100B H F3
100C H MOV [1200 H], AX A3 [1200 H] (AX)
100D H 00
100E H 12
100F H MOV [1202 H],DX 89 [1202 H] (DX)
1010 H 16
1011 H 02
1012 H 12
1013 H HLT F4 Stop the execution
9
MPMC Lab CS6412
16-Bit Addition
Input Output
Address Data Address Data
1100H 1200H
1101H 1201H
1102H 1202H
1103H
1100H 1200H
1101H 1201H
1102H 1202H
1103H
16-Bit Subtraction
Input Output
Address Data Address Data
1100H 1200H
1101H 1201H
1102H 1202H
1103H
1100H 1200H
1101H 1201H
1102H 1202H
1103H
16-Bit Multiplication
Input Output
Address Data Address Data
1100H 1200H
1101H 1201H
1102H 1202H
1103H 1203H
1100H 1200H
1101H 1201H
1102H 1202H
1103H 1203H
16-Bit Division
Input Output
Address Data Address Data
1100H 1200H
1101H 1201H
1102H 1202H
1103H 1203H
1100H 1200H
1101H 1201H
1102H 1202H
1103H 1203H
10
CS6412 MPMC Lab
Procedure
Program Entry:
Reset M Enter Program Starting Address ENTER KEY Enter
Opcode SPACE BAR Enter Opcode SPACE BAR ...
SPACE BAR
Input Data Entry:
Reset M Enter Input Data Address ENTER KEY Enter
Input Data SPACE BAR Input Data SPACE BAR ...
SPACE BAR
Program Execution:
Reset G Enter Program Starting Address ENTER KEY
To Verify Output Data:
Reset M Enter Output Data Address ENTER KEY
SPACE BAR ... SPACE BAR
Result:
The above programs were successfully executed and results were verified.
Programs
11
MPMC Lab CS6412
8-Bit OR Operation
12
CS6412 MPMC Lab
Aim: To write an assembly language program to perform an AND, OR, XOR and NOT
operations using 8086 microprocessor kit.
Algorithm
8-Bit AND operation
Step 1: Get two 8-bit data from the input memory locations to AL and BL registers.
Step 2: The contents of BL is AND with AL register and store the result in AL.
Step 3: Store the contents of AL to output memory location.
Step 4: Stop the execution.
8-Bit OR operation
Step 1: Get two 8-bit data from the input memory locations to AL and BL registers.
Step 2: The contents of BL is OR with AL register and store the result in AL.
Step 3: Store the contents of AL to output memory location.
Step 4: Stop the execution.
Step 1: Get two 8-bit data from the input memory locations to AL and BL registers.
Step 2: The contents of BL is XOR with AL register and store the result in AL.
Step 3: Store the contents of AL to output memory location.
Step 4: Stop the execution.
Step 1: Get an8-bit data from the input memory location to AL register.
Step 2: The content of AL is complimented with NOT operation and result is stored in
AL register.
Step 3: Store the contents of AL to output memory location.
Step 4: Stop the execution.
13
MPMC Lab CS6412
8-Bit OR operation
14
CS6412 MPMC Lab
15
MPMC Lab CS6412
1100H 1200H
1101H
8-Bit OR operation
Input Output
Address Data Address Data
1100H 1200H
1101H
1100H 1200H
1101H
1100H 1200H
1101H
1100H 1200H
16
CS6412 MPMC Lab
Procedure
Program Entry:
Reset M Enter Program Starting Address ENTER KEY Enter
Opcode SPACE BAR Enter Opcode SPACE BAR ...
SPACE BAR
Input Data Entry:
Reset M Enter Input Data Address ENTER KEY Enter
Input Data SPACE BAR Input Data SPACE BAR ...
SPACE BAR
Program Execution:
Reset G Enter Program Starting Address ENTER KEY
To Verify Output Data:
Reset M Enter Output Data Address ENTER KEY
SPACE BAR ... SPACE BAR
Result:
The above programs were successfully executed and results were verified.
17
MPMC Lab CS6412
Programs
16-Bit OR Operation
18
CS6412 MPMC Lab
Aim: To write an assembly language program to perform an AND, OR, XOR and NOT
operations using 8086 microprocessor kit.
Algorithm
16-Bit AND operation
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: The contents of BX is AND with AX register and store the result in AX.
Step 3: Store the contents of AX to output memory location.
Step 4: Stop the execution.
16-Bit OR operation
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: The contents of BX is OR with AX register and store the result in AX.
Step 3: Store the contents of AX to output memory location.
Step 4: Stop the execution.
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: The contents of BX is XOR with AX register and store the result in AX.
Step 3: Store the contents of AX to output memory location.
Step 4: Stop the execution.
Step 1: Get an8-bit data from the input memory location to AX register.
Step 2: The content of AX is complimented with NOT operation and result is stored in
AX register.
Step 3: Store the contents of AX to output memory location.
Step 4: Stop the execution.
19
MPMC Lab CS6412
16-Bit OR operation
20
CS6412 MPMC Lab
21
MPMC Lab CS6412
16-Bit OR operation
Input Output
Address Data Address Data
1100H 1200H
1101H 1201H
1102H
1103H
1100H 1200H
1101H 1201H
1102H
1103H
22
CS6412 MPMC Lab
1103H
Procedure
Program Entry:
Reset M Enter Program Starting Address ENTER KEY Enter
Opcode SPACE BAR Enter Opcode SPACE BAR ...
SPACE BAR
Input Data Entry:
Reset M Enter Input Data Address ENTER KEY Enter
Input Data SPACE BAR Input Data SPACE BAR ...
SPACE BAR
Program Execution:
Reset G Enter Program Starting Address ENTER KEY
To Verify Output Data:
Reset M Enter Output Data Address ENTER KEY
SPACE BAR ... SPACE BAR
Result:
The above programs were successfully executed and results were verified.
23
MPMC Lab CS6412
Programs
24
CS6412 MPMC Lab
Aim: To write an assembly language program to find a smallest and largest number out of
five 8-bit numbers using 8086 microprocessor kit.
Algorithm
25
MPMC Lab CS6412
26
CS6412 MPMC Lab
27
MPMC Lab CS6412
28
CS6412 MPMC Lab
Procedure
Program Entry:
Reset M Enter Program Starting Address ENTER KEY Enter
Opcode SPACE BAR Enter Opcode SPACE BAR ...
SPACE BAR
Input Data Entry:
Reset M Enter Input Data Address ENTER KEY Enter
Input Data SPACE BAR Input Data SPACE BAR ...
SPACE BAR
Program Execution:
Reset G Enter Program Starting Address ENTER KEY
To Verify Output Data:
Reset M Enter Output Data Address ENTER KEY
SPACE BAR ... SPACE BAR
Result:
The above programs were successfully executed and results were verified.
29
MPMC Lab CS6412
Programs
30
CS6412 MPMC Lab
Aim: To write an assembly language program to find a smallest and largest number out of
five 16-bit numbers using 8086 microprocessor kit.
Algorithm
31
MPMC Lab CS6412
32
CS6412 MPMC Lab
33
MPMC Lab CS6412
34
CS6412 MPMC Lab
Procedure
Program Entry:
Reset M Enter Program Starting Address ENTER KEY Enter
Opcode SPACE BAR Enter Opcode SPACE BAR ...
SPACE BAR
Input Data Entry:
Reset M Enter Input Data Address ENTER KEY Enter
Input Data SPACE BAR Input Data SPACE BAR ...
SPACE BAR
Program Execution:
Reset G Enter Program Starting Address ENTER KEY
To Verify Output Data:
Reset M Enter Output Data Address ENTER KEY
SPACE BAR ... SPACE BAR
Result:
The above programs were successfully executed and results were verified.
35
MPMC Lab CS6412
Programs
36
CS6412 MPMC Lab
Aim: To write an assembly language program to sort an array in ascending and descending
order using 8086 microprocessor kit (Array size is 05H ).
Algorithm
1
MPMC Lab CS6412
2
CS6412 MPMC Lab
3
MPMC Lab CS6412
4
CS6412 MPMC Lab
Procedure
Program Entry:
Reset M Enter Program Starting Address ENTER KEY Enter
Opcode SPACE BAR Enter Opcode SPACE BAR ...
SPACE BAR
Input Data Entry:
Reset M Enter Input Data Address ENTER KEY Enter
Input Data SPACE BAR Input Data SPACE BAR ...
SPACE BAR
Program Execution:
Reset G Enter Program Starting Address ENTER KEY
To Verify Output Data:
Reset M Enter Output Data Address ENTER KEY
SPACE BAR ... SPACE BAR
Result:
The above programs were successfully executed and results were verified.
5
MPMC Lab CS6412
Programs
6
CS6412 MPMC Lab
Aim: To write an assembly language program to sortan array in ascending and descending
order using 8086 microprocessor kit (Array size is 05H ).
Algorithm
17
MPMC Lab CS6412
18
CS6412 MPMC Lab
19
MPMC Lab CS6412
20
CS6412 MPMC Lab
Procedure
Program Entry:
Reset M Enter Program Starting Address ENTER KEY Enter
Opcode SPACE BAR Enter Opcode SPACE BAR ...
SPACE BAR
Input Data Entry:
Reset M Enter Input Data Address ENTER KEY Enter
Input Data SPACE BAR Input Data SPACE BAR ...
SPACE BAR
Program Execution:
Reset G Enter Program Starting Address ENTER KEY
To Verify Output Data:
Reset M Enter Output Data Address ENTER KEY
SPACE BAR ... SPACE BAR
Result:
The above programs were successfully executed and results were verified.
21
MPMC Lab CS6412
Programs
22
MPMC Lab CS6412
Algorithm
8-Bit String Move
Step 1: Initialize SI and DI registers 1100H and 1200H respectively.
Step 2: Initialize CX register 0005H.
Step 3: Copy a string from source memory to destination memory and repeat the same
until CX becomes zero.
Step 4: Stop the execution.
8-Bit String Reverse
Step 1: Initialize SI and DI registers 1100H and 1208H respectively.
Step 2: Initialize CX register 0005H.
Step 3: Load a string to AL from source memory and set DF = 1.
Step 4: Store the string from AL to destination memory and Clear DF = 0.
Step 5: Decrement CX register by 1 and If CX 0 then go to step - 3.
Step 6: Stop the execution.
18
MPMC Lab CS6412
18
CS6412 MPMC Lab
Input Output
Address Data Address Data
1100H 1100H
1101H 1101H
1102H 1102H
1103H 1103H
1104H 1104H
1100H 1100H
1101H 1101H
1102H 1102H
1103H 1103H
1104H 1104H
19
MPMC Lab CS6412
Input Output
Address Data Address Data
1100H 1100H
1101H 1101H
1102H 1102H
1103H 1103H
1104H 1104H
1100H 1100H
1101H 1101H
1102H 1102H
1103H 1103H
1104H 1104H
Input Output
Address Data Address Data
1100H 1100H
1101H 1101H
1102H 1102H
1103H 1103H
1104H 1104H
1105H 1105H
1106H 1106H
1107H 1107H
1108H 1108H
1109H 1109H
1100H 1100H
1101H 1101H
1102H 1102H
1103H 1103H
1104H 1104H
1105H 1105H
1106H 1106H
1107H 1107H
1108H 1108H
1109H 1109H
20
CS6412 MPMC Lab
Input Output
Address Data Address Data
1100H 1100H
1101H 1101H
1102H 1102H
1103H 1103H
1104H 1104H
1105H 1105H
1106H 1106H
1107H 1107H
1108H 1108H
1109H 1109H
1100H 1100H
1101H 1101H
1102H 1102H
1103H 1103H
1104H 1104H
1105H 1105H
1106H 1106H
1107H 1107H
1108H 1108H
1109H 1109H
21
MPMC Lab CS6412
Producer
Program Entry:
Reset M Enter Program Starting Address ENTER KEY Enter
Opcode SPACE BAR Enter Opcode SPACE BAR ...
SPACE BAR
Input Data Entry:
Reset M Enter Input Data Address ENTER KEY Enter
Input Data SPACE BAR Input Data SPACE BAR ...
SPACE BAR
Program Execution:
Reset G Enter Program Starting Address ENTER KEY
To Verify Output Data:
Reset M Enter Output Data Address ENTER KEY
SPACE BAR ... SPACE BAR
Result:
The above programs were successfully executed and results were verified.
22
CS6412 MPMC Lab
Programs
23
MPMC Lab CS6412
Aim: To write an assembly language program to block move operation with 8-bit & 16-bit
numbers using 8086 microprocessor kit.
Algorithm
24
CS6412 MPMC Lab
25
MPMC Lab CS6412
Procedure
Program Entry:
Reset M Enter Program Starting Address ENTER KEY Enter Opcode
SPACE BAR Enter Opcode SPACE BAR ... SPACE BAR
Input Data Entry:
Reset M Enter Input Data Address ENTER KEY Enter Input Data
SPACE BAR Input Data SPACE BAR ... SPACE BAR
Program Execution:
Reset G Enter Program Starting Address ENTER KEY
26
CS6412 MPMC Lab
Result:
The above programs were successfully executed and results were verified.
Programs
8-bit Addition
MOV DPTR, #8300H
MOVX A, @DPTR
MOV R0, A
INC DPTR
MOVX A, @DPTR
MOV R1, #00H
ADD A, R0
JNC loop-1
INCR1
loop-1: MOV DPTR, #8400H
MOVX @DPTR, A
INC DPTR
MOV A, R1
MOVX @DPTR, A
loop-2: SJMP loop-2
8-bit Subtraction
MOV DPTR, #8300H
MOVX A, @DPTR
MOV R0, A
INC DPTR
MOVX A, @DPTR
MOV R1, #00H
CLR C
SUBBA, R0
JNC loop-1
INCR1
loop-1: MOV DPTR, #8400H
MOVX @DPTR, A
INC DPTR
MOV A, R1
MOVX @DPTR, A
27
MPMC Lab CS6412
Aim: To write an assembly language program for perform an adding and subtracting of two 8-
bit numbers using 8051 microcontroller kit.
Algorithm
8-Bit Addition
Step 1: Get two 8-bit numbers from the input memory locations to R0 and A registers.
Step 2: Clear R1 register to store the carry condition.
Step 3: Add the contents of R0 to A register and store the result in A.
Step 4: Check carry flog, If CF = 0 then go to step 6.
Step 5: Increment R1 register by 1.
Step 6: Store the contents of Sum and Carry to output memory locations.
Step 7: Stop the execution.
8-Bit Subtraction
Step 1: Get two 8-bit numbers from the input memory locations to R0 and A registers.
Step 2: Clear R1 register to store the carry condition. Clear carry flag.
Step 3: Subtract the contents of R0 from A register and store the result in A.
Step 4: Check carry flog, If CF = 0 then go to step 6.
Step 5: Increment R1 register by 1.
Step 6: Store the contents of Difference and Borrow to output memory locations.
Step 7: Stop the execution.
28
CS6412 MPMC Lab
8-Bit Subtraction
Memory Label Mnemonics Opcodes Comments
Address
8200 H MOV DPTR, #8300 H 90 (DPTR) (8300 H)
8201 H 83
8202 H 00
8203 H MOVX A, @DPTR E0 (A) ( (DPTR))
8204 H MOV R0, A F8 (R0) (A)
8205 H INC DPTR A3 (DPTR) (DPTR) + 1
8206 H MOVX A, @DPTR E0 (A) ( (DPTR))
8207 H MOV R1, #00 H 79 (R1) 00H
8208 H 00
8209 H CLRC C C3 (CF)00H
820A H SUBBA, R0 98 (A) (A) - (R0)
820B H JNC loop-1 50 If CF=0, then go to loop-1
820C H 01
820D H INCR1 09 (R1) (R1) + 1
820E H loop-1 MOV DPTR, #8400 H 90 (DPTR) (8400 H)
820F H 84
8210 H 00
8211 H MOVX @DPTR, A F0 ((DPTR))(A)
8212 H MOV A, R1 E9 (8401H)(A)
8213 H INC DPTR A3 (DPTR) (DPTR) + 1
8214 H MOVX @DPTR, A F0 ((DPTR))(A)
8215 H loop-2 SJMP loop-2 80 Stop the execution
8216H FE
29
MPMC Lab CS6412
Producer
Program Entry:
Reset Enter Program Starting Address ADS Enter Opcode
INC ... INC
Input Data Entry:
Reset Enter Input Data Address ADS Enter Input Data INC
... INC
Program Execution:
Reset Enter Program Starting Address ADS EXEC
To Verify Output Data:
Reset Enter Output Data Address ADS INC ... INC
8-Bit Addition
Input Output
Address Data Address Data
8300H 8400H
8301H 8401H
8300H 8400H
8301H 8401H
8-Bit Subtraction
Input Output
Address Data Address Data
8300H 8400H
8301H 8401H
8300H 8400H
8301H 8401H
Result:
The above programs were successfully executed and results were verified.
30
CS6412 MPMC Lab
Programs
8 bit Multiplication
8 bit Division
31
MPMC Lab CS6412
Aim: To write an assembly language program perform multiplication and division of two 8-bit
numbers using 8051 microcontroller kit.
Algorithm
8-Bit Multiplication
Step 1: Get two 8-bit numbers from the input memory locations to B and A
registers.
Step 2: Multiply the contents of B with A register and store the product in A&B.
Step 3: Store the contents of product to output memory locations.
Step 4: Stop the execution.
8-Bit Division
Step 1: Get two 8-bit numbers from the input memory locations to B and A
registers.
Step 2: Divide the contents of B with A register and store the results in A&B.
Step 3: Store the contents of quotient & remainder to output memory locations.
Step 4: Stop the execution.
32
CS6412 MPMC Lab
8-Bit Multiplication
Memory Address Label Mnemonics Opcodes Comments
8200 H MOV DPTR, #8300 H 90 (DPTR) (8300 H)
8201 H 83
8202 H 00
8203 H MOVX A, @DPTR E0 (A) ( (DPTR))
8204 H MOV B, A F5 (B) (A)
8205 H F0
8206 H INC DPTR A3 (DPTR) (DPTR) + 1
8207 H MOVX A, @DPTR E0 (A) ( (DPTR))
8208 H MUL AB A4 (BA) (A) * (B)
8209 H MOV DPTR, #8400 H 90 (DPTR) (8400 H)
820A H 84
820B H 00
820C H MOVX @DPTR, A F0 ((DPTR))(A)
820D H MOV A, B E5 (A) (B)
820E H F0
820F H INC DPTR A3 (DPTR) (DPTR) + 1
8210 H MOVX @DPTR, A F0 ((DPTR))(A)
8211 H loop-1 SJMP loop-1 80 Stop the execution
8212 H FE
8-Bit Division
Memory Address Label Mnemonics Opcodes Comments
8200 H MOV DPTR, #8300 H 90 (DPTR) (8300 H)
8201 H 83
8202 H 00
8203 H MOVX A, @DPTR E0 (A) ( (DPTR))
8204 H MOV B, A F5 (B) (A)
8205 H F0
8206 H INC DPTR A3 (DPTR) (DPTR) + 1
8207 H MOVX A, @DPTR E0 (A) ( (DPTR))
8208 H DIV AB 84 (AB) (A) / (B)
8209 H MOV DPTR, #8400 H 90 (DPTR) (8400 H)
820A H 84
820B H 00
820C H MOVX @DPTR, A F0 ((DPTR))(A)
820D H MOV A, B E5 (A) (B)
820E H F0
820F H INC DPTR A3 (DPTR) (DPTR) + 1
8210 H MOVX @DPTR, A F0 ((DPTR))(A)
8211 H loop-1 SJMP loop-1 80 Stop the execution
8212 H FE
33
MPMC Lab CS6412
Producer
Program Entry:
Reset Enter Program Starting Address ADS Enter Opcode
INC ... INC
Input Data Entry:
Reset Enter Input Data Address ADS Enter Input Data INC
... INC
Program Execution:
Reset Enter Program Starting Address ADS EXEC
To Verify Output Data :
Reset Enter Output Data Address ADS INC . . INC.
8-Bit Multiplication
Input Output
Address Data Address Data
8300H 8400H
8301H 8401H
8300H 8400H
8301H 8401H
8-Bit Division
Input Output
Address Data Address Data
8300H 8400H
8301H 8401H
8300H 8400H
8301H 8401H
Result:
The above programs were successfully executed and results were verified.
34
CS6412 MPMC Lab
Programs
8 bit OR Operation
35
MPMC Lab CS6412
Aim: To write an assembly language program perform AND&OR operation of two 8-bit
numbers using 8051 microcontroller kit.
Algorithm
Step 1: Get two 8-bit numbers from the input memory locations to R0 and A
registers.
Step 2: Perform the AND operation between the contents of R0 with A registers and
stores the result in A register.
Step 3: Store the contents of result to output memory locations.
Step 4: Stop the execution.
8-Bit OR Operation
Step 1: Get two 8-bit numbers from the input memory locations to R0 and A
registers.
Step 2: Perform the OR operation between the contents of R0 with A registers and
stores the result in A register.
Step 3: Store the contents of result to output memory locations.
Step 4: Stop the execution.
36
CS6412 MPMC Lab
8-Bit OR Operation
Producer
37
MPMC Lab CS6412
Program Entry:
Reset Enter Program Starting Address ADS Enter Opcode
INC ... INC
Input Data Entry:
Reset Enter Input Data Address ADS Enter Input Data INC
... INC
Program Execution:
Reset Enter Program Starting Address ADS EXEC
To Verify Output Data :
Reset Enter Output Data Address ADS INC . . INC.
8-Bit OR Operation
Input Output
Address Data Address Data
8300H
8400H
8301H
8300H
8400H
8301H
Result:
The above programs were successfully executed and results were verified.
Programs
38
CS6412 MPMC Lab
39
MPMC Lab CS6412
Aim: To write an assembly language program perform EX-OR & NOT operations of two 8-
bit numbers using 8051 microcontroller kit.
Algorithm
Step 1: Get two 8-bit numbers from the input memory locations to R0 and A
registers.
Step 2: Perform the EX-OR operation between the contents of R0 with A registers and
stores the result in A register.
Step 3: Store the contents of result to output memory locations.
Step 4: Stop the execution.
Step 1: Get an 8-bit number from the input memory location to Aregister.
Step 2: Perform the NOT operation of on A register and store the result in A register.
Step 3: Store the contents of result to output memory location.
Step 4: Stop the execution.
40
CS6412 MPMC Lab
41
MPMC Lab CS6412
Producer
Program Entry:
Reset Enter Program Starting Address ADS Enter Opcode
INC ... INC
Input Data Entry:
Reset Enter Input Data Address ADS Enter Input Data INC
... INC
Program Execution:
Reset Enter Program Starting Address ADS EXEC
To Verify Output Data :
Reset Enter Output Data Address ADS INC . . INC.
8300H 8400H
Result:
The above programs were successfully executed and results were verified.
42
CS6412 MPMC Lab
Programs
43
MPMC Lab CS6412
Aim: To write an assembly language program perform bit manipulation of an 8-bit number
using 8051 microcontroller kit.
Algorithm
Step 1: Get an 8-bit number from the input memory locationto A register.
Step 2: Set a bit A3 and Clear bit A7 in A register and store the result in A.
Step 3: Store the contents of product to output memory location.
Step 4: Stop the execution.
Step 1: Get an 8-bit number from the input memory location to A register.
Step 2: Check whether the bit A0 is binary 1. If A0 = 1, then go to step- 4.
Step 3: Store the status of A register has even number in output memory location.Stop
the execution.
Step 4: Store the status of A register has odd number in output memory location.Stop
the execution.
44
CS6412 MPMC Lab
45
MPMC Lab CS6412
Producer
Program Entry:
Reset Enter Program Starting Address ADS Enter Opcode
INC ... INC
Input Data Entry:
Reset Enter Input Data Address ADS Enter Input Data INC
... INC
Program Execution:
Reset Enter Program Starting Address ADS EXEC
To Verify Output Data :
Reset Enter Output Data Address ADS INC . . INC.
8300H 8400H
8300H 8400H
Result:
The above programs were successfully executed and results were verified.
46
CS6412 MPMC Lab
Programs
Saw Tooth Wave Form
MOV A, #80H 7 6 5 4 3 2 1 0
MOV DPTR, #A003H I/O MS1 MS0 PA PCU MS PB PCL
MOVX @DPTR, A 1 0 0 0 0 0 0 0
MVI A, 00H CW = 80H
MOV DPTR, #A001H
Loop-1: MOVX @DPTR, A
INR A
SJMP Loop-1
MOV A, #80H 7 6 5 4 3 2 1 0
MOV DPTR, #A003H I/O MS1 MS0 PA PCU MS PB PCL
MOVX @DPTR, A 1 0 0 0 0 0 0 0
MVI A, 00H CW = 80H
MOV DPTR, #A001H
Loop-1: MOVX @DPTR, A Delay: MOV R0, #FFH
LCALL Delay loop-1: NOP
CPL A DJNZ loop-1
SJMP Loop-1 RET
47
MPMC Lab CS6412
48
CS6412 MPMC Lab
49
MPMC Lab CS6412
50
CS6412 MPMC Lab
0 T(msec)
51
MPMC Lab CS6412
Producer
Program Entry:
Reset Enter Program Starting Address ADS Enter Opcode
INC ... INC
Program Execution:
Reset Enter Program Starting Address ADS EXEC
Result:
The above programs were successfully executed and results were
verified.
52
CS6412 MPMC Lab
Programs
Stepper Motor
MOV A, #80H 7 6 5 4 3 2 1 0
MOV DPTR, #A003H I/O MS1 MS0 PA PCU MS PB PCL
MOVX @DPTR, A 1 0 0 0 0 0 0 0
MOV DPTR, #A000H CW = 80H
MOV A, #33H
Loop-1: MOVX @DPTR, A
LCALL Delay
RR A
SJMP Loop-1
53
MPMC Lab CS6412
Algorithm
Stepper motor interface
Step 1: Initialize A register to 80H.
Step-2: Send the content of A register to Control ward register.
Step-3: Initialize A register to 33H.
Step-4: Send the content of A register to Port - A.
Step-5: Call Delay subroutine program.
Step-6: Rotate the contents of A register to right side by 1 bit position.
Step-7: Jump to step-4.
Subroutine Program
Step 1: Initialize R0 register to 20H.
Step 2: Initialize R1 register to FFH.
Step 3: No operation.
Step 4: Decrement R1 register by 1 and go to step-3, if R10.
Step 5: Decrement R0 register by 1 and go to step-3, if R00.
Step 6: Return to Main program.
54
CS6412 MPMC Lab
55
MPMC Lab CS6412
Producer
Program Entry:
Reset Enter Program Starting Address ADS Enter Opcode
INC ... INC
Program Execution:
Reset Enter Program Starting Address ADS EXEC
Output
Instruction Direction of Rotation
RR A Clockwise Rotation
RL A Anti-clockwise Rotation
Result:
The above programs were successfully executed and results were verified.
56
CS6412 MPMC Lab
Programs
DC Motor
MOV A, #80H 7 6 5 4 3 2 1 0
MOV DPTR, #A003H I/O MS1 MS0 PA PCU MS PB PCL
MOVX @DPTR, A 1 0 0 0 0 0 0 0
Loop-2: JB P1.2, Loop-1
MOV DPTR, #A001H CW = 80H
MOV A, #04H
MOVX @DPTR, A
SJMP Loop-2
loop-1: MOV A, #00H
MOVX @DPTR, A
SJMP Loop-2
57
MPMC Lab CS6412
Algorithm
DC motor interface
Step 1: Initialize A register to 80H.
Step-2: Send the content of A register to Control ward register.
Step 3: If P1.2 bit = 1, then go to step-7.
Step-4: Initialize A register to 04H.
Step-5: Send the content of A register to Port - B.
Step-6: Jump to step-3.
Step 7: Initialize A register to 00H.
Step 8: Send the content of A register to Port - B.
Step 9: Jump to step-3.
58
CS6412 MPMC Lab
59
MPMC Lab CS6412
Producer
Program Entry:
Reset Enter Program Starting Address ADS Enter Opcode
INC ... INC
Program Execution:
Reset Enter Program Starting Address ADS EXEC
Output
Switch (SW29) is in ON : DC Motor starts to rotate.
Switch (SW29) is in OFF : DC Motor stops to rotate.
Result:
The above programs were successfully executed and results were verified.
60