




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































I ntrodu ct ion to Comput er H ardware After completing this chapter, you should be able to:
◗ Describe the fundamental elements of every computer system: proces- sor, memory, and input/output ◗ Compare elements of the HC11 block diagram to the fundamentals of every computer system ◗ Describe the use of busses to connect computer elements ◗ Explain the three major functional units of a processor ◗ Illustrate the typical registers inside the processor ◗ List the HC11 processor registers ◗ Discuss the HC11 processor modes ◗ Compare and contrast various memory types ◗ Describe the on-chip memory of the HC ◗ Specify input/output functions present on most computers ◗ Use some basic BUFFALO commands to control the EVBU
◗ 1.1 Elements of Every Computer ◗ 1.2 Elements of Processors ◗ 1.3 Introduction to Memory ◗ 1.4 Memory Types ◗ 1.5 Input/Output ◗ 1.6 EVBU/BUFFALO
Introduction to Computer Hardware
The HC11 is a computer system on a single chip that contains the three functional blocks of a computer system. Its internal central processor is a member of the 6800 family of processors; it has on-board memory and sophisticated on-chip input/output capabilities.
The HC11 block diagram is shown in Figure 1.2. This block diagram is specific to the M68HC11E9 version of the HC11. This version of the HC11 is used on the development board (EVBU), as well as in the examples used throughout this text. Three types of memory are included on-chip: RAM, ROM and EEPROM. The HC11 also supports expanded off-chip memory. It contains five on-chip input/output functions, an analog-to-digital converter, and a sophisticated timing system that supports numerous event-driven functions. The address, data and control busses are not shown in this diagram; the processor is connected to the memory and input/output functions inside the HC11 chip in the manner illustrated in Figure 1.1.
Figure 1.2 M68HC11E9 Block Diagram
NOTE: Throughout this text, references to the HC11 presume the M68HC11E version of the chip; thus, the shorter, more general name “HC11” will be used, unless otherwise specified.
The processor is the device at the center of the machine. It has the responsibility to execute instructions, manipulate data and perform arithmetic functions. It controls and manages the activities of the entire machine. The human brain is the ultimate processor. It can receive and process instructions, process data (like visual images and sounds) and perform arithmetic calculations. However, the human brain is much, much more than a processor because it has the ability to think and to reason. Computer processors cannot think in the same sense.
The term Central Processing Unit (CPU) is used to refer to the main processor in a system. The CPU often works in conjunction with a set of processors to complete a whole system. Modern computers contain additional processors, other than the CPU. They contain video processors, input/output processors, memory controllers, interrupt controllers and math co-processors, to name a few. Since these other processors are subordinate to the central processor, they are often called sub-processors. Many peripheral devices, such as harddrives, printers and video projection systems, have dedicated processors embedded into their control circuitry.
Memory is a term that refers to any component that stores data and programs used by the processor. Memory can have many forms. There are semiconductor memories, magnetic memories, and optical memories. Semiconductor memories include read only memory (ROM) and read/write memory (RAM). Magnetic memories include floppy disk drives, hard disk drives and tape systems. Optical memories include CD-ROM, DVD and optical disks. A thorough presentation of memory relevant to the HC11 will be provided in chapter 8. Section 1.3 will address concepts of memory that are applicable to all computer systems and a necessary foundation for this study of the HC11.
Input/Output is a term that refers to any subsystem that has the responsibility of receiving data for the processor (input) or sending data out from the processor (output). Input/Output is typically abbreviated as I/O and does not necessarily imply that a particular device has both input and output capability. Typical input devices are keyboards, mice or scanners. Typical output devices are printers and monitors. Typical devices that perform both input and output functions are modems or tape drives. Collectively, all these devices are referred to as I/O devices. The HC11 I/O capability is discussed in detail in chapters 10 through 13.
Processors have the job of processing the data within a computer and controlling the overall operation of the system. The basic block diagram of a processor includes an arithmetic logic unit, processor registers and a control unit, as shown in Figure 1.4.
The arithmetic logic unit ( ALU ) is responsible for mathematical and logical operations. Most processors support addition and subtraction, logical AND, OR and NOT operations and data shifting. All of these operations are performed in an ALU. The ALU receives data from the processor registers and from external memory via the external data bus. It does not store data, but it returns the result of the operations to the registers or to memory. The ALU is interfaced to a block of processor registers and
Connection to the Devices Outside of Processor
Address Data Control
Addresses from Registers
Control to/from Registers
Control to ALU
Internal Processor Data Bus Processor Registers
Arithmetic Logic Unit (ALU)
Control Unit
Components of the Processor
Figure 1.4 Processor Block Diagram
to the control block, as shown in Figure 1.4. The HC11 has an ALU that can perform operations on 8-bit and 16-bit data.
The processor registers are a set of registers needed to perform the instruction execution. The registers are used to temporarily store data and memory addresses, as well as to contain status and control information. These registers are accessible to the user via instructions. A basic register block configuration is shown in Figure 1.5. Each processor will have a unique design that may not include all the registers described here. Often a processor will contain multiple copies of these registers for versatility and enhanced functionality.
Accumulators are special registers directly linked to the ALU to assist with the arithmetic operations. The results of arithmetic operations are stored in an accumula- tor. The size of the accumulators is related to the size of the data bus. If the processor is an 8-bit processor, then it will have 8-bit accumulators. If it is a 16-bit processor, then it will have 16-bit accumulators. Moreover, processors often have the ability to process data of various sizes. For example, an 8-bit processor may also be able to process 16-bit data. If the processor has a 32-bit configuration, it can also process data in 16-bit or even 8-bit words.
The program counter is a processor register that keeps track of the address of the next location in memory that will be accessed. Every processor must have a register that performs the function of a program counter. The program counter is the same size as
b 7 b 0
b 15 b 0
b 15 b 0
b 15 b 0
b 7 b 0
b 15 b 0
8-bit Accumulator
16-bit Accumulator
Program Counter
Stack Pointer
Address Register
Status Register
Figure 1.5 Basic Processor Registers
cycle and deposited into this register. The opcode remains in this register until it is overwritten by the opcode for the next instruction.
Opcodes, operands and instructions are explained in Chapter 2.
NOTE: The instruction register should be called the opcode register, because it contains only the opcode of the instruction. Operands and operand addresses are not processed by the instruction register.
The instruction decoder is the main section of the control block. It has the job of decoding the instruction in the instruction register and controlling the execution of the instruction. It causes each step of the instruction execution to take place. If an address needs to be read from memory, the instruction decoder will cause that to take place. If data needs to be added, it will tell the ALU to perform an addition operation, and so on.
T he process of fetching and executing an instruction is covered in chapter 2.
The HC11 is a member of the Motorola 6800 family of processors. It is compatible with the M6800 and M6801 processors. In addition to executing all M6800 and M
Connection to the Devices Outside of Processor
Address Data Control
Instruction Decoder
IR MAR MDR
Control Unit
Addresses from Registers
Internal Processor Data Bus
Control to/from Registers
Control to ALU
Figure 1.6 Components of the Processor Control Block
instructions, the HC11 supports many additional instructions. The HC11 supports 16-bit by 16-bit divide instructions, twelve instructions that support bit-manipulation, and various instructions that support a second address register (Y), none of which was available on the original 6800.
The HC11 MCU is an 8-bit processor, which supports a 16-bit address bus. It contains an 8-bit ALU that can be configured to perform some 16-bit operations.
The HC11 has a complete set of processor registers. This set of registers is called the programmer’s model, as shown in Figure 1.7. It has two 8-bit accumulators that can be configured as a 16-bit accumulator for some operations. It has two16-bit address registers, a 16-bit stack pointer and a 16-bit program counter. Finally, it contains an 8-bit status register that contains three control bits and five status flags. None of these registers is addressable as memory; they can only be accessed via instructions. These registers are described in the following sections.
Accumulator A. An 8-bit register that is used as the primary data-processing register. All arithmetic and logical instructions can operate on data in this register. Many special-purpose instructions can only operate on data in this register. This register is referred to as the “A” register or as “AccA.”
Accumulator B. An 8-bit register that is identical to Accumulator A in function. Some instructions have versions that access Accumulator A only and do not support Accumulator B. There are also two instructions that utilize Accumulator B and do not support Accumulator A. This register is referred to as the “B” register or as “AccB.”
to allow loading of permanent programs and other production related programming tasks.
NOTE: This text focuses only on the normal modes and primarily on operation in the single chip mode. Some examples and explanation of the use of the expanded mode are provided in chapter 8 on memory. The special modes will not be discussed, because of the advanced nature of their function.
The hardware mode is selected by the logic levels on two mode control pins (MODA and MODB) when the processor is in the reset state. Figure 1.8 shows the logic levels required to select each of the four modes. The MODB bits selects between the normal modes (Single Chip and Expanded) and the special modes (Bootstrap and Test).
Memory is a term that refers to any component that stores data and programs for the processor. The programs (software), as well as the program data, are stored in the memory during execution and processing. Memory consists of storage locations, where each location can contain one byte of information. A unique address is assigned to each storage location in memory so that it can be individually accessed. The HC11 uses memory that contains a byte of data in each storage location.
A memory address is an n -bit binary number that the processor uses to select a specific memory location. If the processor wishes to communicate with memory location 7, it produces the 16-bit binary address for this location (%0000 0000 0000 0111) and places this address on the address bus. The number of address bits in a system determines the number of unique addresses that can be created by the processor, as shown in
MODB MODA Mode 10 Single Chip Expanded 11 0 0 Bootstrap 0 1 Test
Figure 1.8 Hardware Mode Select (courtesy of Motorola)
Equation 1.1. The HC11 uses a 16-bit address. Therefore, it can address 2^16 or 64K unique memory locations.
where n is the number of address bits in the system.
Although an address can be generated from each combination of binary bits in the address, there may not be physical memory at all locations in the address range. A memory map designates the memory addresses that are connected to physical memory locations and indicates which locations are unused. For example, a system may have a 16-bit address bus, which allows it to address 64K memory locations. However, the system may have only 16K of physical memory connected. In this case, the memory map indicates the address range within the 64K range that will be used for this 16K device. Figure 1.9 illustrates how this memory map would look.
The data is the information stored at each memory location. Since all data is just a group of binary bits, it all appears about the same to the processor. It is impossible by simple inspection to know if a value in memory is a number, a special code or a piece of a larger address. The real value of the data is how it is used. The meaning of the data comes from the order in which it appears in the memory, as well as how it is used by the processor.
The process of storing data in memory is called a write operation. When a specific memory location is addressed, the data can be written to the data bus by the processor, as shown in Figure 1.10. The processor generates the address $ 0005 and sends it to the memory device on the address bus. Then the processor places the data $CF on the data bus. The processor tells the memory what type of operation to perform via the control signals. Writing to memory is a destructive process, which means that any data previously in the memory location is overwritten by the new data and the old data is lost. After a write operation, the data will remain in the memory location until it is overwritten by another write operation.
Data can also move from the memory location to the processor via a read operation, as shown in Figure 1.11. A read operation causes a copy of the data to be sent to the processor from the memory. The processor initiates a read operation by placing the address ($0007) on the address bus. It then signals the memory to
$ 16K device
$3FFF $
$FFFF
unused
Figure 1.9 Example of Memory Map
The physical memory locations can be represented by various types of memory devices. Two different types of memory made from semiconductor materials will be described: volatile and nonvolatile. Volatile memory is a memory that retains the data only when the power is applied. If the power is removed, the data stored in the memory locations will be lost. As the name implies, nonvolatile memory is not volatile. A nonvolatile memory retains the data with or without power being applied to the device.
RAM stands for Random Access Memory; however, it is better described as read/write memory. Most memory on modern computers is random access, which means that it can be randomly addressed (the data is accessed in any order the processor chooses). Sequentially accessed memory is used only for special processing and timing applica- tions and will not be described in this text.
RAM is volatile , retaining data only when the power is applied. If the power going to RAM is turned off, all data contained in it is lost. When power is reapplied, the content of RAM is undefined, which means the data can be any value. RAM is used for temporary storage of programs while they are being executed, as well as for temporary storage of data while it is being processed. RAM is relatively fast memory when compared to the whole family of various memory devices. RAM is also relatively less expensive, uses less power and is smaller than most memory devices.
ROM stands for Read Only Memory. ROM is used for permanent storage of programs and data. It is a nonvolatile memory; therefore, it always retains its data, whether power is applied or not. Standard ROM must be loaded with the permanent programs and data during the manufacturing process. Other types of ROM have been developed that allow programs and data to be written to them after the manufacturing process.
Programmable Read Only Memory or PROM is designed to be programmed in the field, after the manufacturing process. This provides the user the ability to purchase one chip and use it for various purposes dependent upon the field application. PROM can be programmed one time. If a program or data contained in a PROM needs to be modified, the PROM must be discarded and a new one must be programmed.
Erasable Programmable Read Only Memory, EPROM , is a type of PROM that can be erased by applying an intense ultraviolet light to the memory circuitry. Once it has been erased, it can be reprogrammed using a special programming fixture. Chips that contain EPROM have a small window on the chip package that allows the light to reach the memory circuitry. Once an EPROM is programmed, this window is covered to stop light from entering the device and inadvertently erasing the memory locations.
Electrically Erasable Programmable Read Only Memory, EEPROM , can be erased with electrical signals and then reprogrammed. EEPROM is used in various devices that
require permanent memory yet need the convenience of electrical erasure. Single locations within an EEPROM can be erased and reprogrammed.
The HC11E9 contains three types of on-chip memory, RAM, EEPROM and ROM, as shown in Figure 1.12. There are 512 bytes of RAM located in the memory map, from $0000 through $01FF. In addition to the RAM, the HC11 contains 512 bytes of EEPROM and 12K of ROM. The EEPROM is located from $B600 through $B7FF in the memory map, and the ROM is located from $D000 through $FFFF. In addition to this memory, a 64-byte register block is located at $1000 through $103F within the memory map. Refer to chapter 8 for a further presentation regarding HC11 memory.
The third element of every computer system is the I/O. All computers must input data from at least one source. The data is processed internally and then output to an external device. Not all I/O capabilities are related to specific devices. For example, most desktop computer systems have general I/O ports. A port is an I/O connection that allows for the movement of data between the computer and an I/O device. There are two major types of ports on computers: serial ports and parallel ports. A serial port is
Figure 1.12 Memory Map on the HC11E
$ 0200 $ 0000
$ 1000
$ B
SINGLE CHIP
$ FFFF
$ D
512 BYTES RAM
64-BYTE REGISTER AVAILABLE BLOCK FOR EXPANDED MEMORY 512 BYTES EEPROM
FFFF
B B7FF
D
1000 103F
0000 01FF
12 KBYTES ROM
$ 0FFF $ 1040
$ B5FF $ B
$ CFFF
See chapter 12 for explanation of the Port A timing system.
Port B is an 8-bit general-purpose output port. Port C is an 8-bit general-purpose port that can be configured for either input or output operation.
T he primary I/O functions of Port B and Port C are presented in chapter 9.
Port D is a general-purpose digital port and also supports serial communication functions. The digital I/O function uses the six I/O pins of Port D as programmable I/O pins. When used for serial communications, two independent serial interfaces can be configured. They are called the serial communications interface (SCI) and the serial peripheral interface (SPI).
T he serial communications capabilities built into Port D are discussed in chapter 13.
Port E is an 8-bit general-purpose digital input port that can be configured as an 8-channel analog-to-digital converter with an internal resolution of 8-bits.
T he analog input capabilities of the HC11 are presented in chapter 11.
Figure 1.14 HC11 I/O Ports (adapted with permission from Motorola)
A full explanation of the function of the EVBU is presented in the Universal Evaluation Board User’s Manual. Refer to section 4.6 of the EVBU User’s Manual for a description of the BUFFALO monitor commands.
The EVBU is the Motorola M68HC11 Universal Evaluation Board. It is a development tool for HC11 microcontroller-based designs. It provides a variety of features with which to experiment with the functions of the HC11 and to test designs based on the HC11. It also works well as an educational tool. In addition to the HC11 chip, the EVBU contains the following hardware features:
◗ M68HC68 Real-time clock chip. The real-time clock chip provides accu- rate timing information in seconds, minutes, hours, and so on. ◗ Standard serial communications port. This port allows connection to an external computer. ◗ Breadboard area. A small solder pad development area is provided on the EVBU layout.
The EVBU has a monitor program that serves as an operating environment. The monitor program is a piece of software that provides a controlled environment in which the HC11 can operate. It also provides a user interface (UI). The UI allows a user of the EVBU to enter some simple commands to access memory, run programs and monitor the function of the HC11. The monitor program is called BUFFALO (Bit User Fast Friendly Aid to Logical Operations). BUFFALO works in conjunction with the EVBU hardware to provide the following features:
◗ One-line assembler. The user can enter programs directly into memory. ◗ Program download. Programs that have been created externally can be loaded directly into memory. ◗ Troubleshooting capabilities. BUFFALO commands allow users to exe- cute programs one step at a time, to stop programs at a particular in- struction and to examine the contents of the registers and memory.
BUFFALO is burned into the HC11 on-chip ROM during the manufacturing process. It occupies 8K of the 12K of available ROM. In addition, some of the RAM is used by BUFFALO as system temporary memory. Therefore, only part of the RAM is available for user programs and data. However, the EEPROM is unused by the EVBU and is