Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

INDORE INSTITUTE OF SCIENCE & TECHNOLOGY

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

LAB MANUAL

SUBJECT: - Microprocessor and it’s Applications


SUBJECT CODE: EC- 501
Session: July-Dec 2022

Student Name: SHARAD PRATAP SINGH BAIS


Roll No.: 0818EC201045
Year: III rd
Session: July-Dec 2022

1
Content

S.No. Name of Experiments Page No.

8086 Microprocessor Experiment List


1. To study the Instruction Set of 8086 Microprocessor.

2. Add two 8 – bit unsigned nos. residing in Data Segment and store the result at
another location in the same segment.

3. Add two unsigned 16 – bit nos. residing in Data Segment and store the result at
another location in the same segment.

4. Add an array of unsigned 8 – bit nos. stored in the Data Segment and save the
result at another location in the same segment.

5. Find the largest no. from an array of unsigned16 – bit nos. stored in Data
Segment

6. Arrange an array of unsigned 16 – bit nos. in Data Segment in ascending order.

7. Find no. of even and odd nos. from an array of 16 – bit Find the largest no. from
an array of unsigned16 – bit nos. stored in Data Segment nos. residing in Data
Segment

8. Move a block of data containing 128 bytes stored in Data Segment starting from
offset 1000H to consecutive locations starting from offset 3000H in same
segment.

8051 Microcontroller Experiment List

9. To write a program to blink LEDs, connected at Port - 1 of 8051, with a nominal


delay of about 1 sec.

2
10. Interfacing of 8051 to ADC0804: draw a simple circuit schematic and write a
program to read analog data from ADC and display it on LEDs connected at
Port – 2.

11. Interfacing of 8051 to Stepper Motor: draw a simple circuit schematic and write
a program to rotate the motor constantly in any one direction.

12. Interfacing of 8051 to 16x2 Alphanumeric LCD Display: draw a simple circuit
schematic and write a program to display “Hi! I am 8051”.

3
Indore Institute of Science and Technology

Guidelines for Lab Report File


Microprocessor and its Applications (EC - 501)

8086 Microprocessor Experiment List

1. To study the Instruction Set of 8086 Microprocessor.

TO WRITE AND SIMULATE 8086 ASSEMBLY LANGUAGE PROGRAMS (ALPs) TO:

2. Add two 8 – bit unsigned nos. residing in Data Segment and store the result at another location in the same
segment.
3. Add two unsigned 16 – bit nos. residing in Data Segment and store the result at another location in the same
segment.
4. Add an array of unsigned 8 – bit nos. stored in the Data Segment and save the result at another location in
the same segment.
5. Find the largest no. from an array of unsigned16 – bit nos. stored in Data Segment.
6. Arrange an array of unsigned 16 – bit nos. in Data Segment in ascending order.
7. Find no. of even and odd nos. from an array of 16 – bit Find the largest no. from an array of unsigned16 –
bit nos. stored in Data Segment nos. residing in Data Segment.
8. Move a block of data containing 128 bytes stored in Data Segment starting from offset 1000H to
consecutive locations starting from offset 3000H in same segment.

8051 Microcontroller Experiment List

9. To write a program to blink LEDs, connected at Port - 1 of 8051, with a nominal delay of about 1 sec.
10. Interfacing of 8051 to ADC0804: draw a simple circuit schematic and write a program to read analog data
from ADC and display it on LEDs connected at Port – 2.
11. Interfacing of 8051 to Stepper Motor: draw a simple circuit schematic and write a program to rotate the
motor constantly in any one direction.
12. Interfacing of 8051 to 16x2 Alphanumeric LCD Display: draw a simple circuit schematic and write a
program to display “Hi! I am 8051”.

(Main reference: “The 8051 Microcontroller and Embedded Systems” by Muhammad


Ali Mazidi, Janice Gillispie Mazidi and Rolin D. McKinlay)

4
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

SUBJECT: Microprocessor and its Applications SUBJECT CODE: EC-501


CLASS: EC 3rd Year SESSION: July-Dec 2022

Experiment – 1
AIM: To study the Instruction Set of 8086 Microprocessor.

THEORY: The 8086 being a CISC (Complex Instruction Set Computer) Processor has a large
no. of instructions in its Instruction Set. These Instructions can be divided into 6 categories.
Each category may have sub – categories. Following is given a brief summary of the 8086
Instruction Set with a few examples for each category/sub - category:

I. DATA TRANSFER INSTRUCTIONS:


a. General purpose byte or word transfer instructions:
MOV : Copy byte or word from specified source to specified destination.
XCHG : Exchange bytes or exchange words.
XLAT: Translate a byte in AL using a table in memory.
PUSH: Copy specified word to top of stack. [Etc.]
b. Simple input and output port transfer instructions:
IN : Copy a byte or word from specified port to Accumulator (Acc.).
OUT : Copy a byte or word from Acc. To specified port.
c. Special address transfer instructions:
LEA : Load effective address of operand into specified reg.
LDS/LES
: Load DS/ES register and other specified reg. from memory.
d. Flag transfer instructions:
LAHF/SAHF
: Load/Store AH with/to low byte of flag reg.
PUSHF/POPF
: Copy flag reg. to top of stack/ word at top of stack to flag reg.

II. ARITHMETIC INSTRUCTIONS:


a. Addition instructions:
ADD : Add specified byte/word to the other specified byte/word.
ADC : Add byte+byte+carry flag or word+word +carry flag.
INC : Increment specified byte/word by 1.
Etc.
b. Subtraction instructions:
5
SUB : Subtract specified byte/word from the other specified byte/word.
SBB : Subtract (byte-byte-carry flag) or (word-word-carry flag)
DEC : Decrement specified byte/word by 1.
Etc.
c. Multiplication instructions:
MUL/IMUL
: Multiply unsigned/signed byte by byte or unsigned/signed word by word.
AAM : ASCII adjust after multiplication.
d. Division instructions:
DIV/IDIV
: Divide unsigned/signed byte by byte or unsigned/signed word by word.
AAD : ASCII adjust before division. [Etc.]
III. BIT MANIPULATION INSTRUCTIONS
a. Logical instructions:
NOT : Invert each bit of a byte/word.
AND/OR/XOR
: AND/OR/XOR each bit in a byte/word with corresponding bits in another
byte/word. [Etc.]
b. Shift instructions:
SHL/SAL
: Shift byte left, put zeros in LSBs.
SHR/SAR
: Shift byte right, put zero/old MSB into new MSB.
c. Rotate instructions:
ROL/ROR
: Rotate byte/word left/right.
RCL/RCR
: Rotate byte/word left/right through carry.
IV. STRING INSTRUCTIONS:
MOVS/MOVSB/MOVSW
: Move byte or word from one string to another.
COMPS/COMPSB/COMPSW
: Compare two string bytes/words. [Etc.]
V. PROGRAM EXECUTION TRANSFER INSTRUCTIONS:
a. Unconditional transfer instructions:
CALL/RET
: Call/return from a procedure.
JMP : Jump to given address.
b. Conditional transfer instructions:
JA/JNBE
: Jump if - above/not below or equal (unsigned comaprison).
JG/JNLE
6
: Jump if - greater/not less than or equal (signed comparison). [Etc.]
c. Iteration control instructions:
LOOP : Loop through a sequence of instructions until CX = 0.
JCXZ : Jump if CX = 0. [Etc.]
d. Interrupt instructions:
INT : Call the specified interrupt service routine (ISR).
IRET : Return from ISR. [Etc.]
e. High-level language interface instructions:
ENTER/LEAVE
: Enter/LEAVE procedure. [Etc.]
VI. PROCESSOR CONTROL INSTRUCTIONS:
a. Flag set/clear instructions:
STC/ CLC
: Set/clear CF.
STI/CLI
: Set/clear Interrupt enable Flag. [Etc.]
b. External hardware synchronization instructions:
HLT : Halt until interrupt or reset.
WAIT : Wait until signal on test pin is low.
c. No operation instruction:
NOP : No operation, just fetch and decode.

7
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Experiment – 2
AIM:To write and simulate 8086 ALPto add two 8 – bit unsigned nos. residing in Data Segment and store the
result at another location in the same segment.

DESCRIPTION:In the program below, firstly, the two 8 – bit nos. to be added are loaded in any two of the 8 –
bit registers. Then they are added and the contents of the register holding the result are stored at another
location.

CODING:

ASSUME CS: CODE_SEG, DS: DATA_SEG

