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
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
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:
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:
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
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
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
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
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
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
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
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
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
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