You are on page 1of 43

8 80 08 85 5 M MI IC CR RO OP PR RO OC CE ES SS SO OR R L LA AB B M MA AN NU UA AL L

IV SEMESTER B.E (TCE)


(For Private Circulation Only)



VISHVESHWARAIAH TECHNOLOGICAL UNIVERSITY

VESHWARAIAH TECHNOLOGICAL
DEPARTMENT OF TELECOMMUNICATION ENGINEERING
SRI SIDDHARTHA INSTITUTE OF TECHNOLOGY
MARALUR, TUMKUR 572 105



MICROPROCESSOR LAB MANUAL

CONTENTS

1. Program to move a da6ta block without overlap
2. Program to move a data block with overlap
3. Program to execute ascending/descending order.
4. Program to add N one byte numbers
5. Program to add two multi byte binary number
6. Program to add BCD numbers.
7. program to subtract two 16 bit numbers
8. Program to check the 4
th
bit of 8-numbers
9. Program to generate a resultant byte where 7
th
bit is given by A
7
A
2
A
5
A
6

10. Program to implement

multiplication by successive addition method
11. Program to implement multiplication by shift left & add method.
12. Program to implement 16 bit by 8-bit division.
13. Program to implement decimal up counter
14. Program to implement down counter
15. Program to implement HEX up counter
16. Program to implement HEX down counter
17. Program to implement 2 out of 5 code
18. Program to find the smallest of N numbers
19. Program to implement real time clock
20. Program to implement BINARY TO BCD conversion
21. Program to implement BINARY TO ASCII conversion
22. Program to implement ASCII TO BINARY conversion
23. Program to implement BCD TO BINARY conversion
24. Program to implement square wave generation using DAC
25. Program to implement triangular wave generation using DAC
26. Program to implement stair case waveform using DAC
27. Program to implement Keyboard sensing
28. Program to display using seven segment display scrolling.
29. Program to display ASCII equivalent of the key pressed
30. Program to implement THROW OF A DICE.
31. Program to control the speed and direction of stepper motor
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


1. WriteanALPtomovedatablockstartingat locationX tolocationY without overlap.

PROGRAM ALGORITHM
START: LXI H, F000H
LXI D, F100H
MVI C, 04
LOOP: MOV A, M

STAX D

INX H
INX D
DCR C
JNZ LOOP

HLT

; InitializeHL rp* withsourceaddr*.
; InitializeDE rpwithdestinationaddr.
; movetheblocklengthintoreg.C
; movethedatafrommemorylocationaspointedbyHL rptoreg. A
; Storethedatafromreg. A intothedest*.
whoseaddr. ispointedbyDE rp.
; Increment thesrc*. addr.
; Increment dest addr.*
; Decrement thecounter.
; If counter iszeroterminatetheprogram
Elserepeat theprogramfor next data.
; Terminatetheprogram.


NOTE: * denotes
Addr Address
rp register pair
dest Destination
src Source

RESULT:
STARINGSRC. ADDR.=F000
STARTINGDEST. ADDR.=F100
BLOCK LENGTH=04

BEFORE EXECUTION AFTEREXECUTION
Src.addr. Data Dest.addr. Data Src.addr. Data Dest.addr. Data
F000
F001
F002
F003
01
02
03
04
F100
F101
F102
F103
XX
XX
XX
XX
F000
F001
F002
F003
01
02
03
04
F100
F101
F102
F103
01
02
03
04


MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


2. WriteanALPtomoveablockstartingat locationX tolocationY withoverlap.

PROGRAM ALGORITHM

START: LXI H, F109

LXI D, F10E

MVI C, 0A
LOOP: MOV A, M

STAX D

DCX H
DCX D
DCRC
JNZLOOP

HLT


; InitializeHL rp* withlast locationof source
addr.
; InitializeDE rpwithlast locationof
Destinationaddr*.
; Movetheblocklengthintoreg.C
; movethedatafrommemorylocationas
PointedbyHL rptoreg. A
; Storethedatafromreg. A intothedest*.
whoseaddr. ispointedbyDE rp.
; Decrement thesrc*. addr.
; Decrement dest addr.*
; Decrement thecounter.
; If counter iszeroterminatetheprogram
elserepeat theprogramfor next data.
; Terminatetheprogram.


RESULT:
STARINGSRC. ADDR.=F100
STARTINGDEST. ADDR.=F105
BLOCK LENGTH=0A
BEFORE EXECUTION AFTEREXECTION

Src.addr. Data Dest.addr. Data
F100
F101
F102
F103
F104
F105
F106
F107
F108
F109
00
01
02
03
04
05
06
07
08
09
F105
F106
F107
F108
F109
F10A
F10B
F10C
F10D
F10E
00
01
02
03
04
05
06
07
08
09
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


3. WriteanALPtoarrangeset of 8bit numbersstartingat locationinASCENDING/DESCENDINGorder.
Displaythestoredvector inaddress-datafield.

PROGRAM ALGORITHM
START: MVI B, (N-1)
MVI C, (N-1)
NXTPASS: LXI H, F100
LOOP: MOV A, M
INX H
CMPM
JC NOSWAP

SWAP: MOV D, M
MOV M,A
DCX H
MOV M, D
INX H
NOSWAP: DCRC
JNZLOOP
DCRB
MOV C, B
JNZNXTPASS
DISPLAY: LXI H, F100

MVI C, N
NEXT: MOV A, M
STA FFF1
PUSHH
PUSHB
CALL UPDDT
CALL DELAY
POP B
POP H
INX H
DCRC
JNZ NEXT

