final mpmc lab manual1

Upload: sandy-ronaldo

Post on 04-Jun-2018

245 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Final Mpmc Lab Manual1

    1/99

    EC2308: MICROPROCESSORS &

    MICROCONTROLLERS LAB MANUAL

    V SEM ECE

  • 8/13/2019 Final Mpmc Lab Manual1

    2/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    1. INTRODUCTION TO 8085

    INTEL 8085 is one of the most popula 8!"it mi#opo#esso #apa"le of

    a$$essin% ' (B of memo) an$ its a#hite#tue is simple* The $e+i#e has '0 pins,

    e-uies .5 / poe suppl) an$ #an opeate ith 1M23 sin%le phase #lo#4*

    ALU (Arith!ti" L#$i" U%it:

    The 8085A has a simple 8!"it ALU an$ it o4s in #oo$ination ith the

    a##umulato, tempoa) e%istes, 5 fla%s an$ aithmeti# an$ lo%i# #i#uits* ALU has

    the #apa"ilit) of pefomin% se+eal mathemati#al an$ lo%i#al opeations* The

    tempoa) e%istes ae use$ to hol$ the $ata $uin% an aithmeti# an$ lo%i# opeation*

    The esult is stoe$ in the a##umulato an$ the fla%s ae set o eset a##o$in% to the

    esult of the opeation* The fla%s ae affe#te$ ") the aithmeti# an$ lo%i# opeation*

    The) ae as follos

    6i%n fla%

    Afte the e7e#ution of the aithmeti# ! lo%i# opeation if the "it D

    of the esult is 9, the si%n fla% is set* This fla% is use$ ith si%ne$

    num"es* If it is 9, it is a ne%ati+e num"e an$ if it is 0, it is a positi+e

    num"e*

    :eo fla%

    The 3eo fla% is set if the ALU opeation esults in 3eo* This fla%

    is mo$ifie$ ") the esult in the a##umulato as ell as in othe e%istes*

    Au7illa) #a) fla%

    In an aithmeti# opeation hen a #a) is %eneate$ ") $i%it D1

    an$ passe$ on to D', the au7illa) fla% is set*

    Pait) fla%

    Afte aithmeti# ; lo%i# opeation, if the esult has an e+en num"e

    of 9

  • 8/13/2019 Final Mpmc Lab Manual1

    3/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    Tii%$ '% "#%tr#) *%it

    This unit s)n#honi3es all the mi#opo#esso opeation ith a #lo#4 an$

    %eneates the #ontol si%nals ne#essa) fo #ommuni#ation "eteen the

    mi#opo#esso an$ peipheals* The #ontol si%nals RD ea$ an$ R ite

    in$i#ate the a+aila"ilit) of $ata on the $ata "us*

    I%+tr*"ti#% r!$i+t!r '% !"#!r

    The instu#tion e%iste an$ $e#o$e ae pat of the ALU* hen an instu#tion is

    fet#he$ fom memo) it is loa$e$ in the instu#tion e%iste* The $e#o$e $e#o$es the

    instu#tion an$ esta"lishes the se-uen#e of e+ents to follo*

    R!$i+t!r 'rr',

    The 8085 has si7 %eneal pupose e%istes to stoe 8!"it $ata $uin% po%am

    e7e#ution* These e%istes ae i$entifie$ as B, C, D, E, 2 an$ L* the) #an "e #om"ine$

    as BC, DE an$ 2L to pefom 9!"it opeation*

    A""**)'t#r

    A##umulato is an 8!"it e%iste that is pat of the ALU* This e%iste is use$ to

    stoe 8!"it $ata an$ to pefom aithmeti# an$ lo%i# opeation* The esult of an

    opeation is stoe$ in the a##umulato*

    Pr#$r' "#*%t!r

    The po%am #ounte is a 9!"it e%iste use$ to point to the memo) a$$ess of

    the ne7t instu#tion to "e e7e#ute$*

    St'"- #i%t!r

    It is a 9!"it e%iste hi#h points to the memo) lo#ation in R memo), #alle$

    the 6ta#4*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 1

  • 8/13/2019 Final Mpmc Lab Manual1

    4/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    C#*%i"'ti#% )i%!+

    8085 mi#opo#esso pefoms $ata tansfe opeations usin% thee #ommuni#ation

    lines #alle$ "uses* The) ae a$$ess "us, $ata "us an$ #ontol "us*

    A$$ess "us ; it is a %oup of 9!"it lines %eneall) i$entifie$ as A0; A95*

    The a$$ess "us is uni$ie#tional i*e*, the "its flo in one $ie#tion fom

    mi#opo#esso to the peipheal $e+i#es* It is #apa"le of a$$essin% 9

    memo) lo#ations*

    Data "us ; it is a %oup of 8 lines use$ fo $ata flo an$ it is "i$ie#tional*

    The $ata an%es fom 00 ; >>*

    Contol "us ; it #onsist of +aious sin%le lines that #a) s)n#honi3in%

    si%nals* The mi#opo#esso uses su#h si%nals fo timin% pupose*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '

  • 8/13/2019 Final Mpmc Lab Manual1

    5/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    2(A.8 BIT DATA ADDITION

    AIM:

    To a$$ to 8 "it num"es stoe$ at #onse#uti+e memo) lo#ations*

    AL/ORITM:

    9* Initiali3e memo) pointe to $ata lo#ation** ?et the fist num"e fom memo) in a##umulato*1* ?et the se#on$ num"e an$ a$$ it to the a##umulato*'* 6toe the anse at anothe memo) lo#ation*

    RESULT:

    Thus the 8 "it num"es stoe$ at '500 &'509 ae a$$e$ an$ the esult stoe$ at '50 &'501*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 5

  • 8/13/2019 Final Mpmc Lab Manual1

    6/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LO CART:

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

    6TART

    F2LG '5002

    FAG FMG

    FAGFAG.FMG

    F2LGF2LG.9

    6T=P

    F2LGF2LG.9

    FMG FAG

    FCG 002

    FMG FCG

    F2LGF2LG.9

    Is thee aCa) H

    FCGFCG.9

  • 8/13/2019 Final Mpmc Lab Manual1

    7/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT

    '900 6TART M/I C, 00 Clea C e%*

    '909'90 LI 2, '500 Initiali3e 2L e%* to

    '500'901

    '90'

    '905 M=/ A, M Tansfe fist $ata toa##umulato

    '90 IN 2 In#ement 2L e%* topoint ne7t memo)

    Lo#ation*

    '90 ADD M A$$ fist num"e toa##* Content*

    '908 JNC L9 Jump to lo#ation ifesult $oes not )iel$

    #a)*'90K

    '90A

    '90B INR C In#ement C e%*

    '90C L9 IN 2 In#ement 2L e%* topoint ne7t memo)

    Lo#ation*

    '90D M=/ M, A Tansfe the esult foma##* to memo)*

    '90E IN 2 In#ement 2L e%* topoint ne7t memo)

    Lo#ation*

    '90> M=/ M, C Mo+e #a) to memo)

    '990 2LT 6top the po%am

    OBSERVATION:

    INPUT =UTPUT

    '500 '50

    '509 '501

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

  • 8/13/2019 Final Mpmc Lab Manual1

    8/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    2(B.8 BIT DATA SUBTRACTION

    AIM:

    To 6u"ta#t to 8 "it num"es stoe$ at #onse#uti+e memo) lo#ations*

    AL/ORITM:

    9* Initiali3e memo) pointe to $ata lo#ation** ?et the fist num"e fom memo) in a##umulato*1* ?et the se#on$ num"e an$ su"ta#t fom the a##umulato*'* If the esult )iel$s a "oo, the #ontent of the a##* is #omplemente$ an$ 092 is

    a$$e$ to it

  • 8/13/2019 Final Mpmc Lab Manual1

    9/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LO CART:

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ K

    6TART

    F2LG '5002

    FAG FMG

    Is thee a

    Boo H

    FAGFAG!FMG

    F2LGF2LG.9

    FCG 002

    FCGFCG.9

    6T=P

    F2LGF2LG.9

    FMG FAG

    FMG FCG

    F2LGF2LG.9

    Complement FAGA$$ 092 to FAG

  • 8/13/2019 Final Mpmc Lab Manual1

    10/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT

    '900 6TART M/I C, 00 Clea C e%*

    '90'90 LI 2, '500 Initiali3e 2L e%* to

    '500'901

    '90'

    '905 M=/ A, M Tansfe fist $ata toa##umulato

    '90 IN 2 In#ement 2L e%* topoint ne7t mem*

    Lo#ation*

    '90 6UB M 6u"ta#t fist num"efom a##* Content*

    '908 JNC L9 Jump to lo#ation ifesult $oes not )iel$

    "oo*'90K

    '90A

    '90B INR C In#ement C e%*

    '90C CMA Complement the A##*#ontent

    '90D ADI 092 A$$ 092 to #ontent ofa##*'90E

    '90> L9 IN 2 In#ement 2L e%* topoint ne7t mem*

    Lo#ation*

    '990 M=/ M, A Tansfe the esult foma##* to memo)*

    '999 IN 2 In#ement 2L e%* topoint ne7t mem*

    Lo#ation*

    '99 M=/ M, C Mo+e #a) to mem*

    '991 2LT 6top the po%am

    OBSERVATION:

    INPUT =UTPUT

    '500 '50

    '509 '501

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 90

  • 8/13/2019 Final Mpmc Lab Manual1

    11/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    3(A.8 BIT DATA MULTIPLICATION

    AIM:

    To multipl) to 8 "it num"es stoe$ at #onse#uti+e memo) lo#ations an$ stoe

    the esult in memo)*

    AL/ORITM:

    LO/IC:Multipli#ation #an "e $one ") epeate$ a$$ition*

    9* Initiali3e memo) pointe to $ata lo#ation** Mo+e multipli#an$ to a e%iste*1* Mo+e the multiplie to anothe e%iste*'* Clea the a##umulato*5* A$$ multipli#an$ to a##umulato

    * De#ement multiplie* Repeat step 5 till multiplie #omes to 3eo*8* The esult, hi#h is in the a##umulato, is stoe$ in a memo) lo#ation*

    RESULT:

    Thus the 8!"it multipli#ation as $one in 8085p usin% epeate$ a$$ition metho$*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 99

  • 8/13/2019 Final Mpmc Lab Manual1

    12/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LO CART:

    N=

    @E6

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 9

    F2LG '500

    B M

    A 00

    C 00

    Is theean)#a)

    C C.9

    B B!9

    FAG FAG .FMG

    F2LG F2LG.9

    I6B0

    A

    6TART

  • 8/13/2019 Final Mpmc Lab Manual1

    13/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 91

    A

    6T=P

    F2LGF2LG.9

    FMG FAG

    FMG FCG

    F2LGF2LG.9

  • 8/13/2019 Final Mpmc Lab Manual1

    14/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT

    '900 6TART LI 2, '500 Initiali3e 2L e%* to'500

    Tansfe fist $ata toe%* B

    '909

    '90'901 M=/ B, M

    '90' IN 2 In#ement 2L e%* topoint ne7t mem*

    Lo#ation*

    '905 M/I A, 002 Clea the a##*

    '90

    '90 M/I C, 002 Clea C e% fo #a)

    '908

    '90K L9 ADD M A$$ multipli#an$multiplie times*

    '90A JNC NET Jump to NET if theeis no #a)'90B

    '90C

    '90D INR C In#ement C e%

    '90E NET DCR B De#ement B e%

    '90> JN: L9 Jump to L9 if B is not3eo*'990

    '999

    '99 IN 2 In#ement 2L e%* topoint ne7t mem*

    Lo#ation*

    '991 M=/ M, A Tansfe the esult foma##* to memo)*

    '99' IN 2 In#ement 2L e%* topoint ne7t mem*

    Lo#ation*

    '995 M=/ M, C Tansfe the esult fomC e%* to memo)*

    '99 2LT 6top the po%am

    OBSERVATION:

    INPUT =UTPUT

    '500 '50

    '509 '501

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 9'

  • 8/13/2019 Final Mpmc Lab Manual1

    15/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    3(B.8 BIT DIVISION

    AIM:

    To $i+i$e to 8!"it num"es an$ stoe the esult in memo)*

    AL/ORITM:

    LO/IC:Di+ision is $one usin% the metho$ Repeate$ su"ta#tion*9* Loa$ Di+iso an$ Di+i$en$* 6u"ta#t $i+iso fom $i+i$en$1* Count the num"e of times of su"ta#tion hi#h e-uals the -uotient'* 6top su"ta#tion hen the $i+i$en$ is less than the $i+iso *The $i+i$en$ no

    "e#omes the emain$e* =theise %o to step *5* stop the po%am e7e#ution*

    RESULT:

    Thus an ALP as itten fo 8!"it $i+ision usin% epeate$ su"ta#tion metho$ an$

    e7e#ute$ usin% 8085p 4its

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 95

  • 8/13/2019 Final Mpmc Lab Manual1

    16/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LOCART:

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 9

    B 00

    M A!M

    FBG FBG .9

    I6 A0

    A A. M

    B B!9

    F2LG '500

    A M

    F2LG F2LG.9

    6TART

    6T=P

    F2LGF2LG.9

    FMG FAG

    FMG FBG

    F2LGF2LG.9

  • 8/13/2019 Final Mpmc Lab Manual1

    17/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRESS OPCODE LABEL MNEMO

    NICS

    OPERA

    ND

    COMMENTS

    '900 M/I B,00 Clea B e% fo -uotient

    '909'90 LI 2,'500 Initiali3e 2L e%* to

    '5002'901

    '90'

    '905 M=/ A,M Tansfe $i+i$en$ to a##*

    '90 IN 2 In#ement 2L e%* to pointne7t mem Lo#ation*

    '90 L==P 6UB M 6u"ta#t $i+iso fom $i+i$en$

    '908 INR B In#ement B e%

    '90K JNC L==P Jump to L==P if esult $oesnot )iel$ "oo'90A

    '90B'90C ADD M A$$ $i+iso to a##*

    '90D DCR B De#ement B e%

    '90E IN 2 In#ement 2L e%* to pointne7t mem Lo#ation*

    '90> M=/ M,A Tansfe the emain$e foma## to memo)*

    '990 IN 2 In#ement 2L e%* to pointne7t mem Lo#ation*

    '999 M=/ M,B Tansfe the -uotient fom Be% to memo)*

    '99 2LT 6top the po%am

    OBSERVATION:

    S.NO INPUT OUTPUT

    ADDRE66 DATA ADDRE66 DATA

    9 '500 '50

    '509 '501

    '500 '50

    '509 '501

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 9

  • 8/13/2019 Final Mpmc Lab Manual1

    18/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    (A.14 BIT DATA ADDITION

    AIM:

    To a$$ to 9!"it num"es stoe$ at #onse#uti+e memo) lo#ations*

    AL/ORITM:

    9* Initiali3e memo) pointe to $ata lo#ation** ?et the fist num"e fom memo) an$ stoe in Re%iste pai*1* ?et the se#on$ num"e in memo) an$ a$$ it to the Re%iste pai*'* 6toe the sum & #a) in sepaate memo) lo#ations*

    RESULT:

    Thus an ALP po%am fo 9!"it a$$ition as itten an$ e7e#ute$ in 8085pusin% spe#ial instu#tions*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 98

  • 8/13/2019 Final Mpmc Lab Manual1

    19/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LO CART:

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 9K

    6TART

    FDEG F2LG

    FLG F8052GF2G F80512G

    FAG002

    F2LGF2LG.FDEG

    FLG F8050 2G

    F2G F8059 2G

    Is thee aCa)H

    6T=P

    F805'GF LG

    F8055G F2G

    FAGFAG.9

    F805G FAG

  • 8/13/2019 Final Mpmc Lab Manual1

    20/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT

    8000 6TART L2LD 80502 Loa$ the au%en$ in DEpai thou%h 2L pai*8009

    8008001 C2?

    800' L2LD 8052 Loa$ the a$$en$ in 2Lpai*8005

    800

    800 M/I A, 002 Initiali3e e%* A fo#a)8008

    800K DAD D A$$ the #ontents of 2LPai ith that of DEpai*

    800A JNC L==P If thee is no #a), %o

    to the instu#tionla"ele$ L==P*

    800B800C

    800D INR A =theise in#emente%* A

    800E L==P 62LD 805'2 6toe the #ontent of 2LPai in 805'2L6B ofsum

    800>

    8090

    8099 6TA 8052 6toe the #a) in8052 thou%h A##*M6B of sum*

    809

    8091

    809' 2LT 6top the po%am*

    OBSERVATION:

    INPUT =UTPUT

    ADDRE66 DATA ADDRE66 DATA

    80502 805'2

    80592 80552

    8052 8052

    80512

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 0

  • 8/13/2019 Final Mpmc Lab Manual1

    21/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    (B.14 BIT DATA SUBTRACTION

    AIM:

    To su"ta#t to 9!"it num"es stoe$ at #onse#uti+e memo) lo#ations*

    AL/ORITM:

    9* Initiali3e memo) pointe to $ata lo#ation** ?et the su"tahen$ fom memo) an$ tansfe it to e%iste pai*1* ?et the minuen$ fom memo) an$ stoe it in anothe e%iste pai*'* 6u"ta#t su"tahen$ fom minuen$*5* 6toe the $iffeen#e an$ "oo in $iffeent memo) lo#ations*

    RESULT:

    Thus an ALP po%am fo su"ta#tin% to 9!"it num"es as itten an$e7e#ute$*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 9

  • 8/13/2019 Final Mpmc Lab Manual1

    22/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LO CART:

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

    6TART

    FDEG F2LG

    FLG F8052GF2G F80512G

    F2LGF2LG!FDEG

    FLG F8050 2GF2G F8059 2G

    Is thee a"ooH

    6T=P

    F805'GF LG

    F8055G F2G

    FCGFCG.9

    F805G FCG

  • 8/13/2019 Final Mpmc Lab Manual1

    23/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRESS OPCODE LABEL MNEMO

    NICS

    OPER

    AND

    COMMENTS

    8000 6TART M/I C, 00 Initiali3e C e%*

    8009

    800 L2LD 80502 Loa$ the su"tahen$ in DEe%* Pai thou%h 2L e%*pai*

    8001

    800'

    8005 C2?

    800 L2LD 8052 Loa$ the minuen$ in 2L e%*Pai*800

    8008

    800K M=/ A, L Mo+e the #ontent of e%* L toA##*

    800A 6UB E 6u"ta#t the #ontent of e%*E fom that of a##*

    800B M=/ L, A Mo+e the #ontent of A##* toe%* L

    800C M=/ A, 2 Mo+e the #ontent of e%* 2 toA##*

    800D 6BB D 6u"ta#t #ontent of e%* Dith that of A##*

    800E M=/ 2, A Tansfe #ontent of a##* toe%* 2

    800> 62LD 805'2 6toe the #ontent of 2L paiin memo) lo#ation 850'2*8090

    8099

    809 JNC NET If thee is "oo, %o to theinstu#tion la"ele$ NET*8091

    809'

    8095 INR C In#ement e%* C

    809 NET M=/ A, C Tansfe the #ontent of e%* Cto A##*

    809 6TA 8052 6toe the #ontent of a##* tothe memo) lo#ation 85028098

    809K

    809A 2LT 6top the po%am e7e#ution*

    OBSERVATION:

    INPUT =UTPUT

    ADDRE66 DATA ADDRE66 DATA

    80502 805'2

    80592 80552

    8052 8052

    80512

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 1

  • 8/13/2019 Final Mpmc Lab Manual1

    24/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    5(A.14 BIT MULTIPLICATION

    AIM:

    To multipl) to 9!"it num"es an$ stoe the esult in memo)*

    AL/ORITM:

    9* ?et the multiplie an$ multipli#an$** Initiali3e a e%iste to stoe patial po$u#t*1* A$$ multipli#an$, multiplie times*'* 6toe the esult in #onse#uti+e memo) lo#ations*

    RESULT:

    Thus the 9!"it multipli#ation as $one in 8085p usin% epeate$ a$$ition

    metho$*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '

  • 8/13/2019 Final Mpmc Lab Manual1

    25/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LOCART:

    NO

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 5

    6TART

    L F8050G2 F8059G

    L F805G2 F8051G

    6P 2L

    DE 2L

    2L0000BC0000

    2L2L.6P

    Is Ca)fla% setH

    BCBC.9

    DEDE.9

    Is :eofla% setH

    A

  • 8/13/2019 Final Mpmc Lab Manual1

    26/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    ES

    NO

    ES

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

    A

    F805'G LF8055G 2

    F805G CF805G B

    6T=P

  • 8/13/2019 Final Mpmc Lab Manual1

    27/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    ADDRESS OPCODE LABEL MNEM

    O

    N

    I

    C

    S

    OPERAN

    D

    COMMENTS

    8000 6TART L2LD 8050 Loa$ the fist No* in sta#4 pointethou%h 2L e% pai8009

    800

    8001 6P2L

    800' L2LD 805 Loa$ the se#on$ No* in 2L e%*pai

    & E7#han%e ith DE e% pai*8005

    800

    800 C2?

    8008 LI 2, 00002

    Clea 2L & DE e% pais*

    800K

    800A800B LI B, 00002

    800C

    800D

    800E L==P DAD 6P A$$ 6P ith 2L pai*

    800> JNC NET If thee is no #a), %o to theinstu#tion la"ele$ NET8090

    8099

    809 IN B In#ement BC e% pai

    8091 NET DC D De#ement DE e% pai*

    809' M=/ A,E Mo+e the #ontent of e% E to A##*

    8095 =RA D =R A## ith D e%*

    809 JN: L==P If thee is no 3eo, %o to instu#tionla"ele$ L==P809

    8098

    809K 62LD 805' 6toe the #ontent of 2L pai inmemo) lo#ations 805' &8055*

    809A

    809B

    809C M=/ A, C Mo+e the #ontent of e%* C to A##*

    809D 6TA 805 6toe the #ontent of A##* inmemo) lo#ation 805*809E

    809>800 M=/ A, B Mo+e the #ontent of e%* B to A##*

    809 6TA 805 6toe the #ontent of A##* inmemo) lo#ation 805*80

    801

    80' 2LT 6top po%am e7e#ution

    OBSERVATION:INPUT =UTPUT

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

  • 8/13/2019 Final Mpmc Lab Manual1

    28/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    ADDRE66 DATA ADDRE66 DATA

    8050 805'

    8059 8055

    805 8058051 805

    5(B.146 BIT DIVISION

    AIM:

    To $i+i$e to 9!"it num"es an$ stoe the esult in memo) usin% 8085mnemoni#s*

    AL/ORITM:

    9* ?et the $i+i$en$ an$ $i+iso** Initiali3e the e%iste fo -uotient*1* Repeate$l) su"ta#t $i+iso fom $i+i$en$ till $i+i$en$ "e#omes less than $i+iso*'* Count the num"e of su"ta#tion hi#h e-uals the -uotient*5* 6toe the esult in memo)*

    RESULT:

    Thus the 9!"it Di+ision as $one in 8085p usin% epeate$ su"ta#tion metho$*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 8

  • 8/13/2019 Final Mpmc Lab Manual1

    29/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LOCART:

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ K

    6TART

    L F8059G2 F805G

    2L DE

    L F8050G2 F8059G

    BC 00002

    A L AA! ELA

    A2AA! 2! Boo2A

    BCBC. 9

    Is Ca)

    fla% set H

    A

  • 8/13/2019 Final Mpmc Lab Manual1

    30/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 10

    A

    BCBC! 9

    2L2L.DE

    LF805'G2F8055G

    AC

    F805G A

    AB

    F805G A

    6T=P

  • 8/13/2019 Final Mpmc Lab Manual1

    31/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRESS OPCODE LABEL MNEM

    ONICS

    OPERA

    ND

    COMMENTS

    8000 6TART L2LD 805 Loa$ the fist No* in sta#4 pointethou%h 2L e%* pai8009

    8008001 C2?

    800' L2LD 8050 Loa$ the se#on$ No* in 2L e%* pai & E7#han%e ith DE e%* pai*8005

    800

    800 LI B, 00002Clea BC e%* pai*8008

    800K

    800A L==P M=/ A, L Mo+e the #ontent of e%* L to A##*

    800B 6UB E 6u"ta#t e%* E fom that of A##*

    800C M=/ L, A Mo+e the #ontent of A## to L*

    800D M=/ A, 2 Mo+e the #ontent of e%* 2 A##*800E 6BB D 6u"ta#t e%* D fom that of A##*

    800> M=/ 2, A Mo+e the #ontent of A## to 2*

    8090 IN B In#ement e%* Pai BC

    8099 JNC L==P If thee is no #a), %o to the lo#ationla"ele$ L==P*809

    8091

    809' DC B De#ement BC e%* pai*

    8095 DAD D A$$ #ontent of 2L an$ DE e%* pais*

    809 62LD 805' 6toe the #ontent of 2L pai in 805' &8055*809

    8098

    809K M=/ A, C Mo+e the #ontent of e%* C to A##*

    809A 6TA 805 6toe the #ontent of A##* in memo)805809B

    809C

    809D M=/ A, B Mo+e the #ontent of e%* B to A##*

    809E 6TA 805 6toe the #ontent of A##* in memo)805*809>

    800

    809 2LT 6top the po%am e7e#ution*

    OBSERVATION:

    INPUT =UTPUT

    ADDRE66 DATA ADDRE66 DATA

    8050 805'

    8059 8055

    805 805

    8051 805

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 19

  • 8/13/2019 Final Mpmc Lab Manual1

    32/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    4(A.LAR/EST ELEMENT IN AN ARRA

    AIM:

    To fin$ the la%est element in an aa)*

    AL/ORITM:

    9* Pla#e all the elements of an aa) in the #onse#uti+e memo) lo#ations*

    * >et#h the fist element fom the memo) lo#ation an$ loa$ it in the a##umulato*

    1* Initiali3e a #ounte e%iste ith the total num"e of elements in an aa)*

    '* De#ement the #ounte ") 9*

    5* In#ement the memo) pointe to point to the ne7t element*

    * Compae the a##umulato #ontent ith the memo) #ontent ne7t

    element*

    * If the a##umulato #ontent is smalle, then mo+e the memo) #ontent

    la%est element to the a##umulato* Else #ontinue*

    8* De#ement the #ounte ") 9*

    K* Repeat steps 5 to 8 until the #ounte ea#hes 3eo

    90* 6toe the esult a##umulato #ontent in the spe#ifie$ memo) lo#ation*

    RESULT:

    Thus the la%est num"e in the %i+en aa) is foun$ out*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 1

  • 8/13/2019 Final Mpmc Lab Manual1

    33/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LO CART:

    N=

    @E6

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 11

    FBG0'2

    F2LGF89002G

    FAGF2LG

    F2LF2LG . 9

    I6FAG F2LGH

    FAGF2LG

    F8905GFAG

    6TART

    FBGFBG!9

    I6FBG 0H

    6T=P

  • 8/13/2019 Final Mpmc Lab Manual1

    34/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRE

    SS

    OPCO

    DE

    LABEL MNEM

    ONICS

    OPER

    AND

    COMMENTS

    8009 LI 2,8900 Initiali3e 2L e%* to89002800

    8001

    800' M/I B,0' Initiali3e B e% ith no* of#ompaisonsn!98005

    800 M=/ A,M Tansfe fist $ata to a##*

    800 L==P9 IN 2 In#ement 2L e%* to pointne7t memo) lo#ation

    8008 CMP M Compae M & A

    800K JNC L==P If A is %eate than M then %oto loop800A

    800B800C M=/ A,M Tansfe $ata fom M to A e%

    800D L==P DCR B De#ement B e%

    800E JN: L==P9 If B is not :eo %o to loop9

    800>

    8090

    8099 6TA 8905 6toe the esult in a memo)lo#ation*809

    8091

    809' 2LT 6top the po%am

    OBSERVATION:

    INPUT =UTPUT

    ADDRE66 DATA ADDRE66 DATA

    8900 8905

    8909

    890

    8901

    890'

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 1'

  • 8/13/2019 Final Mpmc Lab Manual1

    35/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    4(B.SMALLEST ELEMENT IN AN ARRA

    AIM:

    To fin$ the smallest element in an aa)*

    AL/ORITM:

    9* Pla#e all the elements of an aa) in the #onse#uti+e memo) lo#ations*

    * >et#h the fist element fom the memo) lo#ation an$ loa$ it in the a##umulato*

    1* Initiali3e a #ounte e%iste ith the total num"e of elements in an aa)*

    '* De#ement the #ounte ") 9*

    5* In#ement the memo) pointe to point to the ne7t element*

    * Compae the a##umulato #ontent ith the memo) #ontent ne7t

    element*

    * If the a##umulato #ontent is smalle, then mo+e the memo) #ontent

    la%est element to the a##umulato* Else #ontinue*

    8* De#ement the #ounte ") 9*

    K* Repeat steps 5 to 8 until the #ounte ea#hes 3eo

    90* 6toe the esult a##umulato #ontent in the spe#ifie$ memo) lo#ation*

    RESULT:

    Thus the smallest num"e in the %i+en aa) is foun$ out*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 15

  • 8/13/2019 Final Mpmc Lab Manual1

    36/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LO CART:

    @E6

    N=

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 1

    FBG0'2

    F2LGF89002G

    FAGF2LG

    F2LF2LG . 9

    I6FAG F2LGH

    FAGF2LG

    F8905GFAG

    6TART

    FBGFBG!9

    I6FBG 0H

    6T=P

  • 8/13/2019 Final Mpmc Lab Manual1

    37/99

  • 8/13/2019 Final Mpmc Lab Manual1

    38/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    7(A.ASCENDIN/ ORDER

    AIM:

    To sot the %i+en num"e in the as#en$in% o$e usin% 8085 mi#opo#esso*

    AL/ORITM:9* ?et the num"es to "e sote$ fom the memo) lo#ations*

    * Compae the fist to num"es an$ if the fist num"e is la%e than se#on$ then Iinte#han%e the num"e*1* If the fist num"e is smalle, %o to step ''* Repeat steps an$ 1 until the num"es ae in e-uie$ o$e

    RESULT:

    Thus the as#en$in% o$e po%am is e7e#ute$ an$ thus the num"es ae aan%e$in as#en$in% o$e*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 18

  • 8/13/2019 Final Mpmc Lab Manual1

    39/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LOCART:

    @E6

    N=

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 1K

    FBG0'2

    F2LGF89002G

    FAGF2LG

    F2LF2LG . 9

    I6FAG F2LGH

    FDGF2LG

    F2LGFAG

    F2LGF2LG ! 9

    F2LGFDG

    F2LGF2LG . 9

    FCGFCG ; 09 2

    A

    FCG0'2

    6TART

  • 8/13/2019 Final Mpmc Lab Manual1

    40/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    N=

    @E6

    N=

    @E6

    PRO/RAM:

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '0

    I6FCG

    0H

    A

    FBGFBG!9

    I6FBG 0H

    6T=P

  • 8/13/2019 Final Mpmc Lab Manual1

    41/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    ADDR

    E

    SS

    OPCO

    DE

    LABEL MNEM

    ONICS

    OPER

    AND

    COMMENTS

    8000 M/I B,0' Initiali3e B e% ith num"e

    of #ompaisons n!98009800 L==P 1 LI 2,8900 Initiali3e 2L e%* to

    890028001

    800'

    8005 M/I C,0' Initiali3e C e% ith no* of#ompaisonsn!9800

    800 L==P M=/ A,M Tansfe fist $ata to a##*

    8008 IN 2 In#ement 2L e%* to pointne7t memo) lo#ation

    800K CMP M Compae M & A

    800A JC L==P9 If A is less than M then %o to

    loop9800B800C

    800D M=/ D,M Tansfe $ata fom M to D e%

    800E M=/ M,A Tansfe $ata fom a## to M

    800> DC 2 De#ement 2L pai

    8090 M=/ M,D Tansfe $ata fom D to M

    8099 IN 2 In#ement 2L pai

    809 L==P9 DCR C De#ement C e%

    8091 JN: L==P If C is not 3eo %o to loop

    809'

    8095

    809 DCR B De#ement B e%

    809 JN: L==P1 If B is not :eo %o to loop1

    8098

    809K

    809A 2LT 6top the po%am

    OBSERVATION:

    INPUT =UTPUT

    MEM=R@L=CATI=N DATA MEM=R@L=CATI=N DATA

    8900 8900

    8909 8909

    890 890

    8901 8901

    890' 890'

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '9

  • 8/13/2019 Final Mpmc Lab Manual1

    42/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    7(B.DE SCENDIN/ ORDER

    AIM:

    To sot the %i+en num"e in the $es#en$in% o$e usin% 8085 mi#opo#esso*

    AL/ORITM:9* ?et the num"es to "e sote$ fom the memo) lo#ations*

    * Compae the fist to num"es an$ if the fist num"e is smalle than se#on$ then Iinte#han%e the num"e*1* If the fist num"e is la%e, %o to step ''* Repeat steps an$ 1 until the num"es ae in e-uie$ o$e

    RESULT:

    Thus the $es#en$in% o$e po%am is e7e#ute$ an$ thus the num"es ae aan%e$in $es#en$in% o$e*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '

  • 8/13/2019 Final Mpmc Lab Manual1

    43/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LOCART:

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '1

    FBG0'2

    F2LGF89002G

    FAGF2LG

    F2LF2LG . 9

    I6FAG F2LGH

    FDGF2LG

    F2LGFAG

    F2LGF2LG ! 9

    F2LGFDG

    F2LGF2LG . 9

    FCGFCG ; 09 2

    A

    FCG0'2

    6TART

  • 8/13/2019 Final Mpmc Lab Manual1

    44/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    N=

    @E6

    N=

    @E6

    PRO/RAM:

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ ''

    I6FCG

    0H

    A

    FBGFBG!9

    I6FBG 0H

    6T=P

  • 8/13/2019 Final Mpmc Lab Manual1

    45/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    ADDRE

    SS

    OPCO

    DE

    LABEL MNEM

    ONICS

    OPER

    AND

    COMMENTS

    8000 M/I B,0' Initiali3e B e% ith num"eof #ompaisons n!98009

    800 L==P 1 LI 2,8900 Initiali3e 2L e%* to890028001

    800'

    8005 M/I C,0' Initiali3e C e% ith no* of#ompaisonsn!9800

    800 L==P M=/ A,M Tansfe fist $ata to a##*

    8008 IN 2 In#ement 2L e%* to pointne7t memo) lo#ation

    800K CMP M Compae M & A

    800A JNC L==P9 If A is %eate than M then %oto loop9800B

    800C800D M=/ D,M Tansfe $ata fom M to D e%

    800E M=/ M,A Tansfe $ata fom a## to M

    800> DC 2 De#ement 2L pai

    8090 M=/ M,D Tansfe $ata fom D to M

    8099 IN 2 In#ement 2L pai

    809 L==P9 DCR C De#ement C e%

    8091 JN: L==P If C is not 3eo %o to loop

    809'

    8095

    809 DCR B De#ement B e%

    809 JN: L==P1 If B is not :eo %o to loop1

    8098

    809K

    809A 2LT 6top the po%am

    OBSERVATION:

    INPUT =UTPUT

    MEM=R@

    L=CATI=N

    DATA MEM=R@

    L=CATI=N

    DATA

    8900 8900

    8909 8909

    890 890

    8901 8901

    890' 890'

    8(A.CODE CONVERSION DECIMAL TO E9

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '5

  • 8/13/2019 Final Mpmc Lab Manual1

    46/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    AIM:

    To #on+et a %i+en $e#imal num"e to he7a$e#imal*

    AL/ORITM:

    9* Initiali3e the memo) lo#ation to the $ata pointe** In#ement B e%iste*1* In#ement a##umulato ") 9 an$ a$Oust it to $e#imal e+e) time*'* Compae the %i+en $e#imal num"e ith a##umulato +alue*5* hen "oth mat#hes,the e-ui+alent he7a$e#imal +alue is in B e%iste** 6toe the esultant in memo) lo#ation*

    RESULT:

    Thus an ALP po%am fo #on+esion of $e#imal to he7a$e#imal as itten an$

    e7e#ute$*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '

  • 8/13/2019 Final Mpmc Lab Manual1

    47/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LOCART:

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '

    6TART

    2L '5002

    A 00

    B 002

    A A .9

    De#imal a$Ousta##umulato

    B B.9

    A B

    IsAMH

    8909 A

    6top

  • 8/13/2019 Final Mpmc Lab Manual1

    48/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRE

    SS

    OPCO

    DE

    LABEL MNEM

    ONICS

    OPER

    AND

    COMMENTS

    8000 LI 2,8900 Initiali3e 2L e%* to

    890028009800

    8001 M/I A,00 Initiali3e A e%iste*

    800'

    8005 M/I B,00 Initiali3e B e%iste**

    800

    800 L==P INR B In#ement B e%*

    8008 ADI 09 In#ement A e%

    800K

    800A DAA De#imal A$Oust A##umulato

    800B CMP M Compae M & A

    800C JN: L==P If a## an$ %i+en num"e aenot e-ual, then %o to L==P800D

    800E

    800> M=/ A,B Tansfe B e% to a##*

    8090 6TA 8909 6toe the esult in a memo)lo#ation*8099

    809

    8091 2LT 6top the po%am

    RESULT:

    INPUT =UTPUT

    ADDRE66 DATA ADDRE66 DATA

    8900 8909

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '8

  • 8/13/2019 Final Mpmc Lab Manual1

    49/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    8(B. CODE CONVERSION E9ADECIMAL TO DECIMAL

    AIM:

    To #on+et a %i+en he7a$e#imal num"e to $e#imal*

    AL/ORITM:

    9* Initiali3e the memo) lo#ation to the $ata pointe** In#ement B e%iste*1* In#ement a##umulato ") 9 an$ a$Oust it to $e#imal e+e) time*'* Compae the %i+en he7a$e#imal num"e ith B e%iste +alue*5* hen "oth mat#h, the e-ui+alent $e#imal +alue is in A e%iste** 6toe the esultant in memo) lo#ation*

    RESULT:

    Thus an ALP po%am fo #on+esion of he7a$e#imal to $e#imal as itten an$e7e#ute$*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 'K

  • 8/13/2019 Final Mpmc Lab Manual1

    50/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LOCART:

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 50

    6top

    6TART

    2L 89002

    A 00

    B 002

    A A .9

    De#imal a$Ousta##umulato

    B B.9

    D A, A B,

    IsAMH

    8909 A, A C890 A

    C 002

    C C.9

    Isthee#a)H

  • 8/13/2019 Final Mpmc Lab Manual1

    51/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRE

    SS

    OPCO

    DE

    LABEL MNEM

    ONICS

    OPER

    AND

    COMMENTS

    8000 LI 2,8900 Initiali3e 2L e%* to

    890028009800

    8001 M/I A,00 Initiali3e A e%iste*

    800'

    8005 M/I B,00 Initiali3e B e%iste*

    800

    800 M/I C,00 Initiali3e C e%iste fo #a)*

    8008

    800K L==P INR B In#ement B e%*

    800A ADI 09 In#ement A e%

    800B

    800C DAA De#imal A$Oust A##umulato 800D JNC NET If thee is no #a) %o to

    NET*800E

    800>

    8090 INR C In#ement # e%iste*

    8099 NET M=/ D,A Tansfe A to D

    809 M=/ A,B Tansfe B to A

    8091 CMP M Compae M & A

    809' M=/ A,D Tansfe D to A

    8095 JN: L==P If a## an$ %i+en num"e aenot e-ual, then %o to L==P809

    809

    8098 6TA 8909 6toe the esult in a memo)lo#ation*809K

    809A

    809B M=/ A,C Tansfe C to A

    809C 6TA 890 6toe the #a) in anothememo) lo#ation*809D

    809E

    809> 2LT 6top the po%am

    RESULT:

    INPUT =UTPUT

    ADDRE66 DATA ADDRE66 DATA

    8900 8909

    890

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 59

  • 8/13/2019 Final Mpmc Lab Manual1

    52/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    (A.BCD ADDITIONAIM:

    To a$$ to 8 "it BCD num"es stoe$ at #onse#uti+e memo) lo#ations*

    AL/ORITM:

    9* Initiali3e memo) pointe to $ata lo#ation** ?et the fist num"e fom memo) in a##umulato*1* ?et the se#on$ num"e an$ a$$ it to the a##umulato'* A$Oust the a##umulato +alue to the pope BCD +alue usin% DAA instu#tion*5* 6toe the anse at anothe memo) lo#ation*

    RESULT:

    Thus the 8 "it BCD num"es stoe$ at '500 &'509 ae a$$e$ an$ the esult stoe$ at'50 & '501*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 5

  • 8/13/2019 Final Mpmc Lab Manual1

    53/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LO CART:

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 51

    6TART

    F2LG '5002

    FAG FMG

    FAGFAG.FMGDe#imal A$Oust A##umulato

    F2LGF2LG.9

    6T=P

    F2LGF2LG.9

    FMG FAG

    FCG 002

    FMG FCG

    F2LGF2LG.9

    Is thee a

    Ca)H

    FCGFCG.9

  • 8/13/2019 Final Mpmc Lab Manual1

    54/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT

    '900 6TART M/I C, 00 Clea C e%*'901

    '90 LI 2, '500 Initiali3e 2L e%* to'500'901

    '90'

    '905 M=/ A, M Tansfe fist $ata toa##umulato

    '90 IN 2 In#ement 2L e%* topoint ne7t memo)

    Lo#ation*

    '90 ADD M A$$ fist num"e to

    a##* Content*'908 DAA De#imal a$Oust

    a##umulato

    '90K JNC L9 Jump to lo#ation ifesult $oes not )iel$

    #a)*'90A

    '90B

    '90C INR C In#ement C e%*

    '90D L9 IN 2 In#ement 2L e%* topoint ne7t memo)

    Lo#ation*

    '90E M=/ M, A Tansfe the esult foma##* to memo)*

    '90> IN 2 In#ement 2L e%* topoint ne7t memo)

    Lo#ation*

    '990 M=/ M, C Mo+e #a) to memo)

    '999 2LT 6top the po%am

    OBSERVATION:

    INPUT =UTPUT

    '500 '50

    '509 '501

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 5'

  • 8/13/2019 Final Mpmc Lab Manual1

    55/99

  • 8/13/2019 Final Mpmc Lab Manual1

    56/99

  • 8/13/2019 Final Mpmc Lab Manual1

    57/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT

    '900 6TART M/I D, 00 Clea D e%*

    '909

    '90 LI 2, '500 Initiali3e 2L e%* to'500'901

    '90'

    '905 M=/ B, M Tansfe fist $ata toa##umulato

    '90 IN 2 In#ement 2L e%* topoint ne7t mem*

    Lo#ation*

    '90 M=/ C, M Mo+e se#on$ no* to Be%*

    '908 M/I A, KK Mo+e KK to the

    A##umulato'90K'90A 6UB C 6u"ta#t FCG fom a##*

    Content*

    '90B INR A In#ement A e%iste

    '90C ADD B A$$ FBG ith FAG

    '90D DAA A$Oust A##umulato+alue fo De#imal $i%its

    '90E JC L==P Jump on #a) to loop

    '90>

    '990

    '999 INR D In#ement D e%*'99 L==P IN 2 In#ement 2L e%iste

    pai

    '991 M=/ M , A Mo+e the A##*#ontent tothe memo) lo#ation

    '99' IN 2 In#ement 2L e%* topoint ne7t mem*

    Lo#ation*

    '995 M=/ M, D Tansfe D e%iste#ontent to memo)*

    '99 2LT 6top the po%am

    OBSERVATION:

    INPUT =UTPUT

    '500 '50

    '509 '501

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 5

  • 8/13/2019 Final Mpmc Lab Manual1

    58/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    10. 2 9 2 MATRI9 MULTIPLICATION

    AIM:

    To pefom the 7 mati7 multipli#ation*

    AL/ORITM:

    9* Loa$ the input mati#es in the sepaate a$$ess an$ initiali3e the 2L an$ the DEe%iste pai ith the statin% a$$ess espe#ti+el)*

    * Call a su"outine fo pefomin% the multipli#ation of one element of a mati7ith the othe element of the othe mati7*

    1* Call a su"outine to stoe the esultant +alues in a sepaate mati7*

    RESULT:

    Thus the 7 mati7 multipli#ation is pefome$ an$ the esult is stoe$ at '00,'09 ,'0 & '01*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 58

  • 8/13/2019 Final Mpmc Lab Manual1

    59/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    LO CART:

    @E6

    N=

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 5KCall su"outineMUL

    2L 2L.9DE DE.9 DE DE.9

    IsA0'2

    H

    In#ement 2Le%* pai

    C 0022L 85002

    DE 8002

    2L 2L.9DE DE.9 DE DE.9

    B A

    A A.B

    6TART

    2L 2L!9DE DE!9

    B A

    A

    Call su"outineMUL

    Call su"outine

    6T=RE

    A

    Call su"outineMUL

    Call su"outineMUL

    A A.B

    Call su"outine 6T=RE

    Call su"outineMUL

    A C

    BA

    B6T=P

  • 8/13/2019 Final Mpmc Lab Manual1

    60/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    @E6

    N=

    N=

    @E6

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 0

    MUL

    2 2! 9

    Is 20 H

    FAG FFDEGG

    D A2 M

    FDGFDG.9

    F2G85 FDG8

    2 2! 9

    Is 20 H

    RET

    6T=RE

    B 8

    FAGFFBCGG

    C C. 9

    RET

  • 8/13/2019 Final Mpmc Lab Manual1

    61/99

  • 8/13/2019 Final Mpmc Lab Manual1

    62/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    89 CPI 0' Compae ith 0' to #he#4 hetheall elements ae multiplie$*898

    89K J: L==P9 If #omplete$, %o to loop9

    89A

    89B

    89C IN 2 In#ement 2L e%iste Pai*89D JMP L==P Jump to L==P*

    89E

    89>

    8910 L==P9 2LT 6top the po%am*

    8919 MUL LDA D Loa$ a## fom the memo) lo#ationpointe$ ") DE pai*

    891 M=/ D,A Tansfe a## #ontent to D e%iste*

    8911 M=/ 2,M Tansfe fom memo) to 2 e%iste*

    891' DCR 2 De#ement 2 e%iste*

    8915 J: L==P1 If 2 is 3eo %o to L==P1*

    891891

    8918 L==P' ADD D A$$ A## ith D e%

    891K DCR 2 De#ement 2 e%iste*

    891A JN: L==P' If 2 is not 3eo %o to L==P'*

    891B

    891C

    891D L==P1 M/I 2,85 Tansfe 85 T= 2 e%iste*

    891E

    891> M/I D,8 Tansfe 8 to D e%iste*

    89'0

    89'9 RET Retun to main po%am*

    89' 6T=RE M/I B,8 Tansfe 8 to B e%iste*

    89'1

    89'' 6TA B Loa$ A fom memo) lo#ationpointe$ ") BC pai*

    89'5 INR C In#ement C e%iste*

    89' RET Retun to main po%am*

    OBSERVATION:

    INPUT =UTPUT

    '500 '00 '00

    '509 '09 '09

    '50 '0 '0

    '501 '01 '01

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

  • 8/13/2019 Final Mpmc Lab Manual1

    63/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    11. BIOS;DOS CALLS DISPLA

    AIM:

    To $ispla) a messa%e on the CRT s#een of a mi#o#ompute usin% D=6 #alls*

    AL/ORITM:

    9* Initiali3e the $ata se%ment an$ the messa%e to "e$ispla)e$*

    * 6et fun#tion +alue fo $ispla)*

    1* Point to the messa%e an$ un the inteupt to $ispla) the messa%e in the CRT*

    PRO/RAM:

    A66UME C6 C=DE, D6 DATA

    DATA 6E?MENT

    M6? DB 0D2, 0A2, ?==D M=RNIN?Q , =D2, =A2, Q

    DATA END6

    C=DE 6E?MENT

    6TART M=/ A, DATA

    M=/ D6, AM=/ A2, 0K2

    M=/ D, =>>6ET M6?

    INT 92

    M=/ A2, 'C2

    INT 92

    C=DE END6

    END 6TART

    RESULT:

    A messa%e is $ispla)e$ on the CRT s#een of a mi#o#ompute usin% D=6 #alls

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 1

  • 8/13/2019 Final Mpmc Lab Manual1

    64/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    12.BIOS;DOS CALLS ILE MANIPULATION

    AIM:

    To open a file usin% D=6 #alls*

    AL/ORITM:

    9* Initiali3e the $ata se%ment, file name an$ the messa%e to "e $ispla)e$** 6et the file atti"ute to #eate a file usin% a D=6 #all*1* If the file is una"le t o #eate a file $ispla) the messa%e

    PRO/RAM:

    A66UME C6 C=DE, D6 DATA

    DATA 6E?MENT

    >ILENAME DB 6AMPLE*DATQ, Q

    M6? DB 0D2, 0A2, >ILE N=T CREATEDQ, =D2, =A2, Q

    DATA END6C=DE 6E?MENT6TART M=/ A, DATA

    M=/ D6, A

    M=/ D, =>>6ET >ILENAME

    M=/ C, 002

    M=/ A2, 1C2

    INT 92

    JNC L==P9

    M=/ A, DATA

    M=/ D6, A

    M=/ D, =>>6ET M6?

    M=/ A2, 0K2

    INT 92

    L==P9 M=/ A2, 'C2

    INT 92

    C=DE END6END 6TART

    RESULT:

    A file is opene$ usin% D=6 #alls*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '

  • 8/13/2019 Final Mpmc Lab Manual1

    65/99

  • 8/13/2019 Final Mpmc Lab Manual1

    66/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    1.8084 STRIN/ MANIPULATION SEARC A ORD

    AIM:

    To sea#h a o$ fom a stin%*

    AL/ORITM:

    9* Loa$ the sou#e an$ $estination in$e7 e%iste ith statin% an$ the en$in%

    a$$ess espe#ti+el)*

    * Initiali3e the #ounte ith the total num"e of o$s to "e #opie$*

    1* Clea the $ie#tion fla% fo auto in#ementin% mo$e of tansfe*

    '* Use the stin% manipulation instu#tion 6CA6 ith the pefi7 REP tosea#h a o$ fom stin%*

    5* If a mat#h is foun$ 39, $ispla) 09 in $estination a$$ess* =theise,

    $ispla) 00 in $estination a$$ess*

    RESULT:

    A o$ is sea#he$ an$ the #ount of num"e of appeaan#es is $ispla)e$*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

  • 8/13/2019 Final Mpmc Lab Manual1

    67/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    A66UME C6 C=DE, D6 DATA

    DATA 6E?MENT

    LI6T D 512, 952, 9K2, 02

    DE6T ESU 10002

    C=UNT ESU 052

    DATA END6

    C=DE 6E?MENT

    6TART M=/ A, DATA

    M=/ D6, A

    M=/ A, 952

    M=/ 6I, =>>6ET LI6T

    M=/ DI, DE6T

    M=/ C, C=UNT

    M=/ A, 00

    CLD

    REP 6CA6

    J: L==P

    M=/ A, 09

    L==P M=/ FDIG, A

    M=/ A2, 'C2

    INT 92

    C=DE END6

    END 6TART

    INPUT:

    LI6T 512, 952, 9K2, 02

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

  • 8/13/2019 Final Mpmc Lab Manual1

    68/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    OUTPUT:

    1000 09

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 8

  • 8/13/2019 Final Mpmc Lab Manual1

    69/99

  • 8/13/2019 Final Mpmc Lab Manual1

    70/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    A66UME C6 C=DE, D6 DATA

    DATA 6E?MENT

    LI6T D 512, 952, 9K2, 02

    REPLACE ESU 102

    C=UNT ESU 052

    DATA END6

    C=DE 6E?MENT

    6TART M=/ A, DATA

    M=/ D6, A

    M=/ A, 952

    M=/ 6I, =>>6ET LI6T

    M=/ C, C=UNT

    M=/ A, 00

    CLD

    REP 6CA6

    JN: L==P

    M=/ DI, LABEL LI6T

    M=/ FDIG, REPLACE

    L==P M=/ A2, 'C2

    INT 92

    C=DE END6

    END 6TART

    INPUT:

    LI6T 512, 952, 9K2, 02

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 0

  • 8/13/2019 Final Mpmc Lab Manual1

    71/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    OUTPUT:

    LI6T 512, 102, 9K2, 02

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 9

  • 8/13/2019 Final Mpmc Lab Manual1

    72/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    3. 8084 STRIN/ MANIPULATION COP A STRIN/

    AIM:

    To #op) a stin% of $ata o$s fom one lo#ation to the othe*

    AL/ORITM:

    * Loa$ the sou#e an$ $estination in$e7 e%iste ith statin% an$ the en$in%

    a$$ess espe#ti+el)*

    * Initiali3e the #ounte ith the total num"e of o$s to "e #opie$*

    8* Clea the $ie#tion fla% fo auto in#ementin% mo$e of tansfe*

    K* Use the stin% manipulation instu#tion M=/6 ith the pefi7 REP to

    #op) a stin% fom sou#e to $estination*

    RESULT:

    A stin% of $ata o$s is #opie$ fom one lo#ation to othe*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

  • 8/13/2019 Final Mpmc Lab Manual1

    73/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    A66UME C6 C=DE, D6 DATA

    DATA 6E?MENT

    6=URCE ESU 0002

    DE6T ESU 10002

    C=UNT ESU 052

    DATA END6

    C=DE 6E?MENT

    6TART M=/ A, DATA

    M=/ D6, A

    M=/ E6, A

    M=/ 6I, 6=URCE

    M=/ DI, DE6T

    M=/ C, C=UNT

    CLD

    REP M=/6

    M=/ A2, 'C2

    INT 92

    C=DE END6

    END 6TART

    INPUT: OUTPUT:

    000 '8 1000 '8

    009 8' 1009 8'

    00 100

    001 K0 1001 K0

    00' 9 100' 9

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 1

  • 8/13/2019 Final Mpmc Lab Manual1

    74/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    .8084 STRIN/ MANIPULATION SORTIN/

    AIM:

    To sot a %oup of $ata ")tes*

    AL/ORITM:

    Pla#e all the elements of an aa) name$ list in the #onse#uti+e

    memo) lo#ations*

    Initiali3e to #ountes D & C ith the total num"e of elements in

    the aa)*

    Do the folloin% steps until the #ounte B ea#hes 0*

    o Loa$ the fist element in the a##umulato

    o Do the folloin% steps until the #ounte C ea#hes 0*

    9* Compae the a##umulato #ontent ith the ne7t elementpesent in the ne7t memo) lo#ation* If the a##umulato#ontent is smalle %o to ne7t step otheise, sap the#ontent of a##umulato ith the #ontent of memo)lo#ation*

    * In#ement the memo) pointe to point to the ne7t element*1* De#ement the #ounte C ") 9*

    6top the e7e#ution*

    RESULT:

    A %oup of $ata ")tes ae aan%e$ in as#en$in% o$e*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ '

  • 8/13/2019 Final Mpmc Lab Manual1

    75/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    A66UME C6 C=DE, D6 DATA

    DATA 6E?MENT

    LI6T D 512, 52, 9K2, 02

    C=UNT ESU 0'2

    DATA END6

    C=DE 6E?MENT

    6TART M=/ A, DATA

    M=/ D6, A

    M=/ D, C=UNT!9

    L==P M=/ C, D

    M=/ 6I, =>>6ET LI6T

    A?AIN M=/ A, F6IG

    CMP A, F6I.G

    JC L==P9

    C2? F6I .G, A

    C2? F6IG, A

    L==P9 ADD 6I, 0

    L==P A?AIN

    DEC D

    JN: L==P

    M=/ A2, 'C2

    INT 92

    C=DE END6

    END 6TART

    INPUT:

    LI6T 512, 52, 9K2, 02

    OUTPUT:

    LI6T 02, 9K2, 52, 512

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 5

  • 8/13/2019 Final Mpmc Lab Manual1

    76/99

  • 8/13/2019 Final Mpmc Lab Manual1

    77/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM:

    ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS

    '900 6TART M/I A, K0 Initiali3e pot Aas Input an$ PotB as output*

    '909

    '90 =UT C 6en$ Mo$eContol o$'901

    '90' IN C0 Rea$ fom Pot A

    '905

    '90 =UT C Displa) the $atain pot B'90

    '908 6TA '00 6toe the $ataea$ fom Pot Ain '00

    '90K

    '90A

    '90B 2LT 6top the po%am*

    MODE1 STROBED I;O MODE:

    In this mo$e, pot A an$ pot B ae use$ as $ata pots an$ pot C is use$ as #ontolsi%nals fo sto"e$ I= $ata tansfe*

    Let us initiali3e pot A as input pot in mo$e9

    MAIN PRO/RAM:

    ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS

    '900 6TART M/I A, B' Initiali3e pot Aas Input pot inmo$e 9*

    '909

    '90 =UT C 6en$ Mo$eContol o$'901

    '90' M/I A,0K 6et the PC' "itfo INTE A

    '905

    '90 =UT C Displa) the $atain pot B

    '90

    EI

    '908 M/I A,08 Ena"le R6T5*5

    '90K

    '90A 6IM

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@

  • 8/13/2019 Final Mpmc Lab Manual1

    78/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    EI

    '90B 2LT 6top the po%am*

    ISR (I%t!rr*t S!r>i"! R#*ti%!

    ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS

    '00 6TART IN C0 Rea$ fom pot A

    '09

    '0 6TA '500 6toe in '500*

    '01

    '0'

    '05 2LT 6top the po%am*

    S*? r#$r':

    ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS

    '05E JMP '00 ?o to '00

    '05>'00

    BSR MODE (Bit S!t R!+!t #!

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 8

  • 8/13/2019 Final Mpmc Lab Manual1

    79/99

  • 8/13/2019 Final Mpmc Lab Manual1

    80/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    '90K 2LT 6top the po%am*

    RESULT:

    Thus 855 is intefa#e$ an$ its #haa#teisti#s in mo$e0,mo$e9 an$ B6R mo$e is

    stu$ie$*

    4. INTERACIN/ 8253 TIMER IT 8085

    I%t!r@'"i%$ 8253 Pr#$r''?)! I%t!r>') Ti!r ith 8085

    AIM

    To intefa#e 851 Intefa#e "oa$ to 8085 p an$ +eif) the opeation of 851in si7

    $iffeent mo$es*

    APPARATUS RE=UIRED

    8085 p 4it, 851 Intefa#e "oa$, DC e%ulate$ poe suppl), /T paallel "us,

    CR=*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 80

  • 8/13/2019 Final Mpmc Lab Manual1

    81/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    M#! 0 I%t!rr*t #% t!ri%') "#*%tThe output ill "e initiall) lo afte mo$e set opeations* Afte loa$in% the #ounte,

    the output ill "e emainin% lo hile #ountin% an$ on teminal #ount the output

    ill "e#ome hi%h, until eloa$e$ a%ain*

    Let us set the #hannel 0 in mo$e 0* Conne#t the CL( 0 to the $e"oun#e #i#uit ")#han%in% the Oumpe J1 an$ then e7e#ute the folloin% po%am*

    Pr#$r':

    Ar!++ O"#!+ L'?!) M%!#%i" O!r'%+ C#!%t+

    '900 6TART M/I A, 10 Channel 0 in mo$e 0

    '90 =UT CE 6en$ Mo$e Contol o$

    '90' M/I A, 05 L6B of #ount'90 =UT C8 ite #ount to e%iste

    '908 M/I A, 00 M6B of #ount

    '90A =UT C8 ite #ount to e%iste

    '90C 2LT

    It is o"se+e$ in CR= that the output of Channel 0 is initiall) L=* Afte %i+in% si7#lo#4 pulses, the output %oes 2I?2*

    M#! 1 Pr#$r''?)! ONE6SOT:

    Afte loa$in% the #ounte, the output ill emain lo folloin% the isin% e$%e of

    the %ate input* The output ill %o hi%h on the teminal #ount* It is eti%%ea"le hen#ethe output ill emain lo fo the full #ount, afte an) isin% e$%e of the %ate input*

    E')!:

    The folloin% po%am initiali3es #hannel 0 of 851 in Mo$e 9 an$ also initiatesti%%ein% of ?ate 0* =UT 0 %oes lo, as #lo#4 pulse afte ti%%ein% the %oes "a#4 tohi%h le+el afte 5 #lo#4 pulses* E7e#ute the po%am, %i+e #lo#4 pulses thou%h the$e"oun#e lo%i# an$ +eif) usin% CR=*

    Ar!++ O"#!+ L'?!) M%!#%i" O!r'%+ C#!%t+

    '900 6TART M/I A, 1 Channel 0 in mo$e 9

    '90 =UT CE 6en$ Mo$e Contol o$'90' M/I A, 05 L6B of #ount

    '90 =UT C8 ite #ount to e%iste

    '908 M/I A, 00 M6B of #ount

    '90A =UT C8 ite #ount to e%iste

    '90C =UT D0 Ti%%e ?ate0

    '900 2LT

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 89

  • 8/13/2019 Final Mpmc Lab Manual1

    82/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    M#! 2 R't! /!%!r't#r:

    It is a simple $i+i$e ") N #ounte* The output ill "e lo fo one peio$ of the input

    #lo#4* The peio$ fom one output pulse to the ne7t e-uals the num"e of input

    #ounts in the #ount e%iste* If the #ount e%iste is eloa$e$ "eteen output pulses

    the pesent peio$ ill not "e affe#te$ "ut the su"se-uent peio$ ill efle#t the ne

    +alue*

    E')!Usin% Mo$e , Let us $i+i$e the #lo#4 pesent at Channel 9 ") 90* Conne#t the

    CL(9 to PCL(*

    Ar!++ O"#!+ L'?!) M%!#%i" O!r'%+ C#!%t+

    '900 1E ' 6TART M/I A, ' Channel 9 in mo$e

    '90 D1 CE =UT CE 6en$ Mo$e Contol o$

    '90' 1E 0A M/I A, 0A L6B of #ount

    '90 D1 CA =UT CA ite #ount to e%iste

    '908 1E 00 M/I A, 00 M6B of #ount

    '90A D1 CA =UT CA ite #ount to e%iste

    '90C 2LT

    In CR= o"se+e simultaneousl) the input #lo#4 to #hannel 9 an$ the output at =ut9*

    M#! 3 S*'r! '>! $!%!r't#rIt is simila to Mo$e e7#ept that the output ill emain hi%h until one half of #ount

    an$ %o lo fo the othe half fo e+en num"e #ount* If the #ount is o$$, the output

    ill "e hi%h fo #ount . 9 #ounts* This mo$e is use$ of %eneatin% Bau$ ate fo

    859A U6ART*

    E')!:

    e utili3e Mo$e 0 to %eneate a s-uae a+e of fe-uen#) 950 (23 at #hannel 0*

    Ar!++ O"#!+ L'?!) M%!#%i" O!r'%+ C#!%t+

    '900 1E 1 6TART M/I A, 1 Channel 0 in mo$e 1

    '90 D1 CE =UT CE 6en$ Mo$e Contol o$

    '90' 1E 0A M/I A, 0A L6B of #ount

    '90 D1 C8 =UT C8 ite #ount to e%iste

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 8

  • 8/13/2019 Final Mpmc Lab Manual1

    83/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    '908 1E 00 M/I A, 00 M6B of #ount

    '90A D1 C8 =UT C8 ite #ount to e%iste

    '90C 2LT

    6et the Oumpe, so that the #lo#4 0 of 851 is %i+en a s-uae a+e of fe-uen#) 9*5 M23*This po%am $i+i$es this PCL( ") 90 an$ thus the output at #hannel 0 is 950 (23*

    /a) the fe-uen#) ") +a)in% the #ount* 2ee the ma7imum #ount is >>>> 2*6o, the s-uae a+e ill emain hi%h fo >>> 2 #ounts an$ emain lo fo >>> 2#ounts* Thus ith the input #lo#4 fe-uen#) of 9*5 M23, hi#h #oespon$s to a peio$of 0*0 mi#ose#on$s, the esultin% s-uae a+e has an =N time of 0*098'mi#ose#on$s an$ an =>> time of 0*098' mi#ose#on$s*

    To in#ease the time peio$ of s-uae a+e, set the Oumpes su#h that CL( of851 is #onne#te$ to =UT 0* Usin% the a"o+e!mentione$ po%am, output a s-uae a+eof fe-uen#) 950 (23 at #hannel 0* No this is the #lo#4 to #hannel *

    M#! : S#@t'r! Tri$$!r! Str#?!:The output is hi%h afte mo$e is set an$ also $uin% #ountin%* =n teminal #ount,

    the output ill %o lo fo one #lo#4 peio$ an$ "e#omes hi%h a%ain* This mo$e #an "euse$ fo inteupt %eneation*

    The folloin% po%am initiali3es #hannel of 851 in mo$e '*

    E')!:

    Conne#t =UT 0 to CL( Oumpe J9* E7e#ute the po%am an$ o"se+e theoutput =UT * Counte ill %eneate a pulse afte 9 se#on$*

    Ar!++ O"#!+ L'?!) M%!#%i" O!r'%+ C#!%t+

    '900 6TART M/I A, 1 Channel 0 in mo$e 0'90 =UT CE 6en$ Mo$e Contol o$

    '90' M/I A, 0A L6B of #ount

    '90 =UT C8 ite #ount to e%iste

    '908 M/I A, 00 M6B of #ount

    '90A =UT C8 ite #ount to e%iste

    '90C M/I A, B8 Channel in Mo$e '

    '90E =UT CE 6en$ Mo$e #ontol o$

    '990 M/I A, K8 L6B of Count

    '99 =UT CC ite Count to e%iste

    '99' M/I A, 1A M6B of Count

    '99 =UT CC ite Count to e%iste '998 2LT

    M#! 5 'r'r! tri$$!r! +tr#?!:

    Counte stats #ountin% afte isin% e$%e of ti%%e input an$ output %oes lo foone #lo#4 peio$ hen teminal #ount is ea#he$* The #ounte is eti%%ea"le*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 81

  • 8/13/2019 Final Mpmc Lab Manual1

    84/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    E7ampleThe po%am that follos initiali3es #hannel 0 in mo$e 5 an$ also ti%%es ?ate 0*Conne#t CL( 0 to $e"oun#e #i#uit*

    E7e#ute the po%am* Afte %i+in% 6i7 #lo#4 pulses, )ou #an see usin% CR=, theinitiall) 2I?2 output %oes L=* The output =UT 0 pin %oes hi%h on the ne7t #lo#4

    pulse*

    Ar!++ O"#!+ L'?!) M%!#%i" O!r'%+ C#!%t+

    '900 6TART M/I A, 9A Channel 0 in mo$e 5

    '90 =UT CE 6en$ Mo$e Contol o$

    '90' M/I A, 05 L6B of #ount

    '90 =UT C8 ite #ount to e%iste

    '908 M/I A, 00 M6B of #ount

    '90A =UT D0 Ti%%e ?ate 0

    '90C 2LT

    R!+*)t:

    Thus the 851 has "een intefa#e$ to 8085 p an$ si7 $iffeent mo$es of 851

    ha+e "een stu$ie$*

    . 8051 6 SUM O ELEMENTS IN AN ARRA

    AIM:

    To fin$ the sum of elements in an aa)*

    AL/ORITM:

    9* Loa$ the aa) in the #onse#uti+e memo) lo#ation an$

    initiali3e the memo) pointe ith the statin% a$$ess*

    * Loa$ the total num"e of elements in a sepaate e%iste as

    a #ounte*

    1* Clea the a##umulato*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 8'

  • 8/13/2019 Final Mpmc Lab Manual1

    85/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    '* Loa$ the othe e%iste ith the +alue of the memo)

    pointe*

    5* A$$ the e%iste ith the a##umulato*

    * Che#4 fo #a), if e7ist, in#ement the #a) e%iste ") 9*

    otheise, #ontinue

    * De#ement the #ounte an$ if it ea#hes 0, stop* =theise

    in#ement the memo) pointe ") 9 an$ %o to step '*

    RESULT:

    The sum of elements in an aa) is #al#ulate$*

    PRO/RAM:

    M=/ DPTR, '00

    M=/ A, DPTR

    M=/ R0, A

    M=/ B, 00

    M=/ R9, B

    INC DPTR

    L==P CLR C

    M=/ A, DPTR

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 85

  • 8/13/2019 Final Mpmc Lab Manual1

    86/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    ADD A, B

    M=/ B, A

    JNC L==P

    INC R9

    L==P INC DPTR

    DJN: R0, L==P

    M=/ DPTR, '500

    M=/ A, R9

    M=/ DPTR, A

    INC DPTR

    M=/ A, B

    M=/ DPTR, A

    2LT 6JMP 2LT

    INPUT OUTPUT:

    '00 0' '500 0>

    '09 05 '509 00

    '09 0

    '0 01

    '01 0

    10(A.8051 6 E9ADECIMAL TO DECIMAL CONVERSION

    AIM:

    To pefom he7a$e#imal to $e#imal #on+esion*

    AL/ORITM:

    9* Loa$ the num"e to "e #on+ete$ into the a##umulato*

    * If the num"e is less than 900 '2, %o to ne7t step

    otheise, su"ta#t 900 '2 epeate$l) until the emain$e is less than 900

    '2* 2a+e the #ount900 TEC2N=L=?@ 8

  • 8/13/2019 Final Mpmc Lab Manual1

    87/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    1* If the num"e is less than 90 0A2, %o to ne7t step

    otheise, su"ta#t 90 0A2 epeate$l) until the emain$e is less than 90

    0A2* 2a+e the #ountten TEC2N=L=?@ 8

  • 8/13/2019 Final Mpmc Lab Manual1

    88/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    M=/ A, B

    M=/ B, 0A

    DI/ A, B

    INC DPTR

    M=/ DPTR, A

    INC DPTR

    M=/ A, B

    M=/ DPTR, A

    2LT 6JMP 2LT

    INPUT OUTPUT:

    '500 D '509 95

    '50 0

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 88

  • 8/13/2019 Final Mpmc Lab Manual1

    89/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    10(B.8051 6 DECIMAL TO E9ADECIMAL CONVERSION

    AIM:

    To pefom $e#imal to he7a$e#imal #on+esion

    AL/ORITM:

    9* Loa$ the num"e to "e #on+ete$ in the a##umulato*

    * 6epaate the hi%he o$e $i%it fom loe o$e*

    1* Multipl) the hi%he o$e $i%it ") 90 an$ a$$ it ith the

    loe o$e $i%it*

    '* 6toe the esult in the spe#ifie$ memo) lo#ation*

    RESULT:

    The %i+en $e#imal num"e is #on+ete$ to he7a$e#imal num"e*

    PRO/RAM:

    M=/ DPTR, '500

    M=/ A, DPTR

    M=/ B, 0A

    MUL A, B

    M=/ B, AINC DPTR

    M=/ A, DPTR

    ADD A, B

    INC DPTR

    M=/ DPTR, A

    2LT 6JMP 2LT

    INPUT OUTPUT

    '500 1 '509 9

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ 8K

  • 8/13/2019 Final Mpmc Lab Manual1

    90/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    13. STEPPER MOTOR INTERACIN/ IT 8051

    AIM:

    To intefa#e a steppe moto ith 8059 mi#o#ontolle an$ opeate it*

    TEOR:

    A moto in hi#h the oto is a"le to assume onl) $is#ete stationa) an%ulaposition is a steppe moto* The ota) motion o##us in a step!ise manne fom onee-uili"ium position to the ne7t* 6teppe Motos ae use$ +e) isel) in position #ontols)stems li4e pintes, $is4 $i+es, po#ess #ontol ma#hine tools, et#*

    The "asi# to!phase steppe moto #onsists of to pais of stato poles* Ea#h ofthe fou poles has its on in$in%* The e7#itation of an) one in$in% %eneates a NothPole* A 6outh Pole %ets in$u#e$ at the $iameti#all) opposite si$e* The oto ma%neti#

    s)stem has to en$ fa#es* It is a pemanent ma%net ith one fa#e as 6outh Pole an$ theothe as Noth Pole*

    The 6teppe Moto in$in%s A9, A, B9, B ae #)#li#all) e7#ite$ ith a DC#uent to un the moto in #lo#4ise $ie#tion* B) e+esin% the phase se-uen#e as A9,B, A, B9, anti#lo#4ise steppin% #an "e o"taine$*

    !P2A6E 6ITC2IN? 6C2EMEIn this s#heme, an) to a$Oa#ent stato in$in%s ae ene%i3e$* The sit#hin%

    s#heme is shon in the ta"le %i+en "elo* This s#heme po$u#es moe to-ue*

    ANTICLOC TEC2N=L=?@ K0

  • 8/13/2019 Final Mpmc Lab Manual1

    91/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    PRO/RAM :

    Ar!++OPCODES

    Label Comments

    =R? '900h

    '900 6TART M=/ DPTR, TABLE Loa$ the stata$$ess of sit#hin%s#heme $ata TABLEinto Data PointeDPTR

    '901 M=/ R0, 0' Loa$ the #ount in R0

    '905 L==P M=/ A, DPTR Loa$ the num"e inTABLE into A

    '90 PU62 DP2 Push DPTR +alue to6ta#4'908 PU62 DPL

    '90A M=/ DPTR, 0>>C0h Loa$ the Moto pota$$ess into DPTR

    '90D M=/ DPTR, A 6en$ the +alue in Ato steppe Moto pota$$ess

    '90E M=/ R', 0>>h Dela) loop to #ausea spe#ifi# amount oftime $ela) "efoene7t $ata item is sentto the Moto

    '990 DELA@

    M=/ R5, 0>>h

    '99 DELA@9

    DJN: R5, DELA@9

    '99' DJN: R', DELA@

    '99 P=P DPL P=P "a#4 DPTR+alue fom 6ta#4'998 P=P DP2

    '99A INC DPTR In#ement DPTR topoint to ne7t item inthe ta"le

    '99B DJN: R0, L==P De#ement R0, if not3eo epeat the loop

    '99D 6JMP 6TART 6hot Oump to 6tatof the po%am toma4e the motootate #ontinuousl)

    '99> TABLE DB 0K 05 0 0Ah /alues as pe to!phase sit#hin%s#heme

    PROCEDURE:

    Ente the a"o+e po%am statin% fom lo#ation '900*an$ e7e#ute the same* Thesteppe moto otates* /a)in% the #ount at R' an$ R5 #an +a) the spee$* Entein% the$ata in the loo4!up TABLE in the e+ese o$e #an +a) $ie#tion of otation*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ K9

  • 8/13/2019 Final Mpmc Lab Manual1

    92/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    RESULT:

    Thus a steppe moto as intefa#e$ ith 8059 an$ un in foa$ an$ e+ese$ie#tions at +aious spee$s*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ K

  • 8/13/2019 Final Mpmc Lab Manual1

    93/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    8059

    8051

    9* Rea$in% an$ itin% on a paallel pot*

    9* itin% to a pot pin

    6ETB P1*5 set pin 5 of pot 1M=/ P9, 'A2 sen$in% $ata 'A2 to pot 9 ! the "ina) patten on thepot ill "e 0900 9090M=/ P, A sen$ hate+e $ata is in the a##umulato to pot

    * Rea$in% a pot pin

    6ETB P9*0 initiali3e pin 0 of pot 9 as an input pinM=/ P, >>2 set all pins of pot as inputsM=/ C, P9*0 mo+e +alue on pin 0 of pot 9 to the #a)M=/ R1, P mo+e $ata on pot into R1

    2. Timer in Different Modes

    The "asi# 8059 has to on!#hip times that #an "e use$ fo timin% $uations o fo#ountin% e7tenal e+ents Inte+al timin% allos the po%amme to pefom opeations atspe#ifi# instants in time* >o e7ample, in ou LED flashin% po%am the LED as tune$on fo a spe#ifi# len%th of time an$ then tune$ off fo a spe#ifi# len%th of time* ea#hie+e$ this thou%h the use of time $ela)s* 6in#e the mi#o#ontolle opeates at aspe#ifi# fe-uen#), e #oul$ o4 out e7a#tl) ho man) iteations of the time $ela) asnee$e$ to %i+e us the $esie$ $ela)* 2oe+e, this is #um"esome an$ pone to eo*An$ thee is anothe $isa$+anta%e the CPU is o##upie$, steppin% thou%h the loops* Ife use the on!#hip times, the CPU #oul$ "e off $oin% somethin% moe useful hile thetimes ta4e on the menial tas4 of 4eepin% ta#4 of time*

    The TimesV 6>Rs

    The 8059 has to 9!"it times* The hi%h ")te fo time 9 T29 is at a$$ess 8D2 hilethe lo ")te TL9 is at 8B2 The hi%h ")te fo time 0 T20 is at 8C2 hile the lo")te TL0 is at 8A2*Both times #an "e use$ in a num"e of $iffeent mo$es* Thepo%amme sets the times to a spe#ifi# mo$e ") loa$in% the appopiate 8!"it num"einto the Time Mo$e Re%iste TM=D hi#h is at a$$ess 8K2*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ K1

  • 8/13/2019 Final Mpmc Lab Manual1

    94/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    Time Mo$e Re%iste

    The fun#tions of the 8!"its of TM=D ae $es#i"e$ in the a"o+e ta"le* The top fou "itsae fo time 9 an$ the "ottom fou "its ha+e the e7a#t same fun#tion "ut fo time 0* The?ate "its ae use$ in #onOun#tion ith inteupts an$ ill "e $ealt ith at a late sta%e*>o the moment e #an ta4e it that "its an$ 1 ae ala)s #leae$* As mentione$ a"o+e,the times #an "e use$ fo #ountin% e7tenal e+ents o fo timin% inte+als* If )ou ish thetime to "e an e+ent #ounte )ou set the #oespon$in% CT!"a "it* 6imilal), if )ou ish

    it to "e an inte+al time )ou eset the #oespon$in% CT!"a "it* Thee ae to mo$e "itsM9 an$ M0 fo ea#h time* The ta"le "elo $es#i"es thei fun#tion

    Thee ae fou time mo$es, set ") the "its M9 an$ M0* Mo$e 0 is not #ommonl) use$*

    Mo$e 9 ! 9!"it mo$e

    The hi%h ")te T27 is #as#a$e$ ith the lo ")te TL7 to po$u#e a 9!"it time* Thistime #ounts fom 00002 to >>>>2 ! it has 9 5,51 states* An o+eflo o##us$uin% the >>>>2 to 00002 tansition, settin% the o+eflo fla% to "e $ealt ith shotl)*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ K'

  • 8/13/2019 Final Mpmc Lab Manual1

    95/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    Mo$e ! 8!"it auto!eloa$ mo$e

    The time lo ")te TL7 opeates as an 8!"it time #ountin% to >>2 hile the hi%h!")te hol$s a eloa$ +alue* hen the time o+eflos fom >>2, athe than statin% a%ainfom 002, the +alue in T27 is loa$e$ into TL7 an$ the #ount #ontinues fom thee*

    * 6eial #ommuni#ation implementationAll #ommuni#ation e ae $ealin% ith #an "e seial o paallel*In Paallel #ommuni#ation, $ata "ein% tansfee$ "eteen one lo#ation an$ anothe R0to the a##umulato, fo e7ample ta+el alon% the 8!"it $ata "us* Be#ause of this $ata "us,$ata ")tes #an "e mo+e$ a"out the mi#o#ontolle at hi%h spee$*2oe+e, paallel #ommuni#ation has the $isa$+anta%e of e-uiin% at least ei%ht sepaatelines in an 8!"it s)stem an$ in most #ases e7ta lines to s)n#honi3e the $ata tansfein the #ase of the mi#o#ontolle, the #ontol "us*6eial #ommuni#ation has the a$+anta%e of e-uiin% onl) one line fo the $ata, a se#on$line fo %oun$ an$ possi"l) a thi$ line fo the #lo#4* Theefoe, "e#ause seial#ommuni#ation e-uies less ph)si#al ies, it is moe suita"le fo tansmittin% $ata o+elon%e $istan#es*The o"+ious $isa$+anta%e of seial #ommuni#ation, #ompae$ ith paallel, is the

    e$u#tion ine #oul$ sa) it ta4es 9us to tansfe a $ata ")te usin% paallel #ommuni#ation* If eima%ine thesame timefame fo $ata "its settlin% on the seial line, it oul$ ta4e 8us to tansfe a $ata")teusin% seial #ommuni#ation 9us fo ea#h "it*

    S,%"hr#%#*+ S!ri') C#*%i"'ti#%

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ K5

  • 8/13/2019 Final Mpmc Lab Manual1

    96/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    6)n#honous seial #ommuni#ation e-uies an e7ta line fo the #lo#4 si%nal* >o seial#ommuni#ation, the 8!"it paallel $ata ")te must "e shifte$ $on the seial line intansmission*Theefoe, one "it is folloe$ ") anothe* 6ome 4in$ of s)stem must "e use$ to$etemine ho

    lon% ea#h "it is on the line* >o e7ample, the seial s)stem $esi%ne ma) $e#i$e ea#h "it ill "eon the line fo 9us an$, as e7plaine$ a"o+e, tansmission of the full ei%ht "its oul$ ta4e 8us*ith s)n#honous #ommuni#ation, the #lo#4 si%nal is tansmitte$ on a sepaate line, as shon inthe $ia%am "elo

    In this a), the e#ei+e is s)n#honi3e$ ith the tansmitte* As e shall see, the 8059 seialpot in mo$e 0 is an e7ample of s)n#honous seial #ommuni#ation*

    As)n#honous 6eial Communi#ation

    A %oo$ e7ample of as)n#honous seial #ommuni#ation is the intefa#e "eteen a 4e)"oa$ an$a #ompute* In this #ase, the 4e)"oa$ is the tansmitte an$ the #ompute is the e#ei+e* ithas)n#honous #ommuni#ation, a #lo#4 si%nal is not sent ith the $ata* Thee ae a num"e ofeasons h) this fom of #ommuni#ation mi%ht "e $esia"le o+e s)n#honous #ommuni#ation*=ne a$+anta%e is the fa#t that the ph)si#al line fo the #lo#4 is not nee$e$* Also, as)n#honous#ommuni#ation is "ette o+e lon% $istan#es* If e t) to s)n#honi3e a emote e#ei+e ")sen$in% the #lo#4 si%nal, $ue to popa%ation $ela)s an$ intefeen#e, the +ali$it) of the #lo#4 is

    lost*

    Anothe eason fo not tansmittin% the #lo#4 aises hen the $ata ate is eati#* >o e7ample,$ata ate fom a 4e)"oa$ to a #ompute is $epen$ent upon the t)pist* The use ma) t)pe at a ateof si7t) o$s pe minute, "ut at othe times heshe ma) t)pe a lot less* An$ fo lon% peio$sthee ma) "e no $ata sent at all* Be#ause of this eati# $ata ate an as)n#honous #ommuni#ations)stem is suita"le*

    6eial Communi#ation Poto#ol

    In an) #ommuni#ation s)stem, the e#ei+e must 4no hat 4in$ of $ata to e7pe#t an$ at hatate the $ata ill ai+e* In "oth s)n#honous an$ as)n#honous seial #ommuni#ation, thee#ei+e nee$s to 4no ith hi#h "it the tansmitte "e%ins* In most s)stems the L6B is the fist

    "it tansmitte$* >o an as)n#honous s)stem, the num"e of "its tansmitte$ pe se#on$ must "e4non ") the e#ei+e* 6in#e the #lo#4 si%nal is not tansmitte$, the e#ei+e nee$s to 4no hat#lo#4 fe-uen#) the tansmitte is usin% so that it #an use the same* The e#ei+e also nee$s to

    "ut e ill see #ases hee nine "its ae tansmitte$ pe o$* An$ the e#ei+e nee$s to 4nohee the $ata "e%ins an$ hee the $ata stops* All these paametes ma4e up the poto#ol* If thee#ei+e uses the same poto#ol as the tansmitte is shoul$ e#ei+e the $ata #oe#tl) althou%heos #an o##u an$ e ill loo4 at ho e #at#h these eos at a late $ate* If the e#ei+euses a poto#ol othe than the one use$ ") the tansmitte, then the to $e+i#es ae effe#ti+el)spea4in% to $iffeent lan%ua%es an$ the $ata e#ei+e$ ill "e %a"a%e*

    6tat Bits an$ 6top Bits

    In as)n#honous #ommuni#ation, at least to e7ta "its ae tansmitte$ ith the $ata o$ a stat"it an$ a stop "it* Theefoe, if the tansmitte is usin% an 8!"it s)stem, the a#tual num"e of "itsTheefoe, hen no $ata is "ein% sent the $ata line is #ontinuousl) 2I?2* The e#ei+e aits fo

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ K

  • 8/13/2019 Final Mpmc Lab Manual1

    97/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    a 9 to 0 tansition* In othe o$s, it aaits a tansition fom the stop "it no $ata to the stat "itlo%i# 0* =n#e this tansition o##us the e#ei+e 4nos a $ata ")te ill follo* 6in#e it 4nosthe $ata ate "e#ause it is $efine$ in the poto#ol it uses the same #lo#4 as fe-uen#) as thatuse$ ") the tansmitte an$ ea$s the #oe#t num"e of "its an$ stoes them in a e%iste* >oe7ample, if the poto#ol $etemines the o$ si3e as ei%ht "its, on#e the e#ei+e sees a stat "it itea$s the ne7t ei%ht "its an$ pla#es them in a "uffe* =n#e the $ata o$ has "een ea$ the

    e#ei+e #he#4s to see if the ne7t "it is a stop "it, si%nif)in% the en$ of the $ata* If the ne7t "it isnot lo%i# 9 then somethin% ent on% ith the tansmission an$ the e#ei+e $umps the $ata* Ifthe stop "it as e#ei+e$ the e#ei+e aits fo the ne7t $ata o$, ie it aits fo a 9 to 0tansition

    The 8059 6eial PotThe 8059 in#lu$es an on!#hip seial pot that #an "e po%amme$ to opeate in one of fou$iffeent mo$es an$ at a an%e of fe-uen#ies* In seial #ommuni#ation the $ata is ate is 4nonas the "au$ ate, hi#h simpl) means the num"e of "its tansmitte$ pe se#on$* In the seial potmo$es that allo +aia"le "au$ ates, this "au$ ate is set ") time 9*The 8059 seial pot is full $uple7* In othe o$s, it #an tansmit an$ e#ei+e $ata at the sametime* The "lo#4 $ia%am a"o+e shos ho this is a#hie+e$* If )ou loo4 at the memo) map )ouill noti#e at lo#ation KK2 the seial "uffe spe#ial fun#tion e%iste 6BU>* Unli4e an) othee%iste in the 8059, 6BU> is in fa#t to $istin#t e%istes ; the ite!onl) e%iste an$ the ea$!onl) e%iste* Tansmitte$ $ata is sent out fom the ite!onl) e%iste hile e#ei+e$ $ata isstoe$ in the ea$!onl) e%iste* Thee ae to sepaate $ata lines, one fo tansmission TDan$ one fo e#eption RD* Theefoe, the seial pot #an "e tansmittin% $ata $on the TDline hile it is at the same time e#ei+in% $ata on the RD line*The TD line is pin 99 of the mi#o#ontolle P1*9 hile the RD line is on pin 90 P1*0*Theefoe, e7tenal a##ess to the seial pot is a#hie+e$ ") #onne#tin% to these pins* >o e7ample,if )ou ante$ to #onne#t a 4e)"oa$ to the seial pot )ou oul$ #onne#t the tansmit line of the4e)"oa$ to pin 90 of the 8059* If )ou ante$ to #onne#t a $ispla) to the seial pot )ou oul$#onne#t the e#ei+e line of the $ispla) to pin 99 of the 8059* This is $etaile$ in the $ia%am

    "elo*

    Tansmittin% an$ Re#ei+in% Data

    Essentiall), the Oo" of the seial pot is to #han%e paallel $ata into seial $ata fo tansmissionan$ to #han%e e#ei+e$ seial $ata into paallel $ata fo use ithin the mi#o#ontolle*!6eial tansmission is #han%in% paallel $ata to seial $ata*! 6eial e#eption is #han%in% seial $ata into paallel $ata! Both ae a#hie+e$ thou%h the use of shift e%istes*

    As $is#usse$ ealie, s)n#honous #ommuni#ation e-uies the #lo#4 si%nal to "e sent alon%ith the $ata hile as)n#honous #ommuni#ation e-uies the use of stop "its an$ stat "its*2oe+e, the po%amme ishin% to use the 8059 nee$ not o) a"out su#h thin%s* Totansmit $ata alon% the seial line )ou simpl) ite to the seial "uffe an$ to a##ess $atae#ei+e$ on the seial pot )ou simpl) ea$ $ata fom the seial "uffe*

    >o e7ample

    !M=/ 6BU>, '52 ! this sen$s the ")te '52 $on the seial line!M=/ A, 6BU> ! this ta4es hate+e $ata as e#ei+e$ ") the seial pot an$ puts it inthe a##umulato*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ K

  • 8/13/2019 Final Mpmc Lab Manual1

    98/99

    ECE DEPARTMENT MP&MC LAB MANUAL

    2o $o e 4no hen the #omplete $ata ")te has "een sentHAs mentione$ ealie, it ta4es a #etain len%th of time fo a $ata ")te to "e tansmitte$ $onthe seial line $etemine$ ") the "au$ ate* If e sen$ $ata to 6BU> an$ then imme$iatel)sen$ moe $ata to 6BU>, as shon "elo, the initial #haa#te ill "e o+eitten "efoe itAs mentione$ ealie, it ta4es a #etain len%th of time fo a $ata ")te to "e tansmitte$ $onthe seial line $etemine$ ") the "au$ ate* If e sen$ $ata to 6BU> an$ then imme$iatel)

    sen$ moe $ata to 6BU>, as shon "elo, the initial #haa#te ill "e o+eitten "efoe it

    As mentione$ ealie, it ta4es a #etain len%th of time fo a $ata ")te to "e tansmitte$ $onthe seial line $etemine$ ") the "au$ ate* If e sen$ $ata to 6BU> an$ then imme$iatel)sen$ moe $ata to 6BU>, as shon "elo, the initial #haa#te ill "e o+eitten "efoe itas #ompletel) shifte$ $on the line*

    JNB RI, ait fo an entie ")te to "e e#ei+e$CLR RI the e#ei+e inteupt fla% is set ") ha$ae "ut must "e #leae$ ") softaeM=/ A, 6BU> mo+e the $ata stoe$ in the ea$!onl) "uffe to the a##umulato

    !M=/ 6BU>, 12!M=/ 6BU>, 52

    Theefoe, e must ait fo the entie ")te to "e sent "efoe e sen$ anothe* The seial pot#ontol e%iste 6C=N #ontains a "it hi#h alets us to the fa#t that a ")te has "eentansmitte$ ie the tansmit inteupt fla% TI is set ") ha$ae on#e an entie ")te has "eentansmitte$ $on the line* 6in#e 6C=N is "it!a$$essa"le e #an test this "it an$ ait until itis set, as shon "elo

    M=/ 6BU>, 12 sen$ the fist ")te $on the seial lineJNB TI, ait fo the entie ")te to "e sentCLR TI the tansmit inteupt fla% is set ") ha$ae "ut must "e #leae$ ") softaeM=/ 6BU>, 52 sen$ the se#on$ ")te $on the seial line

    2o $o e 4no hen $ata has "een e#ei+e$H

    6imilal), e nee$ to 4no hen an entie ")te has "een e#ei+e$ ") the seial pot* Anothe"it in 6C=N, the e#ei+e inteupt fla% RI is set ") ha$ae hen an entie ")te is e#ei+e$") the seial pot* The #o$e "elo shos ho )ou oul$ po%am the #ontolle to ait fo$ata to "e e#ei+e$ an$ to then mo+e that $ata into the a##umulato*

    6R INTERNATI=NAL IN6TITUTE => TEC2N=L=?@ K8

  • 8/13/2019 Final Mpmc Lab Manual1

    99/99

    ECE DEPARTMENT MP&MC LAB MANUAL