MPMC Lab Manual
MPMC Lab Manual
LAB
EXPT.NO NAME OF THE EXPERIMENT PAGE
NO
1 Basic arithmetic and Logical operations
9 Digital clock
11 Printer status
2
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
BASIC ARITHMETIC AND LOGICAL OPERATIONS USING 8086
PROGRAMMING
APPARATUS REQUIRED:
PROBLEM STATEMENT:
Write an ALP in 8086 to add and subtract two byte numbers stored in the
memory location 1000H to 1003H and store the result in the memory location
1004H to 1005H.Also provide an instruction in the above program to consider the
carry also and store the carry in the memory location 1006H.
ALGORITHM:
(i) 16-bit addition (iii) Multiplication of 16-bit
Initialize the MSBs of sum to 0 numbers:
Get the first number. Get the multiplier.
Add the second number to the first Get the multiplicand
number. Initialize the product to 0.
If there is any carry, increment Product = product +
MSBs of sum by 1. multiplicand
Store LSBs of sum. Decrement the multiplier by 1
Store MSBs of sum. If multiplicand is not equal to
0,repeat from step (d) otherwise
(ii) 16-bit subtraction store the product.
Initialize the MSBs of difference to (iv) Division of 16-bit numbers.
0 Get the dividend
Get the first number Get the divisor
Subtract the second number from Initialize the quotient to 0.
the first number. Dividend = dividend – divisor
If there is any borrow, increment If the divisor is greater, store the
MSBs of difference by 1. quotient. Go to step g.
Store LSBs of difference If dividend is greater, quotient
Store MSBs of difference. = quotient + 1. Repeat from
step (d)Store the dividend
value as remainder.
3
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
FLOWCHART
ADDITION SUBTRACTION
START START
YES
A=A+B
IS THERE
ANY CY
YES
NO COUNTER =
IS THERE COUNTER =
ANY CARRY COUNTER + 1 COUNTER + 1
STORE THE
DIFFERENCE
NO
STOP
4
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
ADDITION
SUBTRACTION
100A 00
100B 12
100C HLT F4
5
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
FLOWCHART
MULTIPLICATION DIVISION
Start
Start
QUOTIENT = 0
REGISTER=00
REGISTER=00
DIVIDEND =
DIVIDEND-DIVISOR
REGISTER = REGISTER
REGISTER =
+ MULTIPLICAND
REGISTER +
MULTIPLICAND
QUOTIENT = QUOTIENT+1
Multiplier=MULTIPLI
ER Multiplier=MU
–1
LTIPLIER – 1
IS
NO DIVIDEN
D<
DIVISOR
NO IS
MULTIPLIER ?
=0?
YES
STOP STOP
6
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
MULTIPLICATION
DIVISION
1001 06
1002 00
1003 MOV BX,[1102] 11
1004 8B
1005 1E
1006 10
1007 01
7
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
1008
LAB DIV BX F7
1009 F3
100A MOV[1200],AX 89
100B 06
100C 00
100D 12
100E MOV[1202],DX 89
100F 16
1010 02
1011 12
1012 HLT F4
RESULT:.
Thus Arithmetic operation of two byte numbers are performed and the result is stored.
8
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
LOGICAL OPERATION
AIM:
To perform basic logical operations AND,OR,XOR and NOT
ALGORITHM:
Start the Program.
Get the first data from 1100
Get the Second data from 1100
Set pointer in 1130 address
Perform logical instruction
Store the Result
Stop the program
PROGRAM:
AND:
OR
XOR
NOT
9
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
RESULT:
Thus the program for logical operation was executed and the output was verified successfully.
10
EC 8681 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
MOVE A DATA BLOCK WITHOUT OVERLAP
EXP.NO: 02 DATE:
AIM:
To convert a given Move a data block without overlap
.
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 Bregister.
6. Store the resultant in memory location.
PROGRAM
RESULT:
Thus the output for the Move a data block without overlap was executed successfully
11
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
CODE CONVERSION, DECIMAL ARITHMETIC
AND MATRIX OPERATIONS.
12
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
PROGRAM:
1000 8B060011 MOV AX,[1100] Move the contents from 1100 to acc
1004 81E00F00 AND AX,000F Performs AND operation of acc value with 000F
1008 89060012 MOV[1200],AX Store the result at 1200
100C 89060011 MOV AX,[1100] Move the original Contents to acc
1010 C6C104 MOV CL,04 Set the counter value to 04
1013 D3C8 ROR AX,CL Rotate the contents of acc right by 4 times
1015 81E00F00 AND AX,000F Performs AND operation of acc value with 000F
1019 C7C10A00 MOV CX,0A Move the value OA to C reg
101D F7E1 MUL CX Multiply OA with acc value
101F 03060012 ADD AX,[1200] Add the contents of Previous Result with acc value
1023 89060012 MOV[1200],AX Move the new result to 1200
1027 8B060011 MOV AX,[1100] Move the original Contents to acc
1028 C6C108 MOV CL,08 Set the counter value to 08
102E D3C8 ROR AX,CL Rotate the contents of acc right by 8 times
1030 81E00F00 AND AX,000F Performs AND operation of acc value with 000F
1034 C7C16400 MOV CX,64 Move the value 64 to C reg
1038 F7E1 MUL CX Multiply 64 with acc value
103A 03060012 ADD AX,[1200] Add the contents of Previous Result with acc value
103E 89060012 MOV[1200],AX Move the new result to 1200
1042 8B060011 MOV AX,[1100] Move the original Contents to acc
1046 C6C10C MOV CL,0C Set the counter value to 0C
1049 D3C8 ROR AX,CL Rotate the contents of acc right by 0C times
104B 81E00F00 AND AX,000F Performs AND operation of acc value with 000F
104F C7C1E803 MOV CX,3E8 Move the value 3E8 with acc value
1053 F7E1 MUL CX Multiply 3E8 with acc value
1055 03060012 ADD AX,[1200] Add the contents of Previous Result with acc value
1059 89060012 MOV[1200],AX Move the new result to 1200
105D F4 HLT Stop the Program
13
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
14
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
FLOWCHART
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
PROGRAM:
(i)Addition:
(ii)Subtraction:
RESULT:
Thus the ALP program for addition &Subtraction using Decimal Arithmetic Operation is
Calculated and Verified Successfully.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
MATRIX OPERATION
AIM:
To Perform addition and Subtraction of two 3x3 Matrix.
APPARATUS REQUIRED:
8086 Microprocessor Kit
PROGRAM:
(i)ADDITION:
(ii)SUBTRACTION:
RESULT:
Thus the output for the addition and subtraction for two matrix was executed
successfully.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
ALGORITHM:
a. Initialize the data segment .(DS)
b. Initialize the extra data segment .(ES)
c. Initialize the start of string in the DS. (SI)
d. Initialize the start of string in the ES. (DI)
e. Move the length of the string(FF) in CX register.
f. Move the byte from DS TO ES, till CX=0.
START
Initialize DS,ES,SI,DI
CX=length of string,
DF=0.
Decrement CX
NO
Check for
ZF=1
STOP
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
MOVE A STRING
RESULT:
Thus a string of a particular length is moved from source segment to destination segment
18
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
SEARCHING A STRING
AIM:
To scan for a given byte in the string and find the relative address of the byte from the
starting location of the string.
ALGORITHM:
a. Initialize the extra segment .(ES)
b. Initialize the start of string in the ES. (DI)
c. Move the number of elements in the string in CX register.
d. Move the byte to be searched in the AL register.
e. Scan for the byte in ES. If the byte is found ZF=0, move the address pointed by ES:DI
to BX.
START
NO
Check for
ZF=1
Move DI to BX
STOP
19
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
SEARCHING A STRING
RESULT:
Thus a given byte or word in a string of a particular length in the extra segment(destination)
is found .
20
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
ALGORITHM:
a. Initialize the extra segment .(E S)
b. Initialize the start of string in the ES. (DI)
c. Move the number of elements in the string in CX register.
d. Move the byte to be searched in the AL register.
e. Store the ASCII code of the character that has to replace the scanned byte in BL
register.
f. Scan for the byte in ES. If the byte is not found, ZF≠1 and repeat scanning.
g. If the byte is found, ZF=1.Move the content of BL register to ES:DI.
START
NO
YES
Move the content of BL
to ES:DI
STOP
21
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
RESULT:
Thus a given byte or word in a string of a particular length in the extra segment(destination)
is found and is replaced with another character.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
AIM:
To write an Assembly Language Program (ALP) to sort a given array in
ascending and descending order.
APPARATUS REQUIRED:
PROBLEM STATEMENT:
ALGORITHM:
(i) Sorting in ascending order:
a. Load the array count in two registers C1 and C2.
b. Get the first two numbers.
c. Compare the numbers and exchange if necessary so that the two numbers are
in ascending order.
d. Decrement C2.
e. Get the third number from the array and repeat the process until C2 is 0.
f. Decrement C1 and repeat the process until C1 is 0.
(ii) Sorting in descending order:
a. Load the array count in two registers C1 and C2.
b. Get the first two numbers.
c. Compare the numbers and exchange if necessary so that the two numbers are
in descending order.
d. Decrement C2.
e. Get the third number from the array and repeat the process until C2 is 0.
f. Decrement C1 and repeat the process until C1 is 0.
23
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
FLOWCHART
ASCENDING ORDER DESCENDING ORDER
START
START
YES
IS POINTER YES IS POINTER
POINTER POINTER
NO
NO
TEMP = POINTER
TEMP = POINTER POINTER = POINTER + 1
POINTER = POINTER + 1 POINTER + 1 = TEMP
POINTER + 1 = TEMP
POINTER = POINTER +1
POINTER = POINTER +1 COUNT = COUNT + 1
COUNT = COUNT + 1
NO NO
IS
IS
YES
YES
NO
IS FLAG
IS FLAG
YES
YES
STOP
STOP
24
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
ASCENDING
DESCENDING
RESULT:
Thus given array of numbers are sorted in ascending & descending order.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
LARGEST& SMALLEST
AIM:
To write an Assembly Language Program (ALP) to find the largest and
smallest number in a given array.
APPARATUS REQUIRED:
PROBLEM STATEMENT:
An array of length 10 is given from the location. Find the largest and
smallest number and store the result.
ALGORITHM:
(i) Finding largest number:
a. Load the array count in a register C1.
b. Get the first two numbers.
c. Compare the numbers and exchange if the number is small.
d. Get the third number from the array and repeat the process until C1 is 0.
START START
INITIALIZE
INITIALIZE
COUNT
COUNT
PONITER = PONITER =
POINTER + 1 POINTER + 1
YES
IS MAX IS MIN
POINTER
YES
NO NO
NO NO
IS COUNT = 0 IS COUNT = 0
? ?
YES
YES
STORE MAXIMUM STORE MINIIMUM
STOP STOP
28
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
LARGEST
RESULT:
Thus the largest and smallest number is found in a given array.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
AIM:
To perform floating point operation using 8086 microprocessor Kit.
APPARATUS REQUIRED:
8086 Microprocessor Kit
PROGRAM:
ADDITON:
SUBTRACTION:
MULTIPLICATION:
RESULT:
Thus the program for floating point operation are executed and the output was verified
success fully.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
APPARATUS REQUIRED:
PROGRAM:
;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:
31
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
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
Today PROC
MOV AX, @data
MOV DS, AX
MOV DX, OFFSET mess1 ; Move string to DX
MOV AH, 09h ; 09h call to display string (DX > AH > DOS)
INT 21H ; Send to DOS
; CX year, DH month, DL day
MOV AH, 2AH ; Get the date (appendix D)
INT 21H ; Send to DOS
PUSH CX ; Move year to the stack
MOV CX, 0 ; Clear CX
MOV CL, DL
PUSH CX ; Move day to stack
MOV CL, DH ; Move month > CL
PUSH CX ; Move month to stack
MOV DH, 0 ; Clear DH
; ************************** DISPLAY MONTH ************************
32
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
33
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
34
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
Ram size:
ORG 0000H
CLR PSW3
CLR PSW4
CPL A
ADD A, #01H
MOV A,R3
AGAIN: SJMP AGAIN
RESULT:
Thus the output for the Password checking, Print RAM size and system date was
executed successfully
35
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
EXP.NO: 06 DATE:
AIM:
To interface the programmable interval timer to generate square wave with 8086 microprocessor
kit.
APPARATUS REQUIRED:
2. Power Chord 1
4. CRO 1
PROCEDURE:
1.The microprocessor kit was switched on.
2.The opcode for the program was entered into the microprocessor kit.
3.The program was executed and output square was verified in CRO.
PROGRAM:
RESULT:
Thus the programmable interval timer was interfaced to generate square wave with 8086
microprocessor kit.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
EXP.NO: 07 DATE
AIM:
To interface 8279 Microprocessor to display A character using microprocessor 8086.
APPARATUS REQUIRED:
2. Power Chord 1
4. CRO 1
HLT End
RESULT:
Thus the program to display ‘A’ in the first digit of a display by interfacing 8279 with 8086
was complemented and the output was verified.
EC 6413– MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
EXP.NO: 07 DATE:
AIM:
To write an assembly language program in 8086 to Traffic light control
APPARATUS REQUIRED:
SL.NO ITEM SPECIFICATION QUANTITY
1. Microprocessor kit 8086 1
2. Power Supply +5 V, dc,+12 V dc 1
3. Traffic light control Interface - 1
board
THEORY:
The board is a simple contraption of a traffic control systems wherein the signalling
light are simulated by the blinking or ON-OFF control of light emitting diodes. The signalling
lights for the pedestrian crossing are simulated by the ON-OFF control of dual colour light
emitting. A Model of a four road four lane junction, the board has green, yellow and red LEDs
which are the green, orange and the red signals of an actual system. Twenty LEDs are used on
the board. In additional eight dual colour LEDs are used which can be made to change either to
red or to green.
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
PROGRAM:
RESULT:
39
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
EXP.NO: 08 DATE:
AIM:
To write an assembly language program in 8086 to rotate the motor at different speeds.
APPARATUS REQUIRED:
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 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:
For running stepper motor clockwise and anticlockwise directions
MEMORY A1 A2 B1 B2 HEX
LOCATION CODE
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
40
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
FLOWCHART:
START
DELAY
DECREMENT COUNTER
IS B = 0 ?
PROGRAM :
RESULT:
Thus the assembly language program for rotating stepper motor in both clockwise and
anticlockwise directions is written and verified.
41
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
DIGITAL CLOCK
EXP.NO: 09 DATE:
AIM
To display the digital clock specifically by displaying the hours, minutes and seconds
using 8086 kits
APPARATUS REQUIRED:
PRELIMINARY SETTINGS:
Org 1000h
Store time value in memory location 1500- Seconds
1501- Minutes
1502- Hours
DIGITAL CLOCK PROGRAM:
42
EC6413 – MICROPROCESSOR AND MICROCONTROLLER LAB DEPT OF ECE
43
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
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.
44
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
EXP.NO:10 DATE:
AIM:
To display the rolling message “HELP US “in the display.
APPARATUS REQUIRED:
8086 Microprocessor kit, Power supply, Interfacing board.
ALGORITHM:
Display of rolling message “HELP US “
1. Initialize the counter
2. Set 8279 for 8 digit character display, right entry
3. Set 8279 for clearing the display
4. Write the command to display
5. Load the character into accumulator and display it
6. Introduce the delay
7. Repeat from step 1.
0 0 0 1 0 0 0 0
0 0 0 D D K K K
DD
00 - 8Bit character display left entry
01 - 16Bit character display left entry
10 - 8Bit character display right entry
1 1- 16Bit character display right entry
KKK- Key Board Mode
000 - 2Key lockout.
2.Clear Display: Control word-DC H
1 1 0 1 1 1 0 0
1 1 0 CD CD CD CF CA
1 0 0 1 0 0 0 0
1 0 0
AI A A A A
Auto increment = 1, the row address selected will be incremented after each of read and
write operation of the display RAM.
FLOWCHART:
SEGMENT DEFINITION:
DATA BUS D7 D6 D5 D4 D3 D2 D1 D0
SEGMENTS d c b a dp g f e
46
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
PROGRAM:
LOOK-UP TABLE:
1200 98 68 7C C8
1204 FF 1C 29 FF
RESULT:
RESULT:
Thus the rolling message “HELP US” is displayed using 8279 interface kit.
47
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
PRINTER STATUS
EXP.NO:11 DATE:
AIM:
To display the Printer Status in the display
APPARATUS REQUIRED:
8086 Microprocessor kit, Power supply, Interfacing board.
PROGRAM:
XOR AX, AX
XOR BX, BX
;this divides my 3digit number by 100 giving me my, hundredth digit
MOV AX, RES
MOV BX, 100
DIV BX;prints the hundredth digit
ADD AL, '0'
MOV DL, AL
PUSH AX ; save AX on the stack
MOV AH, 02h
INT 21h
POP AX ; restore ax
;divides the remainder by 10 giving me my tens digit
MOV BX, 10
DIV BX
;prints my tens digit
ADD AL, '0'
MOV DL, AL
PUSH AX ; save AX on the stack
MOV AH, 02h
INT 21h
POP AX ; restore ax
;print my last remainder which is my ones
ADD AH, '0'
MOV DL, AH
MOV AH, 02h
INT 21h
RESULT:
Thus the output for the status of printer was executed successfully.
48
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
EXP.NO: 12 DATE:
Aim:
To connect two 8086 microprocessor kits and to serially communicate with
each other by considering transmitter and receiver kits.
Apparatus required:
Procedure:
1. Take two number of 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 9-9 serial cable in the serial port of the microprocessor kits.
(LCD kit means PC-PC cable. LED kit means kit-kit cable)
5. Enter the data in transmitter kit use the memory location 1500.
6. Execute the receiver kit.
7. Execute the transmitter kit.
8. Result will be available in receiver kit memory location 1500.
Transmitter Program:
49
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
Receiver Program:
Result:
Thus the serial communication between two 8086 microprocessor kits has been
established and the data is transmitted in one kit and received in the other kit
successfully.
50
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
PARALLEL COMMUNICATION BETWEEN TWO 8086 MICROPROCESSORS
KITS
Aim:
To connect two 8086 microprocessor kits and to establish parallel communication with
each other by considering transmitter and receiver kits.
Apparatus required:
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 to get same eight data.
8. Data is available in transmitter kit in the memory location.
9. Change the data & execute the following procedure & get the result in receiver kit.
Transmitter program:
ADDRESS MNEMONICS OPCODE COMMANDS
MOV AL,80
OUT 26,AL
MOV AL,04
OUT 20,AL
MOV AL,06
OUT 22,AL
HLT
Receiver Program:
ADDRESS MNEMONICS OPCODE COMMANDS
MOV AL,92
MOV AL,26
IN AL,20
MOV [SI],1500
MOV [SI],AL
IN AL,22
MOV [SI],1502
MOV [SI],AL
HLT
Result:
Thus the serial communication between two 8086 microprocessor kits has been
established and the data is transmitted in one kit and received in the other kit successfully.
51
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
NO
IS EOC = 1?
YES
STOP
52
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
PROGRAM:
RESULT:
ANALOG DIGITAL DATA ON LED HEX CODE IN MEMORY
VOLTAGE DISPLAY LOCATION
RESULT:
Thus the ADC was interfaced with 8086 and the given analog inputs were converted into its
digital equivalent.
53
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
INTERFACING DIGITAL – TO – ANALOG CONVERTER
AIM :
1. To write an assembly language program for digital to analog conversion
2. To convert digital inputs into analog outputs & to generate different waveforms
APPARATUS REQUIRED:
SL.NO ITEM SPECIFICATION QUANTITY
1. Microprocessor kit 8086 Vi Microsystems 1
2. Power Supply +5 V, dc,+12 V dc 1
3. DAC Interface board - 1
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 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:
(i) Send the digital value of DAC.
(ii) Read the corresponding analog value of its output.
Waveform generation:
Square Waveform:
(i) Send low value (00) to the DAC.
(ii) Introduce suitable delay.
(iii) Send high value to DAC.
(iv) Introduce delay.
(v) Repeat the above procedure.
Saw-tooth waveform:
(i) Load low value (00) to accumulator.
(ii) Send this value to DAC.
(iii) Increment the accumulator.
(iv) Repeat step (ii) and (iii) until accumulator value reaches FF.
(v) Repeat the above procedure from step 1.
Triangular waveform:
(i) Load the low value (00) in accumulator.
(ii) Send this accumulator content to DAC.
(iii) Increment the accumulator.
(iv) Repeat step 2 and 3 until the accumulator reaches FF, decrement the
accumulator and send the accumulator contents to DAC.
(v) Decrementing and sending the accumulator contents to DAC.
(vi) The above procedure is repeated from step (i)
54
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
FLOWCHART:
MEASUREMENT OF ANALOG VOLTAGE: SQUARE WAVE FORM:
START
START
DELAY
TRANSFER THE
ACCUMULATOR
LOAD THE ACC WITH MAX
VALUE SEND ACC CONTENT
LOAD THE
CORRESSPONDING VALUE DELAY
STOP
55
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
START
START
INITIALIZE
INITIALIZE
ACCUMULATOR
ACCUMULATOR
SEND ACC
SEND CONTENT TO DAC
ACCUMULATOR
INCREMENT INCREMENT
ACCUMULATOR ACCUMULATOR
NO
IS ACC ≤
IS FF
ACC≤FF
DECREMENT
ACC CONTENT
SEND ACC
YES
IS
ACC≤00
56
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
MEASUREMENT OF ANALOG VOLTAGE:
PROGRAM : SQUARE WAVE:
L2 MOV AL,00H
L1 OUT C8,AL
CALL L1
MOV AL,0FFFH
OUT C8,AL
CALL L1
JMP L2
L1 : MOV CX,05FFH
L3 L3 : LOOP L3
RET
L3 L3 : MOV BL,00
MOV AL,BL
L1 L1 : OUT C8,AL
INC BL
JNZ L1
MOV BL,0FFH
MOV AL,BL
L2 L2 : OUT C8,AL
DEC BL
JNZ L2
JMP L3
57
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
RESULT:WAVEFORM GENERATION:
Square waveform
Saw-tooth waveform
Triangular waveform
MODEL GRAPH:
Triangular waveform
RESULT:
Thus the DAC was interfaced with 8085 and different waveforms have been generated.
58
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
AIM:
To generate a square wave by interfacing 8253 with 8086.
APPARATUS REQUIRED:
8086 Microprocessor kit, Power supply, Interfacing board, CRO.
ALGORITHM:
Move the number into AL register
Set the control register and data register
Then the channels are to be selected.
Move the value 10 into AL register
Move the value 00 into AL register
Stop the program.
PROGRAM:
RESULT:
Thus the square wave was generated by interfacing 8253 with 8086 of the output was verified
successfully.
59
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
AIM:
APPARATUS REQUIRED:
8086 Microprocessor kit, Keyboard, 8251/8253 Interface kit.
ALGORITHM:
TRANSMISSION:
RECEPTION:
60
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
RESULT:
Thus the transmission and reception of a character was initialized and checked.
61
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
AIM:
ALGORITHM:
FLOW CHART:
START
Clear PSW
Select Register
Load A and R 0
with 8- bit data
Add A & R 0
STOP
62
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
8 BIT ADDITION (IMMEDIATE ADDRESSING):
OUTPUT
MEMORY LOCATION DATA
4500
RESULT:
Thus the 8051 ALP for addition of two 8 bit numbers is executed.
63
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
8 BIT SUBTRACTION
AIM:
To perform subtraction of two 8 bit data and store the result in memory.
ALGORITHM:
a. Clear the carry flag.
b. Initialize the register for borrow.
c. Get the first operand into the accumulator.
d. Subtract the second operand from the accumulator.
e. If a borrow results increment the carry register.
f. Store the result in memory.
FLOWCHART:
START
CLEAR CARRY
FLAG
GET FIRST
OPERAND IN
ACCR
SUBTRACT THE
SECOND OPERAND
FROM ACC
N
IS CF=1
Y
INCREMENT
THE BORROW
REGISTER
STORE
RESULT IN
MEMORY
STOP
64
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
8 BIT SUBTRACTION (IMMEDIATE ADDRESSING):
RESULT:
Thus the 8051 ALP for subtraction of two 8 bit numbers is executed.
65
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
8 BIT MULTIPLICATION
AIM:
To perform multiplication of two 8 bit data and store the result in memory.
ALGORITHM:
a. Get the multiplier in the accumulator.
b. Get the multiplicand in the B register.
c. Multiply A with B.
d. Store the product in memory.
FLOWCHART:
START
GET
MULTIPLIER
IN ACCR
GET
MULTIPLICAND
IN B REG
MULTIPLY A
WITH B
STORE
RESULT IN
MEMORY
STOP
66
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
8 Bit Multiplication
ADDRESS LABEL MNEMONIC HEX COMMANDS
CODE
4100 MOVA ,#data1 74, data1 Store data1 in accumulator
OUTPUT:
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
4500 4502
4501 4503
RESULT:
Thus the 8051 ALP for multiplication of two 8 bit numbers is executed.
67
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
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.
4. Store the Quotient and Remainder in memory.
FLOWCHART:
START
GET DIVIDEND
IN ACCR
GET DIVISOR IN
B REG
DIVIDE A BY B
STORE
QUOTIENT &
REMAINDER
IN MEMORY
STOP
68
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
8 Bit Division
4104 DIVA,B 84
OUTPUT:
INPUT OUTPUT
MEMORY LOCATION DATA MEMORY LOCATION DATA
4500 (dividend) 4502 (remainder)
RESULT:
Thus the 8051 ALP for division of two 8 bit numbers is executed.
69
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
LOGICAL AND BIT MANIPULATION
AIM:
To write an ALP to perform logical and bit manipulation operations using 8051
microcontroller.
APPARATUS REQUIRED:
8051 microcontroller kit
ALGORITHM:
FLOWCHART:
START
STOP
70
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
PROGRAM :
AND OPERATION:
OR OPERATION:
EXOR OPERATION:
RESULT:
Thus the bit manipulation operation is done in 8051 microcontroller.
71
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
AIM:
To perform the square, cube & two’s complement operations in 8051.
APPARATUS REQUIRED:
2. Power Chord 1
PROCEDURE:
1.The microprocessor kit was switched on.
2.The opcode for the program was entered into the microprocessor kit.
3.The program was executed and output was verified.
SQUARE :
MOV B,A
MUL AB
MOV DPTR,#4500
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @ DPTR,A
SJMP HERE
72
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB :
CUBE
MOV B,A
MOV DPTR,#4400
MOVX @DPTR,A
MUL AB
MOV B,A
MOVX A,@DPTR
MUL AB
MOV DPTR,#4500
INC DPTR
MOVX @DPTR,A
SJMP HERE
TWO’S COMPLEMENT:
MOVX A,@DPTR
CPL A
ADD A,#01
INC DPTR
MOVX @ DPTR,A
SJMP HERE
RESULT:
The basic square, cube & two’s complement operations was done on 8051 microcontroller and
output was verified.
73
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
AIM:
To convert BCD number into ASCII by using 8051 micro controller
RESOURCES REQUIERED:
8051 microcontroller kit
Keyboard
Power supply
74
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
FLOWCHART:
PROGRAM:
RESULT:
The given number is converted into ASCII using 8051 microcontroller kit.
75
EC 6413 – MICROPROCESSOR AND MICROCONTROLLER DEPT OF ECE
LAB
52
58
66-76
76