Embedded Systems

System:
A system is a way of working, organizing or doing one or many tasks according to a fixed plan, program, or set of rules. e.g. 1. Time display system 2. Automatic clothes washing system

Embedded System:
The embedded system is a combination of computer hardware, software additional electrical & mechanical parts.. It is a dedicated computer based system for an application or product. As its s/w usually embeds in ROM, it does not need secondary memories as in commuter. As embedded system has s/w assigned to keep in view three constraints 1. Available system memory 2. Available processor speed 3.the need to limit power dissipation when running the system continuously in cycles in cycles of wait for events ,run, stop, wake-up. These are Real-time systems process events. These events occur on external inputs cause other events to occur as outputs. Minimizing response time is usually a primary objective, or otherwise the entire system may fail to operate properly Therefore embedded systems employ the use of a RTOS (Real-Time Operating System) It is Operating Systems with the necessary features to support a Real-Time System Real-Time System A system where correctness depends not only on the correctness of the logical result of the computation, but also on the result delivery time. It responds in a timely, predictable way to unpredictable external stimuli arrivals.
Semiconductor Technologies – VEDANT, Lucknow 1

limited Random Access memory 4. Locating Some common characteristics • Single-functioned – Executes a single program. etc.The real Time Systems can be further divided into two types:  Soft Real-Time System Compute output response as fast as possible. Linking 4. Absence of standard input/output devices BUILD PROCESS: The process of translating the code that is written by humans to the code that is understandable by the microprocessor. Steps involved in transforming the source code to the final executable format are listed below: 1. low power. Interaction with hardware 6. Preprocessing 2. Lucknow 2 . repeatedly • Tightly-constrained – Low cost. but no specific deadlines that must be met. CHALLENGES FOR EMBEDDED SYSTEMS: 1.  Hard Real-Time System Output response must be computed by specified deadline or system fails. limited secondary memory 3. Compiling 3. limited processing power 5. small. limited operating system support for programming 2. • Reactive and real-time – Continually reacts to changes in the system’s environment BuiThes e are Real- Semiconductor Technologies – VEDANT. fast.

e. widely-abused – Clock frequency. and controller tells that the device might be used to control objects. Micro Suggests that the device is small. because the microcontroller and Semiconductor Technologies – VEDANT. a single-chip computer. safety. many more He performance design metric: • Widely-used measure of system. instructions per second – not good measures • Latency (response time) – Time between task start and end • Throughput – Tasks per second. or. Lucknow 3 . Another term to describe a microcontroller is embedded controller.g. processes. or events. Camera A processes 4 images per second • Speedup of B over S = B’s performance / A’s performance – Throughput speedup = 8/4 = 2 Microcontroller A microcontroller is a computer-on-a-chip.– Must compute certain results in real-time without delay Design Challenges (optimizing design metrics): • Common metrics – Unit cost: the monetary cost of manufacturing each copy of the system. excluding NRE cost – NRE cost (Non-Recurring Engineering cost): The one-time monetary cost of designing the system – Size: the physical space required by the system – Performance: the execution time or throughput of the system – Power: the amount of power consumed by the system – Flexibility: the ability to change the functionality of the system without incurring heavy NRE cost – Time-to-prototype: the time needed to build a working version of the system – Time-to-market: the time required to develop a system to the point that it can be released and sold to customers – Maintainability: the ability to modify the system after its initial release – Correctness.

Lucknow 4 . controls. Any device that measures. portable devices. calculates. Different aspects of a microprocessor/controller  Hardware :Interface to the real world  Software :order how to deal with inputs The necessary tools for a microprocessor/controller         CPU: Central Processing Unit I/O: Input /Output Bus: Address bus & Data bus Memory: RAM & ROM Timer Interrupt Serial Port Parallel Port Semiconductor Technologies – VEDANT. and other peripherals Why do we need to learn Microprocessors/controllers?  The microprocessor is the core of computer systems. the devices they control. or embedded in. printers.  A designer should know what types of components he needs. and often more to control additional systems in the car. In desktop computers. The largest single use for microcontrollers is in automobiles—just about every car manufactured today includes at least one microcontroller for engine control. you can find microcontrollers inside keyboards. are controlled by them. We can find microcontrollers in all kinds of things these days. or displays information is a candidate for putting a microcontroller inside. modems.its support circuits are often built into. digital entertainment.  Nowadays many communications. stores. ways to reduce production costs and product reliable.

technical support 3. Microcontroller Microprocessor  CPU is stand-alone. emulator. video game player Three criteria in Choosing a Microcontroller 1. meeting the computing needs of the task efficiently and cost effectively • speed. I/O. wide availability and reliable sources of the microcontrollers Semiconductor Technologies – VEDANT.Microprocessor vs. the number of I/O ports and timers.  In an embedded system. power and space are critical • single-purpose Embedded system  Embedded system means the processor is embedded into that application. availability of software development tools • assemblers.  An embedded product uses a microprocessor or microcontroller to do one task only. RAM. power consumption • easy to upgrade • cost per unit 2. the amount of ROM and RAM. timer are separate  Designer can decide on the amount of ROM. ROM. there is only one application software that is typically burned into ROM. I/O and timer are all on a single chip • fix amount of on-chip ROM. simulator.  expansive  versatility  general-purpose Microcontroller • CPU. RAM. I/O ports • for applications in which cost. debuggers. size.  Example printer. RAM. ROM. C compilers. keyboard. packaging. RAM and I/O ports. Lucknow 5 .

Semiconductor Technologies – VEDANT. Lucknow 6 .

07 for bank 0 (default) Active bank selected by bits [ RS1.17 for bank 2 08 . R0 to R7 Addresses are : 18 . Lucknow .0F for bank 1 00 . bit manipulations Control Transfer : Unconditional 7 Semiconductor Technologies – VEDANT.Features of 8051 • • • • • • • • • 8 bit CPU optimized for control applications Harvard Architecture Extensive Boolean processing capabilities 4K B on chip program memory 128 bytes on chip data Ram 32 bit bi directional I/O Two sixteen bit timer counters Full duplex UART Powerful Interrupt structure Register Banks Four banks of 8 byte-sized registers. Permits fast “context switching” in interrupt service routines (ISR). Instruction Set • • • • Data transfer Arithmetic Mul/Div Logic Byte. RS0 ] in PSW.1F for bank 3 10 .

#INDEX . A = index • Semiconductor Technologies – VEDANT. DPTR=address of TABLE (CM) MOV A. JMP.) and JMP instructions: – MOVC A. RET 8051 Addressing Modes • ADD • ADD • Immediate: operand is constant contained in instruction A. Mem[30H] = 11 Register indirect: operand is memory cell whose address is contained in register – Restrictions: • only 8-bit registers R0 and R1.@A+PC – JMP @A+DPTR Indexed: – Example 2.@A+DPTR – MOVC A. implementing case/switch statement using jump table: MOV DPTR. Mem[DPTR] = A • • Indexed: operand is memory cell whose address is the sum of two registers – Restrictions: • only applies to MOVC (move constant/move from code mem.JNZ. and 16-bit register DPTR may be used INC @R1 MOVX @DPTR.JNB.JB.ACALL .A . JMP @A+DPTR Conditional JZ. LCALL.DJNZ.#31 Register: operand is register A.#TABLE . Lucknow 8 .R0 Direct: operand is memory cell whose address is contained in instruction MOV 30H.JBC CJNE.#11 .

A = A*B DIV AB A = A/B B=A DA A A(hex) = Semiconductor Technologies – VEDANT.. A *= 2 JMP @A+DPTR . the jump itself ..reg|dir|indir|immA=A^oper XRL dir. Lucknow .reg|dir|indir|immA=A+oper ADDC A. AJMP CASE0 AJMPCASE1 AJMPCASE2 8051 Arithmetic Instructions Instruction increment decrement add add with carry with borrow multiply divide %B decimal adjust A(dec) 8051 Logical Instructions Instruction bitwise AND bitwise OR bitwise XOR clear complement rotate left rot left w carry Mnemonic Meaning ANL A.A|imm dir=dir&opr ORL A.TABLE RL A .A|imm dir=dir|opr XRL A. SUBB A.reg|dir|indir|immA=A+oper+Csub.reg|dir|indir|immA=A&oper ANL dir.reg|dir|indir|immA=A-oper-C MUL AB B.A|imm dir=dir^opr CRL A A=0 CPL A A=~A RL A RLC A 9 Mnemonic Meaning INC A|reg|dir|indir|DPTR oper++ DEC A|reg|dir|indir oper-ADD A.reg|dir|indir|immA=A|oper ORL dir.

