0% found this document useful (0 votes)
22 views

CSE IV MP Lab Manual

The document describes assembly language programs to perform various arithmetic and logical operations on 8086 microprocessors. It includes programs for addition, subtraction, multiplication, division, and sorting an array in ascending order. The programs provide algorithms, flowcharts, and assembly code to add, subtract, multiply, and divide two 16-bit numbers and sort an array using comparisons and data swaps.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

CSE IV MP Lab Manual

The document describes assembly language programs to perform various arithmetic and logical operations on 8086 microprocessors. It includes programs for addition, subtraction, multiplication, division, and sorting an array in ascending order. The programs provide algorithms, flowcharts, and assembly code to add, subtract, multiply, and divide two 16-bit numbers and sort an array using comparisons and data swaps.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 122

EX.NO.1.

PROGRAMS FOR BASIC ARITHMETIC AND LOGICAL OPERATIONS


(USING 8086)
AIM
:
To write an assembly language program to perform arithmetic operations using
8086 Microprocessor.

ALGORITHM:-
a) Addition:-
(i) Start the process
(ii) Initialize the count value
(iii) Get the two datas.
(iv) Add the two data values
(v) If carry exists increment the count value.
(vi) Store the result.
(vii) Stop the process.

PROGRAM

Label Address Mnemonics Hex code Comments


Opcode Operand
1000 MOV CL , 00 C6, C1, 00 ; Initialize the count
1003 MOV AX, 0F0C C7, C0, 0C, 0F ; Move1st data to accumulator
1007 MOV BX, 111F C7, C3, 1F, 11 ; Move2nd data to register
100B ADD BX, AX 01, C3 ; Add the two data
100D JNC LOOP1 73, 02 ; Jump on no carry
100F INC CL FE, C1 ; Increment the counter
LOOP1: 1011 MOV [1100], BX 89,1E, 00, 11 ; Store the result
1015 MOV [1102], CL 88, 0E, 02,11 ; Store the carry
1019 HLT F4 ; Stop the process

OUTPUT

16 – BIT ADDITION

Address Output
1100 2B
1101 20

1
1102 00

2
16 BIT ADDITION

Start

Initialize count as zero for carry

Get the two data

Add the datas

If No
Carry

Yes

Increment the count

Store the result & carry

Stop
1 B) 16 BIT SUBTRACTION

ALGORITHM:-

(i) Start the process


(ii) Initialize the count value
(iii) Get the two data and subtract it.
(iv) If carry exists, get the 2’s complement of the value.
(v) Store the result and carry value.
(vi) Stop the process.

PROGRAM

Label Address Mnemonics Hex code Comments


Opcode Operand
1000 MOV CL, 00 C6, C1, 00 ; Initialize the count
1003 MOV AX, [1100] 8B, 06, 00, 11 ; Move1st data to accumulator
1007 MOV BX, [1102] 8B, 1E, 02, 11 ; Move 2nd data to ‘B’ register
100B SUB BX, AX 29, C3 ; Subtract the two datas
100D JNC LOOP1 73, 05 ; Jump on no carry
100F INC CL FE, C1 ; Increment the counter
1011 NOT BX F7, D3 ; Get the complement value
1013 INC BX 43 ; Increment the value
LOOP1: 1014 MOV [1104], BX 89, 1E, 04, 11 ; Store the result
1018 MOV [1106], CL 88, 0E, 06, 11 ; Store the carry
101C HLT F4 ; Stop the process
OUTPUT

16 – BIT SUBTRACTION

Address Input Address Output


1100 76 1104 31
1101 86 1105 65
1102 45 1106 00
1103 81
FLOWCHART:-

Subtraction:-

Start

Initialize count as zero for borrow

Get the two datas

Subtract the datas

If No
Carry
exists

Yes

Take 2’s complement

Store the result & carry

Stop
1.C) 16 BIT MULTIPLICATION
ALGORITHM:-
(i) Start the process
(ii) Get the two values
(iii) Multiply the two values.
(iv) Store the result and overflow
(v) Stop the process.

PROGRAM

Label Address Mnemonics Hex code Comments


Opcode Operand
1000 MOV SI, 1100 C7, C6,00, 11 ; Move the source index
1004 MOV AX, [SI] 8B, 04 value
1006 MOV BX, [SI + 02] 8B, 54, 02 ; Move the first data
1009 MUL BX F7, E3 ; Get the second data
100B MOV [SI + 04], 89, 44, 04 ; Multiply the data
100E MOV AX 89, 54, 0b ; Store the result
1011 HLT [SI + 06], F4 ; Store the over flow
DX ; Stop the process

INPUT OUTPUT

Address Input Address Output


1100 11 1104 00
1101 11 1105 21
1102 00 1106 22
1103 11 1107 01
FLOW CHART:-

Multiplication:-

Start

Get the two values

Multiply the values

Store the result & overflow

Stop
D) 16 BIT DIVISION

AIM:

To perform division of a 32 bit number by a 16 bit number and store the quotient and remainder
in memory

ALGORITHM:-
(i) Start the process
(ii) Get the two values
(iii) Initialize ‘DX’ register as zero
(iv) Divide the values
(v) Store the quotient and remainder
(vi) Stop the process.
FLOWCHART:
1D) 16 BIT DIVISION

PROGRAM

Label Address Mnemonics Hex code Comments


Opcode Operand
1000 MOV SI, 1100 C7, C6,00, 11 ; Get the source index value
1004 MOV Ax, [SI] 8B, 04 ; Get the first data
1006 MOV DX, [SI + 8B, 54, 02 ; Initialize ‘DX’ register
1009 MOV 02] 8B, 5C, 04 value
100C DIV BX, [SI + 04] F7, E3 ; Get the dividend value
100E MOV BX 89, 44, 06 ; Divide the value
1011 MOV [SI + 06], 89, 54, 08 ; Move the quotient
1014 HLT AX F4 ; Move the remainder & store
[SI + 08], ; Stop the process
DX

16 – BIT DIVISIION

Address Input Address Output


1100 42 (DIVIDEND) 1106 21(QUOTIENT)
1101 24 1107 12
1102 00 1108 00(REMAINDER)
1103 00 1109 00
1104 02(DIVISOR)
1105 00

RESULT:-

Thus the assembly language program for 16 Bit Arithmetic and Logical operations has been done
and verified.
2. PROGRAM FOR SEARCHING AND SORTING OF AN ARRAY USING 8086

2a. SORTING AN ARRAY IN ASCENDING ORDER


AIM:-
Write an assembly language program to sort an array of data in ascending order.
ALGORITHM:-
1. Set SI register as pointer for array.
2. Set CL register as count for N – 1 repetitions.
3. Initialize array pointer.
4. Set CH as count for N – 1 comparisons.
5. Increment the array pointer.
6. Get an element of array AL register.
7. Increment the array pointer.
8. Compare the next element of the array with AL.
9. Checks carry flag. If carry flag is set then go to step -12, otherwise go to next step.
10. Exchange the content of memory pointed by SI and the content of previous memory location
11. Decrement the count for comparisons (CH register).
12. Check zero flag. If zero flag is reset then go to step-6, otherwise go to next step.
13. Decrement the count for repetitions (CL register).
14. Check zero flag. If zero flag is reset then go to step-3, otherwise go to next step.
15. Stop.
SORTING IN ASCENDING ORDER

Start

Load the address of the array in SI Exchange AL and memory


register pointed by SI

Load the count in CL register and Exchange AL and memory


decrement by one pointed by SI – 1

2
Load the address of array in SI Decrement CH count
register

Load the count in CH register and


No Is
decrement by one 1
ZF = 1?

Increment the array pointer (SI) Yes


Decrement CL count

1
Get an element of array in AL
register

No Is
2
ZF = 1?
Increment the array pointer (SI)

Yes
Compare next element of array Stop
with AL

Is No
CF = 1?
Yes
PROGRAM

Label Address Mnemonics Hex code Comments


Opcode Operand
START: 1000 MOV SI, 1100H C7 C6 00 11 ; Set SI register as pointer for array
1004 MOV CL, [SI} 8A 0C ; Set CL as count for N – 1 repetitions
1006 DEC CL FE C9
REPEAT 1008 MOV SI, 1100H C7 C6 00 11 ; Initialize pointer
100C MOV CH, [SI] 8A 2C : Set CH as count for N – 1 comparisons
100E DEC CH FE CD
1010 INC SI 46 ; Decrement the count
REPCOM 1011 MOV AL, [SI] 8A 04 ; Get an element of array in AL register
1013 INC SI 46
1014 CMP AL, [SI] 3A 04 ; Compare with next element of array
; in memory
1016 JC AHEAD 72 05 ; It AL register is lesser than memory,
‘then go to AHEAD
1018 XCHG AL, [SI] 86 04 ; If AL is less than memory then
; exchange
101A XCHG AL, [SI –1] 86 44 FF ; the content of memory pointed by
; SI and the previous memory location
AHEAD 101D DEC CH FE CD ; Decrement the count for comparisons
101F JNZ REPCOM 75 F0 ; Repeat comparisons until CH count is
; zero
1021 DEC CL FE C9 ; Decrement the count for repetitions
1023 JNZ REPEAT 75 E3 ; Repeat N – 1 comparisons until CL
count is zero
1025 HLT F4

Address Input Address Output


1100 05 – count 1100 05 – count
1101 09 1101 09
1102 49 1102 24
1103 24 1103 32
1104 32 1104 49
1105 64 1105 64

RESULT:

Thus the assembly language program to sort an array of data in ascending order using 8086
has been done and verify successfully.
2b. SORTING AN ARRAY IN DESCENDING ORDER

AIM:-
Write an assembly language program to sort an array of data in descending order.

ALGORITHM:-
1. Set SI register as pointer for array.
2. Set CL register as count for N – 1 repetitions.
3. Initialize array pointer.
4. Set CH as count for N – 1 comparisons.
5. Increment the array pointer.
6. Get an element of array AL register.
7. Increment the array pointer.
8. Compare the next element of the array with AL.
9. Checks carry flag. If carry flag is set then go to step -12, otherwise go to next step.
10. Exchange the content of memory pointed by SI and the content of previous memory location
(For this, exchange AL and memory pointed by SI, and then exchange AL and memory
pointed SI – I).
11. Decrement the count for comparisons (CH register).
12. Check zero flag. If zero flag is reset then go to step-6, otherwise go to next step.
13. Decrement the count for repetitions’ (CL register).
14. Check zero flag. If zero flag is reset then go to step-3, otherwise go to next step.
15. Stop.
SORTING IN DESCENDING ORDER

Start

Load the address of the array in SI Exchange AL and memory


register pointed by SI

Load the count in CL register and Exchange AL and memory


decrement by one pointed by SI – 1

2 Load the address of array in SI Decrement CH count


register

No

Load the count in CH register and


decrement by one Is
1
ZF = 1?

Increment the array pointer (SI) Yes

Decrement CL count

1 Get an element of array in AL


register No

Is
2
ZF = 1?
Increment the array pointer (SI)

Yes

Compare next element of array Stop


with AL

No

Is
CF = 0?

Yes
PROGRAM

Label Address Mnemonics Hex code Comments


Opcode Operand
START: 1000 MOV SI, 1100H C7 C6 00 11 ; Set SI register as pointer for array
1004 MOV CL, [SI} 8A 0C ; Set CL as count for N – 1 repetitions
1006 DEC CL FE C9
REPEAT 1008 MOV SI, 1100H C7 C6 00 11 ; Initialize pointer
100C MOV CH, [SI] 8A 2C : Set CH as count for N – 1 comparisons
100E DEC CH FE CD
1010 INC SI 46 ; Increment the count
REPCOM 1011 MOV AL, [SI] 8A 04 ; Get an element of array in AL register
1013 INC SI 46
1014 CMP AL, [SI] 3A 04 ; Compare with next element of array
; in memory
1016 JNC AHEAD 73 05 ; It AL is greater than memory, then go
; to AHEAD
1018 XCHG AL, [SI] 86 04 ; If AL is less than memory then
101A XCHG AL, [SI –1] 86 44 FF ; exchange the content of memory
; pointed by SI and the previous memory
; location
AHEAD 101D DEC CH FE CD ; Decrement the count for comparisons
101F JNZ REPCOM 75 F0 ; Repeat comparisons until CH count is
zero
1021 DEC CL FE C9 ; Decrement the count for repetitions
1023 JNZ REPEAT 75 E3 ; Repeat N – 1 comparisons until CL
count is zero
1025 HLT F4

Address Input Address Output


1100 05 – count 1100 05 – count
1101 09 1101 64
1102 49 1102 49
1103 24 1103 32
1104 32 1104 24
1105 64 1105 09

RESULT:
Thus the assembly language program to sort an array of data in descending order using 8086
has been done and verify successfully.
2 C . SEARCHING FOR SMALLEST NUMBER IN AN ARRAY

AIM:-
Write an assembly language program to search the smallest data in an array.

ALGORITHM:
1. Load the staring address of the array in SI register.
2. Load the address of the result in DI register.
3. Load the number of bytes in the array in CL register.
4. Increment the array pointer (SI register).
5. Get the first byte of the array in AL register
6. Decrement the byte count (CL register).
7. Increment the array pointer (SI register).
8. Get next byte of the array in BL register.
9. Compare current smallest (AL) and next byte (BL) if the array.
10. Check carry flag. If carry flag is set then go to step -12, otherwise go to next step.
11. Move BL to AL.
12. Decrement the byte count (CL register).
13. Check zero flag. If zero flag is reset then go to step-7, otherwise go to next step.
14. Save the smallest data in memory pointed by DI.
15. Stop.
FLOWCHART
Start
A

Load the address of array in SI register Decrement byte count (CL)

Load the address of result in DI register


Is
B No ZF = 1?

Set CL as byte count

Yes
Store AL in memory
Increment array pointer (SI)

Stop
Get the first byte of array in AL register

Decrement the byte count

B Increment array pointer (SI)

Get the next byte of array in BL register

Compare AL and BL register

Yes Is
CF = 1?

Move
N BL to AL

A
PROGRAM
Label Address Mnemonics Hex code Comments
Opcode Operand
START 1000 MOV SI, 1100H C7 C6 00 11 ; Set SI register as pointer for array
1004 MOV DI, 1200H C7 C7 00 12 ; Set DI register as pointer for result
1008 MOV CL, [SI] 8A 0C ; Set CL as count for elements in the array
100A INC SI 46 ; Increment the address pointer
100B MOV AL, [SI] 8A 04 ; Set first data as smallest
100D DEC CL FE C9 ; Decrement the count
AGAIN 100F INC SI 46 ; Make SI to point to next data in array
1010 MOV BL, [SI ] 8A 1C ; Get the next data in BL register
1012 CMP AL, BL 38 D8 ; Compare current smallest data in AL
; with BL
1014 JC AHEAD 72 02 ; If carry is set then AL is less than BL
; hence proceed to AHEAD
1016 MOV AL, BL 88 D8 ; If carry is not set then make BL as
; current smallest
AHEAD 1018 DEC CL FE C9 ; Decrement the count
101A JNZ AGAIN 75 F3
; If count is not zero repeat search
101C MOV [DI], AL 88 05
; Store the smallest data in memory
101E HLT F4

Smallest no in the array


Address Input
1100 (05) count
1101 22
1102 AA
1103 FF
1104 45
1105 50
Address Output
200 22

RESULT:
Thus the assembly language program for smallest data in an array using 8086 has been done
and verify successfully.
2D). SEARCHING FOR LARGEST NUMBER IN AN ARRAY
AIM:-
Write an assembly language program to search the largest data in an array.

ALGORITHM:
1. Load the staring address of the array in SI register.
2. Load the address of the result in DI register.
3. Load the number of bytes in the array in CL register.
4. Increment the array pointer (SI register).
5. Get the first byte of the array in AL register
6. Decrement the byte count (CL register).
7. Increment the array pointer (SI register).
8. Get next byte of the array in BL register.
9. Compare current smallest (AL) and next byte (BL) if the array.
10. Checks carry flag. If carry flag is set then go to step -12, otherwise go to next step.
11. Move BL to AL.
12. Decrement the byte count (CL register).
13. Check zero flag. If zero flag is reset then go to step-7, otherwise go to next step.
14. Save the largest data in memory pointed by DI.
15. Stop.
FLOWCHART:

Start

A
Set SI register as array pointer

Yes
Is
CF = 0?
Set DI register as result pointer

No
Move BL to AL
Set CL as byte count

Decrement by count
Increment array pointer

Get the first byte of array in AL Yes


register B Is
ZF = 1?

Decrement the byte count No


Store AL in memory

B Increment the array pointer

Stop

Get the next byte of the array in BL

Compare AL and BL registers

A
PROGRAM

Label Address Mnemonics Hex code Comments


Opcode Operand
START 1000 MOV SI, 1100H C7 C6 00 11 ; Set SI register as pointer for array
1004 MOV DI, 1200H C7 C7 00 12 ; Set DI register as pointer for result
1008 MOV CL, [SI] 8A 0C ; Set CL as count for elements in the
; array
100A INC SI 46 ; Increment the address pointer
100B MOV AL, [SI] 8A 04 ; Set first data as smallest
AGAIN 100D DEC CL FE C9 ; Decrement the count
100F INC SI 46 ; Make SI to point to next data in array
1010 MOV BL,[SI ] 8A 1C ; Get the next data in BL register
1012 CMP AL, BL 38 D8 ; Compare current smallest data in AL
; with BL
1014 JNC AHEAD 73 02 ; If carry is set then AL is less than BL
; hence proceed to AHEAD
1016 MOV AL, BL 88 D8 ; If carry is not set then make BL as
AHEAD ; current largest
1018 DEC CL FE C9
; Decrement the count
101A JNZ AGAIN 75 F3
; If count is not zero repeat search
101C MOV [DI], AL 88 05
; Store the smallest data in memory
101E HLT F4

Largest

Address Input
1100 05 – count
1101 22
1102 AA
1103 FF
1104 45
1105 50
Address Output
1200 FF

RESULT:

Thus the assembly language program for largest data in an array using 8086 has been done
and verify successfully.
3. PROGRAM FOR STRING MANIPULATION OPERATIONS USING 8086
AIM:-
To write a program for string manipulation such as fill a byte, move a string; compare the string by
using 8086 microprocessor kit.
ALOGRITHM:
a) Move the string:
Step1: Start the process

Step2: Initialize the memory

Step3: Clear the direction flag

Step4: Move the value to string

Step5: Stop the process

b) Compare the string:

Step1: Start the process

Step2: Initialize the counter and carry value

Step3: Initialize the memory value

Step4: Compare two values

Step5: If the two value are equal set the carry otherwise reset

Step6: Stop the process

c) Fill a Byte:

Step1: Start the process

Step2: Clear the direction flag

Step3: Initialize the counter

Step4: Get the value of byte

Step5: Initialize the memory

Step6: Store the value in memory


Step7: Stop the process
Move the String:

START

Initialize the memory


Location & counter value

Clear direction flag

Move the string value

IF No
Zero

Yes

STOP
3a) Move the String:
PROGRAM:
Label Address Mnemonics Hex code Comments
Opcode Operand
1000 MOV SI,1100 C7, C6, 00, 11 Initialize the memory
1004 MOV DI,1200 C7, C7, 00, 12 Initialize the memory
1008 MOV CX,0005 C7, C1, 05, 00 Initialize the counter
100C CLD FC Clear the direction flag
LOOP1: 100D MOVSB A4 Store the result of string
100E LOOP LOOP1 E2, FD Go to LOOP L1
1010 HLT F4 Stop the process.

Observation:

Address Input Address Output


1100 11 1200 11
1101 22 1201 22
1102 33 1202 33
1103 44 1203 44
1104 55 1204 55
Compare the String:

START

Initialize counter and carry value

Initialize the memory value

If Yes
equal

No
Set Set
Zero Flag = 0 zero Flag = 1

STOP
3b) Compare the String:
PROGRAM

Label Address Mnemonics Hex code Comments


Opcode Operand
1000 CLD FC Clear the direction flag
1001 MOV DX,0000 C7, C2, 00, 00 Initialize the carry
1005 MOV CX,0005 C7, C1, 05, 00 Initialize the counter
1009 MOV SI,1200 C7, C6, 00, 12
100D MOV DI,1300 C7, C7, 00, 13 Initialize the memory
1011 REPZ CMPSB F3, A6 Compare the string
1013 JNZ LOOP1 75, 01 If no zero to L1
1015 INC DX 42 Increment DX value.
LOOP1: 1016 MOV [1400], DX 89, 16, 00, 14 Move the value in memory
101A HLT F4 Stop the process

Address Input Address Input


1200 11 1300 11
1201 12 1301 12
1202 13 1302 13
1203 14 1303 14
1204 15 1304 15

Address Output
1400 01
1401 00
Fill a Byte:

START

Clear the direction flag

Initialize the counter

Get the value of byte

Initialize the memory &


Store value in memory

STOP
3c) Fill a Byte
PROGRAM
Label Address Mnemonics Hex code Comments
Opcode Operand
1000 CLD FC Clear the direction flag
1001 MOV DX, 0005 C7, C2, 05, 00 Initialize the counter
1005 MOV AL,1F C6, C0,1F Get the value of byte
1008 MOV DI,1200 C7, C7, 00, 12 Initialize the memory
LOOP1: 100C STOSB AA Store the value
100D LOOP LOOP1 E2, FD Loop L1
100F HLT F4 Stop the process

Address Input Address Output


1200 1F 1200 1F
1201 1F 1201 1F
1202 1F 1202 1F
1203 1F 1203 1F
1204 1F 1204 1F

RESULT:
Thus the operation of string manipulation is done and verified using 8086 microprocessor.
4. CODE CONVERSION, DECIMAL ARITHMETIC AND MATRIX OPERATIONS

4a) Hexadecimal to Decimal code conversion


Aim
: To write an assembly language program to convert hexadecimal number into decimal
number

Algorithm:
1. Load the number to be converted into the accumulator.
2. If the number is less than 100 (64H), go to next step; otherwise, subtract 100 (64H)
repeatedly until the remainder is less than 100 (64H). Have the count(100’s value) in
separate register which is the carry.
3. If the number is less than 10 (0AH), go to next step; otherwise, subtract 10 (0AH)
repeatedly until the remainder is less than 10 (0AH). Have the count(ten’s value) in
separate register.
4. The accumulator now has the units.
5. Multiply the ten’s value by 10 and add it with the units.
6. Store the result and carry in the specified memory location.
FLOWCHART:

Hexadecimal to Decimal conversion

START

Get the Hex data in A

Load B with 100D

Divide A by B

Store (A) ie No of 100’s

Load B with 10D

Divide A by 10D

Store (A) as No.of tens

Store (B) as No. Of Units

Stop
PROGRAM

Label Address Mnemonics Hex code Comments


Opcode Operand
START 1000 MOV SI,1100 C7 C6 00 11 ; Load the input address 1100
1004 MOV DX,00 00 C7 C2 00 00 ; Load address in SI
1008 MOV AX,[SI] 8B 04 ; Load 64 to Count the number of 100s
100A MOV BX,00 64 C7 C3 64 00 ;Get the number of hundreds
100E DIV BX F7 F3 ; Load number of hundreds in1102 &
1103
1010 MOV [SI+02],AX 89 44 02 ; Move the remainder to AX
1013 MOV AX,DX 89 D0 ; Initialize DX with 0000
1015 MOV DX ,00 00 C7 C2 00 00 ; Load 0A to find number of tens
1019 MOV BX, 00 0A C7 C3 0A 00 ; Divide by 0A to get number of tens
101D DIV BX F7 F3 ; Move no of tens to the address 1104 &
1105
101F MOV [SI+04],AX 89 44 04 ; Move no of ones to the address 1106 &
1107
1022 MOV [SI+06],DX 89 54 06 ; Halt
1025 HLT F4

Address Input Address Output


1100 FF 1102 02
1101 00 1103 00
1104 05
1105 00
1106 05
1107 00
MATRIX OPERATION

FLOW CHART:
START

Initialize the pointer for two


Matrices

AL = Increment Pointer

CL = CL – 1

IF
CL -0 NO

YES
Store result

STOP
4b. MATRIX OPERATIONS USING 8086

AIM:
To write a program for addition of two 3x3 matrix by using 8086.

ALGORITHM:

1. Initialize the pointer only for data and result


2. Load AL with count
3. Add two matrix by each element
4. Process continues until CL is zero
5. Store result.
PROGRAM
Label Address Mnemonics Hex code Comments
Opcode Operand
START 1000 MOV CL,09 C6 C1 09 ;count for 3 x 3 matrix
1003 MOV SI,1200 C7 C6 00 12 ; address in SI
1007 MOV DI,1300 C7 C7 00 13 ; address in DI
LOOP 100B MOV AL,[SI] 8A 04 ;Load AL with matrix
100D MOV BL,[DI] 8A 1D ; Load BL with matrix
100F ADD AL,BL 00 D8 ; ADD two data
1011 MOV [DI],AL 88 05 ;Store result
1013 INC DI 47 ; Increment DI
1014 INC SI 46 ; Increment SI
1015 DEC CL FE C9 ;Decrement CL
1017 JNZ LOOP 75 F2 ; Loop continues until zero
1019 INT 3 CC ; Break point
Address Input Address Input Address Output
1200 01 1300 12 1300 13
1201 02 1301 02 1301 04
1202 03 1302 04 1302 07
1203 04 1303 06 1303 0A
1204 05 1304 08 1304 0D
1205 06 1305 02 1305 08
1206 07 1306 04 1306 0B
1207 08 1307 06 1307 0E
1208 09 1308 03 1308 0C

PROGRAM for Matrix operation using MASM assembler

.MODEL SMALL
.DATA
TAB DB 3,4,5,6,0
DB 1,4,5,7,0
DB 1,8,9,0,0
DB 1,8,9,2,0
DB 1,1,1,1,0
DB 0,0,0,0,0
TOTROWS DB 0
TOTCOLS DB 0
ROWS DB 5
COLS DB 4
.CODE
MOV AX,@DATA
MOV DS,AX
; COUNTING TOTAL ROWS
LEA SI,TAB
L1: MOV CX,4
L2: MOV AH,BYTE PTR[SI]
ADD TOTROWS , AH
INC SI
LOOP L2
MOV AH,TOTROWS
MOV [SI],AH
MOV TOTROWS,0
INC SI
SUB ROWS,1
CMP ROWS,0
JG L1

; COUNTING TOTAL COLS


LEA SI,TAB
MOV BX,00
L3: MOV CX,5
LEA SI,TAB
ADD SI,BX
L4: MOV AH,BYTE PTR[SI]
ADD TOTCOLS , AH
ADD SI,5
LOOP L4
MOV AH,TOTCOLS
MOV [SI],AH
MOV TOTCOLS,0
SUB COLS,1
CMP COLS,0
ADD BX,1
JG L3
MOV AX,4C00H
INT 21H
END

RESULT:

Thus the matrix operation and code conversion were executed and verified successfully.
5. MOVE A DATA BLOCK WITHOUT OVERLAP

AIM:

To convert a given Move a data block without overlap using u086 MASM assembler and
8086 kit.

ALGORITHM:
1. Initialize the memory location to the data pointer.
2. Increment B register.
3. Increment accumulator by 1 and adjust it to decimal every time.
4. Compare the given decimal number with accumulator value.
5. When both matches, the equivalent hexadecimal value is in B register.
6.
7. Store the resultant in memory location.

Move data block without overlap using 8086 kit


1000 ORG 1000H
1000 B8 0000 MOV AX,0000H
1003 8E D8 MOV DS,AX
1005 B9 0005 MOV CX,0005
1008 BF 3000 MOV DI,3000H
100B BE 1200 MOV SI,1200H
100E 8B 04 L1 MOV AX,[SI]
1010 89 05 MOV [DI],AX
1012 46 INC SI
1013 47 INC DI
1014 49 DEC CX
1015 8B C1 MOV AX,CX
1017 75 F5 JNZ L1

1019 B4 4C MOV AH,4CH


101B CD 21 INT 21H
OBSERVATION:
INPUT:
1200 = 14H
1201 = 35H
1202 = 18H
1203 = 36H
1204 = 54H
OUTPUT
: 1300 = 14H
1301 = 35H
1302 = 18H
1303 = 36H
1304 = 54H
PROGRAM

Move data block without overlap using 8086 MASAM Assembler

DATA SEGMENT X DB 01H,02H,03H,04H,05H ;Initialize Data Segments Memory Locations


Y DB 05 DUP (0)
DATA ENDS
CODE SEGMENT ASSUME CS: CODE, DS: DATA
START:
MOV AX, DATA ; Initialize DS to point to start of the memory
MOV DS, AX ; set aside for storing of data
MOV CX, 05H ; Load counter
LEA SI, X+04 ; SI pointer pointed to top of the memory block
LEA DI, X+04+03 ; 03 is displacement of over lapping, DI pointed to; the top of the
destination block
CODE ENDS
END START

RESULT:

Thus the program for moving the data block without overlap was executed and verified
using 8086 MASM assembler and 8086 kit.
6. PASSWORD CHECKING, PRINT RAM SIZE AND SYSTEM DATE

AIM:

To write an 8086 MASM assembler program for performing password checking, Print
RAM size and system date.
APPARATUS REQUIRED:
SL.NO ITEM QUANTITY
1. 8086 Microprocessor kit 1
2. Intel Desktop systems with MASM 1
3. RTC Interface board 1

