Unit-Iv:: Introduction To Micro-Processors and Micro-Controllers

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

UNIT-IV: Digital electronics and systems, digital logic control, micro

processors and micro controllers, programming, process controllers,


programmable logic controllers, PLCs versus computers, application of
PLCs for control.
Introduction to Micro-processors and Micro-controllers
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.
A typical programmable machine has basic three components as shown in Figure 3.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.

Figure 3.1.1 Components of a programmable logic device


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 th
one of the important inventions of the 20 century. Table 3.1.1 shows the history of
micro-processors.

Table 3.1.1 History of Micro-Processors

Name Date No. of Width of Clock Data Millions of


Transistors smallest Speed Width Instructions
wire on (In Bits) per
chip second(MIPS)

8080 1974 6000 6 2MHz 8 0.64


8088 1979 29000 3 5 MHz 16 0.33
80286 1982 134000 1.5 6MHz 16 1
80386 1985 275000 1.5 16 32 5
80486 1989 1200000 1 25 32 20
Pentium 1993 3100000 0.8 60 32 100
Pentium 1997 7500000 0.35 233 32 300
II

Pentium 1999 9500000 0.25 450 32 510


III

Pentium 4 2000 42000000 0.18 1.5 GHz 32 1700


Pentium 2004 125000000 0.09 3.6 GHz 32 7000
4P

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.

Figure 3.1.2 Schematic of configuration of a micro processor

Figure 3.1.2 and 3.1.3 show the configuration and basic blocks of a microprocessor. The
functions of each element are as follows.
Figure 3.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). 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 3.1.3):
• Data Bus: Through data bus, the data flow between
a. various storage units
b. 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
2.Microcomputer
Microcomputer is a microprocessor based system. It is a data processing system that
employs a microprocessor as its central unit. Based on the input it takes decisions. These
decisions are further used to control a system or to actuate an action or operation.
3.1 Microprocessor based programmable controller
Figure 3.1.4 Schematic of microcontroller.

It is a microprocessor-based system. It implements the functions of a computer and a


controller on a single chip. Generally microcontroller is programmed for one specific
application and it is dedicated to a specific control function.
Microcontrollers find applications in automobiles, aircraft, medical electronics and home
appliances. They are small in size and can be embedded in an electromechanical system
without taking up much space. Thus we can have a system with its functions completely
designed into a chip. However microcontrollers have very little user programmable
memory. Various types of microcontroller chips available in market are: Motorola
68HC11, Zilog Z8 and Intel MCS51 and 96 series.
PROGRAMMING LANGUAGES
Low Level Programming Language

Microprocessors recognize the binary numbers and they operate in binary numbers. Each
microprocessor has its own binary words, meanings and languages. Each machine has its own set of
instructions based on the design of its CPU. Binary language is called as machine language.
Englishlike words are used to represent the binary instructions of a machine. This is called as assembly
language programs. The general purpose languages such as BASIC, FORTRAN, C, etc. are called as
high-level languages. The machine language and assembly language are however specific to a
microprocessor, therefore these are termed as low-level languages.

Assembly language
In assembly language, a word length is of about eight bits. It is called as a byte. Assembly language
can have 256 combinations of bytes. Thus the language has 256 words. There can be a various patterns
of bytes. With the help of electronic logic gates, these patterns give a specific meaning to each
combination of bytes. These are called as an ‗instruction‘. Instructions are made up of one word or
several words. The set of instructions designed into the machine makes up the machine language that
is specific to each microprocessor based system viz. micro-computer.
Thus we can say,
‗Machine language is the binary medium of communication through a designed set of instructions
specific to each computer.‘
‗Assembly level language is a medium of communication with a computer in which programs are
written in mnemonics. An assembly language is specific to a given computer.‘

Assembly language programming