Lucknow .indir move extern MOVX A.A =A mv code mem MOVC A.rotate right rot right w carry swap A[4:7] RR A RRC A SWAP A[0:3]<-> A 8051 Copy and Transfer Instructions Instruction move Mnemonic MOV MOV MOV MOV MOV Meaning A.@reg|@DPTR A = oper MOVX @reg.A|dir|imm reg = oper dir.reg|dir|indir XCHD A.A =A MOVX @DPTR.imm16 DPTR oper on oper of A <-> oper A[0:3] <-> oper[0:3] oper oper A= = imm16 push stack pop stack exchange PUSH dir POP dir XCH A.@A+DPTR|@A+PC oper 8051 Boolean Instructions Instruction and oper or Mnemonic ANL C.A|reg|dir|indir|imm dir = oper indir.reg|dir|indir|imm A = oper reg.A|dir|imm indir = oper DPTR.bit|/bit Meaning C=C& C = C | oper 10 Semiconductor Technologies – VEDANT.bit|/bit ORL C.

reladdr PC = PC +/. !C bit !bit bit.move bit clear bit set bit complement Bit manipulation MOV C. PC[15:11]#addr11 call unc.reladdr JBC bit. goto PC (from subroutine) RETI (from interrupt) PC = PC+1 reladdr PC = PC +/.127 if PC = PC +/.127 PC = LJMP addr16 PC = addr16 JMP @A+DPTR PC = A+DPTR ACALL addr11 push PC PC = push PC.127 if PC = PC +/.127 if . PC[15:11]#addr11 LCALL addr16 addr16 return no operation NOP jump cond. PC = RET JC pop PC.127 if bit = 0 Semiconductor Technologies – VEDANT.bit MOV bit. Lucknow 11 Mnemonic SJMP reladdr AJMP addr11 Meaning PC = PC +/.C CLR C CLR bit SETB C SETB bit CPL C CPL bit C = bit bit = C C=0 bit = 0 C=1 bit = 1 C = !C bit = !bit • Bit addressing can only be applied to internal RAM addresses 20H2FH and SFR addresses that end at 0 or 8 • Carry flag works as Accumulator 8051 Jump Instructions Instruction jump unc.reladdr JNB bit. JB bit.127 if C JNC reladdr PC = PC +/.

127 if A!=opr CJNE reg. PC = PC +/.. and user bit vars occupy internal RAM addresses 08H-2FH • Special instructions: – PUSH op – POP op – op must be specified using direct addressing! General-purpose processors • Programmable device used in a variety of applications – Also known as “microprocessor” • Features – Program memory – General datapath with large register file and general ALU • User benefits – Low time-to-market and NRE costs – High flexibility • “Pentium” the most well-known. alternate register banks 1.| dir--.imm.reladdr PC = PC +/. if you push a value onto the stack. Lucknow 12 .dir|imm.reladdr PC = PC +/.reladdr PC = PC +/.127 if reg|dir!=0 CJNE A.127 if reg!=imm CJNE indir.127 if indir!=imm Subroutines • 8051 stack grows from low addresses to high addresses • SFR SP (address 81H) points to top of stack. 2.reladdr PC = PC +/.127 if PC = PC +/. i. it will be stored at address SP+1 • Be careful: SP is initialized to 07H. but there are hundreds of others Semiconductor Technologies – VEDANT.imm.127 if reg-.A==0 A!=0 decr+jmp comp+jmp JZ JZ DJNZ reladdr reladdr reg|dir.e.

Sign up to vote on this title
UsefulNot useful