ec 6513 microprocessor and microcontroller manual

Upload: saravanantec

Post on 07-Aug-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    1/121

    MAAMALLANINSTITUTE OF TECHNOLOGY

    DEPARTMENT OFELECTRONICS ANDCOMMUNICATION

    EC – 6513

    MICROPROCESSORS & MICROCONTROLLERS

    LAB MANUAL

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    2/121

     MAAMALLAN INSTITUTE OF TECHNOLOGYVadamangaam! S"#$%"m$d"! 'an()#$"am *#+,"#(,

    EC – 6513

    MICROPROCESSORS & MICROCONTROLLERS

    LAB MANUAL

     

    Nam% -. ,)% S,d%n, / 0000000000000000000000 

    R%g#+,%" Nm%" / 0000000000000000000000  

    *%$a",m%n, 2 Y%a"2 S%(,#-n / 0000000000000000000000 

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    3/121

    Ta% -. (-n,%n,+ /S N- *a,% Nam% -. ,)% E4$%"#m%n, Pag% N- *a,% -.

    Sm#++#-n

    Ma" S#gna,"%

    A A"()#,%(,"% -. 76 & P"-g"am+

    1 Addition of Two 16 – Bit Datas.

    Subtraction of Two 16 – Bit Datas.

    8 Multiplication of Two 16 – Bit Datas.

    Division of Two 16 – Bit Datas.3 Transfer a Block of Data.

    9 Code Conversions

     Larest of !n" Datas.

    5 Addition of !n" Data.

     #actorial of Data.

    6 Matri$ Addition .

    Strin Manipulation – #ind % &eplace a Data.

    Counter and Dela' ti(e

    B MASM P"-g"am+

    1 Addition of Two 16 – Bit Datas.Subtraction of Two 16 – Bit Datas.

    8 Multiplication of Two 16 – Bit Datas.

    Division of Two 16 – Bit Datas.

    3 Transfer a Block of Data.

    9 Code Conversions

    5 )assword C*eckin

    6 Sortin of an Arra' of datas

    Searc*in an ele(ent in an Arra'

    : S+uare usin MASM

    C A"()#,%(,"% -. 751 & P"-g"am+

    1 Addition of Two , – Bit Datas.

    Subtraction of Two , – Bit Datas.

    8 Multiplication of Two , – Bit Datas.

    Division of Two , – Bit Datas.

    3 Loical -perations

    9 1s and /s Co(ple(ent

    5 Code Conversion

    * In,%".a(#ng P"-g"am+

    1 Diital Clock 

    8 Analo to Diital Convertor.

    Diital to Analo Convertor.3 Displa' 0nterface – Accept a e'.

    9 Displa' 0nterface – Displa' a Letter.

    5 Stepper Motor 0nterface.

    6 Traffic Li*t Controller.

    : )rinter Status

    )arallel 0nterface

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    4/121

    INTERNAL ARCHITECTURE OF 8086

    0ntel ,2,6 is a 16 – bit processor3 wit* powerful instruction set. 0t *as 42 pins workin intwo different (odes3 suc* as3 Ma$i(u( Mode % Mini(u( Mode. T*e ,2,6 *as )ipelined

    Arc*itecture wit* Bus 0nterface 5nit % $ecution 5nit.

    T*e ,2,67,2,, arc*itecture can be broadl' divided into two roups89i: $ecution 5nit 95:9ii: Bus 0nterface 5nit 9B05:

    T*e e$ecution unit contains t*e Data and Address reisters3 t*e Arit*(etic and Loic 5nit andt*e Control 5nit. T*e Bus 0nterface 5nit contains Bus 0nterface Loic3 Se(ent reisters3Me(or' addressin loic and a Si$ b'te instruction ob;ect code +ueue 94 < b'te instruction

    ob;ect < code +ueue in case of ,2,, (icroprocessor:.T*e e$ecution unit and t*e Bus 0nterfaceunit operate as'nc*ronousl'. T*e 5 waits for t*e instruction ob;ect code to be fetc*ed fro( t*e(e(or' b' t*e B05. T*e B05 fetc*es or pre < fetc*es t*e ob;ect code 916 < bits at a ti(e: andloads it into t*e si$ b'tes +ueue.

    =*enever t*e 5 is read' to e$ecute a new instruction3 it fetc*es t*e instruction ob;ect codefro( t*e front of t*e instruction +ueue and e$ecutes t*e instruction in specified nu(ber of clock  periods. 0f (e(or' or 0nput7output devices (ust be accessed in t*e course of e$ecutin aninstruction3 t*en t*e 5 infor(s t*e B05 of its needs. T*e B05 co(pletes its operation code9opcode: fetc* c'cle3 if in proress3 and e$ecutes an appropriate e$ternal access (ac*ine c'cle 0

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    5/121

    n response to t*e 5 de(and. T*e B05 is independent of t*e 5 and atte(pts to keep t*e si$ < b'tes +ueue filled wit* instruction ob;ect codes.0f two or (ore of t*ese si$ b'tes are e(pt'3 t*en t*e B05 e$ecutes instruction fetc* (ac*inec'cles as lon as t*e 5 does not *ave an active re+uest for t*e bus access pendin. 0f t*e 5issues a re+uest for t*e bus access w*ile t*e B05 is in t*e (iddle of an instruction fetc* (ac*inec'cle3 t*en t*e B05 will co(plete t*e instruction fetc* (ac*ine c'cle before *onor in t*e 5 bus access re+uest. T*e 5 does not use (ac*ine c'cles> it e$ecutes instructions in so(e nu(ber of clock periods t*at are not sub;ected to an' t'pe of (ac*ine c'cles. T*e onl' ti(e clock 

     periods are rouped is clock w*en t*e bus control loic wis*es to access (e(or' or 07- devices.

    $ecution 5nit 95:8

    T*e e$ecution unit consists of 

    ?eneral &eistersArit*(etic Loic 5nitControl unit#la &eisters

    ?eneral &eisters

    T*e C)5 *as ei*t 16

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    6/121

    ,2,6 7 ,2,, *as an additional pointer into t*e stack called t*e B) reister. =*ile t*e S) isused si(ilar to t*e stack pointer in ot*er (ac*ine9for pointin to subroutine and interrupt return addresses:3 t*e B) reister is used to *oldan old stack pointer value3 or it can (ark a place in t*e subroutine stack independent of t*e S) reister. 5sin t*e B) reister to (ark t*e stack saves t*e ;ulin of a sinlestack pointer to reference subroutine para(eters and addresses. S0 and D0 are bot* 16 <

     bits wide and are used b' strin (anipulation instructions and in buildin so(e of t*e(ore powerful ,2,67,2,, data structures and addressin (odes. Bot* t*e S0 and t*e D0reisters *ave auto incre(entin and auto < decre(entin capabilities.

    Arit*(etic Loic 5nit 9AL5:8

    AL5 is 16 < bits wide. 0t can do t*e followin 16 < bits arit*(etic operations9i: Addition9ii:Subtraction9iii: Multiplication9iv: Division

    T*e AL5 can also perfor( loical operations suc* as9i: -T9ii:AD9iii: -& 9iv: @CL5S0 -& 9v: TST

    #la &eister 

    T*e $ecution 5nit *as a 16 < bit fla reister w*ic* indicates so(e conditions affected b' t*e e$ecution of an instruction. So(e bits of t*e fla reister control certain operationsof t*e 5. T*e fla reister in t*e 5 contains nine active flas . Si$ of t*e nine flas areused to indicate so(e condition produced b' an instruction. T*ese condition flas arealso called status flas of ,2,67,2,, (icroprocessor. T*ese are t*e Carr' fla3 )arit'fla3 Au$iliar' carr' fla3 Eero fla3 and Sin fla. T*e ot*er t*ree Control flas are Trap#la3 Direction #la and 0nterrupt fla

    Bus 0nterface 5nit 9B05:8

    T*e B05 sends out addresses3 fetc*es instructions fro( (e(or'3 reads data fro( (e(or'and ports3 and writes data to ports and (e(or'. 0n ot*er words t*e B05 *andles alltransfers of data and addresses on t*e buses for t*e e$ecution unit. T*e B05 *as1. An instruction +ueue/. An 0nstruction pointer F. Se(ent reisters

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    7/121

    0nstruction Gueue8

    To speed up prora( e$ecution3 t*e B05 fetc*es as (an' as 6 insturction b'tes a*ead of ti(e fro( (e(or'. T*e prefetc*ed instruction b'tes are *eld for t*e 5 in a first < < first <out roup of reister called a +ueue. T*e 5 decodes an instruction or e$ecutes an

    instruction w*ic* does not re+uire t*e buses. =*en t*e 5 is read' for its ne$tinstruction3 it si(pl' reads t*e instruction fro( t*e +ueue in t*e B05. #etc*in t*e ne$tinstruction w*ile t*e current instruction e$ecutes3 is called pipelinin.

     ote8

    T*e ,2,, (icroprocessor *as onl' a 4

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    8/121

    76 P"-g"am+

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    9/121

    Expt.No:1 (A) ADDITION OF TWO 16 BIT DATA IN 8086*a,%/

     AIM/

      To add two16 bit nu(bers stored at consecutive (e(or' locations.

    ALGORITHM/

    1. ?et t*e #irst data in Accu(ulator./. Add t*e Second Data wit* t*e Accu(ulator contentF. Store t*e &esult

    FLO;CHART/

    STA&T

    ?T T #0&ST DATA DATA 0ACC5MALAT-& 

    ADD T SC-D DATA =0TACC5MALAT-& C-TT

    ST-& T &S5LT

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    10/121

    PROGRAM /

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENT

    1122 B 22 1H M- S031H22

    112F AD L-DS=

    1124 ,I CF M- B@3A@

    1126 AD L-DS=

    112J 21 CF ADD B@3A@

    112I B# /2 1H M- D031H/2

    112C ,I 1D M- KD03B@112 CC 0T F

    OBSERVATION/

    RESULT/

    0)5T -5T)5T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    11/121

    Expt.No:1 (B) SUBTRACTION OF TWO 16 BIT DATA IN 8086*a,%/

     AIM/

      To Subtract two16 bit nu(bers stored at consecutive (e(or' locations.

    ALGORITHM/

    1. ?et t*e #irst data in Accu(ulatar./. Subtract t*e Second Data wit* t*e Accu(alatar contentF. Store t*e &esult

    FLO;CHART/

    STA&T

    ?T T #0&ST DATA DATA 0ACC5MALAT-& 

    S5BT&ACT T SC-D DATA=0T ACC5MALAT-& C-TT

    ST-& T &S5LT

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    12/121

    PROGRAM /

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENT

    1122 B 22 1H M- S031H22

    112F AD L-DS=

    1124 ,I CF M- B@3A@

    1126 AD L-DS=112J 21 CF S5B B@3A@

    112I B# /2 1H M- D031H/2

    112C ,I 1D M- KD03B@

    112 CC 0T F

    OBSERVATION/

    RESULT/

    0)5T -5T)5T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    13/121

    Expt.No:(A) MULTIPLICATION OF TWO 16 BIT DATA IN 8086*a,%/

     AIM/

      To Multipl' two16 bit nu(bers stored at consecutive (e(or' locations.

    ALGORITHM/

    1. ?et t*e #irst data in Accu(ulatar.

    /. Multipl' t*e Second Data wit* t*e Accu(alatar contentF. Store t*e &esult

    FLO;CHART/

    STA&T

    ?T T #0&ST DATA DATA 0ACC5MALAT-& 

    M5LT0)L T SC-D DATA

    =0T ACC5MALAT-& C-TT

    ST-& T &S5LT

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    14/121

    PROGRAM /

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENT

    1/22 B 22 1H M- S031H22

    1/2F AD L-DS=

    1/24 ,I CF M- B@3A@

    1/26 AD L-DS=

    1/2J #J F M5L B@

    1/2I B# 2H 1H M- D031H2H

    1/2C ,I 2H M- KD03A@

    1/2 21 CF 0C D01/2# B# /2 1H 0C D0

    1/12 ,I 1D M- KD03D@

    1/1/ CC 0T F

    OBSERVATION/

    0)5T -5T)5T

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    15/121

    RESULT/

    Expt.No:(B) DI!ISION OF TWO 16 BIT DATA IN 8086*a,%/

     AIM/

      To Divide two16 bit nu(bers stored at consecutive (e(or' locations.

    ALGORITHM/

    1. ?et t*e #irst data in Accu(ulatar./. Divide t*e Second Data wit* t*e Accu(alatar contentF. Store t*e &esult

    FLO;CHART

    STA&T

    ?T T #0&ST DATA DATA 0ACC5MALAT-& 

    D00D T SC-D DATA =0TACC5MALAT-& C-TT

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    16/121

    PROGRAM /

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENTS

    1F22 BA 22 22 M- D@32222

    1F2F B, #D ## M- A@3###D

    1F26 BI 2# 22 M- C@3222#

    1F2I #J #1 D0 C@

    1F2B B# 22 1H M- D031H221F2 ,, 2H M- KD03AL

    1F12 4J 0C D0

    1F11 ,, /H M- KD03A

    1F1F 4J 0C D0

    1F14 ,I 1H M- KD03D@

    1F16 CC 0T F

    OBSERVATION/

    0)5T -5T)5T

    ST-& T &S5LT

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    17/121

    RESULT/

    Expt.No:" TRANSFER OF DATA FROM ONE LOCATIONTO D#t$: ANOTHERLOCATION

     AIM/

    To write an AL) to Transfer !n" Datas fro( one (e(or' location to anot*er. 

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    18/121

    FLO;CHART /

    STA&T

    0T0L0E MM-&)-0T& 

    0T0L0E C-5T AL5

    T&AS#& T- DS0&DL-CAT0-

    CL N CL

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    19/121

    PROGRAM /

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENT

    1222 B1 2, M- CL32,

    122/ B 22 24 M- S031422

    122H B# H2 14 M- D0314H2

    122, AC L-DSB

    122I ,, 2H M- KD03AL

    122B 4J 0C D0122C # CI DC CL

    122 JH #, PE 122,

    1212 CC 0T F

    OBSERVATION/

    0)5T -5T)5T

    ST-&

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    20/121

    RESULT/

    Expt.No:%(A) CODE CON!ERSIONS*a,%/

    =A> ASCII TO HE? CO*E/

    AIM/

     To write an AL) to e$ecute ASC00 to @ code conversion usin ,2,6

    ALGORITHM/

    1. Load t*e data in al reister./. Subtract F2 wit* al.F. 0f data is less t*an or e+ual to 16 ter(inate t*e prora(.4. lse subtract J fro( al.H. &esult in al reister.

    FLO;CHART/

      Start

    Load al wit* t*e data

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    21/121

    PROGRAM/

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENTS

    1122 B2 F1 M- AL3F1

    112/ /C F2 S5B AL3F2

    1124 FC 12 CM) AL312

    1126 J/ 24 PB 112C112, J4 2/ PE 112C

    112A /C 2J S5B AL32J

    112C CC 0T F

    OBSERVATION/

    INPUT OUTPUT

    A**RESS *ATA A**RESS *ATA

    Subtract wit* F2

    0f ALQN12

      $it

    ALNal

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    22/121

    RESULT/

    =B> HE?A *ECIMAL TO ASCII CO*E/

    AIM/

      To write an AL) to e$ecute e$a deci(al to ASC00 code conversion usin ,2,6(icroprocessor.

    ALGORITHM/

    1. Load al wit* t*e data./. 0f9alQNI: add F2.F. lse add J and F2.4. &esult in al.

    FLO;CHART/

      Start

      Load al wit* t*e data

    0f 

    ALQNI   ALNal R2JRF2  $it

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    23/121

    PRO&RAM:

    ADDRESS OPCODE MNEMONICS OPERAND

    COMMENTS

    1100 BO OA MOV AL,OA

    1102 3C 09 CMP AL,09

    1104 74 04 JZ 110A

    1106 72 02 JB 110A

    1108 04 07 ADD AL,07

    110A 04 30 ADD AL,30

    110C CC INT 3

    OBSER!ATION:

    INPUT OUTPUT

    ADDRESS DATA ADDRESS DATA

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    24/121

    RESULT:

    Expt.No:% (B) LAR&EST OF ' NUMBER IN AN ARRA* *a,%/

    AIM/

    To write an AL) to find t*e Larest of t*e data iven in an arra'.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    25/121

    PROGRAM /

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENT1222 B 22 I2 M- S03I222

    122F ,A 2C M- CL3KS0

    122H 46 0C S0

    1226 ,A 24 M- AL3KS0

    122, # CI DC CL

    122A 46 0C S0

    122B FA 24 CM) AL3KS0

    122D JF 2/ PMB 1211

    122# ,A 24 M- AL3KS0

    1211 # CI DC CL

    121F JH #H PE 122A121H B# 22 IH M- D03 IH22

    121, ,, 2H M- KD03AL

    121A CCS 0T F

    OBSERVATION/

    0)5T -5T)5T

    0SC-5T N 2O

    ST-& T LA&?ST

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    26/121

    RESULT/

    Expt.No:+(A) ADDITION OF ' 16 ,BIT DATAS IN ANARRA* 

    *a,%/

     AIM/

    To write an AL) in ,2,6 to Add !n" 16 – bit Datas stored in an Arra'.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    27/121

    PROGRAM /

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 B9 COMMENT

    1F22 M- CL3 < <

    1F2/ M- AL3221F24 M- BL321

    1F26 L--) ADD AL3BL

    1F2, 0C BL

    1F2A DC CL

    1F2C PE L--)

    1F2 M- D03/222

    1F11 M- KD03A@

    1F1F 0T F

    ?T T C-5T AL5 % CLA& ACC5MALAT-& 

    ADD T DATA =0T ACC5MALAT-& 

    C-5T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    28/121

    OBSERVATION/

    0)5T -5T )5T

    RESULT/

    Expt.No:+(B) FACTORIAL OF A DATA*a,%/ 

    AIM

    To write an AL) in ,2,6 to find t*e #actorial of t*e iven Data.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    29/121

    /. ?et 21 in t*e accu(ulator.F. &epeatedl' (ultipl' t*e data .4. Store t*e &esult.

    FLO; CHART/

    PROGRAM /

    STA&T

    ?T T DATA% AL N 21

    DATA N DATA9n: DATA9n

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    30/121

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 B9 COMMENT

    1122 M- CL3 24

    112/ M- AL321

    1124 M- BL321

    1126 L--) M5L BL

    112, 0C BL

    112A DC CL

    112C PE L--)

    112 M- D03/222

    1111 M- KD03A@

    111F 0T F

    OBSERVATION/

    RESULT/

    Expt.No:6 (A) ADDITION OF " - " MATRI-*a,%/

    AIM

    To write an AL) in ,2,6 to Add t*e Data of two F $ F (atri$.

    0)5T -5T)5T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    31/121

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    32/121

    PROGRAM /

    ?T T LMTS -# AC MAT&0@

    ADD T LMT -# AC MAT&0@

    ST-& T &S5LT

    C-5T N C-5T < 21

    0#C-5T

    N-O

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    33/121

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 B9 COMMENT

    1H22 M- CL3 2I

    1H2/ M- S03/222

    1H2H M- D03F222

    1H2, L--) M- AL3KS0

    1H2A M- BL3KD0

    1H2C ADD AL3BL

    1H2 M- KD03AL

    1H12 0C D0

    1H11 0C S0

    1H1/ DC CL

    1H14 PE L--)

    1H16 0T F

    OBSERVATION/

    0)5T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    34/121

    ALGORITHM/

    1. Load t*e source and destination inde$ reister wit* startin and t*e endin

    address respectivel'.

    /. 0nitialie t*e counter wit* t*e total nu(ber of words to be copied.

    F. Clear t*e direction fla for auto incre(entin (ode of transfer.4. 5se t*e strin (anipulation instruction SCAS= wit* t*e prefi$ &) to searc*

    a word fro( strin.

    H. 0f a (atc* is found 9N1:3 replace t*e old word wit* t*e current word in

    destination address. -t*erwise3 stop.

    PROGRAM/

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    35/121

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 B9 COMMENT

    M- A@3DATA

    M- DS3 A@

    M- A@31H

    M- S03 -##ST

    M- C@3 C-5T

    M- A@3 22

    CLD

    &)LAC SCAS=

    PE L--)

    M- D03 LABL

    M- KD03&)LAC

    L--) M- A34C

    0T /1

    OBSERVATION/

    0)5T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    36/121

      To write an AL) for password c*eckin.

    ALGORITHM/

    1.0nitialie t*e Me(or' )ointer.

    /.Store t*e &e+uired password as our wis*.

    F.nter t*e )assword

    4.0# t*e entered )assword (atc*es wit* t*e Stored )assword t*en t*e =elco(e screen

    appears on Displa'

    H.-t*ers wise !=ron )assword" is displa'ed on t*e Screen.

    FLO;@*IAGRAM8

     

    STA& T

    0nitialie t*e Me(or' )ointer Store 'our )assword in a specificMe(or Address ie.1H22nter t*e )assword

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    37/121

    PROCE*URE/

    STEP/ 1

    0#

    Matc*es

    LCD displa's =ron

    LCD displa's Correct

     o

    es

    nters into =elco(e Screen

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    38/121

    Download t*e *e$ file w*ic* is iven cd.STEP/ 8

    Set 4 diit password in address of 1H22

    STEP/ 3

    To open welco(e screen ive 4 diit correct password in address of 1J22

    STEP/ 9

    0f password (atc* (eans welco(e screen will displa' in lcd.-t*erwise reenter password in address of1J22

    OUTPUT/

      Set password and user iven password (atc*ed and enter into welco(e screen in lcddispla'.

    PROGRAM/

    A**RESS OPCO*ES MNEMONICS COMMENTS

    1222 , 1, 21 CALL 111B >Call t*e LCD initialiation

    122F BH 26 M- C326 >0nitialie t*e reister !C"

    122H B1 26 M- CL326 >0nitialie t*e reister !CL"

    122J BB 22 1H M- B@3 1H22 >Load t*e )assword in t*e Address 1H22

    122A , 22 22 CALL 122D >Call t*e loop

    122D ,A 2J M- AL3KB@ >Move t*e value fro( t*e B@ reister to AL

    122# 4F 0C B@ >0ncre(ent B@ reister b' 1

    1212 # CI DC CL >Decre(ent CL b' 1

    121/ JH #I P 122D >Continue until t*e CL reister not e+ual to ero

    1214 BB 22 1H M- B@3 1H22 >Aain (ove t*e address 1H22 to B@

    121J B 22 1J M- S03 1J22 >eed anot*er address to enter t*e )assword

    121A , 22 22 CALL 121D >Call t*e e$t loop

    121D ,A 24 M- AL3KS0

    121# FA 2J CM) AL3KB@ >Co(pare eac* c*aracter wit* t*e stored )assword

    12/1 JH J P 12A1 >Pu(p to wron loop if t*e c*aracter in B@(atc*es wit* S0

    12/F 4F 0C B@ >0ncre(ent B@

    12/4 46 0C S0 >0ncre(ent S0

    12/H # CD DC C >Decre(ent C

    12/J JH #4 P 121D >Continue until t*e C reister not e+ual to ero

    12/I , 22 22 CALL 12/C

    12/C BA /2 ## M- D@3##/2 >C*oosin )-&T A of ,/HH

    12/# B2 2C M- AL32C >Displa' - and cursor -##

    12F1 -5T D@3AL

    12F/ , 1I 21 CALL 114 >Call LCD enable

    12FH B2 4F M- AL34F >ASC00 value of c*ar C is 4F*

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    39/121

    12FJ -5T D@3AL

    12F, , /F 21 CALL 11H >Call LCD data line

    12FB B2 4# M- AL34# >ASC00 value of c*ar - is 4#*

    12FD -5T D@3AL

    12F , 1D 21 CALL 11H >Call LCD data line

    1241 B2H/ M- AL3H/ >ASC00 value of c*ar & is H/*

    124F -5T D@3AL1244 , 1J 21 CALL 11H >Call LCD data line

    124J B2 H/ M- AL3H/ >ASC00 value of c*ar & is H/*

    124I -5T D@3AL

    124A , 11 21 CALL 11H >Call LCD data line

    124D B2 4H M- AL34H >ASC00 value of c*ar is 4H*

    124# -5T D@3AL

    12H2 , 2B 21 CALL 11H >Call LCD data line

    12HF B2 4F M- AL34F >ASC00 value of c*ar C is 4F*

    12HH -5T D@3AL

    12H6 , 2H 21 CALL 11H >Call LCD data line

    12HI B2 H4 M- AL3H4 >ASC00 value of c*ar T is H4*

    12HB -5T D@3AL

    12HC , ## 22 CALL 11H >Call LCD data line

    12H# , ,2 22 CALL 12/

    126/ B2 21 M- AL321 >Clear LCD

    1264 -5T D@3AL

    126H , 6 22 CALL 114 Call LCD enable line

    126, B2 ,4 M- AL3,4 >C*aracters start to print fro( 4t* colu(n of t*efirst row

    126A -5T D@3AL

    126B , 2 22 CALL 114 Call LCD enable line

    126 B2 2C M- AL32C >LCD displa' - and cursor -##

    12J2 -5T D@3AL

    12J1 , DA 22 CALL 114 Call LCD enable line

    12J4 B2 HJ M- AL3HJ >ASC00 value of c*ar = is HJ*

    12J6 -5T D@3AL

    12JJ , 4 22 CALL 11H >Call LCD data line

    12JA B2 4H M- AL34H >ASC00 value of c*ar is 4H*

    12JC -5T D@3AL

    12JD , D 22 CALL 11H >Call LCD data line

    12,2 B2 4C M- AL34C >ASC00 value of c*ar L is 4C*

    12,/ -5T D@3AL

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    40/121

    12,F , D, 22 CALL 11H >Call LCD data line

    12,6 B2 4F M- AL34F >ASC00 value of c*ar C is 4F*

    12,, -5T D@3AL

    12,I , D/ 22 CALL 11H >Call LCD data line

    12,C B2 4# M- AL34# >ASC00 value of c*ar - is 4#*

    12, -5T D@3AL

    12,# , CC 22 CALL 11H >Call LCD data line

    12I/ B2 4D M- AL34D >ASC00 value of c*ar M is 4D*

    12I4 -5T D@3AL

    12IH , C6 22 CALL 11H >Call LCD data line

    12I, B2 4H M- AL34H >ASC00 value of c*ar is 4H*

    12IA -5T D@3AL

    12IB , C2 22 CALL 11H >Call LCD data line

    12I , C1 ## CALL 126/

    12A1 B2 ,1 M- AL3,1 >C*aracters start to print fro( t*e /nd colu(n oft*e first row

    12AF -5T D@3AL

    12A4 , AJ 22 CALL 114 Call LCD enable line

    12AJ B2 2C M- AL32C >LCD displa' - and cursor -##

    12AI -5T D@3AL

    12AA , A1 22 CALL 114 Call LCD enable line

    12AD B2 HJ M- AL3HJ >ASC00 value of c*ar = is HJ*

    12A# -5T D@3AL

    12B2 , AB 22 CALL 11H >Call LCD data line12BF B2 H/ M- AL3H/ >ASC00 value of c*ar & is H/*

    12BH -5T D@3AL

    12B6 , AH 22 CALL 11H >Call LCD data line

    12BI B2 4# M- AL34# >ASC00 value of c*ar - is 4#*

    12BB -5T D@3AL

    12BC , I# 22 CALL 11H >Call LCD data line

    12B# B2 4 M- AL34 >ASC00 value of c*ar is 4*

    12C1 -5T D@3AL12C/ , II 22 CALL 11H >Call LCD data line

    12CH B2 4J M- AL34J >ASC00 value of c*ar ? is 4J*

    12CJ -5T D@3AL

    12C, , IF 22 CALL 11H >Call LCD data line

    12CB , 14 22 CALL 12/

    12C , ID 22 CALL 116 >Call t*e dela' function

    12D1 , IA 22 CALL 116 >Call t*e dela' function

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    41/121

    12D4 , IJ 22 CALL 116 >Call t*e dela' function

    12DJ , I4 22 CALL 116 >Call t*e dela' function

    12DA , I1 22 CALL 116 >Call t*e dela' function

    12DD , , 22 CALL 116 >Call t*e dela' function

    122 CD /1 0T /1

    12/ BA /2 ## M- D@3##/2 >C*oosin )-&T A of ,/HH

    12H B2 CJ M- AL3CJ >C*aracters start to print fro( t*e Jt* colu(n of t*e/nd row

    12J -5T D@3AL

    12, , 6F 22 CALL 114

    12B B2 H2 M- AL3H2 >ASC00 value of c*ar ) is H2*

    12D -5T D@3AL

    12 , 6D 22 CALL 11H >Call LCD data line

    12#1 B2 41 M- AL341 >ASC00 value of c*ar A is 41*

    12#F -5T D@3AL

    12#4 , 6J 22 CALL 11H >Call LCD data line

    12#J B2 HF M- AL3HF >ASC00 value of c*ar S is HF*

    12#I -5T D@3AL

    12#A , 61 22 CALL 11H >Call LCD data line

    12#D B2 HF M- AL3HF >ASC00 value of c*ar S is HF*

    12## -5T D@3AL

    1122 , HB 22 CALL 11H >Call LCD data line

    112F B2 HJ M- AL3HJ >ASC00 value of c*ar = is HJ*

    112H -5T D@3AL1126 , HH 22 CALL 11H >Call LCD data line

    112I B2 4# M- AL34# >ASC00 value of c*ar - is 4#*

    112B -5T D@3AL

    112C , 4# 22 CALL 11H >Call LCD data line

    112# B2 H/ M- AL3H/ >ASC00 value of c*ar & is H/*

    1111 -5T D@3AL

    111/ , 4I 22 CALL 11H >Call LCD data line

    111H B2 44 M- AL344 >ASC00 value of c*ar D is 44*111J -5T D@3AL

    111, , 4F 22 CALL 11H >Call LCD data line

    111B B4 22 M- A322

    111D BA /6 ## M- D@3##/6

    11/2 B2 ,2 M- AL3,2 >C*aracters start to print fro( t*e first colu(n oft*e first row

    11// -5T D@3AL

    11/F BA /2 ## M- D@3##/2 >,/HH )-&T A DATAB0TS

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    42/121

    11/6 B2 F, M- AL3F, >#unction set

    11/, -5T D@3AL

    11/I , // 22 CALL 114

    11/C B2 F, M- AL3F, >#unction set

    11/ -5T D@3AL

    11/# , 1C 22 CALL 114

    11F/ B2 F, M- AL3F, >#unction set

    11F4 -5T D@3AL

    11FH , 16 22 CALL 114

    11F, B2 2# M- AL32# >Displa' -7-##

    11FA -5T D@3AL

    11FB , 12 22 CALL 114

    11F B2 26 M- AL326 >ntr' (ode

    1142 -5T D@3AL

    1141 , 2A 22 CALL 1141144 B2 21 M- AL321 >Clear screen

    1146 -5T D@3AL

    114J , 24 22 CALL 114

    114A , 21 22 CALL 114

    114D CF &T

    114 BA // ## M- D@3##// >C*oosin t*e )-&TB of ,/HH

    11H1 B2 24 M- AL324

    11HF -5T D@3AL

    11H4 B2 22 M- AL322

    11H6 -5T D@3AL

    11HJ , 14 22 CALL 116

    11HA BA /2 ## M- D@3##/2

    11HD CF &T

    11H BA // ## M- D@3##// >C*oosin t*e )-&TB of ,/HH

    1161 B2 2H M- AL32H

    116F -5T D@3AL

    1164 B2 22 M- AL322

    1166 -5T D@3AL

    116J , 24 22 CALL 116

    116A BA /2 ## M- D@3##/2

    116D CF &T

    116 HF )5S B@ >Store t*e alues in Stack  

    116# BB ## ## M- B@3#### >Load t*e Dela' value 2####* in B@ reister  

    11J/ 4B DC B@ >Decre(ent B@ reister  

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    43/121

    11JF JH #D P 11J/ >Pu(p to D1 until B@ is not e+ual to Eero

    11JH HB )-) B@ >?et t*e value fro( Stack  

    11J6 CF &T >&eturns t*e value

    E4$,N-/ COUNTERS AN* TIME *ELAY

    *a,%/

    AIM/

      To write an AL) for Counter and Ti(e Dela' usin ,2,6 Microprocessor.

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    44/121

    ALGORITHM/

    1 nter t*e prora( into t*e kit.

    8 Connect t*e PLC' and CL'7 t*rou* a wire connector.

    3  ow see t*e output wave for( on t*e OUT7. 

    PROGRAM/

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENTS

    1222 B2 F6 M- AL3F6

    122/ BA H6 ## M- D@3##H6

    122H -5T D@3AL

    1226 B2 J, M- AL3J,

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    45/121

    122, BA H2 ## M- D@3##H2

    122B -5T D@3AL

    122C B2 22 M- AL322

    122 -5T D@3AL

    122# CC 0T F

    RESULT/

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    46/121

    MASAM @ PROGRAMS

    Expt.No:1 (A) ADDITION OF TWO 16 BIT DATA IN 8086 /MASAM

    *a,%/

    AIM/

      To Add two16 bit nu(bers and to store t*e result usin MASAM.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    47/121

    16@BIT A**ITION/

    .(odel.s(all

    .data

    .codeStart8 or 222*  (ov a$326*  (ov b$32H*

    add a$3b$int F

    nd

    OBSERVATION /

    RESULT

    Expt.No:1(B) SUBTRACTIONOF TWO 16 BIT DATA IN 8086/ MASAM

     *a,%/

     AIM/

      To Subtract two16 bit nu(bers and to store t*e result usin MASAM..

    0)5T8 DATA1

    DATA /

    -5T)5T8

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    48/121

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    49/121

    Expt.No:(A) MULTIPLICATION OF TWO 16 BIT DATA USIN&MASAM

    *a,%/

    AIM/

      To Multipl' two16 bit nu(bers and to store t*e result usin MASAM..

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    50/121

    RESULT/

    Expt.No:(B) DI!ISION OF TWO 16 BIT DATA USIN& MASM*a,%/

     AIM/

      To Divide two16 bit nu(bers and to store t*e result usin MASM..

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    51/121

    RESULT

    Expt.No:" LO&ICAL OPERATIONS USIN& MASM*a,%/

    AIM/

      To perfor( Loical -perations and store t*e result usin MASM.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    52/121

    OUTPUT/

    OR OPERATION/

    .(odel.s(all

    .data

    .codeStart8or 222*

    (ov al32/*(ov bl324*or al3blint F

    nd

    OUTPUT/

    NOT OPERATION/

    .(odel.s(all

    .data

    .codeStart8or 222*

    (ov al321*not alint F

    nd

    OUTPUT/

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    53/121

    RESULT/

    Expt.No:% BLOC2 TRANSFER WITHOUT O!ERLAPUSIN& MASAM

    *A,%/

    AIM/

      To Transfer !n" 16 bit arra' fro( one location to anot*er usin MASAM..

    PROGRAM/.MODEL SMALL .DATAArray1 D 1111!,2222!,3333!,4444!,""""!Array2 D " D#P $0%C&'() D 000"*.CODEMOV A+,DATAMOV DS,A+LEA SI,Array1LEA DI,Array2MOV C+,C&'()NE+T- MOV A+,SI/MOV DI/,A+INC SIINC SIINC DIINC DILOOP NE+TMOV A*,4C!INT 21!END

    0)5T -5T)5T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    54/121

    RESULT

    Expt.No:+ PASSWORD CHE2IN& USIN& MASAM*a,%/

    AIM/

    To =rite an AL) to erif' t*e )assword usin MASAM S-.,a"% R%#"%d/

    1. )c wit* windows 9IH7I,7@)7T7/222:

    /. MASM S-#T=A&

    P"-g"am/

    ASS5M CS8C-D3DS8DATA3S8@T&ADATA S?MTST&0?1 DB M&CTST&L G5 9

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    55/121

    C-D DSD STA&T

    RESULT

    Expt.o:6(A) ASCENDIN& 3 DECENDIN& ORDER USIN& MASAM*a,%/

    AIM/

      To Sort !n" 16 bit arra' in Ascendin 7 Descendin -rder usin MASAM..

    A$$a"a,+ R%#"%d/

    1. )c wit* windows 9IH7I,7@)7T7/222:

    /. MASM S-#T=A&

    P"-g"am/ASS5M CS8C-D3DS8DATADATA S?MTA&&A DB 2H2232F2232221322243222/C-5T DB 2HDATA DSC-D S?MTSTA&T8 M- A@3DATAM- DS3A@

    S5B A@3A@M- D@3C-5T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    56/121

    RESULT

    E4$,N-/6=B> SEARCHING USING MASM

    *a,%/

    AIM/ 

    To searc* an ele(ent in an arra' usin MASM.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    57/121

    RESULT/

    Expt.No:4 S5UARE USIN& MASM*a,%/

    AIM/

      To perfor( s+uare operation usin MASM.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    58/121

      LCALL 22BB*end

    0)5T -5T)5T

    RESULT/

    INTERNAL ARCHITECTURE OF 80+1

    The Intel MCS-51 (commonly referred to as 8051) is a Harvard

    architecture CISCinstruction set sin!le chi" microcontroller  (#C) series $hich $as

    develo"ed %y Intelin 1&80 for use in em%edded systems

    http://en.wikipedia.org/wiki/Harvard_architecturehttp://en.wikipedia.org/wiki/Harvard_architecturehttp://en.wikipedia.org/wiki/Complex_instruction_set_computinghttp://en.wikipedia.org/wiki/Instruction_sethttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Intelhttp://en.wikipedia.org/wiki/Embedded_systemhttp://en.wikipedia.org/wiki/Harvard_architecturehttp://en.wikipedia.org/wiki/Harvard_architecturehttp://en.wikipedia.org/wiki/Complex_instruction_set_computinghttp://en.wikipedia.org/wiki/Instruction_sethttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Intelhttp://en.wikipedia.org/wiki/Embedded_system

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    59/121

    Important features and applications 

    The 8051 architecture "rovides many functions (C' *M +M I,+ interru"t lo!ic timer 

    etc) in a sin!le "ac.a!e.

    • 8-%it */ and *ccumulator  8-%it e!isters (one 1-%it re!ister $ith s"ecial move

    instructions) 8-%it data %us and 21-%it address %us,"ro!ram counter ,data "ointer  and

    related 8,11,1-%it o"erations3 hence it is mainly an 8-%it microcontroller 

    • 4oolean "rocessor $ith 1 instructions 1-%it accumulator 6 re!isters (7 %it-

    addressa%le 8-%it) and u" to 177 s"ecial 1 %it-addressa%le *M varia%les (18 %it-

    addressa%le 8-%it)

    • Multi"ly divide and com"are instructions

    • 7 fast s$itcha%le re!ister %an.s $ith 8 re!isters each (memory ma""ed)

    • ast interru"t $ith o"tional re!ister %an. s$itchin!

    • Interru"ts and threads $ith selecta%le "riority

    • 9ual 1-%it address %us : It can access ;   memory locations : 7

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    60/121

    Memory architecture

    The MCS-51 has four distinct ty"es of memory : internal *M s"ecial function re!isters

    "ro!ram memory and e;ternal data memory

    Internal *M (I*M) is located from address 0 to address 0; I*M from 0;00 to 0;

    can %e accessed directly I*M from 0;80 to 0; must %e accessed indirectly usin! the

    E0 or E1 synta; $ith the address to access loaded in 0 or 1 The 18 %its at I*Mlocations 0;0:0; are %it-addressa%le

    S"ecial function re!isters (S) are located in the same address s"ace as I*M at

    addresses 0;80 to 0; and are accessed directly usin! the same instructions as for the

    lo$er half of I*M They cannot  %e accessed indirectly via E0 or E1 1 of the Ss

    are also %it-addressa%le

    'ro!ram memory ('M=M thou!h less common in usa!e than I*M and ?*M) is u" to

    7

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    61/121

    Registers

    The only re!ister on an 8051 that is not memory-ma""ed is the 1-%it "ro!ram counter 'C

    This s"ecifies the address of the ne;t instruction to e;ecute elative %ranch instructions

    su""ly an 8-%it si!ned offset $hich is added to the 'C

    8 !eneral-"ur"ose re!isters 0: may %e accessed $ith instructions 1 %yte shorter than

    others They are ma""ed to I*M %et$een 0;00 and 0;1 +nly 8 %ytes of that ran!e areused at any !iven time determined %y the t$o %an. select %its in the 'SD

    The follo$in! re!isters are memory-ma""ed into the s"ecial function re!ister s"ace

    • (0;81) Stac. "ointer S' This is an 8-%it re!ister used %y su%routine call and return

    instructions The stac. !ro$s u"$ard3 the S' is incremented %efore "ushin! and

    decremented after "o""in! a value

    • (0;8:86) 9ata "ointer 9' This is a 1-%it re!ister that is used for accessin! 'M=M

    and ?*M• (0;90) 'ro!ram status $ord 'SD This contains im"ortant status fla!s

    • 'SD0 ' 'arity ives the "arity (modulo- sum of the %its of) the most recent */

    result• 'SD1 9 ser 9efined or !eneral soft$are use not other$ise used %y hard$are

    • 'SD +F +verflo$ fla! Set $hen addition "roduces a si!ned overflo$

    • 'SD6 S0 e!ister select 0 The lo$-order %it of the re!ister %an. Set $hen %an.s

    at 0;08 or 0;18 are in use• 'SD7 S1 e!ister select 1 The hi!h-order %it of the re!ister %an. Set

    $hen %an.s at 0;10 or 0;18 are in use• 'SD5 0 la! 0 or !eneral soft$are use not other$ise used %y hard$are

    'SD *C au;iliary carry Set $hen addition "roduces a carry from %it 6 to %it 7

    • 'SD C Carry %it

    • (0;=0) *ccumulator * This re!ister is used %y most instructions

    • (0;0) 4 re!ister This is used as an e;tension to the accumulator for multi"ly and

    divide instructions

    5 sin!le %its are directly addressa%le These are the 1 I*M locations from 0;0:0;

    and the 1 s"ecial function re!isters 0;80 0;88 0;&0 J0;8 *ny %it of these %ytes may%e directly accessed %y a variety of lo!ical o"erations and conditional %ranches

    >ote that the 'SD does not contain the common > (ne!ative) and K (Aero) fla!s Instead

    %ecause the accumulator is a %it-addressa%le S it is "ossi%le to %ranch on its most

    si!nificant %it directly There is also an instruction to Lum" if the accumulator is Aero or non-

    Aero

    http://en.wikipedia.org/wiki/Overflow_flaghttp://en.wikipedia.org/wiki/Adjust_flaghttp://en.wikipedia.org/wiki/Carry_bithttp://en.wikipedia.org/wiki/Overflow_flaghttp://en.wikipedia.org/wiki/Adjust_flaghttp://en.wikipedia.org/wiki/Carry_bit

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    62/121

    751 @ PROGRAMS

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    63/121

    E4$,N-/1=A> A**ITION OF T;O –BIT *ATA IN 751

    *a,%/

    AIM8

    To write an AL) in ,2H1 to Add two , –bit Data.

    ALGORITHIMS8

    1. 0nitialie t*e Data )ointer.

    /. ?et t*e data to be added in (icrocontroller.

    F. Add t*e data and store t*e su(.

    4. C*eck for t*e carr' and store t*e carr' also.

    FLO; CHART/

     STA&T

    0T0AL0E DATA )-0T& 

    ?T T DATAS T- B ADDD

    ADD T DATAS

    ST-& T S5M

    ST-& CA&&

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    64/121

    PROGRAM/

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENT

    4122 M- D)T&3VI222

    412F M-@ A3 WD)T&  

    4124 M- &23A412H 0C D)T&  

    4126 M-@ A3 WD)T&  

    412J ADD A3 &2

    412, 0C D)T&  

    412I M-@ WD)T&3A

    412A M- A3V 22

    412C ADDC A3 V22

    412 0C D)T&  

    412# M-@ WD)T&3 A

    4112 LCALL 22BB

    OBSERVATION/

    0)5T -5T)5T

    RESULT/

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    65/121

    E4$,N-/1=B> SUBRACTION OF T;O –BIT *ATA IN 751

    *a,%/

    AIM8

    To write an AL) in ,2H1 to Add two , –bit Data.

    ALGORITHIMS/

    1. 0nitialie t*e Data )ointer.

    /. ?et t*e data to be added in (icrocontroller.

    F. subtract t*e data and store t*e su(.

    4. C*eck for t*e carr' and store t*e carr' also.

    FLO; CHART/

    STA&T

    0T0AL0E DATA )-0T& 

    ?T T DATAS T- B S5BT&ACTD

    S5BT&ACT T DATAS

    ST-& T D0##&C

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    66/121

    PROGRAM /

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENT

    4122 M- D)T&3VI222

    412F M-@ A3 WD)T&  

    4124 M- &23A

    412H 0C D)T&  4126 M-@ A3 WD)T&  

    412J S5B A3 &2

    412, 0C D)T&  

    412I M-@ WD)T&3A

    4112 LCALL 22BB

    OBSERVATION/

    RESULT/

    0)5T -5T)5T

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    67/121

    E4$,N-/8=A> MULTIPLICATION OF T;O –BIT *ATA IN 751

    *a,%/

    AIM8

    To write an AL) in ,2H1 to Multipl' two , –bit Data.

    ALGORITHIMS/

    1. 0nitialie t*e Data )ointer.

    /. ?et t*e data to be (ultiplied in (icrocontroller.F. Multipl' two datas and store t*e +uotient and re(ainder.

    4. C*eck for t*e carr' and store t*e carr'.

    FLO; CHART/

     STA&T

    0T0AL0E DATA )-0T& 

    ?T T DATAS T- B M5LT0)L0D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    68/121

    PROGRAM/

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENT

    4122 M- D)T&3VI222

    412F M-@ A3 WD)T&  

    4124 M- #23A

    4126 0C D)T&  

    412J M-@ A3 WD)T&  

    412, M5L AB

    412I 0C D)T&  412A M-@ WD)T&3A

    412B 0C D)T&  

    412C M- A3#-

    412 M-@ WD)T&3A

    411# LCALL 22BB

    M5LT0)L T DATAS

    ST-& T)&-D5CT

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    69/121

    OBSERVATION/

    0)5T -5T)5T

    RESULT/

    E4$,N-/8=B> *IVISION OF T;O –BIT *ATA IN 751

    *a,%/

    AIM8

    To write an AL) in ,2H1 to Divide two , –bit Data.

    ALGORITHIMS/

    1. 0nitialie t*e Data )ointer.

    /. ?et t*e data to be divided in (icrocontroller.

    F. Divide t*e data and store t*e Guotient.

    4. Store t*e &e(ainder also.

    FLO; CHART/

     STA&T

    0T0AL0E DATA )-0T& 

    ?T T DATAS T- B D00DD

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    70/121

    PROGRAM/

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENT

    4122 M- D)T&3VI222

    412F M-@ A3 WD)T&  

    4124 M- #23A

    4126 0C D)T&  

    412J M-@ A3 WD)T&  

    412, D0 AB

    412I 0C D)T&  

    412A M-@ WD)T&3A

    412B 0C D)T&  

    412C M- A3#-

    412 M-@ WD)T&3A

    411# LCALL 22BB

    D00D T DATAS

    ST-& T G5-T0T %

    &MA0D& 

    D

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    71/121

    OBSERVATION/

    0)5T -5T)5T

    RESULT/

    E4$,N-/3 LOGICAL OPERATIONS OF 751

    *a,%/

    AIM/

     To write an AL) for loical operations usin ,2H1 Microcontroller.

    ALGORITHIMS/

    1. 0nitialie t*e &eister A and &eister B.

    /. ?et t*e datas for perfor(in loical operations in (icrocontroller.

    F. )erfor( AD3-& and @

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    72/121

    AN* PROGRAM/

    A**RESS MNEMONICS OPERAN* COMMENTS

    I222 M- A3V2/

    I221 M- B3V24

    I22/ AL AB

    I22F LCALL 22BB

    OBSERVATION/

    INPUT OUTPUT

    A**RESS *ATA A**RESS *ATA

    OR PROGRAM/

    A**RESS MNEMONICS OPERAN* COMMENTS

    I222 M- A3V2/

    I221 M- B3V24

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    73/121

    I22/ -&L A3B

    I22F LCALL 22BB

    OBSERVATION/

    INPUT OUTPUT

    A**RESS *ATA A**RESS *ATA

    E?@OR/

    A**RESS MNEMONICS OPERAN* COMMENTS

    I222 M- A3V2/

    I221 M- B3V24

    I22/ @&L A3B

    I22F LCALL 22BB

    OBSERVATION/

    INPUT OUTPUT

    A**RESS *ATA A**RESS *ATA

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    74/121

    RESULT/

    E4$,N-/9 1+ AN* 8+ COMPLEMENT

    *a,%/

    =A>1+ COMPLEMENT/

    AIM/

      To write an AL) for 1s co(ple(ent usin ,2H1 Microcontroller.

    ALGORITHIM/

    1. 0nitialie t*e Accu(alator.

    /. ?et t*e data to be 1s co(ple(ented in (icrocontroller.

    F. Co(ple(ent t*e data in t*e Accu(alator.

    4. Store t*e result in t*e Accu(alator .

    PROGRAM/

    A**RESS MNEMONICS OPERAN* COMMENTS

    I222 M- A3V2/

    I221 C)L A

    I22/ LCALL 22BB

    OUTPUT/

    INPUT OUTPUT

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    75/121

    A**RESS *ATA A**RESS *ATA

    =B>8+ COMPLEMENT/

    AIM/

      To write an AL) /s co(ple(ent usin ,2H1 Microcontroller. 

    ALGORITHIMS/

    1. 0nitialie t*e Data )ointer.

    /. ?et t*e data.

    F. Co(ple(ent t*e Accu(ulator and add 21.

    4. Store t*e result in t*e Accu(ulator.

    PROGRAM/

    *ATA

    A**RESS MNEMONICS OPERAN* COMMENTSI222 M- D)T&3VIH22

    I221 M- A3WD)T&  

    I22/ C)L A

    I22F ADD A3V21

    I224 M- D)T&3VIH22

    I22H M-@ WD)T&3A

    I226 LCALL 22BB

    OUTPUT/

    INPUT OUTPUT

    A**RESS *ATA A**RESS *ATA

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    76/121

    RESULT/

    5 CO*E CONVERSION

    ASCII TO HE?A *ECIMAL CONVERSION/

    A IM/

    To perfor( ASC00 to *e$adeci(al conversion.

    ALGORITHM/

    1. Load t*e data in al reister./. Subtract F2 wit* al.F. 0f data is less t*an or e+ual to 16 ter(inate t*e prora(.

    4. lse subtract J fro( al.H. &esult in al reister.

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    77/121

    PROGRAM/

    A**RESS MNEMONICS OPERAN* COMMENTS

    I222 M- D)T&3VIH22

    I22F CL& C

    I224 M-@ A3WD)T&  

    I22H S5BB A3VF2

    I22J M- &13A

    I22, S5BB A3V2A

    I22A PC I211

    I22C CL& C

    I22D M- A3&1

    I22 S5BB A3V2J

    I212 M- &13A

    I211 M- A3&1

    I21/ LCALL 22BB

    OBSERVATION

    INPUT OUTPUT

    A**RESS *ATA A**RESS *ATA

    RESULT/

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    78/121

    INTERFACING

    PROGRAMS

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    79/121

    E4$,N-/1 *IGITAL CLOC' 

    *a,%/

    AIM/ 

    To write an AL) for Diital Clock.

    ALGORITHM/

     1.Load t*e data rs3Mins and Sec in Different Me(or' &eisters./.0nitialie r 3Min and Sec.F.0C Seconds until HI.0f it is reater t*an HI t*en t*e Minute starts incre(ented b' 1 and

    t*e Seconds are initialied to Eero.4.0f (inute is reater t*an HI3t*en t*e *our starts incre(ented b' 1 and t*e Minutes and

    Seconds are initialied to Eero.H.=*en t*e *our is reater t*an 1/3 t*en t*e Seconds and Minutes are initialied to Eero. And

    t*en t*e our is initialied to -ne.6. Aain t*e clock starts fro(

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    80/121

    FLO; CHART/

     

    0nitialie t*e Me(or' )ointers for r3Min and Sec

    STA&T

      Load t*e data in t*ree Me(or'&e isters

      0nitialie r 

      0nitialie Min

      0nc Sec

    0f SecQNHI

    0nc Min

      0nitialie Sec

    0f MinQNHI

      0nc r 

    0f r QN

    1/

    Y%+N-

    N- Y%+

       L  -  -  $

      +   ,  a  "   ,  +

      a  g  a   #  n

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    81/121

    PROGRAM/

    A**RESS

    OPCO*ES

     

    MNEMONICS

      COMMENTS

      7777 E B8 77 CALL 77B5 Ca ,)% LC* #n#,#a#Da,#-n

      7773 37 37 ?OR

    B?SI!*H

    *%(a"#ng ,)% a"#a%+ #n B,%+

      7775 37 37 ?OR

    B?SI!*H

      777: 31 B3 77

    B:

    ?OR

    BP*IB:77

      777B 77 B1 77

    B5

    A**

    B?*IB577

      777F 77 BA 87FF

    A**BPSIFF87

      7713 B7 7C MOV AL!7C M-% ,)% )%4 a% 7C) ,- an A((m .-" ,)%

    C"+%" O.. and *#+$a ON #n LC*

      7715 EE OUT *?!AL And O,$,2S%nd ,)% A((m a% #n ,-

    LC*

      7716 E CF 77 CALL 77E Ca ,)% LC* C-mmand Ena% #n#,#a#Da,#-n

      771J BE 77 15 MOV SI! 1577 *%.#n% ,)% #n#,#a Add"%++ .-" g%,,#ng ,)%

    a%+

      771C AC LO*SB L-ad ,)% 1+,  d#g#, -. an H" a% #n ,- an

    A((m

      771* 8E A8 75 MOV

    7775!AL

    M-% ,)% H" a% ."-m an A((m ,- a"3

      7781 AC LO*SB L-ad ,)% 8nd  d#g#, -. an H" a% #n ,- an

    A((m

      7788 A E7 MOV AH!AL M-% ,)% H" a% ."-m an A((m ,- AH

      7789 AC LO*SB L-ad ,)% n% a% #n ,- an A((m

      7785 8E A8 76 MOV

    7776!AL

    M-% ,)% a% ."-m an A((m ,- a"9

      778J AC LO*SB L-ad ,)% n% Va% #n ,- an A((m

      778A 8E A8 73 MOV

    7773!AL

    M-% ,)% a% ."-m an A((m ,- a" 1

      778E AC LO*SB L-ad ,)% 1+, d#g#, -. M#n,%+ #n ,- an A((m

      778F A E MOV CH!AL M-%2S,-"% ,)% a% ."-m an A((m ,- ,)%

    R%g#+,%" CH

      7731 AC LO*SB L-ad ,)% 8nd d#g#, -. M#n,%+ #n ,- an A((m

      7738 A F MOV BH!AL M-%2S,-"% ,)% a% ."-m an A((m ,- ,)%

    R%g#+,%" BH

    N- Y%+

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    82/121

      7739 AC LO*SB L-ad ,)% 1+, d#g#, -. S%(-nd+ #n ,- an A((m

      7735 A C MOV CL!AL M-%2S,-"% ,)% a% ."-m an A((m ,- ,)%

    R%g#+,%" CL

      773: AC LO*SB L-ad ,)% 8nd d#g#, -. S%(-nd+ #n ,- an A((m

      773 A * MOV BL!AL M-%2S,-"% ,)% a% ."-m A((m ,- ,)%

    R%g#+,%" BL

      773A EB 1J KMP 7755 Km$ ,- --$1 #. ,)% (-nd#,#-n #+ %#a%n, ,-

    %"-

    773C J7 NOP

      773* 8E C6 76

    75

    MOV

    B7775!37

    In#,#a#D% a"3=#%a"3 7 .-" ,)% )%4 a%

    37) >

      7793 8E A7 75 MOV AL!7775 M-%2S,-"% ,)% a% -. ,)% a"#a% ,- an

    A((m

      779: B9 31 MOV AH!31 In#,#a#D% ,)% R%g#+,%" AH 1= #% ,)% )%4 a%

    -. 31)>

      779J 8E C6 76

    73

    MOV

    B7773!31

    In#,#a#D% ,)% R%g#+,%" AH 1= #% ,)% )%4 a%

    -. 31)>

      779F B5 37 MOV CH!37 In#,#a#D% ,)% R%g#+,%" CH 7= #%,)% )%4 a%-. 37) >

      7751 B: 37 MOV BH!37 In#,#a#D% ,)% R%g#+,%" BH 7= #%,)% )%4 a%

    -. 37)>

      7753 B1 37 MOV CL!37 In#,#a#D% ,)% R%g#+,%" CL 7= #%,)% )%4 a%

    -. 37)>

      7755 E B7 77 CALL 717 Ca ,)% $a", +%(,#-n

      775 B3 37 MOV BL!37 In#,#a#D% ,)% R%g#+,%" BL 7= #%,)% )%4 a%

    -. 37)>

      775A A C3 MOV AL!BL M-%2S,-"% ,)% a% -. ,)% a"#a% ."-m ,)%

    R%g#+,%" BL ,- an A((m  775C EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-",+ -. LC*

      775* E J 77 CALL 77F Ca ,)% LC* *a,a Ena% #n#,#a#Da,#-n

      7767 E A5 77 CALL 717 Ca ,)% $a", +%(,#-n

      7763 FE C3 INC BL In("%m%n, ,)% R%g#+,%" BL 1

      7765 A C3 MOV AL!BL M-%2S,-"% ,)% a% -. ,)% a"#a% ."-m ,)%

    R%g#+,%" BL ,- an A((m

      776: EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-",+ -. LC*  776 E * 77 CALL 77F Ca ,)% LC* *a,a Ena% #n#,#a#Da,#-n

      776B 7 FB 3J CMP BL!3J C-m$a"% ,)% a% 3J #,) ,)% R%g#+,%" BL

      776E :5 F7 KNE 7767 Km$ ,- --$8 )%n #, #+ n-, %a ,- %"-

      77:7 FE C1 INC CL In("%m%n, ,)% R%g#+,%" CL 1

      77:8 7 FJ 36 CMP CL!36 C-m$a"% ,)% a% 36 #,) ,)% R%g#+,%" CL

      77:5 :5 *E KNE 7755 Km$ ,- --$ 1 )%n ,)% "%g#+,%" CL d-%+ n-,

    ma,() #,) 36

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    83/121

      77:: FE C: INC BH In("%m%n, ,)% R%g#+,%" BH 1

      77:J 7 FF 3A CMP BH!3A C-m$a"% ,)% a% 3A #,) ,)% R%g#+,%" BH

      77:C :5 *5 KNE 7753 Km$ ,- --$ 3 )%n ,)% "%g#+,%" BH d-%+ n-,

    ma,() #,) 3A

      77:E FE C5 INC CH In("%m%n, ,)% R%g#+,%" CH 1

      777 7 F* 36 CMP CH!36 C-m$a"% ,)% a% 36) #,) ,)% R%g#+,%" CH

      773 :5 CC KNE 7751 Km$ ,- --$ 9 )%n ,)% "%g#+,%" BH d-%+ n-,

    ma,() #,) 36

      775 8E FE 76

    73

    INC B7773

      77A FE C9 INC AH In("%m%n, ,)% R%g#+,%" AH 1

      77C 8E 7 3E

    73

    CMP

    B7773!3J

      77J8 :6 BB KBE 779F Km$ ,- --$5 )%n ,)% a% -. ,)% a"#a%

    %- -" %a ,- 3J)

      77J9 8E C6 76

    75

    MOV

    B7775!31  77JA 8E A 86

    76

    MOV AH!

    7776

      77JF 8E FE 76

    76

    INC B7776 In("%m%n, ,)% a% -. ,)% a"#a% a"9 1

      77A9 8E 7 3E

    76

    CMP

    B7776!33

    C-m$a"% ,)% a% 33) #,) ,)% a% -. ,)%

    a"#a% a"9

      77AA :6 A3 KBE 779F Km$ ,- --$5 )%n ,)% a% -. ,)% a"#a%

    %- -" %a ,- 3J)

      77AC 8E C6 76

    77

    MOV

    B7777!77

      77B8 76 PUSH ES

      77B3 J CC MOV SP!C?

      77B5 B9 77 MOV AH!77

      77B: BA 86 FF MOV *?!FF86 C-n,"- $-", -. 855

      77BA B7 7 MOV AL!7 S,a",#ng L-(a,#-n -. LC*

      77BC EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-",+ -. LC*

      77B* *9 *B 79

      77BE 87 FF AN* BH!BH

      77C7 B7 3 MOV AL!3 F-" ()--+#ng 1648 LC*

      77C8 EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      77C3 E 73 77 CALL 77CJ Ca ,)% LC* C-mmand Ena% #n#,#a#Da,#-n

      77C6 B7 3 MOV AL!3 F-" ()--+#ng 1648 LC*

      77C EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    84/121

    *a,a $-", -. LC*

      77CJ E 1C 77 CALL 77E

      77CC B7 3 MOV AL!3 F-" ()--+#ng 1648 LC*

      77CE EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      77CF E 16 77 CALL 77E Ca ,)% LC* C-mmand Ena% #n#,#a#Da,#-n

      77*8 B7 7F MOV AL!7F 7F C-mmand .-" ,)% *#+$a ON and C"+%"

    #n#ng

      77*9 EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      77*5 E 17 77 CALL 77E O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      77* B7 76 MOV AL!76 76 .-" ,)% En," m-d% -. LC*

      77*A EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      77*B E 7A 77 CALL 77E Ca ,)% LC* C-mmand Ena% #n#,#a#Da,#-n

      77*E B7 71 MOV AL!71 C-mmand .-" (%a"#ng ,)% LC* d#+$a

      77E7 EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      77E1 E 79 77 CALL 77E Ca ,)% LC* C-mmand Ena% #n#,#a#Da,#-n

      77E9 E 71 77 CALL 77E Ca ,)% LC* C-mmand Ena% #n#,#a#Da,#-n

      77E: C3 RET R%,"n ."-m P"-(%d"% -" Fn(,#-n

      77E BA 88 FF MOV *?!FF88 C)--+#ng ,)% PORTB -. 855

      77EB B7 79 MOV AL!79

      77E* EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      77EE B7 77 MOV AL!77

      77F7 EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      77F1 E 9J 77 CALL 713*

      77F9 BA 87 FF MOV *?!FF87 C)--+#ng ,)% PORTA -. 855

      77F: C3 RET R%,"n ."-m P"-(%d"% -" Fn(,#-n

      77F BA 88 FF MOV *?!FF88 C)--+#ng ,)% PORTB -. 855

      77FB B7 75 MOV AL!75

      77F* EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      77FE B7 77 MOV AL!77

      7177 EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    LC* *a,a

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    85/121

      7171 E 3J 77 CALL 713*

      7179 BA 87 FF MOV *?!FF87 C)--+#ng ,)% PORTA -. 855

      717: C3 RET R%,"n ."-m P"-(%d"% -" Fn(,#-n

      717 BA 87 FF MOV *?!FF87

      717B B7 C7 MOV AL!C7 C-mmand .-" ()--+#ng ,)% 8nd R- -. LC*

      717* EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%*a,a $-", -. LC*

      717E E *: FF CALL 77E Ca ,)% LC* C-mmand #n#,#a#Da,#-n

      7111 8E A7 75 MOV AL!7775 M-%2S,-"% ,)% a% -. ,)% a"#a% a"3 #n ,-

    an A((m

      7115 EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      7116 E *F FF CALL 77F Ca ,)% LC* *a,a m-d% #n#,#a#Da,#-n

      711J A C9 MOV AL!AH M-% ,)% a% -. ,)% R%g#+,%" AH #n ,- an

    A((m

      711B EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      711C E *J FF CALL 77F Ca ,)% LC* *a,a m-d% #n#,#a#Da,#-n

      711F B7 3A MOV AL!3A T)% ()a"a(,%" -. ,)% ASCII a% 3A #+

    /=(--n>

      7181 EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      7188 E *3 FF CALL 77F Ca ,)% LC* *a,a m-d% #n#,#a#Da,#-n

      7185 A C5 MOV AL!CH M-%2S,-"% ,)% a% -. ,)% R%g#+,%" CH #n,-

    an A((m  718: EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      718 E C* FF CALL 77F Ca ,)% LC* *a,a m-d% #n#,#a#Da,#-n

      718B A C: MOV AL!BH M-%2S,-"% ,)% a% -. ,)% R%g#+,%" BH #n,-

    an A((m

      718* EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      718E E C: FF CALL 77F Ca ,)% LC* *a,a m-d% #n#,#a#Da,#-n

      7131 B7 3A MOV AL!3A T)% ()a"a(,%" -. ,)% ASCII a% 3A #+

    /=(--n>  7133 EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      7139 E C1 FF CALL 77F Ca ,)% LC* *a,a m-d% #n#,#a#Da,#-n

      713: A C1 MOV AL!CL M-%2S,-"% ,)% a% -. ,)% R%g#+,%" CL #n,-

    an A((m

      713J EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g) ,)%

    *a,a $-", -. LC*

      713A E BB FF CALL 77F Ca ,)% LC* *a,a m-d% #n#,#a#Da,#-n

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    86/121

      713* 53 PUSH B?

      713E BB FF 3F MOV B?!3FFF L-ad ,)% a% ,- ,)% R%g B? .-" +%,,#ng ,)%

    *%a

      7191 9B *EC B? *%("%m%n, ,)% R%g#+,%" B? 1

      7198 :5 F* KNE 7191 Km$ ,- *1 --$ )%n ,)% a% -. B? d-%+

    n-, ma,() #,) ,)% a% 5FFF

      7199 5B POP B?

      7195 C3 RET R%,"n ."-m P"-(%d"% -" Fn(,#-n

    E4am$% 8 1

    INPUT 8F-" ,)% (-( %- 17

     1577 

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    87/121

    E4am$% / 8

    INPUT /

    F-" ,)% (-( A-% 17

    1577 

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    88/121

    To =rite an AL) to 0nterface,2,6 )rocessor wit* t*e Ana-g ,- *#g#,a

    C-n%",-" =A*C> 0nterface Board.

    s

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    89/121

    PROGRAM/

    OBSERVATION/

    ST-)

    C-#0?5& T )-&TS

    ?T T AAL-? DATA

    @C5T T )&-?&AM

    ?T T D0?0TAL -5T)5T

    ?T T C-5T

    DC&MT T C-5T

    E& - O

    &T5&

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    90/121

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENT

    /22 M- D@3 ##H6

    M- AL3 I2

    -5T D@3 AL

    M- D@3 ##H4

    M- AL3 ##

    -5T D@3 AL

    M- AL3 ##

    -5T D@3 AL

    CALL )?M

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    91/121

    P"-g"am =B>/

    AIM/

    To =rite an AL) to 0nterface,2,6 )rocessor wit* t*e *#g#,a ,- Ana-g

    C-n%",-" =*AC> 0nterface Board.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    92/121

    PROGRAM/

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENT

    F222 M- D@3 ##H6 Move Central &e

    M- AL3 ,2 Control =or

    -5T D@3AL

    M- D@3 ##H/

    M- AL3 22

    -5T D@3AL -ut in )ort B

    F22C 0T F

    OBSERVATION/

    S. - D0?0TAL AL5

    9volts:

    AAL-? AL5

    9volts:

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    93/121

    RESULT /

    E4$,N-/ 3 *ISPLAY INTERFACE PROGRAM USING 8:J

    *a,%/ ACCEPTING A 'EY

    AIM/

    To =rite an AL) to 0nterface,2,6 )rocessor wit* t*e ,/JI 0nterface Board to Accept a

    e'.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    94/121

    FLO; CHART/

    STA&T

    L-AD T MM-& L-CAT0-

    0T0T0L0E C-T&-L =-&D &?ST& 

    D0S)L T DATA

    O

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    95/121

    PROGRAM/

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENT

    M- AL31/

    M- D@3##H/

    -5T D@3AL

    M- AL3F

    -5T D@3AL

    M- AL3A2

    -5T D@3AL

    L--) 0 AL3D@

    AD AL32J

    P L--)

    M- D@3##H2

    0 AL3D@

    AD AL3F#

    0T F

    ST-)

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    96/121

    OUTPUT/

    RESULT/

    E4$,N-/9   *ISPLAY INTERFACE PROGRAM USING 8:J*a,%/  *ISPLAY A LETTER 

    AIM/

    To =rite an AL) to 0nterface,2,6 )rocessor wit* t*e ,/JI 0nterface Board to Displa' a

    C*aracter.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    97/121

    FLO; CHART/

    STA&T

    L-AD T C-5T AL5

    ?T C-T&-L =-&D &?ST& 

    STA&T

    L-AD T AL5 0 C % B &?.

    DC&MT C < &?

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    98/121

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENT

    M- AL3 1/

    M- D@3 ##H/

    -5T D@3 ALM- A3 AL

    L--) 1 -5T D@3 AL

    M- A3 AL

    -5T D@3 AL

    M- A3 2B

    M- D@3 ##H2

    M- AL3 22

    -5T D@3 AL

    DC A

    CALL DLA

    DC&MT T C-5T& 

    0#E&- O

    CC

    E&-O

    DC&MT B – &?.

    CC

    E&-O

    &T5& T- MA0 )?M

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    99/121

    PE L--) 1

    M- D@3 ##H2

    M- CL3 26

    M- B@3 /222

    M- A@3 KB@

    L--) / -5T D@3 AL

    0C B@

    DC CL

    PE L--) /

    0T F

    PROGRAM/

    OUTPUT /

    a b c d e f * e$a

    +uivalent

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    100/121

    RESULT/

    E4$,N-/5 PROGRAM TO INTERFACE STEPPER MOTOR 

    *a,%/

    AIM/

    To =rite an AL) to 0nterface,2,6 )rocessor wit* t*e S,%$$%" M-,-" 0nterface Board to

    rotate in #orward % Backward Directions and to Control its Speed.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    101/121

    1.,2,6Trainer it

    /. Stepper Motor 0nterface Board.

    F. Stepper Motor.

    4. )ower Card.

    ALGORITHM/

    1. Start t*e prora(.

    /. Call &otate forward.

    F. Call Dela' )rora(.

    4. Call &otate Backward.

    H. Call Dela' )rora(.

    6. &epeat t*e steps.

    FLO;CHART/

    STA&T

    0T0L0E

    CALL &-TAT

    STA&T

    ?T ST-) C-5T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    102/121

    PROGRAM /

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENT

    M- D@3 ##/6

    M- AL3 ,2

    -5T D@3 AL

    M- D@3 ##/2

    &-TAT M- AL3 ,2

    CALL DLA

    CALL &-TAT

    CALL DLA

    DC&MT

    E&-O

    &T5&

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    103/121

    -5T D@3 AL

    CALL DLA

    M- AL3 C-

    -5T D@3 AL

    CALL DLA

    M- AL3 2

    -5T D@3 AL

    CALL DLA

    M- AL3 A2

    -5T D@3 AL

    CALL DLA

    PM) &-TAT

    DLA M- B@3 2212

    M- A@3 22##

     -)

     -)

     -)

    TABULATION /

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    104/121

    CLOC';ISE ANTICLOC';ISE

    RESULT/

    E4$,N-/6 PROGRAM TO INTERFACE TRAFFIC LIGHT

    *a,%/ CONTROLLER

    AIM/

    To =rite an AL) to 0nterface Traffic Li*t Controller usin ,2,6.

    APPARATUS RE

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    105/121

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENTJ577 MOV *?! FF86

    M- AL3 ,1

    IH2H L--) -5T D@3 AL

    M- D@3 ##/2

    M- AL3 CC

    -5T D@3 AL

    M- D@3 ##//

    M- AL3 11

    -5T D@3 AL

    CALL IH44 CALL DLA

    M- D@3 ##/2M- AL3 AA

    -5T D@3 AL

    M- D@3 ##//

    M- AL3 AA

    -5T D@3 AL

    CALL IHHH CALL DLA

    M- D@3 ##/2

    M- AL3 11

    -5T D@3 AL

    M- D@3 ##//M- AL3 CC

    -5T D@3 AL

    CALL IH44 CALL DLA

    M- D@3 ##/2

    M- AL3 AA

    -5T D@3 AL

    M- D@3 ##//

    M- AL3 AA

    -5T D@3 AL

    CALL IHHH CALL DLA

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    106/121

    PM) IH2H

    PROGRAM/

    A**RESS LABEL MNEMONICS OPERAN* B1 B8 B3 COMMENT

    IH44 DLA 1 M- B@3 22##

    L--) 1 M- AL3 ##

    L--) / -)

     -)

     -)

     -)

    DC AL

    PE IH4I P5M) L--)

    DC B@

    PE IH4J P5M) L--)

    IHH4 &T

    IHHH DLA / M- B@3 1222

    L--) F M- AL3 ##

    L--) 4 -)

     -)

     -) -)

    DC AL

    PE IHHA P5M) L--)

    DC B@

    PE IHH, P5M) L--)

    IH6H &T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    107/121

    OUTPUT /

    INPUT OUTPUT

    RESULT/

    E4$,N-/: : PRINTER INTERFACING THROUGH 855

    *a,%/

    AIM/  To write an AL) for )rinter 0nterfacin t*rou* ,/HH.

    ALGORITHM 8

    1. 0nitialie t*e )ointer to (e(or' for data and t*e result./. Load t*e data in al reister fro( t*e (e(or'.F. Co(pare t*e value of an accu(ulator wit* t*e value !2D".4.

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    108/121

    FLO; @*IAGRAM 8

     

    Startssssssss

    ssSSSTA&T

      0nitialie t*e Me(or' pointer 

      Load t*e c*aracters in t*eAccu(ulator

    if al NN2D

    Send t*e c*aracter to printer t*rou* ,/HH ports

    N-

    Aga#n

    N-Y%+

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    109/121

    PROGRAM /

     @0T

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    110/121

    OBSERVATION/

     

    A**RESS

     

    OPCO*ES

     

    MNEMONICS

     

    COMMENTS

      7777 BA 86 FF MOV

    *?!FF86

    In#,#a#D% 855 add"%++

      7773 B7 8 MOV AL!8 C-n,#n-+ -"d .-" $-", & ( -$

      7775 EE OUT *?!AL O,$,2S%nd ,)% a% -. AL ,)"-g)

    ,)% *a,a $-",+ -. 855  7776 BE 77 1 MOV SI! 177 S,a",#ng add"%++ .-" m%++ag% +,"#ng

      777J B7 7: MOV AL!7: +,"-% )#g) a, - and )#g)

      777B BA 89 FF MOV

    *?!FF89

    C)--+#ng P-", C

      777E EE OUT *?!AL O,$, ,)% a% -. AL ,)"-g) P-",

    C -. 855

      777F E 7A 77 CALL 771C Ca -n% ()a"a(,%"

      7718 A 79 MOV AL!SI P, ,- AL

      7719 3C 7* CMP AL!7* C-m$a"% ,)% ()a"a(,%" #,) 7*

     

    7716 :5 71 KNE 771J

    Km$ ,- a --$ ,- $"#n, ,)% ()a"a(,%" #.

    AL d-%+n, ma,() #,) 7*;)%n ,)%

    a% -. AL ma,()%+ #,) 7* ,)%n --$

    g%,+ ,%"m#na,%d

      771 CC INT3 S,-$+ $"#n,#ng

      771J 96 INC SI In("%m%n, ,)% +-"(% #nd%4 .-" g%,,#ng

    ,)% n%4, ()a"

      771A EB F3 KMP 777F Aga#n #, g-%+ ,- ,)% --$ .-" g%,,#ng

    an-,)%" ()a"a(,%"

      771C BA 88 FF MOV

    *?!FF88

    C)--+#ng P-", B

      771F EC IN AL!*? F-" g%,,#ng $"#n,%" +,a,+  7787 *7 C ROR AL! 1 g%, ,- #,+ ,- "#g), ,- g%, $-",

    +,a,+=+>

      7788 *7 C ROR AL! 1 g%, ,- #,+ ,- "#g), ,- g%, $-",

    +,a,+=+>

      7789 :8 F6 KB 771C a#, #. +

      7786 A 79 MOV AL!SI g%, ()a" ."-m m%++ag% +,"#ng

      778 BA 87 FF MOV

    *?!FF87

    $, ,)% da,a ,- $"#n,%"

      778B EE OUT *?!AL -,$, ,)% a% -. AL ,- $"#n,%"

      778C B7 79 MOV AL!79 ma% +,"-% - ,- #nd#(a,%

      778E BA 89 FF MOV*?!FF89

    ,% #+ -ad%d

      7731 EE OUT *?!AL

      7738 J7 NOP ;a#, .-" .% +%(-nd+=#%d%a>

      7733 J7 NOP

      7739 B7 75 MOV AL!75 +,"-% a( ,- )#g)

      7736 EE OUT *?!AL

      773: C3 RET R%,"n ."-m P"-(%d"% -" Fn(,#-n

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    111/121

    INPUT8   nter t*e datas in t*e consecutive location startin fro( 1,22.

    177  8 41* 9Ascii value of c*aracter !A":171 8 4/* 9 !B":178  8 4F* 9 !C" :173  8 44* 9 !*":

    179  8 4H* 9 !E":175 8 46* 9 !F" :176  8 4J* 9 !G":17:  8 4,* 9 !H":17  8 4I* 9 !I" :17J  8 2D*

    OUTPUT 8   )rinter can print like t*is.

    ABC*EFGHI

    RESULT/

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    112/121

    E4$,N-/ PARALLEL INTERFACE

    *a,%/

    AIM/

     To write an AL) for )arallel 0nterface usin ,2,6 Microprocessor.

    ALGORITHM/

    1. Start t*e )rora(./. Call for t*e prora(.F. &epeat t*e steps.

     

    PROGRAM FOR 76/

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    113/121

    RECEIVER PROGRAM/

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENTS

    I222 BA /6 ## M- D@3##/6

    I22F B2 IB M- AL3IB

    I22H -5T D@3AL

    I226 BA /4 ## M- D@3##/4

    I22I C 0 AL3D@

    I22A ,, C1 M- CL3AL

    I22C BA // ## M- D@3##//

    I22# C 0 AL3D@

    I212 ,, CF M- BL3AL

    I21/ BA /2 ## M- D@3##/2

    I21H C 0 AL3D@

    I216 CC 0T F

    TRANSMITTER PROGRAM/

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENTS

    I122 BA /6 ## M- D@3

    I12F B2 ,2 M- AL3 ,2

    I12H -5T D@3 AL

    I126 , 1C 22 CALL I1/H

    I12I BA /2 ## M- D@3

    I12C B2 ## M- AL3 ##I12 -5T D@3 AL

    I12# , 1F 22 CALL I1/H

    I11/ BA // ## M- D@3

    I11H B2 // M- AL3 //

    I11J -5T D@3 AL

    I11, , 2A 22 CALL I1/H

    I11B BA /4 ## M- D@3

    I11 B2 FF M- AL3 FF

    I1/2 -5T D@3 AL

    I1/1 , 21 22 CALL I1/H

    I1/4 CC 0T F

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    114/121

    *ELAY/

    A**RESS OPCO*E MNEMONICS OPERAN* COMMENTS

    I1/H BI ## 22 M- C@3##

    I1/, I2 LOOP1/ -)

    I1/I I2 -)

    I1/A I2 -)

    I1/B I2 -)

    I1/C 4I DC C@I1/D JH #I PE LOOP1

    I1/# CF &T

    OUTPUT/

    RESULT/

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    115/121

    INTRO*UCTION TO MASM

    E*ITOR

    An editor is a prora(3 w*ic* allows 'ou to create a file containin t*e asse(bl' lanuae

    state(ents for 'our prora(. As 'ou t'pe in 'our prora(3 t*e editor stores t*e ASC00 codes for 

    t*e letters and nu(bers in successive &AM locations. =*en 'ou *ave t'ped in all of 'our  prora(s3 'ou t*en save t*e file on a flopp' of *ard disk. T*is file is called source file. T*e ne$t

    step is to process t*e source file wit* an asse(bler. 0n t*e MASM 7TASM asse(bler3 'ou s*ould

    ive 'our source file na(e t*e e$tension3 .ASM

    ASSEMBLER

    An asse(bler prora( is used to translate t*e asse(bl' lanuae (ne(onics for instructions to

    t*e correspondin binar' codes. =*en 'ou run t*e asse(bler3 it reads t*e source file of 'our 

     prora( t*e disk3 w*ere 'ou saved it after editin on t*e first pass t*rou* t*e source prora(

    t*e asse(bler deter(ines t*e displace(ent of na(ed data ite(s3 t*e offset of labels and pails t*is

    infor(ation in a s'(bol table. -n t*e second pass t*rou* t*e source prora(3 t*e asse(bler 

     produces t*e binar' code for eac* instruction and inserts t*e offset etc t*at is calculated durin

    t*e first pass. T*e asse(bler enerates two files on flopp' or *ard disk. T*e first file called t*e

    ob;ect file is iven t*e e$tension. -BP. T*e ob;ect file contains t*e binar' codes for t*e

    instructions and infor(ation about t*e addresses of t*e instructions. T*e second file enerated b'

    t*e asse(bler is called asse(bler list file. T*e list file contains 'our asse(bl' lanuae

    state(ents3 t*e binar' codes for eac* instructions and t*e offset for eac* instruction. 0n

    MASM7TASM asse(bler3 MASM7TASM source file na(e ASM is used to asse(ble t*e file.

    dit source file na(e LST is used to view t*e list file3 w*ic* is enerated3 w*en 'ou asse(ble

    t*e file.

    LIN'ER

    A linker is a prora( used to ;oin several ob;ect files into one lare ob;ect file and convert to an

    %4% file. T*e linker produces a link file3 w*ic* contains t*e binar' codes for all t*e co(bined

    (odules. T*e linker *owever doesn t assin absolute addresses to t*e prora(3 it assins is said‟

    to be reloadable because it can be put an'w*ere in (e(or' to be run. 0n MASM7TASM3

    L07TL0 source filena(e is used to link t*e file.

    *EBUGGER

    A debuer is a prora( w*ic* allows 'ou to load 'our ob;ect code prora( into s'ste(

    (e(or'3 e$ecute t*e prora( and troubles*oot are debu it t*e debuer allows 'ou to look at

    t*e contents of reisters and (e(or' locations after 'our prora( runs. 0t allows 'ou to c*ane

    t*e contents of reister and (e(or' locations after 'our prora( runs.

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    116/121

    0t allows 'ou to c*ane t*e contents of reister and (e(or' locations and return t*e prora(. A

    debuer also allows 'ou to set a break point at an' point in t*e prora(. 0f 'ou inset a

     breakpoint t*e debuer will run t*e prora( upto t*e instruction w*ere t*e breakpoint is set and

    stop e$ecution. ou can t*en e$a(ine reister and (e(or' contents to see w*et*er t*e results

    are correct at t*at point. 0n MASM7TASM3 td filena(e is issued to debu t*e file.*EBUGGER FUNCTIONS/

    1. Debuer allows lookin at t*e contents of reisters and (e(or' locations.

    /. =e can e$tend ,

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    117/121

     a(e Kpat*na(eKaru(ent list

    -utput - port b'te

    )roceed ) KNaddressKnu(ber

    Guit G

    &eister &Kreister

    Searc* S rane listTrace T KNaddressKvalue

    5nasse(bled u Krane

    =rite =KaddressKdriveKfirst sectorKnu(ber

    MS@MASM/

    Microsoft s Macro Asse(bler 9MASM: is an interated software packae =ritten b' Microsoft‟

    Corporation for professional software developers. 0t consists of an editor3 an asse(bler3 a linker 

    and a debuer 9Code iew:. T*e prora((er s workbenc* co(bines t*ese four parts into a‟

    user

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    118/121

    STEP58 A++%m#ng! L#n#ng and E4%(,#ng ,)% $"-g"am

    ?o to file opt click exit opt now D-S pro(pt will be displa'ed to asse(ble t*e prora( t'pe t*e

    followin co((ands at t*e D-S pro(pt

    Ma+m P"-g"am Nam%! P"-g"am Nam%! P"-g"am Nam%! P"-g"am Nam% *it t*e enter

    E4/ Ma+m add! add! add! add %n,%"

    ORE4/ Ma+m adda+m

    0f t*ere are an' errors in t*e prora( asse(bler reports all of t*e( at t*e co((and pro(pt wit*

    line no s3 if t*ere are now bus 'our read' to link t*e prora(. To link t*e prora( t'pe t*e‟

    followin line at co((and pro(pt Link prora( na(e ,,,,, 9H co((as:

    E4/ L#n add!!!!!

    OR

    E4/ #n add-Q

    After linkin 'ou are read' to e$ecute t*e prora(. To e$ecute t*e prora( t'pe t*e followin

    co((and

    *%g $"-g"am nam%%4% *it t*e enter

    E4/ *%g add%4%

     ow 'ou entered into t*e e$ecution part of t*e prora( *ere 'ou *ave to e$ecute t*e prora(

    instruction b' instruction 9debuin: first of all press t*e r ke'9reister: hit t*e enter ke' it ll‟

    displa's all t*e reisters and t*eir initial values in @DC0MAL note down t*e values of all

    t*e reister w*ic* are used in t*e prora(. To e$ecute t*e ne$t instruction press t ke' 9T&AC:

    *it t*e enter it ll e$ecute t*at instruction and displa's t*e contents of all t*e reister. ou *ave to‟

    do t*is until 'ou reac* t*e last instruction of t*e prora(. After e$ecution 'ou *ave to observe

    t*e results 9in (e(or' or reisters based on w*at 'ou *ave written in t*e prora(:.

    STEP6/ C-$#ng #+, .#% =(-mm-n .-" a $"-g"am+>/

    A list file contains 'our code startin address and end address alon wit* 'our prora( .#or 

    ever' prora( asse(bler enerates a list file at 'our folder3 prora(na(e.lst 9e$. Add.lst: 'ou

    s*ould cop' t*is to 'our lab observation -penin a list file

    Ed#, $"-g"amnam%+,

    E4 Ed#, add+,

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    119/121

    E4%(,#-n -. 76 $"-g"am+

    &un co((and pro(pt and o to Mas( director'i.e. C:\masm\

    T'pe t*e prora( b' openin an editor usin dit co((and

    i.e. C:\masm\edit filename.asm

    After t'pin t*e prora( asse(ble t*e prora( usin (as( co((and.

    i.e. C:\masm\masm filename.asm;

    After asse(blin3 link t*e file usin link co((and

    i.e. C:\masm\link filename.obj;

    #inall' use debu or afdebu co((and to e$ecute t*e prora(.

    C:\masm\debug filename .exe

    -t > for sinle step e$ecution

    -g > for at a ti(e e$ecution

    -I > for restartin t*e prora( e$ecution

    -d > to see t*e data se(ent

    -q > to +uit t*e e$ecution

    C:\masm\afdebug filename .exe

     F > for sinle step e$ecution

     g > for at a ti(e e$ecution

     ! filename

    "uit > to co(e out of t*e e$ecute screen

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    120/121

    EN*

  • 8/20/2019 EC 6513 Microprocessor and Microcontroller manual

    121/121