; Loadregister Bwith(N-1), No. of passes
; Loadregister Cwith(N-1) comparisons
; Movestartingaddressof theDataintoHL rp.
; Movedatatoregister A
; Increment thepointer.
; Comparewiththenext element
; If carryjumptoNOSWAP, elseinterchangethedata
; Interchangetwodata
; Consecutiveelements
; Decrement thememorylocation

; Increment register pair.
; Decrement register C(No. of comparisons)
; If not zerojumptoloop, else
; decrement register B(No. of passes)
; Thedatainregister Bismovedtoregister C
; If not zero, jumptonext pass
; InitializeHL pair withaddressof thelist
( ascending/descending)
; Initializecounter.
; Loadtheelement inregister A.
; Storethecontent of register A inFFF1.
; Pushaddr, of thedataintotheStack
; Pushthecontent intotheStack.
; Displaythedataondatasheet.
; Wait for sometime.
; Popthecounter
; Poptheaddr. of thelist.
; Increment pointer
; Decrement counter
; If Counter=0terminatetheprogram, elsetake
next datafor comparison.
; Terminatetheprogram.
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


HLT
DELAY: LXI B, F424
WAIT: DCX B
MOV A, C
ORA B
JNZWAIT
RET
; Loadreg. pair BCwiththecount for 0.5sdelay.
; Decrement count
; Checkif count iszero
; Clear theAccumulator contents
; If count isnot zerojumptoWAIT, elsereturnto
mainprogram
RESULT SHEET:

N=07

AFTEREXECUTION:

Src.addr. Data DataField
F100
F101
F102
F103
F104
F105
F106
30
12
A3
04
46
71
23
04
12
23
30
46
71
A3

NOTE: For Descendingorder ChangeJCtoJNC














MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


4. WriteanALPtoaddNonebytebinarynumbersstoredfromlocationX+1 whereNisstoredat location
X. Storetheresult inlocationY &Y+1. Displaytheresult inaddressfield.
PROGRAM ALGORITHM
START: LXI H, F100
MOV C, M
SUB A
MOV B,A
LOOP: INX H
ADD M
JNC LOOP1
INRB
LOOP1: DCRC
JNZLOOP
MOV H,B
MOV L,A
SHLD F2OO
CALL UPDAD
HLT
STEP1: Initializethestartingaddressof the
Datablock
STEP2: Initializethecount.
STEP3: Initializetheinitial sumtozero.
STEP4: Addthedatabytesonebyone.
STEP5: Increment thememorypointer oneby
Onefor oneeachaddition.
STEP6: Decrement thecount byonefor each
Condition. Checkfor zerocondition.
STEP7: If thecount isnot zero, repeat step4to
6.
STEP8: If thecount iszerohalt theprocessor.

NOTE: StoretheprogramstartingfromF000H.
Storethecount at locationF100H.
StorethedatastartingfromF101H.
Executetheprogram. Theresult will bedisplayedinthedisplayfield.
Theresult isalsoinlocationF200H&F201H
Addressfor UPDADis06BFH
RESULT:
LENGTHOF BLOCK =04
STORE AT LOCATIONF100
BEFORE EXECUTION: AFTEREXECUTION:
DataAddr. Data Result Addr. Data
F101
F102
F103
F104
01
02
03
04
F200
F201
0A
00


ADDRESSFIELD:
0 0 0 A
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


5. WriteanALPtoaddtwomulti-bytebinarynumber startingat locationsX andY andstoretheresult at location
Z.

PROGRAM ALGORITHM
START: LXI H, F100
LXI B, F200
LXI D, F300
STC
CMC
MVI A, 04
LOOP: STA F400
LDAX B
ADC M
STAX D
INX H
INX B
INX D
LDA F400
DCR A
JNZ LOOP
MVI A,00
RAL
STAX D
HLT
STEP1: Initializethestartingaddressof the
twomulti-bytenumbersat result
Location(F100, F200&F300).
STEP2: Reset thecarryflag
STEP: 3: Addthemulti-bytenumbersbyteby
bytebyconsideringthecarry
Condition.
STEP4: Checkthebytecount logically
without affectingthestatus.
STEP5: If thebytecount isnot zero, repeat
thesteps3&4
STEP6: If thebytecount iszero, count the
final carry, meantimestorethe
result.
STEP 7: Halt theprocessor.




NOTE:
StoretheprogramstartingfromF000H.
Storethefirst 32bit number datastartingfromF100H.
Storethesecond32bit number datastartingfromF200H.
Storetheresult startingfromF300.
Executetheprogram. Theresult will bedisplayedinthedisplayfield.
Theresult isalsoinlocationF200H&F201H



MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


RESULT:

BEFORE EXECUTION:
Addr. Of 1
st

multibytenumber
Data Addr. Of 2
nd
multibyte
number
Data Addr. Of theresult Data
F100
F101
F102
F103
01
02
03
04
F200
F201
F202
F203
AA
BB
CC
DD
F300
F301
F302
F303
XX
XX
XX
XX



AFTEREXECUTION:
Addr. Of 1
st

multibytenumber
Data Addr. Of 2
nd
multibyte
number
Data Addr. Of theresult Data
F100
F101
F102
F103
01
02
03
04
F200
F201
F202
F203
AA
BB
CC
DD
F300
F301
F302
F303
AB
BD
CF
E1


















MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


