You are on page 1of 43
Fo / MICKULUNTRULLER BUDE Microataller {5.0 chip which contains ene inbuilh cpu, gan Rom, To porxis, Timer, Serial g com port. 2) is also trowe as ONeWp computer. / Weroprocemor doesnct hove Inbuilk conbsoliers. ty | forma system ,tnese controll | | externally . have io ve inkrjaced BK susie designer using General purpeseginters-prce-- ssov Muar add FAM, Po, Clo poris, dimes’ ev) \e ae ~ * omake thon yercHonol. Aithogh the additon RAM, LOM ond Ho ports makes these sysiem bulkif-r and é Much move - cxpensive, They vave the advantage oy Yettsa-— Hilly en Ane We desgner an decide onthe amount 6, RAM, OM and “Yo porty necded..-te pit 2 th Fasko ob hand: . . 8 wnicro~contralles: hes a CPL in additten. Ao ar Lixed omount OF RAM, ROM, Lo forls,and Hiner ae allong a ~ single chitp. The ‘yixed arncunt a, On’ chip FAM, Rom ek. sto wnicrocontrollers wakes them {deal sor 7a Aypltcatons on in Ghich cost! and space are critical: Jn yarn Sapplicaltons for axample a Ty _vemete contesl doemmt_p power of ..Peottum-4 . Th aR Woos, he space it tak ‘The power it consumes, and The price per unit are madi more crivical considerations snag Abe ‘cempuling power. Be These Aypltcations mest often veqsre micro -contcller. Agsitearogs. 13 Intercom, Wepnene, fox, Ws, VeR, Vide fellular phones, camera, oy microwave ) Printe ete + A" Nigh comeiiting 2 » PILKULUNTRULLER BUD L. Microcontroller. $5.9 chip dhich conlgins eve inbuilt pL, gain rom, flo ports, Thner, Serial g com port, 2} fs also Known as Ordip computer Weroprocemor doesnot hove Inbuilt controllers. to form o Syste , these controllers have io be inkrjaced evternally, ey . tT aout Mioo= precessen] co) "Eb, ‘ : Spi # os BK sytem designer wing general purpesaginiers-puce-: So Musk add FAM; Rom, Clo poris, Himes’ ey! hy + make Thun junctional. Although the addchon of evberel, Ram, ROM jand Mp ports makes ‘These sysiem bulkigy and Much move cxpendive, They have th. advantage ay Setsa— Alby eh Ae he designer man dectde onthe Amount SE RAM, ROM and “Blo ports needed. -te gtk Te task ak hand. + . A wiero-controlless hes a CPU ih additon. jo an hixed Omount OF RAM, ROM, Lo gorls,and timer ae all ong a single chulp. The “yixed amount a, on’ chip Ram Rom ek. in wicrocontaollers wakes them deal sor m ny AyplTeaHons in Ghich cust and space are critical: Jy samy Sapglicalens for axamgle a Ty _vemole control doesnt need "high come power of ..Pentium-4 » Sh “any agplicalions, he space wrt ‘he gower it consumes, and the price per unit ore mac mre critfcol considerations finan Ane cornpuktng ower. Se Thre Apeicatons mosh opren veqire wicro -contoller. Apeiteedtogs Fellulay, phones, camera, toys microwave , printer ete - Ne Intercom, eghene, fex, Ts, NCR, Video ques, 1 ing o i NN Q { Bimel (97) ee! _ : [fort Number pom. | enm | tlopins | Hiner Tolersuph Ye Tage | . aT sac 5) ae 12:8 32 2 cy | AT SALN SI. | “ak. | 28 32 2 “6 ’ | ! : areaciosi | ik 64 = 1 3 at saczos1 | ak | 138 ff IF 2 (fe w| i Vat eacen | 8k as , wf a: i Tle aT SANE sk] ys | a2 ] 3 &. lay.) ne a . - ; J A, feotures_oy _ 8051 __ ~ i » BSbit CPU with registers A and B 2) Ibi} -prograin counter CPC) Fdola poioter CoPTE) ED) sit progran stolus word Crs) - 4) Bbit stack pointer CSPD 1 s) Tnernol Rom of ARS. , © Inrernal - RAM >} \28 bu tto- i) h negister. banks each containing = registers: iy Ae butea, @lotel *ngybe addressed ak tre bit level B i) Eighty. . byten Lf general-purpose dota memory’ D $2 Mo pins arranged as four S-vit ports: Pa-PS,-- D Nwso- We bit, Wer lcountrs : To and Ty D Full _cuplex serto} dd data vecetver [Transmitter * spof 1) Costes) vegisters + Ton TMD, SCON, PLON ,EP,and re Wo -exksnal and three’ taternal foterrapt source? ~ W) Gnbult osetllaion a ek clock cfrcutt- ry tock ellagram. ‘ov Arehilechuve Of BOST p / P ‘special L. Arithmetic function ob flo and [— Ps regiskers 4 Bo-hy Vogical Unit RAM & EF 00-07 a] |s shit dal4 |, E jEa t t Addro3 bus vt PTR x Wr. Pe | JOPH sot go) el fa E Slo 7 x 40 pris c bE Addr Gus re BIE — Z y Ami Byte] Bib ' sustero Himing a u SERS —_ tle Ne Leen ze oo Pinte veut a Yk Register P 1 , z gis\ z i —_| Tolerrupts = ots mers Bank-3 |, --2eo% _] 4 ops - SBvF Rowe toc | Sate bupters Register scon ' Guo Lemay coke Bank-L =r) ‘ i T 1 Register | [| Tmod I u Bask-| | | TL | i he THO ' ' Regis ccm ; i Banko THI i ' L2H i 1 Tolernal LAM s}ructure Accummlator CA) = THs a sre 2 vsed to hokithe vesult a S > used for data jrans(ar belween Bost external memory - = Several funckons like vole, lest ete apely specirically oo dre accumulatoy — Register SB. ‘Itis @ SER - = eqister (scratch sad) <5 used as a generol purpose Bp_ton_peryorm —arithmelle and Logical °P ewahons, On guy data ____— - Progthits ‘Stas, Bord: eee The PS eonlsins Ihe wrath wFlaqs puser PrEgTAN 4) iby | a a Sa ister select bits -hat identigy whieh * i and the. se ; jour general purpose register banks fs canrentty, | thuse Soy he > pregram- _ cy- carry Flag, used tp arithmels, Deft! ‘Abvanch on Pa 5 Ac - ft itary carry _flag 4 for BCD “arithme He . _ Us? glaq 0 -'C Usey: aefined Maz bE Psa Reaiske bank sclecto Register bank o o aA Select Register bank -| ° -..Sslect ' Register. bante- 2 J... Seleck Register banks QV + Overflow Flag cused in arithmetic | lostrucHons « — > Reserved. for future wae. Po > Parity Flag 3 shows Parthy of register ALL sodd patily: —¥ bik registers provided do Store That results oF Serte8n _piegcam \nsbructons. Othen Fnshr . f2dten oy the —.. Fle are ucHons ap Jest the flog and mate decision. bared opty Hy-2 shake Qreuped_tnside The Psw ond thie power ante! _ 4 rao A olernal Memory. ee ae The 8051 microcontroller hasan Snkynal Memory: For 4he large sistern, contiguranon an -2xkrnal memory canbe added Taternal Memory, ai Tokermal RAH C198 byes) 1 area a Tokvnal Ron CH k8) Herma) -_ RAM. Bos\ has 128 byle jokrnal KAmM- This is organlud in three Atertck ave: : y 4 register banks 5 Bbykn each: ay 16 bu ten ax be addressable area. - » so alg oo genera} purpose, Ram Cscralchpad_memary) prot _ - - Bale addneo> ayie adios p - TF 9° ? 2 z é oo 21 [OF os} 3 2290 a 20 [or ee] 30 Wosting Bit addressale 7 ft ® butep cach» 1) Hregisters_bants of OW => 82 Ste) From addrexs OOH fo IFH that make. U8 a ave : registers organized os 4 banks of 8B vegislers exch, ‘y => 4 register banks re numbered 0103 and are mode, |g wegislers named Pe fo hr > => Each register can be dddvessed by varme Ch. to, x, eky Ov its PAM address. Opa, => Bis Rso and P81 inthe Psd delerronea Thich bank oy registers Js currently in wse at any Hine They pregrar js Yanning. t => Register. Lbamks not sdected cam be Used Os general purge RAM. ~ Sank 0 is seleckd on venet- ; => Register Ro and Ri are used for register gAdveating, ) Wetoytes bit addressatic area: : . => Th eceapies Ram byle addresses 204 to 2PH a *otal oy 122 addvessatle bits + , > Sn adivessable bit maybe specigted boy its ‘Bil’ oldies A eee La Clouse ammount conmbeansc ont dete From 20 tp 2Ft. > Foveninsy > Several purpose _R 9m => This area is abso called @5 scratch pod axeq Fp => _ Th Vien above bit Qddressable @xea ane) hay addres SOM YO TEM. CRO bubs). riemal Rom + © The west he Ang oy Internal, Rom ees) Octupien address From C0004 to of eth. ry ine 805) Oscillator and ClecR ne SE et aero dod Cec Yne pins XTALL and XTALE are nehoorh contoining cry, he A provided to. connect 4 Tesonating sie] aod Capacitor fo form an aidillator. capacitors are eonnecked In order to slobilize the nl. Me clock Frefuency Ts adjusted between Amy to Isr, Minimum frequenctes imply jnat goine internal Memories, awed are dynamic and ~ mud olwoys operate above a winkmum Frequency oxgiala willbe jost+ The MWmit a0 the roximum Frerueggaes “gottine to designing of internal components. he R AIeHion delay. ob (nkenal Components, . ee : Program Counter C Pe) _ = Sbis = 2 >: o,\guit vealsler and used tohold the address-op © te. Which is ty be feRh _ hn AT inthe | jemary ! Chisknatty” Yer ROM memory) . ene Pee Tr shows ‘tha byte or {nshructiog GWE Whenever the microcontrelles value, oh Peis evook. . Pc tothe register canbe actessed & have, an Internal address - Sto be executed. is wesck the by depauth 4) tea and does nt La Paiste Capra) ~~ Bis 3 Aebit Tegislee made Lp tuo 3 bit wegisters, Named BPH and DFL- frcan be Used as Bb oF Levit Semon) -polntor For Indirech addressing - © Gan be used for formal and exlemnal code address. tk Gscesd and exkrnal data access a _ Stack and _slack _poiple® 5 Slack_dnd _siack_pow st -_ ee > slack isa Yemparary storage of data located yy , Rar) 24°C Intend! data_ ae aosal sailed Jocation «This locaton ne =. stack, ‘ : the ‘negh recent entry called as top of thy slack, eye c=oral ‘| speoa a aaa J 3204 2p= 08 t J SP=08 Sp= 0g f _[Lsp2o7 SPeo7 stering dala a0 a Getting data prom the shack era a . > PUSH ond PoP ave tne’ fichuctions used to access the stad, => ON nesek. s WIN ipiHabae to 7 e sp2o07- :