Assembly language programming is generally written by using hexadecimal codes. Programs can be
written by using special keyboard equipped with using hex keys. Programs also have instructions to
translate these keys into their equivalent binary patterns. The data and instructions are stored in
prescribed locations in memory. An operation code is written which accomplishes the intended task(s).
These tasks are carried out on ‗operand(s)‘ by the operation code. 8085 is a typical general purpose
microprocessor and has 8-bit word length. Now, let us learn its architecture, working and
programming.
Internal Architecture of 8085 Microprocessor
Register Array
8085 Microprocessor consists of six registers, one accumulator and a flag register. The typical
architecture is shown in figure 3.2.2. There are six general-purpose registers B, C, D, E, H, and L, each
having capacity to store 8 bit data. They are combined as BC, DE, HL to perform 16 bit operations. In
addition to this Register array, two 16 bit registers viz. stack register and program counter are provided.
As discussed in the earlier lecture, the ‗program counter‘ is employed to sequence the execution of
instructions. It always points to the memory address from which the next byte is to be fetched. Stack
Pointer points to the memory location in R/W (Read and/or write) memory. It is also termed as a
‗stack‘.

Figure 3.2.2 Architecture of 8085 microprocessor

3.2 Accumulator

The accumulator is 8-bit register (can store 8 bit data). It is a part of arithmetic/logic unit (ALU). In
general, after performing logical or arithmetical operations, result is stored in accumulator.
Accumulator is also identified as Register A.
3.3 Flags

ALU of 8085 have five flip flops whose states (set/reset) are determined by the result data of other
registers and accumulator. They are called as Zero, Carry, Sign, Parity and Auxiliary-Carry flags.

• Zero Flag (Z): When an arithmetic operation results in zero, the flip-flop called the Zero flag -
which is set to one.

• Carry flag (CY): After an addition of two numbers, if the sum in the accumulator is larger than
eight bits, then the flip-flop uses to indicate a carry called the Carry flag – which is set to one.
• S-Sign (S): It is set to 1, if bit D7 of the result = 1; otherwise reset. D7 is the first digit of a
binary number.

D7 D6 D5 D4 D3 D2 D1 D0

S Z AC P CY

• P-Parity (P): If the result has an even number of 1s, the flag is set to 1; for an odd number of
1s the flag is reset.

• AC-Auxiliary Carry (AC): In an arithmetic operation, when a carry is generated by digit D3


and passed to digit D4, the AC flag is set. Generally this flag is used internally for Binary
Coded Decimals (BCD).

Figure 3.2.2 shows a 8-bit flag register, adjacent to the accumulator. It is not used as a register. Out of
eight bit-positions, five positions are used to store the outputs of five flip-flops. These flags play an
important role in decision-making process of the microprocessor.

3.4 Instruction Register/Decoder

Before execution of an instruction, it is sent to the Instruction Register. Instruction register stores
current instruction of any program. Decoder takes the instruction from memory, decodes it and then
passes it to the next stage.

3.5 Memory Address Register

Memory Address Register (MAR) holds the address of next instruction to be executed.

3.6 Control Generator

In microprocessor, the Control Generator generates a signal that executes the operations in accordance
to the decoded instructions. In fact it creates a signal (information) which have details about
connections between different blocks of the microprocessor so that data reaches to the respective place.

3.7 Register Selector

Register selector is basically a logical controller which directs switching between different registers of
microprocessor.

3.8 General Purpose Registers

Microprocessor has few extra registers which can be used to store additional data during a program.
Programming in 8085

As mentioned in above section, a simple and very effective substitution to binary codes could be use
of standard English words to complete any task. For example addition of two numbers can be
represented by ADD. Such codes are referred as mnemonic codes and that language is called assembly
language. Most of the early processers including 8085, are programmed using mnemonics. However,
assembly language codes should be converted into binary one so that microprocessor can identify the
instructions given to it. This operation is done by Assembler. In assembly language, instructions are
composed of two segments which are as follows:

1. Operation (Op) Code: It depends on which operation is to be performed. For example for OR
operation, we have Op Code ―OR‖.

2. Operands: Operand is the object on which the required operation is to be done. Generally
operations are done on data stored in registers.
COMPARISION BETWEEN MICROPROCESSORS AND MICROCONTROLLERS
Microprocessor Microcontroller

Arithmetic and ALU Timer/ IO Ports


