380 likes | 478 Views
Embedded Software 1. Dr. Richard Conway BM025 Richard.conway@ul.ie. Aims & Objectives.
E N D
Embedded Software 1 Dr. Richard Conway BM025 Richard.conway@ul.ie
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.
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. Syllabus
Module Evaluation • Final Exam 60% written exam • Term Work 20% lab • 20% midterm • Lab starts week 4 • Repeat Exam 100% written exam
Module Information • Recommended Text. “The 8051 Microcontroller”, 3rd Edition.I. Scott MacKenzie, 1999 Available in Bookshop and Library (long term loan) • 8052 tutorial available on • http://www.8052.com
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 65536 (or 64K) unique address locations. • For n address lines, there are 2n 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
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 CPU’s 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 Data Bus
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
Example operation of CPU Memory CPU INC R0 Decode Data bus 371 Fetch 371 Address bus 97 98 Read Signal Write Signal Execute
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
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 Microcontroller • 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!
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 it’s 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
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 • What are the basic components of a computing system? • With respect to a computing system, what is a bus? • Describe the 3 buses that are used in a computing system. • Using Figure 1., detail the steps that are involved in a memory write bus cycle Figure 1.
Exercises • What is CPU an acronym for? • What are the main sections of a CPU? • What is the purpose of the PC register? • What is the purpose of the IR register? • Fill in the missing word. The CPU operates by repeatedly performing ________, decode and execute operations. • What is a non-volatile memory?
Exercises • What is an ALU? • List 5 examples of embedded systems • In the home • In University • In a car • What are the differences between a microcontroller and a microprocessor? • How many components (approximately) are needed for a simple working microcontroller system