Presentation on theme: "Embedded Software 1 Dr. Richard Conway BM025"— Presentation transcript:
Embedded Software 1 Dr. Richard Conway BM025
Aims & Objectives The aim of the module is to provide an introduction to embedded processor systems and applications. The main objectives are to provide the student with an overview of the architecture of a simple microprocessor, to explain the operating principles and provide a functional understanding of assembly language.
Syllabus Describe what an embedded system is. Detail application areas and examples. Introduce a simple microprocessor architecture – Registers, buses, and memory organization and how it is used in embedded applications. Describe memory and I/O devices. Explain memory and I/O accesses. Detail instruction machine formats, and instruction decoding. Introduce instruction sets, addressing modes, data move instructions, arithmetic instruction, stack operation and usage, Program flow control instructions, sub routines and loops. Detail assembler directives and the program translation process. Review the build and load process for embedded application programs. Introduce simulation tools and debugging techniques. Introduce the monitor program and how to use it to test applications using target hardware. Describe how to control/communicate with I/O devices through polling and interrupts. Interrupt service routines, interrupt priority, multiple interrupts, nesting. Use practical programming examples to illustrate concepts.
Module Evaluation Final Exam 60% written exam Term Work20% lab 20% midterm Lab starts week 4 Repeat Exam100% written exam
Module Information Recommended Text. The 8051 Microcontroller, 3 rd Edition.I. Scott MacKenzie, 1999 Available in Bookshop and Library (long term loan) 8052 tutorial available on
Embedded System Computing systems widely used today PCs, laptops, Palm pilot, Servers Easily identifiable as computing systems Can easily change the operation Add programs/applications Add hardware resources Embedded System Microwave, mobile phone, EMU in car, digital camera, etc… Computing system that is embedded within a device/system May not be obvious from the outside Often fixed in operation Volume of sales in billions
Basic components of a computing system All computing systems (big or small) contain CPU – brains of the system. Executes instructions Memory – storage. Stores program (instructions) and data Input/Output – Interaction with outside world Communication achieved with buses Groups of signals to carry the data, address and control info
Buses A bus is a collection of signals (wires) that are collectively referred to by a common name that identifies their common purpose Example is the address bus. Could consist of 16 individual wires. Rather than draw all the signals, a wider shape is used on schematics
Address Bus The number of address lines that a CPU has determines the amount of memory that can be used with the CPU* 16 address lines allow (or 64K) unique address locations. For n address lines, there are 2 n unique address locations In CPU systems, the CPU supplies the address This could be the address of a memory location or an I/O device * This is without consideration of paging and memory management (MM) techniques
Data Bus The data bus is used to transfer data between Memory and CPU I/O devices and CPU I/O devices and Memory The transfer can be either way, so the data bus is a bi- directional bus Data bus size is normally a multiple of 8 bits (byte) and is usually the same size or less than the size of the CPUs internal registers. For example, an 8 bit processor has internal registers of size 8 bits and would have an 8 bit data bus Clearly a bigger data bus means that more data can transferred, but this is at the cost of more pins and wider memories High end systems usually have wide data buses that reduce the bottleneck between CPU and memory
Data Bus Data bus contains data on its wires! This could be actually represent Instructions Data Values >Integers, Characters, Floating point values, etc… Addresses >An instruction may contain an address >E.g. JUMP 459
Control Bus These signals are used to control the transfer of data between memory, I/O and the CPU The 2 most basic are Read signal (1 wire) Write signal (1 wire) Both are outputs from the CPU Other control signals include Reset, interrupt and direct memory access
Bus cycles Transfer of data occurs between Processor and memory Processor and I/O Memory and I/O (DMA) Bus cycles are used to perform these transfers Most common types are Memory read Memory write I./O read I/O write Bus cycles are concerned with the synchronisation of the data transfer Cover in lecture
Bus cycle example Memory Read bus cycle CPU outputs address CPU activates read signal Memory responds with data on data bus CPU reads data and deactivates read signal
CPU Intel introduced the first widely used microprocessor in 1971, the 8080 A computing system could be built using the microprocessor, memory devices and I/O devices on a printed circuit board
CPU Brains of the system Controls what operations happen Performs operations on data CPU understands a finite number of instructions Actual instructions are defined by the instruction set for the CPU Example instruction ADD R1,R2,R3 CPU has 2 main parts Control unit Controls and sequences themicrosteps in the fetch- decode-execute cycle of each instruction. Datapath section Consists of the register file (group of registers) and the Arithmetic Logic Unit (ALU)
CPU Datapath section is most important section Register file, which is a group of registers, some of which have general purpose use and some may have specific usage Arithmetic Logic Unit (ALU), which is logic that performs operations on data, e.g. addition, multiplication, logical OR, etc. The Program Counter (PC) register always stores the address of the next instruction to be fetched from memory.
CPU An instruction read from memory is stored in the instruction register (IR) register The control unit decodes the instruction to determine what the instruction is and what to do to execute the instruction After the instruction is executed, the same steps are repeated, I.e Fetch Decode Execute A series of instructions that are combined to perform a task form a program. As such the CPU operates under the control of a program
MemoryCPU Address bus Data bus Read Signal Write Signal INC R0 98 Fetch Decode Execute Example operation of CPU
Memory Programs and data are stored in memory Types of computer memory include Semiconductor, considered primary Common classification is ROM (non-volatile) and RAM (volatile) Magnetic and optical, considered secondary CPU communicates directly with semiconductor memory.
Main Memory RAM Random Access Memory that can be read from and written to. Contents are volatile, so contents are lost when power removed This type of memory is fast. Memories for computers are rated by their capacity in bytes. ROM Read Only Memory can only be read from. Contents are non-volatile, so contents are NOT lost when power is removed Also fast access
Abstract view of memory
Microcontroller A device similar to the microprocessor is a microcontroller Early example is the Intel 8748 microcontroller The key difference is the integration of memory and basic I/O functions on a single chip and low cost The 8051 introduced in 1980 Original 8051 had an 8-bit CPU, 4K program memory, 128 bytes of RAM and I/O functions (ports, timers and serial transmission support) all on a single chip!
Examples of microcontroller uses
Fully working 8051 system!
Micrcontroller Many other companies that produce other microcontollers Microchip, Motorola, Atmel, Philips, Hitachi, etc … Differ in internal architecture, instruction set, speed, size of on-chip memories, package sizes, I/O support, power consumption, register size, cost Companies other than Intel make 8051 devices Philips, Atmel, Analog Devices, Cygnal, etc… Despite being over 25 years old, the 8051 microcontroller is still widely used! This is due to its proven track record and a wide knowledge base Unlike personal computing where increased throughput is constantly required, there are still many embedded (not all) that require a low cost and simple microcontroller Cover in lecture
Microcontroller vs Microprocessor MicroprocessorMicrocontroller Microprocessor is a single chip CPU and requires many additional devices to form working system Microcontroller is a single chip with CPU, memory (small amount) and I/O Medium to high cost for systemLow cost for system Application is in microcomputer systems, with operation system and application software. Software and hardware can be easily upgraded Application is in embedded system with fixed programs and low component count (also fixed). Typically control oriented application Instruction set and internal architecture focused for processing intensive operations and can support many addressing modes (CISC machines) and support of operating systems (OS). Instruction set and internal architecture focused on control of I/O and efficient use of on-chip resources. This can include bit instructions. Small amount of ROM relative to amount of RAM and secondary memory. E.g. 128K ROM, 512M RAM and 80 G Harddisk Large amount of ROM relativeto small amount of RAM and usually no secondary memory. E.g. 32K ROM, 4K RAM
Appendix Week 1
Ad from 1970s for 8080
General Purpose Computing System
Magnetic Disks Types Hard disks Floppy disks Zip disks Provide long term storage (non-volatile). A hard disk cannot normally be removed and is fixed internally in the computer. A floppy disk and zip disk can be removed or inserted as needed. Disks store data using magnetic media. Accessing data on these disks is much slower than RAM. Also known as secondary storage
Other types of Storage Optical Disks CD-ROM and DVD Flash Memory Drives Uses Flash Semiconductor Technology Memory sticks
Exercises Week 1
Exercises 1. What are the basic components of a computing system? 2. With respect to a computing system, what is a bus? 3. Describe the 3 buses that are used in a computing system. 4. Using Figure 1., detail the steps that are involved in a memory write bus cycle Figure 1.
Exercises 5. What is CPU an acronym for? 6. What are the main sections of a CPU? 7. What is the purpose of the PC register? 8. What is the purpose of the IR register? 9. Fill in the missing word. The CPU operates by repeatedly performing ________, decode and execute operations. 10. What is a non-volatile memory?
Exercises 11. What is an ALU? 12. List 5 examples of embedded systems 1. In the home 2. In University 3. In a car 13. What are the differences between a microcontroller and a microprocessor? 14. How many components (approximately) are needed for a simple working microcontroller system