logic unit Counter
Accum
ulator
Accumulator Interrupt
Working Registers
Registe
rs
Program Counter Stack Pointer Internal Circuits
Internal RAM ROM
Clock Circuit Interrupt circuit
Stack Pointer Clock

Program Counter
Block diagram of microprocessor Block diagram of microcontroller

Microprocessor contains ALU, General Microcontroller contains the circuitry of


purpose registers, stack pointer, program microprocessor, and in addition it has built in
counter, clock timing circuit, interrupt circuit ROM, RAM, I/O Devices, Timers/Counters etc.
It has many instructions to move data between It has few instructions to move data between
memory and CPU memory and CPU

Few bit handling instruction It has many bit handling instructions

Less number of pins are multifunctional More number of pins are multifunctional
Single memory map for data and code Separate memory map for data and code
(program) (program)

Access time for memory and IO are more Less access time for built in memory and IO.

Microprocessor based system It requires less additional hardwares


requires additional hardware
More flexible in the design point of view Less flexible since the additional circuits which
is residing inside the microcontroller is fixed for
a particular microcontroller
Large number of instructions with flexible Limited number of instructions with few
addressing modes addressing modes

FATURES OF 8051 :
Salient features of 8051 microcontroller are given below.
• Eight bit CPU
• On chip clock oscillator
• 4Kbytes of internal program memory (code memory) [ROM]
• 128 bytes of internal data memory [RAM]
• 64 Kbytes of external program memory address space.
• 64 Kbytes of external data memory address space.
• 32 bi directional I/O lines (can be used as four 8 bit ports or 32 individually addressable
I/O lines)
• Two 16 Bit Timer/Counter :T0, T1
• Full Duplex serial data receiver/transmitter
• Four Register banks with 8 registers in each bank.
• Sixteen bit Program counter (PC) and a data pointer (DPTR)
• 8 Bit Program Status Word (PSW)
• 8 Bit Stack Pointer
• Five vector interrupt structure (RESET not considered as an interrupt.)
• 8051 CPU consists of 8 bit ALU with associated registers like accumulator ‗A‘ , B
register, PSW, SP, 16 bit program counter, stack pointer.
• ALU can perform arithmetic and logic functions on 8 bit variables.
• 8051 has 128 bytes of internal RAM which is divided into o Working registers [00 – 1F]
o Bit addressable memory area [20 – 2F]
o General purpose memory area (Scratch pad memory) [30-7F] ARCHITECTYR
OF 8051 :
Let's see the internal architecture of 8051 Microcontroller represented in form of block diagram as
shown below: Basic components present internally inside 8051 Microcontroller architecture are: CPU
(Central Processing Unit): CPU act as a mind of any processing machine. It synchronizes and
manages all processes that are carried out in microcontroller. User has no power to control the
functioning of CPU. It interprets the program stored in ROM and carries out from storage and then
performs it projected duty. CPU manage the different types of registers available in 8051
microcontroller.
Interrupts: Interrupts is a sub-routine call that given by the microcontroller when some other program
with high priority is request for acquiring the system buses the n interrupts occur in current running
program.
Interrupts provide a method to postpone or delay the current process, performs a sub-routine task and
then restart the standard program again.

Types of interrupt in 8051 Microcontroller:


Let's see the five sources of interrupts in 8051 Microcontroller:
o Timer 0 overflow interrupt - TF0
o Timer 1 overflow interrupt - TF1 o External hardware interrupt
- INT0 o External hardware interrupt - INT1 o Serial
communication interrupt - RI/TI
Memory: For operation Micro-controller required a program. This program guides the
microcontroller to perform the specific tasks. This program installed in microcontroller required
some on chip memory for the storage of the program.
Microcontroller also required memory for storage of data and operands for the short duration. In
microcontroller 8051 there is code or program memory of 4 KB that is it has 4 KB ROM and it also
comprise of data memory (RAM) of 128 bytes.
Bus : Bus is a group of wires which uses as a communication canal or acts as means of data transfer.
The different bus configuration includes 8, 16 or more cables. Therefore, a bus can bear 8 bits, 16 bits
all together.
Types of buses in 8051 Microcontroller:
Let's see the two types of bus used in 8051 microcontroller: o Address Bus: 8051 microcontrollers is
consisting of 16 bit address bus. It is generally be used for transferring the data from Central
Processing Unit to Memory. o Data bus: 8051 microcontroller is consisting of 8 bits data bus. It
is generally be used for transferring the data from one peripherals position to other peripherals.
Oscillator: As the microcontroller is digital circuit therefore it needs timer for their operation. To
perform timer operation inside microcontroller it required externally connected or on-chip oscillator.
Microcontroller is used inside an embedded system for managing the function of devices. Therefore,
8051 uses the two 16 bit counters and timers. For the operation of this timers and counters the oscillator
is used inside microcontroller.
ADDRESSING MODES
Various methods of accessing the data are called
addressing modes. 8051 addressing modes are
classified as follows.
1. Immediate addressing.
2. Register addressing.
3. Direct addressing.
4. Indirect addressing.
5. Index addressing
1. Immediate addressing.
In this addressing mode the data is provided as a part of instruction itself.
In other words data immediately follows the instruction.
Eg. MOV A,#30H
ADD A, #83 # Symbol indicates the data is immediate.
2. Register addressing.
In this addressing mode the register will hold the data. One of the eight general
registers (R0 to R7) can be used and specified as the operand.
Ex:MOV A,R0
MOV A,R6
R0 – R7 will be selected from the current selection of register bank. The default register bank
will be bank 0.
3. Direct addressing
There are two ways to access the internal memory. Using direct address
and indirect address. Using direct addressing mode we can not only address the
internal memory but SFRs also. In direct addressing, an 8 bit internal data memory
address is specified as part of the instruction and hence, it can specify the address
only in the range of 00H to FFH. In this addressing mode, data is obtained directly
from the memory. Eg. MOV A,30H 4. Indirect addressing
The indirect addressing mode uses a register to hold the actual address
that will be used in data movement. Registers R0 and R1 and DPTR are the only
registers that can be used as data pointers. Indirect addressing cannot be used to
refer to SFR registers. Both R0 and R1 can hold 8 bit address and DPTR can hold
16 bit address.
Eg. MOV A,@R0
MOV A,@R1
MOV A,@DPTR
5. Indexed addressing.
In indexed addressing, either the program counter (PC), or the data pointer
(DTPR)—is used to hold the base address, and the A is used to hold the offset
address. Adding the value of the base address to the value of the offset address
forms the effective address. Indexed addressing is used with JMP or MOVC
instructions. Look up tables are easily implemented with the help of index
addressing.
Eg. MOVC A, @A+DPTR // copies the contents of memory location pointed by
the sum of the accumulator A and the DPTR into accumulator A. MOVC
A, @A+PC // copies the contents of memory location pointed by the sum
of the accumulator A and the program counter into accumulator A.

Programmable Logic Controllers


What is a PLC or Define PLC
PLC stands for ―Programmable Logic Controller‖. A PLC is a computer specially designed
to operate reliably under harsh industrial environments – such as extreme temperatures, wet, dry,
and/or dusty conditions. PLCs are used to automate industrial processes such as a manufacturing
plant‘s assembly line, an ore processing plant, or a wastewater treatment plant.
PLCs share many features of the personal computer you have at home. They both have a
power supply, a CPU (Central Processing Unit), inputs and outputs (I/O), memory, and operating
software (although it‘s a different operating software).
PLC key features
Key features of a programmable logic controller include:
1. Processor Module:
Programmable Logic Controller (PLC) is a single microprocessor device which is used to control
manufacturing, infrastructure, transportation and machine/station control automation equipment
operation. 2. Architecture:
Programmable Logic Controllers (PLC) was designed to replace the relay-based systems. The
engineers used to represent physical reply sans timers with the help of ladder logic diagrams in PLCs
for programming the sequence of events and reactions I/O devices.
3. Usage:
Programmable Logic Controllers (PLC) has built-in networks which enable them to communicate
between multiple PLCs, I/Os, HMIs (human-machine interfaces) and SCADA (supervisory-control and
data-acquisition) systems.
5. Programming:
Programmable Logic Controllers (PLC) uses Ladder Logic Diagram Programming, and In
Programmable Automation Controllers (PAC) programming is done through structured text,
function block diagrams, ladder logic diagram and also other programming languages like C or
C++ etc.

