Microprocessors Lecture 2
Revision/summary
The main components of a small computer system are:-
MEMORY - Stores the program and data required by the program
INTERFACES - Communicate with the outside world
PROCESSOR - Carries out the program instructions one at a time
All data and instructions in any computer system are stored in
binary. If they appear in any other form then a translation must
have been carried out.
The meaning of a binary number depends entirely on how it is
used, or on its context. E.g. 10000110 is clearly a binary number
which can be translated into 86 in hexadecimal notation. If it is
part of an 6809 program and is executed as an instruction then it
would have the effect of 'Loading accumulator A using immediate
addressing'. If it is used as data in unsigned arithmetic then it
has the value 134 in decimal. If it is used in twos complement
arithmetic, however, it has the value -122. Its negative because
the most significant bit is a 1. If it sent to a vdu then it will
be interpretted as an ASCII character and the letter N will be
displayed. Alternatively it might be in the address part of an
instruction and refer to a memory location. It might be sent to
an interface connected to a pelican crossing and result in the
green traffic lights being turned on, the red 'do not cross,
signs being illuminated and the 'WAIT' signs being on.
This is a very important point which many people have difficulty
in grasping - that a pattern of 1s and 0s has no intrinsic
meaning it all depends on what you do with it.
MEMORY is a mass of registers where binary data can be stored.
Some may be read-only; their contents cannot be changed, others
may be read-write; what is stored can be changed whenever
necessary. Every register has an address, which is also a binary
number, by which it can be referenced to distinguish it from
other memory registers. Surprisingly this address may not be
unique. As we shall see later a memory register may have several
different addresses. E.g. the register at address 0000 may also
have address 4000 and 8000 and C000. What must not happen, and
this is down to the system design, is that two memory registers
have the same address otherwise when you read from that address
you don't know which data you're getting.
INTERFACES - also appear as registers in memory but they are not
simply passive memory locations where you always get back what
was stored in them. They are connected to external devices so when
you store a binary value in memory location FE00 for example, if
that address is an interface to a set of LEDS, then the stored
value will cause certain LEDs to be turned on and others to be
turned off. When you read data from FE01, if that is an interface
connected to a set of switches than the data is not what has been
previously stored in that location but the setting on each of the
switches. These days most interface devices are programmable
which means they can perform a variety of functions. This makes
the devices more flexible and means that the same interface
device can be used in a wide range of applications. In order to
customise the interface for one particular application it will
frequently need to be set up by storing values in control
registers. These again appear as memory registers.
The PROCESSOR - is obviously the most important part of the
system and is where all the instructions are carried out. it
takes the instructions one at a time, normally in the order in
which they are stored in memory, and executes them. Generally
speaking there are three groups of instructions -
- Data Movement (or Memory Reference) - These instructions move
data from one register to another, usually from memory registers
to registers inside the processor and vice versa. E.g 'Load
accumulator A with the contents of memory register 002E'.
- Arithmetic & Logical - These operate on data usually already in
processor registers to perform arithmetic operations such as
addition or logical operations such as shifting one bit to the
left.
- Program Control (Jump and Branch) - These alter the program flow
from the normal one instruction after another in the sequence
stored in memory. E.g Jump to the instruction in memory register
201A. Often these are conditional so that program loops can be
created. E.g. 'Go back 8 instructions if the result of the last
arithmetic instruction was not zero'.
Early computers stuck fairly rigidly to these three groups but
more modern processors, like the 6809, blur the distinctions by
having instructions which combine two operations into a single
instruction like 'Add the contents of memory register 201A to
accumulator B'. This is both data movement and arithmetic in one
instruction.
Registers
In order to achieve this the processor has a number of internal
registers -
User-programmable registers in the M6809
Buses
These are data paths which enable data to be transferred from
one device to another in the system. In a computer system these
are normally parallel in nature i.e. to transfer 8 bits of data
we need 8 wires (or 8 tracks on a PCB) connected to each device.
There are two such buses which are necessary.
- Address Bus - Connects the processor to memory devices and
interfaces. It is used by the processor to indicate which memory
register (or interface register) is the source or destination for
data. In 6809 it has to be 16 bits. Since the address is always
supplied by the processor (except in DMA) the processor always
outputs data on this bus and the other devices always input or
receive data.
- Data Bus - This is used to transfer data between the processor
and memory registers and interface registers. The source of data
may be the processor or it may be a memory register or an
interface register: To avoid damaging the devices or scrambling
data only one device may place data on the bus at a time. This
will be either the processor or the device addressed by the
binary pattern currently on the address bus. Normal logic gates
have only two output states high (1) or low (0). Gates connected
to a bus of this type must have a third high-impedence state when
they are effectively not outputting anything but allowing another
device to output data. The data bus in a 6809 system has 8 bits.
Back
ACKNOWLEDGMENT: Some of the above was taken from Dr A J Tollyfield's notes.