Você está na página 1de 58

Microprocessor Lab Manual

DAYANANDA SAGAR COLLEGE OF ENGINEERING


SHAVIGE MALLESHWARA HILLS,K.S.LAYOUT,BANGALORE-560078

De !"#$e%# &' C&$ (#e" S)*e%)e !%+ E%,*%ee"*%,

-00.--0/0

M*)"& "&)e00&" L!1 M!%(!2


COMPILED BY

3"&'. M. R R!4*%+"!%!#5. 3"&'. Ve%(,& !2 R!& A S

Dept.of CSE, DSCE,Bangalore

page 1

Microprocessor Lab Manual

COURSE OUTLINE

Wee6 N&
1.

3"&,"!$0 #& 1e )&4e"e+ Introduction, stud of asse!bler, debugger and si!ple progra!s" Dealt in t#e classroo!. 3!"# I S&'#7!"e "&,"!$0 Progra!s 1a % $a % &a Progra!s 'a % (a Progra!s )a % *a Progra!s +a % ,a % 1-a T5e&"8 #e0# 7ee6 Progra!s 11a % 1$a Progra!s 1&a % 1'a % 1(a 3!"# II H!"+7!"e "&,"!$0 Progra!s 1b % $b % &b Progra!s 'b % (b % )b T5e&"8 #e0# 7ee6 Progra!s *b % +b % ,b Progra!s 1-b % 11b Progra!s 1$b % 1&b % 1'b Progra!s 1(b

$. &. '. (. ). *. +. ,. 1-. 11. 1$. 1&. 1'. 1(.

Dept.of CSE, DSCE,Bangalore

page $

Microprocessor Lab Manual

1.a 1.b

$.a

$.b &.a &.b '.a '.b (.a (.b

).a ).b *.a

*.b

Searc# a .e ele!ent in a list of n nu!bers using t#e Binar Searc# algorit#!. /ead t#e status of eig#t input bits fro! t#e logic controller interface and displa FF if it is e0en parit bits ot#er1ise displa s 00. 2lso displa nu!ber of 13s in t#e input data. 4rite 2LP !acros5 i6 7o read a c#aracter fro! t#e .e board in t#e !odule 8168in a different file6 ii6 7o displa a c#aracter in !odule 8$68fro! different file6 iii6 9se t#e abo0e t1o !odules to read a string of c#aracters fro! t#e .e board 7er!inated b t#e carriage return and print t#e string on t#e displa in t#e ne:t line. Perfor! t#e follo1ing functions using t#e Logic Controller interface. i6 BCD up"do1n Counter ii 6 /ing Counter. Sort a gi0en set of n nu!bers in ascending and descending order using Bubble sort algorit#!. /ead t#e Status of t1o +"bits inputs8; % Y6 fro! t#e Logic Controller interface and displa ;<Y /ead an alp#anu!eric c#aracter and displa its e=ui0alent 2SCII code at t#e center of t#e screen Displa t#e !essages FIRE and HEL3 alternatel 1it# flic.ering effects on a *" seg!ent displa interface for a suitable period of a ti!e. Ensure a flas#ing rate t#at !a.es it eas to read bot# !essages.8E:a!iner does not specif t#ese dela s 0alues nor it is necessar for t#e student to co!pute t#ese 0alues. /e0erse a gi0en string and c#ec. 1#et#er it is a Palindro!e or not.. 2ssu!e an suitable !essage of 1$ c#aracters lengt# and displa it in t#e rolling fas#ion on a *"seg!ent displa interface for a suitable period of a ti!e. Ensure a flas#ing rate t#at !a.es It eas to read bot# t#e !essages 8E:a!iner does not specif t#ese dela 0alues nor it is necessar for t#e student to co!pute t#ese 0alues. /ead t1o strings, store t#e! in locations STR/ and STR-. C#ec. 1#et#er t#e are e=ual or not displa appropriated !essages. 2lso displa t#e lengt# of t#e stored strings. Con0ert a 1)"bit binar 0alue8assu!ed to be an unsigned integer6 to BCD and displa it fro! left to /ig#t and /ig#t to left for specified nu!ber of ti!es on a *" seg!ent displa interface. /ead our na!e fro! t#e .e board and displa it at a specified location on t#e screen in front of t#e !essage WHAT IS YOUR NAME9 You !ust clear t#e entire screen before displa . Dri0e a Stepper !otor interface to rotate t#e !otor in cloc.1ise direction b > steps. 8> is specified fro! t#e e:a!iner6. Introduce suitable dela bet1een successi0e steps.82n arbitrar 0alue for t#e dela !a be assu!ed b t#e student6.

Dept.of CSE, DSCE,Bangalore

page &

Microprocessor Lab Manual

+.a +.b ,.a ,.b 1-.a 1-.b 11.a 11.b 1$.a 1$.b 1&.a 1&.b 1'.a 1'.b 1(.a 1(.b

Co!pute t#e factorial of a positi0e integer ?n3 using recursi0e procedure. Dri0e a Stepper !otor interface to rotate t#e !otor in anticloc.1ise direction b > steps. 8> is specified fro! t#e e:a!iner6. Introduce suitable dela bet1een successi0e steps.82n arbitrar 0alue for t#e dela !a be assu!ed b t#e student6. Co!pute %C" 9sing recursi0e procedure. 2ssu!e t#at ?n3 and ?r3 are non" negati0e integers. Dri0e a Stepper !otor interface to rotate t#e !otor b > steps left direction and > steps /ig#t direction. 8> is specified fro! t#e e:a!iner6. Introduce suitable dela bet1een successi0e steps. 82n arbitrar 0alue for t#e dela !a be assu!ed b t#e student6. @ind out 1#et#er a gi0en sub"string is present or not in a !ain string of c#aracters.. Scan a +:& .e pad for .e closure and to store t#e code of t#e .e pressed in a !e!or location or displa on screen. 2lso displa ro1 and colu!n nu!bers of t#e .e pressed. Aenerate t#e first ?n3 @ibonacci nu!bers. Scan a +:& .e pad for .e closure and Si!ulate ADD and S9B7/2C7 operations as in a calculator. /ead t#e current ti!e fro! t#e s ste! and displa it in t#e standard for!at on t#e screen. Aenerate a sine 1a0e 9sing D2C interface 87#e output of t#e D2C is to be displa ed on a C/O6 Progra! to si!ulate a deci!al up"counter to displa --",, Aenerate a Balf /ectified sine 1a0e fro! using t#e D2C interface87#e output of t#e D2C is to be displa ed on a C/O6 /ead a pair of input co"ordinates in BCD and !o0e t#e cursor to t#e specified location on t#e screen Aenerate a @ull /ectified sine 1a0e for! using t#e D2C interface87#e output of t#e D2C is to be displa ed on a C/O6 Progra! to create a file8input file6 and to delete an e:isting file. Dri0e an ele0ator interface in t#e follo1ing 1a to !o0e an ele0ator fro! ground to top floor and top to ground floor.

Dept.of CSE, DSCE,Bangalore

page '

Microprocessor Lab Manual

Auidelines to use t#e asse!bler.


7#e asse!bl language progra!!ing can be done using t#e 2sse!blers. 7#ere are a nu!ber of asse!blers a0ailable li.e M2SM, 72SM and DOS asse!bler .M2SM is one of t#e popular asse!blers used along 1it# a LI>C progra! to structure t#e codes generated in t#e for! of an e:ecutable file. M2SM reads t#e source progra! as its input and pro0ides an obDect file. 7#e LI>C accepts t#e obDect file produced b M2SM as input and produces an E;E file. ENTERING A 3ROGRAM Before starting t#e process, ensure t#at all t#e files na!el >E.COM8>orton3s Editor6, M2SM.E;E82sse!bler6,LI>C.E;E8Lin.er6,DEB9A.E;E8Debugger6 are a0ailable in t#e sa!e director in 1#ic# 1e are 1or.ing. STE3S 1. OPE> 7BE 7E;7 EDI7O/. COMM2>D IS5 CE7C O/ CE>E $. E>7E/ 7BE P/OA/2M 2>D CBECC @O/ 7BE MIS72CES 2>D SY>72; E//O/S &. S2FE 7BE P/OA/2M 4I7B 7BE .2SM E;7E>SIO>. COMM2>D IS5 @ILE>2ME.2SM '. 2SSEMBLE 7BE P/OA/2M. COMM2>D IS5 CEM2SM @ILE>2ME O/ CEM2SM @ILE>2ME.2SM

2fter successful asse!bling, t#ree files are created na!el i6 7#e obDect file 1it# .OBG e:tension. page (

Dept.of CSE, DSCE,Bangalore

Microprocessor Lab Manual ii6 7#e listing file 1it# .LS7 e:tension. 7#e listing file contains t#e total offset !ap of t#e source file including labels, offset addresses, opcodes, !e!or relocation infor!ation. iii6 7#e cross reference filena!e 1it# .C/@ e:tension. 7#e cross reference file is used for debugging t#e source progra! and contains t#e statistical infor!ation siHe of t#e file in b tes, nu!ber of labels, list of labels, routines to be called,etc. about t#e source progra!. 7#ese files are used to lin. t#e obDect !odules and generate an e:ecutable 8.E;E6 file fro! a .OBG file. allot!ent for different labels and directi0es and

(.

Lin. t#e obDect !odules of t#e source progra! and t#e function librar generate an integrated e:ecutable code of t#e source progra!. COMM2>D IS5 CELI>C @ILE>2ME.OBG 7#e output of t#e LI>C progra! is an e:ecutable file 1it# t#e entered filena!e and .E;E e:tension. ).

routines to

DEB9A.COM, a DOS utilit can be used for debugging and trouble"s#ooting COMM2>D IS5 CEDEB9A 2 ?"?8das#6 displa signals t#e successful in0o.e operation of DEB9A. So!e of t#e DEB9A co!!ands used are as follo1s5 "/ "D "g "= Displa all registers and flags. Displa 1$+ !e!or locations of /2M starting fro! t#e current displa pointer. E:ecute fro! current CS5 IP. Iuit t#e DEB9A and return to DOS.

of asse!bl language progra!s

"7 SEA5 O@@SE7 7race t#e progra! e:ecution b single stepping

Dept.of CSE, DSCE,Bangalore

page )

Microprocessor Lab Manual Ge%e"!2 '&"$ &' !%8 !00e$128 "&,"!$. 4e can see all t#e progra!s 1ill follo1 so!e co!!on for!at. 7#e best 1a to begin 1it# t#e progra!!ing is to anal He t#e gi0en proble!. 7#en 1e can understand t#at t#e progra! needs so!e inputs. So!eti!es t#e result of t#e progra! need to be stored in t#e !e!or . Bence t#e gi0en progra! de!ands for a certain a!ount of logical space. 7#is is called as D272 SEAME>7. Si!ilarl t#e progra! 1ill #a0e t#e space for t#e instructions to e:ecute t#e gi0en proble!. 7#is re=uires a logical space called as CODE SEAME>7. If an progra! needs stac. facilit t#en it !ust use S72CC SEAME>7 and one !ore logical bloc. called E;7/2 seg!ent can also be used as an additional destination data seg!ent. >ote t#at all t#ese seg!ents are not co!pulsor for t#e progra!. Onl CODE seg!ent is co!pulsor and rest all can be used depending on t#e re=uire!ent. In our progra!s 1e #a0e used D272 SEAME>7 and CODE SEAME>7 onl as ot#er t1o

seg!ents are of no use in t#ese progra!s. 7#ese are represented b J.D272K and .CODE. 7#ese are also called as asse!bler directi0es. 2sse!bler Directi0es indicate #o1 an operand or section of t#e progra! is to be processed b t#e asse!bler. So!e directi0es generate and store infor!ation in !e!or 1#ile ot#ers do not. Most co!!onl used asse!bler directi0es are listed belo1 1it# t#eir !eaning. .s!all L .data"""" Defines data seg!ent .code""" defines code seg!ent .stac. """ Defines Stac. seg!ent .e:tra""" defines E:tra seg!ent BY7E L indicates B te siHed data DB """ Defines B te 8+ bits6 DD """ Defines Double 1ords 8 &$ bits6 D9P""" generates duplication D4 L defines 1ord 81) bits6 E>D L ends t#e progra! E>DM L ends t#e !acro E>DP L ends a procedure. Dept.of CSE, DSCE,Bangalore page *

Microprocessor Lab Manual EI9 L e=uates data to label M2C/O""" Indicates starting of t#e Macro

Dept.of CSE, DSCE,Bangalore

page +

Microprocessor Lab Manual

SOFTWARE 3ROGRAMS

Dept.of CSE, DSCE,Bangalore

page ,

Microprocessor Lab Manual /!. Se!")5 ! 6e8 e2e$e%# *% ! 2*0# &' :%: /6-1*# %($1e"0 (0*%, #5e B*%!"8 0e!")5 !2,&"*#5$. O1;e)#*4e< In t#is progra!, students 1ill learn t#e i!ple!entation of t#e Binar searc# algorit#!. O(#)&$e< Students 1ill learn t#e usage of si!ple asse!bl language instructions and also 1ill i!ple!ent binar searc# algorit#! to find t#e gi0en .e . If t#e .e is found a !essage J@O9>DK 1ill be displa ed ot#er1ise J>O7 @O9>DK 1ill be displa ed. 2LAO/I7BM5 Step 1. define t#e sorted arra of ele!ents as JLIS7K. Step $. get t#e lengt# of t#e arra and store it in JL>7BK Step &. Set a pointer SI to Hero Step '5 Cop t#e lengt# of t#e arra to one !ore pointer DI. Step (. Subtract one fro! DI. Step5) If SI is !ore t#at DI conclude t#at t#e SCEY is not t#ere else do t#e follo1ing steps. Step *5 2dd SI and DI 1#ic# are not#ing but t#e start and end of t#e arra . Di0ide t#is b t1o to get t#e !id location of t#e arra . 7#is is done b SB/ operation 1#ic# rotates t#e su! to t#e rig#t b one bit position. >o1 B; contains t#e MID position of t#e arra . Step +5 Aet t#e ele!ent of t#e location B; of t#e arra LIS7 to 2L. and co!pare it 1it# SCEY. If t#e are e=ual go t#e last stage and displa t#e !essage @O9>D else go to ne:t step. Step ,5 If t#e .e is greater t#an !id"ele!ent of t#e arra , c#ange t#e lo1 0alue t#at is SI 0alue to M!idN1O and repeat t#e steps ), * and +. Step1-5 If t#e .e is s!aller t#an !id"ele!ent of t#e arra , c#ange t#e #ig# 0alue t#at is DI 0alue to M!id"1O and repeat t#e steps * and +. .MODEL SM2LL .D272 LIS7 DB 1, $,&,',( L>7B D4 P " LIS7 SCEY DB -& MSA1 DB Q@O9>D PQ MSA$ DB Q>O7 @O9>D PQ .CODE MOF 2;,RD272 MOF DS, 2; MOF SI,MOF DI,L>7B S9B DI,-1 B2C5 CMP SI,DI G2 >@ MOF B;,SI Dept.of CSE, DSCE,Bangalore

S7o find !id point page 1-

Microprocessor Lab Manual 2DD B;,DI SB/ B;,-1 MOF 2l, LIS7MB;O CMP 2l, SCEY GE Y@ GB >M MOF DI,B; S9B DI,-1 CMP DI,GV >@ GMP B2C >M5 MOF SI,B; 2DD SI,-1 GMP B2C >@5 LE2 D;,MSA$ GMP >E;7 Y@5 LE2 D;,MSA1 >E;75 MOF 2B,-,B I>7 $1B MOF 2B,'CB I>7 $1B E>D O(# (#< @ound V*4! =(e0#*&%0< /. E> 2!*% #5e 2&,*) &' B*%!"8 0e!")5. -. W58 ?@A 08$1&2 *0 #& 1e (0e+ !# #5e e%+ *' #5e 0#"*%, $e00!,e #& 1e +*0 2!8e+9 B. E> 2!*% CA, CE !%+ CB *%0#"()#*&%0 D. W5!# *0 +!#! 0e,$e%#9 5. W5!# *0 )&+e 0e,$e%#9 S8lo1N#ig#6 SS#ift bit to rig#t gi0es no.T$ SIf 8.e UUM!idO6 Du!p to found Selse if8.e EM!idO6 Du!p to >M S else DIU!id"1

SSIUM!idN1O

S@unc8-,#6,Displa String,D;Uoffset of !sg 5@unc8'c#6,7er!inate progra! S Call DOS Ser0ice

Dept.of CSE, DSCE,Bangalore

page 11

Microprocessor Lab Manual -!. W"*#e ! AL3 $!)"&0< *E T& "e!+ ! )5!"!)#e" '"&$ #5e 6e81&!"+ *% #5e $&+(2e F/EF*% ! +*''e"e%# '*2eE **E T& +*0 2!8 ! )5!"!)#e" *% $&+(2e F-E F'"&$ +*''e"e%# '*2eE ***E U0e #5e !1&4e - $&+(2e0 #& "e!+ ! 0#"*%, &' )5!"!)#e"0 '"&$ #5e 6e81&!"+ #e"$*%!#e+ 18 #5e )!""*!,e "e#("% !%+ "*%# #5e 0#"*%, &% #5e +*0 2!8 *% #5e %e># 2*%e. O1;e)#*4e < In t#is progra! t#e students 1ill learn to input t#e data to t#e processor using standard input de0ice t#at is .e board. 2lso t#e 1ill displa t#e sa!e on t#e standard output de0ice. 7#ese t1o operations are done b t1o separate !acros 1#ic# are e:ternal to t#e !ain progra!. 7#e user !ust 1rite t#e t1o !acros first as t1o separate files and t#en t#e can 1rite and e:ecute t#e !ain progra!. OUTCOME< 9nderstanding t#e use of standard input and output de0ices also t#e usage of !acros in t#e asse!bl language progra!!ing, A2,&"*#5$< Step1 5 4rite t#e !acro for reading a .e fro! .e board. 8!1.inc6 Interrupt I>7 $1 is called 1it# 2B #a0ing t#e 0alue -1B.. 7#is 1ill enable t#e processor to read one c#aracter fro! t#e .e board. 2fter reading one c#aracter t#e control 1ill be gi0en to !ain progra!. Step $5 4rite t#e !acro for outputting t#e .e being read fro! .e board. 8!$.inc6 Interrupt I>7 $1 is called 1it# 2B #a0ing t#e 0alue -$B. 7#is 1ill enable t#e processor to 1rite one c#aracter to t#e standard output de0ice. 2fter displa ing one c#aracter t#e control 1ill be gi0en to !ain progra!. Step &5 Main progra!. Define a string of siHe 1- b tes 1it# na!e S7/ to store t#e .e ele!ents being pressed. Step '5 Call t#e !acro /E2D, 1#ic# reads t#e .e fro! t#e .e board. 7#is 1ill read t#e 2SCII 0alue of t#e .e being pressed and store it in 2L register. 2fter e0er .e is read incre!ent a counter SI Step (5 Co!pare t#is 1it# t#e 2CII Falue of ?E>7E/3 .e i.e. ?-DB3 If bot# are !atc#ing end t#e read process else store t#e data in 2L to S7/ arra till ?E>7E/3 .e is being pressed. Step )5 If t#e E>7E/ .e is pressed, stop t#e reading operation and go to DISP !acro 1#ic# displa s one c#aracter at a ti!e. 7#e counter SI can be used to ensure all c#aracters of S7/ are being displa ed Step *5 2fter displa ing all t#e c#aracters ter!inate t#e progra!. I>CL9DE c5W!as!).-WbinW!1.inc Dept.of CSE, DSCE,Bangalore S !acro to read a c#aracter page 1$

Microprocessor Lab Manual I>CL9DE c5W!as!).-WbinW!$.inc .MODEL SM2LL .D272 S7/ DB 1- D9P8X6 .CODE MOF 2;,RD272 MOF DS,2; MOF SI,/E2D15 /E2D CMP 2L,-DB GE BE/E MOF S7/MSIO,2L I>C SI GMP /E2D1 BE/E5 MOF C;,SI MOF SI,MOF DL,1DISPL2Y DISP15 MOF DL,S7/MSIO DISPL2Y I>C SI LOOP DISP1 MOF 2B,'CB I>7 $1B E>D !1.inc S !acro to read a c#aracter /E2D M2C/O MOF 2B, -1B S@unc8-1#6,/ead c#ar I>7 $1B E>DM I% (#< Dsce O(# (#< Dsce V*4! =(e0#*&%0< 1. 4#at is a !acroX $. 4#at do ou understand b asse!bler directi0esX &. Bo1 can ou classif t#e instruction set of +-+)X '. e:plain loop instruction. (. Can 1e displa t#e string S7/ 1it#out using loop instructionX S !acro to displa a c#aracter

S 7o call !acro /ead S -d# ascii 0alue for carriage return

S ascii 0alue for line feed S7o call Macro displa

!$.inc S !acro to displa a c#aracter DISPL2Y M2C/O MOF 2B, -$B S@unc8-$#6,4rite c#ar I>7 $1B E>DM

Dept.of CSE, DSCE,Bangalore

page 1&

Microprocessor Lab Manual

B!. S&"# ! ,*4e% 0e# &' :%: %($1e"0 *% !0)e%+*%, !%+ +e0)e%+*%, &"+e"0 (0*%, B(112e 0&"# !2,&"*#5$. O1;e)#*4e< 7o learn t#e bubble sort algorit#! and i!ple!ent t#e sa!e using +-+) asse!bl language. O(# )&$*%,< Students 1ill learn to c#ec. t#e data in different seg!ents of !e!or and also 1ill learn t#e usage of instructions li.e ;CBA. A2,&"*#5$. Step 15 ?23 gi0es t#e arra ele!ents 1#ic# need to be sorted. Aet t#e lengt# 8sa ?n36 of t#is arra and store it in 0ariable L. Step $5 InitialiHe t1o counters B; and C: 1it# 0alues ?n3 and ?n"13. 2lso initialiHe counter SI to ?-3 Step &5 Co!parison operation and e:c#ange of ele!ents. Mo0e first ele!ent of Db to 2l, and co!pare 1it# ne:t ele!ent in t#e arra . If M2lO Y 2MSIO .eep t#e ele!ents in tact if not e:c#ange contents of 2l and 2MSIO. /epeat t#is sa!e till counter C; beco!es Hero. Bence 1e get largest ele!ent at t#e first iteration. /epeat t#is for 8n"16 ti!es and ou 1ill get t#e sorted arra . E>e)(#*&% "&)e+("e< a. Sa0e t#e progra! in t#e folder 1#ic# #as CF. b. 1#ile co!piling t#e code t pe, !as!TVi filena!e.as!S lin.TCO filena!e.obDS CF file na!e. 7#is 1ill ta.e t#e user to a 1indo1 as s#o1n in fig 1. c. >o1 go to /un in t#e !enu and select start to run t#e progra!. 9ser 1ill be pro!pted 1it# t#e !essage sa ing progra! ter!inated nor!all as s#o1n in fig $.. d. >o1 co!e to t#e co!!and pro!pt and t pe J d 2K as s#o1n in fig &. Bere user can see t#e sorted arra . @or first 1- locations of arra 2.

Dept.of CSE, DSCE,Bangalore

page 1'

Microprocessor Lab Manual

F*, /.

@ig $.

Dept.of CSE, DSCE,Bangalore

page 1(

Microprocessor Lab Manual

Fig 3.

Dept.of CSE, DSCE,Bangalore

page 1)

Microprocessor Lab Manual .MODEL SM2LL .D272 2 Db +(B,,(B,$(B, '(B, ((B, 1(B, )(B, '(B L D4 P " 2 SLengt# of arra .CODE MOF 2;, RD272 MOF DS, 2; MOF B;, L DEC B; >P5 MOF C;, B; MOF SI, >I5 MOF 2l, 2MSIO I>C SI CMP 2l, 2MSIO GBE >E;7 ;CBA 2l, 2MSIO MOF 2MSI"1O,2l >E;75 LOOP >I DEC B; G>V >P MOF 2B, 'CB I>7 $1B E>D SB;U>o. of iterations SC;U>o. of co!parison in eac# iteration

Sfor descending order G2E >E;7 SE:c#ange If 82LY MSIN1O6

O(# (#< Ed 2 1( '( '( (( )( +( ,(

Dept.of CSE, DSCE,Bangalore

page 1*

Microprocessor Lab Manual D!. Re!+ A2 5!%($e"*) C5!"!)#e" G +*0 2!8 *#0 eH(*4!2e%# ASCII )&+e !# #5e )e%#"e &' 0)"ee% . O1;e)#*4e< In t#is progra!, t#e user 1ill input an alp#a nu!eric c#aracter and see t#e corresponding 2SCII 0alue on t#e standard output de0ice. O(#)&$e< 7#e user 1ill co!e to .no1 t#e 0arious .inds of DOS interrupts to clear t#e screen to select a specific location on t#e screen to displa t#e data and also to get t#e 2SCII 0alue of t#e .e being pressed. A2,&"*#5$. Step 15 Defining 0arious !acros to perfor! specific tas.s li.e displa ing a !essage to t#e user to pro!pt #i! to enter t#e alp#a nu!eric data, to clear t#e screen and to set t#e location of t#e screen 1#ere t#e 2SCII 0alue of t#e .e pressed to be displa ed. 7#ese are ac#ie0ed b 0arious DOS interrupts 1it# suitable 0alues in 2; register. Step $5 P/I>7 MSA Macro" #ere t#e !essage stored at t#e address DS5 D; 1ill be displa ed on t#e standard output 1#en t#e interrupt I>7$1B being called 1it# 2B #a0ing t#e 0alue -,B Step &5 SC/ Macro L Clears t#e Screen 1#en t#e interrupt I>7$1B being called 1it# 2B #a0ing t#e 0alue --B and 2L #a0ing t#e 0alue -&B. Step '5 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII .MODEL SM2LL 00 P/I>7 M2C/O MSA MOF 2B,-,B MOF D;,O@@SE7 MSA I>7 $1B E>DM SC/ M2C/O MOF 2B,--B MOF 2L,-&B I>7 1-B E>DM POS M2C/O MOF 2B,-$B Dept.of CSE, DSCE,Bangalore S Macro to displa string

SMacro to clear to screen

SMacro to Set t#e cursor

page 1+

Microprocessor Lab Manual MOF BB,--B MOF DB,-CB MOF DL,$&B I>7 1-B E>DM .D272 7MP DB X 7MP1 DB X MSA1 DB 1-,1&, QEnter t#e alp#a"nu!eric c#aracter5PQ .CODE MOF 2;,RD272 MOF DS,2; SC/ P/I>7 MSA1 MOF 2B,-1B I>7 $1B MOF 2B,--B MOF BL,1DIF BL MOF 7MP1,2B CMP 2L,1-D GAE L$ 2DD 2;,&-&-B MOF C;,2; POS MOF 2B,-)B MOF DL,CL I>7 $1B MOF 2B,-)B MOF DL,CB I>7 $1B GMP L2S7 L$5 MOF 2B,--B DIF BL 2DD 2;,&-&-B MOF 7MP,2B POS MOF 2B,-)B MOF DL,2L I>7 $1B MOF 2B,-)B MOF DL,7MP I>7 $1B Dept.of CSE, DSCE,Bangalore

SiTp of c#ar ie, ascii e=ui0alent code is stored in 2L Sdi0ide t#e no. 1it# 1- gi0es t#e deci!al e=ui0alent of #e: no. Scon0erted no. is stored in 2; register

Sdispla t#e no. in t#e centre of t#e screen

Sif after 1 di0 t#e no. is not con0erted di0ide it furt#er

page 1,

Microprocessor Lab Manual MOF 2B,7MP1 2DD 2B,&-B MOF 7MP1,2B MOF 2B,-)B MOF DL,7MP1 I>7 $1B L2S75 MOF 2B,'CB I>7 $1B E>D

O(# (#< Enter t#e alp#a"nu!eric c#aracter 5 *

((

5!. Re4e"0e ! ,*4e% 0#"*%, !%+ )5e)6 75e#5e" *# *0 ! !2*%+"&$e &" %&#. .MODEL SM2LL .S72CC 1-.D272 S7/ DB QM2L2Y2L2MQ > DB P"S7/ /S7/ DB 1- D9P8-6 MSA1 DB QS7/I>A IS P2LI>D/OMEPQ MSA$ DB Q>O7 P2LI>D/OMEPQ .CODE MOF 2;,RD272 MOF DS,2; MOF ES,2; MOF CL,> DEC CL MOF DI,C; I>C C; B2C5 MOF 2B,S7/MDIO Dept.of CSE, DSCE,Bangalore

S7o re0erse t#e string page $-

Microprocessor Lab Manual MOF /S7/MSIO,2B I>C SI DEC DI LOOP B2C LE2 SI,S7/ LE2 DI,/S7/ CLD MOF CL,> /EPE CMPSB GE DMSA1 LE2 D;,MSA$ GMP ;I7 DMSA15 LE2 D;,MSA1 ;I75 MOF 2B,-,B I>7 $1B MOF 2B,'CB I>7 $1B E>D O(# (#< S7/I>A IS P2LI>D/OME S 7o re0erse t#e string

SCLUSiHe of string S7o co!pare t#e $ strings SGu!p on e=ual to @ound SIf not e=ual displa not found

6!. Re!+ - 0#"*%,0, 0#&"e #5e$ *% 2&)!#*&%0 STR/ !%+ STR- )5e)6 75e#5e" #5e8 !"e eH(!2 &" %&# !%+ +*0 2!8 ! "& "*!#e $e00!,e0. A20& +*0 2!8 #5e 2e%,#5 &' #5e 0#&"e+ 0#"*%,0 . .MODEL SM2LL .D272 S7/1 DB 1-DB DB 1-- D9P8-6 S7/$ DB 1-DB DB 1-- D9P8-6 M1 DB QLE>7B O@ 7BE S7/15Q L1 DB X,1-,1&,QPQ M$ DB QLE>7B O@ 7BE S7/$5Q L$ DB X,1-,1&,QPQ M& DB QS7/1 IS EI92L 7O S7/$PQ M' DB QS7/1 IS >O7 EI92L 7O S7/$PQ .CODE MOF 2;,RD272 MOF DS,2; Dept.of CSE, DSCE,Bangalore page $1

S7o store t#e lengt# % t#e string1 S 7o store t#e lengt# % t#e string$

S7o print t#e lengt# of string1 S 7o print t#e lengt# of string$

Microprocessor Lab Manual MOF ES,2; LE2 D;, S7/1 MOF 2B,-2B I>7 $1B LE2 D;,S7/$ I>7 $1B MOF CL,S7/1N1 MOF BL,S7/$N1 2DD CL,&-B 2DD BL,&-B MOF L1,CL MOF L$,BL S9B CL,&-B S9B BL,&-B LE2 D;,M1 MOF 2B,-,B I>7 $1B LE2 D;,M$ I>7 $1B CMP CL,BL GV >E;7 DM'5LE2 D;,M' MOF 2B,-,B I>7 $1B GMP E;I7 >E;75 LE2 SI,S7/1N$ LE2 DI,S7/$N$ CLD /EPE CMPSB G>V DM' LE2 D;,M& MOF 2B,-,B I>7 $1B E;I75MOF 2B,'CB I>7 $1B E>D O(# (#< ra0i ra0i LE>7B O@ 7BE S7/15 ' LE>7B O@ 7BE S7/$5 ' S7/1 IS EI92L 7O S7/$

S@unc8-2B6,/ead % Print string1 S @unc8-2B6,/ead % Print string$ SCLULengt# of string1 S BLULengt# of string$

S7o Print t#e lengt# of string1 S 7o Print t#e lengt# of string$ SCo!pare t#e lengt# of strings SIf lengt# of string1Ustring$,Co!pare SIf lengt# of string1ZU string$ SPrint >ot E=ual % E:it SLoad effecti0e address of string1 S Load effecti0e address of string$ SCo!pare t1o strings S If strings are not e=ual print not e=ual SElse print strings are e=ual

Dept.of CSE, DSCE,Bangalore

page $$

Microprocessor Lab Manual

7!. Re!+ 8&(" %!$e '"&$ #5e 6e81&!"+ !%+ +*0 2!8 *# !# ! 0 e)*'*e+ 2&)!#*&% &% #5e 0)"ee% *% '"&%# &' #5e $e00!,e W5!# *0 8&(" %!$e9 Y&( $(0# )2e!" #5e e%#*"e 0)"ee% 1e'&"e +*0 2!8. .MODEL SM2LL .D272 MSA DB Q4B27 IS YO9/ >2ME5Q >EM DB (- D9P 8-6 .CODE MOF 2;,RD272 MOF DS,2; MOF SI,MOF 2B,1 B2C5 I>7 $1B MOF >EMMSIO,2L I>C SI CMP 2L,1& G>E B2C MOF BY7E P7/ >EMMSIO,QPQ C2LL CL/ C2LL SE7C LE2 D;,MSA MOF 2B,, Dept.of CSE, DSCE,Bangalore

S@unc8-1B6,ITp a c#ar 1it# ec#o fro! .e board SMo0e eac# c#aracter to t#e arra

SEnd of t#e string SClear t#e screen SSet t#e cursor to t#e specified location SDispla !essage 4#at is our >a!eX

page $&

Microprocessor Lab Manual I>7 $1B MOF 2B,'CB I>7 $1B CL/5MOF 2B,) SProcedure to clear t#e screen MOF 2L,MOF BB,* MOF CB,MOF CL,MOF DB,$' SDBUPosition of t#e ro1 MOF DL,*, S DLUPosition of t#e col I>7 1-B /E7 SE7C5 MOF 2B,$ SProcedure to set t#e cursor MOF BB,MOF DB,1$ SDBUPosition of t#e ro1 MOF DL,$SDLUPosition of t#e col I>7 1-B /E7 E>D O(# (#< /a0i 4#at is our na!eX /a0i 8!. C&$ (#e #5e '!)#&"*!2 &' ! &0*#*4e *%#e,e" :%: (0*%, #5e "e)("0*4e "&)e+("e . .MODEL SM2LL .D272 >9M D4 ( /ES9L7 D4 X .CODE MOF 2;,RD272 MOF DS,2; MOF 2;,-1 MOF B;,>9M CMP B;,-GE >E;7 C2LL @2C7 >E;75MOF /ES9L7,2; MOF 2B,'CB I>7 $1B @2C7 P/OC >E2/ CMP B;,-1 GV /IP P9SB B; DEC B; C2LL @2C7 Dept.of CSE, DSCE,Bangalore

SCo!pare nu! 1it# --

S/ecusi0e procedure to calculate @actorial SCo!pare nu! 1it# -1

page $'

Microprocessor Lab Manual POP B; M9L B; /IP5/E7 @2C7 E>DP E>D

O(# (#< Ed /esult *+

.!.C&$ (#e %C" (0*%, "e)("0*4e "&)e+("e. A00($e #5!# :%: !%+ :": !"e %&%-%e,!#*4e *%#e,e"0 . .MODEL SM2LL .D272 > D4 ( / D4 & >C/ D4 .CODE MOF 2;,RD272 MOF DS,2; MOF 2;,> MOF B;,/ C2LL >C/P/O MOF 2B,'CB I>7 $1B >C/P/O5CMP B;,2; GE /ES1 CMP B;,GE /ES1 CMP B;,1 GE /ES> DEC 2; CMP B;,2; GE I>C/ P9SB 2; Dept.of CSE, DSCE,Bangalore

5/ecursi0e procedure to calculate >C/ SIf B;UU2;,>C/U1 SIf B;UU-.>C/U1 SIf B;UU1 ,>C/U1 SCo!pare B; % 2; SIf B;UU2;,>C/U1

page $(

Microprocessor Lab Manual P9SB B; C2LL >C/P/O POP B; POP 2; DEC B; P9SB 2; P9SB B; C2LL >C/P/O POP B; POP 2; /E7 /ES15I>C >C/ /E7 I>C/5I>C >C/ /ES>5 2DD >C/,2; /E7 E>D O(# (#< E D ncr -2 /0!. F*%+ &(# 75e#5e" ! ,*4e% 0(1 0#"*%, *0 "e0e%# &" %&# *% ! $!*% 0#"*%, &' )5!"!)#e"0. .MODEL SM2LL .D272 S7/ DB QO>EPL9S74OISEI92L7O7B/EEQ L1 D4 P"S7/ S9BS DB QPL9SQ L$ D4 P"S9BS MSA1 DB QS9BS7/I>A IS P/ESE>7 I> M2I> S7/I>APQ MSA$ DB QS9BS7/I>A IS >O7 P/ESE>7 I> M2I> S7/I>APQ .CODE MOF 2;,RD272 MOF DS,2; MOF ES,2; MOF C;,L1 MOF B;,L$ LE2 DI,S7/ LE2 SI,S9BS CLD /P75MOF 2L,MSIO /EP>E SC2SB S Co!pares 2L 1it# e0er letter of S7/ I>C SI MOF D;,C; DEC B; S9B C;,B; S if t#e lengt# of !ain string is Y substring displa !sg$ GB DMSA$ Dept.of CSE, DSCE,Bangalore page $)

Microprocessor Lab Manual MOF C;,B; /EPV CMPSB S else co!pare t#e t1o strings G>V >@7 S if strings are not e=ual displa !sg$ LE2 D;,MSA1 S else displa !sg1 MOF 2B,, I>7 $1B GMP E;I7 DMSA$5 LE2 D;,MSA$ MOF 2B,, I>7 $1B E;I75 MOF 2B,'CB I>7 $1B >@75MOF C;,D; LE2 SI,S9BS MOF B;,L$ GMP /P7 E>D O(# (#< S9BS7/I>A IS P/ESE>7 I> M2I> S7/I>A //!. Ge%e"!#e #5e '*"0# ?%A F*1&%!))* %($1e"0 . .MODEL SM2LL .S72CC .D272 > DB 1@>S DB &$ D9P8-6 .CODE MOF 2;,RD272 MOF DS,2; MOF SI,MOF @>SMSIO,2DD SI,1 MOF @>SMSIO,1 MOF CL,> S9B CL,$ B2C5MOF 2L,@>SMSI"1O 2DD 2L,@>SMSIO 2DD SI,1 MOF @>SMSIO,2L LOOP B2C MOF 2B,'CB I>7 $1B E>D

S cop t#e first nu!ber to t#e arra S cop t#e second nu!ber to t#e arra S CLU n "$ 8for t#e rest of t#e lengt#6

Dept.of CSE, DSCE,Bangalore

page $*

Microprocessor Lab Manual O(# (#< ED @>S -- -1 -1 -$ -& -( -+ -D 1( $$

/-!. Re!+ #5e )(""e%# #*$e '"&$ #5e 080#e$ !%+ +*0 2!8 *# *% #5e 0#!%+!"+ '&"$!# &% #5e 0)"ee%. .MODEL SM2LL .CODE MOF 2B,$CB I>7 $1B MOF 2L,CB C2LL DISP MOF DL,Q5Q MOF 2B,$ I>7 $1B MOF 2L,CL C2LL DISP MOF DL,Q5Q MOF 2B,$ I>7 $1B MOF 2L,DB C2LL DISP MOF 2B,'CB I>7 $1B DISP P/OC >E2/ 22M 2DD 2;,&-&-B MOF B;,2; MOF DL,2B MOF 2B,-$ I>7 $1B Dept.of CSE, DSCE,Bangalore

S func8$C#6, to get t#e s ste! ti!e S stores #rs, !ins, secs in CB,CL,DB respecti0el

S Con0erts BE; 0alues to unpac.ed BCD for!at

page $+

Microprocessor Lab Manual MOF DL,BL I>7 $1B /E7 DISP E>DP E>D O(# (#< -,5((5'(

/B!. 3"&,"!$ #& 0*$(2!#e ! +e)*$!2 ( -)&(%#e" #& +*0 2!8 00-.. .MODEL SM2LL .CODE MOF 2;,>>5 P9SB 2; C2LL SE7C C2LL DISP C2LL DEL2Y MOF 2B,-1 I>7 1)B G>V E;I7 POP 2; 2DD 2L,1 D22 CMP 2L,G>V >> E;I75 MOF 2B,'CB I>7 $1B SE7C5 MOF 2B,$ MOF DB,1$ MOF DL,&( I>7 1-B /E7 DISP5 MOF BL,2L MOF DL,2L MOF CL,' SB/ DL,CL 2DD DL,&-B Dept.of CSE, DSCE,Bangalore

S to set t#e cursor position S to displa t#e nu!ber S dela bet1een nu!bers

page $,

Microprocessor Lab Manual MOF 2B,$ I>7 $1B MOF DL,BL 2>D DL,-@B 2DD DL,&-B I>7 $1B /E7 DEL2Y5 MOF SI,-@@@B B$5 MOF DI,-@@@@B B15 DEC DI G>V B1 DEC SI G>V B$ /E7 E>D O(# (#< ,, /D!. Re!+ ! !*" &' *% (# )&-&"+*%!#e0 *% BCD !%+ $&4e #5e )("0&" #& #5e 0 e)*'*e+ 2&)!#*&% &% #5e 0)"ee% . .MODEL SM2LL .D272 MSA1 DB 1-,1&,[E>7E/ /O4 >O5P[ MSA$ DB 1-,1&,[E>7E/ COL >O5P[ MSA& DB 1-,1&,[P/ESS 2>Y CEY 7O S7OPP[ /O4 DB X COL DB X .CODE MOF 2;,RD272 MOF DS,2; LE2 D;,MSA1 MOF 2B,, I>7 $1B C2LL /E2D S read t#e input ro1 MOF /O4,2L LE2 D;,MSA$ MOF 2B,, I>7 $1B C2LL /E2D S read t#e input col MOF COL,2L LE2 D;,MSA& MOF 2B,, I>7 $1B MOF 2B,$ S !o0e t#e cursor to t#e entered ro1 and col MOF DB,/O4 MOF DL,COL I>7 1-B Dept.of CSE, DSCE,Bangalore page &-

Microprocessor Lab Manual MOF 2B,+ I>7 $1B MOF 2B,'CB I>7 $1B /E2D5MOF 2B,1 I>7 $1B 2>D 2L, -@B MOF BL,2L MOF 2B,1 I>7 $1B 2>D 2L,-@B MOF 2B,BL 22D /E7 E>D O(# (#< E>7E/ /O4 >O5 1$ E>7E/ COL >O5 &( P/ESS 2>Y CEY 7O S7OP \ S 1ait for a .e to be pressed to e:it

S to read t#e input of t1o nu!bers S and store its e=ui0alent deci!al nu!ber in al

Dept.of CSE, DSCE,Bangalore

page &1

Microprocessor Lab Manual

/5!. 3"&,"!$ #& )"e!#e ! '*2e F*% (# '*2eE !%+ #& +e2e#e !% e>*0#*%, '*2e . .MODEL SM2LL .D272 MSA1 DB 1-,1&,[E>7E/ @ILE >2ME 7O BE C/E27ED5P[ MSA$ DB 1-,1&,[E>7E/ @ILE >2ME 7O BE DELE7ED5P[ MSA& DB [15C/E27E[,1-,1&,[-5DELE7EP[ MSA' DB 1-,1&,[E>7E/ YO9/ CBOICE5P[ MSA( DB [E//O/P[ @\>2ME DB +- D9P8-6 .CODE MOF 2;,RD272 MOF DS,2; LE2 D;,MSA& MOF 2B,, I>7 $1B LE2 D;,MSA' MOF 2B,, I>7 $1B MOF 2B,1 I>7 $1B CMP 2L,Q1Q GV C\@ILE CMP 2L,Q-Q GV D\@ILE E//O/5LE2 D;,MSA( MOF 2B,, I>7 $1B MOF 2B,'CB I>7 $1B C\@ILE5 LE2 D;,MSA1 MOF 2B,, Dept.of CSE, DSCE,Bangalore page &$

Microprocessor Lab Manual I>7 $1B C2LL /E2D MOF C;,MOF 2B,&CB LE2 D;,@\>2ME I>7 $1B GC E//O/ MOF 2B,'CB I>7 $1B D\@ILE5LE2 D;,MSA$ MOF 2B,, I>7 $1B C2LL /E2D LE2 D;,@\>2ME MOF 2B,'1B I>7 $1B GC E//O/ MOF 2B,'CB I>7 $1B /E2D5MOF 2B,1 LE2 SI, @\>2ME B2C5I>7 $1B CMP 2L,-DB GV DO>E MOFMSIO,2L I>C SI GMP B2C DO>E5/E7 E>D

S func8&CB6,to create a file 1it# t#e na!e loaded in D; S carr flag is set if error during creation

S func8'1#6, deletes a file 1it# t#e na!e loaded in D;

S to store t#e na!e of t#e file

O(# (#< 15C/E27E -5DELE7E E>7E/ YO9/ CBOICE51 E>7E/ @ILE >2ME 7O BE C/E27ED5 /a0i.as!

Dept.of CSE, DSCE,Bangalore

page &&

Microprocessor Lab Manual

/1. Re!+ #5e 0#!#(0 &' e*,5# *% (# 1*#0 '"&$ #5e 2&,*) )&%#"&22e" I%#e"'!)e !%+ +*0 2!8 ?FFA *# *0 e4e% !"*#8 1*#0 &#5e"7*0e +*0 2!8 00.A20& +*0 2!8 %($1e" &' /A0 *% #5e *% (# +!#!. .MODEL SM2LL .CODE MOF D;,-E'-&B MOF 2L,+$B O97 D;,2L MOF D;,-E'-1B I> 2L,D; MOF CL,+ MOF 2B,>$5/O/ 2L,-1 GC >1 DEC CL G>V >$ GMP >;7 >15I>C 2B DEC CL G>V >$ >;75MOF 2L,2B 2>D 2L,1 CMP 2L,GV D@@ MOF 2L,GMP >E;7 D@@5MOF 2L,-@@B >E;7 5MOF D;,-E'--B O97 D;,2L MOF SI,'@@@B /E7$5MOF DI,-@@@@B /E715DEC DI G>V /E71 DEC SI Dept.of CSE, DSCE,Bangalore

S to set t#e control 1ord register S +$#" port 2 oTp and port B iTp

S CL" stores t#e no. of bits S if t#e bit in C@ is 1 incre!ent no. of 13s S else find t#e ne:t bit

S to c#ec. if t#e no. of 13s is e0en or odd S if e0en displa @@ S else displa --

S dela to see clear oTp

page &'

Microprocessor Lab Manual G>V /E7$ MOF 2L,2B MOF D;,-E'--B O97 D;,2L MOF 2B,'CB I>7 $1B E>D

-1. 3e"'&"$ #5e '&22&7*%, '(%)#*&% (0*%, 2&,*) )&%#"&2 I%#e"'!)e *. BCD ( -+&7% )&(%# .MODEL SM2LL .CODE MOF D;,-E'-&B MOF 2L,+-B O97 D;,2L MOF 2L,MOF D;,-E'--B 9P5O97 D;,2L C2LL DEL2Y 2DD 2L,1 D22 C2LL S7OP CMP 2L,,,B G>E 9P DO4>5O97 D;,2L C2LL DEL2Y 2DD 2L,,,B D22 C2LL S7OP CMP 2L,,,B G>E DO4> S7OP5P9SB 2; MOF 2B,1 I>7 1)B G>E E;I7 POP 2; /E7 E;I75MOF 2B,'CB I>7 $1B DEL2Y5MOF SI,$@@@B /E7$5MOF DI,-@@@@B /E715DEC DI Dept.of CSE, DSCE,Bangalore

S +-B" all ports oTp

S con0ert #e: no. to BCD S if no. Y ,,B incre!ent and displa Selse decre!ent and displa

page &(

Microprocessor Lab Manual G>V /E71 DEC SI G>V /E7$ /E7 E>D **. R*%, )&(%#e". .MODEL SM2LL .CODE MOF D;,-E'-&B MOF 2L,+-B O97 D;,2L MOF D;,-E'--B MOF 2L,1 B2C5O97 D;,2L C2LL DEL2Y C2LL S7OP /OL 2L,1 GMP B2C DEL2Y5MOF SI,-(@@@ /E7$5MOF DI,-@@@@B /E715DEC DI G>V /E71 DEC SI G>V /E7$ /E7 S7OP5P9SB 2; MOF 2B,1 I>7 1)B G>V ;I7 POP 2; /E7 ;I75 MOF 2B,'CB I>7 $1B E>D

Dept.of CSE, DSCE,Bangalore

page &)

Microprocessor Lab Manual

B1. Re!+ #5e 0#!#(0 &' #7& 8-1*#0 *% (#0FJ G YE '"&$ #5e L&,*) C&%#"&22e" I%#e"'!)e !%+ +*0 2!8 JKY. .MODEL SM2LL .CODE MOF D;,-E'-&B MOF 2L,+$B O97 D;,2L MOF D;,-E'-1B I> 2L,D; MOF BL,2L MOF 2B,+ I>7 $1B MOF D;,-E'-1B I> 2L,D; M9L BL MOF D;,-E'--B O97 D;,2L C2LL DEL2Y MOF 2L,2B O97 D;,2L MOF 2B,'CB I>7 $1B DEL2Y5MOF SI,-(@@@B /E7$5MOF DI,-@@@@B /E715DEC DI G>V /E71 DEC SI G>V /E7$ /E7 E>D

S ta.e input of ;8first no.6 fro! .e board S 1ait for a .e board iTp S ta.e input of Y8first no.6 fro! .e board S !ultipl t#e nos. 8;<Y6 S displa t#e resultant

Dept.of CSE, DSCE,Bangalore

page &*

Microprocessor Lab Manual

D1.D*0 2!8 $e00!,e0 FIRE !%+ HEL3 !2#e"%!#*4e28 7*#5 '2*)6e"*%, e''e)#0 &% ! 7-0e,$e%# D*0 2!8 *%#e"'!)e '&" ! 0(*#!12e e"*&+ &' #*$e .E%0("e ! '2!05*%, "!#e #5!# $!6e0 *# e!08 #& "e!+ 1&#5 #5e $e00!,eFE>!$*%e" +&e0 %&# 0 e)*'8 #5e0e +e2!8 4!2(e0 %&" *# *0 %e)e00!"8 '&" #5e 0#(+e%# #& )&$ (#e #5e0e 4!2(e0E. .MODEL SM2LL .D272 D2721 DB +)B,-2@B,-C@B,+EB D272$ DB +CB,-C*B,+)#,+,B .CODE MOF 2;,RD272 MOF DS,2; MOF D;,-E'-&B MOF 2L,+-B O97 D;,2L B2C5 LE2 SI,D2721 C2LL DISPL2Y C2LL DEL2Y LE2 SI,D272$ C2LL DISPL2Y C2LL DEL2Y MOF 2B,1 I>7 1)# GV B2C MOF 2B,'CB I>7 $1B DISPL2Y5 MOF C;,-' B2C$5 MOF BL,-+ MOF 2L,MSIO >E;75 /OL 2L,-1 MOF D;,-E'-1B O97 D;,2L P9SB 2; MOF D;,-E'-$B MOF 2L,-@@B O97 D;,2L MOF 2L,-O97 D;,2L Dept.of CSE, DSCE,Bangalore

S se0en"seg!ent code for E,r,I,@ respecti0el S se0en"seg!ent code for P,L,E,B respecti0el

Sload t#e effecti0e address of erif Sdispla @IrE Sdela to #a0e flic.ering effect Sload t#e effecti0e address of PLEB Sdispla BELP Sdela to #a0e flic.ering effect Sc#ec. for .e stro.e to stop displa

SCL" no. of letters to be displa ed SBL" no. of seg!ent in eac# LED Seac# seg!ent is outputted at a ti!e Sport C to generate a serial cloc. pulse

page &+

Microprocessor Lab Manual DEC BL POP 2; G>V >E;7 I>C SI LOOP B2C$ /E7 DEL2Y5 MOF SI,$@@@B /EP$5 MOF DI,-@@@@B /EP15 DEC DI G>V /EP1 DEC SI G>V /EP$ /E7 E>D

Dept.of CSE, DSCE,Bangalore

page &,

Microprocessor Lab Manual

51.A00($e !%8 0(*#!12e $e00!,e &' /- )5!"!)#e"0 2e%,#5 !%+ +*0 2!8 *# *% #5e "&22*%, '!05*&% &% ! 7-0e,$e%# +*0 2!8. I%#e"'!)e '&" 0(*#!12e e"*&+ &' #*$e. E%0("e ! '2!05*%, "!#e #5!# $!6e0 *# e!08 #& "e!+ 1&#5 $e00!,e0.FE>!$*%e" +&e0 %&# 0 e)*'8 #5e0e +e2!8 4!2(e0 %&" *# *0 %e)e00!"8 '&" #5e 0#(+e%# #& )&$ (#e #5e0e 4!2(e0E. .MODEL SM2LL .D272 LIS7 DB -C*B,-2&B,-2*B,++B,-21B,-2BB,-++B,-2BB,-++B,-,,B,-++B,-21B S list se0en"seg!ent code for L,o,C,2,D,n,2,n,2,Y,2,D respecti0el .CODE MOF 2;,RD272 MOF DS,2; MOF 2L,+-B MOF D;,-E'-&B O97 D;,2L /P75MOF C;,1$ SC;"no. of c#aracters to be displa ed LE2 SI,LIS7 >C5 MOF 2L,MSIO C2LL DISP SDispla eac# c#aracter C2LL DEL2Y Sgi0e a dela to displa in rolling fas#ion C2LL S7OP Sc#ec. for .e board stro.e to stop I>C SI Selse displa ne:t c#ar LOOP >C GMP /P7 S7OP5MOF 2B,1 I>7 1)B G>V E;I7 /E7 E;I75 MOF 2B,'CB I>7 $1B DISP5 MOF BL,-+ >BI75 /OL 2L,1 MOF D;,-E'-1B O97 D;,2L P9SB 2; MOF D;,-E'-$B MOF 2L,-@@B O97 D;,2L MOF 2L,--B O97 D;,2L Dept.of CSE, DSCE,Bangalore page '-

Microprocessor Lab Manual POP 2; DEC BL G>V >BI7 /E7 DEL2Y5 P9SB SI MOF SI,-'@@@B /E7$5 MOF DI,-@@@@B /E715 DEC DI G>V /E71 DEC SI G>V /E7$ POP SI /E7 E>D

Dept.of CSE, DSCE,Bangalore

page '1

Microprocessor Lab Manual

61.C&%4e"# ! /6-1*# 1*%!"8 4!2(e F!00($e #& 1e !% (%0*,%e+ *%#e,e"E #& BCD !%+ +*0 2!8 *# '"&$ 2e'# #& "*,5# !%+ "*,5# #& 2e'# '&" 0 e)*'*e+ %($1e" &' #*$e0 &% ! 7-0e,$e%# +*0 2!8 *%#e"'!)e. .MODEL SM2LL .D272 LIS7 DB -@@B,-@@B,-@@B,-@@B,X,X,X,X,X,-@@B,-@@B,-@@B,-@@B Sto store BCD e=ui0alent *"seg!ent code in place of X,X,X,X,X 72BLE DB -C-B,-@,B,-2'B,-B-B,,,B,,$B,+$B,-@+B,+-B,,+B S*"seg!ent code fro! - to , BCD DB ( D9P 8X6 Sto store con0erted BCD no. >9M D4 -@B Sbinar no. to be con0erted .CODE MOF 2;,RD272 MOF DS,2; MOF 2L,+-B MOF D;,-E'-&B O97 D;,2L LE2 SI,BCD MOF 2;, >9M Sto con0ert 1)"bit binar no. to BCD MOF B;,1---Sdi0ide t#e no. b !ultiples of 1- and C2LL CO>F Sstore eac# no. in BCD arra to get BCD no. MOF B;,1--C2LL CO>F MOF B;,1-C2LL CO>F MOF B;,1C2LL CO>F MOF MSIO,DL LE2 SI,BCD LE2 DI,LIS7N+ LE2 B;,72BLE MOF C;,( SC;U no. of BCD digits >E;75 MOF 2L,MSIO Scop t#e e=ui0alent *"seg!ent to t#e LIS7 ;L27 MOF MDIO,2L DEC DI I>C SI LOOP >E;7 GMP S72/7 CO>F5 MOF D;,DIF B; Dept.of CSE, DSCE,Bangalore page '$

Microprocessor Lab Manual MOF MSIO,2L MOF 2;,D; I>C SI /E7 S72/75 MOF BB,1LE2 DI,LIS7 B2C15 MOF SI,DI P9SB B; C2LL DISP C2LL DEL2Y C2LL S7OP POP B; I>C DI DEC BB G>V B2C1 MOF BB,, LE2 DI,LIS7N+ B2C$5MOF SI,DI P9SB B; C2LL DISP C2LL DEL2Y C2LL S7OP POP B; DEC DI DEC BB G>V B2C$ GMP S72/7 S7OP5 MOF 2B,1 I>7 1)B G>V E;I7 /E7 E;I75 MOF 2B,'CB I>7 $1B DISP5 MOF C;,' >C5 MOF BL,-+ MOF 2L,MSIO >B5 /OL 2L,1 MOF D;,-E'-1B O97 D;,2L P9SB 2; MOF D;,-E'-$B MOF 2L,-@@B O97 D;,2L MOF 2L,--B O97 D;,2L POP 2; Dept.of CSE, DSCE,Bangalore page '&

Microprocessor Lab Manual DEC BL G>V >B I>C SI LOOP >C /E7 DEL2Y5MOF B;,-$@@@B /E7$5 MOF C;,-@@@@B /E715 LOOP /E71 DEC B; G>V /E7$ /E7 E>D

Dept.of CSE, DSCE,Bangalore

page ''

Microprocessor Lab Manual

71.D"*4e ! 0#e e" $&#&" *%#e"'!)e #& "&#!#e #5e $&#&" *% )2&)6 7*0e +*"e)#*&% 18 N 0#e 0.FN *0 0 e)*'*e+ 18 #5e e>!$*%e"E.I%#"&+()e ! +e2!8 1e#7ee% 0())e00*4e 0#e 0.FA%8 !"1*#"!"8 4!2(e '&" #5e $!8 1e !00($e+ 18 #5e 0#(+e%#E. .MODEL SM2LL .CODE MOF C;,&MOF D;,-E'-&B MOF 2L,+-B O97 D;,2L MOF D;,-E'--B MOF 2L,++B /EP15O97 D;,2L C2LL DEL2Y /O/ 2L,1 DEC C; G>V /EP1 MOF 2B,'CB I>7 $1B DEL2Y5MOF SI,$@@@B B2CC$5MOF DI,-@@@@B B2CC15DEC DI G>V B2CC1 DEC SI G>V B2CC$ /E7 E>D

SC;"no. of steps

Sto energiHe t#e nort# pole and sout# pole of t#e !otor S1- -- 1- -- 2 % C poles are energiHed i.e, 1SB % D are not energiHed S gi0es cloc.1ise !otion

Dept.of CSE, DSCE,Bangalore

page '(

Microprocessor Lab Manual 81.D"*4e ! 0#e e" $&#&" *%#e"'!)e #& "&#!#e #5e $&#&" *% A%#*-)2&)67*0e +*"e)#*&% 18 N 0#e 0.FN *0 0 e)*'*e+ 18 #5e e>!$*%e"E. I%#"&+()e 0(*#!12e +e2!8 1e#7ee% 0())e00*4e 0#e 0.FA%8 !"1*#"!"8 4!2(e '&" #5e +e2!8 $!8 1e !00($e+ 18 #5e 0#(+e%#E. .MODEL SM2LL .CODE MOF C;,$MOF D;,-E'-&B MOF 2L,+-B O97 D;,2L MOF D;,-E'--B MOF 2L,++B /EP15O97 D;,2L C2LL DEL2Y /OL 2L,1 DEC C; G>V /EP1 MOF 2B,'CB I>7 $1B DEL2Y5MOF SI,$@@@B B2CC$5MOF DI,-@@@@B B2CC15DEC DI G>V B2CC1 DEC SI G>V B2CC$ /E7 E>D

S gi0es anti"cloc.1ise !otion

.1.D"*4e ! 0#e

e" $&#&" *%#e"'!)e #& "&#!#e #5e $&#&" 18 N 0#e 0 2e'# +*"e)#*&% !%+ N 0#e 0 page ')

Dept.of CSE, DSCE,Bangalore

Microprocessor Lab Manual "*,5# +*"e)#*&% FN *0 0 e)*'*e+ 18 #5e e>!$*%e"E.I%#"&+()e ! 0(*#!12e +e2!8 1e#7ee% 0())e00*4e 0#e 0.FA%8 !"1*#"!"8 4!2(e '&" #5e +e2!8 $!8 1e !00($e+ 18 #5e 0#(+e%#E. .MODEL SM2LL .CODE MOF C;,&MOF D;,-E'-&B MOF 2L,+-B O97 D;,2L MOF D;,-E'--B MOF 2L,++B /EP15O97 D;,2L C2LL DEL2Y /O/ 2L,1 DEC C; G>V /EP1 MOF C;,&/EP$5O97 D;,2L C2LL DEL2Y /OL 2L,1 DEC C; G>V /EP$ MOF 2B,'CB I>7 $1B DEL2Y5 MOF SI,-@@@B B2CC$5 MOF DI,-@@@@B B2CC15 DEC DI G>V B2CC1 DEC SI G>V B2CC$ /E7 E>D

S gi0es cloc.1ise !otion

S gi0es anti"cloc.1ise !otion

/01.S)!% 8>B 6e8 !+ '&" 6e8 !+ )2&0("e !%+ #& 0#&"e #5e )&+e &' #5e 6e8 "e00e+ *% ! $e$&"8 2&)!#*&% &" +*0 2!8 *# &% #5e 0)"ee%. A20& +*0 2!8 "&7 !%+ )&2($% %($1e"0 &' #5e Dept.of CSE, DSCE,Bangalore page '*

Microprocessor Lab Manual 6e8 "e00e+. .MODEL SM2LL .D272 CEYS DB Q-1$&'()*+,2BCDE@ABIGCLM>Q Sarra for $' .e s of .e pad CEY DB X MSA1 DB 1-,1&, Q7BE /O4 >O IS UQ /O4 DB X,1&,1-,QPQ MSA$ DB Q7BE COL >O IS UQ COL DB X,QPQ .CODE MOF 2;,RD272 MOF DS,2; MOF D;,-E'-&B MOF 2L,,-B O97 D;,2L /EP15MOF D;,-E'-$B Sto acti0ate pc- ie, to c#ec. ro11 MOF 2L,-1 O97 D;,2L MOF D;,-E'--B Sta.e input using port B I> 2L,D; CMP 2L,-Sif .e pressed in ro11 G>V @/ SDu!p to first ro1 MOF D;,-E'-$B Selse acti0ate pc1 ie, to c#ec. ro1$ MOF 2L,-$ O97 D;,2L MOF D;,-E'--B Sta.e input using port B I> 2L,D; CMP 2L,-Sif .e pressed in ro1$ G>V S/ SDu!p to second ro1 MOF D;,-E'-$B S else acti0ate pc$ ie, to c#ec. ro1& MOF 2L,-' O97 D;,2L MOF D;,-E'--B Sta.e input using port B I> 2L,D; CMP 2L,-Sif .e pressed in ro1& G>V 7/ SDu!p to t#ird ro1 GMP /EP1 Srepeat t#e c#ec. till an .e is pressed @/5C2LL DEL2Y LE2 SI,CEYS MOF /O4,&1B S&1Uascii 0alue for 1 ie, first ro1 MOF CL,&-B SclUcolu!n 0alue >E;715 I>C CL SB/ 2L,1 Sc#ec. for t#e pressed .e 1#ic# 1ill be 1 GC DISP I>C SI Dept.of CSE, DSCE,Bangalore page '+

Microprocessor Lab Manual GMP >E;71 S/5 C2LL DEL2Y LE2 SI,CEYS 2DD SI,-+ MOF /O4,&$B MOF CL,&-B >E;7$5 I>C CL SB/ 2L,1 GC DISP I>C SI GMP >E;7$ 7/5 C2LL DEL2Y LE2 SI,CEYS 2DD SI,1-B MOF /O4,&&B MOF CL,&-B >E;7&5I>C CL SB/ 2L,1 GC DISP I>C SI GMP >E;7& DISP5 MOF DL,MSIO MOF 2B,-$B I>7 $1B LE2 D;,MSA1 MOF 2B,-,B I>7 $1B MOF COL,CL LE2 D;,MSA$ I>7 $1B GMP E;I7 DEL2Y5 MOF SI,$@@@B B2C$5 MOF DI,-@@@@B B2C15 DEC DI G>V B2C1 DEC SI G>V B2C$ /E7 E;I75 MOF 2B,'CB I>7 $1B E>D

Ssecond ro1 starts fro! +t# .e S&$Uascii 0alue for $ ie, second ro1

Ssecond ro1 starts fro! 1)t# .e S&&Uascii 0alue for & ie, t#ird ro1

Sto displa t#e .e pressed Sto displa t#e ro1 no. Sto displa t#e col no.

//1.S)!% ! B>8 6e8 !+ '&" 6e8 )2&0("e !%+ 0*$(2!#e ADD !%+ SUBTRACT & e"!#*&%0 !0 *% ! )!2)(2!#&" .FL*$*#!#*&%< *# *0 ! 0*%,2e +*,*# )!2)(2!#&"E. .MODEL SM2LL Dept.of CSE, DSCE,Bangalore page ',

Microprocessor Lab Manual .D272 @C DB ' D9P8X6 Sarra to store t#e e:pression CEY DB X E/MSA DB 1-,1&,[E//O/SP[ E;P> DB 1-,1&,[E>7E/ E;P/ESSIO>5P[ >2>S DB .CODE MOF 2;,RD272 MOF DS,2; MOF D;,-E'-&B MOF 2L,,-B O97 D;,2L LE2 D;,E;P> MOF 2B,, I>7 $1B MOF DI,' LE2 SI,@C B2C5C2LL /E2D C2LL DEL2Y MOF 2L,CEY MOF MSIO,2L I>C SI DEC DI G>V B2C CMP @CM1O,-BB GV 2DD> CMP @CM1O,-CB GV S9B> GMP E// MOF 2B,'CB I>7 $1B 2DD>5MOF 2L,@C 2DD 2L,@CM$O CMP @CM&O,1&B G>V E// C2LL DISP MOF 2B,'CB I>7 $1B E//5LE2 D;,E/MSA MOF 2B,, I>7 $1B MOF 2B,'CB I>7 $1B S9B>5MOF 2L,@C S9B 2L,@CM$O G>C POSI7IFE Dept.of CSE, DSCE,Bangalore

Se:pression contains ' c#ar, eg. (N)U Sread t#e input Sstore t#e read input in @C as e:pression

Sco!pare t#e second c#ar 1it# ?N3 Sif e=ual Du!p to addition Sco!pare t#e second c#ar 1it# ?"? Sif e=ual Du!p to subtraction Sif operator is neit#er of t#e! Du!p to error Sto add @CM-O and @CM$O Sco!pare t#e t#ird c#ar 1it# ?U3 Sif not e=ual Du!p to error Sdispla t#e ans1er Sdispla error

Sto subtract @CM-O and @CM$O Sif t#e result is a positi0e no. Du!p to positi0e page (-

Microprocessor Lab Manual >EA 2L MOF >2>S,1 POSI7IFE5 CMP @CM&O,1&B G>V E// C2LL DISP MOF 2B,'CB I>7 $1B /E2D5 MOF 2L,+-B MOF CEY,MOF BL,& >E;7/O45/OL 2L,1 MOF BB,2L MOF D;,-E'-$B O97 D;,2L MOF CL,+ MOF D;,-E'--B I> 2L,D; >E;7COL5 /O/ 2L,1 GC CEYCODE I>C CEY DEC CL G>V >E;7COL MOF 2L,BB DEC BL G>V >E;7/O4 GMP /E2D CEYCODE5 MOF DL,CEY CMP DL,-BB G>V >E;7 MOF DL,QNQ MOF 2B,$ I>7 $1B /E7 >E;75CMP DL,-CB G>V >E;71 MOF DL,Q"Q MOF 2B,$ I>7 $1B /E7 >E;715 CMP DL,1&B G>V >E;7$ MOF DL,QUQ MOF 2B,$ I>7 $1B /E7 >E;7$5 2DD DL,&-B Dept.of CSE, DSCE,Bangalore Selse find t1o3s co!ple!ent SnansUnegati0e ans1erU1, ie, true Sco!pare t#e t#ird c#ar 1it# ?U3 Sdispla t#e ans1er

SblUcount for & ro1s SalU-1, c#ec. for ro11

Sto find t#e .e pressed

Sto co!pare if t#e .e pressed is ?N3

Sto co!pare if t#e .e pressed is ?"?

Sto co!pare if t#e .e pressed is ?U3

S else t#e .e pressed is a digit page (1

Microprocessor Lab Manual MOF 2B,$ I>7 $1B /E7 DISP5 CMP >2>S,1 G>V SCIP P9SB 2; MOF DL,Q"Q MOF 2B,$ I>7 $1B POP 2; SCIP522M 2DD 2;,&-&-B MOF B;,2; MOF 2B,$ MOF DL,BB I>7 $1B MOF DL,BL I>7 $1B /E7 DEL2Y5MOF B;,$@@@B B$5 MOF C;,-@@@@B B15 LOOP B1 DEC B; G>V B$ /E7 E>D

Sif negati0e ans1er is false ie, - Du!p to s.ip Selse add ?"? s !bol before t#e no. and displa

/-1.Ge%!"!#e ! 0*%e 7!4e (0*%, #5e DAC *%#e"'!)eFT5e &(# (# &' #5e DAC *0 #& 1e +*0 2!8e+ &% ! CROE. .MODEL SM2LL .D272 2 DB --,$$,'&,)&,+1,,*,1-,,11,,1$(,1$* S points to plot .CODE Dept.of CSE, DSCE,Bangalore page ($

Microprocessor Lab Manual MOF 2;,RD272 MOF DS,2; MOF 2L,+-B MOF D;,-E'-&B O97 D;,2L MOF SI,-@@@@B MOF B;,MOF D;,-E'-1B B15MOF 2L,2MB;O 2DD 2L,1$* O97 D;,2L I>C B; CMP B;,, GB B1 B$5MOF 2L,2MB;O 2DD 2L,1$* O97 D;,2L DEC B; CMP B;,G>V B$ B&5MOF 2L,2MB;O MOF CL,1$* S9B CL,2L MOF 2L,CL O97 D;,2L I>C B; CMP B;,, GB B& B'5 MOF 2L,2MB;O MOF CL,1$* S9B CL,2L MOF 2L,CL O97 D;,2L DEC B; CMP B;,G>V B' DEC SI G>V B1 MOF 2B,'CB I>7 $1B E>D

SSI"no. of sine 1a0efor!s SB;"count no. of points SportB as oTp port S-"$(( le0els possible. Median is 1$*

Dept.of CSE, DSCE,Bangalore

page (&

Microprocessor Lab Manual

/B1.Ge%e"!#e ! H!2' Re)#*'*e+ S*%e 7!4e '&"$ (0*%, #5e DAC *%#e"'!)e.FT5e &(# (# &' #5e DAC *0 #& +*0 2!8 &% ! CROE. .MODEL SM2LL .D272 2 DB --,$$,'&,)&,+1,,*,1-,,11,,1$(,1$* .CODE MOF 2;,RD272 MOF DS,2; Dept.of CSE, DSCE,Bangalore page ('

Microprocessor Lab Manual MOF 2L,+-B MOF D;,-E'-&B O97 D;,2L MOF C;,-@@@@B MOF B;,MOF D;,-E'--B B15 MOF 2L,2MB;O 2DD 2L,1$* O97 D;,2L I>C B; CMP B;,, GB B1 B$5 MOF 2L,2MB;O 2DD 2L,1$* O97 D;,2L DEC B; CMP B;,G>V B$ MOF SI,1' /P75 MOF 2L,1$* O97 D;,2L DEC SI G>V /P7 LOOP B1 E;I75 MOF 2B,'CB I>7 $1B E>D

Sport2 as oTp port

Sloop for #alf rectified 1a0e

/D1. Ge%e"!#e ! F(228 Re)#*'*e+ S*%e 7!4e '"&$ (0*%, #5e DAC *%#e"'!)e FT5e &( (# &' #5e DAC *0 #& 1e +*0 2!8e+ &% ! CROE. .MODEL SM2LL .D272 2 DB --,$$,'&,)',+$,,*,11-,11,,1$(,1$* .CODE MOF 2;,RD272 MOF DS,2; MOF 2L,+-B Dept.of CSE, DSCE,Bangalore page ((

Microprocessor Lab Manual MOF D;,-E'-&B O97 D;,2L MOF C;,-@@@@B MOF B;,MOF D;,-E'-1B B15MOF 2L,2MB;O 2DD 2L,1$+ O97 D;,2L I>C B; CMP B;,, GB B1 B$5MOF 2L,2MB;O 2DD 2L,1$+ O97 D;,2L DEC B; CMP B;,G>V B$ LOOP B1 MOF 2B,'CB I>7 $1B E>D

SC;"no. of 1a0efor!s

/51.D"*4e E2e4!#&" I%#e"'!)e *% #5e '&22&7*%, 7!8< *. I%*#*!228 #5e e2e4!#&" 05&(2+ 1e *% #5e ,"&(%+ '2&&", 7*#5 !22 "eH(e0#0 *% OFF 0#!#e. **. W5e% ! "eH(e0# *0 $!+e '"&$ ! '2&&", #5e e2e4!#&" 05&(2+ $&4e #& #5!# '2&&", 7!*# #5e"e '&" ! )&( 2e &' 0e)&%+0, !%+ #5e% )&$e +&7% #& ,"&(%+ '2&&" !%+ 0#& . I' 0&$e "eH(e0#0 &))(" +("*%, ,&*%, ( &" )&$*%, +&7% #5e8 05&(2+ 1e *,%&"e+. .MODEL SM2LL .CODE MOF D;,-E'-&B MOF 2L,+$B O97 D;,2L Dept.of CSE, DSCE,Bangalore

Sport B as iTp port

page ()

Microprocessor Lab Manual B2C5 MOF 2B,-1 I>7 1)B G>E E;I7 MOF 2L,MOF D;,-E'--B O97 D;,2L MOF 2L,-@-B O97 D;,2L LOOP15C2LL /ICBE GV LOOP1 SB/ 2L,1 G>C A>D SB/ 2L,1 G>C @@ SB/ 2L,1 G>C S@ GMP 7@ /ICBE5MOF D;,-E'-1B I> 2L,D; O/ 2L,-@-B CMP 2L,-@@B /E7 A>D5C2LL DEL2Y C2LL DEL2Y MOF 2L,-@-B GMP B2C @@5MOF 2L,-@-B MOF CL,-& C2LL M9P C2LL DEL2Y C2LL DEL2Y MOF CL,-& C2LL DO4> GMP B2C S@5MOF 2L,-@-B MOF CL,-) C2LL M9P C2LL DEL2Y C2LL DEL2Y MOF CL,-) C2LL AOD4 GMP B2C 7@5MOF 2L,-@-B MOF CL,-,B C2LL M9P C2LL DEL2Y Dept.of CSE, DSCE,Bangalore Sif a .e is pressed fro! t#e .e board t#en e:it

Sc#ec. if t#ere is a re=uest Sif no re=uest 1ait Sc#ec. for gnd floor Sif e=ual go to gnd Sc#ec. for 1st floor Sif e=ual go to @@ Sc#ec. for $nd floor Sif e=ual go to $nd floor Selse go to &rd floor Sta.e t#e iTp fro! t#e interface Sco!pare if no .e is pressed Ssta in ground floor for fe1 secs Sclear t#e iTp data and Du!p for ne:t re=uest Sclear t#e iTp data SclUcount for no. of LED3s,for first floor LED3sU& Sto !o0e up1ards Sto !o0e do1n1ards Sgo to bac for ne:t re=uest SclUcount for no. of LED3s, for second floor LED3sU)

SclUcount for no. of LED3s, for t#ird floor LED3U,

page (*

Microprocessor Lab Manual C2LL DEL2Y MOF CL,-,B C2LL AOD4 GMP B2C E;I75 MOF 2B,'CB I>7 $1B M9P5MOF D;,-E'--B 9P5 I>C 2L C2LL DEL2Y O97 D;,2L LOOP 9P /E7 AOD45MOF D;,-E'--B DO4>5DEC 2L C2LL DEL2Y O97 D;,2L LOOP DO4> /E7 DEL2Y5MOF SI,$@@@B /P7$5MOF DI,-@@@@B /P715DEC DI G>V /P71 DEC SI G>V /P7$ /E7 E>D

Ssend t#e oTp to port 2 Sincre!ent t#e 0alue of 2L to !o0e up Sloop till CLUSsend t#e oTp to port 2 Sdecre!ent t#e 0alue of 2L to co!e do1n Sloop till CLU-

Dept.of CSE, DSCE,Bangalore

page (+

Você também pode gostar