Upload
adamwaiz
View
226
Download
0
Embed Size (px)
Citation preview
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
1/49
JHOPAOALTPAIIEP FPOBHTEOTUPE
# F__EJ@IX IFLGUFGE
^PAGPFJJHLG
^fpt 0^HO Fssej`ix Iflgufge culdfjeltfi
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
2/49
Hlstpuothal set ac ^HO62
^HO62C0455!055>!4455!455> dehoes hloap~apfte tbe
stfldfpd set ac 75 ^HO62 oape hlstpuothals,
Jast hlstpuothals fpe f shlgie ~pagpfj jejapx wapd 63 `hts(
`ut tbepe fpe caup hlstpuothals tbft pevuhpe twa ~pagpfj
jejapx iaofthals,
Efob shlgie*wapd hlstpuothal hs f 63*`ht wapd dhhded hlta fl
a~oade) wbhob s~eohches tbe hlstpuothal tx~e fld ale ap jape
a~epflds) wbhob cuptbep s~eohcx tbe a~epfthal ac tbe
hlstpuothal,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
3/49
Tbe hlstpuothal set hs bhgbix aptbagalfi fld hs gpau~ed hlta
caup `fsho oftegaphes=
@xte*aphelted a~epfthals
@ht*aphelted a~epfthals Ihtepfi a~epfthals
Oaltpai a~epfthals
Fl Fssej`ix iflgufge hlstpuothal oalshsts ac caup cheids=
[if`eiZ jlejalho [a~epfldsZ [; oajjeltZ
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
4/49
@xte*aphelted a~epfthals
Jast `xte*aphelted hlstpuothals bfe tbpee a~epflds=
6, Tbe chie peghstep "s~eohched `x c(
0, Tbe desthlfthal ac tbe pesuit "s~eohched `x d(
?, Tbe fooessed jejapx "s~eohched `x f(
Tbe chie peghstep deshglftap c s~eohches wbhob chie peghstep hs ta
`e used `x tbe hlstpuothal,
Tbe desthlfthal deshglftap d s~eohches wbepe tbe pesuit ac
tbe a~epfthal hs ta `e ~ifoed, Hc d hs }epa) tbe pesuit hs ~ifoedhl tbe WPEG peghstep, Hc d hs ale) tbe pesuit hs ~ifoed hl tbe
chie peghstep s~eohched hl tbe hlstpuothal,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
5/49
@xte*aphelted a~epfthals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
6/49
@ht*aphelted a~epfthals
Fii `ht*aphelted hlstpuothals bfe tbpee a~epflds=
6, Tbe chie peghstep "s~eohched `x c(
0, Tbe `ht hl tbe chie peghstep "s~eohched `x `(
?, Tbe fooessed jejapx "s~eohched `x f(
Tbe `ht cheid deshglftap ` seieots tbe luj`ep ac tbe `ht
fcceoted `x tbe a~epfthal) wbhie tbe chie peghstep
deshglftap c pe~peselts tbe luj`ep ac tbe chie hl wbhob
tbe `ht hs iaofted,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
7/49
@ht*aphelted a~epfthals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
8/49
Ihtepfi a~epfthals
Tbe ihtepfi hlstpuothals jfx use saje ac tbe caiiawhlg
a~epflds=
F ihtepfi fiue ta `e iafded hlta f chie peghstep "s~eohched `x
k(
Tbe deshped C_P peghstep ta iafd tbe ihtepfi fiue hlta
"s~eohched `x c(
La a~epfld pevuhped "s~eohched `x (
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
9/49
Ihtepfi a~epfthals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
10/49
Oaltpai a~epfthals
Tbe oaltpai hlstpuothals jfx use saje ac tbe caiiawhlg
a~epflds=
F ~pagpfj jejapx fddpess "s~eohched `x l(
Tbe jade ac tbe OFII ap PETUPL hlstpuothals
"s~eohched `x s( Tbe jade ac tbe tf`ie pefd fld tf`ie wphte
hlstpuothals "s~eohched `x j(
La a~epfld pevuhped "s~eohched `x (
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
11/49
Oaltpai a~epfthals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
12/49
Fii hlstpuothals fpe f shlgie wapd) eroe~t cap caup dau`ie*wapd
hlstpuothals,
Fii shlgie*wapd hlstpuothals fpe ereouted hl f shlgiehlstpuothal oxoie) uliess f oaldhthalfi test hs tpue ap tbe
~pagpfj oaultep hs obflged fs f pesuit ac tbe hlstpuothal, Hltbese ofses) tbe ereouthal tfkes twa hlstpuothal oxoies whtbtbe fddhthalfi hlstpuothal oxoies( ereouted fs f LA^,
Tbe dau`ie*wapd hlstpuothals ereoute hl twa hlstpuothaloxoies,
^iefse pecep ta ^HO dftfsbeet cap detfhi hlcapjfthal,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
13/49
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
14/49
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
15/49
Erfj~ie
APG >r0>
PEG> EVU >r>>
PEG6 EVU >r>6
PEG0 EVU >r>0
JASIW >r?7JASWC PEG>)>
JASIW >r80
JASWC PEG6)>
FDDWC PEG>)>
JASWC PEG0) >
_IEE^
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
16/49
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
17/49
Oade fssej`ix iflgufge ushlg ^HO62 hlstpuothal set
Ta `e jape ~peohse) tbe hlstpuothal set ofl `e dhhde ta 7 gpau~=
Jae Dftf Oa~x( fld Iafd
Fphtbjetho
Iagho
^pagpfj Pedhpeothal @pflob!Muj~(
@ht Jflh~uifthal
Tf`ie Pefd!Wphte
Jfobhle Oaltpai
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
18/49
Jae fld Iafd Hlstpuothals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
19/49
Fphtbjetho Hlstpuothals 6 ac ?(
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
20/49
Fphtbjetho Hlstpuothals 0 ac ?(
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
21/49
Fphtbjetho Hlstpuothals ? ac ?(
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
22/49
Iagho Hlstpuothals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
23/49
@pflob Hlstpuothals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
24/49
Ofii fld Petupl Hlstpuothals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
25/49
@ht Jflh~uifthal Hlstpuothals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
26/49
Test fld _kh~ Hlstpuothals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
27/49
Hlopejelt!Deopejelt fld _kh~ Lert Hlstpuothal
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
28/49
Tf`ie Pefd!Wphte Hlstpuothals 6 ac 0(
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
29/49
Tf`ie Pefd!Wphte Hlstpuothals 0 ac 0(
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
30/49
Jfobhle Oaltpai Hlstpuothals
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
31/49
Fssej`ihlg fld ihlkhlg ~paoess hl ^HO62 ^pagpfj
Tbe ste~s ta opefte fl ereoutf`ie Fssej`ix iflgufge ~pagpfj
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
32/49
Chpst we use f tert edhtap ta tx~e hl f ~pagpfj, ^HO
jhopaoaltpaiieps) we use tbe J^IF@ HDE) wbhob bfs f tert
edhtap) fssej`iep) ihlkep) shjuiftap) fld juob jape fii hl ale
sactwfpe ~fokfge,
_aupoe chie bfs tbe ertelshal "fsj", Tbe "fsj" ertelshal cap
tbe saupoe chie hs used `x fl fssej`iep hl tbe lert ste~,
Tbe fssej`iep oalepts tbe hlstpuothals hlta jfobhle oade,
Tbe fssej`iep whii ~paduoe fl a`meot chie fld fl eppap chie,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
33/49
Tbe ertelshal cap tbe a`meot chie hs ">", Tbe ertelshal cap tbe
eppap chie) wbhob oaltfhls flx sxltfr eppaps fld tbehp ihle
luj`eps) hs "epp",
Fssej`ieps pevuhpe f tbhpd ste~ ofiied ihlkhlg, Tbe ihlk
~pagpfj tfkes ale ap jape a`meot chies fld ~paduoes f ber
chie) f ihst chie) f jf~ chie) fl hltepjedhfte a`meot chie) fld f
de`ug chie,
Fctep f suooesscui ihlk) tbe ber chie hs pefdx ta `e `upled hlta
tbe ^HO's ~pagpfj PAJ fld hs dawliafded hlta tbe ^HO
Tpfhleps
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
34/49
^HO fssej`iep ~pahdes us tbe eppap chie whtb tbe ertelshal ac
"epp" fld tbhs hs tbe chie we erfjhle ta see tbe lftupe ac
sxltfr eppaps,
Tbe 6st ihst( fld jf~ chies fpe epx usecui ta tbe ~pagpfjjep,
Tbe ihst sbaws tbe `hlfpx fld saupoe oade, Tbe jf~ chie sbaws
tbe jejapx ifxaut ac used fld ulused jejapx iaofthals,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
35/49
^pagpfj oaultep hl tbe ^HO
Tbe ~pagpfj oaultep hs used `x tbe O^U ta ~ahlt ta tbe
fddpess ac tbe lert hlstpuothal ta `e ereouted,
Fs tbe O^U cetobes tbe a~oade cpaj tbe ~pagpfj PAJ) tbe~pagpfj oaultep hs hlopejelted futajfthofiix ta ~ahlt ta tbe
lert hlstpuothal,
Tbe whdep tbe ~pagpfj oaultep) jape tbe jejapx iaofthals fO^U ofl fooess,
Tbe ~pagpfj oaultep hl tbe ^HO 62 cfjhix hs 06*`ht, Tbhs jeflstbft tbe ^HO 62 cfjhix ofl fooess ~pagpfj fddpesses >>>>>>ta H CCCCCB) f tatfi ac 0J ac oade,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
36/49
PAJ jejapx jf~ hl tbe ^HO62 cfjhix
Ht just `e lated tbft wbhie tbe chpst iaofthal ac ~pagpfj PAJ
hlshde tbe ^HO bfs tbe fddpess ac >>>>>>) tbe ifst iaofthal ofl
`e dhccepelt de~eldhlg al tbe sh}e ac tbe PAJ al tbe obh~,
Chld tbe PAJ jejapx fddpess ac efob ac tbe caiiawhlg ^HO
obh~s=
f( ^HO H 2C000> whtb 4 K@
`( ^HOH2C046> whtb 63 K@
o( ^HOH2C452 whtb ?0 K@
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
37/49
f( ^HO H 2C000> whtb 4 K@
Whtb 4K ac al*obh~ PAJ jejapx
s~foe) we bfe 4>83 `xtes 4 r 6>04 :
4>83(,
Tbhs jf~s ta fddpess iaofthals ac
>>>> ta ACCCB, Lathoe tbft > hs fiwfxs
tbe chpst iaofthal,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
38/49
`( ^HOH2C046> whtb 63 K@
Whtb 63K ac al*obh~ PAJ jejapx
s~foe) we bfe 63)?24 `xtes 63 r 6>04
: 63)?24()wbhob ghes >>>>*?CCCB,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
39/49
o( ^HOH2C452 whtb ?0 K@
Whtb ?0K we bfe ?0)732 `xtes ?0 r
6>04 : ?0)732(, Oalepthlg ?0)732 ta
ber) we get 2>>>B; tbepecape) tbe
jejapx s~foe hs >>>> ta 7CCCB,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
40/49
Wbepe tbe ^HO wfkes u~ wbel ht hs ~aweped u~1
Ft wbft fddpess daes tbe O^U wfke u~ wbel ~awep hs
f~~ihed1
tbe jhopaoaltpaiiep wfkes u~ ft jejapx fddpess >>>> wbel
ht hs ~aweped u~,
Hl atbep wapds) wbel tbe ^HO hs ~aweped u~) tbe ^O ~pagpfj
oaultep( bfs tbe fiue ac >>>>> hl ht, Tbhs jefls tbft ht
er~eots tbe chpst a~oade ta `e staped ft PAJ fddpess
AAAAAB,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
41/49
Cap tbhs pefsal) hl tbe ^HO sxstej) tbe chpst a~oade just `e
`upled hlta jejapx iaofthal AAAAAB ac ~pagpfj PAJ
`eofuse tbhs hs wbepe ht iaaks cap tbe chpst hlstpuothal wbel hts
`aated,
We fobhee tbhs `x ushlg tbe APG stftejelt hl tbe saupoe
~pagpfj,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
42/49
^ifohlg oade hl ~pagpfj PAJ
Ta get f `ettep uldepstfldhlg ac tbe paie ac tbe ~pagpfj
oaultep hl cetobhlg fld ereouthlg f ~pagpfj) we erfjhle tbe
fothal ac tbe ~pagpfj oaultep fs efob hlstpuothal hs cetobed
fld ereouted,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
43/49
;^HO Fssej`ix Iflgufge ^pagpfj Ta Fdd _aje Dftf,
;stape suj hl chiePeg iaofthal iAB,
_UJ EVU 6>B ; PFJ iae 6>B cap suj
APG AB ;stfpt ft fddpess >
JASIW 05B ;WPEG : 05
FDDIW Ar?4 ;fdd ?4B ta WPEGFDDIW 66B ;fdd 66B ta WPEG
FDDIW D'62' ;W W + 60B : 7OB
FDDIW iOB ;W : W + iOB : 82B
FDDIW @' >>>>>66>' ;W : W + 3 : 8EB
JASWC _UJ ;sfe tbe suj hl iao 6>B
BEPE GATA BEPE ;stfx bepe capeep
ELD ;eld ac fsj saupoe chie
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
44/49
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
45/49
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
46/49
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
47/49
Cap tbe ^HOH2) tbe hlteplfi dftf `us `etweel tbe oade PAJ
fld tbe O^U hs 63 `hts,
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
48/49
7/31/2019 Chapter2-Microcontroller Architecture & Assembly Language Pt2
49/49
Eld ac ~fpt 0) ta `e oalthlued hl ~fpt ?