Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
22 views
Unit 1 - Intro
introduction to embedded systems
Uploaded by
Rashmi kumari
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Unit 1 - Intro For Later
Download
Save
Save Unit 1 - Intro For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
22 views
Unit 1 - Intro
introduction to embedded systems
Uploaded by
Rashmi kumari
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Unit 1 - Intro For Later
Carousel Previous
Carousel Next
Save
Save Unit 1 - Intro For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 17
Search
Fullscreen
|1.1_ MICROPROCESSOR , microprocessor, sometimes called a logic chip, is a computer processor on a microchip. ‘The microprocessor contains all, or most of, the central processing unit (CPU functions and is he “engine” that goes into motion when you turn your computer on). A microprocessor is designed to erform arithmetic and logic operations that make use of small number-holding areas called registers. ypical microprocessor operations include adding, subtracting, comparing two numbers, and fetching, umbers from one area to another. These operations are the result of a set of instructions that are part of he microprocessor design. When your computer is turned on, the microprocessor gets the first instruction from the basic nput/output system (BIOS) that comes with the computer as part of its memory. After that, either the 5108, or the operating system that BIOS loads into computer memory, or an application program is driving” the microprocessor, giving it instructions to perform. In PCs, the most popular microprocessor used is the Intel Pentium chip, whereas Macintosh omputers use the PowerPC chip (developed by Motorola, IBM, and Apple). ‘The speed of a microprocessor is measured in megahertz, or cycles per second. But higher regahertz doesn’t always mean better performance. Though a 600-MHz chip has a clock speed that is wice as fast as a 300-MHz chip, it doesn’t mean that the computer with the 600-MHz chip will run vice as fast. This is because the speed of a computer is also influenced by other factors, such as the fficiency of the processor, the bus architecture, the amount of memory available, and the software that s running on the computer. Some processors can complete more operations per clock cycle than other rocessors, making them more efficient than other processors with higher clock speeds. This is why the owerPC chip is typically faster than Pentium chips that are clocked at higher megahertz, ]1.2_ MICROCONTROLLER \ microcontroller is an integrated chip that is often part of embedded system. The microcontroller icludes a CPU, ROM, RAM, V/O ports and Timer like a standard computer but because they are designed > execute only a single specific task to control a single system, they are much smaller and simplified so 1~ BBBEB) Bz microcowmouen 100 Emecooen SYSTEMS ona single chip. Microcontrollers are sometimes catey Jude all the functions required hat they are part of an embedded system that is, one pap that they can incl which just means t! embedded microcontrollers, of a larger device or system. Microcontrollers have become co! mentations. mmon in various area and are found in home appliances computer equipment and instru "These are most used in automobiles and have become centrg, part of industrial Robotics. bz MICROPROCESSOR Vs. MICROCONTROLLER How, does microcontroller differ from microprocessor? ‘This question can be addressed from throg perspectives: 1. Hardware architecture 2. Applications 3. Instruction set features 1. Hardware Architecture: To highlight the difference between microcontroller ang microprocessor Figure 1.1 contrasts microprocessor system with microcontroller system. Control Bus CPU ROM vO ROM || Serial || Timer PORT COM Port General Purpose Microproc- essor t t t t t Data Bus Fig. 1.1 (a) General Architecture of a Microprocessor System cru ae Interrupt Microcontroller oo Control aa Timer Serial ee and COM Port Counter Fig. 1.1 (6) General Architecture of a MicrocontrollerIwHcKOPROCESSORS AND Microconreouens = | EM Mi cess ficroprocessor Microcontroller © Single Chip CPU. Single Chip * Ina single IC- A CPU, and much of remaining circuitry of a complete microcomputer system. * Besides CPU It includes RAM, ROM, Serial and Parallel interface, timer and interrupt handling circuitry all in single IC. © Microprocessor also implement interrupt but ‘* Have built in interrupt system. external components are required, * Microprocessors do not contain bit * Microcontrollers have bit addressable register. addressable registers, Applications: Microprocessor i Microcontroller * Microprocessors are used as CPU in micro * Microprocessor are suited to processing computer system. That is why they are information in computer system, Microcontrollers designed for and this is where their strength are used in small, minimum component design, lie. performing control oriented activities. A microcontroller reduce overall component count. * Microprocessor are suited to processing * These are suitable for control of 1A devices in information in computer system. design required minimum component size. 3. Instruction Set Features: As microprocessors and microcontrollers have separate field of applications, microcontrollers have somewhat different requirement for their instructions set than microprocessors. (a) Microprocessor instruction sets are “processing” intensive, implying they have powerful addressing modes with instruction catering to operations on large volume of data. Their instructions operate on nibbles, bytes, words or even double words. Microcontrollers on the other hand, have instruction sets catering to the control of inputs and outputs. The interface to many inputs and output uses a single bit. For example, a motor may be turned on and off by a solenoid energized by a 1 bit output port. (b) Microcontrollers possess instructions to set and clear individual bits and perform other bit oriented operations such as logically ANDing, ORing, or EXORing a bit, jumping if a bit is set or clear and so on. This powerful feature is rarely present in’ microprocessors which are usually designed to operate on bytes or larger unit of data. (c) The most instructions should be executed in a single byte i.e., instruction must be extremely compact. This feature is always desire. The program design must fit into the available on-chip ROM, since the addition external memory adds too much cost to the final product. Microprocessors powerful addressing modes bring with them a less than compact encoding of instructions. This feature is not found in microprocessor.ETRY = crcrnousn Esoen Sere ‘A brief comparison between the (wo e them functional, De SU eaistaed RAM/ROM, VO ports and timers externally 10 mk 5 Less number of pins with dual purpose: Take the system bulkier and much more Expensive- nd memory devices. lity on the amount of Jess — must Have the advantage of versati RAM/ROM and 1/0 ports, have external peripherals t0 interag > > More access time for V/O a > > by-itself, completely use Microprocessor, with outside world. > Single memory map for data and code. Microcontroller: and a of VO ports make them ideal for many > The fixed amount of on-chip ROM, RAM and space are critical. applications in which cost > More number of pins with dual purpose. > In many application the space it takes, the power it consumes, and the price per unit are much more critical considerations then the computing power. > Less access time for I/O and memory devices. > Microcontroller puts a limited amount of most coi “limited” amount is often “enough” for many applications. mmonly used resources “inside” the chip - > Separate memory map for data and code. Bi4 EMBEDDED SYSTEMS Embedded systems are basic electronic devices used to control, monitor or a the operation of equipment, machinery or a plant. The choice of word “embedded” reflects the fact that these are integral part of the system. Uses of embedded system in our real life are increasing day-by-day. Children need such systems to play video games and to operate chocolate vending machine, Housewives need embedded systems for microwave, TV, music system, and other system appliances. _ An embedded device can range from a relatively simple product for example a toaster to complex mission, critical applications such as those used in avionics. A typical embedded device will have both ardware and softwar ardwe i re components. The hardware could be micro components such as embedded microprocessor or microcontroller. Microcontroller is relatively small, has a on-chip memory, an I/O controller and other suppor 's of applications that perfor ee do processing and controlling tasks. The software consi: ledicat al ti i : aos and may run on aa time operating system which will be explained later in this unit. eee — sytem may be either an independent system ora part of a large system. Itis specialize ae “ pear a general purpose workstation like a desktop or a computer. Such kit ena single microprocessor board with programs which are stored in ROM (Re Ree ae eral a compact, portable and mass produced electronic devie™ y . P ere designed using microprocess ; we are using a wide range of processors from other a weyMicroprocessors ANO Mik Bofore we want (o the basic of an embedded system, we should see a In fact, almost all modem electronic devices use some sort of embedded syst and we always come aeross such devices: DVD players, air-conditioners. print handphone, digital camera, ATM machines, we will see some examples of em! Now it is time to give a proper definition, Definitions: “Embedded systems are devices which are used to control, operation of an equipment, machinery or plant.” The term “control” defines th Embedded system because their purpose is to control an aspect of a physical system temperature und so on, Also the term “monitor” defines the progress of activities. Embedded systems? From several examples listed earlier these systems are extremely home, vehicle and the workplace, At Ho range of its applications. technology inside them attendance machines, led system in unit-6. itor or assist the ‘ain function of ch as pressure, ete, In Motor Vehicle: Engine management, security (locking or anti-theft devie.), air conditioning, brakes, radio, etc. In Industry and Commerce: Machine control, factory automation, robotics, electhnic commerce office equipments. \ Figure 1.2 shows basic component used in embedded system \ Embedded System Microcontroller + Software Sensors Actuators Tt Uy Input Output Fig. 1.2 Basic Component of Embedded System Is APPLICATIONS OF MICROCONTROLLERS IN COMMUNICATION SYSTEM Microcontrollers are today’s choice in almost all fields like communication, defence medical field, industry, automation, consumer electronics, automobiles, etc. Revolution developments are also taking place in area of mobile devices. It is now used for accessing data, voice and video services. Anywhere latinn ne Anta vinina and widen annlication ie naw a reality Game af rocanteallarsIntroduction to Microcontrollers Baa DIFFERENT TYPES OF MICROCONTROLLERS _(MDU December 2013) Microcontrollers can be classified on the basis of internal bus width, architecture, memory and instruction set. Figure 2.1 shows the various types of microcontrollers. As of 2013 there are several dozen microcontroller architectures and vendors. The microcontroller market is extremely fragmented, with numerous vendors, technologies, and markets. Microcontrollers Bits Memory/devices Instruction set Memory/architecture | | I rT] l I i l 4 8 16 32 64 Embedded Extemal CISC SISC RISC Princeton Harvard Family 8051 “Motorola PIC Texas National ARM Others Intel Atmel Dallas Philips Siemens Fig. 2.1 Different Types of Microcontroller Microcontrollers are available in bit size like 8 bit, 16 bit, PIC microcontroller are available in M683 XX. Table 2.1 list important 1. Microcontroller based on bit size: 32 bit. 8 bit microcontrollers are Intel 8051, Atmel AT89C2051, both 8, 16 and 32 bit. Example of 32 bit microcontroller is motorola 4, 8, 16 bit microcontroller. 13Hitachi HMCS40 Intel 8051 Intel 8096 ARMOIM Toshiba TLCS47 National COP820 NationahHPCT6164 | IBM PowerPC 75074 p, National COP 420 | Rockwell 6500/1 Hitachi:H8/532 MCORE MMC209;, OKI:MSM6411 Zilog Z8 MO683XX family TMS1000. . Motorola 68HCI1 Signetics:87C552 2. Microcontroller based on memory/device: Based on memory/devices microcontroller available in two format, embedded microcontroller and external memory microcontroller, When hardware is embedded into microcontroller to run the desired application then it is called embe microcontroller. Such microcontroller which can address external memory are called extemal em microcontroller. 3. Microcontroller based on instruction set: According to instruction set two Lypes ¢ microcontroller have reported with RISC architecture and CISC architecture. For example, CISC dase microcontrollers are Motorola 68HCXX, Intel 80X86 and RISC based microcontroller are SPAR from Sun and IBM Power PC 601, 604 and Motorola MPC620. 4. Microcontroller based on memory architecture: Princeton response was a computer tha had common memory for storing the control program as well as variable and other data structures, j was best known by chief scientist's name “Von Neumann”. In contrast, Harvard's response was a dev that used separate memory banks for program storage, the processor stack, and variable RAM. PI microcontrollers from Microchip are example of Harvard architecture. 5. Microcontroller based on family/manufacturer: Different vendor are available in the marke with different architecture and instruction set like Intel, Atmel, Dallas, Philips, Siemens, Motorola, Some other popular microcontrollers are: Hitachi H8X family Samsung SAM8 Mitsubishi 740 National Semiconductor COP8 and CR16 [2.2 EMBEDDED MICROCONTROLLERS When entire hardware is available into a microcontroller unit to run the desired application then it called embedded microcontroller. This is useful in some of the applications where compactness ism For example, MCS-51 has V/O ports, serial COM, data memory, program memory, interrupts, St and counter on the chip is an embedded microcontroller. The complete hardware needed fot es applications have brought much advantage to the system design and it is possible at low cost compactness in size. In these microcontroller all the functional blocks (including program as We sé memory) is available on a chip. For example, 8051 having Program and Data Memory, U/O Potts Communication, Counters and Timers and Interrupt Control logic on the chip is an e™ microcontroller. Another example of embedded microcontroller is Atmel 89C20S1. Figure 22° block diagram of an embedded microcontroller,haromucrow ro Mexocowmoucs « AEEEEI CPU RAM Interrupt and ROM Control Embedded Microcontroller vo Timer Serial Port and Com Port counter Fig. 2.2 Embedded Microcontroller [2.3 EXTERNAL MEMORY MICROCONTROLLERS Sometimes the internal memory (RAM and ROM) may not be sufficient to serve the purpose. In such cases external memory interface is needed. Phe facility for addressing external program memory as well as data memory is available in most of the microcontrollers. Such microcontroller that can address extemal memory are called external memory microcontroller. In case of MCS-51 a portion of program execution is possible from on chip memory and a portion is possible from external memory. The requirement of memory depends on the program size which is entirely dependent on the application being developed. So external memory microcontroller becomes very useful for applications where on chip memory is unable to serve user need with its limited capacity. In external memory microcontroller, all or part of the memory units are externally interfaced using an interfacing circuit called the glue circuit. For example, 8031 has no program memory on the chip, is an external memory microcontroller. The external memory microcontroller block diagram is shown in Figure 2.3. Address bus on Memory Microcontroller [Data bus (RAM/ROM) Control bus Fig. 2.3 External Memory Microcontroller 2.4 PROCESSOR ARCHITECTURE Many years ago, the United State government asked Harvard and Princeton Universities to come up with a computer architecture to be used in computing tables of Naval artillery shell distance for varying elevations and environmental conditions.MicrocoNTROLLER AND EMBEDDED SYSTEMS 2.4.1 Princeton response was a comput Harvard and Princeton Architecture [MDU May 2012, Dec, 2013 ce that had common memory for storing the control program as wey 13) It was best known by chief scientist's name “Von Neuman ariable and other data structures. Figure 2.4 Memory Space 3 ROM 3S Program Data, 2 Memory , Addr_| Memory g and Data Variable #———J Interface Je} Processor 5 Memory RAM [,Ctel__| Unit and Built-in = Registers Stack RAM (a) Simple block diagram (0) Detailed block diagram (Courtesy Myke Predko, TMH) Fig. 2.4 Princeton or Von-Neumann Architecture was a design that used separate memory banks for progr ble RAM, Figure 2.5. In contrast, Harvard’s respon: storage, the processor stack, and vatia Control Space Data Program Addr "| Instruction Memot Decode tu lemory Ctrl 3 ¥ 5 Program PC Stack Register 8 ROM Space 2 Data Data Processor and [* Addi Memory ir ‘ister Interface Ctrl jqCtrl _J (a) Simple block diagram (b) Detailed block diagram (Courtesy Myke Predko, TMH) Fig. 2.5 Harvard Architecture Out of two, Princeton architecture won the competition because it was better suited 10 technology of that time. Using one memory was preferable because of the unreliability of © electronics. A single memory interface would have fewer things that could go wrong. The Von Neumann architecture is a computer design model that uses a processing vnit and? single separate storage structure to hold both instruction and data, It was named after mathemsi®™ and early computer scientist John Von-Neumann. The Princeton architecture's largest advantage it simplifies the microcontroller chip design because only one memory is accessed. The exam Princeton architecture is Motorola 68HC11.Harvard architecture is a architecture with a instruction and data, In this architecture there is no n in particular, width, timing, implementation techn memory is ofien wider than data memory, There is pre-fetched the current instruction is executed on t 2.4.2. CISC AND RISC PROCESSOR [MDU May 2012} CISC Proce r Pronounced sisk, and stands for Complex Instruction architecture, For instance Intel and AMD CPU's are based on CISC architecues Teele ny have a large amount of different and complex instructions. The philosophy behind swe Geng ees always faster than software, therefore one should make a powerful instruction cey on ch fad 7 programmers with assembly instructions to do a lot with short programs, In commoa CISC chin ven relatively slow (compared to RISC chips) per instruction, but use little (less than RISC) insinaereae Set Computer. Most PC’s ise CPU based on this CISC Characteristics 1, A large number of instructions—typically from 150 to 250, 2. Variable length instruction format, 3. Some instructions that perform specialized task and are used infrequently. 4, Instruction that manipulate operands in memory. 5. A large variety of addressing modes—typically from 5 to 20 different modes, RISC Processor Pronounced risk, and stands for Reduced Instruction Set Computer. RISC chips evolved around the mid-1980 as a reaction at CISC chips. The philosophy behind it is that almost no one uses complex assembly language instructions as used by CISC, and people mostly use compilers which never use complex instructions. Apple for instance uses RISC chips. Therefore fewer, simpler and faster instructions would be better, than the large, complex and slower CISC instructions. However, more instructions are needed to accomplish a task. An other advantage of RISC is that ~ in theory — because of the more simple instructions, RISC chips require fewer transistors, which makes them easier to design and cheaper to produce. Finally, its easier to write powerful optimized compilers, since fewer instructions exist. RISC Characteristics: 1. Relatively few instructions. 2. Memory access limited to load and store instructions. 3. Fixed-length, easily decoded instruction format. 4, Hardwired rather than micro programmed control. 5. Relatively few addressing modes. 6. All operations done within the register of the CPU SISC Processor ee Tefers to Specific Instruction Set Computer. a roca icrocontrollers have specific instructions required for a pal “roca instruction set are designed for specific purpose of control (for example powerful bit manipulation). lly microcontrollers are SISC based. jon, Microcontroller—2.5 MICROCONTROLLER MEmunt Lu ay 2044 grounds. According to storage con 2 ified on two In microcontrollers memory used can be classi ou Orage conte, , Figure 2.6 shows classificat types of memory are used data memory and program memory. Fig tion, ofa types of memory used in microcontroller. Program Memory : ‘A memory that contains the program (which we had written), after we've bumed it. AS a rq Program Counter executes commands stored in the program memory, one after the other, Microcontroller Memory a Physical Location Storage Content Storage Method }-> ROM Embedded Extemal [> NROM Memory Memory [> OTP ROM Program Data Memory Memory [> UV EPROM [> FLASH > RAM ‘_» EEPROM Fig. 2.6 Memory Classification for Microcontroller Data Memory This is RAM memory type, which contains a special registers like SFR (Special Faction Regist) GPR (General Purpose Register). The variables that we store in the Data Memory during the are deleted after we turn off the microcontroller. These two memories have separated data buses, which makes the access to each one of| very easy. Few authors have added one more category ‘Data EEPROM memory’ in addition of te? Each one of them has a different role. Program Memory and Data Memory, are the two memories ti needed to build a program, and Data EEPROM is used to save data after the microcontroller is Program Memory and Data EEPROM they are non-volatile memories, which store the informatio? after the power is turn off. These memories called Flash or EEPROM. In contrast, Data Memory save the information because it needs power in order to maintain the information stored in the i? Different Types of memory used in microcontroller are: Read Only Memory (ROM) Read Only Memory (ROM) is used to permanently save the program being executed. The si2@ that can be written depends on the size of this memory. Today’s microcontrollers como!) addressing, which means that they are able to address up to 64 Kb of memory, i.e., 65535! ofp El The sav val elec it’s emlfrermOnUCHON TO MiceocoNtROLitHs novice, your proguun will tarely exceed the limit of several hundied instructions, There are several types of KOM, Masked ROM (MROM) Masked ROM is a kind of ROM the ‘maxked’ comes from the Content of which is programmed by the manufacturer. The term nuamulacturing process, where regions of the chip are masked off before the process of photolithoyraphy. In case of a large-scale Production, the price is very low. Forget One Tine P nnuble ROM (OTP ROM) One time programmable ROM enables you tw download a prog time only. fan error is detected after downloadin program to another chip, mn into it, but, as its name states, one if You can do is to download the correet the only t UV Erasable Programmable ROM (UV EPROM) Both the manufacturing process and characteristics of this memory are completely identical to OTP ROM. However, the packaye of the microcontroller with this memory has a recognizable ‘window’ on its top side. He ala to be . After a few n to download a new program into it, lables, ased under strong ultravi ites it is possible Installation of this window is complicated, which normally affects the price. From my point of view, unfortunately-nepative... Flash Memory id in the 80s in the laboratories of INTEL and was represented as the successor to the UV EPROM, Since the content of this memory can be written and cleared practically an unlimited number of times, microcontrollers with Flash ROM are ideal for learning, experimentation ly, most microcontrollers are manufactured in ‘This type of memory was inven production, B use Of its great popu voing to buy a microcontroller, the type to look for is definitely flash technology today. So, if you are Flash! Random Access Memory (RAM) Once the power supply is off the contents of RAM is cleared, I is used for temporary storing data and intermediate results created and used during the operation of the microcontroller, User program and dala to be executed are stored in RAM with the continual drop in the per byte cost of the RAM, microcontroller contains million of bytes of RAM. User program and data to be executed are stored in RAM with the continual drop in the per byte cost of the RAM, microcontroller contains million of bytes of RAM. Electrically Erasable Programmable ROM (EEPROM) The contents of EEPROM may be changed during operation (similar to RAM), but remains permanently saved even after the loss of power (similar to ROM). Accordingly, EEPROM is often used to store Valucs, created during operation, which must be permanently saved. For example, if you design an er to create 2 sword, but electronic clock or an alarm, it would be great to enable the user to create and enter the pass The idea ion i croc er with an it’s useless if Jost, every time the power supply goes off, The ideal solution is a microcontroller embedded HEPROM.edt) below, ares of several memory are sho Atable comparing various ‘Table 2.2: Comparison of Features of Different Memories 2 Erase Cycles | Cost (per Byte) Type Volatile? | Writeable? Max Erase Cy RAM Yes Yes Unlimited | __ Expensive asked = 5 No wa Inexpensive ROM _—— i joderate PROM No | Once, with a device wh vd programmer EPROM No Yes. with a device Limited (consult Moderate: programmer datasheed) EEPROM| No Yer Limited (consult Expensive Fstowahagt datasheed) 10 erasehriye | Flash No Yes Limited (consult Moderate Fast to red ioe datasheed) 10 ersehne | NVRAM | No Yes Unlimited Expensive Far 2.6 MI INTROLLER FEATURES MDU December 2013) I ICROCO! [ be 205 2.6.1 Clocking All microcontrollers require a clock (or an oscillator) to operate, On most microcontroller there is bu in circuitry to allow a simple connection of a crystal or other hardware, such as ceramic resonator org - The clock is usually provided by connecting external timing devices to th microcontroller. Most microcontrollers will generate clock signals when a crystal and two small capacitor are connected. Some will operate with resonators or external resistor-capacitor pair. Some microcontralle have built-in timing circuits and they do not require any external timing components. The microconttl clock is used to sequence the execution of the instructions. An instruction is executed by fetching from the memory and then decoding it. This usually takes several clock cycles and is known as t instruction cycle (Figure 2.7). external clock sourc Clock. cycle tntnction Ys cycle 4 1 Instruction cycle Fig. 2.7 Instruction cycle vs. Clock cycle i i s it _In true 8051, each instruction cycle take 12 clock cycles to execute but in practical cont requiring 12 cycles for each instruction is not practical in microcontroller opetlio™INTROOUCHON To Mu eee cartecntes @ Lene are running at one clock cycle per instruction cycle. Dalles micrecsntrhier only four clock cycle per instruction cycle, thus instruction exeencs i a : ; ‘coution speed is apgrtmisraaely of true 8051 microcontroller. eas In PIC microcontrollers, an instruction cycle takes four clock periods, Thus, the snicecernterd is actually operated at a clock rate, which is a quarter of the actual encillaten frequency. Fox ex PIC microcontroller operating at 4-MHz. clock, the instruction cycle time is only I ys requ 1 MHz). The PICI8F series of microcontrollers can operate with clock frequencies ug to 4 9 2.6.2 1/O Pins In order to make the microcontroller useful, it has to be connected to additional electeemics, ie. peripherals. Each microcontroller has one or more registers (called ports) conniccted to the rieroces: pins. For example, suppose you want your device to turn on/off three LEDs and simultzxeranly re the logic state of five sensors. Some of the ports need to be configured 40 thas there (connected to LEDs) and five inputs (connected to sensors). VO circuits are vervatile feture of microcontroller that connects it with outside world. A port consist of a latch,-an output driver xd ax input buffer. A general bidirectional I/O port structure is shown in Figure 2.4. ee oh Dr Control Signal Read Latch Intemal CPU Bus tI Q Conrail Write to Latch ce O Logie | | D Latch (SFR Latch) | Read Pin Fig. 2.8 General /O Port Structure pe output latch in microcontroller. Each port has a specific addvess es. In Figure 2.8, two data path are the status of each latch may be read For each pin there is D ty] assign to it. The SFR for each port is made up of these 8 D latch shown that read the latch or pin data using two separate buffer. T) from a latch buffer. 2.6.3 Interrupts [MDU May 2012] i i a act to events. Events sigt Microcontrollers tend to be deployed in systems that have to re st sen yme sort of reaction by the microcontroller. Reactions in the controlled system and generally require so mi a range from a eee like incrementing a counter whenever & ee 2 pos aa barrier on the conveyor belt to time-critical measures like shutting down tt ee a into the working area of a machine. Assuming that the controller can observ te eee an input line that changes its state to indicate the event, there is still ihe ae eee should monitor the input line to ensure a proper and timely reaction. Fo! ee eel itself offers a convenient way in the form of interrupts. Here, the microco!BE. m MicroconTROUER AND EmseppeD SYSTEMS: ge is detected. As long as there is. no state change ut the event. As soon as the event Occurs handles the event, The ISR must be proy, if a state chan thout any concerns abot rvice routine (ISR) whiel interrupts the main program only | main program simply executes wi microcontroller calls an interrupt se fhe application programmer. cemnon by the appl + is the occurrence of a condition, an event that causes a temporary suspension ‘An interrupt is dition is serviced by another program. An interrupt driven system Bives ity ile the condition tt vy simultaneously. Processor cannot execute More than one instry atyeteat Gale ooepend Srvring main/irst program after this Eoes 10 iNlerTypt pry eae ee program and then finally retums (0 main/first program. The Prograny associated with interrupt is called ISR (Interrupt Service Routine). Steps taken by Microcontroller in executing an interrupt: , i Whenever an interrupt activates, microcontroller takes following steps to execute it, 1. Microcontroller finishes executing current instruction (give it name main program), content/address of program counter) to the stacky program while th 2, It save address of next instruction (i.e., pushing two byte of program counter into sta 3. Iejumps to interrupt vector table. Interrupt vector table is a fixed memory location, Ike the address of ISR. 4, From interrupt vector table microcontroller gets the address of ISR. It starts executi instructions of Interrupt service subroutine (ISS). In every ISS last instruction is alwa RETI (Return from subroutine). This is the last instruction to be executed of a ISS, Now microcontroller returns to main program, where it was interrupted. It gets address of progr counter (saved to Stack in step 2) from Stack by popping two byte of stack into program counter, At getting address it starts executing the program. Interrupts are defined as request as they can be masked (or refused). If they are not masked, th whenever an interrupt request is received the interrupt handler or interrupt service routine follow special set of event (Figure 2.9). Main Program Execution Resume (Before pe Interrupt rogram Request) Execution| ISR. a; | ISR Retum Save | Rstin | 41, Restore] to Register] HW landle i" j Interrupt | Register] Main Program Fig. 2.9 Interrupt Execution‘Timers are important parts of any microcontroller, A timer is basically a counter, which is driven eithe: by an extemal clock pulse or by the internal oscillator of the miicrocontiller A timer ene fn len wide, Data can be loaded ilo a timer under program control and the timer ean be stopped or started by Program control. Most timers can be configured to generate an interrupt when they reach n certain eon (usually when they overflow). The interrupt ean be used by the user progam to catty owt necean timing-related operations inside the microcontroller eee ecurate A basic computer timer consist of a counter that a ne ean be read from or writtel ¢ proces is shown in Figure 2.10. The or written (0 by the processor fue of a counter ean be read from or wri ing mi wn in} ‘ written (0 during microprocessor operation. If the counter overflows, an interrupt request is made of the processor, " Data Bi External — my Counter Intermal —J Select &X Overflow (OF) Interrupt Fig, 2.10 Basic Computer Timer This timer provides an interrupt request on overflow. ‘The clock source for counter is either external source or microcontroller’s clock. The microcontroller oscillator uses quartz, erystal for jts operation. Even though it is not the simplest solution, there are many reasons to use it. The frequency of such 03 sely defined and very stable, so that pulses it gen width, which makes them ideal for time measurement, Such oseillators are Ifitis necessary to measure time between two events, it is sufficient to count up pulses generated by thi oscillator. Thi If the timer uses an internall quartz oscillator for i between two events (if the register value is TI at the moment measurement starts, d time is equal to the result of subtraction T2 — TL). If registers use pulses tes are always of the same tz, watches Iso used in qt s exactly what the timer does. an be used to measure time and T2 at the moment operation then it it terminates, then the elaps coming from external source then such a timer is turned into a counter, This is only a simple explanation of the operation itself, IL is however more complicated in practice. 2.6.5 Peripherals Peripherals have been added to microcontroller of the common peripheral is interface. Important peripherals are discussed below. fo create devices suited for particular application, One 2.6.5.1 Buses The connections between various blocks of a computer system are of wires that carry a specific type of information, In general, every computer address bus, data bus, and control bus. called buses, A bus is a common set stem has three busenin a computer system. Itis a unidirecti, x ‘ore bits in larger systems. An address 4 smory chips. This bus is also used to cay TREE 8 Microconsnve artie Address Bus: An address bus © bus having 16 bits in small computer syste usually carries the memory addresses from ‘h the /O addresses in many computer systems. ‘a bus carries the data in a comput en more bits in In addition, data is carried to other 5 the address informatio1 ms and 32 or m« the CPU to the met er system. It is a bidirectional bus having 8 bits larger systems. A data bus carries the memory day parts of a computer via the dy, Data Bus: A dat small systems and 14, 16, 32, or ev from the CPU to the memory chips. bus. is usually a smaller bus and is used to provide control signals to most : The control bus P ‘ Control Bus: The memory read and write control signals are carried by the control by, of a computer system. For example, 2.6.5.2 Serial /O Serial communication (also called RS232 communication) enables a microcontroller to communica with other devices using the serial RS232 communication protocol. For example, a microcontroller ca be connected to another microcontroller or to a PC and exchange data using the serial communication protocol. Some microcontrollers have built-in hardware called universal synchronous-asynchronous receiver-transmitter (USART) to implement a serial communication interface. The baud rate and the data format can usually be selected by the user program. If serial I/O hardware is not provided, itis easy to develop software to implement the serial data communication using any I/O pin of a microcontroller, The PICI8F series of microcontrollers have built-in USART modules. Some microcontrollers (¢.g., PIC18F series) incorporate a serial peripheral interface (SPI) or an integrated interconnect (I2C) hardware bus interface. These enable a microcontroller to interface to other compatible devices easily.
You might also like
Digital Calendar
PDF
100% (8)
Digital Calendar
58 pages
Embedded Systems
PDF
100% (1)
Embedded Systems
27 pages
6W 002 Training Report Draft
PDF
No ratings yet
6W 002 Training Report Draft
67 pages
Micro-Controller: Embedded: Designing & Programming Using Arduino
PDF
No ratings yet
Micro-Controller: Embedded: Designing & Programming Using Arduino
18 pages
ES&RTOS-Firstppt IMODULE
PDF
No ratings yet
ES&RTOS-Firstppt IMODULE
582 pages
Lec - 6-Microprocessser and Microcontroler
PDF
No ratings yet
Lec - 6-Microprocessser and Microcontroler
17 pages
The 8051 Micro Controller and Embedded Systems CH1
PDF
No ratings yet
The 8051 Micro Controller and Embedded Systems CH1
12 pages
MODULE 1 8051 Microcontroller
PDF
No ratings yet
MODULE 1 8051 Microcontroller
14 pages
About Microcontroller
PDF
No ratings yet
About Microcontroller
18 pages
4351703_IOT_A&R_UNIT-3_PNP
PDF
No ratings yet
4351703_IOT_A&R_UNIT-3_PNP
8 pages
8051 Microcontroller
PDF
No ratings yet
8051 Microcontroller
50 pages
Intro 1
PDF
No ratings yet
Intro 1
24 pages
MC 8051-Mazidi
PDF
No ratings yet
MC 8051-Mazidi
12 pages
Basics of Microcontroller
PDF
100% (3)
Basics of Microcontroller
27 pages
Chapter 1
PDF
No ratings yet
Chapter 1
47 pages
CHAPTER 1 and 2, microcontrollers
PDF
No ratings yet
CHAPTER 1 and 2, microcontrollers
38 pages
Chapter 1 Intro To Micropro
PDF
No ratings yet
Chapter 1 Intro To Micropro
22 pages
Monograph
PDF
No ratings yet
Monograph
19 pages
Module-3-Mechatronics
PDF
No ratings yet
Module-3-Mechatronics
11 pages
MA Unit1 Part 1
PDF
No ratings yet
MA Unit1 Part 1
70 pages
MICROPROCESSORS
PDF
No ratings yet
MICROPROCESSORS
56 pages
ELX 302 MicroController System 1.0 LM 1st Sem 24 25
PDF
No ratings yet
ELX 302 MicroController System 1.0 LM 1st Sem 24 25
45 pages
Chapter 1 - Introduction To Embedded System
PDF
100% (1)
Chapter 1 - Introduction To Embedded System
22 pages
Difference Between Microprocessor and Microcontroller
PDF
No ratings yet
Difference Between Microprocessor and Microcontroller
4 pages
Chapter 1 Introduction to Embedded Syste
PDF
No ratings yet
Chapter 1 Introduction to Embedded Syste
24 pages
Topic 1 Introduction To Embedded System (ISMAIL - FKEUTM 2020)
PDF
No ratings yet
Topic 1 Introduction To Embedded System (ISMAIL - FKEUTM 2020)
37 pages
MICROCONTROLLER
PDF
100% (4)
MICROCONTROLLER
141 pages
Batch 6
PDF
No ratings yet
Batch 6
75 pages
Microprocessor Vs Microcontrollers
PDF
No ratings yet
Microprocessor Vs Microcontrollers
5 pages
Introduction To Embedded Systems
PDF
100% (1)
Introduction To Embedded Systems
33 pages
Microcontroller Architecture and Programming
PDF
No ratings yet
Microcontroller Architecture and Programming
24 pages
Group1 Module1 Es
PDF
No ratings yet
Group1 Module1 Es
7 pages
Chapter 1 Introduction To Embedded Syste
PDF
No ratings yet
Chapter 1 Introduction To Embedded Syste
24 pages
Microcontroller and Applications
PDF
No ratings yet
Microcontroller and Applications
115 pages
EEAC 110 Learning Material 1
PDF
No ratings yet
EEAC 110 Learning Material 1
11 pages
Chapter 0
PDF
No ratings yet
Chapter 0
36 pages
Intro - Embedded Systrems
PDF
No ratings yet
Intro - Embedded Systrems
15 pages
Chapter-1 Introductionto Embedded System
PDF
No ratings yet
Chapter-1 Introductionto Embedded System
40 pages
CH 2
PDF
No ratings yet
CH 2
59 pages
MCU Overview
PDF
No ratings yet
MCU Overview
38 pages
It_(r22)_3-2_embedded Systems Design Digital Notes
PDF
No ratings yet
It_(r22)_3-2_embedded Systems Design Digital Notes
116 pages
1 Course Material - All Chapter 04-01-2024
PDF
No ratings yet
1 Course Material - All Chapter 04-01-2024
148 pages
Difference Between Microprocessor and Microprocessor
PDF
No ratings yet
Difference Between Microprocessor and Microprocessor
10 pages
In-House Training Report On Embedded System
PDF
No ratings yet
In-House Training Report On Embedded System
23 pages
Eeac 110 Learning Material 1 (Microprocessor)
PDF
No ratings yet
Eeac 110 Learning Material 1 (Microprocessor)
12 pages
CS3691 ESIOT Soft Copy Notes
PDF
No ratings yet
CS3691 ESIOT Soft Copy Notes
128 pages
Topic 1-Intro To Es - Part 1
PDF
No ratings yet
Topic 1-Intro To Es - Part 1
39 pages
Introduction To Embedded System: MD Hafriz Fikrie Bin MD Hussin Subject
PDF
No ratings yet
Introduction To Embedded System: MD Hafriz Fikrie Bin MD Hussin Subject
24 pages
Chapter 1 Introduction To Embedded Syste
PDF
No ratings yet
Chapter 1 Introduction To Embedded Syste
24 pages
Presentation of 8051
PDF
No ratings yet
Presentation of 8051
178 pages
PDR - Unit I
PDF
No ratings yet
PDR - Unit I
16 pages
1.PIC introduction
PDF
No ratings yet
1.PIC introduction
11 pages
Esd 1
PDF
No ratings yet
Esd 1
40 pages
Embedded system PPT
PDF
No ratings yet
Embedded system PPT
17 pages
1 History of Microprocessor
PDF
No ratings yet
1 History of Microprocessor
80 pages
Unit I _04.09.24_
PDF
No ratings yet
Unit I _04.09.24_
158 pages
Microcontroller and Microprocessor Part I
PDF
No ratings yet
Microcontroller and Microprocessor Part I
72 pages
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
Digital Calendar
PDF
Digital Calendar
Embedded Systems
PDF
Embedded Systems
6W 002 Training Report Draft
PDF
6W 002 Training Report Draft
Micro-Controller: Embedded: Designing & Programming Using Arduino
PDF
Micro-Controller: Embedded: Designing & Programming Using Arduino
ES&RTOS-Firstppt IMODULE
PDF
ES&RTOS-Firstppt IMODULE
Lec - 6-Microprocessser and Microcontroler
PDF
Lec - 6-Microprocessser and Microcontroler
The 8051 Micro Controller and Embedded Systems CH1
PDF
The 8051 Micro Controller and Embedded Systems CH1
MODULE 1 8051 Microcontroller
PDF
MODULE 1 8051 Microcontroller
About Microcontroller
PDF
About Microcontroller
4351703_IOT_A&R_UNIT-3_PNP
PDF
4351703_IOT_A&R_UNIT-3_PNP
8051 Microcontroller
PDF
8051 Microcontroller
Intro 1
PDF
Intro 1
MC 8051-Mazidi
PDF
MC 8051-Mazidi
Basics of Microcontroller
PDF
Basics of Microcontroller
Chapter 1
PDF
Chapter 1
CHAPTER 1 and 2, microcontrollers
PDF
CHAPTER 1 and 2, microcontrollers
Chapter 1 Intro To Micropro
PDF
Chapter 1 Intro To Micropro
Monograph
PDF
Monograph
Module-3-Mechatronics
PDF
Module-3-Mechatronics
MA Unit1 Part 1
PDF
MA Unit1 Part 1
MICROPROCESSORS
PDF
MICROPROCESSORS
ELX 302 MicroController System 1.0 LM 1st Sem 24 25
PDF
ELX 302 MicroController System 1.0 LM 1st Sem 24 25
Chapter 1 - Introduction To Embedded System
PDF
Chapter 1 - Introduction To Embedded System
Difference Between Microprocessor and Microcontroller
PDF
Difference Between Microprocessor and Microcontroller
Chapter 1 Introduction to Embedded Syste
PDF
Chapter 1 Introduction to Embedded Syste
Topic 1 Introduction To Embedded System (ISMAIL - FKEUTM 2020)
PDF
Topic 1 Introduction To Embedded System (ISMAIL - FKEUTM 2020)
MICROCONTROLLER
PDF
MICROCONTROLLER
Batch 6
PDF
Batch 6
Microprocessor Vs Microcontrollers
PDF
Microprocessor Vs Microcontrollers
Introduction To Embedded Systems
PDF
Introduction To Embedded Systems
Microcontroller Architecture and Programming
PDF
Microcontroller Architecture and Programming
Group1 Module1 Es
PDF
Group1 Module1 Es
Chapter 1 Introduction To Embedded Syste
PDF
Chapter 1 Introduction To Embedded Syste
Microcontroller and Applications
PDF
Microcontroller and Applications
EEAC 110 Learning Material 1
PDF
EEAC 110 Learning Material 1
Chapter 0
PDF
Chapter 0
Intro - Embedded Systrems
PDF
Intro - Embedded Systrems
Chapter-1 Introductionto Embedded System
PDF
Chapter-1 Introductionto Embedded System
CH 2
PDF
CH 2
MCU Overview
PDF
MCU Overview
It_(r22)_3-2_embedded Systems Design Digital Notes
PDF
It_(r22)_3-2_embedded Systems Design Digital Notes
1 Course Material - All Chapter 04-01-2024
PDF
1 Course Material - All Chapter 04-01-2024
Difference Between Microprocessor and Microprocessor
PDF
Difference Between Microprocessor and Microprocessor
In-House Training Report On Embedded System
PDF
In-House Training Report On Embedded System
Eeac 110 Learning Material 1 (Microprocessor)
PDF
Eeac 110 Learning Material 1 (Microprocessor)
CS3691 ESIOT Soft Copy Notes
PDF
CS3691 ESIOT Soft Copy Notes
Topic 1-Intro To Es - Part 1
PDF
Topic 1-Intro To Es - Part 1
Introduction To Embedded System: MD Hafriz Fikrie Bin MD Hussin Subject
PDF
Introduction To Embedded System: MD Hafriz Fikrie Bin MD Hussin Subject
Chapter 1 Introduction To Embedded Syste
PDF
Chapter 1 Introduction To Embedded Syste
Presentation of 8051
PDF
Presentation of 8051
PDR - Unit I
PDF
PDR - Unit I
1.PIC introduction
PDF
1.PIC introduction
Esd 1
PDF
Esd 1
Embedded system PPT
PDF
Embedded system PPT
1 History of Microprocessor
PDF
1 History of Microprocessor
Unit I _04.09.24_
PDF
Unit I _04.09.24_
Microcontroller and Microprocessor Part I
PDF
Microcontroller and Microprocessor Part I