6. WriteanALPtoadd N2-digit BCDnumbersstoretheresult at locationXandstorethesameinaddress/data
field.
PROGRAM ALGORITHM
START: LXI H,F100H
MOV C,M
SUBA
MOV B,A
RPT: INX H
ADDM
DAA
JNCNOF
PUSH PSW
MOV A,B
ADI 01H
DAA
MOV B,A
POP PSW
NOF: DCRC
JNZRPT
MOV L,A
MOV H,B
SHLDF200H
CALL UPDAD
HLT
STEP1. Initializethestartingaddressof the
datablockwherethetwodigits
BCDnumbersarestored.
STEP2. Initializethecounter.
STEP3. Initializethesum00H.
STEP4. Addthedatabytesonebyone
meantimeconvert thesumintothe
decimal value
STEP5. Decrement thecounter onebyone
andcheckfor thezerocondition.
STEP6. If thecounter isnot zerorepeat
step4to6
STEP7. If thecounter iszerodisplaythe
result
STEP8.Halt theprocessor.
NOTE:
StoretheprogramstartingfromF000h.
Storethecounter at F100H
Storethe2-digit BCD numbersstartingat thelocationF101H
Executetheprogram.
Result will bedisplayedinthedisplayfieldandthesamewill storedat location F200HandF201H
#ADDRESSFORUPDADis06BFh.






MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


RESULT:
BEFORE EXECUTION AFTEREXECUTION
Address Data Addressfor
result
Data Address Data Addressfor
result
Data
F100 04(cnt) F200 X X F100 04(cnt) F200 10
F101 11 F201 X X F101 11 F201 01
F102 22 F102 22
F103 33 F103 33
F104 44 F104 44
ADDRESSFIELD:


















0 1 1 0
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


7. WriteanALPtosubtract a16-bit binarynumber storedat locationX &X+1 fromanother 16-bit number
at locationY &Y+1. Displaytheresult inaddressfield.

PROGRAM ALGORITHM
START : LHLDF100
XCHG
LHLDF102
MOV A,L
SUBE
MOV L,A
MOV A,H
SBBD
MOV H,A
SHLDF104
CALL UPDAD
HLT
STEP1: Load thetwo16-bit BCD
numbers fromrespective
locations
STEP2: Usingsuitableinstructionsin
Decimal modefindsthenumbers.
STEP3: Storetheresult intheaddress
field.
STEP 4: Halt theprocessor.


NOTE:
Addressfor UPDADis06BFH
StoretheprogramstartingfromF000H
Storethe16-bit datasat LOCF100H, F101HandF102H, F103H
Respectively.
Executivetheprogram.
Result will bedisplayedinaddressfield.
RESULT:
BEFORE EXECUTION
Addr. For 1
st
data Data Addr. For 2
nd
data Data
F100H
F101H
3C
3C
F102H
F103H
C3
C3
AFTEREXECUTION

Addressfield:

CY=0. Thereforeanswer ispositive.


8 7 8 7
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


8.WriteanALPtocheckthefourthbit of abytestoredat locationX isa0 or 1. If 0 store00H elsestoreFFH
at locationY. DisplaythesameinADDRESS/DATAfield.

PROGRAM ALGORITHM
START: LDA F100H
ANI 10H
JZSTRO
MVI A,FFH
STRO: STA F1O1H
CALL UPDDT:
HLT
STEP1: LoadthedatabytefromLOCX
toACC.
STEP2: Checkthefourthbit usingsuitable
Instruction.
STEP3: Checktherespectiveflag
Condition.
STEP4: Storeresult/ decisionat LOCY.
STEP5: DisplaythesameinDATA field.
STEP 6: Halt theprocessor.

NOTE:
StorethedatatypeinLOCX (F100H).
Executetheprogram. Result will bedisplayedinDATA fieldandalsostored
inLOCY (F101H)
#for UPDAD: is06BFH.
#for UPDAD: is06D6H


RESULT:

BEFORE EXECUTION AFTEREXECUTION
Addr. of LOCX DATA Addr. of LOCY DATA DatainDatafield
F100H 07 F101H 00 00
F100H 90 F101H FF FF






MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


9. WriteanALPtogenerateresultant bytewhose7
th
bit isgivenby:
A
7
=A
2
A
5
A
6

PROGRAM ALGORITHM
START: LDA F100H
MOV B,A
RRC
RRC
ANI 01H
MOV C,A
MOV A,B
RLC
RLC
ANI 01H
MOV D,A
MOV A,B
RLC
RLC
RLC
ANI 01H
XRA D
XRA C
RRC
STA F300H
CALL UPDDT:
HLT
STEP1: LoadthedatabytefromLOCX
toACC.
STEP2: Checkthefourthbit usingsuitable
Instruction.
STEP3: Checktherespectiveflag
Condition.
STEP4: Storeresult/ decisionat LOCY.
STEP5: DisplaythesameinDATA field.
STEP 6: Halt theprocessor.
NOTE:
StoretheprogramfromF000h., Storethedataat F100h., Executetheprogram.
Result will bestoredinthememorylocationF101h, andthesamewill be
displayed inthedatafield.
If A7bit is1, DATA fieldwill alwaysdisplay80H
If A7bit is0, DATA fieldwill alwaysdisplay00H
# Addressfor UPDAD: is06BFH.
RESULT:
BEFORE EXECUTION AFTEREXECUTION
Addr. of LOCX DATA Addr. of LOCY DATA DatainDatafield
F100H 17H F300H 80H 80H
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


10.WriteaALPtofindtheproduct of twounsignedbinarynumbersstoredat locationX andX+1 using
successiveadditionanddisplaytheresult inaddressfield.
PROGRAM ALGORITHM
START: LDA F100H
MOV E,A
MVI D,00H
LDA F101H
MOV C,A
LXIH, 0000H
MOV A,E
CPI 00H
JZ DISPLY
MOV A,C
CPI 00H
JZDISPLY
LOC: DADD
DCRC
JNZLOC
DISPLY: SHLDFE73H
CALL UPDAD
HLT
STEP1: Loadthedata fromlocationsX
andX+1.
STEP2: Findtheproduct usingsuccessive
Additionmethod.
STEP 3: Displaytheresult inADDRESS
field
STEP 4: Halt theprocessor.

