SlideShare una empresa de Scribd logo
1 de 18
FACULTY OF ENGINEERING
PRACTICAL FILE
MICROPROCESSOR
SUBMITTED BY:- SUBMITTED BY:-
Er. PARVINDER BANGAR Name- SOURABH
(HOD ECE) Roll no. - 7910476 -L
Branch – ELECTRONICS & COMM .
ENGG.
NECS’s GROUP OF INSTITUTIONS
(Affiliated to Kurukshetra University)
CHIRAO, KARNAL
HARYANA
INDEX
Sr.
No.
Particular Date Remarks
1 Write a program to HEX
decimal additions of two
numbers.
6/09/2011
2 Write a program to HEX
decimal additions of two
numbers and the result should
not be greater than 199.
13/09/2011
3 Write a program to add two
sixteen bit numbers.
13/09/2011
4 Write a program an ALP to
rotate shaft of a 4- phase stepper
motor in clockwise 5 rotations
& in anticlockwise 5 rotations.
20/09/2011
5 Write a program to sort a string
of a number of bytes in
descending order.
20/09/2011
6 Write a program To multiply an
ASCII string of eight numbers
by a single ASCII digit. The
result is a string of unpacked
BCD digits.
11/10/2011
7 Write a program to data string of
no. of bytes is located from the
starting address 0300.This data
string is to be converted to its
equivalent 2’s complement from
and the result is to be stored
from 0400 on wards.
18/10/2011
8 Write a program Binary to gray
code conversion for number 00
to 0f using translate instruction.
8/11/2011
9 Write a program to convert BCD
number to its equivalent binary
number.
15/11/2011
10 Write a program to find square
root of a two digit number
assuming number a perfect
square.
15/11/2011
PROGRAM - 1
# Hex decimal addition of two numbers.
DISCRIPTION:-
THE PROGRAM TAKES THECONNECT OF 2040, ADDS IT TO 2041 AND
STORES THE RESULT BACK OF 2042.EXCUTE THE PROGRAM FROM 2043
LOCATION.
STEPS .
1) Initialize H<Reg. pair with address where the first number is lying.
2) Store the number in an accumulator.
3) Get the second number.
4) Add the two numbers & store the result in 2042.
5) Go back monitor. Execute from 2043 location.
ADDRESS CODE LABEL MNEMONIC OPERAND COMMENTS
2043 21 40 20 Start LXI H,2000 Points to first
no.
2046 7E MOV A,M Load the
accumulator
2047 23 INX H Advance
pointer
2048 86 ADD M Add 2nd
num.
2049 23 INX H Advance
pointer
204A 77 MOV MA Store result
2051 EF RST 5
Output:-
EXAMPLE:-
2040 20
2041 23
2042 43 DATA in HEX.
PROGRAM - 2
# The decimal addition of two numbers. The result should not be
greater than 199.
DISCRIPTION :-
The program will add two decimal lying at 2040 and 2041. The result will be stored
at 2042.
STEPS .
1) Load the content of first location in accumulator.
2) Add it with the content of second location.
3) Adjust the decimal.
4) Store the result and go back to monitor. Execute from 2043 location.
ADDRESS CODE LABEL MNEMONIC OPERAND COMMENTS
2043 21 40 20 START LXI H,2000 Points to first
no.
2046 7E MOV A,M Load the
accumulator
2047 23 INX H Advance
pointer
2048 86 ADD M Add 2nd
num.
2049 27 INX H Advance
pointer
204A 23 MOV M Store result
204B 77 ADD H
204C EF MOV MA
Output :-
2043 11
2044 20
2045 31 DATA IN HEX.
PROGRAM -3
# Add two sixteen bit number .
DISCRIPTION
This program will add two 16 bit numbers lying at 2040, 2041 , 2042 and 2043. The
result is stored at 2044 and 2045. Carry is neglected.
STEPS
1) Load the first number in HL.
2) Load the second number.
3) Add the two number and store result.
4) Go back to monitor . Execute from 2046 location.
ADDRESS CODE LABEL MNEMONIC OPERAND COMMENTS
2046 2A 40 20 START LHLD 2040 Load the HL. Reg.
with 1ST
number.
2049 EB DCHG Exchange the HL
and DE register.
204A 2A 42 20 LHLD 2042 Load the HL reg.
with 2ND
number.
204D 19 DAD Add HL &DE
register.
204E 22 54 20 SHLD 2044 Store the result in
2044.
2051 EF RST 2045
Output :-
Example:-
2040 11
2041 12
2042 14
2043 23
2044 30
2045 15
PROGRAM- 4
# Write a program an ALP to rotate shaft of a 4- phase stepper motor
in clockwise 5 rotations & in anticlockwise 5 rotations.
An ALP for rotating the shaft of the stepper motor .
ASSUME CS CODE (MNEMONIC) COMMENTS
CODE SEGMENT
START MOV AL,80H
OUT CWR , AL
MOV AL, 88H Bit pattern 10001000 to start
MOV CX , 1000 The sequence of excitation
AGAIN 1: OUT PORT A, AL From WA. Excite WA, WB.
CALL DELAY We and W0 in sequence with
delay ay. For 5 clockwise.
ROL AL ,01 Rotations the count is
200*5=1000.
DEC CX , JNZ AGAIN1 Excite till count =0.
MOV AH , 88H Bit pattern to excite WA.
MOV CX , 1000 Count for 5 rotations
AGAIN 2 OUT PORTA ,AL Excite WA,WB,Wc and W5.
CALL DELAY WAIT.
ROR AL, 01 Rotate bit pattern right to
obtain anticlockwise.
DEC CX Motion of shaft. Decrement
count.
JNZ AGAIN 2 If 5 rotations are completed
MOV AH, 4CH Return to DOS else.
INT 21H Continue
CODE ENDS
END START
Output :-
The stepper motor connection for windings .ALP for rotating the shaft of
the stepper motor in clockwise 5 rotations & in anticlockwise 5 rotations.
PROGRAM – 5
# To sort a string of a number of bytes in descending order.
ADDRESS OP CODE MNEMONIC COMMENTS
0200 BE 00 03 MOV SI,0300
Initialize SI Reg.
with Mem LOCN
0300.
0203 8B 1C MOV BX,[SI] BX has the no. of
bytes LOCNS
0300& 0301.
0205 4B DEC BX Decrement the no.
of bytes by one.
0206 8B 0C MOV CS [SI] Also CX has the no.
of bytes in LOCNS
0300 AND 0301.
0208 49 DEC CX Decrement the no.
of bytes by one.
0209 BE 02 03 MOV SI, 0302 Initialize SI reg.
with the starting
address of string.
020C 8A 04 MOV AL,[SI] Move the first data
byte of string into
AL.
020E 46 INC SI Point at the next
bytes of the string.
020F 3A 04 COMP AL,[SI] Compare the two
bytes of string.
0211 73 06 JAE 0219 If two bytes are
equal.
0213 86 04 XCHG AL,[SI] Else
0215 4E DEC SI Second byte is less
than first byte and
swap the two bytes.
0216 88 04 MOV[SI],AL
0218 46 INC SI Point at the next
LOCN of the string.
0219 E2 F1 LOOP 020C Loop if CX is not
zero.
021B 4B DEC BX At this junction,
first sorting will be
over.
021C BE 00 03 MOV SI,0300 Compared with the
rest of the nos. must
be compared with
each other logically.
021F 75 E5 JNZ 0206
0221 F4 HLT Halt .
Output :-
For Example AFTER EXECUTION
0300 : 05 0302 : 28
0301 : 00 0303 : 25
0302 : 20 0304 : 20
0303 : 25 0305 : 15
0304 : 28 0306 : 07
0305 : 15
0306 : 07
PROGRAM – 6
# Write a program To multiply an ASCII string of eight numbers by a
single ASCII digit. The result is a string of unpacked BCD digits.
ADDRESS OP CODE MNEMONIC COMMENTS
0200 BE 00 03 MOV SI, 0300 Load SI reg. with
starting address of
string.
0203 BF 08 03 MOV DI, 0308 Load DI reg. with the
starting address of
result LOCNS.
0206 B2 34 MOV DL,34 Load DL with the
multiplier ASCII Digit.
0208 B9 08 00 MOV CX,0008 Load counter reg. with
the no. of bytes in the
string.
020B C6 05 00 MOV [DI],00 .
020E 80 E2 0F ANDL, OF MS nibble of multiplier
is zeroed
0211 8A 04 MOV AL,[SI] First ASCII no. of
string in AL.
0213 46 INC SI Point at the next LOCN
in string
0214 80 E0 0F AND AL, OF MS nibble at multiplier
no gap & is also zero
0217 F6 E2 MUI DL Perform the fn.
AX=AL*DL
0219 D4 0A AAM Perform the fn. AH
=AL/0A,AL=remainder
021B 02 05 ADD AL,[DI] The contents of AL.
021D 37 AAA Added with 00 which
are in 1st Dest . LOCN.
The contents of AL are
unpacked Decimal no.
and are stored in 1st
dest. LOCN(=0308).
021E 88 05 MOV [DI], AL
0220 47 INC DI Point at the next dest.
LOCN.
0221 88 25 MOV [DI],AH Contents of AH are
moved in next best.
LOCN (0309).
0223 49 DEC CX Decrement the counter
reg.
0224 75 EB JNZ 0211 If not zero, continue
multiply and storing
unpacked BCD digits,
ELSE.
0226 F4 HLT HALT
Output :-
For example AFTER EXECUTION
0300 : 31 0308 : 04
0301 : 32 0309 : 08
0302 : 33 030A : 02
0303 : 34 030B : 07
0304 : 35 030C : 01
0305 : 36 030D : 06
0306 : 31 030E : 06
0307 : 32 030F : 08
PROGRAM -7
# A data string of no. of bytes is located from the starting address
0300.This data string is to be converted to its equivalent 2’s
complement from and the result is to be stored from 0400 on wards.
ADDRESS OP CODE MNEMONIC COMMENTS
0200 BE 00 03 MOV SI, 0300 Load SI reg.., with
the starting address
of data string.
0203 BF 00 04 MOV DI, 0400 Load DI with the
starting address of
result LOCNS.
0206 B9 10 00 MOV CX, 0010 Load CX with the
no. of bytes in the
string.
0209 AC LODSB Load AL with data
byte accessed by SI
reg. and increment
the address LOCN in
SI reg.
020A F6 D8 NEG AL The contents of AL
ae 2’s
complemented.
020C AA SIOS B Store AL contents in
LOCN pointed to by
DI ref. & increment
the current location
in DI reg.
020D E0 FA Loop NZ 0209 If CX=0000,continue
2’s complementing
the data in string
else;
020F F4 HLT Halt.
Output :-
For example after execution
0300 : 01 0400 : FF
0301 : 02 0401 : FE
0302 : 03 0402 : FD
0303 : 04 0403 : FC
0304 : 05 0404 : FB
0305 : 06 0405 : FA
0306 : 07 0406 : F9
0308 : 09 0408 : F7
3039 : 0A 0409 : F6
030A : 0B 040A : F5
030B : 0C 040B: F4
030C : 0D 040C: F3
030D : 0E 040D : F2
030E : 0F 040E : F1
030F : 10 040F : F0
PROGRAM – 8
# Write a program Binary to gray code conversion for number 00 to 0f
using translate instruction .
The address of the B. number whose equivalent gray code is to be found is in SI
register. The start address of the loop up table for the binary to gray code is in BX
register. The result will be moved to (SI + 1) location.
ADDRESS OP CODE MNEMONIC COMMENTS
0200 BB 00 03 MOV BX, 0300 Load BX with the
starting address of
look up table. Load
SI . with the address
of binary no. whose
gray code is to be
found.
0203 BE 50 05 MOV SI,05 50
0206 AC LODSB Load AL with the
data byte accessed
by SI reg. and
increment its current
address by one i.e.
SI=0551.
0207 D7 XLAT AL=(BX+AL) i.e.
the contents of
address accessed by
BX+AL is stored in
AL.
0208 88 04 MOV[SI],AL The contents of AL
are moved into
LOCN pointed by
SI, i.e.,0551
contains the result.
020A F4 HLT Halt.
LOOK UP TABLE:-
0300 : 00
0301 : 01
0302 : 02
0303 : 03
0304 : 04
0305 : 05
0306 : 06
0307 : 07
0308 : 0F
0309 : 0E
030A : 0C
030B : 0D
030C : 08
030D : 09
030E : 0B
030F : 0A
Output :-
For example
Let 0550 : 05 let 0550 : 09
Result 0551 : 05 Result 0551 : 0E
1) Enter the program from 0000:0200h
2) Execute from 0000: 0200h and check the square wave at connector J5.
PROGRAM– 9
# Write a program to convert BCD number to its equivalent binary
number.
CODE SEGMENT MNEMONIC COMMENTS
START MOV AX,DATA Initialize data segment
MOV DS,AX
MOV BX,BCDNUM BX is now having BCD
number
MOVCX,O Initialization
CONTINUE CMP BX,O Comparison to check BCD
NUM is zero.
J2 ENDPROG If zero end the program
MOV AL,BL 8 LSBs of number is
transferred to AL.
SUM AL,1 Subtract one from AL.
DAS Decimal adjust after
subtraction.
MOV BL,AL Result stored in BL.
MOV AL,BH 8 MSS is transferred to AL
SBB AL,00H Subtraction with borrow.
DAS Decimal adjust after subtraction
MOV BH,AL Result back in BH register.
INC CX Increment CX by 1
JMP CONTINUE
ENDPROG MOV BIN_NUM,CX Result is stored in data
segment.
MOV AH,4CH Termination of program
INT 21H Termination of program
CODE EN
END START
PROGRAM -10
# Write a program to find square root of a two digit number assuming
number a perfect square.
CODE SEGMENT MNEMONIC COMMENTS
START MOV AX , DATA Initialize DS.
MOV DS , AX
MOV CL, NUM Number is transferred to CL.
MOV BL,1 BL is initialize to 1.
MOV AL,0 AL initialize to 0.
UP CMP CL,0 Check for zero number.
JZ ZRESULT If zero then go to ZRESULT
label
SUB CL,BL If not zero subs tract BL from
CL.
INC AL Increment the content of AL,
ADD BL, 02 Add two to register BL.
JMP UP Go back to label up
ZRESULT MOV RESULT,AL Result is saved in data segment.
MOV AH,4CH
INT 21H
CODE ENDS,
END START

Más contenido relacionado

La actualidad más candente

Genius it ians™ 8085 programming (part 2)
Genius it ians™  8085 programming (part 2)Genius it ians™  8085 programming (part 2)
Genius it ians™ 8085 programming (part 2)Manoj Shahu
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual
Microprocessor lab manualDhaval Shukla
 
Programming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacingProgramming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacingAmitabh Shukla
 
Ec2308 microprocessor and_microcontroller__lab1
Ec2308 microprocessor and_microcontroller__lab1Ec2308 microprocessor and_microcontroller__lab1
Ec2308 microprocessor and_microcontroller__lab1v1i7n9i2
 
Microprocessor Lab Manual by Er. Swapnil V. Kaware
Microprocessor Lab Manual by Er. Swapnil V. KawareMicroprocessor Lab Manual by Er. Swapnil V. Kaware
Microprocessor Lab Manual by Er. Swapnil V. KawareProf. Swapnil V. Kaware
 
8085 instruction set (detailed)
8085 instruction set (detailed)8085 instruction set (detailed)
8085 instruction set (detailed)Ravi Anand
 
Instruction Set 8085
Instruction Set 8085Instruction Set 8085
Instruction Set 8085Stupidsid.com
 
Data transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorData transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorvishalgohel12195
 
