mechatronics (1).91 108
TRANSCRIPT
-
7/28/2019 Mechatronics (1).91 108
1/18
Einstein College of Engineering
16-to-1 MUX
Use two 74151
D = 0 enables top MUX
D = 1 enables bottom MUX
W = Y
= (Y1+Y2)
= (W1+W2)
= W1W2
-
7/28/2019 Mechatronics (1).91 108
2/18
Einstein College of Engineering
Larger Multiplexers
Larger multiplexers can be constructed from smaller ones. An 8-to-1 multiplexer can be
constructed from smaller multiplexers as shown below.
8-to-1 multiplexer from Smaller MUX
16-to-1 multiplexer from 4:1 mux
-
7/28/2019 Mechatronics (1).91 108
3/18
Einstein College of Engineering
Quadruple 2-to-1 MUX
It is 2-to-1 MUX with 4 bits for each input
There is 1 output of 4 bitsThere is 1 select signalWhen 1 input is selected, the whole group of 4 bits goes to the output
-
7/28/2019 Mechatronics (1).91 108
4/18
Einstein College of Engineering
Quad 2-to-1 MUX
Implementing Functions Multiplexers
Any n-variable logic function can be implemented using a smaller 2n-1
-to-1 multiplexer and asingle inverter (e.g 4-to-1 mux to implement 3 variable functions) as follows.
Express function in canonical sum-of-minterms form. Choose n-1 variables as inputs to mux
select lines. Construct the truth table for the function, but grouping inputs by selection linevalues (i.e select lines as most significant inputs).
-
7/28/2019 Mechatronics (1).91 108
5/18
Einstein College of Engineering
Determine multiplexer input line i values by comparing the remaining input variable and the
function F for the corresponding selection lines value i.
We have four possible mux input line i values:
Connect to 0 if the function is 0 for both values of remaining variable. Connect to 1 if the function is 1 for both values of remaining variable. Connect to remaining variable if function is equal to the remaining variable. Connect to the inverted remaining variable if the function is equal to the remaining
variable inverted
3-variable Function Using 8-to-1 mux
Implement the function F(X,Y,Z) = S(1,3,5,6) using an 8-to-1 mux. Connect the input
variables X, Y, Z to mux select lines. Mux data input lines 1, 3, 5, 6 that correspond to the
function minterms are connected to 1. The remaining mux data input lines 0, 2, 4, 7 are
connected to 0.
3-variable Function Using 4-to-1 mux
Implement the function F(X,Y,Z) = S(0,1,3,6) using a single 4-to-1 mux and an inverter. We
choose the two most significant inputs X, Y as mux select lines.
Truth Table
Select i X Y Z F Mux Input i
0 0 0 0 1 1
0 0 0 1 1 1
1 0 1 0 0 Z
1 0 1 1 1 Z2 1 0 0 0 0
-
7/28/2019 Mechatronics (1).91 108
6/18
Einstein College of Engineering
2 1 0 1 0 0
3 1 1 0 1 Z'
3 1 1 1 0 Z'
We determine multiplexer input line i values by comparing the remaining input variable
Z and the function F for the corresponding selection lines value i
when XY=00 the function F is 1 (for both Z=0, Z=1) thus mux input0 = 1 when XY=01 the function F is Z thus mux input1 = Z when XY=10 the function F is 0 (for both Z=0, Z=1) thus mux input2 = 0 when XY=11 the function F is Z' thus mux input3 = Z'
-
7/28/2019 Mechatronics (1).91 108
7/18
Einstein College of Engineering
Example for logic function implementation using MUX
De-multiplexers
-
7/28/2019 Mechatronics (1).91 108
8/18
Einstein College of Engineering
They are digital switches which connect data from one input source to one of n
outputs.Usually implemented by using n-to-2n
binary decoders where the decoder enable line
is used for data input of the de-multiplexer.The figure below shows a de-multiplexer block
diagram which has got s-bits-wide select input, one b-bits-wide data input and n b-bits-wide
outputs.
The operation of a de-multiplexer can be better explained using a mechanical switch as
shown in the figure below. This rotary switch can touch any of the outputs, which is
connected to the input. As you can see at any given point of time only one output gets
connected to input.
1-to-4 De-multiplexer
-
7/28/2019 Mechatronics (1).91 108
9/18
Einstein College of Engineering
Truth Table
S1 S0 F0 F1 F2 F3
0 0 D 0 0 0
0 1 0 D 0 0
1 0 0 0 D 0
1 1 0 0 0 D
Unit 4. PROGRAMMING LOGIC CONTROLLERS
Programmable Logic ControllersBasic StructureInput / Output ProcessingProgramming
MnemonicsTimers, Internal relays and countersShift RegistersMaster and Jump Controls
Data HandlingAnalogs Input / OutputSelection of a PLC Problem.
A programmable logic controller (PLC) orprogrammable controller is adigital computerused
forautomationofelectromechanicalprocesses, such as control of machinery on factoryassemblylines, amusement rides, or lighting fixtures. PLCs are used in many industries and machines. Unlike
general-purpose computers, the PLC is designed for multiple inputs and output arrangements,
extended temperature ranges, immunity to electrical noise, and resistance to vibration and impact.Programs to control machine operation are typically stored in battery-backed ornon-volatile
memory. A PLC is an example of a hardreal timesystem since output results must be produced in
response to input conditions within a bounded time, otherwise unintended operation will result.
Early PLCs were designed to replace relay logic systems. These PLCs were programmed in "ladder
logic", which strongly resembles a schematic diagram of relay logic. This program notation was
chosen to reduce training demands for the existing technicians. Other early PLCs used a form of
instruction listprogramming, based on a stack-based logic solver.
Modern PLCs can be programmed in a variety of ways, from ladder logic to more traditional
programming languages such as BASIC and C. Another method isState Logic, avery high-level
programming languagedesigned to program PLCs based onstate transition diagrams.
Many early PLCs did not have accompanying programming terminals that were capable of graphicalrepresentation of the logic, and so the logic was instead represented as a series of logic expressions
http://en.wikipedia.org/wiki/Digital_computerhttp://en.wikipedia.org/wiki/Digital_computerhttp://en.wikipedia.org/wiki/Digital_computerhttp://en.wikipedia.org/wiki/Automationhttp://en.wikipedia.org/wiki/Automationhttp://en.wikipedia.org/wiki/Automationhttp://en.wikipedia.org/wiki/Electromechanicalhttp://en.wikipedia.org/wiki/Electromechanicalhttp://en.wikipedia.org/wiki/Electromechanicalhttp://en.wikipedia.org/wiki/Assembly_linehttp://en.wikipedia.org/wiki/Assembly_linehttp://en.wikipedia.org/wiki/Assembly_linehttp://en.wikipedia.org/wiki/Assembly_linehttp://en.wikipedia.org/wiki/Non-volatile_memoryhttp://en.wikipedia.org/wiki/Non-volatile_memoryhttp://en.wikipedia.org/wiki/Non-volatile_memoryhttp://en.wikipedia.org/wiki/Non-volatile_memoryhttp://en.wikipedia.org/wiki/Real-time_computinghttp://en.wikipedia.org/wiki/Real-time_computinghttp://en.wikipedia.org/wiki/Real-time_computinghttp://en.wikipedia.org/wiki/Ladder_logichttp://en.wikipedia.org/wiki/Ladder_logichttp://en.wikipedia.org/wiki/Ladder_logichttp://en.wikipedia.org/wiki/Instruction_listhttp://en.wikipedia.org/wiki/Instruction_listhttp://en.wikipedia.org/wiki/State_Logichttp://en.wikipedia.org/wiki/State_Logichttp://en.wikipedia.org/wiki/State_Logichttp://en.wikipedia.org/wiki/Very_high-level_programming_languagehttp://en.wikipedia.org/wiki/Very_high-level_programming_languagehttp://en.wikipedia.org/wiki/Very_high-level_programming_languagehttp://en.wikipedia.org/wiki/Very_high-level_programming_languagehttp://en.wikipedia.org/wiki/State_diagramhttp://en.wikipedia.org/wiki/State_diagramhttp://en.wikipedia.org/wiki/State_diagramhttp://en.wikipedia.org/wiki/State_diagramhttp://en.wikipedia.org/wiki/Very_high-level_programming_languagehttp://en.wikipedia.org/wiki/Very_high-level_programming_languagehttp://en.wikipedia.org/wiki/State_Logichttp://en.wikipedia.org/wiki/Instruction_listhttp://en.wikipedia.org/wiki/Ladder_logichttp://en.wikipedia.org/wiki/Ladder_logichttp://en.wikipedia.org/wiki/Ladder_logichttp://en.wikipedia.org/wiki/Real-time_computinghttp://en.wikipedia.org/wiki/Non-volatile_memoryhttp://en.wikipedia.org/wiki/Non-volatile_memoryhttp://en.wikipedia.org/wiki/Assembly_linehttp://en.wikipedia.org/wiki/Assembly_linehttp://en.wikipedia.org/wiki/Assembly_linehttp://en.wikipedia.org/wiki/Electromechanicalhttp://en.wikipedia.org/wiki/Automationhttp://en.wikipedia.org/wiki/Digital_computer -
7/28/2019 Mechatronics (1).91 108
10/18
Einstein College of Engineering
in some version of Boolean format, similar to Boolean algebra. As programming terminals evolved,
it became more common for ladder logic to be used, for the aforementioned reasons. Newer formats
such as State Logic and Function Block (which is similar to the way logic is depicted when using
digital integrated logic circuits) exist, but they are still not as popular as ladder logic. A primary
reason for this is that PLCs solve the logic in a predictable and repeating sequence, and ladder logic
allows the programmer (the person writing the logic) to see any issues with the timing of the logicsequence more easily than would be possible in other formats.
Ladder logic is aprogramming languagethat represents a program by a graphical diagram based on
thecircuit diagramsofrelay-based logic hardware. It is primarily used to develop software for
Programmable Logic Controllers(PLCs) used in industrial control applications. The name is basedon the observation that programs in this language resemble ladders, with two vertical rails and a
series of horizontal rungs between them.
An argument that aided the initial adoption of ladder logic was that a wide variety of engineers andtechnicians would be able to understand and use it without much additional training, because of the
resemblance to familiar hardware systems. This argument has become less relevant given that mostladder logic programmers have a software background in more conventionalprogramming
languages, and in practice implementations of ladder logic have characteristics - such as sequential
execution and support for control flow featuresthat make the analogy to hardware somewhat
inaccurate.
Ladder logic is widely used to programPLCs, where sequential control of a process or
manufacturing operation is required. Ladder logic is useful for simple but critical control systems or
for reworking oldhardwiredrelay circuits. As programmable logic controllers became more
sophisticated it has also been used in very complex automation systems. Often the ladder logic
program is used in conjunction with anHMIprogram operating on a computer workstation.
Manufacturers of programmable logic controllers generally also provide associated ladder logic
programming systems. Typically the ladder logic languages from two manufacturers will not becompletely compatible; ladder logic is better thought of as a set of closely related programming
languages rather than one language. (TheIEC 61131-3standard has helped to reduce unnecessarydifferences, but translating programs between systems still requires significant work.) Even different
models of programmable controllers within the same family may have different ladder notation such
that programs cannot be seamlessly interchanged between models.
Ladder logic can be thought of as a rule-based language rather than aprocedural language. A "rung"
in the ladder represents a rule. When implemented with relays and other electromechanical devices,the various rules "execute" simultaneously and immediately. When implemented in a programmable
logic controller, the rules are typically executed sequentially by software, in a continuous loop
(scan). By executing the loop fast enough, typically many times per second, the effect of
simultaneous and immediate execution is relatively achieved to within the tolerance of the time
required to execute every rung in the "loop" (the "scan time"). It is somewhat similar to other rule-
based languages, likespreadsheetsorSQL. However, proper use of programmable controllers
requires understanding the limitations of the execution order of rungs.
Example of a simple ladder logic program
http://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Circuit_diagramhttp://en.wikipedia.org/wiki/Circuit_diagramhttp://en.wikipedia.org/wiki/Circuit_diagramhttp://en.wikipedia.org/wiki/Relayhttp://en.wikipedia.org/wiki/Relayhttp://en.wikipedia.org/wiki/Relayhttp://en.wikipedia.org/wiki/Programmable_Logic_Controllerhttp://en.wikipedia.org/wiki/Programmable_Logic_Controllerhttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programmable_logic_controllerhttp://en.wikipedia.org/wiki/Programmable_logic_controllerhttp://en.wikipedia.org/wiki/Programmable_logic_controllerhttp://en.wikipedia.org/wiki/Hardwiredhttp://en.wikipedia.org/wiki/Hardwiredhttp://en.wikipedia.org/wiki/Hardwiredhttp://en.wikipedia.org/wiki/User_Interfacehttp://en.wikipedia.org/wiki/User_Interfacehttp://en.wikipedia.org/wiki/User_Interfacehttp://en.wikipedia.org/wiki/IEC_61131-3http://en.wikipedia.org/wiki/IEC_61131-3http://en.wikipedia.org/wiki/IEC_61131-3http://en.wikipedia.org/wiki/Procedural_languagehttp://en.wikipedia.org/wiki/Procedural_languagehttp://en.wikipedia.org/wiki/Procedural_languagehttp://en.wikipedia.org/wiki/Spreadsheethttp://en.wikipedia.org/wiki/Spreadsheethttp://en.wikipedia.org/wiki/Spreadsheethttp://en.wikipedia.org/wiki/SQLhttp://en.wikipedia.org/wiki/SQLhttp://en.wikipedia.org/wiki/SQLhttp://en.wikipedia.org/wiki/SQLhttp://en.wikipedia.org/wiki/Spreadsheethttp://en.wikipedia.org/wiki/Procedural_languagehttp://en.wikipedia.org/wiki/IEC_61131-3http://en.wikipedia.org/wiki/User_Interfacehttp://en.wikipedia.org/wiki/Hardwiredhttp://en.wikipedia.org/wiki/Programmable_logic_controllerhttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Programmable_Logic_Controllerhttp://en.wikipedia.org/wiki/Relayhttp://en.wikipedia.org/wiki/Circuit_diagramhttp://en.wikipedia.org/wiki/Programming_language -
7/28/2019 Mechatronics (1).91 108
11/18
Einstein College of Engineering
The language itself can be seen as a set of connections between logical checkers (contacts) and
actuators (coils). If a path can be traced between the left side of the rung and the output, through
asserted (true or "closed") contacts, the rung is true and the output coil storage bit is asserted (1) or
true. If no path can be traced, then the output is false (0) and the "coil" by analogy to
electromechanical relays is considered "de-energized". The analogy between logical propositions
and relay contact status is due toClaude Shannon.
Ladder logic has contacts that make or break circuits to control coils. Each coil or contact
corresponds to the status of a single bit in the programmable controller's memory. Unlike
electromechanical relays, a ladder program can refer any number of times to the status of a single
bit, equivalent to a relay with an indefinitely large number of contacts.
So-called "contacts" may refer to physical ("hard") inputs to the programmable controller fromphysical devices such as pushbuttons and limit switches via an integrated or external input module,
or may represent the status of internal storage bits which may be generated elsewhere in theprogram.
Each rung of ladder language typically has one coil at the far right. Some manufacturers may allowmore than one output coil on a rung.
--( )-- a regular coil, energized whenever its rung is closed
--(\)-- a "not" coil, energized whenever its rung is open
--[ ]-- A regular contact, closed whenever its corresponding coil or an input which controls it is
energized.
--[\]-- A "not" contact, open whenever its corresponding coil or an input which controls it is
energized.
The "coil" (output of a rung) may represent a physical output which operates some device connected
to the programmable controller, or may represent an internal storage bit for use elsewhere in the
program.
Examples
Here is an example of what one rung in a ladder logic program might look like. In real life, there
may be hundreds or thousands of rungs.
For example:
1. ----[ ]---------|--[ ]--|------( )
X | Y | S
| |
|--[ ]--|
Z
The above realizes the function: S = XAND( YORZ )
http://en.wikipedia.org/wiki/Claude_Shannonhttp://en.wikipedia.org/wiki/Claude_Shannonhttp://en.wikipedia.org/wiki/Claude_Shannonhttp://en.wikipedia.org/wiki/Logical_ANDhttp://en.wikipedia.org/wiki/Logical_ANDhttp://en.wikipedia.org/wiki/Logical_ANDhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Logical_ANDhttp://en.wikipedia.org/wiki/Claude_Shannon -
7/28/2019 Mechatronics (1).91 108
12/18
Einstein College of Engineering
Typically, complex ladder logic is 'read' left to right and top to bottom. As each of the lines (or
rungs) are evaluated the output coil of a rung may feed into the next stage of the ladder as an input.
In a complex system there will be many "rungs" on a ladder, which are numbered in order of
evaluation.
1. ----[ ]-----------|---[ ]---|----( )X | Y | S
| |
|---[ ]---|
Z
2. ----[ ]----[ ]-------------------( )
S X T
2. T = S AND X where S is equivalent to #1. above
This represents a slightly more complex system for rung 2. After the first line has been evaluated,
the output coil (S) is fed into rung 2, which is then evaluated and the output coil T could be fed into
an output device (buzzer, light etc..) or into rung 3 on the ladder. (Note that the contact X on thesecond rung serves no useful purpose, as X is already defined in the 'AND' function of S from the 1st
rung.)
This system allows very complex logic designs to be broken down and evaluated.
For more practical examples see below:
------[ ]--------------[ ]----------------( )
Key Switch 1 Key Switch 2 Door Motor
This circuit shows two key switches that security guards might use to activate an electric motor on a
bank vault door. When the normally open contacts of both switches close, electricity is able to flow
to the motor which opens the door. This is alogical AND.
+-------+
----------------------------+ +----
+-------+
Remote Receiver
--|-------[ ]-------+-----------------( )
| Remote Unlock | Lock Solenoid| |
|-------[ ]-------|
Interior Unlock
This circuit shows the two things that can trigger a car'spower door locks. The remote receiver is
always powered. The locksolenoidgets power when either set of contacts is closed. This is alogical
OR.
Often we have a little green "start" button to turn on a motor, and we want to turn it off with a bigred "Stop" button. The stop button itself is wired as a normally closed switch, the PLC input is read
http://en.wikipedia.org/wiki/Logical_ANDhttp://en.wikipedia.org/wiki/Logical_ANDhttp://en.wikipedia.org/wiki/Logical_ANDhttp://en.wikipedia.org/wiki/Power_door_lockshttp://en.wikipedia.org/wiki/Power_door_lockshttp://en.wikipedia.org/wiki/Power_door_lockshttp://en.wikipedia.org/wiki/Solenoidhttp://en.wikipedia.org/wiki/Solenoidhttp://en.wikipedia.org/wiki/Solenoidhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Logical_ORhttp://en.wikipedia.org/wiki/Solenoidhttp://en.wikipedia.org/wiki/Power_door_lockshttp://en.wikipedia.org/wiki/Logical_AND -
7/28/2019 Mechatronics (1).91 108
13/18
Einstein College of Engineering
as normally open. When the stop button is pushed, the input will go false. Making the rung false,
stopping the "run" output.
--+----[ ]--+----[\]----( )| start | stop run
| |
+----[ ]--+
run
-------[ ]--------------( )
run motor
Thislatchconfiguration is a commonidiomin ladder logic. In ladder logic it is referred to as seal-in
logic.
Additional functionality
Additional functionality can be added to a ladder logic implementation by the PLC manufacturer as
a special block. When the special block is powered, it executes code on predetermined arguments.
These arguments may be displayed within the special block.
+-------+
-----[ ]--------------------+ A +----
Remote Unlock +-------+
Remote Counter
+-------+
-----[ ]--------------------+ B +----
Interior Unlock +-------+
Interior Counter
+--------+
--------------------+ A + B +-----------
+ into C +
+--------+
Adder
In this example, the system will count the number of times that the interior and remote unlockbuttons are pressed. This information will be stored in memory locations A and B. Memory location
C will hold the total number of times that the door has been unlocked electronically.
PLCs have many types of special blocks. They include timers, arithmetic operators and comparisons,
table lookups, text processing,PIDcontrol, and filtering functions. More powerful PLCs can operate
on a group of internal memory locations and execute an operation on a range of addresses, for
example,to simulate a physical sequential drum controller or afinite state machine. In some cases,
users can define their own special blocks, which effectively are subroutines or macros. The largelibrary of special blocks along with high speed execution has allowed use of PLCs to implement
very complex automation systems.
http://en.wikipedia.org/wiki/Latch_%28electronic%29http://en.wikipedia.org/wiki/Latch_%28electronic%29http://en.wikipedia.org/wiki/Latch_%28electronic%29http://en.wikipedia.org/wiki/Idiomhttp://en.wikipedia.org/wiki/Idiomhttp://en.wikipedia.org/wiki/Idiomhttp://en.wikipedia.org/wiki/PID_controllerhttp://en.wikipedia.org/wiki/PID_controllerhttp://en.wikipedia.org/wiki/PID_controllerhttp://en.wikipedia.org/wiki/Finite_state_machinehttp://en.wikipedia.org/wiki/Finite_state_machinehttp://en.wikipedia.org/wiki/Finite_state_machinehttp://en.wikipedia.org/wiki/Finite_state_machinehttp://en.wikipedia.org/wiki/PID_controllerhttp://en.wikipedia.org/wiki/Idiomhttp://en.wikipedia.org/wiki/Latch_%28electronic%29 -
7/28/2019 Mechatronics (1).91 108
14/18
-
7/28/2019 Mechatronics (1).91 108
15/18
Einstein College of Engineering
Logic Functions
PLC programming is a logical procedure
-
7/28/2019 Mechatronics (1).91 108
16/18
Einstein College of Engineering
In a PLC program, things (inputs and rungs) are either TRUE or FALSEIf the proper input conditions are TRUE:The rung becomes TRUE and an output action
occurs (for example, a motor turns on)
If the proper input conditions are not TRUE:The rung becomes FALSE and an output action
does not occur
Ladder logic is based on the following logic functions:AND, OR, Sometimes called inclusive OR, Exclusive OR.
-
7/28/2019 Mechatronics (1).91 108
17/18
Einstein College of Engineering
-
7/28/2019 Mechatronics (1).91 108
18/18
Einstein College of Engineering