CODE_SEG SEGMENT
MOV AX, DATA_SEG ; Load AX with initialization value for Data Segment register
MOV DS, AX ; Initialize the DS register
MOV AL, OPERAND1 ; Load first no.
MOV BL, OPERAND2 ; Load second no.
ADD AL, BL ; Add the two nos.
MOV RESULT, AL ; Store back the result
HLT ; Stop
CODE_SEG ENDS

DATA_SEG SEGMENT
OPERAND1 DB 4BH ; Store first operand here
OPERAND2 DB 0A9H ; Store second operand here
RESULT DB 01 DUP(?) ; Reserve one location for result
DATA_SEG ENDS

END

8
SIMULATION RESULT for Experiment - 2:

9
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Experiment – 3
AIM: To write and simulate 8086 ALP to add two unsigned 16 – bit nos. residing in Data Segment and store the
result at two consecutive locations in the same segment.

DESCRIPTION: Here most of the code is the same as in addition of 8 – bit nos. The only difference lies where
the operands are loaded in 16 – bit registers instead of 8 – bit registers.

CODING:

ASSUME CS: CODE_SEG, DS: DATA_SEG

CODE_SEG SEGMENT
MOV AX, DAT_SEG ; Load AX with initialization value for Data Segment register
MOV DS, AX ; Initialize the DS register
MOV AX, OPERAND1 ; Load first no.
MOV BX, OPERAND2 ; Load second no.
ADD AX, BX ; Add the two nos.
MOV RESULT, AL ; Store back the result
HLT ; Stop
CODE_SEG ENDS

DATA_SEG SEGMENT
OPERAND1 DW 103CH ; Store first operand here
OPERAND2 DW 6D5FH ; Store second operand here
RESULT DW 01 DUP(?) ; Reserve two consecutive locations for result
DATA_SEG ENDS

END

10
SIMULATION RESULT for Experiment - 3:

11
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Experiment – 4
AIM: To write and simulate 8086 ALP to add an array of unsigned 8 – bit nos. stored in the Data Segment and
save the result at another location in the same segment.

DESCRIPTION: Given a programming task, its exact implementation in any computer language may take
many distinct forms. The following program uses a looping approach, to add the array of given nos., in
conjunction with the Indexed Addressing Mode. The result of addition of many 8 – bit nos. may exceed 255
which is the max no. which can be stored within 8 – bits. So the addition is done using 16 – bit registers and the
final result is stored in two consecutive 8 – bit locations collectively referred to as a word (16 – bit) and named
as RESULT.

CODING:

ASSUME CS: CODE_SEG, DS: DATA_SEG

CODE_SEG SEGMENT
MOV AX, DAT_SEG ; Load AX with initialization value for Data Segment register
MOV DS, AX ; Initialize the DS register
MOV SI, OFFSET NUM_ARRAY ; Load the offset of first no. of the array in Source Index
reg.
MOV CX,ARR_SIZE ; Load array size in Counter reg.
MOV AX, 0 ; Clear AX
MOV BX, 0 ; Clear BX
REPEAT:
MOV BL, [SI] ; Load the 8 – bit no. pointed by SI into BL reg.
ADD AX, BX ;Add it to AX
INC SI ; Increment SI to point to the next no. in the array
DEC CX ; Decrement CX
JNZ REPEAT ; If CX is not zero then repeat addition for next no. in the array
MOV RESULT, AX ; If CX=0, all nos. in the array are added. Store result to memory
HLT ; Stop
CODE_SEG ENDS

DATA_SEG SEGMENT
NUM_ARRAY DB 3EH, 19H, 0AH, 6BH, 0CH, 27H, 3AH, 48H ;Store the 8 – bit no. array here
ARR_SIZE EQU 8 ; Define array size as no. of items in the array

- - - - -
RESULT DW 01 DUP(?) ; Reserve two consecutive locations for
result
DATA_SEG ENDS
END

12
SIMULATION RESULT for Experiment - 4:

INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY


DEPARTMENT OF ELECTRONICS AND COMMUNICATION

13
Experiment – 5
AIM: To write and simulate 8086 ALP to find the largest no. from an array of unsigned 16 – bit nos. stored in
Data Segment.

DESCRIPTION: In the following program we first hold the first no. of array inany 16 – bit register, let BX.
Then we successively compare this register with all other nos. in the array in a loop fashion and in each iteration
we store the bigger no. in the registerBX. At the end of loop the largest no. is in BX and we store it to memory.

CODING:

ASSUME CS: CODE_SEG, DS: DATA_SEG

CODE_SEG SEGMENT
MOV AX, DAT_SEG ; Load AX with initialization value for Data Segment register
MOV DS, AX ; Initialize the DS register
MOV SI, OFFSET NUM_ARRAY ; Load the offset of first no. of the array in Source Index
reg.
MOV CX, ARR_SIZE ; Load array size in Counter reg.
MOV BX, [SI] ; Save first no. of the array in BX

BEGIN:
INC SI ; Increment SI twice to point to the next 16 - bit no. Twice because each
INC SI ; memory location is 8 – bit and so a 16 – bit no. takes two consecutive locations
CMP BX, [SI] ; Compare the no. in BX to the next no. in the array, pointed by SI
JNC NOT_GREATER ; If no. in BX is larger jump to given location
MOV BX, [SI] ; If no. in BX is smaller, save in BX the larger no.
XOR DX, DX ; This is just to reset the Carry Flag for next time
NOT_GREATER:
DEC CX ; Decrement CX
JNZBEGIN ; If CX is not zero then repeat comparison for next no. in the array
MOV LARGEST_NO, BX ;IfCX=0, all nos. in array are compared. Store result which is in BX to
memory
HLT ; Stop

CODE_SEG ENDS

DATA_SEG SEGMENT

NUM_ARRAY DW 839AH, 0ED23H, 1ACCH, 778FH, 4100H, 2547H ;Store the 16-bit no.
array here
ARR_SIZE EQU 6 ; Define array size as no. of items in the array
LARGEST_NO DW 0 ; Reserve two consecutive locations for result
DATA_SEG ENDS
END

SIMULATION RESULT for Experiment - 5:

14
15
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Experiment – 6
AIM: To write and simulate 8086 ALP to arrange an array of unsigned 16 – bit nos. in Data Segment in
ascending order.

DESCRIPTION: Arranging given array of data items in a specific order needs a Sorting Algorithm to be
implemented, for ex. Merge Sort, Insertion Sort, Quick Sort etc., with the computer language being used. The
following program implements the Bubble Sort algorithm in the 8086 Assembly Language for arranging the
given array in ascending order.In this, starting with the first two nos., compare them and put the larger of them
at the second position. Then compare 2nd and 3rd nos. and put the larger one at 3rd position, compare 3rd and 4th
nos. and put larger at 4th place and so on. For N nos. do this for (N-1) times. Here at the end of 1st iteration the
largest no. is at the last place. Now again start with first two nos.: compare and exchange if needed. This time
do this for (N-2) times. In third iteration, do this for (N-3) times. Thus in Mth iteration we have to compare and
exchange (M-1) times. Perform (N-1) such iterations in a loop fashion and in (N-1)th iteration, do this for [(N-1)
– (N-1-1)] = 1 times. Here the array is arranged as desired.

CODING:
ASSUME CS: CODE_SEG, DS: DATA_SEG

CODE_SEG SEGMENT
MOV AX, DAT_SEG ; Load AX with initialization value for Data Segment register
MOV DS, AX ; Initialize the DS register
MOV DX, (N-1) ; Load DX with no. of iterations to be performed
INNER_LOOP:
MOV CX, DX ; Load CX with no. of compare and exchanges in this iteration
MOV SI, OFFSET NUM_ARRAY ; Load Source Index with the offset of first no. in array
BEGIN:
MOV AX, [SI] ; Load AX with the 16 – bit no. pointed by SI
INC SI ; Increment SI twice to point to the next 16 - bit no. Twice because each
INC SI ; memory location is 8 – bit and so a 16 – bit no. takes two consecutive locations
CMP AX, [SI] ; Compare AX with next no. in the array, pointedby SI
JCNO_EXCHANGE ; If AX is smaller, jump to given location
XCHG AX, [SI] ; If AX is larger, exchange it with the next no. of array
MOV [SI-2], AX ; Store AX to the previous position of the array. Thus swapping the nos.
of array.
NO_EXCHANGE:
- - - - -
- - - - -
XOR BX, BX ;This is just to reset the Carry Flag for next time
DEC CX ; Decrement CX
JNZ BEGIN ; If CX is not zero then repeat the compare and exchange operation again
DEC DX ; If CX=0 one iteration is over. Decrement DX.
JNZ INNER_LOOP ; If DX≠zero, repeat the loop of successive compare and exchange operations
HLT ; If DX=0, all iterations are complete and the array is arranged. Stop.
CODE_SEG ENDS