microprocessor_labbmet.pdf
microprocessor_labbmet.pdfmicroprocessor_labbmet.pdf
microprocessor_labbmet.pdfYadav Raj
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Jay Patel
 
Code Conversion in 8085 Microprocessor
Code Conversion in 8085 MicroprocessorCode Conversion in 8085 Microprocessor
Code Conversion in 8085 MicroprocessorMOHIT AGARWAL
 
Instruction set of 8085 Microprocessor By Er. Swapnil Kaware
Instruction set of 8085 Microprocessor By Er. Swapnil KawareInstruction set of 8085 Microprocessor By Er. Swapnil Kaware
Instruction set of 8085 Microprocessor By Er. Swapnil KawareProf. Swapnil V. Kaware
 

La actualidad más candente (16)

Genius it ians™ 8085 programming (part 2)
Genius it ians™  8085 programming (part 2)Genius it ians™  8085 programming (part 2)
Genius it ians™ 8085 programming (part 2)
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual
Microprocessor lab manual
 
Programming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacingProgramming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacing
 
8085 assembly language programming
8085 assembly language programming8085 assembly language programming
8085 assembly language programming
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
 
Ec2308 microprocessor and_microcontroller__lab1
Ec2308 microprocessor and_microcontroller__lab1Ec2308 microprocessor and_microcontroller__lab1
Ec2308 microprocessor and_microcontroller__lab1
 
