Giáo trình hệ thống nhúng

193 1.3K 9
Giáo trình hệ thống nhúng

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Giáo trình hệ thống nhúng

Chapter Microprocessor Operation This chapter lets you understand that the microprocessor is built of a CPU, memory and data input/output ICs, that it operates on a "stored program" basis, and that it is available in multi-chip/single-chip architectures These concepts are not confined to the H8/300H but extend to all other kinds of microprocessors 1.1 Microprocessor Configuration The microprocessor is said to be a "computer built around ICs." Mainframes, minis, and microprocessors all share the same principles of operation and vary only in their scale, speed and architecture The minimum components required to build a computer are the CPU, memory and I/O devices as shown in Figure 1.1 Figure 1.1 Microprocessor configuration All these components of a microprocessor are fabricated of a single IC Such ICs are coupled to build a computer Three minimum ICs needed to make up a microprocessor are the CPU, memory, and peripheral IC http://resource.renesas.com Page CPU (Central Processing Unit) The CPU forms the nucleus of any computer by executing instructions Microprocessors are grouped into 4-bit, 8-bit, 16-bit, and 32-bit microprocessors according to the length of bits they can handle at a time A 4bit microprocessor can handle four binary digits in a single instance of calculation, but as many as eight digits in two instances and 16 in four instances The microprocessor is also known as a "MPU (microprocessing unit)", "microprocessor", or simply "processor." Memory (Memory) A device on which instructions and data are stored Without memory, programs and data cannot be used In a microprocessor, ROM (read-only memory) and RAM (random access memory) are used Input device (Input) A data input device The keyboard and mouse of a PC, for example, are data input devices With a built-in controller, switches and sensors are input devices These input devices cannot be directly connected to a CPU, but they must be attached to the CPU by way of a "peripheral IC," containing connection circuitry Depending on the kind of input device to be connected to the CPU, an appropriate peripheral IC is used Output device (Output) A data output device The display and printer of a PC, for example, are data output devices With a built-in controller, display LEDs, motors, heaters and so on are output devices Like input devices, output devices are attached to a CPU by way of a "peripheral IC." Depending on the kind of output device to be connected to the CPU, an appropriate peripheral IC is used Input devices and output devices are collectively called "peripherals." 1.2 Stored Program Computers The stored program computer provides a most precise concept of the operating principles of a computer It might be safely said that "All modern computers are stored program computers." The stored program computer was first conceptualized in 1947 by John von Neumann and is also known as a "Neumann computer." In the stored program computer, the CPU reads instructions stored in memory in sequence, decodes and executes them The act of the CPU reading an instruction from memory is called "fetch." Interpreting the fetched instruction to see what operation it defines is called "decode." The CPU then proceeds to perform, or "execute," the operation defined by the instruction When the CPU has finished executing the http://resource.renesas.com Page instruction, it fetches the next instruction After all, the CPU infinitely repeats the following cycle of operations: - Instruction fetch - Instruction decoding - Instruction execution Any microprocessor has a program counter in its CPU The program counter always holds the "address of the next instruction to be executed." When the CPU reads an instruction, the program is automatically updated to indicate the address of the next instruction in sequence The program counter thus ensures that instructions stored in memory will be executed in correct sequence Figure 1.2 Operating principles of a stored program computer 1.3 Memory Memory devices are broadly classified into two categories: ROM (readonly memory) and RAM (random access memory) You can only read stored data from ROM but cannot write to it Stored data is preserved intact, however, when the microprocessor is switched off Use ROM to store valuable data that needs to be protected from erasure in times of power failures, typically, programs Instructions are stored in ROM Each meaningful collection of instructions is a program Any microprocessor would be inoperable unless it comes up with "programs available for ready use" when switched on ROM fills this need Data can be written to and read from RAM as desired Stored data would be lost, however, once the microprocessor is switched off Even when http://resource.renesas.com Page the microprocessor is switched on again, previous data is no longer left Hence, RAM is used as temporary data storage Programs may also be placed in RAM, but will be lost once the microprocessor is switched off To run programs in RAM, it is necessary to attach an external storage device, such as a floppy disk or hard disk drive, and transfer the programs to RAM from external storage to RAM when the microprocessor is switched on Mask ROM (Mask ROM) When a memory IC is manufactured in the factory, programs are written to it A mask is a plate of glass imprinted with patterns of wirings and transistors used in the IC manufacturing process Users have a semiconductor manufacture custom-build a mask to manufacture a memory IC Advantages - Suitable for volume production - Low cost Disadvantages - Long lead-time from ordering to completion - Not reprogrammable once built EPROM (Erasable & Programmable ROM) Stored data can be erased by ultraviolet irradiation To this end, a special package with a glass window is used An EPROM writer is used to write to EPROM EPROM is erasable and programmable about 100 times Advantage - Erasable and programmable and thus convenient for testing and debugging Disadvantage - Expensive because of the use of a special package OTPROM (One Time Programmable ROM) An EPROM chip housed in an inexpensive plastic package Stored data cannot be erased by ultraviolet irradiation because no glass window can be attached to the plastic package OPTROM can be written only once, but it comes by far cheaper than EPROM Programs are debugged in EPPROM and, when finalized, moved to OTPROM for volume production Advantage - Cheaper than EPROM and suitable for small-batch production Disadvantage - Not erasable and programmable EEPROM (Electrically Erasable & Programmable ROM) EEPROM can be electrically erased and programmable, and can be reprogrammed when mounted on a board as a finished product EEPROM is reprogrammable about tens of thousand times http://resource.renesas.com Page Advantages - Onboard reprogrammable - Ready for infinite times of reprogramming Disadvantage - Expensive Flash memory (Flash Memory) A variation of flash memory, which is cheaper and larger-sized Advantage - Cheaper and larger-sized than EEPROM Disadvantages - Unable to write address by address, unlike EEPROM - Memory IC divided into blocks for erasure and reprogramming block by block Static RAM (Static RAM) RAM with its storage circuit built of flip-flops Given a supply voltage, static RAM preserves stored data intact It dissipates least power when out of use Because six transistors are used to build its flip-flops, static RAM offers less storage capacity than does ROM Advantages - Fast - Low power consumption and suitable for battery backup Disadvantages - Expensive - Small storage capacity Dynamic RAM (Dynamic RAM) Simplified storage circuitry with only one capacitor and one transistor to provide each bit of memory, and hence larger-sized than static RAM Charges on the capacitors, however, drain with time, resulting ultimately in loss of stored data Before such loss, all stored data must be read out and refreshed Power alone does not allow dynamic RAM to retain stored data but requires refreshing for that purpose Advantage - Cheap and large-sized Disadvantage - Refreshing required Table 1.1 summarizes features of key ROM and RAM devices http://resource.renesas.com Page Table 1.1 Kinds and features of memory devices Kind Mask ROM EPROM OTPROM ROM EEPROM Flash memory Static RAM RAM Dynamic RAM Features Large-sized, cheap, volume production use, custom fabrication, not reprogrammable Programmable and erasable by ultraviolet irradiation Testing, debugging Low-volume production use, one-time programmable Electrically programmable, onboard reprogrammable Electrically erasable and programmable, cheaper and larger sized than EEPROM Stored data preserved under voltage input alone, fast, battery backup use Refreshing required to preserve data, large-sized, cheap 1.4 Single-Chip/Multi-Chip Microprocessors Putting a CPU, ROM, RAM, and data input/output circuitry into a single IC will make a single-chip microprocessor Single-chip microprocessors come compact and cheap, but not allow users to choose built-in functions at their option Single-chip microprocessors are also known as "microcomputer units (MCUs)," because they are made of a single IC On the other hand, a computer fabricated from a mix of a CPU, memory and data input/output devices is called a "multi-chip microprocessor." Multi-chip microprocessors offer users greater freedom in their component choice Multichip microprocessors will prove more advantageous for larger systems involving complexities of input/output See how a single-chip microprocessor and a multi-chip microprocessor differ in Figure 1.3 http://resource.renesas.com Page Figure 1.3 Single-chip microprocessor and multi-chip microprocessor Single-chip microprocessors are used as built-in controllers When a single-chip microprocessor is switched on, the control program stored in its internal ROM launches instantly Internal RAM is used as temporary storage The internal data input/output circuits, too, have been chosen to support the single-chip microprocessor as s controller Kinds of internal ROM Early single-chip microprocessors included only mask ROM and were available only for use in mass-produced products Subsequently EPROM has made inroads into single-chip microprocessors as internal ROM As testing and debugging was carried out in erasable and programmable packages with windows and inexpensive plasticpackaged OTPROM used on commercialization, single-chip microprocessors came to be used in products manufactured in small batches as well Now, single-chip microprocessors with internal EEPROM and flash memory are available for use in various applications As the IC manufacturing technology has been advancing from year to year, with continuing increases in the sizes of internal ROM and RAM, state-of-the-art data input/output functions have been used in single-chip microprocessors in an expanding of applications Microprocessors and memory A memory device organized into bits per address is used Each sequence of bits is called a "byte," and memory sizes are stated in the unit byte 64K bytes of memory could be connected to classical 8-bit microprocessors as standard This memory size indicates bits per address in a memory space of 64K (65536 addresses) Eight bits of memory per address are http://resource.renesas.com Page also connected to 16- and 32-bit microprocessors, as well as 8-bit microprocessors What are the three key ICs needed to make up a microprocessor? (CPU (MPU ) ) (Memory ) (Peripheral IC) Mainframes and minis share the same computer architecture Microprocessors are characterized by the fact that three components of the computer - namely, the CPU, memory, and input/output circuit (peripheral IC) - are each fabricated as an IC Fill the blanks with appropriate words or phrases The (stored program computer) provides a most precise concept of the operating principles of a computer This was first conceptualized in 1947 by (John von Neumann) The stored program computer materializes the principles of a computer in which the CPU reads instructions from memory and executes them This is also known as a "Neumann computer," because of its conceptualization by John von Neumann Mention one advantage and one disadvantage for each of the following kinds of memory: Mask ROM Advantage (Inexpensive, large-sized ) Disadvantage (Available only on order, not reprogrammable) EPROM Advantage (Erasable and programmable) Disadvantage (Expensive ) Dynamic RAM Advantage (Inexpensive, large-sized Disadvantage (Refreshing required ) ) Mask ROM is volume-produced at factory at low cost, and features circuit simplicity, offering large-sized memory Mask ROM can be manufactured only by order and is not reprogrammable after it is built EPROM allows about 100 times of erasure and reprogramming using a special writer, but the special package with a glass window adds to its cost Using capacitors as storage devices, DRAM is simple in circuitry, inexpensive, and large-sized, but what is inconvenient, it must be refreshed so that charges on the capacitors not drain http://resource.renesas.com Page Mention one advantage and one disadvantage for the microprocessor Advantage (Compact, inexpensive ) Disadvantage (Limited internal functionality ) (Small memory size Not suitable for use in larger systems ) A single-chip microprocessor has all functions assembled on a single chip and therefore comes compact and more inexpensive than purchasing its components separately Its scale of integration is limited and is not suitable for mounting extra-large-sized memory http://resource.renesas.com Page Chapter Knowledge of Binary Numbers Prerequisite to Writing a Program There are close links between the computer and binary numbers This chapter covers the minimum knowledge of binary numbers prerequisite to writing a program in an assembler language The concept of binary numbers is not restricted to the H8/300H but broadly pertains to computers in general Without a correct understanding of the topics covered here, you would not be able to write correct programs The key concepts of "Signed binary numbers," "Carry," and "Overflow," among other things, would be needed instantly Even when you have finished with this chapter, refer back to it from time to time as needed The reason why binary numbers are used in the computer is that the computer is built of digital circuitry Digital circuitry concerns only two states whether a voltage of interest is higher or lower than a given voltage - and not any intermediate voltage A higher-voltage state is designated by H, a lowervoltage state by L As the computer is a calculator, the two states of H and L can be more conveniently expressed in numeric terms as and in binary All binary numbers that the computer handles correspond to H and L in digital circuitry The unit bit, or binary digit, is used to count binary numbers For example, a reference to bits means digits in binary A sequence of bits is called a "byte." 2.1 Kinds of Data Handled by Microprocessors Before starting to consider how data is represented in binary numbers, let's see what kinds of data are available Here, data is broadly grouped into numeric data and character data as shown in Figure 2.1 Figure 2.1 Kinds of data http://resource.renesas.com Page 10

Ngày đăng: 06/09/2012, 14:51

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan