MICROPROCESSORS, MICROCOMPUTERS AND MICROCONTROLLERS
The microprocessor and the microcomputer have revolutionised the electronics industry and have had a remarkable impact on many aspects of our lives. The development of extremely high density ICs has sharply reduced the size and cost of microcomputers .
Computers have been in general use since the 1950s. Formerly, digital computers were large expensive machnies used by governments or large buisnesses. The size and shape of the digital computer have drastically changed in the past decades as a result of a device called microprocessor µ. The microprocessor is an IC that contains much of the processing capabilities of a larger computer. The microprocessing unit (MPU) is a small but extremely complex VLSI device that is programmable. The MPU is the heart of a microcomputer. The microcomputer is a stored-program digital computer. Microcontrollers are not as well known to the general public or to many in the technical community, as are the more glamorous micro- processors.
Microprocessor unit (MPU) is the heart of every microcomputer. It performs a number of functions, including.
1. Providing timing and control signals for all elements of the microcomputer (µC).
2. Fetching instructions and data from memory (Fig. 48.1).
3. Transferring data to and from memory and I/O (input/output) devices.
4. Decoding instructions.
5. Performing arithmetic and logic operations called for by instructions.
6. Responding to I/O-generated control signals such as RESET and INTERRUPT.
The MPU contains all of the logic circuitry for performing these functions, but its internal logic is not externally accessible. Instead, we can control what happens inside the MPU by the program of instructions that we put in memory for the MPU to execute. This is what makes the MPU so versatile and flexible— when we want to change its operation we simply change the programs stored in software or firmware rather than rewire the electronics (hardware).
The MPU’s internal logic is extremely complex, but it can be thought of as consisting of three basic sections: the control and timing section, the register section, and the arithemetic/logic unit (ALU) see Fig. 48.2. Although there are definite interactions among these three sections, each has specific functions.
The main function of the timing and control section is to fetch and decode (interpret) instruction codes from program memory and then to generate the necessary control signals required by the other MPU sections in order to carry out the execution of instructions. This section also controls timing and control signals (e.g. Read/Write clock) that are needed by the external random access memory (RAM), read only memory (ROM), and input/output (I/O) devices.
The register section contains various registers (inside the MPU) each of which performs a special function. The most important one is the program counter (PC) which keeps track of the addresses of the instruction codes as they are fetched from memory. Other MPU registers are used to perform functions such as : storing instruction codes as they are being decoded, holding data being operated on by the ALU, storing addresses of data to be fetched from memory, and many general purpose storage and counting functions.
The ALU performs a variety of arithmetic and logic operations on data. These operations always include addition and subtraction, AND, OR, EX-OR shifting, incrementing, and decrementing. The more advanced MPUs have ALUs that can do multiplication and division. During a microcomputer’s operation, the operations that an ALU is to perform are under the control of the timing and control section, which of course, does what it is told by the instruction codes it fetches from memory.
It is important to understand the difference between the microcomputer (µC) and the microprocessor (µP). A microcomputer contains several elements, the most important of which is the microprocessor. The microprocessor is usually a single IC that contains all of the circuitry of the control and arithmetic logic units-in other words the CPU. It is common to refer to the microprocessor as the MPU since it is the CPU (central processing unit) of the microcomputer This is illustrated in Fig. 48.3, where the basic elements of a microcomputer are shown.
The memory unit shows both RAM (random access memory) and ROM (read only memory) devices. The RAM section contains one or more LSI chips arranged to provide the designed memory capacity. This section of memory is used to store program and data which will change often during the course of operation. It is also used as storage for intermediate and final results of operations performed during execution of a program.
The ROM section contains one or more chips to store instructions and data that do not change and must not be lost when power is shut off.
The input and ouput section contain the interface circuits needed to allow the peripherals to properly communicate with the rest of the computer. In some cases these interface circuits are LSI chips designed by MPU manufacturer to interface the MPU to a variety of I/O devices. In other cases the interface circuits may be as simple as a buffer register.
Figure 48.4 shows the block diagram of a typical microcontroller which is a true computer on a chip. The design incorporates all of the features found in a microprocessor CPU (central processing unit) : ALU (arithmetic logic unit), PC (program counter), SP (stack pointer), and registers. It also has added the other features needed to make a complete computer : ROM, RAM, parallel I/O, serial I/O, counters, and a clock circuit.
Like the microprocessor, a microcontroller is a general purpose device, but one that is meant to read data, perform limited calculations on the data, and control its environment based on those calculations. The prime use of a microcontroller is to control the operation of a machine using a fixed program that is stored in ROM and that does not change over the lifetime of the system.
The design approach of the microcontroller mirrors that of the microprocessor: make a single design that can be used in as many applications as possible in order to sell, hopefully, as many as possible. The microprocessor design accomplishes this goal by having a very flexible and extensive repertoire of multi- byte instructions. These instructions work in a hardware configuration that enables large amounts of memory and I/O to be connected to address and data bus pins on the integrated circuit package. Much of the activity in the microprocessor has to do with moving code and data to and from external memory to the CPU. The architecture features working registers that can be programmed to take part in the memory access process, and the instruction set is aimed at expediting this activity in order to improve throughout. The pins that connect the microprocessor to external memory are unique, each having a single function. Data is handled in byte or larger sizes.
The microcontroller design uses a much more limited set of single and double-byte instructions that are used to move code and data from internal memory to the ALU. Many instructions are coupled with pins on the integrated circuit package; the pins are programmable that is, capable of having several different functions depending on the wishes of the programmer. The microcontroller is concerned with getting data from and to its own pins; the architecture and insturction set are optimized to handle data in bit and byte size.
COMPARING MICROPROCESSORS AND MICROCONTROLLERS
The contrast between a microcontroller and a microprocessor is best examplified by the fact that most microprocessors have many operational codes (opcodes) for moving data from external memory to the CPU, microcontrollers may have one or two. Microprocessors may have one or two types of bit-handling instructions; microcontrollers will have many. To summarise, the micrprocessor is concerned with rapid movement of code and data from external addresses to the chip; the microcontroller is concerned with rapid movement of bits within the chip. The microcontroller can function as a computer with the addition of no external digital parts; the microprocessor must have many additional parts to be operational.
THE Z80 AND THE 8051
The Z80 (Table 48.1) has a very rich instruction set. The penalty that is paid for this abundance is the number of multi byte instructions needed, some 71% of the total number. Each byte of a multibyte instruction must be fetched from program memory and each fetch takes time, this results in longer program byte counts and slower execution time versus single byte instructions. The 8051 has a 62% multi byte instuction content; the 8051 program is more compact and will run faster to accomplish similar tasks.
The disadvantage of using a lean instruction set, as in the 8051, is increased programmer effort (expense) to write code; this disadvantage can be overcome when writing large programs by the use of high-level languages such as BASIC and C, both of which are popular with 8051 system developers. The price paid for reducing programmer time is the size of the program generated.
1. Explain the difference between a microprocessor and a microcomputer.
2. Compare a microprocessor with a microcontroller.
3. What are the fields of application of microcontrollers?
Fill in the Blanks
1. The internal logic of a microprocessor unit is not …………………… accessible.
2. When we want to change the operation of an MPU we simply change the…………………… stored in its software.
3. The MPU is the…………………… of the microcomputer.
4. The…………………… section contains one or more LSI chips that store program and data that will often change.
5. The…………………… section contains one or more LSI chips that store program and data that will not change.
6. The input and output sections contain…………………… circuits.
7. The prime use of a microcontroller is to control the operation of a machine using a …………………… program.
8. The microprocessor moves data and code to and from…………………… to the CPU.
9. The microcontroller is concerned with getting data from and to its…………………… .
Fill in the Blanks
8. external memory
3. central processing unit
9. own pins