EC8681 MPMC Lab Manual
EC8681 MPMC Lab Manual
EC8681 MPMC Lab Manual
Lab Manual
___________________________________________________________________________________________
____________________________________________________________________________
___________________________________________________________________________________________
THANTHAI PERIYAR GOVERNMENT INSTITUTE OF TECHNOLOGY, DEPT. OF ECE
LIST OF EXPERIMENTS:
8086 Programs using kits and MASM
1. Basic arithmetic and Logical operations
2. Move a data block without overlap
3. Code conversion, decimal arithmetic and Matrix operations.
4. Floating point operations, string manipulations, sorting and searching
5. Password checking, Print RAM size and system date
6. Counters and Time Delay
TOTAL: 60 PERIODS
OUTCOMES:
At the end of the course, the student should be able to:
Write ALP Programmes for fixed and Floating Point and Arithmetic
Interface different I/Os with processor
Generate waveforms using Microprocessors
Execute Programs in 8051
Explain the difference between simulator and Emulator
CONTENTS
AIM:
To write and execute an assembly language program for performing the addition
operation of 16 bit numbers with carry.
APPARATUS REQUIRED:
ALGORITHM:
Step1: Start
PROGRAM:
ADD AX,
[SI+02]
JNC L1
L1
INC CX
MOV [SI], AX
END
MOV [SI+02], CX
HLT
TABULAR COLUMN
INPUT OUTPUT
AIM
APPARATUS REQUIRED:
ALGORITHM:
Step1: Start
Step 5: Subtract the contents of the register pair from the accumulator.
PROGRAM:
JNC L1
L1 INC CX
MOV [SI], AX
MOV [SI+02], CX
END HLT
TABULAR COLUMN
INPUT OUTPUT
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step 1: Start
Step 4: Multiply the contents of the register pair by the content of the accumulator
PROGRAM:
MUL BX
JNC L1
INC CX
MOV [SI], AX
INC SI
INC SI
MOV AX, CX
MOV [SI], AX
MOV [SI+02], CX
END HLT
TABULAR COLUMN
INPUT OUTPUT
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step1: Start
Step 4: Divide the contents of the register pair by the content of the accumulator
PROGRAM:
DIV CX
MOV [SI+04], AX
MOV [SI+06], DX
END HLT
TABULAR COLUMN
INPUT OUTPUT
RESULT:
VIVA QUESTIONS
2. What is the max size of memory that can be connected with 8086
microprocessor?
AIM:
To write and execute an assembly language program for performing the logical AND
operation of 16 bit numbers.
APPARATUS REQUIRED:
ALGORITHM:
Step1: Start
PROGRAM:
MOV BX,[3002h]
AND AX,BX
MOV SI,3100h
MOV [SI],AX
END HLT
TABULAR COLUMN
INPUT OUTPUT
b) 16 BIT OR OPERATION
AIM:
To write and execute an assembly language program for performing the logical OR
operation of 16 bit numbers.
APPARATUS REQUIRED:
ALGORITHM:
Step1: Start
PROGRAM:
MOV BX,[3002h]
OR AX,BX
MOV SI,3100h
MOV [SI],AX
END HLT
TABULAR COLUMN
INPUT OUTPUT
AIM:
To write and execute an assembly language program for performing the logical XOR
operation of 16 bit numbers.
APPARATUS REQUIRED:
ALGORITHM:
Step1: Start
PROGRAM:
MOV BX,[3002h]
XOR AX,BX
MOV SI,3100h
MOV [SI],AX
END HLT
TABULAR COLUMN
INPUT OUTPUT
AIM:
To write and execute an assembly language program for performing the logical NOT
operation of 16 bit number.
APPARATUS REQUIRED:
ALGORITHM:
Step1: Start
PROGRAM:
NOT AX
MOV SI,3100h
MOV [SI],AX
END HLT
TABULAR COLUMN
INPUT OUTPUT
RESULT:
Thus the assembly language programs for the logical AND, OR, XOR and NOT
using 8086 were done and the results were verified.
To move block of data from one location into another location without overlap.
ALGORITHM:
PROGRAM:
ADDRESS LABEL MENMONICS
MOV SI,1100h
MOV DI,1200h
MOV CX,05h
MOV [DI],AX
INC SI
INC SI
INC DI
INC DI
LOOP L1
Stop HLT
RESULT:
Thus the assembly language programs to transfer a data block without overlap
using 8086 was done and the results were verified
INPUT:
1100 :01(LSB)
00(MSB)
02
00
03
00
04
00
05
06
OUTPUT:
1200 :01(LSB)
00(MSB)
02
00
03
00
04
00
05
06
AIM:
To convert the hexadecimal number into its equivalent decimal (BCD) value.
APPARATUS REQUIRED:
ALGORITHM:
PROGRAM:
MOV AL,BL
AND AH,OF
MOV BL,AH
AND AL,OFO
MOV CL,04
MOV AL,BL
MUL BH
ADD AL,BL
MOV [1400],AL
Stop HLT
AIM:
To convert the given BCD number into its equivalent hexadecimal number.
APPARATUS REQUIRED:
ALGORITHM:
Step 3: Increment AL register and decimal adjust accumulator after every increment.
Step 4: Decrement BL
Step 5: If BL equals zero, store the contents to destination else goto Step 3.
PROGRAM:
L1 MOV AX,0000
ADD AL,01
DAA
DEC BL
JNZ L1
MOV [1300],AX
Stop HLT
Result:
Thus the program to convert hexadecimal to BCD and BCD to hexadecimal are
written and verified for 8086.
a)ADDITION:
AIM:
To perform a addition operations between two decimal numbers.
APPARATUS REQUIRED:
8086 Trainer kit, Key board, power supply
ALGORITHM:
Step 1: Get the two numbers from mentioned address using MOV instruction.
Step 2: Add the two values and use decimal adjust after addition.
Step 3: Store the result.
PROGRAM:
ADDRESS LABEL MNEMONICS
MOV AL,[SI]
INC SI
MOV BL,[SI]
ADD AL,BL
DAA
INC SI
MOV [SI],AL
Stop HLT
RESULT:
Thus the program to add two decimal numbers is written and verified using
8086 kit.
INPUT
1100 : 05
1101 : 06
OUTPUT
1102 : 11
b)SUBTRACTION:
AIM:
To perform a subtraction operations between two decimal numbers.
APPARATUS REQUIRED:
8086 Trainer kit, Key board, power supply
ALGORITHM:
Step 1: Get the two numbers from mentioned address using MOV instruction.
Step 2: Subtract the two values and use decimal adjust after subtraction.
Step 3: Store the result.
PROGRAM:
ADDRESS LABEL MNEMONICS
1000 Start MOV SI,1100h
MOV AL,[SI]
INC SI
MOV BL,[SI]
SUB AL,BL
DAS
INC SI
MOV [SI],AL
Stop HLT
RESULT:
Thus the program to subtract two decimal numbers is written and verified
using 8086 kit.
INPUT
1100 : 15
1101 : 07
OUTPUT
1102 : 08
6. MATRIX OPERATIONS
a)ADDITION
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step 1: Get the two 3*3 matrices from mentioned address using MOV instructions.
Step 2: ADD two 3*3 matrices The values from two matrices are added one by one
using INC source and destination index.
PROGRAM:
ADDRESS LABEL MNEMONICS
1000 Start MOV CL,09
MOV SI,1100h
MOV DI,1150h
L1 MOV AL,[SI]
MOV BL,[DI]
ADD AL,BL
MOV [DI],AL
INC DI
INC SI
DEC CL
JNZ L1
Stop HLT
RESULT:
Thus the program to add two 3*3 matrices is written and verified using 8086
kit.
INPUT
1100 : 02
1101 : 02
1102 : 02
1103 : 02
1104 : 02
1105 : 02
1106 : 02
1107 : 02
1108 : 02
INPUT
1150 : 02
1151 : 02
1152 : 02
1153 : 02
1154 : 02
1155 : 02
1156 : 02
1157 : 02
1158 : 02
OUTPUT
1150 : 04
1151 : 04
1152 : 04
1153 : 04
1154 : 04
1155 : 04
1156 : 04
1157 : 04
1158 : 04
b)SUBTRACTION:
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step 1: Get the two 3*3 matrices from mentioned address using MOV instructions.
Step 2: Subtract the two 3*3 matrices. The values from two matrices are subtracted
one by one using INC source and destination index.
PROGRAM:
ADDRESS LABEL MNEMONICS
1000 Start MOV CL,09
MOV SI,1100h
MOV DI,1150h
L1 MOV AL,[SI]
MOV BL,[DI]
SUB AL,BL
MOV [DI],AL
INC DI
INC SI
DEC CL
JNZ L1
Stop HLT
RESULT:
Thus the program to subtract two 3*3 matrices is written and verified using
8086 kit.
INPUT
1100 : 02
1101 : 02
1102 : 02
1103 : 02
1104 : 02
1105 : 02
1106 : 02
1107 : 02
1108 : 02
INPUT
1150 : 02
1151 : 02
1152 : 02
1153 : 02
1154 : 02
1155 : 02
1156 : 02
1157 : 02
1158 : 02
OUTPUT
1150 : 0
1151 : 0
1152 : 0
1153 : 0
1154 : 0
1155 : 0
1156 : 0
1157 : 0
1158 : 0
a) ADDITION
AIM:
APPARATUS REQUIRED:
THEORY:
PROGRAM:
ADDRESS LABEL MNEMONICS
1000 Start MOV AL,66h
MOV BL,33h
ADD AL,BL
MOV SI,1100h
MOV [SI],AL
INC SI
MOV [SI],AH
Stop HLT
OUTPUT:
1100: 99
b) SUBTRACTION:
AIM:
APPARATUS REQUIRED:
8086 Trainer kit, Key board, power supply
THEORY:
INPUT:
FLOAT HEX
0.4 0.4*256=102,4D=66H
0.2 0.2*256=51.2D=33H
Subtract one from another using SUB instruction. The resultant hex value is
converted into floating value
OUTPUT:
HEX DECIMAL FLOAT
33 51 51/256=0.2
PROGRAM:
ADDRESS LABEL MNEMONICS
1000 Start MOV AL,66h
MOV BL,33h
SUB AL,BL
MOV SI,1100h
MOV [SI],AL
INC SI
MOV [SI],AH
Stop HLT
OUTPUT:
1100: 33
1101: 00
RESULT:
Thus the program to add and subtract two floating point numbers were written
in 8086 assembly language and verified.
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step 1: Start
Step 4: Compare the first element with the second element, which is placed after two
bytes.
Step 5: If second element is greater, continue comparison with next data else
Step 9: Halt
PROGRAM:
DEC CL
DEC CH
INC SI
INC SI
JC L4
JNZ L3
DEC CL
JNZ L2
END HLT
TABULAR COLUM
INPUT OUTPUT
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step 1: Start
Step 4: Compare the first element with the second element, which is
Step 9: Halt
PROGRAM:
DEC CL
L2
MOV SI, 1100H
DEC CH
INC SI
L3
MOV AL, [SI]
INC SI
JNC L4
DEC CH
JNZ L3
DEC CL
END JNZ L2
HLT
TABULAR COLUMN
EC8681 MICROPROCESSORS AND MICROCONTROLLERS LABORATORY Page 69
THANTHAI PERIYAR GOVERNMENT INSTITUTE OF TECHNOLOGY, DEPT. OF ECE
INPUT OUTPUT
ADDRESS DATA
ADDRESS DATA
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step 1: Start
Step 5: Increment the array pointer (SI register) and get the first data in
accumulator. Step 6: Decrement the count value and increment SI.
Step 7: Get the next data in BL register and compare the content of AL and BL and
move the
Step 8: Decrement the count and increment SI, if count is non zero, go to step 7
Step 9: Store the content of the accumulator in the memory pointed by DI.
PROGRAM:
INC SI
DEC CL
L2
INC SI
JNC L3
L3 MOV AL, BL
DEC CL
JNZ L2
MOV [DI], AL
END HLT
TABULAR COLUMN
INPUT OUTPUT
APPARATUS REQUIRED:
ALGORITHM:
Step 1: Start
Step 5: Increment the array pointer (SI register) and get the first data in
accumulator.
Step 7: Get the next data in BL register and compare the content of AL and BL and
move the
Step 8: Decrement the count and increment SI, if count is non zero, go to step 7
Step 9: Store the content of the accumulator in the memory pointed by DI.
PROGRAM:
INC SI
MOV AL, [SI]
DEC CL
L2
INC SI
CMP AL, BL
JC L3
MOV AL, BL
L3 DEC CL
JNZ L2
MOV [DI], AL
END HLT
TABULAR COLUMN
INPUT OUTPUT
TABULAR COLUMN
INPUT OUTPUT
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step 1: Start
Step 5: Let BL register keep track of the position. Initialize the position count as one.
Step 7: Compare the content of AL and DL, if they are equal go to step 11.
Step 8: Increment the array pointer (SI register) and the position count (BL).
Step 9: Get the next element in the array in AL and compare with the end marker
(ex.20H). If they are not equal go to step 7.
Step 10: Clear CX register and store CX register in four consecutive memory
locations after the given data and go to step 12.
PROGRAM:
MOV DI,1200H
MOV BL,01H
JZ L4
INC SI
INC BL
MOV AL,[SI]
CMP AL,20H
JNZ L2
L3
MOV CX,0000H
MOV [DI+1],CX
MOV [DI+3],CX
JMP END
L4
MOV BH,0FFH
MOV [DI+1],BH
MOV [DI+2],BL
TABULAR COLUMN
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
RESULT:
Thus the assembly language programs for the searching & sorting using 8086
were done and the results were verified.
VIVA QUESTIONS
1. Explain the logic behind the programs for sorting and searching operations.
2. What is the purpose of segment register & what are the segment registers in
8086?
3. What are the different flags in 8086 and give their function?
4. How the effective 20 bit address is calculated in 8086 processor?
5. What is the purpose of the following commands in 8086 (i) AAD (ii)RCL
6. Give examples of instructions which are used to affect the flag register?
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step2: Using move string word instruction moves the data from source location to
destination location.
Step3: Halt.
PROGRAM:
MOV DI,1200H
MOV CX,COUNT
REP MOVSW
HLT
TABULAR COLUMN
INPUT OUTPUT
AIM: To write and execute an assembly language program to copy a string of data
bytes
APPARATUS REQUIRED:
ALGORITHM:
Step2: Using move string byte instruction move the data from source location to
destination
location.
Step3: Halt.
PROGRAM:
MOV DI,1200H
MOV CX,COUNT
REP MOVSB
END HLT
TABULAR COLUMN
INPUT OUTPUT
ADDRESS DATA
ADDRESS DATA
AIM:
APPARATUS REQUIRED:
ALGORITHM:
Step1: Set SI and DI as pointer to the two addresses, CX as count register to store
the number
Step2: Move the content of address pointed by SI to AL and the content of address
pointed by
DI to BL.
Step6: Halt.
PROGRAM:
MOV SI,1200H
MOV DI,1300H
L1 MOV AL,[SI]
MOV BL,[DI]
MOV [DI], AL
MOV [SI], BL
INC SI
INC DI
DEC CX
JNZ L1
END HLT
TABULAR COLUMN
INPUT
ADDRESS DATA
OUTPUT
ADDRESS DATA
AIM:
To write and execute an assembly language program to compare the data strings
in two memory locations and find the number of equal values in corresponding
location.
APPARATUS REQUIRED:
ALGORITHM:
Step2: Using move string byte instruction move the data from source location to
destination
location.
Step3: Halt.
PROGRAM:
MOV DI,1200H
MOV BX,0000H
MOV CX,COUNT
L1 COMPSB
JNZ L2
INC BX
L2 DEC CX
JNZ L1
MOV SI,1300H
MOV [SI],BX
END HLT
TABULAR COLUMN
INPUT OUTPUT
AIM:
To write and execute an assembly language program to move a data string from
one
location to another.
APPARATUS REQUIRED:
ALGORITHM:
Step1: Set SI and DI as pointer to the two addresses, CX as count register to store
the number of datas in the string.
Step2: Move the content of address pointed by SI to AL and and store 00 to BL.
Step6: Halt.
PROGRAM:
TABULAR COLUMN
INPUT OUTPUT
ADDRESS DATA
ADDRESS DATA
f) STRING REVERSAL
AIM:
To write and execute an assembly language program to perform string reversal
using 8086.
APPARATUS REQUIRED:
8086 Trainer Kit.Keyboard,power supply
ALGORITHM:
Step1: Load count in CX register and use SI register to store source address and DI
to store result address.
Step3: Move the first data using move string byte instruction.
Step4: Decrement 02H from DI register and decrement CX, if it is not a zero go to
step 3.
Step5: Halt.
PROGRAM:
TABULAR COLUMN
INPUT OUTPUT
RESULT:
Thus, the assembly language programs for string manipulation using 8086 were
done and the results were verified.
VIVA QUESTIONS:
AIM:
APPARATUS REQUIRED:
Intel 8086 based Trainer Kit, DAC Interface Card, 26-pin flat Cable Connector,
CRO with probe
COMPONENT DESCRIPTION:
The Digital to Analog conversion is obtained with a simple R-2R ladder circuit.
The DAC card design involves three sections DAC 800, Current to Voltage circuitry
using Op Amp 741. DAC 800 is a monolithic 8-bit high-speed complimentary current
output DAC. It has a typical settling time of 100 nsec. The digital input to the DAC is
provided through the Port A and Port B of 8255. The reference voltage needed for the
DAC is obtained from a onboard voltage regulator 6A 723. The output from the DAC
vary between 0 to 5 V corresponding to values between 00 to FF H. Different types of
waveforms can be observed at the op-amp output depending upon the digital input
pattern.
BLOCK DIAGRAM:
MODEL GRAPH:
ALGORITHM:
Square wave:
Step1: Start
Step2: Move the low value to the DAC address and call delay
Step3: Move the high value to the DAC address and call delay.
Step4: Go to step2
Triangular wave:
Step1: Start
Step2: Move the low value to the DAC address and start incrementing and move
Step3: Move the high value to the DAC address and start decrementing and move
each data
Step4: Go to step2
Step1: Start
EC8681 MICROPROCESSORS AND MICROCONTROLLERS LABORATORY Page 112
THANTHAI PERIYAR GOVERNMENT INSTITUTE OF TECHNOLOGY, DEPT. OF ECE
Step2: Move the low value to the DAC address and start incrementing and move each
data to
Step3: Go to step2
Corresponding
Input data in Hex Output voltage in volts
00 -5.00
7F 0.00
FF +5.00
PORT ADDRESS:
PORT ADDRESS
DAC1 C0
DAC2 C8
PROGRAMS:
OUT C8,AL
CALL DELAY
MOV AL,FF
OUT C8,AL
CALL DELAY
JMP START
L1 DEC CX
JNZ L1
RET
TABULAR COLUMN
DELAY CALCULATION:
Reqd. delay Time = no. of T-states outside the loop + (no. of T-states inside the
loop *
count)
JNZ L1 =16T/4T
RET =8T
L1
MOV AL,BL
OUT C8,AL
INC BL
JNZ L1
MOV BL,FF
L2
MOV AL,BL
OUT C8,AL
DEC BL
JNZ L2
JMP START
TABULAR COLUMN:
Amplitude(v) Time
Period(ms)
L1 OUT C8,AL
INC AL
JNZ L1
JMP START
TABULAR COLUMN:
Amplitude(v) Time
Period(ms)
RESULT:
Thus the programs for various wave form generation using were written,
executed and the results were verified.
VIVA QUESTIONS
1. Explain the logic behind the programs using DAC.
2. What are the different I/O port instructions in 8086?
3. Give some conditional jump instructions of 8086?
4. What are addressing modes? What are the different addressing modes in 8086?
APPARATUS REQUIRED:
Intel 8086 based Trainer Kit, 26-pin flat Cable Connector, ADC Interface
card, Multimeter, potentio meter
COMPONENT DESCRIPTION:
Most of the real time systems give only analog outputs. To process these signals
using Microprocessor based systems, it is necessary to convert the analog signals to
digital signals. This can be done by either using Analog-to-Digital converters or by
an alternative scheme utilizing a Digital-to-Analog converter and either successive
approximation or counter algorithm implemented in software.
ADC 0809 is a monolithic CMOS device with an 8-bit ADC & channel
multiplier of microprocessor compatible logic. The main features are
8 bit resolution
The conversion begins on the falling edge of SOC.EOC will go low to indicate
that the conversion is over. Once the conversion is over, the digital data is read from
the SAR register.
PORT ADDRESS:
Content Address
Channel 0 E0
SOC D0
EOC D8
SAR C8
SELECTION OF CHANNEL:
IN0 0 0 0
IN1 0 0 1
IN2 0 1 0
IN3 0 1 1
IN4 1 0 0
IN5 1 0 1
IN6 1 1 0
IN7 1 1 1
RESULT VERIFICATION:
VREF=4.63Volts
ALGORITHM:
Step1:Start
Step 5: Read the digital data from SAR register and move it to some location.
Step: Halt
PROGRAM:
TABULAR COLUMN:
Analog Digital
input L8 L7 L6 L5 L4 L3 L2 L1 output
voltage
(Volts)
0.5
1
1.5
2
2.5
3
3.5
4
4.5
RESULT:
Thus the program for the conversion of analog voltage in to digital value using
8086 & ADC is written, executed and the result is verified.
VIVA QUESTIONS
2. What are the three modes in which ADC can be interfaced with
microprocessor?
APPARATUS REQUIRED:
COMPONENT DESCRIPTION:
PIN DIAGRAM
An internal prescaler generates all the timings and multiplexing signals for
the 8279. This Prescaler divides the external clock by a programmable integer. Bits
PPPPP determine the value of this integer, which ranges from 2 to 31. Choosing a
divisor that yields 100 KHz will give specified scan and debounce timings.
The CPU sets up the 8279 for a read of the FIFO / Sensor Ram by first writing this
command.
AI – Auto Increment Flag; X – Don’t care; A A A – Address Bits
The CPU sets up the 8279 for a read of the Display RAM by first writing this
command. The address bits A A A A select one of the 16 rows of the display RAM. If
the AI flag is set, this row address will be incremented automatically after each read
from the display RAM.
The CPU sets up the 8279 for a write to the Display RAM by first writing this
command. The address bits A A A A select one of the 16 rows of the display RAM. If
the AI flag is set, this row address will be incremented automatically after each write
to the display RAM.
The IW bits can be used to mask nibble A and nibble B in applications requiring
separate 4-bit display ports. By setting the IW flag for one of the ports, the port
becomes masked, so that the entries to the display RAM from the CPU do not affect
the port. If the user wishes to blank the display, the BL flags are available for each
nibble. The last CLEAR command issued determines the codes to be used as ‘blank’.
7. CLEAR DISPLAY
The Cd bits are available in this command to clear all the rows of the display
RAM to a selectable blanking code as follows.
If the Cf bit is asserted, the FIFO status is cleared and the interrupt output is
reset.
Ca, the Clear All bit has the combined effect of Cd and Cf. It uses the Cd clearing
code on the display RAM and also clears the FIFO status.
For the sensor matrix mode, this command lowers the IRQ line and enables further
writing into the RAM. For N-key roll over mode, if the E bit is programmed to ‘1’ the
chip will operate in the special error mode.
9. FIFO Status
FIFO status is used in the keyboard and strobed input mode to indicate the
number of characters in the FIFO and to indicate whether an error has occurred
BLOCK DIAGRAM
PORT ADDRESS
REGISTER ADDRESS
Control/
Status reg. C2
Data reg. C0
a) KEYBOARD SCAN:
ALGORITHM
Step1:Start
Step6: Clear Display by sending FF and repeat this until the key is pressed.
Step8: If key is pressed, initialize FIFO sensor RAM and get the content of data
register to
AL registers.
Step 9: Using Look Up Table Display the pressed key value by sending the value
through
data register.
Step10: Stop.
1) Keyboard/display mode:
0 0 0 0 0 0 0 0
=00H
2) Clear display:
1 1 0 0 1 1 0 0
=CCH
1 0 0 1 0 0 0 0
=90H
0 1 0 0 0 0 0 0
=40H
0 0 0 0 0 1 1 1
=07H
PROGRAM:
L1
OUT C0,AL
LOOP L1
L2
IN AL,C2
TEST AL,07
JZ L2
MOV AL, 40
OUT C2,AL
IN AL,C2
AND AL,0F
MOV BL,AL
MOV BH,12
MOV AL,[BX]
OUT C0,AL
JMP L2
END
HLT
LOOK UP TABLE:
b) BLINKING DISPLAY:
ALGORITHM
Step1: Start
Step2: Move the address of the Look Up Table to source index register.
Step3: Initialize all the control words ie, Key Board Display, Clear Display and Write
display
RAM.
Step 5: Move all the data from look up table to display one by one.
Step7: Go to step 1.
1) Keyboard/display mode:
0 0 0 0 0 0 0 0
=00H
2) Clear display :
1 1 0 0 1 1 0 0
=CCH
1 0 0 1 0 0 0 0
=90H
PROGRAM:
LOOK UP TABLE:
c) ROLLING DISPLAY:
ALGORITHM
Step1: Start
Step2: Move the address of the Look Up Table to source index register.
Step3: Initialize all the control words ie, Key Board Display, Clear Display and Write
display
RAM.
Step 5: Move data pointed by source index from look up table to display.
Step7: Go to step 1.
1) Keyboard/display mode:
0 0 0 0 0 0 0 0
=00H
2) Clear display:
1 1 0 0 1 1 0 0
=CCH
1 0 0 1 0 0 0 0
=90H
PROGRAM
LOOK UP TABLE:
RESULT:
Thus the programs for the key board display interface (8279) with 8086 is written,
executed and the result is verified.
VIVA QUESTIONS
APPARATUS REQUIRED:
Intel 8086 based Trainer Kit, 8253 Interface, CRO with Probe
COMPONENT DESCRIPTION:
These counters can be operated in any one of the six operating modes. To operate a
counter, a 16-bit count is loaded in its register and on command it begins to
decrement the count until it reaches zero.
Modes of Operation:
The output will be initially low after the mode set operation. After the count is loaded
into the selected count register the output will remain low and the counter will
count. When terminal count (0000) is reached the output will go high and remain
high until the selected count register is reloaded with the mode or a new count is
loaded.
The output will go low on the count following the rising edge of the gate input. The
output will go high on the terminal count. If a new count is loaded while the output
is low it will not affect the duration of the one shot pulse until the succeeding trigger.
The output will be low for one period of the input clock. The period from one output
pulse to the next equals the number of input counts in the count register.
EC8681 MICROPROCESSORS AND MICROCONTROLLERS LABORATORY Page 141
THANTHAI PERIYAR GOVERNMENT INSTITUTE OF TECHNOLOGY, DEPT. OF ECE
The output will remain high until one half of the count has been completed and go
low for the other half of the count. When the counter reaches terminal count the
state of the output is changed and the counter is reloaded with the full count and the
whole process is repeated.
After the mode is set the output will be high. When the count is loaded the counter
will begin counting. On terminal count the output will go low for one input clock
period then will go high again.
The counter will start counting after the rising edge of the trigger input and will go
low for one clock period when the terminal count is reached.
BLOCK DIAGRAM
PORT ADDRESS
MODEL GRAPH
COUNTER0:
0 0 1 1 0 1 1 0
=36H
COUNTER1:
0 1 1 1 0 1 1 0
=76H
COUNTER2:
1 0 1 1 0 1 1 0
=B6H
ALGORITHM
Step1: Start
Step4: Stop.
PROGRAM:
TABULAR COLUMN:
COUNT CALCULATION:
Input frequency=1500khz
RESULT:
Thus the program for square wave generation using 8253 timer is written,
executed and the result is verified.
VIVA QUESTIONS
APPARATUS REQUIRED:
Intel 8086 based Trainer Kit, Interface Card for 8251 and 8253, and RS232C Cable
COMPONENT DESCRIPTION
To implement serial communication, the CPU must inform the 8251 of all details
such as mode, baud, stop bits, parity etc. Therefore prior to data transfer, a set
control words must be loaded into the control register of the 8251. In addition, the
CPU must check the readiness of a peripheral by reading the status register. The
control word is divided into two formats: Mode word and Control word. The mode
specifies the general characteristics of operation (such as baud, parity, number of
stop bits), the command word enables data transmission and / or reception, and the
status word provides the information concerning register status and transmission
errors.
To initialize the 8251 in the asynchronous mode, a sequence of control words must
be followed. After a Reset operation (system reset or through instruction), a mode
word must be written in the control register followed by a command word. Any
control word written into the control register immediately after a mode word will be
interpreted as a command word. However, the 8251 should be reset prior to writing a
new mode word, and it can be reset by using the Internal Reset bit (D6) in the
command word.
COMMAND WORD
STATUS WORD
PIN DIAGRAM
ALGORITHM
TRANSMITTER
Step1: Start
Step2: Move the address of the data to be transmitted to source index register.
Step3: Initialize the control words for 8253 (for clock) and 8251.
Step 5: Check Tx Empty bit of status word, if it is set send the data to USART.
Step6: Increment source Index register and decrement count, if it is non zero jump to
step 5
Step7: stop.
ALGORITHM
RECEIVER
Step1: Start
Step2: Move the address where the data to be stored to source index register.
Step3: Initialize the control words for 8253 (for clock) and 8251.
Step 5: Check Rx Rdy bit of status word, if it is set read the data from USART.
Step6: Increment source Index register and decrement count, if it is non zero jump to
step 5
Step7: stop.
0 0 1 1 0 1 1 0
=36H
0 1 0 0 0 0 0 0
=40H
0 1 0 0 1 1 1 0
=4EH
0 0 1 1 0 1 1 1
=37H
PORT ADDRESS
8253 8251
PORT ADDRESS
PORT ADDRESS
CONTROL 16
CONTROL/STATUS 0A
REG
REG
08
COUNTER0 10
DATA REG
COUNTER1 12
COUNTER2 14
PROGRAM:
TRANSMITTER
MOV AL,36
OUT 16,AL
MOV AL,40
OUT 10,AL
MOV AL,01
OUT 10,AL
LOAD
MOV CL,COUNT
L1 IN AL,OA
AND AL,O4
JZ L1
MOV AL,[SI]
OUT 08,AL
INC SI
CMP AL,3F
JNZ LOAD
DEC CL
JNZ L1
HLT
RECEIVER
MOV AL,36
OUT 16,AL
MOV AL,40
OUT 10,AL
MOV AL,01
OUT 10,AL
LOAD
MOV CL,COUNT
L1 IN AL,OA
AND AL,O2
JZ L1
IN AL,08
MOV [SI],AL
INC SI
CMP AL,3F
JNZ LOAD
DEC CL
JNZ L1
HLT
TABULAR COLUMN
TRANSMITTER µP RECEIVER µP
RESULT:
Thus program for the transmission and reception of a set of data between two
microprocessors using UART is written, executed and the result is verified.
VIVA QUESTIONS
1. Explain the logic behind the program using 8251 for serial data transfer.
2. What is baud rate?
3. What is TXD and RXD?
4. How to initialize data transfer in 8251?
5. State different control words and their use.
To interface a stepper motor with the microprocessor trainer kit and to write an
assembly language program to rotate the stepper motor in clock-wise direction and
anti-clockwise direction.
APPARATUS REQUIRED:
Intel 8086 based Trainer Kit, Stepper motor Interface, Stepper motor, and 26-pin flat
ribbon cable.
COMPONENT DESCRIPTION:
A practical permanent magnet stepper motor will have 1.8° step angle and fifty (50)
tooth on its rotor. There are eight (8) main poles and four windings on the stator
having five (5) teeth in the pole face. Permanent magnet stepper motors have three
mode of excitation. (1) Single phase mode – in which only one of the motor windings
is excited at a time, (2) Two phase mode - Both the stator phases are excited at a
time, and (3) Hybrid mode – a combination of single phase and two phase motors.
The Stepper motor available is a reversible stepper motor with a torque of 3kgcm.
The power requirement is ±12V DC @ 1.2 A current per winding at full torque. The
step angle is 1.8° (for every single excitation, the motor shaft rotates by 1.8°). The
stepper motor interface uses four transistor pairs (SL 100 & SN 3055) in a Darlington
pair configuration. Each Darlington pair is used to excite the particular winding of
the motor connected to 4-pin connector on the interface. The inputs to these
transistors are from 8255 PPI I/O lines of a microprocessor trainer kit.
PORT ADDRESS
PORT ADDRESS
DATA LATCH 1 C0
DATA LATCH 2 C8
STEPPING SEQUENCE
a) SPEED CONTROL:
SPEED CALCULATION:
=200steps/rotation
20 rotation=1min
20*200steps=60 sec
1 step=60/20*200=15msec
15msec=12T+ (18T*COUNT-12T)
T=1/clock frequency
ALGORITHM
Step1: Start
Step2: Move the address of the stepping sequence to destination index register.
Step3: Move the count (number of data in the stepping sequence) to CL register
Step4: Move the data in the stepping sequence to the data latch of stepper interface.
Step6: Increment destination Index register and decrement count, if it is non zero
jump to
step
Step7: Go to step 1
PROGRAM:
L1 MOV CL,04
MOV AL,[DI]
OUT CO,AL
CALL DELAY
INC DI
LOOP L1
JMP START
1500 DELAY
MOV DX,COUNT
L2
DEC DX
JNZ L2
RET
COUNT CALCULATION
=200/360*180=100=64H
Count = 64/4=16H
ALGORITHM
Step1: Start
Step2: Move the count to BL register
Step3: Move the address of the forward stepping sequence to destination index
register.
Step4: Call Rotate sub program
Step5: Decrement count, if it is non zero jump to step 3
Step6:Call delay
Step7: Move the count (number of data in the stepping sequence) to BL register
Step8: Move the address of the reverse stepping sequence to destination index
register.
Step9: Call Rotate sub program
Step10: Decrement count, if it is non zero jump to step 3
Step11: Call delay
Step12: Go to step 1
ROTATE
Step3: Move the count (number of data in the stepping sequence) to CL register
Step4: Move the data in the stepping sequence to the data latch of stepper interface.
Step5: Call delay
Step6: Increment destination Index register and decrement count, if it is non zero
jump to
step 4
Step7: Return to main program
PROGRAM
COUNT CALCULATION:
Count=reqd.angle/step angle
For 180deg,
Count=180/1.8=100=64H
ALGORITHM:
Step1: Start
Step2: Move the count to BL register
Step3: Move the address of the stepping sequence to destination index register.
Step4: Move the count (number of data in the stepping sequence) to CL register
Step5: Move the data in the stepping sequence to the data latch of stepper interface.
Step6: Decrement BL, if it is zero jump to step
Step7: Execute delay
Step8: Increment destination Index register and decrement CL, if it is non zero jump
to Step5
Step9: Go to step 3
Step10: Stop
PROGRAM
ADDRESS LABEL MNEMONICS
RESULT:
Thus, the programs for stepper motor rotation using 8086 microprocessor were
written, executed and the results were verified.
VIVA QUESTIONS
1. Explain the logic behind the program for stepper motor control.
APPARATUS REQUIRED:
Intel 8086 based Trainer Kit-2, connecting cable, power supply, key board
COMPONENT DESCRIPTION
The 8255 Programmable Peripheral Interface (PPI) is a very popular and versatile
input / output chip that is easily configured to function in several different
configuration. The configuration tells the 8255 whether ports are input or output and
even some strange arrangements called bi-directional and strobed, but these 'funny'
modes go a little beyond the scope of this tutorial. The 8255 allows for three distinct
operating modes (Modes 0, 1 and 2) as follows:
For most applications using this range of cards Mode 0 will be used.
Each of the 3 ports has 8 bits, each of these bits can be individually set on or off, it's
a bit like having 3 banks of 8 light switches. These bits are configured in groups to
be inputs or outputs allowing their function to either read data into the computer or
control data out of the computer. The various modes can be set by sending a value to
the control port. The control port is Base Address + 3 (i.e. 768+3 = 771 Decimal). The
table below shows the different arrangements that can be configured and the values
to be sent to the configuration port.
-BLOCK DIAGRAM
PIN DIAGRAM
1 0 0 0 0 0 0 0
=80H
RECEIVER
1 0 0 1 1 0 0 0
=98H
PORT ADDRESS
PORT ADDRESS
CONTROL REG 26
PORT A 20
PORT B 22
PORT C 24
ALGORITHM
TRANSMITTER
Step 1.Start.
Step 4.Stop
RECEIVER
Step 1.Start.
Step 3.Read the data from port A and store in some memory location.
Step 4.Stop
PROGRAM
TRANSMITTER
OUT 26H, AL
OUT 20,AL
END HLT
RECEIVER
OUT 26H, AL
IN AL, 20
MOV [1200],AL
END HLT
RESULT
VIVA QUESTIONS
1. Explain the logic behind the program for transferring the data between two
microprocessors using 8255.
2. What is PPI? Give the control word format for I/O mode and BSR mode of
8255?
3. What are the different operating modes of 8255 PPI?
4. How the data transfer is achieved in handshake mode?
To write and execute an assembly language program for performing the Digital
clock operation with 8086.
APPARATUS REQUIRED:
8086 Trainer kit, Keyboard, Power supply, Digital Clock interface card.
PROGRAM
CALL DISPLAY
OUT 16, AL
MOV CL, 07
S2 MOV AL,88H
OUT 14H, AL
OUT 14H, AL
OUT 16, AL
NOP
NOP
NOP
NOP
IN AL, 14H
MOV DL, AL
IN AL,14H
OR AL,DL
JNZ S1
DEC CL
JNZ S2
INC AL
MOV [SI], AL
JNZ START
MOV [SI], AL
INC SI
INC AL
MOV [AI], AL
JNZ START
MOV AL,0H
MOV [SI], AL
INC SI
MOV AL,[SI]
INC AL
MOV [SI], AL
CMP AL,18H
JNZ START
MOV AL,00H
MOV [SI], AL
JMP START
MOV CL,0H
INT 5
RET
MOV [BX], AL
MOV AL,[SI] ;
MOV AH,00H
DIV DH
DEC BX
MOV [BX],AH
DEC BX
MOV [BX], AL
DEC BX
MOV [BX], AL
DEC BX
INC SI
MOV AL,[SI]
MOV AH,0H
DIV DH
MOV [BX],AH
DEC BX
MOV [BX], AL
DEC BX
MOV [BX], AL
DEC BX
INC SI
MOV AL,[SI]
MOV AH,0H
DIV DH
MOV [BX],AH
DEC BX
MOV [BX], AL
RET
AND AL,0FF
JNC GET C
HLT
RESULT:
Thus an assembly language program for performing the Digital clock operation with
8086 is written and executed.
To write and execute an assembly language program for performing the control of
traffic light.
APPARATUS REQUIRED:
8086 Trainer kit, Keyboard, Power supply, traffic light interface card.
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.
The outputs are the inputs to buffers 7406 whose output drive LEDs. The buffered
output applied to the anode of the LEDs decides whether it is ON or OFF.
The figure shows the LED positions and the port lines which control each LED.
PROGRAM
OUT CNTRL, AL
CALL OUT
OUT PORTA, AL
CALL DELAY1
INC SI
INC BX
CALL OUT
OUT PORTB, AL
CALL DELAY1
INC SI
INC BX
CALL OUT
OUT PORTC, AL
CALL DELAY1
INC SI
INC BX
CALL OUT
OUT PORTC, AL
INC SI
OUT PORTA, AL
CALL DELAY1
JMP REPEAT
OUT PORTC, AL
INC BX
OUT PORTB,AL
INC BX
OUT PORTA, AL
CALL DELAY
RET
A1: DEC DX
JNZ A1
DEC D1
JNZ A
RET
B: MOV DX,0FFFFH
B1: DEC DX
JNZ B1
DEC D1
JNZ B
RET
LOOKUP: DB
12H,27H,44H,10H
DB
2BH,92H,10H,9DH
DB
84H,48H,2EH,84H
LABEL: DB
48H,4BH,20H,49H
04H
END
RESULT:
Thus an assembly language program for performing the control of the traffic light
with 8086 is written and executed.
To write and execute an assembly language program for performing the printing
over Centronics printer.
APPARATUS REQUIRED:
THEORY:
1. First check busy signal pin to see if the printer is ready to receive data.
2. If this signal is low, indicating the printer is ready (not busy), you send an ASCII
4. The STROBE signal going low causes the printer to assert it BUSY signal high.
5. After a minimum time of 0.5 µs the STROBE signal can be raised high again.
6. The data must be held valid on the data lines for atleast 0.5 µs after the STROBE
7. When the printer is ready to receive the next character, it asserts its ACKNLG
8. The rising edge of ACKNLG signal tells the micro computer that it can send the
next character.
9. The rising edge of ACKNLG also resets the busy signal from the printer. BUSY
signal being low is another indication that the printer is ready to accept the next
character.
DATA : C8h
STATUS : C0h
EC8681 MICROPROCESSORS AND MICROCONTROLLERS LABORATORY Page 193
THANTHAI PERIYAR GOVERNMENT INSTITUTE OF TECHNOLOGY, DEPT. OF ECE
PROGRAM:
1004 E4 C0 IN AL,STUS
1016 F4 HLT
1017 PRINT:
101C STAS:
1024 90 NOP
1025 90 NOP
1026 90 NOP
102B C3 RET
102C CHECK:
102C E4 C0 IN AL,STUS
1030 74 FA JZ CHECK
1032 E4 C0 IN AL,STUS
103C F4 HLT
1050 ERR:
1050 CD 02 INT 2
1052 END
RESULT:
Thus the program to print data in Centronics printer interface using 8086 is written
and executed.
APPARATUS REQUIRED:
THEORY:
Steps to be followed
i)initialization of lcd
iv)get the key value from keyboard and compare to it stored value
RS :06H
KEYBOARD :02H
PROGRAM:
1085 EB DC JMP L6
10C7 75 EB JNZ L4
10C9 F4 HLT
10CD L14:
10CD E8 1105 R CALL L10
10D0 E8 110C R CALL L11
10D3 B0 C0 MOV AL,0C0h
EC8681 MICROPROCESSORS AND MICROCONTROLLERS LABORATORY Page 199
THANTHAI PERIYAR GOVERNMENT INSTITUTE OF TECHNOLOGY, DEPT. OF ECE
1105 L10 :
1105 B0 4F MOV AL,4Fh
1107 2C 01 L3: SUB AL,01h
1109 75 FC JNZ L3
110B C3 RET
110C L11:
110C B0 00 MOV AL,00h
110E E6 06 OUT 06h,AL
1110 C3 RET
1111 L12:
1111 B0 01 MOV AL,01h
1113 E6 06 OUT 06h,AL
1115 C3 RET
1116 L13:
1116 B9 0FFF MOV CX,0FFFh
1119 E2 FE HE: LOOP HE
111B C3 RET
RESULT:
Thus the program to verify the password is written and checked using
8086 microprocessor.
:1e(2)
:26(3)
:25(4)
:2e(5)
After executing type the password via keyboard and press enter button the lcd
show the output.
APPARATUS REQUIRED:
THEORY:
CODE:
0000 code segment
assume cs:code,ds:code
1000 org 1000h
100F 46 INC SI
1010 8A 04 MOV AL,[SI]
1012 E6 D0 OUT 0D0H,AL
1014 46 INC SI
1015 8A 04 MOV AL,[SI]
1017 E6 C2 OUT 0C2H,AL
1019 46 INC SI
101A 8A 04 MOV AL,[SI]
101C E6 D2 OUT 0D2H,AL
101E 46 INC SI
EC8681 MICROPROCESSORS AND MICROCONTROLLERS LABORATORY Page 203
THANTHAI PERIYAR GOVERNMENT INSTITUTE OF TECHNOLOGY, DEPT. OF ECE
1023 46 INC SI
1024 8A 04 MOV AL,[SI]
1026 E6 D4 OUT 0D4H,AL
1028 46 INC SI
1029 8A 04 MOV AL,[SI]
102B E6 C6 OUT 0C6H,AL
102D 46 INC SI
102E 8A 04 MOV AL,[SI]
1030 E6 D6 OUT 0D6H,AL
1032 46 INC SI
1033 8A 04 MOV AL,[SI]
1035 E6 C8 OUT 0C8H,AL
1037 46 INC SI
1038 8A 04 MOV AL,[SI]
103A E6 D8 OUT 0D8H,AL
103C 46 INC SI
103D 8A 04 MOV AL,[SI]
103F E6 CA OUT 0CAH,AL
1041 46 INC SI
1042 8A 04 MOV AL,[SI]
1044 E6 DA OUT 0DAH,AL
104F E4 C6 IN AL,0C6H
1051 24 0F AND AL,0FH
1053 46 INC SI
1054 88 04 MOV [SI],AL
1056 E4 D8 IN AL,0D8H
1058 24 0F AND AL,0FH
105A 46 INC SI
105B 88 04 MOV [SI],AL
105D E4 C8 IN AL,0C8H
105F 24 0F AND AL,0FH
1061 46 INC SI
EC8681 MICROPROCESSORS AND MICROCONTROLLERS LABORATORY Page 204
THANTHAI PERIYAR GOVERNMENT INSTITUTE OF TECHNOLOGY, DEPT. OF ECE
1064 E4 DA IN AL,0DAH
1066 24 0F AND AL,0FH
1068 46 INC SI
1069 88 04 MOV [SI],AL
106B E4 CA IN AL,0CAH
106D 24 0F AND AL,0FH
106F 46 INC SI
1070 88 04 MOV [SI],AL
1079 46 INC SI
107A 8A 04 MOV AL,[SI]
107C E6 F0 OUT 0F0H,AL
107E 46 INC SI
107F 8A 04 MOV AL,[SI]
1081 E6 E2 OUT 0E2H,AL
1083 46 INC SI
1084 8A 04 MOV AL,[SI]
1086 E6 F2 OUT 0F2H,AL
1088 46 INC SI
1089 8A 04 MOV AL,[SI]
108D 46 INC SI
108E 8A 04 MOV AL,[SI]
1090 E6 F4 OUT 0F4H,AL
INPUT:
OUTPUT:
APPARATUS REQUIRED:
THEORY:
RS :06H
CODE:
1026 F4 HLT
1027 90 NOP
1028 L2:
107D 75 ED JNZ L4
10D0 F4 HLT
10D1 L10:
10D1 B0 7F MOV AL,7Fh
10D3 2C 01 L8: SUB AL,01h
10D5 75 FC JNZ L8
EC8681 MICROPROCESSORS AND MICROCONTROLLERS LABORATORY Page 211
THANTHAI PERIYAR GOVERNMENT INSTITUTE OF TECHNOLOGY, DEPT. OF ECE
10D7 C3 RET
10D8 L11:
10D8 B0 00 MOV AL,00h
10DA E6 06 OUT 06h,AL
10DC C3 RET
10DD L12:
10DD B0 01 MOV AL,01h
10DF E6 06 OUT 06h,AL
10E1 C3 RET
RESULT:
Thus the program to display the RAM size is executed and verified.
OUTPUT:
3. In that window change the directry [Where the masm software is present]
4. In the command window type the directory name after that change the directory to
8086(masm) after that type edit
5.After changing directory type edit then in that window, write the program
8.Type: link filename,,; [This will create a list file and can be seen inside the
masm(8086)software]
14.Type : e 1200 [see output in corresponding address] use space bar to see
next output value
Mov ah, 4ch [These commands are used to see the results system
itself]
Int 21h
19.Now in micro 86 kit select receiving mode(ie) type si 1000(starting address) then
press enter key. Then the kit is ready to receive data and press any in the host to
start transmission. During transmisson the message display as ,
transmission progress.
a) 16 BIT ADDITION
AIM:
APPARATUS REQUIRED:
ALGORITHM:
1. Start
2. Get the Augends.
3. ADD with addend.
4. Get the memory where sum is to be stored.
5. Store the sum in to memory.
6. Stop the program.
PROGRAM:
ADDRESS LABEL MNEMONICS
TABULAR COLUMN
INPUT OUTPUT
ADDRESS DATA
b) 8 BIT SUBTRACTION
AIM:
To write an ALP to perform 8 bit subtraction of two numbers using 8051
microcontroller.
APPARATUS REQUIRED:
8051 micro controller, power supply, Key board
ALGORITHM:
1.Start
2.Clear the sign bit .
3.Get the minuend.
4.Subtract the subtrahend from the minuend.
5.Get the memory where sum is to be stored.
6.Store the sum in to memory.
7.Stop the program.
PROGRAM:
MOV
A,#minuend
SUB
A,#subtrahend
MOV
L1 DPTR,#4500
MOVX @DPTR,A
SJMP L1 SJMP
TABULAR COLUMN
INPUT OUTPUT
ADDRESS DATA
c) 8 BIT MULTIPLICATION
AIM:
To write an ALP to perform 8 bit multiplication of two numbers using 8051
microcontroller.
APPARATUS REQUIRED:
8051 micro controller, power supply, Key board
ALGORITHM:
1. Start
2. Get the multiplicand and multiplier .
3. Perform multiplication.
4. Get the memory where product is to be stored.
5. Store the product in to memory.
7. Stop the program.
PROGRAM:
INPUT OUTPUT
ADDRESS DATA
d ) 8 BIT DIVISION
AIM:
To write an ALP to perform 8 bit division of two numbers using 8051
microcontroller.
APPARATUS REQUIRED:
8051 micro controller, power supply, Key board
ALGORITHM:
1.Start
2.get the dividend and divisor .
3.Perform division.
4.Get the memory where result is to be stored.
5.Store the quotient and remainder in to memory.
7.Stop the program.
PROGRAM:
TABULAR COLUMN
INPUT OUTPUT
ADDRESS DATA
RESULT:
Thus, ALPs are written to perform arithmetic operations 8051 micro controllers.
The outputs are verified and results were carefully noted.
VIVA QUESTIONS
1. Explain the logic behind the programs for arithmetic operations using 8051.
2. What is a Micro controller? What is the difference between microprocessor &
micro controller?
3. List the addressing modes of 8051?
4. List the salient features of 8051 microcontroller?
5. What is the function of program counter in 8051?
6. What are program and data memory?
7. List different special function registers and their functions.
EC8681 MICROPROCESSORS AND MICROCONTROLLERS LABORATORY Page 231
THANTHAI PERIYAR GOVERNMENT INSTITUTE OF TECHNOLOGY, DEPT. OF ECE
a) 2’S COMPLEMENT
AIM:
To write an assembly language program to find 2’s complement of a given
number using 8051.
APPARATUS REQUIRED :
8051 micro controller, power supply,Key board
ALGORITHM:
1. Start the program
2. Move the data into the accumulator and compliment.
3. Move the address 4800 into data pointer.
4. Move the value of A into 4800.
5. Increment content of data pointer and accumulator.
6. Move contents of A into address 4801.
7. Stop.
PROGRAM:
CPL A
MOV
DPTR,#4800
MOVX @DPTR,A
INC A
INC DPTR
MOVX @DPTR,A
L1
SJMP L1
TABULAR COLUMN
INPUT OUTPUT
ADDRESS DATA
AIM:
To write an assembly language program to perform logical AND/OR/XOR of
two 8 bit data using 8051.
APPARATUS REQUIRED:
8051 micro controller, power supply
ALGORITHM:
1. Start the program
2. Move the first data into the accumulator and perform AND/OR/XOR with the
second data.
3. Move the address 4800 into data pointer.
4. Move the value of A into 4800.
7. Stop.
PROGRAM:
ANL /ORL/XRL A,
#second data
MOVX @DPTR,A
L1
SJMP L1
TABULAR COLUMN
INPUT OUTPUT
ADDRESS DATA
RESULT:
Thus the assembly language programs using logical instructions of 8051 were
written, executed and the results were verified.
VIVA QUESTIONS
1. Explain the logic behind the programs for logical operations using 8051.
2. Give examples of some logical instructions.
3. List the instructions used to access external RAM.
4. What are the advantages of register indirect addressing mode in 8051?
5. What is meant by bit addressable and byte addressable?
6. What is Program status word (PSW)? Give its format.
CONTENT
BEYOND
SYLLABUS
AIM:
To write a program to control the speed of DC motor and measure the speed
using 8086 microprocessor
APPARATUS REQUIRED:
COMPONENT DESCRIPTION
PORT ADDRES
DAC C0 W
CHANNEL 1 C4 R/W
CHANNEL 2 CC R/W
ALGORITHM:
1.Start
3.Make the gate signal low for 8253 to be low and call the delay.
4. Initialize the control word format of 8253 and initialize the count to the counter of
8253.
5.Make the gate signal high and call delay and once again make the gate signal to
low.
6.Store the MSB and LSB of the obtained count to different address.
7.In delay move the high value to register and it is decremented until each one set
the zero flag according to the loop.
8.Stop.
PROGRAM:
OUT C0,AL
MOV AL,00H
OUT D8,AL
CALL DELAY
MOV AL,3OH
OUT CE,AL
MOV AL,FFH
OUT C8,AL
OUT C8,AL
MOV AL,00H
OUT D0,AL
CALL DELAY
MOV AL,00H
OUT D8,AL
IN AL,C8H
MOV SI,1600H
MOV [SI],AL
MOV AL,00H
INC SI
MOV [SI],AL
END HLT
LOOP DEC DX
JNZ LOOP
DEC CL
JNZ LO2
RET
PROCEDURE:
4. Move the higher byte from channel 0 to A and lower byte to memory.
5. Load the delay count; decrement the control until the zero flag in set.
6. Decrement the count if ZF is still equal to zero and go to the specified location.
7. Execute the program, go to location 4300 and 4301.Subtract the data in location
from FFFF and convert it in to decimal, which is the timer output in decimal.
TABULAR COLUMN:
HEX DEC
RESULT:
Thus, the program for control the DC motor is executed and the speed is measured.
VIVA QUESTIONS
1. Explain the logic behind the program for DC motor speed control.
APPARATUS REQUIRED:
Intel 8086 based MPS 85-2 Trainer Kit,8259 interface board, cable
COMPONENT DESCRIPTION:
3. In 8086 processor, it supplies the type number of the interrupt and the type
number is
programmable. In 8085 processor, the interrupt vector address is programmable.
The
priorities of the interrupts are programmable.
BLOCK DIAGRAM:
PIN DIAGRAM
ICW1
ICW2
ICW3
MASTER MODE
SLAVE MODE
ICW4
OCW1
OCW2
OCW3
PORT ADDRESS
COMMAND ADDRESS
WORDS
ICW1 C0
ICW2 C2
ICW3 C2
ICW4 C2
OCW1 C2
OCW2 C0
OCW3 C0
ICW1
0 0 0 1 0 1 1 1
=17H
ICW2
0 0 0 0 1 0 0 0
=08H
ICW4
0 0 0 0 0 0 0 1
=01H
OCW1
1 1 1 1 1 1 1 0
=FEH
ALGORITHM
Step1. Start
Step 2.move the different control word to their respective control register.
Step 3.Check weather the interrupt is set .if not jump to this same step.
Step 4.check the respective interrupt address jump to any other address
which has some sub program like add, sub etc.
Step 5.Check the result in the address given in the sub program.
Step 6.Stop.
PROCEDURE:
1. To identify the interval between interrupt address (a) cascade mode type of trigger
and vectored address we use the icw1 control word.
2. To identify weather it is specially fully nested mode or not for that ICW2 is used.
3.To identify the interrupt vector address of the 8085 mode we use the ICW4 control
word is used.
5.Once the control word is paused it check for the interrupt and output is verified by
getting answer in the respective address.
PROGRAM:
RESULT:
Thus the program for 8259 PIC and development of interrupt service routine is
executed and the output is verified.
VIVA QUESTIONS