Beruflich Dokumente
Kultur Dokumente
INTRODUCTION
The control unit at the heart of a wide variety of modern systems is electronic and
more often than not it is a programmable device, i.e., a microprocessor. The term
micro comes from the fact that the earliest devices were designed to execute a
sequence of operations in response to an applied command. The sequence was stored
internally in the device as binary code, i.e., the microcode, hence the name. The
applied command is the program instruction stored in the system memory. The system
memory is usually considered as a separate component into which the program code
is downloaded for a particular process. Fig. 1 shows a simplified microprocessor
based system.
Program
Memory
ROM device
Processor
Device
Data lines
Scratchpad
Memory
Peripherals
Output
Devices
Switches
6800
Keypads
6809
Displays
Z80
ETC.
Input
Devices
Sensor
systems
Etc.
RAM device
Figure 1
There are two broad categories into which most microprocessor systems may be
divided
1.
2.
Today the most common example of a general purpose computing system is the
personal computer (PC). Its function depends on the application software, i.e. specific
programs loaded into the main memory (RAM) from a back up memory such as a
hard disk. Text editors, spreadsheets, games and so forth are examples of application
software. A general management program known as the operating system is always
present in such systems, i.e. Windows, DOS or UNIX.
Other more specialised systems, that use microprocessor technology to control their
processes, are often referred to as having the computers embedded in them, e.g., laser
printers, washing machines, alarms, cars and so forth. Usually, the programs are
permanently resident in the system in ROM/FLASH memory (no disk drives) and
loaded at the time of manufacture. These programs and related data are called
firmware. (The same applies to highly specialised systems such as those designed for
a particular industrial process). This module is primarily focused on such systems
rather than PC technology.
Types of Processor
Initially, the microprocessor was developed to replace discrete logic devices (AND
gates etc.) in relatively simple control applications such as traffic lights and not to
replace the CPU (central processing unit) of a computer. These early processors
handled information in small bundles of 4 or 8 bits and this is still more than adequate
for many embedded applications. An early example of one such device was the
Motorola 68XX family of 8-bit processors (the first of these, the 6800, was originally
marketed in 1974. Most common 8-bit microprocessors have a similar structure to the
6800, albeit more complex. The 6809 is the most advanced member of the original
68XX family of devices and was used in DIT in the past. Other manufacturers also
developed families of devices. In the early eighties the Intel 8088 became the central
processing unit of the first PCs manufactured by IBM. (However, Microchip PIC
products are now used in the laboratory and this module).
The machine code programs (the binary codes in the system memory) became
increasingly complex as newer devices were developed. Such processors are often
referred to as CISC (complex instruction set computers) devices. To improve speeds,
mainly for computing application and graphics, processor designers developed new
architectures (internal structure of the device) that required fewer instructions. These
are called RISC (reduced instruction set computers). However, manufacturers
eventually developed RISC type device for general purpose non-PC applications (for
example the PIC devices used in this course).
Basic microcomputer
Referring to Figure1 apart from the processor and memory, the other main elements
are the devices to control the transfer of information between the outside world and
the computer, I/O (input/output) devices. (Note that in the past the term CPU would
have included not just the processor but some memory and I/O devices). Figure 2 is a
typical 8-bit embedded system diagram showing the minimum elements of a
microcomputer system. A simple system could have connections to input and output
elements such as switches (or maybe a keypad) and LEDs (or a seven-segment or
LCD display).
The register concept is described later; just think of it as a storage box for 8bits...which is really all that it is. The peripheral interface box in figure 5.2 is also a
register and usually called a port, i.e. the gateway between the outside world
(peripherals) and the inside of the microcomputer system. It acts as a buffer/storage
location to isolate the peripherals (switches or LEDs) from the data bus since only one
value can be on the data bus at a given moment. Furthermore, if no buffer was
present then the values of the switches would always be on the bus effectively
freezing it at those values and preventing anything else from happening. Similarly the
port stores values so that the LED will stay ON or OFF as required (not just flash for a
moment).These are special registers
programmer as A, B,C. etc. (but they are really identified by the address number)
More about that later. So you will see references to PORT A and PORT B a lot
LEDS
W
(working)
Register
Figure 2
Switches
The RAM and the ROM can be viewed as rows of registers as shown in Figure 3
(under the word content). The number beside each register is the means of
identifying that particular location, i.e. the address number. A typical store process
would involve the microprocessor loading the address bus (maybe 16-bits) then
signalling a store operation (or write) using a control line signal which tells the RAM
to read the next byte from the data bus. (A read control signal would cause the
reverse to occur, i.e. the contents of the RAM would load onto the data bus and copy
into the W register). Notice the RAM has two control lines connected read/write.
Different peripheral interfaces are also identified using address numbers which are
decoded to select a given device.
The program code which drives all of this is stored in ROM memory. The process of
fetching an instruction code from ROM is the same, .i.e., an address number (on the
address bus) followed quickly by the transfer of the instruction code into the
microprocessor (but a different part not the W register). This is known as the
FETCH process and the subsequent actions such as a load from the switches into W
is the execute phase.
Figure 3
address bus.
Note: that the term FILE is also used with the term register to describe
locations in memory (or possibly ports and so forth) where data may be stored
or accessed from.
This type of microcomputer where there is a single data bus and single address bus
which is shared between the program memory (ROM) and everything else is called
Von Neumann architecture. (See book for more details). Figure 4 shows a general
representation of such a system. Although the structure is relatively simple (which is
usually a good thing!) the shared buses means that the fetch-execute process
requires a complete execution of the instruction before the next instruction can be
fetched. Consider the fetch as being action 1 AFTER which the execute occurs,
action 2. Consider the following example instruction and execution.
MOVE PORT(A) to W
action 1 (a)
The above is the instruction which is stored in program memory and FETCHED
(action 1(a) ). The following (action 2) is the actual copying of the contents of the
PORT A register into the W register.
PORT(A) - W
action 2(a)
Figure 4
MOVE W to RAM(20)
action 1(b)
action 2(b)
RAM (20)
If there was two extra buses (an extra data and extra address bus) then we could
effectively divide the system into two sections, i.e. the FETCH SIDE (with one pair of
buses) and the execute side (with the other pair). This type of system is known as
HARVARD architecture. What this means is that the system does not have to wait for
the current instruction to finish before it can fetch the next instruction. This means
that in the above instruction examples action 1(b) is performed at the same time as
action 2(a) and this speeds up the system operation.
Another advantage is that the size of the buses can be different. As a result in an 8-bit
system (as far as data is concerned) the program data bus can be bigger. This allows
instructions to be bigger than 8-bits. Often an instruction in a Von Neumann
architecture system requires more than 8-bits, thus requiring the fetch process to
access the program memory (or store) several times to get the complete instruction.
This slows down the overall operation of the system. In Harvard architecture, like the
PICs used in this module, the program store is 13/16-bits (depending on device) and
all the information for a single instruction is stored in a single memory location. This
is fast and efficient. When programming a system the architecture is often invisible
to the programmer but it does occasionally matter when you are performing bit level
operations or need fast processing. Figure 5 shows a simplified diagram (see book) of
Harvard architecture with some elementary system elements. Note that the FILE
STORE can also mean the I/O ports which are organised as 8-bits.
Figure 4
Because many embedded applications are relatively simple, requiring short programs
and limited data variables, manufacturers have developed processors that contain
some memory and I/O devices integrated into a single chip. For instance, the 68HC11
series or PIC devices by Microchip. These devices are called microcontrollers and are
in effect a single chip computer.