|
Microprocessor
systems and microcontrollers
Microprocessors play an important part in modern day life. They
are used to control domestic appliances, like the microwave cooker,
car engine management and braking systems, cash dispensing machines,
mobile telephones and so on.
In most applications, the microprocessor takes in information
from the outside world, processes it in some way and uses the result
to control some device, such as a motor, or heater, or displays
the outcome on a monitor screen.
It is a programmable device, meaning that its behaviour is dictated
by a list of instructions, called a program.
The microcontroller is a programmable device which can provide
all the elements of a microprocessor system.
- processing
- memory,
used to store the program which the microprocessor must follow,
and data needed by or produced by the program,
- an input/output port, through which data is received from and returned to
the outside world,
- and a clock,
used to synchronise and regulate the flow of data around the
system
Programming Language
The
microprocessor receives its instructions from a program stored
in memory. These instructions
are in form of binary numbers, the
only ‘language’ that the microprocessor, a digital
system, ‘understands’. This is known as machine
code.
Humans do not find it easy or efficient to use binary numbers,
and so hexadecimal numbering is usually used to enter, or to list
the machine code program.
High
level languages e.g. BASIC, have been developed to make programming
easier and bear a resemblance to everyday English.
An elaborate program called a compiler carries out the process
of translating the high-level language into machine code. This
process slows down the running of the program. Machine code programming
is the most efficient in terms of memory space and execution time.
The complete list of
instructions, which a particular microprocessor can execute,
is called the instruction set. Each instruction can
be described by a mnemonic, to make it intelligible to us, or as
a hexadecimal or binary number. For example, ‘incf’ stands
for ‘increment file’ meaning ‘add one to the
number stored in the file (or register) referred to. The machine
code for this instruction is the binary number 00 1010.
A program, then, is a series of numbers, identifying what instructions
the microprocessor must carry out, together with any data it needs
to do this. Embedded in the microprocessor itself, is a program
containing the sequence of operations needed to execute each instruction.
The PIC program can be saved in two forms, either in machine code
or in assembler language, (the mnemonics). The former is called
the object file and the latter the source
file.
|