Professional Documents
Culture Documents
MPMC Manual
MPMC Manual
AIM:
To know the general information ,hardware and software details of 8086 microprocessor
trainer kit
HARDWARE SPECIFICATION:
CPU processor and clock frequency :
INTEL 8086/8088 CPU operator at 5/4.7 MHZ clock rate (optionally 8 MHZ)
MEMORY:
PERIPERALS:
RES:
Res causes the processor to immediately terminate its present activity. To be recognised, the signal
must be active high for at least four clock cycles, except after power-on which requires a 50
Micro Sec. pulse. It causes the 8086 to initialize registers DS, SS, ES, IP and flags to all
zeros. It also initializes CS to FFFF H. Upon removal of the RESET signal from the RESET
pin, the 8086 will fetch its next instruction from the 20 bit physical address FFFF0H.
REG NO:212214106291
INT:
INT is an assembly language instruction for x86 processors that generate a software interrupt.
The cpu generates clock signal from the clock generator (8284) which uses a crystal at 15 or 14.318
or 24 MHz .the reset interrupt lines and the data lines are also input to the cpu the cpu outputs
comprises the address lines, data lines and control lines.
The 8086/8088 has an internal 20-bit address bus and 16-bit data bus. Externally, the address bus is
20-bits, and the data bus is 16-bits for the 8086 and 8-bits for the 8088.
The data bus in the 8086 is 16 bits in size, while the address bus is 20. The data bus
is multiplexed with the address bus in order to fit all of the control lines into a standard 40-pin dual
in-line package. It provides a 16-bit I/O address bus, supporting 64 KB of separate I/O space. The
maximum linear address space is limited to 64 KB, simply because internal address/index registers
are only 16 bits wide.
CONTROL BUS:
The control pins, which carry essential signals for all external operations, have more than one
function depending upon whether the device is operated in min or max mode. The former mode was
intended for small single-processor systems, while the latter was for medium or large systems using
more than one processor.
Chip select (CS) or slave select (SS) is the name of a control line in digital electronics used to
select one chip (or set of chips) out of several connected to the same computer bus usually
utilizing the three-state logic.
One bus that uses the chip/slave select is the Serial Peripheral Interface Bus.
When an engineer needs to connect several devices to the same set of input wires (e.g., a
computer bus), but retain the ability to send and receive data or commands to each device
independently of the others on the bus, they can use a chip select. The chip select is a command
pin on many integrated circuits which connects the I/O pins on the device to the internal circuitry
of that device.
ARCHITECTURE OF 8086:
The microprocessors functions as the CPU in the stored program model of the digital computer.
Its job is to generate all system timing signals and synchronize the transfer of data between
memory, I/O, and itself. It accomplishes this task via the three-bus system architecture
previously discussed.
REG NO:212214106291
The microprocessor also has a S/W function. It must recognize, decode, and execute
program instructions fetched from the memory unit. This requires an Arithmetic-Logic Unit
(ALU) within the CPU to perform arithmetic and logical (AND, OR, NOT, compare, etc)
functions.
The 8086 CPU is organized as two separate processors, called the Bus Interface Unit (BIU) and
the Execution Unit (EU). The BIU provides H/W functions, including generation of the memory
and I/O addresses for the transfer of data between the outside world -outside the CPU, that is-
and the EU.
The EU receives program instruction codes and data from the BIU, executes these instructions,
and store the results in the general registers. By passing the data back to the BIU, data can also
be stored in a memory location or written to an output device. Note that the EU has no
connection to the system buses. It receives and outputs all its data thru the BIU.
The EU receives program instruction codes and data from the BIU, executes these instructions,
and store the results in the general registers. By passing the data back to the BIU, data can
also be stored in a memory location or written to an output device. Note that the EU has no
connection to the system buses. It receives and outputs all its data through the BIU.
Stack pointer and base pointer are the two pointer registers whereas the Source index and
Destination index are the index group of registers.
They are primarily used to store relative to segment registers the locations of offset addresses of
memory locations. They serve the purpose of being memory pointers.
The source index and destination index are also used as general purpose register. In such cases
the SI and DI are implemented as source and destination index registers
In stacks, data areas might exist, to be able to access such data which contains the BP register.
REG NO:212214106291
FLAG REGISTERS:
Active flag:- There are nine active flags out of 16, in the 8086 flag register. The remaining
are undefined flag.
Control Flag:- Out of nine active flags, six are conditional flags and the remaining three are
called as the control flag. The three control flags are:
stepping microprocessor executes a instruction and enters into single step ISR.
ARCHITECTURE OF 8086
RESULT:
DATE:
AIM:
To write and execute Assembly language Program to perform arithmetic operations for
8086 microprocessor
(i)DIRECT METHOD:
ALGORITHM:
PROGRAM :
A) By using MASM
CODE SEGMENT
ASSUME CS: CODE,DS:CODE
ORG 1000H
MOV CL,00H
MOV AX,1234H
MOV BX,1234H
ADD AX,BX
JNC LOOP
INC CL
LOOP: MOV SI,1200H
MOV [SI],AX
MOV [SI+2],CL
REG NO:212214106291
MOV AH,4CH
INT 21H
CODE ENDS
END
ALGORITHM:
PROGRAM
CODE SEGMENT
ASSUME CS: CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV CL,00H
MOV AX,[SI]
MOV BX,[SI+02H]
ADD AX,BX
JNC LOOP
INC CL
LOOP:
MOV [SI+04H],AX
MOV [SI+06H],CL
MOV AH,4CH
INT 21H
CODE ENDS
END
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
B) SUBTRACTION:
(i)DIRECT METHOD:
ALGORITHM:
PROGRAM
ALGORITHM:
Step I : Initialize the memory location and store the 1st data.
Step II : Increment the content of AL and get the 2nd data.
Step III : Move the 2nd data in accumulator.
Step IV : Subtract the content of memory and store the result.
PROGRAM
A)By using MASM
CODE SEGMENT
ASSUME CS: CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV CL,00H
MOV AX,[SI]
MOV BX,[SI+02H]
SUB AX,BX
JNC LOOP
INC CL
LOOP:
MOV [SI+04H],AX
MOV [SI+06H],CL
MOV AH,4CH
INT 21H
CODE ENDS
END
REG NO:212214106291
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
REG NO:212214106291
C) MULTIPLICATION
(i)DIRECT METHOD:
ALGORITHM:
Step I : Move the first number into the accumulator.
Step II : Increment the content of register pair.
Step III : Multiply both the data.
Step IV : Store the result in memory location.
PROGRAM
LOCATION
1000 B8 12 34 MOV AX,1234H
1003 BB 12 34 MOV BX, 1234H
1006 F7 E3 MUL BX
1008 BE 12 00 MOV SI,1200H
100B 89 04 MOV [SI],AX
100D F4 HLT
ALGORITHM:
PROGRAM
DIV INSTRUCTION
REG NO:212214106291
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
D)DIVISION:
(i)DIRECT METHOD:
ALGORITHM:
PROGRAM
END
ALGORITHM:
PROGRAM
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
RESULT :
Thus the Assembly language Program to perform arithmetic operations both direct and
indirect in 8086 microprocessor is written and executed both in MASM software and 8086 kit.
LOGICAL OPERATIONS USING 8086 MICROPROCESSOR
EX NO:
REG NO:212214106291
DATE:
AIM:
To write and execute Assembly language Program to perform logical operations for
8086 microprocessor
ALGORITHM:
PROGRAM :
A)By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AL,68H
MOV CL,04H
ROR AL,CL
MOV SI,2000H
MOV [SI],AL
MOV AH,4CH
INT 21H
CODE ENDS
END
INDIRECT METHOD:
ALGORITHM:
Step I : Initialize the memory location for 1st data in HL register.
Step II : Store 1st data in memory location.
Step III : Increment the content of HL register for entering data in
memory location.
Step IV : Store second data in memory location.
Step V : Move 2nd number in accumulator.
Step VI : Decrease the content of HL register pair.
Step VII : Rotate right the content of memory with accumulator.
Step VIII : Store the result in memory location.
Step IX : Stop.
PROGRAM:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV AX,[SI]
MOV BX,[SI+02H]
ROR AX,BX
MOV [SI+04H],AX
MOV AH,4CH
INT 21H
CODE ENDS
END
ALGORITHM:
PROGRAM
A)By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AL,68H
MOV CL,04H
ROL AL,CL
MOV SI,2000H
MOV [SI],AL
MOV AH,4CH
INT 21H
CODE ENDS
END
INDIRECT METHOD:
ALGORITHM:
Step I : Initialize the memory location for 1st data in HL register.
Step II : Store 1st data in memory location.
Step III : Increment the content of HL register for entering data in
memory location.
Step IV : Store second data in memory location.
Step V : Move 2nd number in accumulator.
Step VI : Decrease the content of HL register pair.
Step VII : Rotate left the content of memory with accumulator.
Step VIII : Store the result in memory location.
Step IX : Stop.
PROGRAM:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV AX,[SI]
MOV BX,[SI+02H]
ROL AX,BX
MOV [SI+04H],AX
MOV AH,4CH
INT 21H
CODE ENDS
END
ALGORITHM:
PROGRAM :
A)By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AL,68H
MOV CL,04H
SHR AL,CL
MOV SI,2000H
MOV [SI],AL
MOV AH,4CH
INT 21H
CODE ENDS
END
INDIRECT METHOD:
ALGORITHM:
Step I : Initialize the memory location for 1st data in HL register
Step II : Store 1st data in memory location.
Step III : Increment the content of HL register for entering data in
memory location.
Step IV : Store second data in memory location.
Step V : Move 2nd number in accumulator.
Step VI : Decrease the content of HL register pair.
Step VII : Shift right the content of memory with accumulator.
Step VIII : Store the result in memory location.
Step IX : Stop.
PROGRAM:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV AX,[SI]
MOV BX,[SI+02H]
SHR AX,BX
MOV [SI+04H],AX
MOV AH,4CH
INT 21H
CODE ENDS
END
PROGRAM
INDIRECT METHOD:
ALGORITHM:
Step I : Initialize the memory location for 1st data in HL register
Step II : Store 1st data in memory location.
Step III : Increment the content of HL register for entering data in
memory location.
Step IV : Store second data in memory location.
Step V : Move 2nd number in accumulator.
Step VI : Decrease the content of HL register pair.
Step VII : shift left the content of memory with accumulator.
Step VIII : Store the result in memory location.
Step IX : Stop.
PROGRAM:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV AX,[SI]
MOV BX,[SI+02H]
SHL AX,BX
MOV [SI+04H],AX
MOV AH,4CH
INT 21H
CODE ENDS
END
(v)AND:(DIRECT METHOD)
ALGORITHM:
PROGRAM
A)By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AX,68H
MOV CX,04H
AND AX,CX
MOV SI,2000H
MOV [SI],AX
MOV AH,4CH
INT 21H
CODE ENDS
END
REG NO:212214106291
INDIRECT METHOD:
ALGORITHM:
Step I : Initialize the memory location for 1st data in HL register
Step II : Store 1st data in memory location.
Step III : Increment the content of HL register for entering data in
memory location.
Step IV : Store second data in memory location.
Step V : Move 2nd number in accumulator.
Step VI : Decrease the content of HL register pair.
Step VII : AND the content of memory with accumulator.
Step VIII : Store the result in memory location.
Step IX : Stop.
PROGRAM:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV AX,[SI]
MOV BX,[SI+02H]
AND AX,BX
MOV [SI+04H],AX
MOV AH,4CH
INT 21H
CODE ENDS
END
REG NO:212214106291
(vi)OR:(DIRECT METHOD)
ALGORITHM:
PROGRAM
A)By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AX,68H
MOV CX,04H
OR AX,CX
MOV SI,2000H
MOV [SI],AX
MOV AH,4CH
INT 21H
CODE ENDS
REG NO:212214106291
END
B)By using 8086 kit:
INDIRECT METHOD:
ALGORITHM:
Step I : Initialize the memory location for 1st data in HL register
Step II : Store 1st data in memory location.
Step III : Increment the content of HL register for entering data in
memory location.
Step IV : Store second data in memory location.
Step V : Move 2nd number in accumulator.
Step VI : Decrease the content of HL register pair.
Step VII : OR the content of memory with accumulator.
Step VIII : Store the result in memory location.
Step IX : Stop.
PROGRAM:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV AX,[SI]
MOV BX,[SI+02H]
OR AX,BX
MOV [SI+04H],AX
MOV AH,4CH
INT 21H
CODE ENDS
END
REG NO:212214106291
(vii)XOR:(DIRECT METHOD)
ALGORITHM:
PROGRAM
A)By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AX,68H
MOV CX,04H
XOR AX,CX
MOV SI,2000H
MOV [SI],AX
MOV AH,4CH
INT 21H
CODE ENDS
REG NO:212214106291
END
INDIRECT METHOD:
ALGORITHM:
Step I : Initialize the memory location for 1st data in HL register
Step II : Store 1st data in memory location.
Step III : Increment the content of HL register for entering data in
memory location.
Step IV : Store second data in memory location.
Step V : Move 2nd number in accumulator.
Step VI : Decrease the content of HL register pair.
Step VII : XOR the content of memory with accumulator.
Step VIII : Store the result in memory location.
Step IX : Stop.
PROGRAM:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV AX,[SI]
MOV BX,[SI+02H]
XOR AX,BX
MOV [SI+04H],AX
MOV AH,4CH
INT 21H
CODE ENDS
END
REG NO:212214106291
(viii)NOT:(DIRECT METHOD)
ALGORITHM:
INDIRECT METHOD:
ALGORITHM:
Step I : Initialize the memory location for 1st data in HL register
Step II : Store 1st data in memory location.
Step III : Increment the content of HL register for entering data in
memory location.
Step IV : NOT the content of memory with accumulator.
Step V : Store the result in memory location.
Step VI : Stop.
PROGRAM:
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV AX,[SI]
NOT AX
MOV [SI+02H],AX
MOV AH,4CH
INT 21H
CODE ENDS
END
1004 F7 D0 NOT AX
1006 89 44 02 MOV [SI+02H],AX
1009 F4 HLT
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
OUTPUT FOR OR
BY USING MASM SOFTWARE
REG NO:212214106291
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
RESULT :
REG NO:212214106291
DATE:
AIM:
To write and execute Assembly language Program to perform BCD addition for 8086
microprocessor
APPARATUS REQUIRED:
ALGORITHM:
PROGRAM :
C) By using MASM
REG NO:212214106291
CODE SEGMENT
ASSUME CS: CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV CL,00H
MOV AX,[SI]
MOV BX,[SI+2]
ADD AL,BL
DAA
MOV DL,AL
MOV AL,AH
ADC AL,BH
DAA
MOV DH,AL
JNC AHEAD
INC CL
AHEAD:MOV[SI+4],DX
MOV[SI+6],CL
MOV AH,4CH
INT 21H
CODE ENDS
END
1013 27 DAA
REG NO:212214106291
1016 73 00 JNC D
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
REG NO:212214106291
RESULT :
Thus the Assembly language Program to perform BCD addition in 8086
microprocessor is written and executed in MASM software and 8086 kit.
ARITHMETIC OPERATIONS OF TWO N*N MATRICES
EX NO:
DATE:
AIM:
To write and execute Assembly language Program to perform arithmetic operations of
two n*n matrices for 8086 microprocessor
ALGORITHM:
PROGRAM
A) By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,1500H
MOV BX,0050H
MOV DI,1600H
MOV CL,04H
L2:MOV CH,00H
MOV AX,[SI+BX]
ADD AX,[SI]
JNC L1
INC CH
L1:MOV [DI],AX
ADD DI,02H
MOV [DI],CH
INC DI
ADD SI,02H
REG NO:212214106291
DEC CL
JNZ L2
MOV AH,4CH
INT 21H
CODE ENDS
END
FLOWCHART:
REG NO:212214106291
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
REG NO:212214106291
ALGORITHM:
PROGRAM
A) By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,1500H
MOV BX,0050H
MOV DI,1600H
MOV CL,04H
L2:MOV CH,00H
MOV AX,[SI+BX]
SUB AX,[SI]
JNC L1
INC CH
L1:MOV [DI],AX
ADD DI,02H
MOV [DI],CH
INC DI
ADD SI,02H
DEC CL
JNZ L2
MOV AH,4CH
INT 21H
CODE ENDS
END
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
RESULT:
REG NO:212214106291
Thus the Assembly language Program to perform arithmetic operations of two n*n matrices for
8086 microprocessor is written and executed both in MASM software and 8086 microprocessor
kit.
CODE CONVERSIONS
EX NO:
DATE:
AIM:
To write and execute Assembly language Program to code conversions for 8086
microprocessor
AlGORITHM:
MOV [SI],BX
MOV AH,4CH
INT 21H
CODE ENDS
END
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
AlGORITHM:
PROGRAM
A)By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AX,45H
MOV AH,AL
MOV CL,4H
SHR AH,CL
AND AX,0F0FH
MOV SI,1200H
MOV [SI],AX
MOV AH,4CH
INT 21H
CODE ENDS
END
REG NO:212214106291
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
REG NO:212214106291
RESULT:
Thus the Assembly language Program to perform code conversions for 8086 microprocessor is
written and executed both in MASM software and 8086 microprocessor kit.
DATE:
AIM:
To write and execute Assembly language Program to sort the given numbers in ascending
and descending order for 8086 microprocessor
APPARATUS REQUIRED:
8086 microprocessor kit
Personal computer with MASM software
MEMORY
OP CODE LABEL MNEMONIC
LOCATION
1000 B3 00 MOV BL,00H
1002 BE 2000 GO2 MOV SI,2000H
1005 8B 0C MOV CX,[SI]
1007 46 INC SI
1008 46 INC SI
1009 49 DEC CX
100A 8B 04 GO1 MOV AX,[SI]
REG NO:212214106291
MEMORY
OP CODE LABEL MNEMONIC
LOCATION
1000 B3 00 MOV BL,00H
1002 BE 2000 GO2 MOV SI,2000H
1005 8B 0C MOV CX,[SI]
1007 46 INC SI
1008 46 INC SI
1009 49 DEC CX
100A 8B 04 GO1 MOV AX,[SI]
100C 3B 44 02 CMP AX,[SI+02H]
100F 73 07 JNC GO(1018)
1011 87 44 02 XCHG AX,[SI+02H]
1014 89 04 MOV [SI], AX
1016 B3 00 MOV BL,01H
1018 83 C6 02 GO ADD SI,02H
101B E2 ED LOOP GO1(100A)
101D FE CB DEC BL
101F 74 E1 JZ GO2(1002)
1021 F4 HLT
REG NO:212214106291
FLOWCHART:
ASCENDING ORDER:
REG NO:212214106291
DESCENDING ORDER:
REG NO:212214106291
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
REG NO:212214106291
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
REG NO:212214106291
RESULT :
Thus the Assembly language Program to sort the given numbers in ascending and descending
order for 8086 microprocessor is written and executed both in MASM software and 8086
microprocessor kit.
SEARCHING FOR A NUMBER OR CHARACTER IN A STRING FOR
8086 MICROPROCESSOR
EX NO:
DATE:
AIM:
To write and execute Assembly language Program to search a number or character from a
string for 8086 Microprocessor
ALGORITHM:
PROGRAM
A) By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,2000H
MOV DI,2100H
MOV DL,[DI]
MOV BL,01H
MOV AL,[SI]
GO1:CMP AL,DL
JZ GO
INC SI
INC BL
MOV AL,[SI]
CMP AL,DL
JNZ GO1
GO:MOV [DI+01H],BL
MOV [DI+02H],SI
MOV AH,4CH
INT 21H
CODE ENDS
END
B) By using 8086 kit
FLOWCHART:
REG NO:212214106291
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
RESULT :
REG NO:212214106291
Thus the Assembly language Program to searching for a number or character in a string for 8086
microprocessor is written and executed both in MASM software and 8086 microprocessor kit.
DATE:
AIM:
To write and execute Assembly language Program for string manipulation using 8086
Microprocessor
ALGORITHM:
Step : Load the source and destination index register with starting
and the ending address respectively
Step II : Initialize the counter with the total number of words to be
copied.
Step III : Clear the direction flag for auto incrementing mode of
transfer.
Step IV : Use the string manipulation instruction SCASW with the
prefix REP to search a word from string.
Step V : If a match is found (z=1), display 01 in destination address.
Otherwise, display 00 in destination address
PROGRAM
A) By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV AH,09H
MOV DX,1200H
INT 21H
MOV AH,4CH
INT 21H
ORG 1200H
REG NO:212214106291
DB “MICROPROCESSOR$”
CODE ENDS
END
Flowchart:
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
REG NO:212214106291
RESULT :
Thus the Assembly language Program to perform string manipulation using 8086
Microprocessor is written and executed both in MASM software and 8086 microprocessor kit.
DATE:
AIM:
To write and execute Assembly language Program to implement moving block of data
for 8086 microprocessor
ALGORITHM :
PROGRAM
A) By using MASM
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 1000H
MOV SI,1400H
MOV CL,[SI]
MOV SI,1500H
MOV DI,1600H
LI: MOV AX,[SI]
MOV [DI] ,AX
ADD SI,02H
ADD DI,02H
DEC CL
JNZ LI
MOV AH,4CH
INT 21H
CODE ENDS
REG NO:212214106291
END
FLOWCHART:
REG NO:212214106291
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
REG NO:212214106291
RESULT:
Thus the Assembly language Program to implement moving block of data for 8086
microprocessor is written and executed both in MASM software and 8086 microprocessor kit.
EX NO:
DATE:
AIM:
To write an assembly language program to convert an analog signal into a digital signal using an
ADC interfacing.
APPARATUS REQUIRED:
PROBLEM STATEMENT:
The program is executed for various values of analog voltage which are set with the help of
a potentiometer. The LED display is verified with the digital value that is stored in a
memory location.
THEORY:
REG NO:212214106291
An ADC usually has two additional control lines: the SOC input to tell the ADC when to
start the conversion and the EOC output to announce when the conversion is complete. The
following program initiates the conversion process, checks the EOC pin of ADC 0809 as to
whether the conversion is over and then inputs the data to the processor. It also instructs
the processor to store the converted digital data at RAM location.
ALGORITHM:
FLOW CHART:
NO
YES
REG NO:212214106291
Output
PROGRAM TABLE
LOCATION
RESULT:
Thus the ADC was interfaced with 8086 and the given analog inputs were converted into its
digital equivalent.
AIM :
APPARATUS REQUIRED:
PROBLEM STATEMENT:
The program is executed for various digital values and equivalent analog voltages
are measured and also the waveforms are measured at the output ports using CRO.
THEORY:
Since DAC 0800 is an 8 bit DAC and the output voltage variation is between –5v and
+5v. The output voltage varies in steps of 10/256 = 0.04 (approximately). The digital data input
and the corresponding output voltages are presented in the table. The basic idea behind the
generation of waveforms is the continuous generation of analog output of DAC. With 00 (Hex)
as input to DAC2 the analog output is –5v. Similarly with FF H as input, the output is +5v.
Outputting digital data 00 and FF at regular intervals, to DAC2, results in a square wave of
REG NO:212214106291
amplitude 5v.Output digital data from 00 to FF in constant steps of 01 to DAC2. Repeat this
sequence again and again. As a result a saw-tooth wave will be generated at DAC2 output.
Output digital data from 00 to FF in constant steps of 01 to DAC2.Output digital data from FF to
00 in constant steps of 01 to DAC2. Repeat this sequence again and again. As a result a
triangular wave will be generated at DAC2 output.
ALGORITHM:
Measurement of analog voltage:
Waveform generation:
Square Waveform:
Saw-tooth waveform:
Step IV : Repeat step (ii) and (iii) until accumulator value reaches FF.
FLOWCHART:
SAWTOOTH WAVEFORM
YES
NO
LOCATION
LOCATION
OUTPUT:
WAVEFORM GENERATION:
Square Waveform
Saw-tooth waveform
REG NO:212214106291
MODEL GRAPH:
RESULT:
Thus the DAC was interfaced with 8086 and different waveforms have been generated.
EX NO:
DATE:
AIM:
To write an assembly language program in 8086 to rotate the motor at different speeds.
APPARATUS REQUIRED:
4. Stepper Motor - 1
PROBLEM STATEMENT:
Write a code for achieving a specific angle of rotation in a given time and particular
number of rotations in a specific time.
THEORY:
A motor in which the rotor is able to assume only discrete stationary angular position is a
stepper motor. The rotary motion occurs in a stepwise manner from one equilibrium position to
REG NO:212214106291
the next. Two-phase scheme: Any two adjacent stator windings are energized. There are two
magnetic fields active in quadrature and none of the rotor pole faces can be in direct alignment
with the stator poles. A partial but symmetric alignment of the rotor poles is of course possible.
ALGORITHM:
Step III : Drive the stepper motor circuitry and introduce delay
Step IV : Decrement the counter is not zero repeat from step(iii)
Step V : Repeat the above procedure both for backward and forward directions.
MEMORY A1 A2 B1 B2 HEX
LOCA CO
TION DE
4500 1 0 0 0 09 H
4501 0 1 0 1 05 H
4502 0 1 1 0 06 H
4503 1 0 1 0 0A H
REG NO:212214106291
FLOWCHART:
YES
NO
REG NO:212214106291
PROGRAM TABLE
1011 75 FD JNZ L1
RESULT:
Thus the assembly language program for rotating stepper motor in both clockwise and
anticlockwise directions is written and verified
REG NO:212214106291
DATE:
AIM :
APPARATUS REQUIRED:
4. CRO - 1
THEORY:
ALGORITHM:
Mode 2-
Mode 3-
PORT ADDRESS :
1. CONTROL REGISTER –
2. COUNTER OF CHANNEL 0 -
3. COUNTER OF CHANNEL 1 -
4. COUNTER OF CHANNEL 2 -
5. O/P PORT OF CHANNEL 0 -
6. O/P PORT OF CHANNEL 1 -
7. O/P PORT OF CHANNEL 2 -
REG NO:212214106291
D7 D6 D5 D4 D3 D2 D1 D0
0 0 1 1 0 1 0 0
Mode 2 = 34 H
0 0 1 1 0 1 1 0
Mode 3 = 36 H
0 0 CHANNEL 0 0 0 LATCH
0 1 CHANNEL 1 0 1 LSB
1 0 CHANNEL 2 1 0 MSB
M2 M1 M0 MODE
0 0 0 MODE 0
0 0 1 MODE 1
0 1 0 MODE 2
0 1 1 MODE 3
REG NO:212214106291
1 0 0 MODE 4
1 0 1 MODE 5
2 CLK 1
3 CLK 2
4 OUT 0
5 OUT 1
6 OUT 2
7 GATE 0
8 GATE 1
9 GATE 2
10 GND
REG NO:212214106291
MODEL GRAPH:
FLOW CHART
INITIALIZE ACCUMULATOR
WITH MODE SET WORD
RESULT:
Thus an ALP for square wave generator are written and executed.
REG NO:212214106291
APPARATUS REQUIRED:
8086 kit (2 Nos), RS232 cable.
THEORY:
The 8251 is used as a peripheral device for serial communication and is programmed by
the CPU to operate using virtually any serial data transmission technique. The USART accepts
data characters from the CPU in parallel format and then converts them into a continuous serial
data stream for transmission. Simultaneously, it can receive serial data streams and convert them
into parallel data characters for the CPU. The CPU can read the status of the USART at any time.
These include data transmission errors and control signals. The control signals define the
complete functional definition of the 8251. Control words should be written into the control
register of 8251.These control words are split into two formats: 1) Mode instruction word & 2)
Command instruction word. Status word format is used to examine the error during functional
operation.
1...transmit enable
1...data terminal ready
1... receive enable
1... send break character
1.... reset error flags (pe,oe,fe)
1..... request to send (rts)
1...... internal reset
1....... enter hunt mode (enable search for sync characters)
REG NO:212214106291
1 ransmitter ready
1. receiver ready
1.. transmitter empty
1... parity error (pe)
1.... overrun error (oe)
1..... framing error (fe), async only
1...... sync detect, sync only
1....... data set ready (dsr)
REG NO:212214106291
ALGORITHM:
Step I : Initialize 8253 and 8251 to check the transmission and reception of a character
Step II : Initialize8253 to give an output of 150Khz at channel 0 which will give a 9600
baud rate of 8251.
Step III:The command word and mode word is written to the 8251 to set up for subsequent
operations
Step IV : The status word is read from the 8251 on completion of a serial I/O operation, or when
the host CPU is checking the status of the device before starting the next I/O operation
FLOW CHART:
REG NO:212214106291
RECEIVER END
RESULT:
Thus ALP for serial data communication using USART 8251 is written and the equivalent ASCII
41 for character ‘A’ is been transmitted & received.
REG NO:212214106291
DATE:
AIM:
APPARATUS REQUIRED:
8086 kit, 8255 interface kit.
ALGORITHM:
Mode 0
FLOWCHART
Mode 0
MODE 0
BSR mode
Bit set/reset, applicable to PC only. One bit is S/R at a time. Control word:
D7 D6 D5 D4 D3 D2 D1 D0
I/O mode
D7 D6 D5 D4 D3 D2 D1 D0
o 01 = mode1
o 1X = mode2
Mode 0
Input Output
REG NO:212214106291
RESULT:
The programs for interfacing 8255 with 8086 are executed & the output is obtained for modes 0.
REG NO:212214106291
EX NO:
DATE:
AIM:
APPARATUS REQUIRED:
ALGORITHM:
PROGRAM
RESULT:
Thus the program for Interfacing Traffic Light controller is written and successfully executed.
REG NO:212214106291
DATE:
AIM:
APPARATUS REQUIRED:
ALGORITHM:
PROCEDURE:
PROGRAM:
RESULT:
Thus the program for interfacing digital clock is written and successfully executed
REG NO:212214106291
DATE:
AIM:
A)ADDITION
ALGORITHM
PROGRAM :
A) By using8051 KIT
MOV A,P0
MOV R0,P1
MOV B,R0
ADD A,B
MOV P2,A
END
FLOW CHART:
Clear PSW
Select Register
Bank
Add A & R 0
OUTPUT
INPUT OUTPUT
4500 4502
4501 4503
B)SUBTRACTION
ALGORITHM:
PROGRAM
MOV A,P0
MOV R0,P1
MOV B,R0
ADD A,B
MOV P2,A
END
REG NO:212214106291
FLOWCHART:
CLEAR CARRY
FLAG
GET I’ST
OPERAN
D IN
ACCR
INCREMENT THE
BORRO
W
REGISTE
R
STORE RESULT IN
MEMOR
Y
OUTPUT
INPUT OUTPUT
C)MULTIPLICATION
ALGORITHM:
PROGRAM
PROGRAM:
MOV A,P0
MOV R0,P1
MOV B,R0
MUL AB
MOV P2,A
END
REG NO:212214106291
FLOWCHART:
GET MULTIPLIER
IN ACCR
GET MULTIPLICAND
IN B REG
MULTIPLY A WITH B
STORE RESULT IN
MEMOR
Y
OUTPUT
INPUT OUTPUT
D)DIVISION:
ALGORITHM:
PROGRAM
Store quotient
PROGRAM:
MOV A,P0
MOV R0,P1
MOV B,R0
DIV AB
MOV P2,A
END
REG NO:212214106291
FLOWCHART:
GET DIVIDEND IN
ACCR
GET DIVISOR IN B
REG
DIVIDE A BY B
STORE QUOTIENT
&
REMAIN
DER IN
MEMOR
Y
OUTPUT
OUTPUT
INPUT OUTPUT
RESULT:
Thus Arithmetic Operations using 8051 microcontroller was performed and output is verified
successfully.
REG NO:212214106291
DATE:
AIM:
SQUARE A NUMBER:
ALGORITHM:
PROGRAM :
4500H location
PROGRAM:
MOV A,P0
MOV R0,A
MOV B,R0
MUL AB
MOV P2,A
END
OUTPUT
INPUT OUTPUT
CUBE A NUMBER:
ALGORITHM:
Step 2: load the first data tgo accumulator and move to another register
PROGRAM :
location
PROGRAM:
MOV A,P0
MOV R0,A
MOV B,R0
REG NO:212214106291
MUL AB
MOV B,R0
MUL AB
MOV P2,A
END
OUTPUT
ALGORITHM:
PROGRAM :
accumulator
PROGRAM:
MOV A,P0
CPL A
ADD A,01
MOV P1,A
END
OUTPUT :(BY USING KEIL SOFTWARE)
RESULT:
Thus square,cube,2’s complement a number are performed using assembly language program in
8051 microcontroller and output is verified successfully.
REG NO:212214106291
DATE:
AIM: To write a assembly language program to perform arithmetic operations using 8051
microcontroller.
A)OR:
ALGORITHM
PROGRAM :
A) By using8051 KIT
MOV A,P0
MOV R0,P1
MOV B,R0
ORL A,B
MOV P2,A
END
FLOW CHART:
Clear PSW
Select Register
Bank
OR A & R 0
OUTPUT
INPUT OUTPUT
4500 4502
4501 4503
B)AND:
ALGORITHM
PROGRAM :
A) By using8051 KIT
MOV A,P0
MOV R0,P1
MOV B,R0
ANL A,B
MOV P2,A
END
REG NO:212214106291
FLOW CHART:
Clear PSW
Select Register
Bank
AND A & R 0
OUTPUT
INPUT OUTPUT
4500 4502
4501 4503
REG NO:212214106291
C)EX-OR:
ALGORITHM
PROGRAM :
A) By using8051 KIT
MOV A,P0
MOV R0,P1
MOV B,R0
XRL A,B
MOV P2,A
END
FLOW CHART:
Clear PSW
Select Register
Bank
EXOR A & R 0
OUTPUT
INPUT OUTPUT
4500 4502
4501 4503
RESULT:
Thus Logical Operations using 8051 microcontroller was performed and output is verified
successfully.
REG NO:212214106291
DATE:
ALGORITHM:
Step 3: Mask MSB nibbles , perform OR operation with 30h and store the result
PROGRAM:
MOV DPTR,#6100
MOVX A,DPTR
MOV R1,A
MOV A,#00
MOV R0,#0A
LOOP:ADD A,R1
DJNZ R0,LOOP
MOV R1,A
INC DPTR
MOVX A,@DPTR
ADD A,.R1
CJNE A,#0A,LOOP1
LOOP1:JC LOOP2
ADD A,07H
LOOP2:ADD A,#30
REG NO:212214106291
INC DPTR
MOVX @DPTR,A
OUTPUT
INPUT OUTPUT
RESULT: