8051 M rene controller,
—
Difference blu _mienepropcern & micnocontrrefler, (HC)
HP Ke
It conteng only Cpu CPU, Memeny 20, Timer. one
on Oebign en decifas sizeof RoM,
RAM & Zio _havd.Ling
Von nO min ode hitectr tre
ge
Be tess fn mvt Hteseing
on ingle chip
— fired size of poms RAM £70
hand Ling.
2 mustty Herve orchiteehnre.
P Meae ty mt foseing
> High-speed _y high case
2 low speed fod cost
> Me _hedwar # — bess hardware 40 be interfaces
Pn dem feed
High, fewer consvinp ton — Lew fowewi consumption
eX tense ORI BDL 15 1? 2 Oks - 8051, AVR» PEC, ARM
fea tareg
F
D> __8-bit cpu
> Fee. of
= _|28 byts of
2 posits
“pro 16 bik mes
> ful — Suplex soviet fort
on-chi
PUN TARR NA BMRA
es On-chib
Lye
pre:
on-chip, memmen J
ip data RAM
af 8 bits coh.
choc oscithertor,oe
D> me Fechmigue of organizing. f°, and date mmemerg | 4
___ with _seponate Wat _agdneases yx called Honvand
auchi fecfone. i 2.
D> Speciak fonction negates. (SFR) ehich occepy “hee im Pred
ofthe internal memory, are re negis prs Phar ee
marge
i @
5 in HE. mange SFE HL 1
9 Programmes sheild vot oSe he addness:
pena than jhe SER) ot Hay uted by expernting cue frsoe 95h A
I a
> fhe 8051 hos 2 accomulaters — megs A 48: Kegisin 6 |
Tae ms fhe _accemsla to mmol tiplita Hen & AGS In frihret
ie for other dructions it cam be asceSeu a gornel
a penpose megigto at He adéows FOH. — i
BoSi RAM (pai). AE Blo,
——— H
}
fo en pope eps
Vine byes:
_——-
[sreemof Bost Me
Pont 0 — {Po.0 to Po-7 P
AD, APz
{Plo to PLR?
fort 2 —> 4 p2.0 fo 62-72.
Ag Aus tetyhon ellown)
Port 3 —? {93-0 fo PtP
3 Tx 8 Rx TSeriak cormmunicertion )
=> INTO & FNT4
an feoroupt}
{ timer}
5 RAM condred }
FF Bleck diagram
Expomel nO PIS
aay
+B ROM ae
(eer aden)Sat performs 8 bite of abi thmern x Lg ebootiny.
23k can oye perform ome bit opera Hons. a.
ADD ALRI 5 AGATE
exe
1_Compsiment 70-3 bin
cee 70-3
Acwraytate A
8 bits nregigion .
> Hust of SBDManitione he amd de
wt wwe ulaton
AOD AyRO_ 5, AL—ATRO
ex
ANL A, RI 5 A&A AND RI
gten B
2 hin 8 bits
2 dedicated’ for _muthptica tien 4 Division
eki- MUL AB y BAC AXE
5 ALB, SS YOtent fm a Roemainde hy p
Oty AB
pe —Preenenn Cov 4071
2h bits megigtor
2M halls ndiness of nextDPTR - Data Pointer:
~ —__ le bits register
So St hatds addoress of pata fn memory of RAM.
~~ PPTR 5 fesrthen fivided nto too “Tegistos of “8 bits
~ {OPH —Highen byte x pPL—lowen byte }
~ 4h ts used by proqnammen do, transfen dat from extemot
a RAM.
~~ > 4¢ can ofso be sed af potnter forr Loox up ble im ROM
= v8ing Indexed. addnersing mode.
~ 1 Movx A, @oete 5 A wil ger date: frorn. RAM
= potnied by OPTR
= Move A,@A+SPTR 5 A ewlAh get dora _fncm ROM
pofnded by OPTRTA.
F
SP Stace ponte
oP —S tes pata
—__ 8 big megisien
—__ ft horda addres of top of stack
-__> _the Stace fa pmesent fn _fintomof RAM,
addness (8 fom 00H to FFH.
2 Inknnel RAM
-t 34 fg psey fo» pusH ang POP insta chem.
aap. on. RESET > sp_of 805) pd Coodes ~ OCH add 26sRSW — Progr Satatys west
> 8 bits megisten
> 34% abso called the “ Flag Register”
Pk ghes btats after eve Tnstnvctron trees fren
1. fr b2o gar.
|? the logs com” ajo be chonged by pnograrvme
> PSW ts bit addmexSabhe sregitten.
i Serp psw.2 4 Psa =)
COR PSi-n > Mua =0
[ey [ac [ro J esx | asofova] - [er |
Pe Pane Bes Pee piw5 Pana pen) PO be
ee AO TEE
a2ccH “i100 i100
Bo pally Gop [7P°4 Rie FH i110 0n0
Pel 5 oud pamity { 624 leit 0070
P=0 5 even banity
XRoP L&I =o.
OVR = “ovemftow Flag. Doles
ag Plows ng
VRE) 5 Stoned overflow
OVR= 0 3No Aligned overflows i
ease ha phens, when mesh goeg beyond (27 fo -Rg& a
| > Afi oveiften, si
im Of NSF (MSB) becomes wPnng,~ RS = 00 |, Regist Bam Oy loepsaii
2 Register Bene 1
_ RS = 10> Regune Bam y
— Rs= iy
~ Rs = 0}
el
2. Register Bane 3
2 BY CER ond 5E7B asinuctins we con Adtect mreginin bow
CK CUR Powsg
SETB PSs 95 HOe Rs= 01 «means, Reyishn berm J i Selec fel
eS EO - Uses de fines Fog.
=? Set by user using S87B PoWHS Josora choice
J
> Cher by USA vsing CLR SPSS
a Ac~ AuxtMrary Coory Flag.
ee
ACE i Nibbe fe ribpe commy .
PTA LLL LLL eeleslada alma
AC £0 y No mibbe fo sible cosovy
Cy —- Cony Flag.
Be aes pecan, Seem e
EYE T Reguek hey CooeY
CY =O 5 Rosutt hos 72, Cong”
SSAA]
|
|(kom) :
HN FA=0, He imkomot. program memory ts Tet accessed:
FRE | > the intel program me'meny (4 accemed for“ addrey
ange 0000 OFFFH and the extornal progrerm mermery i
cd for addnerss greater chen OFFEH
Stace
| 7 Stack fs vsed to stone netun adders,
=? Steve i
dusvng ISR: and
boinkd WW. Stece polnsen mnegisteor, er
Za
Mov SPs 4#F 20H 5 SP holds 204 adjnen of RAM
* a
fnegrer fe AC Aiete meses
Mov Ry # 1H
using PUSH & pop
t
j Ri <— tly
Mov R2,# 22H, Ska Qin
Mov S$? # 2FH > SP e— 2ey
PUSH RI Fyeh RI on stack
Pusy RO wth RL On tee,
pop RB “5, POB RS fem Since
pop R& 5 Fb RE From siacg
SFBH | gil Sorbie :
— gem fe |
After PUSH RE
a Fla eles eee aa
es 3 [atm faew | Tan | gj
oe! 2 > 30H | INH | | 0 iit : co
= ae | xX sp => “perl
Data 18 Specified by SH? symbol before date itn the Wrstovctin
Mov A, # 184 3 Bemis :
oxic
| Mev pPTR, # 1000H 4 _pPTR €—/000H.
12 Regisdey Adin esiing nodes
> Data is bheerfed by megintos e+ Ay Ra rRe- -- Ro.
ext Mov AsR2 3 A RZ .
Mev R29 A 3 RZ A
Mov RIsRt 4 Not abloved in 895),
LSS Direct addnening med
Le De Adore of opiramd 15 given in _iinatmction,
jo tnlya fateh RAM and FR aie aoe aDlactd
ols MOV A, 35H) Ae—Larq
Mev %> 84-5 AZ Leon) comimnek p
Mov 30H 35H. 5 (9a entre fs [Ro]of operand wit be Ginn ty magni
ne giter.
Mev A, @Rr
Mov@r2, 4
3 A &L[et]
s{R2k— 4-
ys :
xtemes RAM with 165% of addmensing by DPT, ®
*s used here
eK :- Movx 4, @oPrR 5 we— [DerR]
Movy @ op7R, A 5 [pera] eA
“> Exsermol RAM with 8 bits of adineming by RO RI
Cs
Movx A,@el +3 AC CRIT, if RI ig 25H tem
[ei] = [00284]
=> Inter
elk extomae RAM Page
e an ere “
f be ace; y
owe @eO a [Rol Ay SE RO ig BSH then
[Ro] = foo35H].
5) Indexed addressing modes.
> Thre addressing nodes fs eg to access data “frer
dg
code _mermo74 finsenmal Romo exfomel gon f
©? te cpenate ot
ph_indexexi- Move A; @A+OPTR 3
Move A,@at re
A <— [a tore}
Ae CAAPc. [=
t SE Agito Fowbeuc tonS —
Lb) Addition
ADO > Soi add A’ data Wi .8 bits K Stes NEGLI In 4 za
ADDA, #S0H , A AXE. ee
AOD A, Riy A ATR —
¢
AbD A, lH 5 A<— 4+ CiFH) | —
App A, @RI 5 AS—AFLRI] oe
ADOC > Hai add A data wih & bits elem geal th cary AApaeg
in fe As
Bae
ADDE A, #50H 5 A—A+h0 t losoy ]
Aede A, RI 5 AeAtR tlasoy Bi
ADC Ay FH) Apt CFI + Camry ~
fope & > RI 4 Pe Ay Fei J 4 loamy, * C
22 Subtrachin t
S268 Ay #S50H 5) ne—~ Ar S0- Cary,
Sv BB Ay PI 3 AAA Canny [~
SvBB A, ITH b Ae A -U9T — Cosmas ~
SUBB_A,@RI 5 PSS A= CRI ~ Cosy,
/INe D. :
PTR DpTR <— DPTR+)
TO tememay
ie Dec Ay Am aA-) a
i PEC RI} Ql Ao i
i DEC as 5 E2sn] <— Bsn)-! ~ i
pec@ari yey RiJ-) :
DEC DPTR 4, dows sot exists.
By uttipticntin
Mut AB (Bian Anne) A XB
—__ 6) _ Division
7 Div OA 3 _CBreminn Aaanne) <— ALB
“33 9 etimet etd fost coum = prsbee 9
4 nop A, RI
Bi Daa T pep addition adjestent
add 06 HM with Ae
Wie
bag DY Levers
2 pen add
AAD 5h rapt aye 2 2 STE
eee
bon eth ACs ogre Insdarvc toh
hy AND
ANL Ay HSH > ASA AND SOW
> ANL Ay Al 3 AA AND RI
-. ANL Ay (FA LAA AND Cid)
Ant A,@RL > AS A ANP Ceiy
ANL 26H, A 3 (pony '<— [29H] AND A ©
ANL OSH) #RH 5 CHL —Lesny AND SOM *
ae
ORL A, #50 >
ORL MH, psu 4 C2H] e—Lasnd “oR Sey, _
—_3> XR |.
t XRL A, 50H 5 PA OR S077 @
y KBLA» RI >a EA ORR =
} RRLO ATH SAA RDO] |
L eet n AR) 5 Ano Cpr] a
Kis Se A 5» bsje— Reny ror a =
tie ai Hse PeonJe— Bsr} Kop Goee
es on —
DB em plerront 0+ Ay vncams oT ehowtn A =
as
RAISER Gen aeetahe ae
=00H
cometade hee A ee
18 com bee rrens
FE Rokite Ling boot him
g RRA => wojate -pright of A wither Carrs by L pid. a
S A Z46H % Carry =| : al
s og -
= [2 elope de echt
ony | =
= : Axe) RRB _
. Le] thet Terel oft Ng
- nos MS a
cary 4 cay
e 20 23n- weg
a , Lb of Ae
He FLA D wtinje Seftor A ruttnort Coody ~
= Aves Cel os
a
a
1—SaTee el Tile
al
C2044
afin RRC A
peyote Pee TET
seed et ee es Dea
RLCA > vole depr of Auth coors by FOF
°
ro ‘ele Tee Tok
{tory : J
aft? Rech.
PER € 9 Cheon cassry Huy =0
a CPL eo > Comployont ce27y Plog,
oa Seo leg
se:
4 “Mov ©, p02 +, cooy Rey 2 Po-0Mo
VK A» @Ri 3 A < [o0-R} from extomal RAM
torent obi A leg
i Movs As -@ PTR 5 q <—.LoptA] fam enlomet Rant
= Movx @ Risa 3 [00-81] A fox extemal RAM.
= MOVA@OPTR yA. 5. Loove).t A. fon tntomed-RAM
7 Move A, @r+opte 5 A e—[atorre] fn ROM
_ Move Ay @aA+pc 5 A LAtPCI “fem Rom,
_ PUSH R) > Ri witt be stored on atc
fae PUSH BSH 5 Cast aikl be sdered on state
ot pee R15 Ri cvitt be Loaded fore stack
Ee Pop 25H [25H] with be ‘aded fowm kfeck
oo KCH > _Y cil exchange He mentined Hoo era.
E < Key Ap RO <> KOe
oi KEM Ay 2H Ae Los]
“ ren ar. @e_ 5 4218s)
4 foods
: : Fewer vibble op te meokened
= XCHo 2,0 Re. Stew He exchange.
“ :
Xero A ORI 344? BRiYonty oer sibble
a »
4
|FE Beranch_Obenartions *
Samp > sherk Jem —? 198 $104 a
ag
A AIP rAbsisile Amp > 2B : .
2Ucn
i LIMp3 tng Jump 3 64e8- Lea
with gi
IMP we Gest mp dp new Loca tion and Men ent move OP given
i program : _
J 7 ubna his, we
CALL > we gomp # new Loca bien for _sebrouhint, eft __Bub™™
Come bace to that toca tien again.
Ties RETL
=> uses with nommal scbmotnt| > Uses wlth ISR — Injorrept
evict _meuhine.
bith RET, 805! j8t mena back |? ben RETL, 8051 nese ace fo
female _porypem fnew man bregnem + Tt vill enabe
¢
ee Inioreph by maeterng a= /,
2 opena ton: apes
pep pc 5 etn < CoP]
3 Oct ——sp-4]
3se —Gpr-2]
Pop PCs pen <—LEsp}
5 pCk e—~ Gpiq
5p <— spo.
Bre)Un condi tip
Mendienek Temp Insinvrbions
ees 4
3 _ SIM
Pnbee — 94
Final a
feb te Afoca tion with nespect te Label (3b).
adnor ef pe = pin aeset
2 AIMO tnbet > ang |
re Se
nek alias -pC = 1565 bin of PCE BUN OF ATH? 4 el
$e ee ed
BLIMP 5 bong
pee
Poa Labek
DIM pe @a+ pete 5 5 ci temp Ph kocaton RADPTR
# Gnditiyal Jump Tnaimetinp [Alle SIP)
> DINZ R3y hab 9 I4 wtf _decmerment RB, and Temp fo He
Mabel only if “R3 1h mph Zeno.
=
LEE — PGi babel pocorn ermer EBs fa nond pir fee Sor bek
“ poaky tf BA Fh
SCINE A, # 2H zhabe 2 It evi compere AO Fw &
jemp to Lat df omby if A& #2FH ee Tot coped.
CINE Ay ISH, Label 2 AS [sn
CONE Ro, HesHrtebd RD & HF 25H”
cone @kt, waned. 9 (hed PAH
hanFre tebe >“ Cwoy Flag 15 0
Te larl —> were Flag is |
ING gue >. Bre Fes 15 O-
Bookean
1B 70-0 fabeR ~> Tumb telabel onty
ING P00 kabel -) Po.0=0 >
THC P00 kab > Tomp # Label only if 0-01 & alge
make ~0.0=0,
€-Po.0=!.
i Ht Times & (oonpn : i
> 8051 nex 2- lobby Times ToT, wormeing 8 UP Cones,
a TOA TH NS fos th ditded Into 6 bits og 21¢ 9/8 fos THO
L. Teo » eri -Tt),
aig
4 Te Ty
| : —
ed fered a
| THI TL 2
| How 40 oad cout?
2TH times et UP conpedd Vere
Soyo given chee Tt will fmcrememt py 7.
i a _es: es a
ee i
Preacher , \
denen, fo FFEF Hs inwitt stells bee fo 000% 4
+
=
\
2 FPPEH. \
z Mev THo, #FFH ;
7 Mev THO, #EEH. |
7 ; ~
OR pO PS -
THIS Cont _foaded inn To 6 Tr cxidh WRemerent after ery Cove
Trmen on Comte 2
2 49f chece fo the want ' gue. by tntomel efece of #08)
Hen it wiht be timer and if choce in given by extomep
chow on TO RT pam it te conser.
> that ig to be__omfigured by TMOD register of SOF).
. ; : fer.
> Te bit pitt decide Hmen on _coimten_enbig oh Sf fh,
eee
oe eeHoa Timer [Comte esanes b
Hee Tne
Sa apenas)
AER adlvery -
= A.
ane TEO O*TFl BIE
Toa aT een
incnecse fhe fo 0. bere
ery clock PBR adios
WV
when count neff from
FEF t2 0000H, (t wif Vv
make Tow Tel pip tod RET tT
{519 mm toowpe do 0S!
2 FSR addnes of Time 9 -& Tien 1
pec tively.
ooo BH 2% ddIBy
> Time action is contmolled by Ton & TMOD negindos.
||_¥ TCON Regen - 1Bit NdJoeas TCON-7. fo TCON-Of
ter | Tel
T Fo
TRO | Tey | tty
T£o
IT
TAL ATFO 2 Times evenfiles “flag .
SETHI Duwhen Timen 1
and Timen O
rofl oven to ctl 0%,
Cheea=O 9 pen Me
Over floes, valor dimen
lexew’s TSR atts, araTR.) See pice Se
TRo 5 ‘ ===
re TIME se amish bit a
—S#Nt Combrg fro
OF Katy.
TEI & re
EO Exkonel intoombt ba
LS plen receives in pamepr
OF when ase
txewsey
{ mti > 0003
zu to-> 0019H}
FSR adiney
ETL RETO 9 fecksmot jy konuph Type bre
[= INT) & FATS mst be ve edge Tagger.
OF INTO 2 ZN TH ry)
be how fevet Trrrge
F_TMOO _sreqisien ~ Timer mode condawh seginken
eee
f iz a >.
cf far [Mo fomtel csp [mM | Me
ome] FM [e
A A aT SE
Tima L Vero
eee ‘4 pe bit .
CLF 2 Counts [Timen. 44) :
PgR oh _Coonsen fectomel fez. on _T ato}
t= Ad
3 ily 8 TH S ingomee foreg * Pose (12
nabhe con doel bit
controlled by hand vt
om ante _Regnmt
—_—_—
GATE 2 hae _©
CENTK -Bignel )
pe Timen
0 = Tima _sneepertind“Tm [Me | timer wove :
: ob vl L
fi 0 |0 moleo
014 meer | ~
lo vaten | r
CL meee r
Times _vnale-O {13 bybs Hrnen/ conte B.
Boris forcoum bys force
: a
ee t
> Afier 2 42 coms TL. mollk oven and ik wit
x2 a.
incnement THX
H > So, TEX divides the freq: by 32.
man. cont = 2 = 9K»
yen deley = Bigr2 x 12
F,
ose.
pp
Times-yncde-/ £6 bits Fino [tot )
ae
—>__TLK & THK used Compherely here with mode |
=? _ Dw each che 16 bit wilt ncmerronk by I
D_ TER ih et #2 1, hon |
: when off 16 645 mekes form FLFR 4 000k
DuBy mm, mede MK com = gif = CFe
> man. debe
o erste
ae
LLUa \
=2 (8 bins av \
foo evening ore happening. -
~PATFR Gilt Gre intooupe
THN Cit elo TL.
AP nee on 28aose
e smek- deloy = OS6x 12,
Fac
—mode—3. f Too B bits He by simend }
ise pervade Hees
7 ih dws
9 To atue used wv Bag we Of Teen O-
F
The cial gia. ingereph +e Fe
AB LO com bt sed Tin & Commi pit of Timer b
> nel qe in borp + de TAI Fang
a Tro
4
A
iJo generate deloy of POHste eg send Lge 1
0
g. wae a progam fof
‘on P20 ossvme _ fage = ID HAR.
i : :
salic fon_tmer 0. wit mmode-1.c8 16 bits tHmen
TMOD = 0000 00018
TT
To gieot dimen 0 _ with rnode-1 TOON = 900100008
ro atop _timemO wivh _wmode-1, | TCON =
‘
L—
j—
—
=
ag
=
4a
0000 00008.
To enbendate Cont, ome count time = I2/ faye = HAE
Vale camt = 20=14H
are |
TAS dimen jg up conn achedvebe Bhartd be hated cil be
Cons = PFPEA 19H +) = FFE CH.
TLO =EcH ond THO = FFH, to be headed farr delay of puter
* Mov TMOD #0000 0001B ; Timen O Mole-1
Mov. TLO, #ECH 7
Mov THO, # FEH 5 cond 2oD14H.
MoV TOON , # 000100008 +5 Stent Timesy
War} 2 INA TOONS , Wait d wait for Zomdsec
SETA 2-0 Shoat ga
5 dogic “1 om p2.0
“mov Tcon , # 000000008 + Stop timen
Heme: STMP Here.
End of Pnognom,
—_—
aeda
ite Se
S bregnemn
bregnam 40 generate Aquone wave of tkH2 on Ted
Bheme fose © 12HHe
re
Oo meien1 > Tmey = 9000 000/ 8.
“tin = OIH i
ity oe
cl, “Blo Tron = 000100008
pe ee
= dove oveoB
ie eee
si bie forsee
: sey Sa pee
ltl feat CR
i a
ges 4
$0 fer oS mses it Khotd “be high and fr o-Smme Uh Shad befe~
one tame HVE = JZ. apne, _|
Fore ae
Com} 2 Om 500 = IFKH.
MHRE ~<
rome PFE EEE ea
= -FEOCH. : a
BD CLR P3-) (> Ler TP Qve cal
atheat * Mov TMeD-y # O/I1 y Tier 01 of 5
Hov Tho 1tfoc a —
= Med THO. FEN i fom 5 500 = FAH =
Sy Saeki
oy Tcon ) # opt 5 Sie ie
I , ae
Wart S2TND a wert, 7 ie E
CPLeB- —
Trev 7 co NAOH a8)
paren
pe pew ah
soe thee ia== = — 3
FE Inte ommuph3_fn_ 805! '- }
2 |
> gost hes 6 in kemepls and off on€ vecfoned Mn tomebé
fee hu : = 2
TS Two hordwone interrupts» ENTO nd NTI
+ TFO & TFL
D Tuo ten ovenffo internet interovpts
> Serick communication In domel indennupt + commen for
RI and TE
> AM inkzovpls oe contreSted by
“EE and IP regighns.
Pacgrer ZR pregrarn
Tm ;
Inkezowpt
~{ = v
: mas Rete
Entesompe —_*| Portanty agg nunel”
INTO 1 amo
TO. 2 aa
at 3 00 13H
TEL- € aeiei
Seiad (Itt) 5 a
Te > inkennopl - enaple megisten (Bi adbembe Ié74 TO)
J
+
era ¢5 { et
#xo |
al
erUbIe Tinos OMB TimergTe disatte mare ie 9 zs
4
te > Entewrpr priest, eestor icaguaaae ara a
[eae
J T i
Sesion Se) Poway a emit Parone
Povov, aie Vater TRS
high botom 4 =)
for prren$eo.
von Vet Ld eda