COMPARISION BETWEEN MICRO CONTROLLER AND PLC


 PLC is used for industrial signals , programmed with USB cable or either net etc. easy
language can take analog signals easily change the program can be connected with HMI
systems and interact easily , it consists of a processor and modules ,it has big memory.
 Microcontroller is for programming the chips on boards to do specific jobs and the you
should complete the circuit on the board with relays and other stuff to regulate the
current , used in other things that doesn't need changes , it consist of IC with various
number of Input or output.
 PLC Programming is Ladder Type Programming & it’s easy.
 Microcontroller Programming depends on Hand Coding Program, & it’s so difficult. 
PLC is basically for Industrial use for controlling machinery.
 Microcontroller can be used for any types of application.
 PLC is an infinitely expandable input or output logic controller generally programmed
with a external PC program.
 Microcontroller is not an infinitely expandable input or output logic controller.

Architecture of PLC
PLC system contains of the following parts
 Power supply
 CPU
 Input modules
 Output modules
 Programming Device
Power Supply :
This module supplies power to the CPU, input and output modules. It can be built into the PLC or be
an external unit. Common voltage levels required by the PLC (with and without the power supply)
are
24Vdc, 110Vac, 220Vac
CPU (Central Processing Unit):
This module is considered as the brain of the PLC system and where ladder logic is stored and
processed.
 •The memory contains the data and the ladder program.  It contains an ―Executive‖
program that tells the PLC how to:
 Execute the control Instructions
 User‘s Program
 Communicate with other devices
 Other PLCs, Programming devices, I/O devices, etc.
 Perform Housekeeping activities
 Diagnostics, etc
 This program is stored in ―nonvolatile‖ memory
 Meaning that the program will not be lost if power is removed.
I/O MODULES:
 The I/O interface section of a PLC connects it to external field devices.
 The main purpose of the I/O interface is to condition the various signals received from or sent
to the external input and output devices
 Inputs to, and outputs from, a PLC are necessary to monitor and control a process. Both
inputs and outputs can be categorized into two basic types: logical or continuous.
Input module:
The input module connects the input terminals to the rest of the system. Each terminal is
usually electrically isolated from the internal electronics by OPTO ISOLATORS. This is a way of
passing on the status of the input (on or off) by use of a light emitting diode and phototransistor. A
typical opto isolator is shown. They have the advantage of reducing the effects of spurious pulses
generated from electromagnetic sources. It is also a safety feature to prevent live voltages appearing
on the input lines in the event of a fault.
Following are the some of the Input devices.
 FIeld Transmitters for Pressure, Temperature, Flow, Level etc
 Analyzers (pH, DO, Conductivity, SOX, NOX, etc)
 Switches and Push buttons
 Sensing Devices
 Limit Switches
 Photoelectric Sensors
 Proximity Sensors
 Condition Sensors
Outputs Modules:
Outputs to actuators allow a PLC to cause something to happen in a process. A short list of popular
actuators is given below in order of relative popularity.
Solenoid Valves - Logical outputs that can switch a hydraulic or pneumatic flow.
Lights - Logical outputs that can often be powered directly from PLC output boards.
Motor Starters - Motors often draw a large amount of current when started, so they require motor
starters, which are basically large relays.
Servo Motors - A continuous output from the PLC can command a variable speed or
position.
Symbol of Logic Gates

PLC Program
Here is PLC program to implement various logic gates, along with program explanation and run time test
cases.
AND

By connecting Normally Open / XIC contacts in series, AND gate can be implemented.
When both inputs are set to 1, then and then only output goes high.
OR
By connecting Normally Open / XIC contacts in parallel, OR Gate can be implemented.
When either input is set to high, output goes high.
NOT

By using just one Normally Closed / XIO contact, NOT Logic Gate can be implemented.
Inverted state of input is obtained as an output.
NOR