NOTE:
StoretheprogramstartingfromF000H
Storethedataat LOCF100HandF101H
Executivetheprogram.
Result will bedisplayedinaddressfield.
#Addressfor UPDADis06BFH.
RESULT:

BEFORE EXECUTION
Addr. For 1
st
multiplier Data Addr. For 2
nd
multiplier Data
F100H 06 F101H 05

AFTEREXECUTION:

AddressField:
0 0 1 E
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


11. WriteanALPtofindtheproduct of twounsignedbinarynumbersstoredat locationX andX+1 byshift left
andaddmethodanddisplaytheproduct inaddressfield.

PROGRAM ALGORITHM
START: LXI H, F100H
MOV E,M
MVI D,00H
INX H
MOV A,M
LXI H,0000H
MVI B,08H
MULT: DADH
RAL
JNCSKIP
DADD
SKIP: DCRB
JNZMULT
SHLDFE73
CALL UPDAD
HLT
STEP1: LoadthedatasfromlocationsX
andX+1.
STEP2: Findtheproduct usingShift Left
method.
STEP 3: Displaytheresult inADDRESS
field
STEP 4: Halt theprocessor.

NOTE:
StoretheprogramstartingfromF000H
Storethedataat LOCF100HandF101H
Executivetheprogram.
Result will bedisplayedinaddressfield.
#Addressfor UPDADis06BFH.
RESULT:

BEFORE EXECUTION
Addr. For 1
st
multiplier Data Addr. For 2
nd
multiplier Data
F100H 06 F101H 05

AFTEREXECUTION:

AddressField:


0 0 1 E
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


12. WriteanALPtodividea16bit number at locationXandX+1byan8bit number at locY. Displaythe
Quotient inaddressfieldandremainder indatafiled.

PROGRAM ALGORITHM
START: LHLD FIOOH
XCHG
LDA FI02H
MOV L, A
MVI H,00H
LXI B, 0000H
RPTS: MOV A,E
SUBL
MOV E,A
MOV A,D
SBBH
MOV D,A
INX B
JNCRPTS
DCX B
DADD
MOV A, L
MOV L,C
MOV H,B
PUSHH
CALL UPDDT
POPH
CALL UPDAD
HLT

STEP1; Loadthe16bit number fromthe
specifiedmemorylocationthat is
F100HandF101H
STEP2: Load8bit number from
specifiedmemorylocation
(F102H)
STEP3: Usingsuccessivesubtraction
principlefindthequotient and
remainder
STEP4: Displaytheresult inDatafield
andaddressfield.
STEP5: Terminatetheprogram.
NOTE:
o StoretheprogramstartingfromF000H
o Storethe16bit number at F100HandF101H(Numerator)
o Storethe8bit number at F102H(denominator)r)
o Executetheprogram, result will bedisplayedinthedisplayfield
&addressesfor UPDDT: is06D6H
RESULT:

MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


BEFORE EXECUTION: BEFORE EXECUTION
DataAddr. Data(Numerator) DataAddr Data(Denominator)
F100
F101

0A
00
F102 05
AFTEREXECUTION:

Addressfield: Datafield:

0 0 0 2



























0 0
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


13. WriteanALPtoimplement acounter tocount from00 99 (UPCOUNTER) inBCD. Useasubroutineto
generateadelayof onesecondbetweenthecounts.

PROGRAM ALGORITHM
START: MVI A,00H
RPTD: PUSHPSW
CALL UPDDT
CALL DELAY
POP PSW
ADI 01H
DAA
JMPRPTD
HLT

DELAY: LXI B, F424H
WAIT: DCX B
MOV A,C
ORA B
JNZWAIT
RET
STEP 1: Initiatetheminimumnumber in
accumulator
STEP2: DisplayintheDATA field
STEP3: Add01tothepresent value
displayed
STEP4: Usedecimal conversion
Instruction.
STEP5: Repeat thesteps2-4.
STEP6: Provideproper displaybetween
Eachdisplay.
STEP7: TerminatingPoint.

NOTE:
StoretheprogramstartingfromF000H.
Executetheprogram; theresult will bedisplayedintheDATA field.
#Addressfor UPDAD: is06BFH.
RESULT:
It countsfrom00to99withthegivendelayinDATA field.
0 0
0 1
. .


9 8
9 9
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


14. Writeaprogramfor decimal downcounter 99-00
(DOWNCOUNTER) anddisplaythecount inDATA/ADDRESSfield

PROGRAM ALGORITHM
START: MVI A,99H
DSPLY: PUSH PSW
CALL UPDDT
CALL DELAY
POP PSW
ADI 99H
DAA
JMP DSPLY
HLT
DELAY: LXI D, FFFFH
REPEAT: DCX D
MOV A, E
ORA D
JNZ REPEAT
RET
Step1: Initiatethemaximumcount Acc
Step2: Displaythepresent countingdata
field
Step3: Provideproper delayusing
subroutinetechniques
Step4: Decrement thecountingdecimal
mode( Use10scomplement
method)
Step5: Repeat steps2, 3, and4

Step6: Terminatetheprogram
NOTE:
o StoretheprogramstartingfromLOCF000H
o Executetheprogram
o Observetheresult onthedatafield
o # Addressfor UPDDT: 06D6H
RESULT:
It countsfrom99to00withthegivendelayondatafield.
DATAFIELD
9 9
9 8


0 1
0 0
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


15. WriteanALPtoimplement acounter tocount from00 FF (UPCOUNTER) inHEX. Useasubroutineto
generateadelayof onesecondbetweenthecounts.

PROGRAM ALGORITHM
START: MVI A,00
RPTD: PUSH PSW
CALL UPDDT
CALL DELAY
POP PSW
ADI 01H
JMPRPTD
HLT

DELAY: LXI B, F424H
WAIT: DCX B
MOV A,C
ORA B
JNZWAIT
RET
STEP1: Initiatetheminimumnumber in
accumulator
STEP2: DisplayintheDATA field
STEP3: Add01tothepresent value
displayed
STEP4: Repeat thesteps2-4.
STEP5: Provideproper displaybetween
Eachdisplay.
STEP6: TerminatingPoint.

NOTE:
StoretheprogramstartingfromF000H.
Executetheprogram; theresult will bedisplayedintheDATA field.
#Addressfor UPDAD: is06BFH.
RESULT:
It countsfrom00toFF withthegivendelayinDATA field.

0 0
0 1


F E
F F

MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


16. WriteanALPtoimplement acounter tocount fromFF 00 (DOWNCOUNTER) inHEX. Useasubroutineto
generateadelayof onesecondbetweenthecounts.

PROGRAM ALGORITHM
START: MVI A,FFH
RPTD: PUSH PSW
CALL UPDDT
CALL DELAY
POP PSW
SBI 01H
JMPRPTD
HLT

DELAY: LXI B, F424H
WAIT: DCX B
MOV A,C
ORA B
JNZWAIT
RET
STEP1: Initiatetheminimumnumber in
accumulator
STEP2: DisplayintheDATA field
STEP3: Subtract 01tothepresent value
Displayed.
STEP4: Repeat thesteps2-4.
STEP5: Provideproper displaybetween
Eachdisplay.
STEP6: TerminatingPoint.
NOTE:
StoretheprogramstartingfromF000h.
Executetheprogram; theresult will bedisplayedintheDATA field.
#Addressfor UPDAD: is06BFH.
RESULT:
It countsfromFF to00withthegivendelayinDATA field.

F F
F E
. .


0 1
0 0
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


17. WriteanALPtocheckwhether the8-bit numbersstoredat locationX belongsto2out of 5code or not.
Display00 if invalidandFF if valid, onthedatafield.
PROGRAM ALGORITHM
START: LDA F100H
ANI E0H
JNZDISPLAY
LDA F100H
JPODISPLAY
MVI C,05H
MVI B,00H
RPT1: RRC
JNCNEXT1
INRB
NEXT1: DCRC
JNZRPT1
MOV A,B
CPI 02H
MVI A,FFH
JZNEXT2
DISPLAY: MVI A,00H
NEXT2: STA FE75H
CALL UPDDT
HLT
STEP1: Loadthedatatobecheckedfor
Codestatus.
STEP2: Checkthe3MSBsarezeroor not.

STEP3: If zeroproceedfurther elseDisplay
error andhalt theprocessor.

STEP4: Count thenumber of onesinthe
5-bits
STEP5: Checkthecount with02

STEP6: If count=02, displayFFH onthe
Datafiledandhalt theprocessor.

STEP7: If count 02display00 onthe
Datafieldandhalt theprocessor.

STEP 8: Halt theprocessor.
NOTE:
StoretheprogramstartingfromF000H, Storethedataat LOCF100H., Executetheprogram.
Result will bedisplayedindatafield, DisplaysFF onDatafiledfor validcondition.
Displays00onDatafiledfor invalidcondition.
#Addressfor UPDDT is06D6H
RESULT:
Eg1: Eg2:
BEFORE EXECUTION
Address Data
F100H 12H

AFTEREXECUTION: AFTER EXECUTION

DataField:
BEFORE EXECUTION
Address Data
F100H 19H
F F 0 0
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


18. WAPtofindthesmallest of N 1-bytenumbers. Valueof N isstoredinlocationX &numbersfrom
X+1. Displaythenumber indatafield&itsaddressinaddressfield.
PROGRAM ALGORITHM
START: LXI H,F500H
MOV C,M
INX H
MOV A,M
DCRC
LOOP1: INX H
CMPM
JCAHEAD
MOV A,M
AHEAD: DCRC
JNZ LOOP1
STA F300H
LXI H,F500H
MOV C,M
INX H
LOOP3: CMPM
JZ LOOP2
INX H
DCRC
JNZLOOP3
LOOP2: SHLD F301H
CALL UPDAD
LDA F300H
CALL UPDDT
HLT
STEP1: Initializethestartingaddressof
Thearrayof Nelements.

STEP2: Loadthecount N.

STEP3: Findthesmallest number by
comparingtheelementsgivenby
Verifyingthecarryflag.

STEP4: Storetheaddressof smallest
Number at F301.

RESULT:
Lengthof Block=04

AFTEREXECUTION:







BEFORE EXECUTION
Address Data
F500H(cnt) 04
F501H A1
F502H 11
F503 01
F504 B2
Address Data
F 5 0 3 01
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


19. WAPtorealizereal timeclock. Displaysecondsindatafield, minutesandhoursinaddressfield.
PROGRAM ALGORITHM
START: LXI H,0000H
MIN: MVI A,00H
SEC: PUSHPSW
PUSHH
PUSHH
CALL UPDDT
POPH
CALL UPDAD
LXI D,FFFFH
CALL DELAY
CALL DELAY
POPH
POPPSW
ADI 01H
DAA
CPI 60
JNZSEC
MOV A,L
ADI 01H
DAA
MOV L,A
CPI 60
JNZMIN
MVI L,00
MOV A,H
ADI 01H
DAA
MOV H,A
CPI 24H
JNZMIN
JMPSTART
HL T
STEP1: Initialize thedatafor secondsin
acc...
STEP2: Initializethedatafor minutesinL
reg.
STEP3: Initializethedatafor hoursinH
reg
STEP4: Displaythedata inthedisplay
field
STEP5: Call proper delayof onesecond.
STEP6: Increment thesecondby01and
compareit with thevalue60
suitablyif it isequal increment the
minutebyoneandcompareit with
thevalue24suitably, if not for all
theaboveincrement thesecond
Valueandrepeat thesteps4-5. STEP7: Termination.

