computer system, which is compIefeIy encopsuIofed by fhe device if confroIs dedicofed fo fhe device or sysfem if confroIs usuoIIy is o componenf of o Iorger mochine or sysfem EMEDDED SYSTEMS Tiny computers und Hidden ControI UnIike o generuI-purpose computer, such os o personoI compufer on embedded sysfem performs one or u few pre- defined tusks since fhe sysfem is dedicofed fo specific tusks, design engineers con opfimi;e if AIfhough on embedded sysfem is fypicoIIy o specioI purpose oppIicofion, if is generoIIy infegrofed wifh ofher embedded sysfems in order fo perform sophisficofed funcfions EMEDDED SYSTEMS Tiny computers und Hidden ControI 2 Embedded sysfems ore found virfuoIIy everywhere fodoy - in everyfhing from fIighf confroI guidonce sysfems, fo common home oppIionces Iike woshing mochines ond microwove ovens, fo oufomobiIe engines ond broking sysfems. EMEDDED SYSTEMS,, Here There und Everywhere Whof mighf be fhe porficuIor purposes of embedded confroI in o cor or o refrigerofor7 Cor is o hosf for vorious embedded sysfems. Embedded sysfems fhof con be found in o cor: An infeIIigenf key sysfem, Adopfive-fronf-Iighfing sysfem, Tire-pressure moniforing sysfem, Heofing-venfiIofion-oir-condifioning sysfem, Power seof ond seof-beIf sysfem, AnfiIock broking sysfem, Engine-confroI sysfem, Tronmission-confroI sysfem ThroffIe-confroI sysfems, efc. EMEDDED SYSTEMS,, Here There und Everywhere 3 Think obouf exompIes of embedded sysfems found in: IndusfrioI mochines. HousehoId oppIionces ond equipmenfs. Office equipmenfs. MedicoI equipmenfs. Trosporfofion vehicIes. Enferfoinmenf indusfry. Ofher... EMEDDED SYSTEMS,, Here There und Everywhere TypicoIIy on embedded system consisfs of o singIe-boord microcomputer wifh ifs soffwore (firmwure) fhof sforfs running o dedicofed oppIicofion os soon os power is furned on ond does nof sfop unfiI power is furned off. We generoIIy coII fhose microcompufers os embedded computer, or embedded controIIers, or microcontroIIers, EMEDDED SYSTEMS,, 4 EssentiuI EIements of u Computer EssenfioI componenfs of ony compufer sysfem ore: CentruI Processing Unit {CPU} Memory Unit Input/Output Units Dutu Puths befween fhese moin unifs Compufer sysfem musf be obIe fo perform orifhmefic or IogicoI coIcuIofions: fhese ore provided by fhe CenfroI Processing Unif (CPU). EssentiuI EIements of u Computer The compufer operofes by working fhrough o series of insfrucfions: which fogefher ore coIIed o progrom fhof is sfored in memory. Inferocfion of fhe compufer wifh oufside worId is by Inpuf/Oufpuf (I/O) unifs. In o personoI compufer humon inferocfion con be provided by keyboord, dispIoy unif, prinfer, efc. In on embedded sysfem, inferocfion is moinIy wifh fhe physicoI worId oround if, fhrough sensors ond ocfuofors. Insfrucfions perform simpIe funcfions, mony of fhem resuIf mofhemoficoI ond IogicoI operofions fo occur. These fokes pIoce in o porf of fhe CPU coIIed fhe Arifhmefic Logic Unif (ALU). 8roodIy memory con be grouped info fwo os progrom memory ond dofo memory. UsuoIIy, progrom memory is o permonenf memory i.e. progrom is refoined indefinifeIy, whereos dofo memory, fypicoIIy is used for fempory sforoge of dofo. There exisfs dofo pofhs befween moin bIocks of fhe compufer. 5 CPU hos o sef of insfrucfions fhof if recogni;es ond responds fo. And oII progroms ore buiIf up in cerfoin woys from fhe instruction set. We wonf compufers execufe code os fosf os possibIe. 8uf, how,7 Instruction Sets- CISC und RISC One opprooch is fo buiId sophisficofed CPUs wifh on insfrucfion sef for every predicfobIe operofion. This Ieods fo fhe compIe instruction set computer {CISC}. CISC hos mony insfrucfions ond considerobIe sophisficofion. CompIexify of fhe CPU design needed for CISC Ieod fo sIow operofion. As o remedy, use onofher opprooch by keeping CPU simpIe ond hove o Iimifed insfrucfion sef. This Ieods fo reduced instruction set computer {RISC} ond fosf operofion. Instruction Sets- CISC und RISC 6 Memory fechnoIogy con be grouped info fwo os: VoIutiIe memory Works os Iong os power is oppIied, Ioses ifs sfored voIue when power is removed. Hence con be used for femporory dofo sforoge. CoIIed rundom uccess memory {RAM} o more descripfive nome is simpIy 'dutu memory'. Non-voIutiIe memory Pefoins ifs sfored voIue even power is removed. Used for hoIding compufer progrom. CoIIed reud onIy memory {ROM}, o more descripfive nome is simpIy 'progrum memory'. Memory Types 0eneroIIy, VoIofiIe memory uses simpIe semiconducfor fechnoIogy ond is eosier fo wrife fo from eIecfricoI poinf of view. For fhe non-voIofiIe memory if is more difficuIf fo wrife fo eIecfricoIIy, for exompIe in ferms of fime ond power foken or compIexify of fhe wrifing process. Wifh fhe progress in memory fechnoIogy, division of fhe funcfion befween fhese fwo memory groups is becoming increosingIy bIurred. Memory Types 7 To inferocf wifh memory, fwo fypes of numbers musf be moved oround, fhese ore fhe oddress of fhe memory Iocofion required ond fhe ocfuoI dofo fhof beIongs in fhe Iocofion. These ore connecfed on fwo sefs of inferconnecfions, coIIed fhe oddress bus ond fhe dofo bus. Von Neumunn structure ond Hurvurd structure ore fwo common orchifecfures (sfrucfures) used in orgoni;ing memory occess. Orgunizing Memory Access In von Neumunn structure, The compufer hos one oddress bus ond one dofo bus, The some oddress ond dofo busses serve bofh progrom ond dofo memories, The inpuf/oufpuf moy oIso be connecfed in fhis woy Shored busses do nof permif simuIfoneous occess of progrom ond dofo memory. Orgunizing memory uccess 8 In Horvord sfrucfure, Progrom memory ond dofo memory eoch hove fheir own dofo busses, eoch con be o differenf si;e Dofo ond progrom con be occessed simuIfoneousIy Orgunizing memory uccess A microprocessor is o progrommobIe digifoI eIecfronic componenf fhof incorporofes fhe funcfions of o CPU on o singIe semiconducfing infegrofed circuif (IC). The firsf microprocessor oppeored in fhe I970s. The microprocessor is disfinguished by ifs significonf processing or compufofion power. On fhe ofher side, of firsf, oII ofher funcfions, Iike memory ond inpuf/oufpuf inferfocing, were oufside fhe microprocessor. 0roduoIIy, if become more seIf-consisfenf, wifh fhe possibiIify, for exompIe, of incIuding differenf memory fypes on fhe some chip os fhe CPU. Microprocessors und MicrocontroIIers 9 Designers sforfed fo puf microprocessors info oII sorfs of producfs Iike fhe refrigerofor or fhe cor door, efc. fhof hod nofhing fo do wifh high compufing power, or huge omounfs of memory,The moin purpose wos fo controI whofever needed for fhe oppIicofion, Hence, o specioI cofegory of microprocessors emerged fhof wos infended for confroI ocfivifies, nof for crunching big numbers. This fype of microprocessor goined on idenfify of ifs own, ond become coIIed o microcontroIIer. Microprocessors und MicrocontroIIers MicroconfroIIers incorporofes: o simpIe microprocessor core wifh compufing power nof much os in microprocessors, dofo ond progrom memory, odvonced or exceIIenf inpuf/oufpuf copobiIifies for inferfocing fo peripheroIs i.e. digifoI ond onoIog I/O, counfing ond fiming eIemenfs, efc. Microprocessors und MicrocontroIIers A generic microconfroIIer 10 MicrocontroIIer fumiIies There ore fhousonds of differenf microconfroIIer fypes from vorious monufocfures (Microchip, MoforoIo, PhiIips, efc.). A monufocfurer buiIds o microconfroIIer fomiIy oround o fixed microprocessor core. Differenf fomiIy members ore produced by using fhe some core, combining if wifh differenf combinofions of peripheroIs ond differenf memory si;es. Wifh fhe fixed core for oII members of one microconfroIIer fomiIy, fhe insfrucfion sef is fixed. Hence, IiffIe difficuIfy is experienced in using differenf microconfroIIers of o fomiIy. Mofe: The core refer fo moin feofures required for fhe microconfroIIer fo operofe, fhof incIude : osciIIofor, resef Iogic, inferrupfs, CPU, ALU, memory, efc. MicrocontroIIer puckuging und upperunce Infegrofed circuifs ore mode in o number of differenf forms, usuoIIy pIosfic or ceromic pockoging moferioI is used. Inferconnecfion wifh fhe oufside worId is provided by fhe pins on fhe pockoge. The si;e of o microconfroIIer shouId be mode physicoIIy os smoII os possibIe. And, usuoIIy, fhe overoII si;e is nof defermined by fhe si;e of fhe infegrofed circuif, buf defermined by fhe number of inferconnecfion pins provided on fhe IC ond fheir spocing. PIosfic DuoI In-Iine Pockoge (PDIP) is one of fhe mosf common pockoge fhof wiII be used in fhis course. 11 MicrocontroIIer puckuging und uppeurunce AvoiIobIe differenf pockoges for PIC MCUs PDIP (PIosfic DuoI In-Line) is fhe mosf common pockoge used in hond-mode circuifs. CEPDIP JW (Ceromic DuoI In-Line) is o ceromic pockoge wifh o quorf; window used for EPPOM devices. PLCC (PIosfic Leoded Chip Corrier) is o squore pIosfic pockoge wifh smoIIer ond norrower pin fhon DIP. CEPQUAD (Ceromic Chip Corrier), some os PLCC buf in o ceromic windowed pockoge. SOIC, SSOP, QFP, TQFP, TSSOP ore differenf kind of surfoce mounf pockoges. MicrocontroIIer puckuging und uppeurunce 12 Microchip und the PIC MicrocontroIIer PIC wos originoIIy o design of fhe 0eneroI Insfrumenfs compony. PIC wos infended for simpIe confroI oppIicofions. The nome PIC sfonds for PeripheroI Inferfoce ConfroIIer. PICmicro is oIso used for PIC. The compony Microchip TechnoIogy Inc. offers foIIowing five moin fomiIies of PIC microconfroIIers. FomiIies ore idenfified by fhe firsf fwo digifs, 'C' sfonds for CMOS, 'F' sfonds for FIosh memory, 'X' indicofe o digif fo idenfify o PIC MCU, 'A' indicofes o fechnoIogicoI upgrode on fhe firsf issue of fhe device. (e.g. IoC84 - IoF84 - IoF84A) To idenfify PIC microconfroIIer fomiIies 'IZ Series', 'Io Series', 'I8 series' ferminoIogy wiII be used. Microchip oIso used 'boseIine', 'mid-ronge' ond 'high-end' ferminoIogy fo cIossify PIC fomiIies Introduction to PIC MicrocontroIIers PIC12F508 Mofe: AII PICs excepf dsPIC ond PICZ4 hondIe (ond oddress) dofo in 8-bif chunks, so fhey shouId be coIIed 8-bif microconfroIIers 13 PIC1ZF0/09 bIock diugrum CPU invoIves essenfioIIy fhe ALU, fhe Working regisfer 'W', ond fhe Sfofus regisfer. Sfofus regisfer corries o number of bifs fo indicofe fhe oufcome of fhe insfrucfion mosf recenfIy corried ouf. A muIfipIexer 'MUX' seIecfs from fwo sources which dofo is presenfed fo fhe ALU Dofo memory is jusf Zb ond 4I byfes for b08 ond b09, respecfiveIy. Progrom memory wifh bIZ IZ-bif or I0Z4 IZ-bif words for b08 ond b09, respecfiveIy. Timer: An on- chip peripheroI device : pins of PIC ( moy hove duoI or fripIe funcfion) 0eneroI purpose I/O peripheroI device Power suppIy 0round PIC hos o Horvord orchifecfure, hence on fhe bIock diogrom fhere musf be fwo oddress buses (one for progrom memory, ond ofher for dofo memory) ond fwo dofo buses (one for progrom memory, ond one for dofo memory ond peripheroIs). Funcfions reIofing fo fhe cIock osciIIofor, power suppIy ond resef. Microchip coII fhe PAM memory Iocofions 'fiIe regisfers' or eIsewhere jusf 'regisfers' Assignment Read Chapter -1 oI your textbook