• By connecting Normally Closed / XIO contacts in series, NOR Logic Gate can be implemented.
• If both inputs are Reset to 0, output goes High otherwise remains in Low state.
• Or by inverting output of a OR Gate, that is by using output of OR Gate as an input of NOT Gate,
NOR Gate can be implemented.
NAND

• By connecting Normally Closed contacts in parallel to each other, NAND Gate can be implemented.
• Or by simply inverting output of AND gate, NAND Gate can be implemented.
EX-OR

• By connecting XIC and XIO in series with parallel to XIO and XIC in series as shown in diagram
above, EX-OR Gate can be implemented.
• When both inputs are identical, output is 0. Output is high when A ≠ B.
• Note here that XIC of first series contacts and XIO of second series contacts must be given same
address and similarly for the other two.
EX-NOR
• By connecting two XIO contacts in series with parallel to two XIC contacts in
series, EX-NOR gate can be implemented.
• When both inputs are identical A=B=O or A=B=1, output goes high.
• It implies same here as in EX-OR gate that address must be given same.
• – By inverting output of EX-OR gate, implementation of EX-NOR can be
accomplished.
JUMP INSTRUCTION:
• The JMP instruction is used to cause the PLC to skip over rungs. The Jump
(JMP) instruction is paired with the Label (LBL) instruction by designating
the same address number to each function. When the jump rung is TRUE, it
causes the ladder program to skip over rungs of the ladder program.
• To
designate
the JMP
and LBL
commands,
parameters
may be
entered
from Q2: 0
to Q2:
999.
One
or more
JMP

instructions may be used to jump to the same LBL instruction


• Example of explanation of jump:
• Consider here are seven motors used for various processes. On-demand
base Motors 4, 5 & 6 are needed. Design a program to skip motor 4, 5 & 6
when it does require for the process.
• PLC Program
• Program Description:
• RUNG 0000 :The input I:0/0 is used to turn on Motor 1.
• RUNG 0001 :The input I:0/1 is used to turn on Motor 2.
• RUNG 0002 :The input I:0/2 is used to turn on Motor 3.
• RUNG 0003:The input I:0/3 is used to initiate the jump function (Q2:0).
• RUNG 0004 :The input I:0/0 & I:0/4 is used to turn on Motor 4.
• RUNG 0005:The input I:0/1 and I:0/5 is used to turn on Motor 5.
• Rung 0007: Label instruction is used to finish the jump function.
• The input I:0/6 and I:0/2 is used to turn on Motor 6.
• When JUMP condition is OFF :When Jump condition is not initiated or
enabled, all outputs will turn ON/OFF according to respective input.
• When JUMP condition is ON :Rung 4, 5 & 6 are completely skipped
till label function.
TIMER IN PLC:
A timer is a PLC instruction measuring the amount of time elapsed following an event.Timer
instructions come in two basic types: on-delay timers and off-delay timers. Both ―on-delay‖ and
―off-delay‖ timer instructions have single inputs triggering the timed function.
An ―on-delay‖ timer activates an output only when the input has been active for a minimum
amount of time.
There are different types of Time-Delay relays available in the market:
• On-delay timer
• Off-delay timer
• On/Off delay timer
On-Delay Timer Relay
In an On-Delay timer timing begins when the voltage is applied to the coil of the timer. The contact
changes as soon as time has expired and remains changed until the voltage is removed from the coil.
Off-Delay Timer Relay
In an Off-Delay timer when the voltage is applied to the coil nothing happens. When the input/trigger
switch closes, output contact changes and timing begins. The output contact remains changed until
the timing is finished or voltage is removed from the coil.
On/Off Delay Timer Relay
In an On/Off delay timer, we have the functionalities of both an on-delay timer and an off-delay
timer. There is a functionality of a repeat-cycle also on this type of time delay relay.

Data Types Allowed for TON


