Introduction to Microprocessors

A microprocessor is an electronic device commonly regarded as the brain of a computer system. This is the most important part of almost every modern electronic equipment. It was in 1971 Intel developed world’s first microprocessor. It was a 4-bit, single-chip device. The serial number given was 4004. An enhanced version Intel 4040 was also brought out by Intel followed by the success of the first processor. The whole world of digital electronics was attaining a new momentum with the introduction of microprocessors.This chapter gives one an idea of microprocessors.

Microprocessor

It is a register-based, programmable device built to perform the functions of a central processing unit on a single or a few integrated circuits. With the advent of miniaturized processors called microprocessors which have revolutionized digital electronics, electronic equipment embedded with microprocessors have become the part and parcel of our day to day life and activities.

As we have mentioned earlier, a microprocessor is a device which has all the faculties of a central processing unit. It has a register unit, arithmetic, and logic unit, control unit, input/output unit and the memory unit. There are address and data buses to transfer address and data instruction.

Registers

According to the purpose and the type of information it deals with, the registers are divided into several types. They are the accumulator, general purpose registers, instruction register, status register, dedicated registers, stack pointer and program counter.

Accumulator

It is also called result register as it is in this register the results of the various processes are stored. This register is incorporated in various arithmetic and logic operation as in such operations, one operand is from accumulator while the other is from any other internal registers or brought in by the data bus from the main memory. An accumulator is an 8-bit register.

General Purpose Register

There are six 8-bit general purpose registers in the microprocessor labeled B, C, D, E, H and L. These registers can be used individually in case it has to deal with an 8-bit data or they can be used as a pair of registers which will enable them to register 16-bit address. Only specific pairing is allowed such as B-C, D-E, and H-L.

Instruction Register

The purpose of this register is to store the instruction to be processed next. The 8-bit instruction stored in the instruction register is transferred to the instruction decoder the same time it is received by the instruction register. The instruction decoder decodes the instruction and a signal is sent to the control unit.

STATUS REGISTER

These registers are also called condition flags as they operate to indicate several conditions. They are a set of flip-flops indicating several conditions such as the presence of a carry, auxiliary carry, sign, zero and parity.

Dedicated Registers

As the name implies, these are registers meant for some special, dedicated purposes. These registers can only be accessed by the manufacturer and not the programmer.

Stack Pointer

These are 16-bit registers and are used to point to the stack in the memory, especially while dealing with a subroutine. The stack is that part of memory where the register contents are stored temporarily when interrupt like events occurs. CPU uses the stack registers for storing the values of a present register and flag contents and jump to interrupt handling subroutine. It operates in the LIFO manner (last in, first out).

Program counter

This register holds the 16-bit address of the instruction that has to be loaded into the instruction register. After each instruction is fetched, program counter points to the next instruction. And the stored value in the program counter is increased by one each time a new instruction is fetched. When the computer restarts, the program counter reverts to zero. Based on the decoded instructions, the program counter can get modified based on the operation of the instruction (for example, a jump instruction).

Arithmetic and Logic Unit

This is where the complex arithmetic and logic operations are processed. It is one of the most important parts of a microprocessor and this unit is the one which is being designed first. The rest are designed accordingly.

Control Unit

This is the unit where decoding and control actions of the instructions take place. With the help of a clock signal, the control unit controls the activities of various units of the system and thereby flawless execution of programs is ensured.

Memory Unit

In a microprocessor, the memory is needed mainly to store three type of information: instruction, data, and address. According to the characteristic features, memory is divided into random access memory, read-only memory and bipolar and unipolar memories.

Random access memory (RAM)

RAM or read-write memory is used when there are possibilities for the stored information, including programs, to be changed during the operation of the system. Because of this feature, RAM is regarded as the volatile memory.

Read-only memory (ROM)

In this type of semiconductor memory, the programs are fixed. That means once the information is loaded into the memory, it can not be altered. Because of this characteristic, this type of memory is non-volatile. There are different types of ROMs such as mask ROM, programmable ROM, electrically alterable ROM and erasable programmable ROM.

Mask ROM is custom programmed and can not be altered once manufactured. These are costly. Programmable ROM, as it is aptly termed, can be programmed by the user. This is achieved by electrically overheating the fusible links selectively. Once programmed the content cannot be altered. Electrically alterable ROM is another kind of ROMs. In this type of ROMs, the memory can be reprogrammed by the user by electrically erasing the programs with the help of high amount of negative voltages applied to the control gates of the circuit. Memory in the erasable programmable ROM can also be erased and reprogrammed by applying a high-intensity ultraviolet light.

Another classification of memory is based on the technology with which it is manufactured. There is MOS unipolar and bipolar memory available. Erasable memories are only available with MOS technology while the mask ROMs and PROMs are available with bipolar technology. In MOS devices, power consumption and speed factors are low and it is cheaply available while the bipolar devices require more space and consume more power.

Buses

Buses are in simple terms the highways by which the data, address, and control signals are transferred from one unit to the other in the microprocessor. Information is transferred as a group of bits. In a bus, there are wires for each bit to be transferred from one location to the other. So if a data is 8-bit in size, all the 8 bits can be transferred at a time, parallel to each other.

There are three buses in a microprocessor. They are the data bus, address bus and control bus. Data bus is the bus which transfers the data to and from the I/O devices to the memory while the address bus is unidirectional. It carries the address of the I/O device from the memory and it is received by all the devices and only the device which is addressed response. The control bus carries the control signal which controls the activities of various devices in the system.

Peripheral Interfacing

Interface circuits are needed when one or more I/O devices have to be connected to the microprocessor. The data transfer between the peripheral device and the microprocessor takes place basically in two different ways: programmed data transfer and direct memory access transfer.

In programmed data transfer, the peripheral devices are requested to transfer data to and from the accumulator. There are exceptions as in some microprocessors, programmed data transfer can also take place between other internal registers and the peripheral devices. This is particularly useful when a small amount of data is needed to transfer with comparatively slow input/output devices.

Direct memory access transfer is used when a large amount of data have to be transferred to and from the peripheral devices, just as in the case of data transfer from a mass storage devices. The interface is relatively complex than that is used in the case of programmed data transfer.

Programming a Microprocessor

A program is a sequence of instructions fed to the computer system in order to make it function according to the requirement. A number of programs grouped together are called a computer software. There are several languages in which the programs are written in the computer. They are machine language, assembly language and high-level language.

Machine language is a computer language in which the instructions are written as binary codes. Assembly language is relatively easier as the instructions are written as alphanumeric symbols. These assembly language programs are converted to machine language before it is stored in the microprocessor.

The high-level language is any user-friendly computer language which can be easily learned and operated by the programmer. There is an array of high-level languages available including C, C++, Java etc. Before getting stored and executed, these high-level language programs are converted to machine language.

Instruction set: The instruction set of a microprocessor consists of different types of instructions. Basically, there are five varieties. They are data transfer instructions, arithmetic instructions, logical instructions, branch instructions and stack, I/O and machine control instructions.

The data transfer instructions are intended to move data between registers. arithmetic instructions as the name implies, help execute arithmetic functions such as add, subtract, increment or decrement data. Logical instructions include logic functions such as AND, NAND, OR and XOR etc. Branch group is another category of instructions which include instructions to call a subroutine, jump operation etc. Condition instructions also include in this group of instructions. They help the processor make a decision during the execution of a program. These instructions are incorporated to move data between the microprocessor and I/O devices. These instructions help manipulate the stack and it alters internal control flags.