LECTURE 6
PROGRAMMABLE
LOGIC DEVICES (PLDS). INTRODUCTION TO MICRO-PROCESSORS AND MICRO-CONTROLLERS
6.1.
INTRODUCTION
Programmable Logic Devices
(PLD) are programmable systems and are generally used in manufacturing
automation to perform different control
functions, according to the programs written in its memory, using low level languages
of commands. There are following three types of PLDs are being employed in
mechatronics systems:
1. Microprocessor (it is a digital integrated circuit which carries out necessary digital
functions to process the information obtained from measurement system);
2. Microcomputer (it uses microprocessor as its central processing unit and contains all
functions of a computer);
3. Programmable Logic Controller (PLC). It is used to control the operations of
electro-mechanical devices especially in tough and hazardous industrial
environments.
Fig. 6.1.1. Components of a
programmable logic device
A typical programmable
machine has basic three components as shown in Figure 6.1.1:
1. Processor, which
processes the information collected from measurement system and takes logical
decisions based on the information. Then it sends this information to actuators
or output devices.
2. Memory, it stores:
a.
the input data
collected from sensors
b.
the programs to
process the information and to take necessary decisions or actions. Program is
a set of instructions written for the processor to perform a task. A group of
programs is called software
3. Input/output devices:
these are used to communicate with the outside world/operator.
Microprocessor
It is a multi-purpose,
programmable device that reads binary instructions from a storage device called
memory, processes the data according to the instructions, and then provides
results as output. In common practice it is also known as CPU (central
processing unit). CPU can be referred as complete computational engine on a
single chip. First Microcontroller, Intel 4004 was launched in 1971. It was
able to process just 4 bits. It started a new era in electronics engineering.
Microprocessor chip was one of the important inventions of the 20th century.
Applications of
microprocessors are classified primarily in two categories:
1. Reprogrammable Systems : Micro computers;
2. Embedded Systems : photocopying machine,
Digital camera.
Microprocessor works or
operates in binary digits i.e. 0 and 1, bits. These bits are nothing but
electrical voltages in the machine, generally 0 – low voltage level, and 1
-high voltage level. A group of bits form a ‘word’. In general, the word length
is about 8 bits. This is called as a «byte». A word with a length of 4 bits is called as a «Nibble» Microprocessor processes the «commands in binary form» to accomplish a task. These are called as «instructions». Instructions are generally entered through input
devices and can be
stored in a storage device called memory.
Fig. 6.1.2. Schematic of
configuration of a micro processor
Figure 6.1.2 and 6.1.3 show the configuration and basic blocks of a
microprocessor. The functions of each element are as follows.
Fig. 6.1.3. Working of a
microprocessor
1. ALU: ALU stands for Arithmetical Logical Unit. As name
indicates it has two parts:
a. Arithmetical unit which is responsible for
mathematical operations like addition, subtraction, multiplication and division;
b. Logical unit which is dedicated to take
logical decisions like greater than, less than, equal to, not equal to etc.
(Basically AND/OR/NOT Operations).
2. Register
Array: Registers are small storage devices that are available to CPU or
processors. They act as temporary storage for processing of intermediate data
by mathematical or logical operations.
3. Control: This part of CPU is dedicated to coordinate data flow
and signal flow through various types of buses i.e. Data Bus, Control Bus, and
Address Bus etc. It directs data flow between CPU and storage and I/O devices.
4. Memory: There are two different types of memory segments
being used by the CPU. First is the ROM which stands for Read Only Memory while
other is R/W which stands for Read and Write Memory or Random Access Memory
(RAM).
a) ROM: From this memory unit, CPU can only read the stored data. No writing
operations can be done in this part of memory. Thus it is used to store the programs
that need no alteration or changes like Monitor Program or Keyboard driver etc.
b) R/W: As name indicates it is opposite to ROM and used for
both reading and writing operations. In general User’s program and instruction
are stored in this segment of memory unit.
5. Input
Devices: Input devices are used to enter input data to
microprocessor from Keyboard or from ADC which receives data from
sensors/signal conditioning systems.
6. Output
Devices: These devices display the results/conclusions coming
out from ALUs either in soft copy (Monitor) or in Hard Copy (Printer).
6.2. FUNCTIONS
OF MICROPROCESSOR
Various functions of
microprocessor are as follows:
·
Microprocessor
performs a variety of logical and mathematical operations using its ALU;
·
It controls data
flow in a system and hence can transfer data from one location to another based
on the instructions given to it;
·
A microprocessor
can take necessary decisions and jump to a new set of instructions based on
those decisions.
Elements of
microprocessor
A simple microprocessor
consists of following basic elements (see Figure 6.1.3):
·
Data Bus;
·
Through data
bus, the data flow between various storage units;
·
ALU and memory
units;
·
Address Bus: It
controls the flow of memory addresses between ALU and memory unit;
·
RD (read) and WR
(write) lines set or obtain the addressed locations in the memory;
·
Clock line
transfers the clock pulse sequence to the processor;
·
Reset Line is
used to restart execution and reset the processor to zero;
·
Address Latch is
a register which stores the addresses in the memory;
·
Program Counter:
It is a register which can increment its value by 1 and keeps the record of
number of instructions executed. It can be set to zero when instructed;
·
Test Register:
It is a register which stores intermediate or in-process data of ALU
operations. For example it is required to hold the «carry» while ALU is performing «addition» operation. It also stores the data which can be
accessed by Instruction decoder to make any decision;
·
3-State Buffers:
These are tri-state buffers. A tri-state buffer can go to a third state in addition
to the states of 1 and 0;
·
The instruction
register and instruction decoder are responsible for controlling the operations
of all other components of a microprocessor.
There are following control
lines present in a microprocessor, which are used to communicate instructions
and data with the instruction decoder:
·
Instruct the A
register to latch the value currently on the data bus;
·
Instruct the B
register to latch the value currently on the data bus;
·
Instruct the C
register to latch the value currently output by the ALU;
·
Instruct the
program counter register to latch the value currently on the data bus;
·
Instruct the
address register to latch the value currently on the data bus;
·
Instruct the
instruction register to latch the value currently on the data bus;
·
Instruct the
program counter to increment;
·
Instruct the program
counter to reset to zero;
·
Activate any of
the six tri-state buffers (six separate lines);
·
Instruct the ALU
what operation to perform;
·
Instruct the
test register to latch the ALU's test bits;
·
Activate the RD
line;
·
Activate the WR
line.