The TON leverages a specific data structure, called the Timer, present in most PLC systems.
Timer – The high-level instruction specification of all the inner structures.
.PRE – Integer specifying up to which value the timer will count.
.ACC – Integer specifying the current time value of the timer.
.BASE – Selectable value which specifies the time multiplier for the timer.
Note1: This is not available in RSLogix 5000; the timers are specified in milliseconds by
default.
.EN – Boolean value which is set to HIGH when the timer is energized.
.TT – Boolean value which is set to HIGH when the timer is in the process of counting.
.DN – Boolean value which is set to HIGH when the timer is finished counting.
I/P Signal ON:-
 Timer Condition :- Timer in running condition.
• EN TT DN
• ACC<PRE 1 1 0
• ACC=PRE 1 0 1
I/P Signal OFF:-
Timer Condition :- Timer not running condition.
EN TT DN
• ACC<PRE 0 0 0
• ACC=PRE 0 0 0
Counters in PLC
A counter is a PLC instruction that either increments (counts up) or decrements (counts down) an
integer number value when prompted by the transition of a bit from 0 to 1 (―false‖ to ―true‖).
Counter instructions come in three basic types:
1. up counters, 2.
down counters,
and 3. up/down
counters.
Both ―up‖ and ―down‖ counter instructions have single inputs for triggering counts, whereas
―up/down‖ counters have two trigger inputs: one to make the counter increment and one to make the
counter decrement.
Each counter instruction has two values (integers) associated with it:
 Accumulated Value (ACC): This is the current number of the counter. The initial value is zero.
 Preset Value (PR): This is a predetermined value set by the programmer. When the accumulated
value is equal to, or greater than the preset value, a status bit is set. This bit can be used to control
an output device.
Each counter is associated with two status bits:
 Counter Enable Bit (EN): This bit is set when a false-to-true rung condition to the left of the
counter instruction is detected.
 Done Bit (DN): This bit is set when the accumulated value is equal to the preset value. It is reset
when the rung condition becomes false.
How it works
Each pulse on the count input (CU) will increase the current counter value (CV) by 1. And each pulse
on the count input (CD) will decrement current counter value (CV) by 1.
When CV is greater than or equal to the counter limit (PV) the output (QU) is set. When CV is less
than or equal to 0 the output (QD) is set.
A pulse on the reset input (R) will reset the value of CV to 0. A pulse on the load input (LD) will
assign the value of counter limit (PV) to CV.

HOW TO SELECT A SPECIFIC MICROCONTROLLER FOR A GIVEN APPLICATION


