Lab Manual: Nada R Saraswathi Co Llege of Engineering and Tech Nology
Lab Manual: Nada R Saraswathi Co Llege of Engineering and Tech Nology
Lab Manual: Nada R Saraswathi Co Llege of Engineering and Tech Nology
LAB MANUAL
Regulation : 2013
Branch : B.E. – ECE
Year & Semest er : III Year / VI Semest er
Regulation 2013
SYLLABUS
LIST OF EXPERIMENTS:
TOTAL: 45 PERIODS
Microprocessors:
Microcontroller:
10 LARGEST& SMALLEST
15 DIGITAL CLOCK
17 PRINTER STATUS
21 8 BIT SUBTRACTION
22 8 BIT MULTIPLICATION
23 8 BIT DIVISION
EX. NO: 01
DATE :
BASIC ARITHMETIC AND LOGICAL OPERATIONS USING
8086 MICROPROCESSOR -16 BIT ADDITION
AIM:
APPARATUS REQUIRED:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
16-bit addition
FLOECHART:
ADDITION:
L1 : MOV
100F LI [1206],CX Store the carry
ADDRESS DATA
INPUT 1200
1201
1202
1203
1204
OUTPUT
1205
RESULT:
EX. NO: 02
DATE :
BASIC ARITHMETIC AND LOGICAL OPERATIONS USING
8086 MICROPROCESSOR - 16 BIT SUBTRACTION
AIM:
APPARATUS REQUIRED:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
16-bit SUBTRACTION:
FLOECHART:
SUBTRACTION:
ADDRESS DATA
1300
1301
INPUT
1302
1303
1304
OUTPUT
1305
RESULT:
EX. NO: 03
DATE :
BASIC ARITHMETIC AND LOGICAL OPERATIONS USING
8086 MICROPROCESSOR - 16 BIT MULTIPLICATION
AIM:
To write an assembly language program to perform Multiplication two 16 bit
numbers by an 8 bit number using 8086.
APPARATUS REQUIRED:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
16-bit MULTIPLICATION
Multiplication of 16-bit numbers:
FLOECHART:
MULTIPLICATION:
MULTIPLICATION OUTPUT:
INPUT
OUTPUT
RESULT:
Thus assembly language programs to perform multiplication two 16 bit
numbers by an 8 bit number using 8086 Performed and the result is stored.
EX. NO: 04
DATE :
BASIC ARITHMETIC AND LOGICAL OPERATIONS USING
8086 MICROPROCESSOR - 16 BIT DIVISION:
AIM:
APPARATUS REQUIRED:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
16-bit division
Division of 16-bit numbers:
Get the dividend and divisor.
Initialize the quotient to 0.
Dividend = dividend–divisor
If the divisor is greater, store the quotient
Go to step 3
If dividend is greater, quotient = quotient+ repeat from step 4.
FLOECHART:
DIVISION:
RESULT:
Thus assembly language programs to perform division two 16 bit numbers by
an 8 bit number using 8086 Performed and the result is stored.
EX. NO: 05
DATE :
MOVE A DATA BLOCK WITHOUT OVERLAP
AIM:
To move a data block without overlap
APPARATUS REQUIRED:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
ALGORITHM:
Increment B register.
PROGRAM:
OUTPUT:
INPUT OUTPUT
1400 1450
1401 1451
1402 1452
1403 1453
1404 1454
RESULT:
Thus the output for the Move a data block without overlap was executed
successfully.
EX. NO: 06
DATE :
CODE CONVERSION, DECIMAL ARITHMETIC
AND MATRIX OPERATIONS.
ALGORITHM:
Initialize the memory location to the data pointer.
Increment B register.
Increment accumulator by 1 and adjust it to decimal every time.
Compare the given decimal number with accumulator value.
When both match, the equivalent hexadecimal value is in B register.
Store the resultant in memory location.
FLOWCHART:
PROGRAM:
OUTPUT:[DECIMAL TO HEXADECIMAL]
INPUT
OUTPUT
RESULT:
Thus the output for the code conversions –decimal to hex was executed
successfully.
EX. NO: 07
DATE :
CODE CONVERSION –HEXADECIMAL TO DECIMAL
AIM:
To convert a given hexadecimal number to decimal.
ALGORITHM:
Initialize the memory location to the data pointer.
Increment B register.
Increment accumulator by 1 and adjust it to decimal every time.
Compare the given hexadecimal number with B register value.
When both match, the equivalent decimal value is in A register.
Store the resultant in memory location.
PROGRAM;
INPUT OUTPUT
MEMORY
DATA
RESULT:
Thus the output for the addition code conversions –decimal to hex was
executed successfully.
EX. NO: 08
DATE :
FLOATING POINT OPERATIONS- STRING
MANIPULATIONS, SORTING AND SEARCHING
Copying a String:
AIM:
To move a string of length FF from source to destination.
ALGORITHM:
FLOECHART:
PROGRAM:
INPUT OUTPUT
1400 1450
1401 1451
1402 1452
1403 1453
1404 1454
RESULT:
EX. NO: 09
DATE :
ASCENDING & DESCENDING
AIM:
To write an Assembly Language Program (ALP) to sort a given array in
ascending and descending order.
APPARATUS REQUIRED:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
PROBLEM STATEMENT:
An array of length 10 is given from the location. Sort it into descending and
ascending order and store the result.
ALGORITHM:
FLOECHART:[ASCENDING]:
FLOWCHART :[DECENDING]:
Number of comparisons in
1002 MOV CL,[SI]
CL
Go to next memory
1007 INC SI
location
Go to next memory
100B L3 : INC SI
location
DATA
INPUT
OUTPUT
DATA
INPUT
OUTPUT
RESULT:
Thus given array of numbers are sorted in ascending & descending order.
EX. NO: 10
DATE :
LARGEST& SMALLEST
AIM:
To write an Assembly Language Program(ALP) to find the largest and
smallest number in a given array.
APPARATUS REQUIRED:
2. POWER SUPPLY + 5 V DC 1
3. KEY BOARD - 1
PROBLEM STATEMENT:
An array of length 5 is given from the location. Find the largest and smallest
number and store the result.
ALGORITHM:
FLOECHART:[LARGEST]
FLOECHART:[SMALLEST]
1018 MOV [DI],AL Else store the biggest number in 1300 location
DATA
INPUT
OUTPUT
DATA
INPUT
OUTPUT
RESULT:
EX. NO: 11
DATE :
PASSWORD CHECKING
AIM:
APPARATUS REQUIRED:
2. Power Supply +5 V dc 1
PROGRAM:
; PASSWORD IS MASM1234
DATA SEGMENT
PASSWORD DB 'MASM1234'
DATA ENDS
CODE SEGMENT
START:
MOV DS, AX
INT 21H
MOV SI, 00
UP1:
INT 21H
JE DOWN
MOV [INST+SI], AL
MOV DL,'*'
INT 21H
INC SI
JMP UP1
DOWN:
MOV BX, 00
CHECK:
MOV AL,[INST+BX]
MOV DL,[PASSWORD+BX]
CMP AL, DL
JNE FAIL
INC BX
LOOP CHECK
INT 21H
JMP FINISH
FAIL:
INT 21H
FINISH:
INT 3
CODE ENDS
END START
END
RESULT:
Thus the output for the Password checking, Print RAM size and system date
was executed successfully
EX.NO: 12
DATE :
APPARATUS REQUIRED:
2. Power Supply +5 V dc 1
PROGRAM:
.MODEL SMALL
.DATA
.CODE
MOV DX,@DATA
MOV DS, DX
LEA DX, MSGIN
MOV AH, 09H
INT 21H
IN1:
Delay:
MOV AH, 0
INT 1Ah
SUB DX, BX
CMP DI, DX
JA Delay
LOOP LP
NXT2:
MOV AH, 4CH
INT 21H
END
RESULT:
Thus the output for the Counters and Time Delay was executed successfully
EXP.NO: 13
DATE :
AIM:
APPARATUS REQUIRED:
2. Power Supply +5 V dc 1
PROGRAM;
100B INX H
100E MOV A, M
1012 INX H
1019 INX H
101A DCR E
1026 L1 DCR C
1028 JNZ L1
1029 DCR D
1000 MOV A, D
1002 ORA E
1004 JNZ L2
1006 RET
RESULT:
Thus the assembly language program for traffic light control is verified
EX. NO: 14
DATE :
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:
ALGORITHM:
MEMORY
LOCATION A1 A2 B1 B2 HEX 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
FLOWCHART:
LOOP 1 : MOV
1004 AL,[DI] Copy the first data in AL
1200 :
1014 09,05,06,0A Array of data’s
RESULT:
Thus the assembly language program for rotating stepper motor in both
clockwise and anticlockwise directions is written and verified.
EX. NO: 15
DATE :
DIGITAL CLOCK
AIM:
To display the digital clock specifically by displaying the hours, minutes and
seconds using 8086 kits
APPARATUS REQUIRED:
2 Power Supply 5V
PRELIMINARY SETTINGS:
1501- Minutes
1502- Hours
1000 START
101D NOP
101E NOP
101F NOP
1020 NOP
1027 OR AL,DL
1029 JNZ S1
102B DEC CL
102D JNZ S2
1035 INC AL
1041 MOV[SI], AL
1043 INC AL
1054 INC SI
1072 MOV CL , 01
1075 INT 5
1077 RET
SECONDS
108D DIV DH
1092 DEC BX
1095 DEC BX
ADD AL, 30H
1096
1098 HLT
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.
EX. NO: 16
DATE :
INTERFACING PRGRAMMABLE KEYBOARD AND
DISPLAY CONTROLLER- 8279
AIM :
To display the rolling message “HELP US “ in the display.
APPARATUS REQUIRED:
ALGORITHM :
Display of rolling message “HELP US “
Initialize the counter
Set 8279 for 8 digit character display, right entry
Set 8279 for clearing the display
Write the command to display
Load the character into accumulator and display it
Introduce the delay
Repeat from step 1.
PROGRAM:
MEMORY
OPCODES PROGRAM COMMENDS
LOCATION
START : MOV
1000 Initialize array
SI,1200H
1000 MOV CX,000FH Initialize array size
Store the control word for
1003 MOV AL,10
display mode
1006 OUT C2,AL Send through output port
Store the control word to
1009 MOV AL,CC
clear display
100B OUT C2,AL Send through output port
Store the control word to
100E MOV AL,90
write display
1011 OUT C2,AL Send through output port
0 0 0 1 0 0 0 0
0 0 0 D D K K K
000-2Key lockout.
1 1 0 1 1 1 0 0
1 1 0 CD CD CD CF CA
11 A0-3; B0-3 =F
1-Enables Clear display
0-Contents of RAM will be displayed
1-FIFO Status is cleared
1-Clear all bits
(Combined effect of CD)
1 0 0 1 0 0 0 0
1 0 0
AI A A A A
FLOWCHART:
SEGMENT DEFINITION:
DATA BUS D7 D6 D5 D4 D3 D2 D1 D0
SEGMENTS d c b a d g f e
RESULT:
Thus the rolling message “HELP US” is displayed using 8279 interface kit.
EX. NO: 17
DATE :
PRINTER STATUS
AIM:
APPARATUS REQUIRED:
2 Power Supply 5V
PROGRAM:
XOR AX, AX
XOR BX, BX
DIV BX
MOV DL, AL
INT 21h
MOV DL, AL
INT 21h
MOV DL, AH
INT 21h
RESULT:
Thus the output for the Move a data block without overlap was executed
successfully.
EX. NO: 18
DATE :
A/D AND D/A INTERFACE AND WAVEFORM GENERATION.
ADC
AIM:
APPARATUS REQUIRED:
THEORY:
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.
ALGORITHM:
Select the channel and latch the address.
Send the start conversion pulse.
Read EOC signal.
If EOC = 1 continue else go to step (iii)
Read the digital output.
Store it in a memory location.
PROGRAM:
MEMORY
COMMENTS
OPCODES PROGRAM
LOCATION
Load accumulator
with value for ALE
1000 MOV AL,00
high
Send through output
1000 OUT 0C8H,AL port
Load accumulator
with value for ALE
1003 MOV AL,08
low
Send through output
1006 OUT 0C8H,AL port
Store the value to
make SOC high in
1009 MOV AL,01 the accumulator
Send through output
100B OUT 0D0H,AL port
FLOWCHART:
1020 IN AL,0C0H from port again
OUTPUT:
RESULT:
Thus the ADC was interfaced with 8086 and the given analog inputs were
converted into its digital equivalent.
EX. NO: 19
DATE :
INTERFACING DIGITAL – TO – ANALOG CONVERTER
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 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.
FLOECHART:
ALGORITHM:
Waveform generation:
Square Waveform:
PROGRAM COMMENTS
PROGRAM COMMENTS
PROGRAM COMMENTS
L1 Load 00 in accumulator
RET return
PROGRAM COMMENTS
L3 Load 00 in accumulator
L3 Load 00 in accumulator
WAVEFORM GENERATION:
Square Waveform
Saw-tooth waveform
Triangular waveform
RESULT
Thus the DAC was interfaced with 8085 and different waveforms have been
generated.
EX. NO: 20
DATE :
BASIC ARITHMETIC AND LOGICAL OPERATIONS
8 BIT ADDITION
AIM:
To write a program to add two 8-bit numbers using 8051 microcontroller.
ALGORITHM:
Clear Program Status Word.
Select Register bank by giving proper values to RS1 & RS0 of PSW.
Load accumulator A with any desired 8-bit data.
Load the register R 0 with the second 8- bit data.
Add these two 8-bit numbers.
Store the result.
Stop the program.
FLOW CHART:
PROGRAM:
HEX
ADDRESS LABEL MNEMONIC OPERAND CODE COMMENTS
OUTPUT:
INPUT OUTPUT
MEMORY MEMORY
DATA DATA
RESULT:
Thus the 8051 ALP for addition of two 8 bit numbers is executed.
EX. NO: 21
DATE :
8 BIT SUBTRACTION
AIM:
To perform subtraction of two 8 bit data and store the result in memory.
ALGORITHM:
Clear the carry flag.
Initialize the register for borrow.
Get the first operand into the accumulator.
Subtract the second operand from the accumulator.
If a borrow results increment the carry register.
Store the result in memory.
FLOECHART:
8 BIT SUBTRACTION
A, # Store data1 in
4101 MOV data1 74, data1 accumulator
A, # Subtract data2
4103 SUBB data2 94,data2 from data1
DPTR, # Initialize
4105 MOV 4500 90,45,00 memory
Location
Store the
difference in
4108 MOVX @ DPTR, A F0 memory
location
OUTPUT:
INPUT OUTPUT
Memory Memory
Data Data
RESULT:
EX. NO: 22
DATE :
8 BIT MULTIPLICATION
AIM:
To perform multiplication of two 8 bit data and store the result in memory.
ALGORITHM:
Get the multiplier in the accumulator.
Get the multiplicand in the B register.
Multiply A with B.
Store the product in memory.
FLOWCHART:
8 BIT MULTIPLICATION:
HEX
ADDRESS LABEL MNEMONIC OPERAND CODE COMMENTS
A Store data1 in
4100 MOV
,#data1 74, data1 accumulator
B, Store data2 in
4102 MOV
#data2 75,data2 B register.
Initialize
4106 MOV DPTR, # memory
4500H 90,45,00
location
Go to next
401A INC memory
DPTR A3 location
Store higher
410B MOV A,B E5,F0 order
OUTPUT:
INPUT OUTPUT
Memory Memory
Data Data
Location location
4500 4502
4501 4503
RESULT:
Thus the 8051 ALP for multiplication of two 8 bit numbers is executed.
EX. NO: 23
DATE :
8 BIT DIVISION
AIM:
To perform division of two 8 bit data and store the result in memory.
ALGORITHM:
Get the Dividend in the accumulator.
Get the Divisor in the B register.
Divide A by B.
Store the Quotient and Remainder in memory.
FLOWCHART:
8 BIT DIVISION
HEX
ADDRESS LABEL MNEMONIC OPERAND COMMENTS
CODE
A, # Store data1 in
4100 MOV
data1 74,data1 accumulator
Initialize
4015 MOV DPTR, # memory
4500H 90,45,00 location
MOVX Store
4018 @ DPTR,
F0
remainder
A
Go to next
4109 INC memory
DPTR A3 location
OUTPUT:
INPUT OUTPUT
Memory Memory
Data Data
Location location
4500 4502
4501 4503
RESULT:
Thus the 8051 ALP for division of two 8 bit numbers is executed.
EX. NO: 24
DATE :
SQUARE AND CUBE PROGRAM, FIND 2’S
COMPLEMENT OF A NUMBER
AIM:
To convert Square and Cube program, Find 2’s complement of a number
using 8051 micro controller
RESOURCES REQUIERED:
PROGRAM:
01 ORG 00h
02 LJMP MAIN
3 DELAYS:
8 SETB TR0
9 JNB TF0,
10CLR TF0
13RET
14MAIN:
15MOV DPTR,#300H
16MOV A,#0FFH
17MOV P1,A
18BACK:
19LCALL DELAY
20MOV A,P1
21MOVC A,@A+DPTR
22;MOV P2,#00H
23;LCALL DELAY
24MOV P2,A
25SJMP BACK
26ORG 300H
27XSQR_TABLE:
28DB 0,1,4,9,16,25,36,49,64,81
29END
OUTPUT
RESULT;
Thus the Square and Cube program, Find 2’s complement of a number is
done in 8051 microcontroller
EX. NO: 25
DATE :
UNPACKED BCD TO ASCII
AIM:
To convert BCD number into ASCII by using 8051 micro controller.
RESOURCES REQUIERED:
FLOWCHART:
ALGORITHM:
AAM
00 59 08 09
AH AL AH AL
ADD AX,
08 09 38 39
3030H
AH AL AH AL
NOTE; 38h and 39h are the ASCII equivalents of 8 and 9 respectively
PROGRAM;
ROUTINE: convert binary for number less than 100 passing parameter
AAM
ADD AX, 3030H
MOV BX, AX
MOV DL, BH
MOV AH, 02
INT 21H
MOV DL, BL
INT 21H
POP AX
POP BX
POP DX
RET
END P
RESULT:
The given number is converted into ASCII using 8051 microcontroller kit.