FAM ends ab address 7FH 4 pusry above TFH vesultio COX'S > Whe “se! ts usually seb ak address above the register bank. < Special _functton Registers Cseps’) > Speetal guncttan Yegisiers Gre the” control’ dod regi- SETS Used do sek Ayperead parame hers Sythe Gost => Nddressen OF SERS: Gre seb above The genero| purpose RAM te above thy TRY. C8OH to FF). | Tne eae RAM address. Accumuatoy - an 8 < OPH - Arithmetic oro Addressing cxkrnal Memory « e3 DPL ; - Mdvessing external ahemary - 30 = a Tolerrupt priotity. _ om FO TIO port dole « an a To pork taken. * 90 Pp To port tale. flo Ps flo. port Jatch- og fon Power conn} on Pty Program Slatus moxd 000 ston Serial port corso) 98 BUF Serial port data busper: 93 sp Stack painter. 8) ‘Tmo. Timer [counter mode contro) 89 ‘TCON Timer {counter contro} 88 TLo Trmer..0 low bute: eA ue Timer 6 high byle- ea wl ess Site A toneaey a8 oo ~- Ter 4 high bute. BD: DIN. descr; WON Ok the ase OOD Oy the - gasp Gitte) LL (Prey tel— Yee Prt a aL pow Praja a POT prs 4 31 pon m4 Ss ait po-g : Pres Ye ae poy ere —P HE pos Prat A - Pog elie. * SP 3 Por CRED) P20 in &e a oF Wer CKD) PB) =I" WS” sol Ree FRG xt = GERD PFA Ay PSE CENT) P33 3 ae}- 29 (To) P34 hy “ ina eel Crp pss ir ah Pa Cire) pas “eC. oh eae = yb. pxg Ci) Ps7—N aay, Pes eee Pa str ley wl LJ0_poxt pins and ‘thety_guncHons oo ae ROE SEO DS Nea The 4 ports fo, Prsfe Ps each Use & PINS, mateing ports. MN the Ports “upon RESET are Cnygured as Outpy Ory Pert of thee ports as an npuk ak mush Moe prog hen Bhi, *. To use AMM eh Pork 0 Z 5 His “Pvit_ park and can be. used For Input er Output. « BM ping Spine pork o Should be connected exleriall Y toe Coke pullup ‘resister. Thr {1s due ig the fact thak py VS an eren araln C similar. ty tha opeo callecler). 0 40 =f poo = ~ = MW lines,” 6 peat Po ave” muttiplexedl: (Ring-AD,) 7) By depoulh iF ts conyigured ao 1p part > te wort an OME port we musk Bre dip ot pino~4 fy te MOV A, POPE H ;MOV Poy A > @nbe wed youth: wp — otp ovt— toe => No need oy — Npon veset, ct > To work ara exkenal act, PUll-u1p ~veststors . 1S canyigured og AP port. Ap sve muah give Li au " ins of Fi. ‘Mp ~otp => No need oy external — pull up pon vecek akig BLO N00 an ta Need yer the Tesistogy, Dig4red a gai Port Bive “sy” to ah pins oy Ps Dddreny eo. peer Son HP WE mast [ | Post -3 + > Sy caobe used as Jnput or output: = Ty does nor peed any pull-up resistor, => TW also provide some additonal guneHon P20 > RD > Wed for seeidl A= reception oy Ya sae: ' ' PBL TED > ted jer Serial ‘vansiission of tu data: P@a > INTO ->) these are exlernal Jolerrupts available, Pa-3 4 INT] al 8OS1- Vector localtons op INTO 4 . i ANT) are 00031 aodooish sreopechvely. 1; Psy 2, qo Fras. . TPas J vif Se wed yorthe ttmers and 1. Exkmal pulser canbe cannectd here to at counting. P&E > BR > sed to vile dhe date, yot0 extemal : smemory « . P27 > RD >. veed tej wetteathedaterdedy. read dee : data trom ine memory ores Mull prot, VIPUL Bsr CResetD 3 TH ie ao Inpuk ,ackve high pin. Yeon Gpplying a high pulse to. Tin pin , the gostaill yeseh and terminate all achvilien Ce xcept fr Romy > Th ot. duzatton of The veoct pulse should lac ok least 2 maciine gycle - . \ Power ON teock : Ave = Whin Power dupol: lou . ; ov Testy 03) asitdud oN, the pact voltage \s 2a00 ¢ all supely BU Will appear @evoo tuk. => When pariter charges fo Supply, the turrect iprewsh, ib 1S eum 4d hinu feco Rese} yaluen af. Some eUTSHNY” Reqis}enr Reoek me 6000} Fe eoooh fe - 96001} oa oot! sp @OoTH at “Qool. Ba. _C Extemal__addvess) - or CExternal Access) 5 Shi. an \npee” pin aod must be copnected te either Vox “ex GND ( Po nor ReeP. open) - : => Whenever tha gos}. will use -internal ROM. for code accessing Hu ER ts connecke do g vec: => for exiernal Kom accessing na 65 pin hould ke 9 voniy 2 i : PSEN Cbrogram store enabled . > Win. pin. is used te activa, entermal gon alu ER. is grounded: C fre ead signal Ror extemal Roly y => This conected 40 OE fio.0, external Rom akuch~ wil) select The fom yer data Ccodt) ee ALG Cnddvesy_bateh Enable)... => Sis active ugh lp | pio: = Used to demulsiplex: the! Bdo-AD Vins oy ta Po~ =) When ALE gees heh Tre Po will have addxens Jewer Adare on ak and Dhan ALE yoo om the Po Wu have dotk on db Timer lounkers and can be operated indenendently - =) when opembd as “Nmen’, the wegisler je proqrarom ed yo lout the internal clock pulses Cie maching cyclen) « Fach machina cys \e ef 12 clock pulses hance Counting pulse is of 19, clock cyclen. Mule of antig =x Rsq ° ‘ =D The © So @unler 5 the , register \s_ programmed to count Ane external pulser connected to To OFT. = Te wuskr | timer registers Ave divided toto _g bik registers called TLo and TU o+ To and THA. = The counter action js cevtrolled by made conwel register CTmep) and. the register CT cont): bits to Yhe mer er |counlen control Mi i ee Toon CTimer/ructer Contra) vegisters) TF TAY [+80 [tro | Fer ati [zo] r70 | a overplow Flag: Seb to_ 4 ahen Hmer /counk overslows . Th revels _Cuskoma to vector Jotattos: ae Thos > wsed pr timero : oe : TRIL = Tmer A Run conbre) bj Th_is_useil to tun the timer. wun Ais jolt is 1 jini Amer [counter eats uns a Hate bmeye E : TRo 1-4 Vsed poi mero a peta Site olcersots pellet ercerte auier nae external isterupt on INTL line. Sp will be cleaved au romatteally When, ic EWO 14 Used yor INTO . James fo vector location: Ty sebs to L shin. Ahureis an, interrapl on ET Wwe Cinterruph is detecked Wun tisk sianel Sper loD from high stab) omni y_. =rmod. : (Timer mede © pore [ae Tm [me ve LT al aa Timer _ ..timer-O Gate: OR gab enable bk chich conbels RON Isr0P 9 : nen sJo. Setto Lh program ‘to enable neg | wun if bit TRI/o, in_TeOn is Set nd signal on élernal Interrupt ENT pie is high: Cleared 40 6 by prograyny, 4o enable. Hmerto Fun If bit Te\/o In TOON. is set: a o> Seer mode 3 countesioletnal Osc: pulses A = Counter mode > Counter pulses yrom Tio. Diy Mot Timer|Counter operating mode select cr Ai Mo mode ° ° o ee ° ' ! all) & : \ fi 8 Note 1 Tmoo. is not bit ‘addressable - S TIME COUNTE CONTROL 1OG1C ose prea” Lf tind wb ms St ip plo To Hmer stays TRI fo'a #110 Bitty eon GATE Cried) a, “Po (b. Inout pin => When conleal bit to TMep Che elf). ls zero, the sorte) fA willbe Conneded to position L re tothe oscillator. e aod Whin C/Fze lL se switth willbe oo Gunter weds. Ty Counter mods june counts the externa) pues given to The Troe To. pio bos] - 2 Ws Timer /couckr ‘mode. can be made. ON or off tompletely by seltch 8. . = When TR dit From Teor is “zevo. then Ine olp oy AND hic) wil) make switch B OFF. gah is low To, maka coudler |Timer enable also can be rode the TR bit should be 4 - depeodent an external interrupt — pulse - ao a When ah GaTe bit from Tmod: is. made oO, the lle. to the oR) gai is 1 - The wilh wake so@iich B OW. fe Buitcn &- is no more dependent an INT pulse: => When Gaye bit io A, the OP of OR gau is dependent on The postion of INT signab- Thin counting, . an. be made for the perticular duration of ihean be started| ager © receiving The pulse ror tre S£8T pin: 3) 3 =) Timer | counter > imen Mop ©: Cig wit tounlesD> c > In this mode the timer opemtes as a 18 bit TH~ebits)-The S bits in the Tlcete the divided by $2 prescalar ister CTL-5 bits aod tothe TH as dn° @ bit counter a a eS iF aso s li eae ap seis tex [> Tato Jers (5 BR) |ce bits) ie crest Tex oo i‘ ee The Mmeris enabled when TR =1 ,4NTE <0 and Ns) 2 Te Tinie et, Men The Amer ts conteolled by external ee TNT_, 30. sn pebse aiith meanwrerenk -TR is contro) bit: ip Ihe _TCON register: : en Hmer_ Count exceeds 9 bit _qeren_Cflag is TR rand Tfo) a ROPE A! Cis. bil. couser) > Gt ts amipr_te the mede oO ercegt - constr | timer ts As wit => _Obts__ Be bit timer the Pore ait allads Soly value of oe | to FEN Jobe leaded Apo the Mmer vegisier TH: => Ayer TH he Bbit een WN Qitena copy Of ih to TL Thies Ma Aimer must be gard . (sere tex) > Ajrer tia starting The Hmer, jk countsup Unkil it reach en ils Unit of FEN hen _ Sb sols over trom FE to O6,ib sets _ TE hah. ss Osc fF Er ee a : yet Th PO re mee Xosor lt. Thx > INT 9 . “| CBbit) "Ape allover fhe Lx witl be loaded qutomalisally by Te — \4 le =! CSplip Himem mode) aie nce ene tier alten Nie bub Th 4 te e& ce Used Woe Miner 5 e =) Tho Od THo are 3 The To register usen INTo ond Yeo. contigured 9 4:00 separate bib counters, Me timer 0 cootral bits ely, Gants sTRO, Wo tounts the tnachine Gyles .L1 taker over The Use of TRY and TE) tom Timer) - : ‘When tne Amer -o \n mode Q ., mde O10 ub wk will 4 othe Amer 1 may be used Ip nok generate any interrupt because TRV \s ued by Amero Re apes CAN \Pel sedi as) ae car eee aenerator jor serial port. From Timer logic | Tnlerruok Pragramy to generale auare ave on p16 - Mov Tmo, 4 10H Himey J, model Cie bit) a AGRIN, MOY TL, HGH founbe TLiz count. >low byte, o4 mer mov TH), F764 count THis utah. ‘byte a, Her. S€te Te) : Start the Hmer-| BocK! ING Te BACK Wait until Amer tolls over CLR Tel. ~~ Step Amer J cpr pes Complement P17 CLR TH clear Hime Has, \4 Moe -9: CSplit Hmen mode? > fe this mode the timer is hat aed but Th 4 tel & ore used yor Wmer-o. 3 TA md THo are comygured q 400 Separate 4 bik counters. => The To “eaister user the Hmer 0 control bits ele, (ATs sTRO INTo ond Teo. THo founts he machine cyclen ft taken over Ye Use 0% TRI aod Th Grom Timer=t ae : When Ane Amer -O In mode g the timer 4 may de used 1p mde ©, 12 Souk Ge wit nok Generate’ any tnlerrapl becaie TRY Vs ued dy mero 4 > ‘Wer 1 ton be used as a tad male generator jor semiol port. INTO pin From Timer logic Z Program to generate syuare Wave on E15 - Mov Tinop, # Ion Kimer J, modet Cle vtt) 2 AGRIN, Moy TL, A SPH founbe. TLi= count. sea byte 0} Hmer mov TH) , A761 county TAs Count Hi. byte oy Hmer- Séte Te Start the dmer-] BhcR! INR Te {BACK weit Until. Amer tolls over CLR rel. — Stee mer | ol a Complement P1-- CLR TF clear Hime Hox, Dola Tnput _Jowtaut —_ Rerial_y Data Ene => Sena eormuntcatoo 3 \ j computers Cshorh atstance communieetion) . > we miorotesivoller, BOS1 hoo SFRs to contre) “the communtcas?, cee Save te “bol He data, Seon to Hee, combat tha, " No contro] the data rat, . data communication and Pro 4 comprise? of 100 rregtstets physically => We SBE. segisler f ° used to Feld He dota thabis to be one oy hero S | Yransmitted ouk via TxD. pio, DWle The other is wad dhe data thal ts. weceived yrom the pesfarms the communleal¥on bel, 5 only and _ hel external __ cep 1 aS § wl duglex asynchronous seriol fnkeryce Can be tmolemented_.on.. using serial wk ryace contre) .ctrcuir. A. double lbujjered secelver ts used_in the ctreuc go Anak the yecelver can Teeeive A second character Dhey awe sk one isin an. toler mechialy ‘register. => Thr _sesiol flere, con be operated io your dipperent moden Mode o te Meda gs __ Modto =» Ghipt veqfsicr- Mode} * B vit UART : moda2 -» 9 vik UART with pixed baud rate = Modes 2 Abe YART. with Variable baud vale - modes 2and 3 hove Special provision for mllHprocestor => he communtealtoo: => Bond wale pe special wmode mo be adyusted ond te clock source “regulired For acting band vale is provided onchig: SCON Csevial pov} cootwl /slalus register - [smo sm [sma] ren [tes [rea | Tr [ar] SMe > Serial port mode specifier: S™, — Serial port mode spetipier- SMp Sng o ° Serial mode o, ° ' Serlal_ model ,ebikdala , lstop, Lstast b ' ° ie. Serial node 2 - i . seetal modeg: REN *.— Receive enable - Seth) cenet by soplware to enable J disable. meception - wae * ts Ane gt data, th willbe dranimitteel, 1p mode 2 avd mode 3. Sebor clear ‘oy soxtwarxe to disable xeception ¢ hak sed to Modat1,2,3. In mods 2avd3 ,is the 9t data bi} thak way creceived. Mn: mode | (Stop bt} Tr t Transmit inlereupt flag. Set by hardvave atthe begining Sh The stop bit in mede-1 Must be cleared by sophuare . PL: Receive Interrupt plag- Ser by hardware halywoy through the stop bit Hme in mode! “Musk be cleared by soptware. BY Mode ©. ora => WW jp te the chiyt register > ° % soul : pool 205 SF = Wis Is haly duplex mode. this -reperred On TAL shiph reptslenn, Te slight vegtctes has shigh ley, shigt wight operation The sniytiny operation of dala bits uy cequenctaly clon « is data and cbck The serial fs transmitted and veceiued through RKP line.TLe clocs fs generated by TED Une As ks are not daba Bo hits are wansmitied aka Wme tu STRAT 4 SToP wequived: 188 is transmitted [Recetd prot We bord sak os fret aod Ghts | Flin - he ic Kao Wonited number of Slo. tas) Trovder to tnevemse he Yo Wika ahi oo Thy tke for “high speed data Collection... Using bes Le t. ) dy wie Vines we can provide external Lo clips scegistere - gull duplex mode _ Yel 8 BIE. synchronous Hansintssioo: change in data. =» 4. transmitted « No Sate. =...0... ttansmitted J BN> operation => 10 bis dye. used yor Atansmission - ro \@lart bit B_-, Bala_vits es ‘ier, wit Te le Tele be Teer] ° A start but Stop bir @ wih aate- jl ' o> Normal rate L+ Bouble -rate - => Fy Hmer tL fe io model theo nea on . ei age Cree acer teats So o de 2s => Fall. dulex, Il bit , synchronous communizabloo, > seo RN2 opervaton- PN BIE. transmission awd, Stare bit 2 7 date bits oe eT Ds) 2) > TRB jrom Seon is us |_to dransmit 9! bit: = RRB From con Is used to receive gth pit. = Baud Rak i variable . \ smo . Baud Rah = 9 x- Oscillator frequency - , x \ 3a if => Wis used por tulliprocessor . communication. MODE 3. _ ede @ fs Samir to madea cecept ‘thet in mode 8 the woud role is Gslermined as in mode using Hmer 4_ NOTESBY Prof, VIPUL. GOH'L : INTERRUPTS | —t Spon _ackratton of The. tke #051 is having six interva An Interrupk, the wwe gees cthrousy the ppllosing DT pntshest the Trsbruction execeting and sa OF The next Tashuction (Pc) on the stack. : : DT also saveo the uurrent Satuo of all tne internups internally, a Th jumes te the Pred vector location where Ts is aritten. 4) Sh executes the eR and Peryorms Nhu took. The &Ketubon will be conhnued ee bl pets inshuctron. D Veon exes executing the RETI inshructon: tne Micreconhdller Yehayns to the place ahire it way tobe inktrupted - Uh gets the €a Pe grom hack - tne rrapts tp Me_8OS} 1 Helually. Tere are S_folerents uk sere nani peckurer give Six + - eeRese th amen _ : When the Reeet, pid Is actvated , The 2061 yamps fo address location OOOOH: ») Umer Inierructs Two \ntexrupts are vesewed jor Hmen . TFs and TE. When Hers ger over voll-over , thine _ Inkerrupls are generated: TF —> G00BH | Cvector locatteo) GY. 3 GOIBH | Cveelor lecattn} 3) External Tolerrupts . Two wrerrupls Gre megerved Yor exkemal use. __EN_ang_ INT. When the signal at th pin pas to° low from high stat. the foterrapt ofl}; be _oceared, INTs -> *0003H Cvector location) NT, > O018H C Yector locaticn) - 4). Sevial port Interrupt ; Combined Used for the Riand TL. The vis ave logfeally "ORed to generat ingle fatenur Seal Trlerrapt 3 00231 Cvector location). Tate crust priority Upon ‘veseb. Priovit . Interrupt Vechor fecatinn i INTO (3.0) 0003 a Le o000RBH a . pe CLeI) 0013H x TRI 001BH CRT) 0022H 805! ‘Tlerrupt Shuckure and Contre) Syslern. TE xegi. é High prtesi pBesoi ter, lb pay “ ol 1 * aie - r = 3 Tey Hf Tolerrupt _ i eo polling i ° sae: ' l Seqlience. Ty : : wl ° AG oo ea ' Bx i ‘ wit = + pt ears Se josh] 7 ~ T ing b J . OTES BY “Sbicdtsath. + Z Se Prof yr! COHIL interrupts CRW 4 EW ave accepted. a =>.The extemal fPolerrupts ENT SENT) ave pins auaslable on gost Chee. Trigg ering, 3) tna folerrupt can be seb Pweough — Toni Seqister. han - fT pit jo Ton is 2000, Ma Aniggere fs‘ vising edge trigger, om} BNO tt=1 , tne Trigger” ured is falling edge? Arigger- Quurance of external Arigew- puloe wii sek Wu te Bes, of Toon > he mer soll over position gil) ‘sek tke Tho ox TE) : Of TON aind Alrectly — given Ao the, TE vegtsien. for Thu seetal communication Ata RTL ple wh ve wun dak fs weady er Sransmission and S Ri + lL scon will seb ahan datas wrscatved «pry ore position [ts detected by GRing Ria cr > These all tnkrrupts Cexcept The” moseing “tin be dono “th xegisters can moos oll “Or. can be 2 TP reatsier sels => Three Internal (TF, TE LCT PID) Interrupts nd Wo external ay ul The various ways of ateessing Wu data rom ~roaister. sinkema| | _memeny extemal memory are called addhessing modes. Bos}__provider a folal._five.. isheek_Alslineh addressing moden I). Ragleler addressing a> Smmedtate addiessing a) -Djrect- address . 4), Lodirveck addressing * 1 9 —Trdexed addressing: > Regisler addressing mode 5 Me invol® the une op... regis to_neld “he data by “be -mammeep manipulated) -.. ... _Regfsier ove $18, Rote &7 gob sdected bank yorrg, Ss — Th copizo the contents oy Ro into A - Mov Ro AL? = Ek copies tne conteols of & into Ra. Nole:- vegisier. qo register mover using the regis te Addressing mods oceuy bet” rregtstess Ad Reto ?, &) immectiake Addveosiing mode + a GT this addressing mmede ,the source obgiand . tsa constant and data te to bem mored { __immediah data fpllowed oy YW sign - {an Ramee, Y Mov A, 30H Loads oH io +0 tke A vegister- : ~D. MY Ry, EO 5 ~~). MOV OPTRA Fo30H loads DPTR with 4ogoH . al hed Messing In Wis mode sti operand ‘ts 5; address yield tm Me a Me 128 bytes ey A\mough Yaa entire “Ab is inpsh Pecitied by an 2 bit Rnstruction - Tr allows 4y__actens Joterna) Ram ang thy SERS divectly. VE bylen FAM Combe accened, ei OFEO. Masd Ap aetens RAM location 30~7 Fr Wo Is dus to the pack tek fe regfster bank 1s HiT SO=TEN, ik addvenable area. Jo_an= 260+ and ovailable Ram is s0-7FH- 2 Grample + : > Moy Ro, HoH 2) Moy 4) Sndivect _Addvessing ; a Indiveck_addyessing. usen Ro: ox fi open coed a) data pointers’, 40 Hold jhe addten o} location in RAM yrom a Mov Py @Ro —— i 4. a ‘moves the. contents. of Lom tocation ‘hose 4,2 Addy. 1s Held by Ro inte & ace <% Mov @ ki, B : - % Moven contents of B Inte. RAM lecatico € hose address ts held by ey 5) Indexed Addressing : a Nis Termally used 49 accens tu look-up Fables dhere program eedi ST data is stored: Pete or He Po canbe ued Oo fodex. register: Example a Move A, @ A+OPTR - Wh Jace Ne Agder adds «| nina The $05) ‘Ensiruchion set - Ro, Rij ba --: Py 2 Registers from, selected bank. >Use} to point The internat | Ext mone @®,.@R, = -- __ Th_conlents ; xegisier wil) ge shy, a _-.. addenda}. emnory - tp... 3 Dmmedtale number Coo-rFen) Peo ed Re eunulater: Pe _ > prgram cunkr used to point ee Ank/ Ext «ROM — (weit Move only) DPTA - Data pointer used to point External RAM -Cmovx) ’ | INI/EXT ROM >.(nsVc) - | This joshuction will copy the Golents of source lestinabon: aay £ Note eth possible. EMO Rss ev ORIS me e OR) Pay : 4 7 Moy add Y meme pololer Yb’ _ eer ares® ELavalid Inshuch'ons. D-MOV @ Ro, Ra. 4) Mov As, CA, _ ‘] )-Mev.@ Ro, QR, ee a) Moy A,@R) b) Mov @-Ro, #80 ec) Mov @ Ro, 80 “> External Addressing ‘mov’ : Ss S ina a ao 1 Mice a nea ; lesa ‘Tygon ol I Ry 1 [po ay Lee a ke "] peta Tf. pea A,@vrrk F AtopTA MOA @aesprR — I ie ; : | [ wrec fymivca @Atec I ' => Ail me Gxkma] RAM, Thema} Rom and External Rom thstruchons- ave with Recumudalin. Colas . D> MBX MoXX Is yer Exbeme] RAM = Movie fs to ROM) Gemtlaxui ®) MEVX A, C Re. jon Wis. foshruchios ___extermad_merery CBbIL) Shoo by the conlenks ° is. (Ro or Ra, ooly.) - peer opel ee foe..Tolennal Ram (00-74) =-'Cor weverse). b> movr 6/@ DPR . ___ Copien, the. conkents Of vexkernal memory (Iti) showo . by - DPTR.. C Reverse can be used) way A1.@.OPTA is. an. Invaltd © Pnshruction - O Moye. As @n+0P ee : “This “tS wed Jo. accens the, coda from Scone G@rso ne _Gppien tne’ code bute , sound at the Rom gx tddress). formed. by dding Pr dnd Dera, “te. Qeeumulater ¢ a i pleco} lookup table: - class nolebook paye:- ae cf, © hEPe . . _..Shis. is:elso: used Jo. accen> The’ code prom the -téok-up table. Crom) ¢ _ fopien “the <-eode bute, joucd at the Rom __.addread formed by adding A and Pe, to actumplater cA): => Pc_will, be locemented by 4 bejpre adding te A Gwe OPTRA wi mob: | [ => Thr contents oF QRTR-: can Be changed Dbite a PO BD, MOE | =D -MONC ts. Mormali4y wed Gith {nkvaal or enteral. Rom .a9d~ cman addr Ak Oy internal or 64 B04 exiecnal - : E om = Sue pusHmccivecl>| 1) i : Ws _ins}ruction sith Of. BPecipiad memory —:...NOTES ny POF VIPUL GOHIL Pop THis Dill pop Clo oi addses3 40 the “Astor _Spei Nolte 3 PUSH-A, 9 Eo Sera ic ACH A, Rn, addy, CR) os ee : Ws Tnstruction sill exchange tas Seakents of, Spedtied with actumualory. Examples D XCH BR 2) XCH A, go 3) xcH A, @Ro eee ee > XCH should perform ith only | PUSH. Thi sill push the conknts memory. adders tothe _ Meremented ty it and den is_inslrucho, --—.—s:. NOTES BY _Prof. VIPUL GOHIL + pare ae addr - Pop : THis will pop Coad) - te enter ts Note 3 Pust.a, — -ACHA, Rn, addy, ep Di Wis tnshruction awl ‘exenange ao eooknts oy Spedgied vith accumulator. Examples D XCH p, Rr a) XCH A, Sd 8) XCH A, @Ro D XCH should perjorn ith ARITHMETIC Grove: D> ADD. A, Hd = fe ALENT 2) AOD A, Re => Re nt-(Rr) 3) AD Arad} = Ae N+ Cadd) 4) FOO ALC Rp => an & p+ CCR) Se AOceA CS ons pe neni ©) ADOC A, Rr. = Ae + CRe) Hcy D Rone Ayadd » = ne ht Cadddicy Y fdoc A,CRe =>. Ae mt [Cady +cy- Similarly Sublraction. inshructions are & : f Qep © sues 6, 4 © s088 As kr Gsvee A,add ® suas A, @ Re. eee =| 3) ENG A. AS A+o} Cincrement) . lo ENCE Ry is eS Ad — @d+51 W) INc. add- Qdd) & (add) +0] Ie) INC GR [cere] — Lceepr} roy 8B) Dee: A« la) Dec Rr- 4 ne bs. 6) pEc © Rp = ee re Wages a 8 >on" Malti plication : ae wet = D MUL AB : : This will perprin tne enik Multi plication of RAG [The high ble, ofp teoult will be on BF lw-byle of reowte will he on f- 20D OV Yoo. will be Sek ih AXB > fen, > There “its ne comma beh agg. Pa sahea: nee >> 3) DIV_AB : Wis inshuchoo alll pe. divide A by B. Awa) Store quohent Cresult) and 8 Oil store remainder. = oy Hog sill sek oy legal dv: 4s_perjemee ve Ble nO nae ad iH - = Original contents Op A B.-wil) be last. 9) DBR. CDectmal adguot acuumulato). 2 We will adjust he, avurmutadin to decimal often arithmele operation. Céimilar to. BOBS). LOGICAL “INSTRUCTIONS j2 Thene are aloo moWD ao Beolead operations becouse jhe Jsgteal. operations are: bit-wise opembions Seq, >? Ly, oe Oh ,OR, if NOTESSBY » Pref: VIPUL GOHIL eee eee D ANE A, 20 > AND each bit oy Alt The cagkenkinasy ee each bit of memory cookenls shown by 20H. 2) ANL 20,6 C26) < C20) AND A 3) ANL A, aD A <> ALAND.) AD ANG 8, @Ro JAK BNO__CCRedJ D AVL Ay Ra ne A AND Rot Strothaly. fern Logical ORrag and EXORing - wD ORL Aradd =: ASH ORe (add) ®-onL add, A. (de (add) OR tee 8). ORL Asatn aA A aac | 4) ORL A, @A, h A " S) ORL A, Ro he Dao. ac ORL ad, Hp (add) — Gad) on n 1. ARL-B, add eA YOR Ged) -SARL add A add) -<— add XoR A 9) -KRV Bat A <— BR OR Jo) xii a, @ae Ro & fp. xoR Cera) wl) ARE 5 Ro A & A XoR Ra <— ~- YOR Ladd yw add) $ add XoR n- lear each bit Of A register 40 0. CELA - (Comslement aceu) _ th wil nplement 4¥8P each but of -—-A@eummuletor- _¢ NOT_eperation ) : wt oTES Ae a pur S° Thene operations are PeTZOrm ON Single Lit . Normal! wit __carey 14 and bits yrom dit addremeable Ram C204 AO 2E) “Which ven bit addre5 %y 90 tO7F- Rrowe 1k. tne. fs - @m. be Uwed- ~~ bine. bik adden. Coo-7f#) or coos a SBR Oddy jeexample pa-a. given | bik she Pory 2B of ORO 27 ay Mov A, # 304 ©. Accumilatnr - -P) Mov yao. o loaded An immediate nes dala 20H “will be ‘The, cooks of. Re oil % 9. moy A, @R,_ Tha_chntents o anemary Shen, Bes the Onients Ot Ri willbe copted 09 acee. ~ 4) mov A180. ‘The - Contents o copied. on acu . Tmmediak, “move ne “ores BY Prof, vip'yt’ GOHIL | > Mov A, #20 i | 5) Mov Ri, Heo 5 Move Ro #29 ~ . ic) 20 — The Uinrrecltety, hun ber Sar} aill be loaded on the memany shown by the conten, oF Ro. ) moy 8°, 20H (20}< 56 2 20H will be loaded on the Tmemnry addveny OAK = | wy aa ; femal i Moy Ro, A _: ERohe- Ae b>. mov Rg, 49 Rg. <0 ©) mov Ra GON J dee 2 C80), = Ms instruction will copy the 00 —,1F HD 20... (0) 26 ©) may s,@Ro Gs) = [0] 4) Mov 8y'Ro 17. GD) & Re ont ieee Ge) © C82) Ch) -> contente op memory 7 aS —< a i een 30 DANL Cb -~+ nnn + bit i_Sere wesult onc example : ANLC, 02 Where 621 Is the vik « MRSS, room bit addresoble RAM. A> ANLCS/b > AND co Hue complement of the addr bik, Store the veoutt on.c. wos et @ ORL Gb Ce God GS each 4) ORL C/b © CO ORT i SGP ce > complement ¢ ne & clRe "= +» Clear ¢ Br en ~*) cLA b > Clear the addressed be Hl 2) mov cb ~ Sepy the addr. bLE to, ~Camry peg - XY mov be > @diac poet peer 10) SETB c Sek carry pag ite 4. E ny sETB b 2 Sct the addy. bil lod. sere wil set pin-a Of Petts to 4. SETB Pswo-s, sete 99, SEBB Toon: 3 _ Rotake and supp Clim rete Bony) i oRLA Rotate A register one bit Position Yo the lept DRL A Rotate — through carry 3): RRA Ro taki. “aeed mulato, might - 4) Rac A&R Rotate acca. right through Camry. S) SWAP A — Cswoap the nibbles) This tnshruction wil) Swap Clolerchangs,) The emt: lower nitble ch Accumulator te Joa, We Woghite nibble SF Accumulodzy. to: Lyte. eS a Aup__.dod_._ Dashing _Conirh — c Uncondtonal yume + “This. trstrectfon will Pwansper the PC So The specitied add yeo7. Leeodtior Dependi Yeon the cHon is elassitied Voto S groups: > Short an gump —? within ihe ast byte area€ Bit) 4 Absolu& gump 2 Wty tne VEB area C1! bib) 3. Within The 64EB area: Clé bib) appleotions » Whe IMP insu 3) long same => Shork jump gives displacement of 25¢ bude addy. locahon’ means Ohio the gump is — Ok centre . position Aha forward displace- ment ts ep G27) and — backward dtsplace- ment? iso, Gt2e) -CAlso \Enown os Relahtve pamp.d - Tow wget Sddress of SSMPT, see class nole. book. —-- Ponduitoned juin be ee All condiHtonal yumps are. short gume: re witaln The = £127 and -125 Area. Bicthas They have B bit address. Cshortyump address 3 sadd) ) TZ, sadj >> Jump 4 A Co eure. tagy 48 vost) a> TN2 ‘sadd = Sump Ih. AxOW — “BSA asad + Dacremnel_ged_jamnp Hy ato SX “Decremen and gume fnstructiog i Cooly Jeo Insdou), D DINZ dalaaddy, sad - ! ‘Wis inshucton will; decrement the contents og Tremory shown by data addr. by ar L and wil) gump to sort addyesd 34 contents veame cero: Prop, NOTES 2 Example | a VIPUL GOHIL DINZ 20, CoH Tr GN decremest the contents of 20H and will yume 40 GON we wes Cire coolkenls) 15 zerD 2) DINZ Ro, sadd * : Wis ail) decrement the given repister, by Lad will game te sadd Cebit) sy resuthis cen: COIN2 Ra, 36) 3 TInvetsd instructions OOIN2 A, 82° @ OSNZ MK Oke, go. @ oz, 60: ©. v2. «0 @ 032 < nol vaticl ~Ompare and Ju dnstruchens and yranspon @re pot’ equal. lombeo if belts % (Nole —s There fs “paliienienae jo check equa} dat, in Bost). CIE ts Invalid). D CINE*A, gen, sadd THis. Toshucton will ompare re B.F ime 294, jumps to gives, both are mot qual.” CINE A, add, sadd- ao] He Comparer sthe conkols of ackke memor_ » Addyeds amd oumps jo soet addreny (sadd_) wy ‘both ‘are NOt equal: Example CONE A, 80, 60H ; : oe QUMPS tO GAH, oy BaP C80) - > CONE @Ro cin, sadd - > CONE Ry, tn, sadd. Can = Povearreses — %) Pho, Rarsadd — Ocane aor, suf fes80, sadd- @)cane ay, 30 saad. | oe. : i“ i Br Jumps » Git jumps all operate aes: according to tho stotus Oy Carry Weg th the Psta or the Malus of any bib-addressable location - TC sadd jumps to wbirdddt ip cyst a) INC sadd Tumps to- git addy th cyso | 3) JB b, sadd | Jumps te addr. Ih. bitis set 4) SN by sadd Jumps to addr uy bibis reset + 3) JC b, sdd | Jumps to addy Sp bibis set and clears the ad bit Dl {eng NOTES BY oS IL —~- =e “EAU. Trsivuctions pret WPUL'GO a ee imnrren) ent ae St ah err Counter . to The Specitied addren> Op the Subrok we - p> AcaLr —s Absolut cal for 2E CI bibs). CBLL ‘Bs LOALL. —s long colt: yee 64K Cle bik) \ aor CAL. 00201 Tis thstucton all jranster the PTOFTAr counte jo Tha addy. G00. BF storen’ the addres come slack pay of Next instruction Bree. Taaving toa reduction in power consuplion - port Ob conho| ter al + Dy saveo We , chup aced not > ba i Tr cnbe achieved by Feceiny gome and reek alt in alrerl _consume aon a0 Power. Savlng rmoden are » , Tale wmede (sleep mode) AD Power, down .mede- She Adie} power domo: wede- a‘ : a i serial pov Timer ap Torermants ae ' [Rs cpu —— ESC eet is._put.to. sleep. awh. aK on-chip Tale made : >. The cove. BE CPL_1S. peripherals... such. 98 “athe - geatel port , imers_aod Ink qropts rernalo achve and eontinus to Eee Ly gf to activaked: by. giving EDL sO- Tr wil maRy ich will make CPU. lp. oy We pnp gat bo wl : ORE. te sisce- =. Here only clocks to CPU are stoped and hence a tu centents Of register and on-chip BAM semalns Undnanged: ‘ => The ackvalton of “any enabled thieript will cause he 2 +e it in PCON to bE cleared by the hardware, termi —

You might also like