Microprocessor Lab Manual by Er. Swapnil V. Kaware
Microprocessor Lab Manual by Er. Swapnil V. KawareMicroprocessor Lab Manual by Er. Swapnil V. Kaware
Microprocessor Lab Manual by Er. Swapnil V. Kaware
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual
Microprocessor lab manual
 
8085 instruction set (detailed)
8085 instruction set (detailed)8085 instruction set (detailed)
8085 instruction set (detailed)
 
Instruction Set 8085
Instruction Set 8085Instruction Set 8085
Instruction Set 8085
 
Data transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorData transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processor
 
microprocessor_labbmet.pdf
microprocessor_labbmet.pdfmicroprocessor_labbmet.pdf
microprocessor_labbmet.pdf
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
 
Code Conversion in 8085 Microprocessor
Code Conversion in 8085 MicroprocessorCode Conversion in 8085 Microprocessor
Code Conversion in 8085 Microprocessor
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
Instruction set of 8085 Microprocessor By Er. Swapnil Kaware
Instruction set of 8085 Microprocessor By Er. Swapnil KawareInstruction set of 8085 Microprocessor By Er. Swapnil Kaware
Instruction set of 8085 Microprocessor By Er. Swapnil Kaware
 

Similar a MICROPROCESSOR PRACTICAL FILE