A microcontroller (MCU), is the smallest and most basic computer. Running on a single chip, it has a
CPU, memories (RAM and ROM), and interfaces (input/output ports) for additions like video, audio,
USB, and cameras. Unlike a microprocessor, which serves more generalized applications, a
microcontroller aims at more specific applications.
Processing power. How much processing power do you require for the task, will a single core
processor suffice, or do you need a dual-core? A multicore processor will be significantly faster, but
it will also consume more energy. Also, will a graphics processing unit (GPU) be necessary?
Memory. The amount of memory (RAM and ROM) you need will depend on the programs you will
be running. More programs need more random access memory (RAM). In addition, a GPU will require
not only more RAM but faster read/write time as well.
Hardware interface. The nature of the task will dictate the need for hardware interfaces such as USB,
Wi-Fi, Bluetooth, audio, video, or camera.
Software architecture. Some microcontrollers are operable on multiple OSs, and others are not. If
you need to scale, it is better to use the same software architecture to increase interoperability. Cost.
Microcontrollers fall within a wide price range, from a hundred units for a few dollars to a few dollars
per unit. If you want to scale, you need to consider the overall cost versus the individual performance
power of a microcontroller.
Hardware architecture. A microcontroller‘s packaging directly influences its size and performance.
Dual in-line packaging is the most common type. Small-outline transistors have a small footprint, and
quad flat packs take up more areas but less vertical space.
Security. Hacking which targets IoT devices is rising, a threat that is especially relevant to
microcontrollers used in automobiles. In response, microcontroller makers are implementing layers
of security such as cryptography and physical security.
APPLICATIONS OF PLC
Industrial Applications of PLC
1. ransportation System likes Conveyor Belt System.
2. Packing and Labeling System in Food & Beverage.
3. Automatic Bottle or Liquid Filling System.
4. Packaging and Labelling System in Pharma Industries.
5. Transportation System like Escalator and Elevator.
6. Industrial Crane Control System for Operation of Overhead Traveling Crane.
Power Station Applications of PLC
1. PLC uses for the Smart Grid System to Monitor and Detect fault conditions.
2. It is used in the Power Generation, Transmission, and Distribution System.
3. In the Power Substation, PLC can use the Auto Assembly Line System.
4. Some Electrical Equipment (like Circuit Breaker Tripping, Capacitor Switching) can be
automatically operated with PLC.
5. A Single-Phase or Three-Phase Sequence Detect by using the PLC.
Commercial Applications of PLC
1. Smart Traffic Control Signal System.
2. Smart Elevator Control System.
3. Fire Detection and Alarm System.
4. Automatic Machine Handling System.
5. Automatic Vehicle Washer System
6. Automated Guided Vehicle System.
Domestic Applications of PLC
1. Water Tank Level Control System
2. Car Washing and Parking System.
3. Flashing Light Controlling System.
4. Automatic Door Opening/Closing System.
PROGRAMMING LOGIC CONTROLLERS (2 MARK QUESTIONS)
1. Define a programmable logic controller.
A programmable logic controller (PLC) is a microprocessor based controller that uses a
programmable memory to store instructions and to implement functions such as logic, sequencing,
timing, counting and arithmetic in order to control machines and process.
2. What are the main component parts of a PLC?
1. Central processing unit (CPU) 2. The input/output unit 3. The programming device 4. Memory unit.
3. What is the function of programming devices?
The programming device is used to enter the required program using ladder logic into the memory of
the processor. The sequence of operation and ultimate control of equipment or machinery is
specified and determined by ladder programme. 4. List various types of PLC programming devices.
1. Use of hand held programmer 2. Terminal with video display unit 3. A personal computer with
appropriate software.
5. List down the types of buses required in a PLC.
1. Data buses for communications data between elements. 2. The address buses to read the address of
locations for accessing stored data. 3. Control buses for internal control actions.
6. What is ALU?
State its function. The ALU is responsible for data manipulation and performs arithmetic and logical
operations such as addition and subtraction. In addition, the ALU contains a number of control
inputs, which specify the data manipulation function to be performed. ALU is combinational logic
circuit, whose output is an instantaneous function of its data and control inputs.
7. Highlight the important role of control unit.
The control unit is used to control the timing of operation and to control the units within the
microprocessor to ensure that operations are carried out in the correct order.
8. What is RAM? Random access memory is for the user‘s program and data storage is designed so
that information can be written into or read from the memory and normally incorporated in the
solidstate form contained in a integrated circuit.
9. What is meant by program scan? A PLC does control the machine by taking repeated snapshots
of the input state and reads to take the values, and energize or de-energize outputs according to
the user programme. This process is known as a program scans.
10. What are counters? Counters allow a number of occurrences of input signals to count or record
the number of times some event occurs. PLCs include some form of counting element and are set
to some preset number value. When this value of input pulse has been received, it will operate its
contact, the normally open contacts would be closed and a normally closed contact would be
opened.
11. Write down various types of counters. 1. Down counters 2. Up-counters
12. When are cascaded counters needed? In some applications, it may be required to count events
that exceed the maximum number allowable per counter instruction. The counters are
programmed in series to produce an output in way that the output of first counter is programmed
into the input of the second counter.
13. At what conditions master control is used? It is often necessary to provide means of executing
sections of the control logic when certain criteria are realized. They include instructions
comprising the override instruction.
14. How does jump control work? The jump instruction is an output instruction enabling part of a
ladder program to be jumped over. With jump instruction, the processor scan time can be reduced
by jumping over instructions not pertinent to the machine operation thereby missing intermediate
program and can skip instruction when a production fault occurs.
15. Categorize data manipulation in shift registers. 1. Data transfer 2. Data comparison.
16. List down PLC programming methods. 1. Structured text 2. Ladder diagrams 3. Function block
diagram 4. Sequential function charts 5. Instruction list
17. What are the types of memory? 1. Random Access Memory 2. Read Only Memory (ROM)

You might also like