RESULT: AFTEREXECUTION






Addressfield Datafield
Hours Min Sec
00 00 01
.. .. ..
.. .. ..
.. .. ..
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


20. WriteanALPtoconvert aBINARY numbersstoredat LOC XtoitsBCDequivalent anddisplayit inthe
data/ addr field.

PROGRAM ALGORITHM
START: LDA F100H
MOV B,A
MVI D, 64H
CALL BCD
MOV H,C
MVI D,0AH
CALL BCD
MOV A,C
RLC
RLC
RLC
RLC
ORA B
MOV L,A
CALL UPDAD
HLT
BCD: MVI C,00H
MOV A,B
RPTS: SUB D
JCNC
INRC
JMPRPTS
NC: ADD D
MOV B,A
RET
STEP1: Loadthenumber tobe
converted
STEP2: Onthebasisof successive
subtractionfindthe
Co-efficient inBCDform.
STEP3: Displaytheresult inAddress
Field.

STEP4: Halt theprocessor

NOTE:
StoretheprogramstartingfromLOCF000H
StoretheprogramstartingfromLOCF100H
Executetheprogram
Observetheresult ontheaddressfield


MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR




RESULT:
EXAMPLE 1:
BEFORE EXECUTION:

F100H FFH


AFTEREXECUTION:

BINARY NUMBER BCDNUMBER

FFH




EXAMPLE 2:
BEFORE EXECUTION:

F100H ACH

AFTEREXECUTION:

BINARY NUMBER BCDNUMBER

ACH









0 2 5 5
0 1 7 2
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


21. WriteanALPtoconvert aBINARY NUMBERstoredat locationX toits ASCII EQUIVALENT and
displayinDATAfield.
PROGRAM ALGORITHM
START: LDA F100H
MOV B,A
CALL ASCII
MOV L,A
MOV A,B
RRC
RRC
RRC
RRC
CALL ASCII
MOV H,A
MOV A,B
PUSHH
CALL UPDDT
POP H
CALL UPDAD
HLT
ASCII: ANI 0FH
CPI 0AH
JCBUS
ADI 07H
BUS: ADI 30H
RETURN: RET
STEP1: Loadthebinarynumber from
LOCX
STEP2: Separatethenibbles
STEP3: Convert eachnibbletoitsASCII
Equivalent.
STEP4: Addthetwoconvertedvalues.
STEP5: Displaytheresult intheDATA
Field.
STEP 6: Halt theprocessor.
NOTE:
StoretheprogramstartingfromF000h.
Storethebinarynumber at F100h.
Executetheprogram; theresult will bedisplayedinthedatafield.
#Addressfor UPDDT: is06D6H.
#Addressfor UPDAD: is06BFH.
RESULT:
BEFORE EXECUTION AFTEREXECUTION
Addr. of LOCX DATA DatainDatafield
1. F100H 01H 30 31
2. F100H ABH 41 42
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


22. WriteanALPtoconvert aASCII NUMBERstoredat locationX toits BINARY EQUIVALENT and
displayinDATAfield.

PROGRAM ALGORITHM
START: LDA F100H
CPI 40H
JCRPT
JZHALT
SUI 40H
ADI 09H
JMP DISP
RPT: SUI 30H
DISP: CALL UPDDT
HALT: HLT
STEP1: LoadtheASCII number from
LOCX.
STEP2: Checkfor digit / alphabets.
STEP3: Usingsuitablelogicand
instructionsconvert theASCII
Number intobinary.
STEP 4: Displayit intheDATA field.
STEP 6: Halt theprocessor.

NOTE:
StoretheprogramstartingfromF000h.
StoretheASCII number at F100h.
Executetheprogram; theresult will bedisplayedinthedatafield.
#Addressfor UPDDT: is06D6H.

RESULT:

BEFORE EXECUTION AFTEREXECUTION
Addr. of LOCX DATA DatainDatafield
1. F100H 30H 00
2. F100H 34 04







MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


23. Writeaprogramtoconvert aBCDnumber storedat LOC XtoitsBINARY equivalent &displayit indata
field
PROGRAM ALGORITHM
START: LDA F100H
MOV B,A
ANI F0H
RRC
RRC
RRC
RRC
MOV D,A
MVI C,0AH
SUB A
RPTA: ADD D
DCR C
JNZ RPTA:
MOV D,A
MOV A,B
ANI 0FH
ADD D
CALL UPDDT
HALT: HLT
STEP1:LoadtheBCDnumbersfrom
LOC x toACC

STEP2: Separatethehigher &lower
nibbles

STEP3:Convert thenibblesintobinary
valuesbymultiplyingtheir
nibblesbyitsfactor

STEP4:ADDthetwobinarynumbers

STEP5:Displaytheresult intheDATA
field

STEP6:Halt theprocessor

NOTE:
StoretheprogramstartingfromF000H
StoretheBCDnumber at F100H
Executetheprogram, result will bedisplayedinthedisplayfield
RESULT:
BEFORE EXECUTION:

Eg1: F100H 45
Eg2: F100H 64
AFTEREXECUTION:
DATA FIELD