8085 instruction set and Programming
8085 instruction set and Programming 8085 instruction set and Programming
8085 instruction set and Programming pooja saini
 
Microprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionMicroprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionDheeraj Suri
 
8085 Assembly language programs.pdf
8085 Assembly language programs.pdf8085 Assembly language programs.pdf
8085 Assembly language programs.pdfRahulMishra122561
 
Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086sravanithonta79
 
Home works summary.pptx
Home works summary.pptxHome works summary.pptx
Home works summary.pptxHebaEng
 
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterLab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterKatrina Little
 
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.pptUnit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.pptIronMan665214
 
Instruction set class
Instruction set   classInstruction set   class
Instruction set classshiji v r
 
Instruction set of 8085
Instruction set  of 8085Instruction set  of 8085
Instruction set of 8085shiji v r
 

Similar a MICROPROCESSOR PRACTICAL FILE (20)

Av222 lab 1 st part
Av222 lab 1 st partAv222 lab 1 st part
Av222 lab 1 st part
 
5.pptx
5.pptx5.pptx
5.pptx
 
Adc interfacing
Adc interfacingAdc interfacing
Adc interfacing
 
Loader
LoaderLoader
Loader
 
8085 instruction set and Programming
8085 instruction set and Programming 8085 instruction set and Programming
8085 instruction set and Programming
 
Dee2034 chapter 6 register
Dee2034 chapter 6 registerDee2034 chapter 6 register
Dee2034 chapter 6 register
 
Microprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionMicroprocessor 8086 instruction description
Microprocessor 8086 instruction description
 
8085 Assembly language programs.pdf
8085 Assembly language programs.pdf8085 Assembly language programs.pdf
8085 Assembly language programs.pdf
 
Number codes students
Number codes studentsNumber codes students
Number codes students
 
Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086
 
Chapter 5 counter
Chapter 5 counterChapter 5 counter
Chapter 5 counter
 
Dee2034 chapter 5 counter
Dee2034 chapter 5 counterDee2034 chapter 5 counter
Dee2034 chapter 5 counter
 
Chapter 5 counter1
Chapter 5 counter1Chapter 5 counter1
Chapter 5 counter1
 
Number codes
Number codesNumber codes
Number codes
 
Home works summary.pptx
Home works summary.pptxHome works summary.pptx
Home works summary.pptx
 
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterLab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
 
8086 alp
8086 alp8086 alp
8086 alp
 
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.pptUnit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
Unit-2-Stack_basic_Input_Output-4-12-2022-8am.ppt
 
Instruction set class
Instruction set   classInstruction set   class
Instruction set class
 
Instruction set of 8085
Instruction set  of 8085Instruction set  of 8085
Instruction set of 8085
 

Más de Sourabh Bhattacharya (20)

Vhdl2
Vhdl2Vhdl2
Vhdl2
 
Vhdl
VhdlVhdl
Vhdl
 
Operational%20 amplifier
Operational%20 amplifierOperational%20 amplifier
Operational%20 amplifier
 
Mai506
Mai506Mai506
Mai506
 
M&i605
M&i605M&i605
M&i605
 
M&i
M&iM&i
M&i
 
Lica605
Lica605Lica605
Lica605
 
Lica506
Lica506Lica506
Lica506
 
Lica
LicaLica
Lica
 
Itc605
Itc605Itc605
Itc605
 
Itc
ItcItc
Itc
 
Vlsi707
Vlsi707Vlsi707
Vlsi707
 
Sms based wireless appliances control
Sms based wireless appliances controlSms based wireless appliances control
Sms based wireless appliances control
 
Energy merter
Energy merterEnergy merter
Energy merter
 
Comm network
Comm networkComm network
Comm network
 
132 kv seminar ppt
132 kv seminar ppt132 kv seminar ppt
132 kv seminar ppt
 
132 kv
132 kv132 kv
132 kv
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Matlab files
Matlab filesMatlab files
Matlab files
 
Matlab booklet
Matlab bookletMatlab booklet
Matlab booklet
 

Último

New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 

Último (20)

New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 