PROGRAM:

6 A) PASSWORD CHECKING

; PASSWORD IS MASM1234
DATA SEGMENT
PASSWORD DB 'MASM1234'
LEN EQU ($-PASSWORD)
MSG1 DB 10,13,'ENTER YOUR PASSWORD: $'
MSG2 DB 10,13,'WELCOME TO ELECTRONICS WORLD!!$'
MSG3 DB 10,13,'INCORRECT PASSWORD!$'
NEW DB 10,13,'$'
INST DB 10 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START:
MOV AX,DATA
MOV DS,AX
LEA DX,MSG1
MOV AH,09H
INT 21H
MOV SI,00
UP1:

MOV AH,08H
INT 21H

CMP AL,0DH
JE DOWN
MOV [INST+SI],AL
MOV DL,'*'
MOV AH,02H
INT 21H
INC SI
JMP UP1
DOWN:
MOV BX,00
MOV CX,LEN
CHECK:
MOV AL,[INST+BX]
MOV DL,[PASSWORD+BX]
CMP AL,DL
JNE FAIL
INC BX
LOOP CHECK
LEA DX,MSG2
MOV AH,09H
INT 21H
JMP FINISH
FAIL:
LEA DX,MSG3
MOV AH,009H
INT 21H
FINISH:
INT 3
CODE ENDS
END START
END
******************
Password set Input
1240:16 (1)
1241:1E (2)
1242:26 (3)
1243:25(4)
1244:2E(5)
Output:
Enter the Password:
Type 12345
Message: 'WELCOME TO ELECTRONICS WORLD!!$'
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
6 B)DISPLAY MONTH/DAY/YEAR
.MODEL SMALL
.STACK 64
.DATA
Today
SAVEDAY DB ?
SAVEMON DB ?
TEN DB 10
ELEVEN DB 11
TWELVE DB 12
DAYSTAB DB ' SUNDAY, $ ', ' MONDAY, $ '
DB ' TUESDAY, $ ', ' WEDNESDAY, $ '
DB ' THURSDAY, $ ', ' FRIDAY, $ '
DB ' SATURDAY, $ '
MONTAB DB ' JANUARY $ ', ' FEBUARY $ ', ' MARCH $ '
DB ' APRIL $ ', ' MAY $ ', ' JUNE $ '
DB ' JULY $ ', ' AUGUST $ ', ' SEPTEMBER $ '
DB ' OCTOBER $ ', ' NOVEMBER $ ', ' DECEMBER $ '
CODE
BEGIN PROC FAR
MOV AX,@DATA
MOV DS,AX
MOV ES,AX
MOV AX,0600H
CALL Q10SCR
CALL Q20CURS
MOV AH,2AH
INT 21H
MOV SAVEMON,DH
MOV SAVEDAY,DL
CALL B10DAYWK
CALL C10MONTH
CALL D10DAYMO
CALL E10INPT
CALL Q10SCR
MOV AX,4C00H
INT 21H
BEGIN ENDP
B10DAYWK PROC NEAR
MUL TWELVE
LEA DX,DAYSTAB
ADD DX,AX
MOV AH,09H
INT 21H
RET
B10DAYWK ENDP
C10MONTH PROC NEAR
MOV AL,SAVEMON
DEC AL
MUL ELEVEN
LEA DX,MONTAB
ADD DX,AX
MOV AH,09H
INT 21H
RET
C10MONTH ENDP
.386
D10DAYMO PROC NEAR
MOVZX AX,SAVEDAY
DIV TEN
OR AX,3030H
MOV BX,AX
MOV AH,02H
MOV DL,BL
INT 21H
MOV AH,02H
MOV DL,BH
INT 21H
RET
D10DAYMO ENDP

E10INPT PROC NEAR


MOV AH,10H
INT 16H
RET
E10INPT ENDP

Q10SCR PROC NEAR


MOV AX,0600H
MOV BH,17H
MOV CX,0000
MOV DX,184FH
INT 10H
RET
Q10SCR ENDP
Q20CURS PROC NEAR
MOV AH,02H
MOV BH,00
MOV DH,10
MOV DL,24
INT 10H
RET
Q20CURS ENDP
END BEGIN
****************************
Observation:
Input

Set time: 1200 : 05 LSB


1201: 05 MSB(seconds)
1202: 09
1203:05 (Minutes)
1204:03
1205: 02(Hours)

Set
Date:
1206: 05 LSB
1207: 02 MSB(Date)
1208: 01LSB
1209: 00 MSB (Month)
120A:06 LSB
120B : 01 MSB (year)

Output:
The time is displayed as ;
23:59:55 The date is displayed as
;
25:01:16
After 5 seconds the date is displayed as
Date: 26:01:15 in VBMB 8 Kit
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
6 C) RAM SIZE
ORG 0000H
CLR
CLR
CPL A
ADD A, #01H
MOV A,R3
AGAIN: SJMP AGAIN
********************************

Observation:
OUTPUT
“RAM SIZE IS 16 KB” is displayed in the LCD.

RESULT:
Thus the output for the Password checking, Print RAM size and system date was
executed and verified using MASM assembler successfully
7. COUNTERS AND TIME DELAY

AIM:

To write an assembly language program for up counter using 8086 kit and 8086 MASM
assembler.

APPARATUS REQUIRED:

SL.NO ITEM SPECIFICATION QUANTITY


1. Microprocessor kit 8086 kit 1
2. Power Supply +5 V, dc,+12V dc 1
3. RTC Interface board – –

PROCEDURE:

1. Enter the program into the kit


2. Execute the program
3. The counter value displayed in the LCD, he value starts from 00H T0 99H
PROGRAM
UP COUNTER using 8086 kit
1000 EB 2F 10 START: CALL CONVERT
1003 E8 00 1D CALL DISPLAY
1006 B9 00 00 DELAY: MOV CX,0000H
1009 41 L1 : INC CX
100A 81 F9 FF FF CMP CX,0FFFFH
100E 75 F9 JNZ L1
1010 BE 00 15 MOV SI,1500H
1013 8A 04 MOV AL,[SI]
1015 FE C0 INC AL
1017 88 04 MOV [SI],AL
1019 3C 64 CMP AL,064H
101B 75 E3 JNZ START
101D B0 00 MOV AL,00H
101F 88 04 MOV [SI],AL
1021 EB DD JMP START
1023 B4 06 DISPLAY: MOV AH,06H
1025 BA 00 16 MOV DX,1600H
1028 B5 01 MOV CH,01H
102A B1,00 MOV CL,00H
102C CD 05 INT 5
102E C3 RET
102F BE 00 15 CONVERT: MOV [SI],1500H
1032 BB 02 16 MOV BX,1602H
1035 B0 24 MOV AL,24H
1037 88 07 MOV [BX],AL
1039 8A 04 MOV AL,[SI]
103B B4 00 MOV AH,00H
103D B6 0A MOV DH,0AH
103F F6 F6 DIV DH
1041 80 C4 30 ADD AH,30H
1044 4B DEC BX
1045 88 27 MOV[BX],AH
1047 4B DEC BX
1048 04 30 ADD AL,30H
104A 88 07 MOV [BX],AL
104C 4B DEC BX
104D C3 RET
104E E4 02 GETC: IN AL,02H
1050 24 FF AND AL,0FFH
1052 3C F0 CMP AL,0F0H
1054 75 F8 JNE GETC
1055 F4 HLT
UP COUNTER using 8086 MASM assembler

MODEL SMALL
STACK 100H
DATA
PROMPT DB 'The counting from 0 to 9 is : $'
CODE
MAIN PROC
MOV AX, @DATA ; initialize DS
MOV DS, AX
LEA DX, PROMPT ; load and print PROMPT
MOV AH, 9
INT 21H
MOV CX, 10 ; initialize CX
MOV AH, 2 ; set output function
MOV DL, 48 ; set DL with 0
@LOOP: ; loop label
INT 21H ; print character
INC DL ; increment DL to next ASCII character
DEC CX ; decrement CX
JNZ @LOOP ; jump to label @LOOP if CX is 0
MOV AH, 4CH ; return control to DOS
INT 21H
MAIN ENDP
END MAIN

RESULT:

Thus the program for up counter using 8086 MASM assembler was executed and verified
successfully
8. TRAFFIC LIGHT CONTROL

AIM:-

To write an assembly program for Traffic Light Control using 8086 LCD Microprocessor
Kit.

PROGRAM:
CNTRL EQU 26H
PORT A EQU 20H
PORT B EQU 22H
PORT C EQU 24H

Label Address Mnemonics Hex code Comments


Opcode Operand
START 1000 MOV AL,80H C6 C0 80
1003 OUT (CNTRL)26,AL E6 26
REPEAT 1005 MOV BX,LOOK UP C7 C3 73 10
1009 MOV SI,LABEL C7 C6 7F 10
100D CALL OUT E8 33 00
1010 MOV AL,[SI] 8A 04
1012 OUT (PORTA)20,AL E6 20
1014 CALL DELAY 1 E8 4D 00
1017 INC SI 46
1018 INC BX 43
1019 CALL OUT E8 27 00
101C MOV AL,[SI] 8A 04
101E OUT (PORTB)22,AL E6 22
1020 CALL DELAY 1 E8 41 00
1023 INC SI 46
1024 INC BX 43
1025 CALL OUT E8 1B 00
1028 MOV AL,[SI] 8A 04
102A OUT (PORTC)24,AL E6 24
102C CALL DELAY 1 E8 35 00
102F INC SI 46
1030 INC BX 43
1031 CALL OUT E8 0F 00
1034 MOV AL,[SI] 8A 04
1036 OUT (PORTC)24,AL E6 24
1038 INC SI 46
1039 MOV AL,[SI] 8A 04
103B OUT (PORTA)20,,AL E6 26
OUT: 103D CALL DELAY 1 E8 24 00
1040 JMP REPEAT E9 C2 FF
1043 MOV AL,[BX] 8A 07
1045 OUT (PORTC)24,AL E6 24
1047 INC BX 43
1048 MOV AL,[BX] 8A 07
104A OUT (PORTB)22,AL E6 22
104C INC BX 43
104D MOV AL,[BX] 8A 07
104F OUT (PORTA)20,AL E6 20
DELAY: 1051 CALL DELAY E8 01 00
A: 1054 RET C3
A1: 1055 MOV DI,00040H C7 C7 40 00
1059 MOV DX,0FFFFH C7 C2 FF FF
105D DEC DX 4A
105E JNZ A1 75 FD
1060 DEC DI 4F
DELAY1: 1061 JNZ A 75 F6
B: 1063 RET C3
B1: 1064 MOV DI,00015H C7 C7 15 00
1068 MOV DX,0FFFFH C7 C2 FF FF
106C DEC DX 4A
106D JNZ B1 75 FD
106F DEC DI 4F
LOOK UP: 1070 JNZ B 75 F6
1072 RET C3
LABEL: 1073 DB 12H,27H,44H,10H
1077 2BH,92H,10H,9DH
107B 84H,48H,2EH,84H
107F DB 48H,6BH,20H,49H
1083 04

RESULT:
Thus the assembly language program for Traffic Light Control was executed and verified
using 8086 Microprocessor kit.
FLOW CHART:
START

Store lookup table in DI register

Initialize counter registers CL with


04 for lookup table value

Get lookup table value in AL

Call delay

NO If
CL = 0

YES
9. STEPPER MOTOR CONTROL

AIM:-

To write an assembly language program to control the speed of stepper motor in both
directions using 8086 Microprocessor kit.

APPARATUS REQUIRED:
i. Microprocessor kit
ii. Stepper Motor Interface Card
iii. Stepper motor

ALGORITHM:-
a. Start the program
b. Store lookup table value in DI register
c. Initialize counter register CL with 04H for lookup table value.
d. Get lookup table value in CL.
e. Call delay
f. If CL = 0, go to step1 otherwise get next lookup table value.
Lookup table:-
(Anti clockwise direction) (Clockwise direction)
1200 : 09 1200 : 0A
1201 : 05 1201 : 06
1202 : 06 1202 : 05
1203 : 0A 1203 : 09
PROGRAM:
Label Address Mnemonics Hex code Comments
Opcode Operand
START 1000 MOV DI,1200 C7,C7,00,12 ; Initialize lookup table
1004 MOV CL,04 C6,C1,04 ;Initialize count value
REPEAT 1007 MOV AL,[DI] 8A 05 Get lookup table value
1009 OUT C0,AL E6 C0 ;Sent it to output port
100B MOV DX,1010H C7 C2 10 10 ;Delay program
DELAY 100F DEC DX 4A
1010 JNZ DELAY 75 FD
1012 INC DI 47 ;Increment [DI]
1013 LOOP REPEAT E2 F2 ;if CX  0, go to Repeat
1015 JMP START E9 E8 FF ;Repeat to start

RESULT:
Thus the assembly language program for speed control of stepper motor was executed and
verified using 8086 Microprocessor kit.
10. DIGITAL CLOCK

AIM:-

To display the digital clock specifically by displaying the hours, minutes and seconds
using 8086 kits

PROGRAM:
Label Address Mnemonics Hex code Comments
Opcode Operand
START: 1000 MOV AL,05H C6 C0 05
1003 OUT DE,AL E6 DE
1005 MOV AL,04H C6 C0 04
1008 OUT DE,AL E6 DE
100A MOV SI,1310H C7 C6 10 13
100E MOV AL,[SI] 8A 04
1010 OUT C0,AL E6 C0
1012 INC SI 46
1013 MOV AL,[SI] 8A 04
1015 OUT D0,AL E6 D0
1017 INC SI 46
1018 MOV AL,[SI] 8A 04
101A OUT C2,AL E6 C2
101C INC SI 46
101D MOV AL,[SI] 8A 04
101F OUT D2,AL E6 D2
1021 INC SI 46
1022 MOV AL,[SI] 8A 04
1024 OUT C4,AL E6 C4
1026 INC SI 46
1027 MOV AL,[SI] 8A 04
1029 OUT D4,AL E6 D4
L1: 102B MOV SI,1320H C7 C6 20 13
102F IN AL,D4H E4 D4
1031 AND AL,0FH 80 E0 0F
1034 MOV [SI],AL 88 04
1036 IN AL, C4H E4 C4
1038 AND AL,0FH 80 E0 0F
103B INC SI 46
103C MOV [SI],AL 88 04
103E IN AL, D2H E4 D2
1040 AND AL,0FH 80 E0 0F
1043 INC SI 46
1044 MOV [SI],AL 88 04
1046 IN AL, C2H E4 C2
1048 AND AL,0FH 80 E0 0F
104B INC SI 46
104C MOV [SI],AL 88 04
104E IN AL, D0H E4 D0
1050 AND AL,0FH 80 E0 0F
1053 INC SI 46
1054 MOV [SI],AL 88 04
1056 IN AL, C0H E4 C0
1058 AND AL,0FH 80 E0 0F
105B INC SI 46
105C MOV [SI],AL 88 04
OUT_CHECK: 105E MOV SI,1320H C7 C6 20 13
1062 MOV AL,[SI] 8A 04
1064 OUT E0,AL E6 E0
1066 INC SI 46
1067 MOV AL,[SI] 8A 04
1069 OUT F0,AL E6 F0
106B INC SI 46
106C MOV AL,[SI] 8A 04
106E OUT E2,AL E6 E2
1070 INC SI 46
1071 MOV AL,[SI] 8A 04
1073 OUT F2,AL E6 F2
1075 INC SI 46
1076 MOV AL,[SI] 8A 04
1078 OUT E4,AL E6 E4
107A INC SI 46
107B MOV AL,[SI] 8A 04
107D OUT F4,AL E6 F4
107F JMP L1 E9 A9 FF
1082 ENDS

Observation:
Input
1200 00
1201 00
1202 00
1203 00
1204 00

Output:
Time is displayed in the RTC board as
! Hour ŀ Minutes ŀ seconds ŀ
X 0 0 0 5 9

X 0 0 1 0 0

RESULT:
Thus the digital clock program has been written and executed using 8086 microprocessor
kit and the output of digital clock was displayed as [hours: minutes: seconds] successfully.
11. KEY BOARD AND DISPLAY

AIM:-
To write an assembly language program to interfacing of 8279 with 8086.

APPARATUS REQUIRED:-
 8086 Microprocessor kit
 8279 interface board
ALGORITHM:-
(a) Rolling Display
Step1: Start the process
Step2: Initialize lookup table pointer, counter of keyboard display mode of 8279.
Step3: Initialize the prescalar counter and clear the display.
Step4: Get the seven segment display & carried it, in display RAM.
Step5: Increment the look up table pointer.
Step6: Decrement the counter until it becomes zero.
Step7: Stop the process.
(b) Accept a key and display it using 8279
Step1: Start the process
Step2: Set the data to set mode & display
Step3: Initialize the counter and clear the display RAM.
Step4: Write the display RAM command.
Step5: Clear the display RAM.
Step6: Decrement the counter value until it becomes zero.
Step7: Get the key data to be displayed.
Step8: Set the memory to need the FIFO RAM.
Step9: Get the corresponding code from look up table.
Step10: Store it is necessary.
Step11: Stop the process.
FLOW CHART:
(a) Rolling Display START

Initialize look up table pointer & counter

Initialize keyboard / display mode of 8279

Initialize prescalar count

Clear display

Initialize 8279 in display RAM write mode

Get seven segment code

Write it in display RAM

Increment the look up table pointer

Decrement the count

NO If
Count =0

YES

STOP
PROGRAM:-
To Display ‘A’

Label Address Mnemonics Hex code Comments


Opcode Operand
START 1000 MOV AL,00 C6 C0 00 ; Display & keyboard mode set
1003 OUT C2,AL E6 C2
1005 MOV AL,0CC C6 C0 CC ; Clear Display
1008 OUT C2,AL E6 C2
100A MOV AL,90 C6 C0 90 ; Write display RAM
100D OUT C2,AL E6 C2
100F MOV AL,88 C6 C0 88 ; Get character
1012 OUT C0,AL E6 C0
1014 MOV AL,0FF C6, C0 FF ; Blank unused
1017 MOV CX,0005 C7 C1 05 00 7segment LED’s
NEXT 101B OUT C0,AL E6 C0
101D LOOP NEXT E2 FC
101F HLT F4 ; Stop the program
FLOW CHART:-
(b) Accept a key and display
START

Get the data to set mode and display

Initialize counter & clear the display 16x8 RAM

Write the display RAM command

Clear 8 x 8 display

Decrement counter

NO If
Count =0

YES
Get the key data

YES If
Count =0

NO
Set memory to read FIFO RAM

Get code from look up table

Store it in memory
PROGRAM:- To Rolling Display (Display message is’ HELP US’)
Label Address Mnemonics Hex code Comments
Opcode Operand
START 1000 MOV SI,1200 C7 C6 00 12 ; load lookup table
1004 MOV CX,000F C7 C1 0F 00
1008 MOV AL,10 C6C010 ;Display / keyboard
100B OUT C2,AL E6 C2 mode set
100D MOV AL,0CC C6 C0 CC ; Clear Display
1010 OUT C2,AL E6 C2
1012 MOV AL,90 C6 C0 90 ; Write display RAM
1015 OUT C2,AL E6 C2
NEXT: 1017 MOV AL,[SI] 8A 04 ; Get to be displayed
1019 OUT C0,AL E6 C0 character
101B CALL DELAY E8 E2 04 ;Call display program
101E INC SI 46
101F LOOP NEXT E2 F6
1021 JMP START E9 DC FF ;Repeat

DELAY 1500 MOV DX,0A0FF C7 C2 FF A0 ;Delay program


LOOP1: 1504 DEC DX 4A
1505 JNZ LOOP1 75 FD
1507 RET C3

LOOK – UP – TABLE (“HELP US”)


1200 1201 1202 1203 1204 1205
FF FF FF FF FF FF
1206 1207 1208 1209 120A 120B
FF FF 98 68 7C C8
120C 120D 120E 120F
FF 1C 29 FF
RESULT:-
Thus the assembly language program for interfacing 8279 keyboard and display
controller with 8086 microprocessor trainer kit was executed and successfully verified.
12. PRINTER STATUS

AIM:
To write an assembly language program to print a message in printer using VBMB – 005

APPARATUS REQUIRED:
1. 8086 Microprocessor kit,
2. Power supply,
3. VBMB005 interfacing board.
4. Printer
(LOOK – UP - TABLE) ROUTINE TO INITIALISE PRINTER
1500 1501 1502 1503 1504 1505 1506
1B 47 09 09 09 1B 0E
1507 1508 1509 150A 150B 150C 150D
56 69 20 4D 69 63 72
150E 150F 1510 1511 1512 1513 1514
6F 73 79 73 74 65 6D
1515 1516 1517 1518 1519 151A 151B
73 0A 0A 09 09 09 09
151C 151D 151E 151F 1520 1521 1522
1B 78 01 44 45 4D 4F
1523 1524 1525 1526 1527 1528 1529
20 4F 46 0A 0A 09 09
152A 152B 152C 152D 152E 152F 1530
09 1B 78 00 1B 45 1B
1531 1532 1533 1534 1535 1536 1537
47 43 45 4E 54 52 4F
1538 1539 153A 153B 153C 153D 153E
4E 49 43 53 20 50 52
153F 1540 1541 1542 1543 1544 1545
49 4E 54 45 52 20 49
1546 1547 1548 1549 154A 154B 154C
00 4E 54 45 52 46 41
154D 154E 154F 1550 1551 1552 1553
43 45 20 42 4F 41 52
1554 1555 1556 1557 1558 1559 155A
44 2E 1B 48 1B 46 END
PROGRAM:
Label Address Mnemonics Hex code Comments
Opcode Operand
START: 1000 MOV CL,59H C6 C1 59
1003 MOV SI,1500H C7 C6 00 15
1007 MOV AL,05 C6 C0 05
100A OUT (CONTL)D0,AL E6 D0
100C IN AL,(STAT)C0 E4 C0
100E AND AL,20H 80 E0 20
1011 CMP AL,20H 80 F8 20
1014 JNZ ERR 75 3B
PROCEED: 1016
1016 MOV AL,[SI] 8A 04
1018 CALL PRINT ; E8 0B 00
101B INC SI 46
101C DEC CL FE C9
101E JNZ PROCEED 75 F6
1020 MOV AL,0AH C6 C0 6A
1023 CALL PRINT E8 00 00
PRINT: 1026
1026 MOV BL,AL 88 C3
1028 CALL CHECK E8 12 00
STATUS: 102B
102B MOV AL,BL 88 D8
102D OUT (DATA)C8,AL E6 C8
102F MOV AL,01 C6 C0 01
1032 OUT (CONTL)D0,AL E6 D0
1034 NOP 90
1035 NOP 90
1036 NOP 90
1037 MOV AL,05H C6 C6 05
103A OUT (CONTL)D0,AL E6 D0
103C RET C3
CHECK: 103D
103D IN AL,(STAT)C0 E4 C0
103F AND AL,20H 80 E0 20
1042 JZ CHECK 74 F9
1044 IN AL,(STAT)C0 E4 C0
1046 AND AL,80H 80 E0 80
1049 CMP AL,80H 80 F8 80
104C JNZ STATUS 75 DD
104E JMP CHECK E9 EC FF
ERR: 1051
1051 INT 2 CD 02

RESULT:
Thus the given message was printed in the printer using 8086 Microprocessor kit and
VBMB – 005.
13. SERIAL INTERFACE AND PARALLEL

INTERFACE 13a) SERIAL INTERFACE

AIM:

To write a program to send byte value from one microprocessor kit to other kit in serial
method by using 8251.
PROCEDURE:
1. Take two no of 8086 microprocessor kits.
2. Enter the Transmit program in Transmitter kit.
3. Enter the receive program in receiver kit.
4. Interface the two kits with 9-9 serial cable in the serial port of the microprocessor kits.
5. (LCD kit means pc-pc cable; LED kit means kit-kit cable)
6. Enter the Baud rate in Transmitter and the receiver kit
7. Enter the data in Transmitter kit use the memory location 1500.
8. Execute the receiver kit.
9. Execute the Transmitter kit.
10. Result will be available in receiver kit memory location 1500.
PROGRAM: TRANSMITTER SECTION:

Label Address Mnemonics Hex code Comments


Opcode Operand
1000 MOV SI,1500H C7,C6,00,15 : MOVE 1500 to SI register
1004 MOV AL,36H C6,C0,36 : MOV 36, to AL register
1007 OUT 16H,AL E6,16
1009 MOV AL,40H C6,C0,40 : MOVE 40 to AI register
100C OUT 10H,AL E6,16 : MOV 01 to AL
100E MOV AL,01H C6,C0,01
1011 OUT 10H,AL E6,10
RELOAD 1013 MOV CL,05H C6,C1,05 : MOV 05, to CL register
CHECK 1016 IN AL,0AH E4,04
1018 AND AL,04H 80,E0,04
101B JZ CHECK 74,79 :JUMP Check
101D MOV AL,[SI] 8A,04 :MOV SI to AL
101F OUT 08H,AL E6,08
1021 INC SI 46
1022 CMP AL,3FH 80,F8,8F
1025 JNZ RELOAD 75,F0 : JUMP on No – zero reload
1027 DEC CL FE,C9
1029 JNZ CHECK 75,EB :JUMP Check
102B INT 02 CD,02 :INT the 02
Transmitter Receiver
Address Input Address Output
1500 01 1500 01
1501 02 1501 02
1502 03 1502 03
1503 04 1503 04
1504 05 1504 05
RECEIVER SECTION:

Label Address Mnemonics Hex code Comments


Opcode Operand
1000 MOV SI,1500H C7,C6,00,15 : MOVE 1500 to SI register
1004 MOV AL,36H C6,C0,36
1007 OUT 16H,AL E6,16 : MOV AL to 16H
1009 MOV AL,40H C6,C0,40
100C OUT 10H,AL E6,16
100E MOV AL,01H C6,C0,01 : MOVE 01 to AI register
1011 OUT 10H,AL E6,10
RELOAD 1013 MOV CL,05H C6,C1,05 : MOV 05, to CL register
CHECK 1016 IN AL,0AH E4,04
1018 AND AL,02H 80,E0,02 :AND the Alto 02
101B JZ CHECK 74,79 :JUMP the Check
101D IN AL,08 E4,08
101F MOV [SI],AL 88,04
1021 INC SI 46 :Increment the SI
1022 CMP AL,3FH 80,F8,8F
1025 JNZ RELOAD 75,EC : JUMP reload
1027 DEC CL FE,C9 :Decrement CL
1029 JNZ CHECK 75,EB :JUMP Check
102B INT 02 CD,02
102D INT CD,02

RESULT:
Thus the program to send byte value from one microprocessor kit to other kit in serial
method by using 8251has been successfully verified.
13b). PARALLEL COMMUNICATION BETWEEN TWO
8086 MICROPROCESSORS KITS
AIM
:
To write a program to send data from one microprocessor kit to other kit in parallel
method by using mode1 and mode2 of 8255.

PROCEDURE:
1. Take two 8086 microprocessor kits.
2. Enter the transmitter program in transmitter kit.
3. Enter the receiver program in receiver kit.
4. Interface the two kits with 26-core cable on PPI-1.
5. Execute the receiver kit.
6. Execute the transmitter kit.
7. Go and see the memory location 1200 in receiver your getting 8 same data’s.
8. Data is available in transmitter kit the memory location is 100f.
9. We will change the data & execute the following procedure & get the result in receiver kit.
PROGRAM: TRANSMITTER PROGRAM:
Label Address Mnemonics Hex code Comments
Opcode Operand
1000 MOV AL,82H C7,C0,82 : MOVE 82 to AL register
1003 OUT 26H,AL E6,26
1005 MOV AL,3FH C6,C0,3F : MOV 3F to AL register
1008 OUT 20H,AL E6,20
LOOP 100A IN AL,22H E4,22 : MOVE 22H to AI register
100C SUB AL,3FH 80,E8,3F
100F JNZ LOOP 75 F9 :JUMP LOOP
1011 MOV AL,24H C6,C0,24
1014 OUT 20H,AL E6,20
1016 CALL DELAY E8,02,00 :Call delay
1019 INT 02 C0,02
DELAY 101B MOV BL,05H C6,C3,FF
LION 101E MOV DL,0FFH C6,C2,FF
LOOP2 1021 DEC DL FF,CA :Decrement CL
1023 JNZ LOOP2 75,F9 :JUMP Loop2
1025 DEC BL FE,CB
1027 JNZ LION 75,F4 :Jump on no zero to lion
1029 RET C3
Receiver
Address Output
1200 24
1201 24
1202 24
1203 24
1204 24
1205 24
1206 24
1207 24
RECEIVER PROGRAM:
Label Address Mnemonics Hex code Comments
Opcode Operand
1000 MOV AL,90H C7,C0,90 : MOVE 90 to AL register
1003 OUT 26H,AL E6,26 : MOV 20 to AL register
CHECK 1005 IN Al,20H E4,20
1007 SUB AL,3FH 80,E8,3F : MOVE 3FH to AI register
100A JNZ CHECK 75F9
100C MOV AL,3FH C6,C0,3F
100F OUT 22H,AL E6,22
1011 MOV Cl, 08 C6,C1,08 : MOVE 08H to AI register
1014 CALL DELAY E8,12,00
1017 MOV SI, 1200 C7,C8,00,12
LOOP1 101B IN AL,20H E4,20
101D MOV [SI], AL 88,04
100F CALL DELAY E8,07,00 :Call delay
1022 INC SI 46
1023 DEC CL FE,C9
1025 JNZ LOOP1 75,F4
1027 INT 02 CD,02
DELAY 1029 MOV BL, 05H C6,C3,05
LION 102C MOV DL, 0FFH C6,C2,FF
LOOP2 102F DEC DL FE,CA :Decrement CL
1031 JNZ LOOP2 75,FC ;JUMP LOOP2
1033 DEC BL FE,CB :Decrement BL
1035 JNZ LION 75,F5 :JUMP lion
1037 RET C3
1038 RET C3

RESULT;
Thus the program to sent data in parallel method from one microprocessor kit to another
using 8255 has been verified successfully.
14. A/D AND D/A INTERFACE AND WAVEFORM GENERATION

14a) A/D INTERFACE WITH 8086

AIM:-
To write an assembly language program for interfacing of ADC with 8086.

ALGORITHM:-

(ii) Start the program


(iii) Select channel 0 (CH – 0 )
(iv) Make ALE low (ALE = 10)
(v) Make ALE high (ALE = 18)
(vi) Male ALE low (ALE = 10)
(vii) Stop the program
PROCEDURE:

(i) Place jumper J2 in C position


(ii) Place jumper J5 in A position
(iii) Enter and execute the program
(iv) Vary the analog input (using trim pot) and view the corresponding digital
value in LED display,
START

Select channel OC (HO)

Move ALE low (ALE = 10)

Move ALE high (ALE = 18)

Move ALE low (ALE = 10)

FLOW CHART:
STOP
PROGRAM:

Label Address Mnemonics Hex code Comments


Opcode Operand
1000 MOV AL, 10 C6 C0 10 ; Channel selection
1003 OUT C8, AL E6 C8 ; ALE low
1005 MOV AL, 18 C6 C0 18 ; ALE high
1008 OUT C8, AL E6 C8
100A MOV AL,10 C6 C0 10 ; ALE low
100D OUT C8,AL E6 C8
100F HLT F4 ; Stop

Jumper Details:-
From switch CH3

B B
Software CH0
C C CH6
A SOC A
From latch ALE
Box

SOC1 From trimpot


J2 [SOC Jumper Selection for CHO – CH7] J5 [Provision to correct the trimpot to
any of mentioned channel]

RESULT:
Thus the assembly language program for performing the interfacing of ADC with 8086 has
been done verified.
14b. INTERFACING OF DAC WITH 8086

AIM:-
To write an assembly language program to generate square, triangular and saw tooth and waveform
by interfacing of DAC with 8086.
ALOGRITHM:

(a) Square Wave:-


 Initially the output value is predefined high value and after some time, the delayed output
value becomes lower and stays in that position for some time delay.
 Initialize the accumulator and display it.
 Using delay program, the output is displayed from ‘00’ value.
 Increment the value up to ‘FF’ and display it for high value.
 Using repeat instruction the square waveform is obtained.
(c) Saw tooth Waveform:-
 Initialize the accumulator to‘00’ values.
 Display this value in C0
 Increment the accumulator up to ‘FF’
 Suddenly it is sent to 00 and repeats the process.
(d) Triangular Waveform:-
 Initialize the accumulator to‘00’
 Out the results in ‘C8’
 Increment the accumulator up to the value of FF and display it.
 Decrement the accumulator to‘00’ and then display it.
 Repeat the procedure for continuous waveform.
(a) Square Waveform:-

Start

Initialize AL as ‘00’

Display AL value

Make some delay

Move FF to AL

Display the AL value

Make some delay


(b) Saw tooth Waveform:-

Start

Load AL with corresponding digital data

Sent it to input of DAC

Increment AL

Compare with FF

Yes
If
Zero
exist

No
(c) Triangular Waveform:-
Start

Initialize memory with digital data (00)

Send it to input of DAC

Increment data

Computer with FF

Yes
If
Carry

No

Move FF to AL

Display AL value

Decrement AL value

Compute with ‘00’

No If
Zero

Yes
(a) To generate square waveform

PROGRAM:
Label Address Mnemonics Hex code Comments
Opcode Operand
LOOP2 : 1000 MOV AL, 00 C6 C0 00 ; Set Logic 0 level
1003 OUT C8, AL E6 C8
1005 CALL Delay E8 0B 00 ;Generate timing delay
1008 MOV AL,0FF C6 C0 FF ;Set logic 1 level
100B OUT C8, AL E6 C8
100D CALL Delay E8 03 00 ; Generate timing delay
1010 JMP LOOP2 E9 ED FF :Repeat to generates Square Wave
Delay: 1013 MOV CX, 05FF C7 C1 FF 05 :Delay Program
LOOP3: 1017 LOOP LOOP3 E2 FE
1019 RET C3

(b) To generate saw tooth wave

PROGRAM:
Label Address Mnemonics Hex code Comments
Opcode Operand
LOOP2 : 1000 MOV AL, 00 C6 C0 00 ; Set logic 0 level
LOOP1: 1003 OUT C0, AL E6 C0
1005 INC AL FE C0 ;Increment Logic0 toLogic1
1007 JNZ LOOP1 75 FA ;If ZF=0, jump to next
1009 JMP LOOP2 E9 F4 FF ;Repeat
(c) To generate triangular waveform

PROGRAM:
Label Address Mnemonics Hex code Comments
Opcode Operand
LOOP3 : 1000 MOV BL, 00 C6 C3 00 ;Set logic 0
LOOP1: 1003 MOV AL, BL 88 D8 ;copy logic 0
1005 OUT C8, AL E6 C8
1007 INC BL FE C3 ; Increment logic0 to logic1
1009 JNZ LOOP1: 75 F8 ; If ZF=0, jump to next
100B MOV BL, 0FF C6 C3 FF Set logic 1
LOOP2: 100E MOV AL, BL 88 D8 ;copy logic 1
1010 OUT C8, AL E6 C8
1012 DEC BL FE CB ; Decrement logic0 tologic1
1014 JNZ LOOP2 75 F8 ; If ZF=0, jump to next
1016 JMP LOOP3 E9 E7 FF ;Repeat

RESULT:
Thus an assembly language program to generate square, triangular and saw tooth waveform was
done using DAC Interface and 8086 microprocessor kit.
15. BASIC ARITHMETIC AND LOGIAL OPERATIONS USING 8051

A. 8 BIT ADDITION

AIM:

To write a program to add two 8-bit numbers using 8051 microcontroller.

ALGORITHM:

1. Clear Program Status Word.


2. Select Register bank by giving proper values to RS1 & RS0 of PSW.
3. Load accumulator A with any desired 8-bit data.
4. Load the register R 0 with the second 8- bit data.
5. Add these two 8-bit numbers.
6. Store the result.
7. Stop the program.
FLOW CHART:
Start

Clear PSW

Select Register

Load A and R0 with 8 – bit data’s

ADD A & R0

Store the sum

Stop
PROGRAM:

Label Address Mnemonics Hex code Comments


Opcode Operand
START: 4100 CLR C C3 Clear CY Flag
4101 MOV A,#0A 74 0A Get the data1 in Accumulator
4103 ADDC A,#10 34 10 Add the data1 with data 2
4105 MOV DPTR,#4500 90 45 00 Initialize the memory location
4108 MOVX @DPTR,A F0 Store the result in memory location
L1 4109 SJMP L1 80 FE Stop the program

Address Output
4500 1A(LSB)
4501 00(MSB)

RESULT:

Thus the 8051 Assembly Language Program for addition of two 8 bit numbers was
executed.
FLOW CHART:

Start

Clear Carry Flag

Get 1’st Operation in ACCR

Subtract the 2’nd operand from


ACCR

IS
CF=1

Increment the Borrow Register

Store Result in Memory

Stop
15B. 8 BIT SUBTRACTION
AIM:

To perform subtraction of two 8 bit data and store the result in memory.

ALGORITHM:

1. Clear the carry flag.


2. Initialize the register for borrow.
3. Get the first operand into the accumulator.
4. Subtract the second operand from the accumulator.
5. If a borrow results increment the carry register.
6. Store the result in memory.

PROGRAM:

Label Address Mnemonics Hex code Comments


Opcode Operand
START: 4100 CLR C C3 Clear CY Flag
4101 MOV A,#0A 74 0A Get the data1 in Accumulator
4103 SUBB A,#05 94 05 Subtract data2 from data1
4105 MOV DPTR,#4500 90 45 00 Initialize memory location
4108 MOVX @DPTR,A F0 Store the difference in memory location
L1 4109 SJMP L1 80 FE Stop the program

Address Output
4500 05

RESULT:

Thus the 8051 Assembly Language Program for subtraction of two 8 bit numbers was
executed.
FLOW CHART:

Start

Get Multiplier in ACCR

Get Multiplicand in B Register

Multiply A with B

Store Result in Memory

Stop
15 C. 8 BIT MULTIPLICATION

AIM:

To perform multiplication of two 8 bit data and store the result in memory.

ALGORITHM:

1. Get the multiplier in the accumulator.


2. Get the multiplicand in the B register.
3. Multiply A with B.
Store the product in memory
PROGRAM:

Label Address Mnemonics Hex code Comments


Opcode Operand
START: 4100 MOV A,#05 74 05 Store data1 in accumulator
4102 MOV B,#03 75 F0 03 Store data2 in B register
4105 MUL AB A4 Multiply both
4106 MOV DPTR,#4500 90 45 00 Initialize memory location
4109 MOVX @DPTR,A F0 Store lower order result
410A INC DPTR A3 Go to next memory location
410B MOV A,B E5 F0 Store higher order result
410D MOVX @DPTR,A F0
L1 410E SJMP L1 80 FE Stop the program

Address Output
4500 0F(LSB)
4501 00(MSB)

RESULT:

Thus the 8051Assembly Language Program for multiplication of two 8 bit numbers was
executed.
FLOW CHART:

Start

Get Dividend in ACCR

Get Divisor in B Register

Divide A by B

Store Quotient & Remainder in


Memory

Stop
15 D. 8 BIT DIVISION

AIM:

To perform division of two 8 bit data and store the result in memory.

ALGORITHM:

1. Get the Dividend in the accumulator.


2. Get the Divisor in the B register.
3. Divide A by B.
Store the Quotient and Remainder in memory

PROGRAM:

Label Address Mnemonics Hex code Comments


Opcode Operand
START: 4100 MOV A,#15 74 15 Store data1 in accumulator
4102 MOV B,#03 75 F0 03 Store data2 in B register
4105 DIV AB 84 Divide
4106 MOV DPTR,#4500 90 45 00 Initialize memory location
4109 MOVX @DPTR,A F0 Store remainder
410A INC DPTR A3 Go to next memory location
410B MOV A,B E5 F0 Store quotient
410D MOVX @DPTR,A F0
L1 410E SJMP L1 80 FE Stop the program

Input Output
Memory Location Data Memory Location Data
4500 (dividend) 0F 4502 (remainder) 05
4501 (divisor) 03 4503 (quotient) 00

RESULT:

Thus the 8051 8051Assembly Language Program for division of two 8 bit numbers was
executed.
FLOW CHART:

START

Get the first data

Get the second data

Logically AND first data with


second data

Initialize the memory

Move the resultant value into memory

STOP
15 D. MASKING BITS IN AN 8 – BIT NUMBER

AIM:
To write an assembly language program to mask bits o and 7 of an 8 – bit number and
store the result in memory using 8051 microcontroller.

APPARATUS REQUIRED:
8051 microcontroller kit

ALGORITHM:
Masking bits in a 8 bit number
 Start the process
 Get the two data values
 Get the second data
 Logically ‘AND’ the two data values.
 Initialize the memory value and store the result in memory.
 Start the process

PROGRAM:

Label Address Mnemonics Hex code Comments


Opcode Operand
START 4100 MOV A,#87 74 87
4102 ANL A,#7E 54 7E
4104 MOV DPTR,#4500 90 45 00
4107 MOVX @DPTR,A F0
L1 4108 SJMP L1 80 FE

Output
Memory Location Data
4500 06

RESULT:

Thus the 8051assembly language program for masking bits was executed and verified.
a) 1’s and 2’s complement

START

Get the input value

Get the complement

Initialize the data pointer value

Move the data to data pointer

Increment the data value and


data point memory

Move the value to the memory

STOP
16. SQUARE AND CUBE PROGRAM, FIND 2’S COMPLIMENT OF A
NUMBER

AIM:-
To write an assembly language to perform arithmetic, logical and bit manipulation instruction using
8051.

ALOGRITHM:
a) 1’s and 2’s complement
 Get the value
 Get the complement value of data.
 Initialize the data pointer value as memory.
 Move the complemented value to memory of data pointer.
 Increment the value and memory.
 Store the result in memory.
 Stop the process.

a) 1’s and 2’s complement


PROGRAM:
Label Address Mnemonics Hex code Comments
Opcode Operand
4100 MOV A, #02 74, 02 Get the initial value
4102 CPL A F4 Complement the value
4103 MOV DPTR, # 4200 90, 42, 00 Initialize the memory
4106 MOVX @ DPTR, A F0 Move the data to memory
4107 INC A 04 Increment Accumulator
4108 INC DPTR A3 Increment the memory
4109 MOVX @ DPTR, A F0 Move the value to memory
ECE: 410A SJMP ECE 80, FE Continue the process.
1’s and 2’s complement

Output
Memory Location Data
4200 FD (1’s complement
4201 FE(2’S Complement)

Square of a number

Input Output
Memory Location Data Memory Location Data
4200 89 4201 51
4202 49
b) SQUARE PROGRAM FOR 8051

$MOD51
ORG 4100H
MOV DPTR,#4200H
MOVX A,@DPTR
MOV B,A
MUL AB
INC DPTR
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
L:SJMP L

*****************************************************************************

C). CUBE PROGRAM FOR 8051


$MOD51
ORG 4100H
MOV DPTR,#4200H
MOVX A,@DPTR
MOV B,A
MOV R7,A
MUL AB
MOV R0,A
MOV R1,B
MOV A,R7
ANL A,#0FH
MOV B,A
MOV A,R0
MUL AB
MOV R2,A
MOV R3,B
MOV A,R1
MOV B,A
MOV A,R7
ANL A,#0FH
MUL AB
MOV R4,A
MOV R5,B
MOV A,R3
MOV B,R4
ADD A,B
MOV R3,A
MOV A,R0
MOV B,A
MOV A,R7
ANL A,#0F0H
SWAP A
MUL AB
MOV R4,A
MOV R6,B
MOV A,R7
ANL A,#0F0H
SWAP A
MOV B,R1
MUL AB
MOV R0,A
MOV R1,B
MOV A,R6
MOV B,R0
ADD A,B
MOV R0,A
MOV R7,A
MOV A,R4

SWAP A
ANL A,#0F0H
MOV R6,A
MOV A,R0
SWAP A
ANL A,#0F0H
MOV R0,A
MOV A,R4
SWAP A
ANL A,#0FH
MOV R4,A
MOV B,R0
ADD A,B
MOV R4,A
MOV A,R1
SWAP A
MOV B,A
MOV A,R7
SWAP A
ANL A,#0FH
ADD A,B
MOV R0,A
MOV A,R6
MOV B,R2
ADD A,B
MOV R6,A
MOV A,R3
MOV B,R4
ADDC A,B
MOV R3,A
113
MOV A,R0
MOV B,R5
ADDC A,B
MOV R0,A
MOV DPTR,#4500H
MOV A,R6
MOVX @DPTR,A
INC DPTR
MOV A,R3
MOVX @DPTR,A
INC DPTR
MOV A,R0
MOVX @DPTR,A
L:SJMP L

Cube of a number

Input Output
Memory Location Data Memory Location Data
4200 89 4500 56
4501 3C
4502 27

RESULT:
Thus the assembly language program to find 2’s complement, Square and cube of a number
was executed and verified successfully using 8051 microcontroller

114
115
17. UNPACKED BCD TO ASCII

AIM:

To convert BCD number into ASCII by using 8051 micro controller

RESOURCES REQUIERED:

 8051 microcontroller kit


 Keyboard
 Power supply

For example

116
Input Output
Memory Location Data Memory Location Data
4200 89 4201 39
4202 38

117
Unpacked bcd to ascii conversion program for 8051

$MOD51
ORG 4100H
MOV DPTR,#4200H
MOVX A,@DPTR
MOV B,A
ANL A,#0FH
ADD A,#30H
MOV R0,A
MOV A,B
SWAP A
ANL A,#0FH
ADD A,#30H
MOV R1,A
INC DPTR
MOV A,R0
MOVX @DPTR,A
INC DPTR
MOV A,R1
MOVX @DPTR,A
L:SJMP L

RESULT:

Thus the assembly language program to convert unpacked BCD to ASCII was executed and
verified successfully using 8051 microcontroller

118
119
18. INTERFACING 8253 TIMER WITH 8085

AIM:

To interface 8253 Interface board to 8085 p and to generate a square wave of 150MHz.

APPARATUS REQUIRED:
8085 p kit,
8253 Interface board,
DC regulated power supply,
VXT parallel bus,
CRO.

Mode 3 Square wave generator:

It is similar to Mode 2 except that the output will remain high until one half of count and
go low for the other half for even number count. If the count is odd, the output will be high
for (count + 1)/2 counts. This mode is used of generating Baud rate for 8251A (USART).
Procedure:
Set the jumper, so that the clock 0 of 8253 is given a square wave of frequency 1.5 MHz.
This program divides this PCLK by 10 and thus the output at channel 0 is 150 KHz.

Vary the frequency by varying the count. Here the maximum count is FFFF H. So, the
square wave will remain high for 7FFF H counts and remain low for 7FFF H counts. Thus with
the input clock frequency of 1.5 MHz, which corresponds to a period of 0.067 microseconds, the
resulting square wave has an ON time of 0.02184 microseconds and an OFF time of 0.02184
microseconds.

To increase the time period of square wave, set the jumpers such that CLK2 of 8253 is
connected to OUT 0. Using the above-mentioned program, output a square wave of frequency
150 KHz at channel 0. Now this is the clock to channel 2.

Example:
We utilize Mode 0 to generate a square wave of frequency 150 KHz at channel 0.

Address Opcodes Label Mnemonic Operands Comments


4100 3E 36 START: MVI A, 36 Channel 0 in mode 3
4102 D3 CE OUT CE Send Mode Control word
4104 3E 0A MVI A, 0A LSB of count
4106 D3 C8 OUT C8 Write count to register
4108 3E 00 MVI A, 00 MSB of count
410A D3 C8 OUT C8 Write count to register
410C 76 HLT

RESULT:
Thus the 8253 has been interfaced with 8085 p to generate a Square Wave of 150 KHz.

120
121
19. SPEED CONTROL OF DC MOTOR
Aim:-
To write an assembly language program for speed control of DC motor using 8086
Microprocessor Trainer Kit.
Apparatus Required:-
1. 8086 Microprocessor Trainer Kit
2. DC Motor Controller Board
Flow Chart:-
START

Send speed control digital value to AL register

Send value of AL register to DAC port (C0H)

Algorithm:-

1. Start the program


2. Send speed control digital value to AL register
3. Send digital value to DAC port for control the speed of DC motor
4. Repeat again.
Program:-
Label Address Mnemonics Hex code Comments
Opcode Operand
START: 1000 MOV AL, 0FFH C6 C0 FF ; Move digital value to AL
1003 OUT C0H, AL E6 C0 ; Send digital value to DAC port
1005 JMP START E9 F8 FF ; Repeat

Result:-
Thus the assembly language program for speed control of DC motor using with 8086
Microprocessor trainer kit is successfully verified.

122

You might also like