Eg1:

Eg2:
2 D
4 0
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


INTERFACING

24. WAPtogeneratesquarewaveof givendutycycleusingDAC
DisplaythewaveformonaCRO&verifythesame.

PROGRAM ALGORITHM
START: MVI A,80
OUT CWR
RPT: XRA A
OUT P
a

OUT P
b

CALL OFFCOUNT
MVI A,FF
OUT P
a

OUT P
b

CALL ONCOUNT
JMP RPT
HLT
ONCOUNT: LXI H,08
LOOP: DCX H
MOV A,L
ORA H
JNZ LOOP
RET
OFFCOUNT:LXI H,03
LOOP1: DCX H
MOV A,L
ORA H
JNZ LOOP
RET
STEP 1:Writethecontrol wordintothe
PPI of thekit

STEP2: Passthedatasfor squarewave
towardsPPI words

STEP3: Passthealternativedatasfor
LOW&HIGHalternatively
withproper delayaccordingto
thedutycyclegiven

STEP4: Keeptheprocessor ina
continuouslooptill termination

STEP5: Terminatingpoint
NOTE:
Storetheprogram startingfromF000H
Connect theinterfacingunit tothekit
Executetheprogram
ObservethewaveformontheCRO

MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


PORT ADDRESS:

FORP3 FORP4
PORT ADDRESS PORT ADDRESS
PORT A
PORT B
PORT C
CWR
D8
D9
DA
DB
PORT A
PORT B
PORT C
CWR
F0
F1
F2
F3
OUT PUT WAVEFORM:







Toff T

CALUCLATIONS:
Dutycycle=70%,f=1kHz,T=1/f=1msec
D=Ton/T
0.7=Ton/1msec
Ton=0.7msec, T=Ton+Toff
ThereforeToff=0.3mSec
(i) Ton(delay)=0.7msec
Total number of T state=0.7x10
-3
/0.33x10
-6
=2121
Total number of T state=10+(count-1)24+21
2121=10+(count-1)24+21
2121=10+(count -1)24+21=88.09
oncount=0058H
(ii) Toff(delay)=0.3msec
Total number of T state=0.3x10
-3
/0.33x10
-6
=909
Total number of T state=10+(count-1)24+21
2121=10+(count-1)24+21
2121=10+(count -1)24+21=37.5
oncount=0025H
Note: Caluclatefor80, 60%,50%dutycycles


Ton
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


25. WAPtogenerateatriangular waveusingaDAC. Displaythe
Waveformandmeasuretheslope.
PROGRAM ALGORITHM
START: MVI A, 80
OUT CWR
REP: XRA A
VP: OUT P
a

OUT P
b

INR A
CPI FF
JNZ UP
DN: DCR A
OUT P
a


OUT P
b
JNZ DN
JMP REP
STEP 1:Writethecontrol wordinto
thecontrol register of PPI
STEP2:SendthedatastowardsPPI
togeneratetriangular wave
STEP3:sendthedatasfor positive
slope&negativeslope
alternatively
STEP4:Keeptheprocessor inthe
continuousloop, till
termination
STEP5: Terminatingpoint
NOTE:
Storetheprogram startingfromF000H
Connect theinterfacingunit tothekit
Executetheprogram
ObservethewaveformontheCRO
PORT ADDRESS:
FORP3 FORP4
PORT ADDRESS PORT ADDRESS
PORT A
PORT B
PORT C
CWR
D8
D9
DA
DB
PORT A
PORT B
PORT C
CWR
F0
F1
F2
F3
OUTPUT WAVEFORM:



V Slope=V/ T

T

MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


26. WAPtogenerateastaircasewaveformusingDAC.

PROGRAM ALGORITHM
START: MVI A,80
OUT CWR
GF: MVI A,00
NF: OUT P
b
PUSH PSW
CALL DELAY
POP PSW
ADI 33
JNC NF
JMP GF
DELAY: MVI B,FF
BACK: DCR B
JNZ BACK
RET

Step1: Writethecontrol wordintothecontrol register of PPI.
Step2: SendthedatastowardsPPI togeneratestaircasewave.
Step3:sendthedatasfor positiveslope&negativeslope
alternatively
Step4:Keeptheprocessor inthecontinuousloop, till
termination
Step5: Terminatingpoint
NOTE:

o Storetheprogram startingfromF000H
o Connect theinterfacingunit tothekit
o Executetheprogram
o ObservethewaveformontheCRO

PORT ADDRESS:

FORP3 FORP4
PORT ADDRESS PORT ADDRESS
PORT A
PORT B
PORT C
CWR
D8
D9
DA
DB
PORT A
PORT B
PORT C
CWR
F0
F1
F2
F3
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


CALCULATIONOFSTEPSIZE:


NUMBEROF STEPS=N;
STEPSIZE =(MAX. AMPL.) / N

Note: MAX. AMPL. For DAC=5v(FFH)
Ex.: For 5steps
FF / N=255/ 05=51=33H
[ADI 33H]


V











t












MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


27. WriteanAssemblyLanguageProgramtoSenseaKeyboard.

PROGRAM ALGORITHM
START: MVI A, 90H
OUT CWR
BGN: MVI A, 07H
OUT PORT C
DEBOUNCE: INPORT A
ORA A
JZDEBOUNCE
CALL DELAY
INPORT A
ORA A
JZDEBOUNCE
MVI A, 01H
MVI C, 00H
SCAN: MOV B, A
OUT PORT C
INPORT A
ORA A
JNZNXTKEY
MOV A, C
ADI O8H
MOV C, A
MOV A, B
RLC
CPI 08H
JZBGN
JMPSCAN
NXTKEY: RRC
STEP1: Writethecontrol wordintothecontrol register of PPI.
STEP2: Initializethekeyboardrowusingsuitabledata.
STEP3Identifyanykeyclosure, if anykeyclosurefindthecode
of thekeyclosedusingsuitablelogic.
STEP4: Displaythekeycodeinthedisplayfield.
STEP5: Repeat thesteps2-4till termination.
STEP6: Terminatingpoint.
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