MICROPROCESSOR PRACTICAL FILE

  • 1. FACULTY OF ENGINEERING PRACTICAL FILE MICROPROCESSOR SUBMITTED BY:- SUBMITTED BY:- Er. PARVINDER BANGAR Name- SOURABH (HOD ECE) Roll no. - 7910476 -L Branch – ELECTRONICS & COMM . ENGG. NECS’s GROUP OF INSTITUTIONS (Affiliated to Kurukshetra University) CHIRAO, KARNAL HARYANA INDEX
  • 2. Sr. No. Particular Date Remarks 1 Write a program to HEX decimal additions of two numbers. 6/09/2011 2 Write a program to HEX decimal additions of two numbers and the result should not be greater than 199. 13/09/2011 3 Write a program to add two sixteen bit numbers. 13/09/2011 4 Write a program an ALP to rotate shaft of a 4- phase stepper motor in clockwise 5 rotations & in anticlockwise 5 rotations. 20/09/2011 5 Write a program to sort a string of a number of bytes in descending order. 20/09/2011 6 Write a program To multiply an ASCII string of eight numbers by a single ASCII digit. The result is a string of unpacked BCD digits. 11/10/2011 7 Write a program to data string of no. of bytes is located from the starting address 0300.This data string is to be converted to its equivalent 2’s complement from and the result is to be stored from 0400 on wards. 18/10/2011 8 Write a program Binary to gray code conversion for number 00 to 0f using translate instruction. 8/11/2011
  • 3. 9 Write a program to convert BCD number to its equivalent binary number. 15/11/2011 10 Write a program to find square root of a two digit number assuming number a perfect square. 15/11/2011
  • 4. PROGRAM - 1 # Hex decimal addition of two numbers. DISCRIPTION:- THE PROGRAM TAKES THECONNECT OF 2040, ADDS IT TO 2041 AND STORES THE RESULT BACK OF 2042.EXCUTE THE PROGRAM FROM 2043 LOCATION. STEPS . 1) Initialize H<Reg. pair with address where the first number is lying. 2) Store the number in an accumulator. 3) Get the second number. 4) Add the two numbers & store the result in 2042. 5) Go back monitor. Execute from 2043 location. ADDRESS CODE LABEL MNEMONIC OPERAND COMMENTS 2043 21 40 20 Start LXI H,2000 Points to first no. 2046 7E MOV A,M Load the accumulator 2047 23 INX H Advance pointer 2048 86 ADD M Add 2nd num. 2049 23 INX H Advance pointer 204A 77 MOV MA Store result 2051 EF RST 5 Output:- EXAMPLE:- 2040 20 2041 23 2042 43 DATA in HEX. PROGRAM - 2
  • 5. # The decimal addition of two numbers. The result should not be greater than 199. DISCRIPTION :- The program will add two decimal lying at 2040 and 2041. The result will be stored at 2042. STEPS . 1) Load the content of first location in accumulator. 2) Add it with the content of second location. 3) Adjust the decimal. 4) Store the result and go back to monitor. Execute from 2043 location. ADDRESS CODE LABEL MNEMONIC OPERAND COMMENTS 2043 21 40 20 START LXI H,2000 Points to first no. 2046 7E MOV A,M Load the accumulator 2047 23 INX H Advance pointer 2048 86 ADD M Add 2nd num. 2049 27 INX H Advance pointer 204A 23 MOV M Store result 204B 77 ADD H 204C EF MOV MA Output :- 2043 11 2044 20 2045 31 DATA IN HEX. PROGRAM -3 # Add two sixteen bit number .
  • 6. DISCRIPTION This program will add two 16 bit numbers lying at 2040, 2041 , 2042 and 2043. The result is stored at 2044 and 2045. Carry is neglected. STEPS 1) Load the first number in HL. 2) Load the second number. 3) Add the two number and store result. 4) Go back to monitor . Execute from 2046 location. ADDRESS CODE LABEL MNEMONIC OPERAND COMMENTS 2046 2A 40 20 START LHLD 2040 Load the HL. Reg. with 1ST number. 2049 EB DCHG Exchange the HL and DE register. 204A 2A 42 20 LHLD 2042 Load the HL reg. with 2ND number. 204D 19 DAD Add HL &DE register. 204E 22 54 20 SHLD 2044 Store the result in 2044. 2051 EF RST 2045 Output :- Example:- 2040 11 2041 12 2042 14 2043 23 2044 30 2045 15
  • 7. PROGRAM- 4 # Write a program an ALP to rotate shaft of a 4- phase stepper motor in clockwise 5 rotations & in anticlockwise 5 rotations. An ALP for rotating the shaft of the stepper motor . ASSUME CS CODE (MNEMONIC) COMMENTS CODE SEGMENT START MOV AL,80H OUT CWR , AL MOV AL, 88H Bit pattern 10001000 to start MOV CX , 1000 The sequence of excitation AGAIN 1: OUT PORT A, AL From WA. Excite WA, WB. CALL DELAY We and W0 in sequence with delay ay. For 5 clockwise. ROL AL ,01 Rotations the count is 200*5=1000. DEC CX , JNZ AGAIN1 Excite till count =0. MOV AH , 88H Bit pattern to excite WA. MOV CX , 1000 Count for 5 rotations AGAIN 2 OUT PORTA ,AL Excite WA,WB,Wc and W5. CALL DELAY WAIT. ROR AL, 01 Rotate bit pattern right to obtain anticlockwise. DEC CX Motion of shaft. Decrement count. JNZ AGAIN 2 If 5 rotations are completed MOV AH, 4CH Return to DOS else. INT 21H Continue CODE ENDS END START Output :- The stepper motor connection for windings .ALP for rotating the shaft of
  • 8. the stepper motor in clockwise 5 rotations & in anticlockwise 5 rotations.
  • 9. PROGRAM – 5 # To sort a string of a number of bytes in descending order. ADDRESS OP CODE MNEMONIC COMMENTS 0200 BE 00 03 MOV SI,0300 Initialize SI Reg. with Mem LOCN 0300. 0203 8B 1C MOV BX,[SI] BX has the no. of bytes LOCNS 0300& 0301. 0205 4B DEC BX Decrement the no. of bytes by one. 0206 8B 0C MOV CS [SI] Also CX has the no. of bytes in LOCNS 0300 AND 0301. 0208 49 DEC CX Decrement the no. of bytes by one. 0209 BE 02 03 MOV SI, 0302 Initialize SI reg. with the starting address of string. 020C 8A 04 MOV AL,[SI] Move the first data byte of string into AL. 020E 46 INC SI Point at the next bytes of the string. 020F 3A 04 COMP AL,[SI] Compare the two bytes of string. 0211 73 06 JAE 0219 If two bytes are equal. 0213 86 04 XCHG AL,[SI] Else 0215 4E DEC SI Second byte is less than first byte and swap the two bytes. 0216 88 04 MOV[SI],AL 0218 46 INC SI Point at the next LOCN of the string. 0219 E2 F1 LOOP 020C Loop if CX is not zero. 021B 4B DEC BX At this junction, first sorting will be over. 021C BE 00 03 MOV SI,0300 Compared with the rest of the nos. must
  • 10. be compared with each other logically. 021F 75 E5 JNZ 0206 0221 F4 HLT Halt . Output :- For Example AFTER EXECUTION 0300 : 05 0302 : 28 0301 : 00 0303 : 25 0302 : 20 0304 : 20 0303 : 25 0305 : 15 0304 : 28 0306 : 07 0305 : 15 0306 : 07
  • 11. PROGRAM – 6 # Write a program To multiply an ASCII string of eight numbers by a single ASCII digit. The result is a string of unpacked BCD digits. ADDRESS OP CODE MNEMONIC COMMENTS 0200 BE 00 03 MOV SI, 0300 Load SI reg. with starting address of string. 0203 BF 08 03 MOV DI, 0308 Load DI reg. with the starting address of result LOCNS. 0206 B2 34 MOV DL,34 Load DL with the multiplier ASCII Digit. 0208 B9 08 00 MOV CX,0008 Load counter reg. with the no. of bytes in the string. 020B C6 05 00 MOV [DI],00 . 020E 80 E2 0F ANDL, OF MS nibble of multiplier is zeroed 0211 8A 04 MOV AL,[SI] First ASCII no. of string in AL. 0213 46 INC SI Point at the next LOCN in string 0214 80 E0 0F AND AL, OF MS nibble at multiplier no gap & is also zero 0217 F6 E2 MUI DL Perform the fn. AX=AL*DL 0219 D4 0A AAM Perform the fn. AH =AL/0A,AL=remainder 021B 02 05 ADD AL,[DI] The contents of AL. 021D 37 AAA Added with 00 which are in 1st Dest . LOCN. The contents of AL are unpacked Decimal no. and are stored in 1st dest. LOCN(=0308). 021E 88 05 MOV [DI], AL 0220 47 INC DI Point at the next dest. LOCN. 0221 88 25 MOV [DI],AH Contents of AH are moved in next best. LOCN (0309). 0223 49 DEC CX Decrement the counter
  • 12. reg. 0224 75 EB JNZ 0211 If not zero, continue multiply and storing unpacked BCD digits, ELSE. 0226 F4 HLT HALT Output :- For example AFTER EXECUTION 0300 : 31 0308 : 04 0301 : 32 0309 : 08 0302 : 33 030A : 02 0303 : 34 030B : 07 0304 : 35 030C : 01 0305 : 36 030D : 06 0306 : 31 030E : 06 0307 : 32 030F : 08
  • 13. PROGRAM -7 # A data string of no. of bytes is located from the starting address 0300.This data string is to be converted to its equivalent 2’s complement from and the result is to be stored from 0400 on wards. ADDRESS OP CODE MNEMONIC COMMENTS 0200 BE 00 03 MOV SI, 0300 Load SI reg.., with the starting address of data string. 0203 BF 00 04 MOV DI, 0400 Load DI with the starting address of result LOCNS. 0206 B9 10 00 MOV CX, 0010 Load CX with the no. of bytes in the string. 0209 AC LODSB Load AL with data byte accessed by SI reg. and increment the address LOCN in SI reg. 020A F6 D8 NEG AL The contents of AL ae 2’s complemented. 020C AA SIOS B Store AL contents in LOCN pointed to by DI ref. & increment the current location in DI reg. 020D E0 FA Loop NZ 0209 If CX=0000,continue 2’s complementing the data in string else; 020F F4 HLT Halt. Output :- For example after execution 0300 : 01 0400 : FF 0301 : 02 0401 : FE 0302 : 03 0402 : FD 0303 : 04 0403 : FC 0304 : 05 0404 : FB 0305 : 06 0405 : FA 0306 : 07 0406 : F9
  • 14. 0308 : 09 0408 : F7 3039 : 0A 0409 : F6 030A : 0B 040A : F5 030B : 0C 040B: F4 030C : 0D 040C: F3 030D : 0E 040D : F2 030E : 0F 040E : F1 030F : 10 040F : F0
  • 15. PROGRAM – 8 # Write a program Binary to gray code conversion for number 00 to 0f using translate instruction . The address of the B. number whose equivalent gray code is to be found is in SI register. The start address of the loop up table for the binary to gray code is in BX register. The result will be moved to (SI + 1) location. ADDRESS OP CODE MNEMONIC COMMENTS 0200 BB 00 03 MOV BX, 0300 Load BX with the starting address of look up table. Load SI . with the address of binary no. whose gray code is to be found. 0203 BE 50 05 MOV SI,05 50 0206 AC LODSB Load AL with the data byte accessed by SI reg. and increment its current address by one i.e. SI=0551. 0207 D7 XLAT AL=(BX+AL) i.e. the contents of address accessed by BX+AL is stored in AL. 0208 88 04 MOV[SI],AL The contents of AL are moved into LOCN pointed by SI, i.e.,0551 contains the result. 020A F4 HLT Halt. LOOK UP TABLE:- 0300 : 00 0301 : 01 0302 : 02 0303 : 03 0304 : 04 0305 : 05
  • 16. 0306 : 06 0307 : 07 0308 : 0F 0309 : 0E 030A : 0C 030B : 0D 030C : 08 030D : 09 030E : 0B 030F : 0A Output :- For example Let 0550 : 05 let 0550 : 09 Result 0551 : 05 Result 0551 : 0E 1) Enter the program from 0000:0200h 2) Execute from 0000: 0200h and check the square wave at connector J5.
  • 17. PROGRAM– 9 # Write a program to convert BCD number to its equivalent binary number. CODE SEGMENT MNEMONIC COMMENTS START MOV AX,DATA Initialize data segment MOV DS,AX MOV BX,BCDNUM BX is now having BCD number MOVCX,O Initialization CONTINUE CMP BX,O Comparison to check BCD NUM is zero. J2 ENDPROG If zero end the program MOV AL,BL 8 LSBs of number is transferred to AL. SUM AL,1 Subtract one from AL. DAS Decimal adjust after subtraction. MOV BL,AL Result stored in BL. MOV AL,BH 8 MSS is transferred to AL SBB AL,00H Subtraction with borrow. DAS Decimal adjust after subtraction MOV BH,AL Result back in BH register. INC CX Increment CX by 1 JMP CONTINUE ENDPROG MOV BIN_NUM,CX Result is stored in data segment. MOV AH,4CH Termination of program INT 21H Termination of program CODE EN END START
  • 18. PROGRAM -10 # Write a program to find square root of a two digit number assuming number a perfect square. CODE SEGMENT MNEMONIC COMMENTS START MOV AX , DATA Initialize DS. MOV DS , AX MOV CL, NUM Number is transferred to CL. MOV BL,1 BL is initialize to 1. MOV AL,0 AL initialize to 0. UP CMP CL,0 Check for zero number. JZ ZRESULT If zero then go to ZRESULT label SUB CL,BL If not zero subs tract BL from CL. INC AL Increment the content of AL, ADD BL, 02 Add two to register BL. JMP UP Go back to label up ZRESULT MOV RESULT,AL Result is saved in data segment. MOV AH,4CH INT 21H CODE ENDS, END START