DATA_SEG SEGMENT

16
NUM_ARRAY DW 839AH, 0ED23H, 1ACCH, 778FH, 4100H, 2547H ; Store the 16-bit no.
array here
N EQU 6 ; Define N as no. of items in the array
DATA_SEG ENDS
END

SIMULATION RESULT for Experiment - 6:

17
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Experiment – 7
AIM: To write and simulate 8086 ALP to find no. of even and odd nos. from an array of signed/unsigned 16 –
bit nos. residing in Data Segment.

DESCRIPTION:To check if a binary no. is even or odd, its enough to check its LSB. If LSB is 0 the no. is
even; if 1 the no. is odd. In the following program, we put aside two memory locations for holding the no. of
even and odd nos. and name them EVN_NOS and ODD_NOS resp. and initialize them to zero.We check the
LSB of each no. in the array by rotating it right through the Carry Flag (CF). If CF=0 we increment the
locationEVEN_NOS; if CF=1 we increment the location ODD_NOS.This is done for all nos. in a loop fashion.
The same logic can be used to find the no. of positive and negative nos. from a signed array of nos. The
only difference is to check the MSB, instead of LSB, by rotating left, instead of right, through carry.

CODING:

ASSUME CS: CODE_SEG, DS: DATA_SEG

CODE_SEG SEGMENT
MOV AX, DAT_SEG ; Load AX with initialization value for Data Segment register
MOV DS, AX ; Initialize the DS register
MOV SI, OFFSET NUM_ARRAY ; Load Source Index with the offset of first no. in array
MOV CX, ARR_SIZE ; Load array size in Counter reg.
BEGIN:
MOV AX, [SI] ; Load AX with the 16 – bit no. pointed by SI
INC SI ; Increment SI twice to point to the next 16 - bit no. Twice because each
INC SI ; memory location is 8 – bit and so a 16 – bit no. takes two consecutive locations
ROR AX, 1 ; Rotate 1 time through CF the no. in AX
JC NO_IS_ODD ; If CF is set (its an odd no.) then jump to the given location
INC EVN_NOS ; If CF is reset (its an even no.) then increment the location EVN_NOS
JMP CONTINUE ; Bypass the instruction to increment the location ODD_NOS
NO_IS_ODD:
INC ODD_NOS ; Increment the location ODD_NOS
CONTINUE:
DEC CX ; Decrement CX
JNZ BEGIN ; If CX is not zero then repeat the same procedure for next no.
HLT ; If CX is zero, stop
- - - - -
- - - - -
CODE_SEG ENDS

DATA_SEG SEGMENT
NUM_ARRAY DW 839AH, 0ED23H, 1ACCH, 778FH, 4100H, 2547H, 0D691H
; Store the 16-bit no. array here

ARR_SIZE EQU 7 ; Define ARR_SIZE as no. of items in the array


EVN_NOS DB 0 ; Location reserved for holding no. of even nos.
ODD_NOS DB 0 ; Location reserved for holding no. of odd nos.
DATA_SEG ENDS
18
END

SIMULATION RESULT for Experiment - 7:

19
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Experiment – 8
AIM: To move a given block of data containing 12 bytes stored in Data Segment to another set of 12
consecutive locations.

DESCRIPTION:Here we first load the offset of first data byte of given array in Source Index register and the
offset of the first destination location in the Destination Index register. Then using the indexed addressing mode
we transfer required no. of data bytes in a loop fashion.

CODING:

ASSUME CS: CODE_SEG

CODE_SEG SEGMENT
MOV AX, DAT_SEG ; Load AX with initialization value for Data Segment register
MOV DS, AX ; Initialize the DS register
MOV SI, OFFSET SOURCE_ARRAY; Load Source Index with the offset of first byte in the given block
MOV DI, OFFSET DESTN_ARRAY; Load Destination Index with the offset of firstdestinationlocation
MOV CX, BLOCK_SIZE ; Load block size in Counter reg.
REPEAT:
MOV AL, [SI] ; Load the byte, pointed by SI, in AL
INC SI ; Increment SI for next time
MOV [DI], AL ; Store the byte in AL at the location pointed by DI
INC DI ; Increment DI for next time
DEC CX ; Decrement CX
JNZ REPEAT ; If CX is not zero then repeat the same procedure for next byte
HLT ; If CX is zero, stop
CODE_SEG ENDS

DATA_SEG SEGMENT
SOURCE_ARRAY DB 12H, 32H, 6DH, 0A2H, 3EH, 49H, 0B5H,5AH, 0C7H, 81H, 68H, 4EH
; Given data bytes are stored here
DESTN_ARRAY DB 12DUP(0) ; The given bytes will be moved here
BLOCK_SIZE EQU 12 ; Define block size as no. of bytes in the given block of data

DATA_SEG ENDS
END

20
SIMULATION RESULT for Experiment - 8:

21
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Experiment – 9
AIM: To write a program to blink LEDs connected at Port - 1 of 8051 with a nominal delay of about 1 sec.

CODING:

$MOD51

ORG 0000H
BEGIN:
MOV P1, #00H
ACALL DELAY
MOV P1, #0FFH
ACALL DELAY
SMP BEGIN

DELAY:
MOV R0, #255
LOOP1:
MOV R1, #255
LOOP2:
MOV R2, #4
LOOP3:
DJNZ R2, LOOP3
DJNZ R1, LOOP2
DJNZ R0, LOOP1
RET

END

22
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Experiment – 10
AIM: Interfacing of 8051 to ADC0804: draw a simple circuit schematic and write a program to read analog
data from ADC and display it on LEDs connected at Port – 2.

CODING:

$MOD51

ADC_RD BIT P2.5


ADC_WR BIT P2.6
INTR BIT P2.7
ADC EQU P1
LEDS EQU P2

ORG 0000H
INITIALIZATIONS:
MOV ADC, #0FFH
SETB INTR

REPEAT:
SETB ADC_RD
CLR ADC_WR
SETB ADC_WR
WAIT:
JB INTR, WAIT
CLR ADC_RD
MOV A, ADC
MOV LEDS, A
SJMP REPEAT

END

23
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Experiment – 11
AIM: Interfacing of 8051 to Stepper Motor: draw a simple circuit schematic and write a program to rotate the
motor constantly in any one direction.

CODING:

$MOD51

STEPPER EQU P1

ORG 0000H
MOV A, #0CCH
AGAIN:
MOV P1, A
RR A
ACALL DELAY
SJMP AGAIN

DELAY:
MOV R0, #100
LOOP1:
MOV R1, #200
LOOP2:
DJNZ R1, LOOP2
DJNZ R0, LOOP1
RET

END

24
INDORE INSTITUTE OF SCIENCE AND TECHNOLOGY
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

Experiment – 12
AIM: Interfacing of 8051 to 16x2 Alphanumeric LCD Display: draw a simple circuit schematic and write a
program to display “Hi! I am 8051”.

CODING:
$MOD51

LCD EQU P1
RS BIT P2.0
RW BIT P2.1
E BIT P2.2

ORG 0000H
CLR RS
MOV A, #38H
ACALL SEND
MOV A, #0EH
ACALL SEND
SETB RS
MOV DPTR, #MESSAGE
NEXT:
CLR A
MOVC A, @A+DPTR
JZ OVER
ACALL SEND
SJMP NEXT
OVER:
SJMP OVER
SEND:
MOV LCD, A
CLR RW
SETB E
ACALL DELAY
- - - - -
- - - - -
CLR E
S RET
DELAY:
MOV R0, #100
25
LOOP1:
MOV R1, #200
LOOP2:
DJNZ R1, LOOP2
DJNZ R0, LOOP1
RET
MESSAGE: DB ‘Hi! I am 8051’, 0

END

Write the following questions answering.

26
1. Write a short note on the is assembly language programming?
2. What are the instruction set used in 8086 microprocessors (explain in details)?
3. What is addressing mode? Explain the addressing modes used in 8086 microprocessors (explain
in details with example)?
4. Difference between 8086 and 8051.
5. Draw the block diagram and its pin diagram of 8086.
6. Draw the block diagram and its pin diagram of 8051.
7. Explain the USART and DMA Controller.

27

You might also like