JCFOUND
INRC
JMPNXTKEY
FOUND: MOV A, C
STA F200H
CALL UPDDT
JMPBGN
DELAY: LXI H,00FFH
LOOP: DCX H
MOV A, L
ORA H
JNZLOOP
RET

NOTE:
StoretheprogramstartingfromF000H.
Connect theinterfacingunit tothekit.
Executetheprogram.
Pressanykeyinthekeyboard.
Result will bedisplayedinthedisplayfield.














MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


28. WriteanALPtoimplement amovingdisplayof agivenstringof digits
onadisplayinterfacewithasuitabledelay.

PROGRAM ALGORITHM
START: MVI A,CW
OUT CWR:
MVI C,04H
RPTCD: MVI A,FFH
CALL DISP
LXI D,FFFFH
CALL DELY
DCRC
JNZRPTCD
LXI D,FFFFH
CALL DELY
LXI H, F100H
MVI C, 04H
RPDIS: MOV A,M
CALL DISP
INX H
PUSHH
PUSHB
LXI D,FFFFH
CALL DELY
POP B
POP H
DCRC
JNZRPDIS
LXI D,FFFFH
CALL DELY
JMP START
DISP: MVI E,08H
MOV B,A
RPTR: MOV A,B
OUT PB
RRC
MOV B,A
STEP1: Initializeall ports
STEP2: Makeall rowshigh
STEP3: SensetheKeyboard
STEP4: IsanyKeyPressed, if Yescall
delay
STEP5: If No, ChecktheKeyPressed
STEP6: Initializecounter
Step7: Set RowHigh.
Step8:IsanyKeyPressedCheckfirst
column, If Noincrement the
counter by8andenablenext Row.
Step9: If YesDisplaythecounter.

MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


MVI A,00H
OUT PC
CMA
OUT PC
DCRE
JNZRPTR
RETURN: RET

NOTE:

StoretheprogramfromF000H.
Storethestringof datafromF100h.
Connect theinterfacingunit tothePPI of thekit.
Executetheprogram.
Observetheresult inthedisplayinterfaceunit.


LEDDISPLAY:
a

f b

g .h

e c


d

Stringfor SSIT:

A b c d e f g h
0 1 0 0 1 0 0 1 49H(S)
0 1 0 0 1 0 0 1 49H(S)
1 0 0 1 1 1 1 1 9FH(i)
1 1 1 0 0 0 0 1 E1H(t)
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


29. WriteaprogramtodisplaytheASCII equivalent of thekey
pressedusing 8279.

PROGRAM ALGORITHM
START: MVI A, 0EH
SIM
EI
CALL RDKBD
PUSH PSW
MOV B, A
CALL ASCII
MOV L, A
RRC
RRC
RRC
RRC
CALL ASCII:
MOV H, A
POP PSW
PUSH H
CALL UPDDT
POP H
CALL UPDAD
JMP START
HALT: HLT
ASCII: ANI 0FH
CPI 0AH
JC BAT
ADI 07H
BAT: ADI 30H
RET
Step1: Initialisethe8279IC&initialize
theinterrupt systembysuitable
data
Step2: Convert thereceiveddatafrom
thekeypressedintoitsASCII
equivalent
Step3: Displaythesameinthedisplay
field
Step4: Repeat thesteps1-4for eachkey
pressedtill termination
Step5: Terminatingpoint

NOTE:
o StoretheprogramfromF000H
o Executetheprogram
o Pressanykeyinthekeyboardother thantheRESET key
o Theresult will bedisplayedinthedisplayfield
# Theaddressfor RDKBD: is0634H
MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


30. WriteanALPtosimulateTHROWOFADICE usinginterrupts.

PROGRAM ALGORITHM
START: MVI A,0BH
SIM
EI
CAR: MVI A,01H
RPT: INRA
CPI 06H
JNZ RPT
JMP CAR
INRTS: DI
PUSH PSW
CALL UPDDT
POP PSW
EI
RETRN: RET
FFB1: C3 0F F0
STEP1: Initializetheinterrupt systembyproper data.
STEP2: Writetheinterrupt serviceroutineat proper location
(memorylocation)
STEP3: Interrupt serviceroutineisaprogramfor dicesimulation
(countingfrom0-6).
STEP4: Looptheprogramcontrol inacontinuousmode.
STEP5: Terminatingpoint.

NOTE:
StoretheprogramstartingfromF000H.
Storetheinterrupt serviceroutinestartingfromINRTS: addressinF00FH.
StoretheinstructionJMPINRTS: at memorylocationFFB1H
Executetheprogram.


RESULT:

PresstheVect intr buttoninthekeyboard, for eachpressingadisplaywill be
thereinthedisplayfield(datafield). I t displaysfrom00to06.



MICROPROCESSORLABMANUAL DATE: ___/___/_____

SIGNATURE OFSTAFF-IN-CHARGE

DEPARTMENT OFELECTRONICS&COMMUNICATION, SSIT, TUMKUR


MI CROPROCESSOR PROGRAM CODI NG SHEET
TITLE OF THE PROGRAM :
VERIFIEDBY :
ADDRESS OP-CODE
LABEL MNEMONIC OPERAND COMMENTS
ha. la. fb. sb. tb.





























REMARKS:

You might also like