Lecture7 A
Lecture7 A
Output ports
Input ports
and the outside world P02 P42
P04 P44
switches, different P05 P45
PLC
P00 P40 L
P01 P41
P02 P42
P03 P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
Internal Circuit Configuration of an Input Port
PLC Vcc
P00 LED to
R indicate
P01
status of
P02 port P00
P03
Internal
DC
P04 Circuit
Opto-Coupler (CPU)
P05
P06
P07
COM
AC Input Port (Internal Circuit Configuration)
Bridge Rectifier
R1
Pxx
Vcc
LED to
indicate
status of
port P00
R2
COM Internal
Circuit
Opto-Coupler (CPU)
Internal Circuit Configuration of an Output Port
Relay type: (for both AC & DC operation)
Vcc PLC
LED to P40 L
indicate
status of P41
Internal P43
AC/DC
Circuit R P44 Source
(CPU)
P45
P46
P47
COM
Internal Circuit Configuration of an Output Port
Transistor type: (for DC operation)
Vcc PLC
LED to P40 L
indicate
R P41
status of
port P40 P42
Internal P43
Circuit DC
P44
(CPU) Vcc
P45
Opto-Coupler P46
P47
COM
Internal Circuit Configuration of an Output Port
TRIAC type: (for AC operation)
Vcc PLC
LED to P40 L
indicate
status of P41
Opto-Coupler P46
P47
COM
Hardware Wiring
Input wiring
Hardware Wiring
Output wiring
Sourcing and Sinking
The terms sourcing and sinking are used to describe the way in
which DC devices are connected to a PLC.
• Input Sourcing: input device receives current from the input
module, that is, the input module is the source of the current
• Input Sinking: an input device supplies current to the input
module, that is, the input module is the sink for the current
Serial Ports:
Mini-DIN or PS/2
USB Mini-B
RS-232 / RS-485
Purpose of serial ports:
• to upload the program from PC into PLC
• to connect other peripheral devices
• device verification, data acquisition, synchronization between
user applications
Ethernet Port:
P03
P42
P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
A PLC
Logic Functions B
P00 P40 Output
P01 P41
OR Gate: P02
P03
P42
P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
A PLC
Logic Functions P00 P40 Output
P01 P41
P03
P42
P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
A PLC
Logic Functions B
P00 P40 Output
P01 P41
P03
P42
P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
A PLC
Logic Functions B
P00 P40 Output
P01 P41
P03
P42
P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
PLC
Logic Functions A
P03 P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
Programming Example
• Ladder circuit of Start/Stop of motor:
Start
PLC
P00 P40 Motor
Stop
P01 P41
P02 P42
P03 P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
• Programming PLC:
Start
PLC
P00 P40 Motor
Stop
P01 P41
P02 P42
P03 P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
• Starting of Motor:
Start PLC
(actuated)
P00 P40 Motor
Stop
P01 P41
P02 P42
P03 P43
DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
• Continuous running of motor when start button is released:
Start
(released)
PLC
P00 P40 Motor
Stop
P01 P41
P02 P42
P03 P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
• Stopping the motor:
Start PLC
P00 P40 Motor
Stop(actuated)
P01 P41
P02 P42
P03 P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
Multiple Outputs:
Example
• First Priority Circuit:
There are 3 participants in a quiz game. If they want to get the
chance of answering the question from the host, they must
press the answer button on their table first, which will turn on
a lamp in their respective table. Other participants’ pressing
will be invalid if any participant presses the button before
them. The host will have an option to Reset the whole system.
Hardware Connection:
Reset
PLC
P00 P40 Lamp 1
Button 1
P01 P41 Lamp 2
Button 2
P02 P42 Lamp 3
Button 3
P03 P43
DC DC
P04 P44
P05 P45
P06 P46
P07 P47
COM COM
Ladder Logic Program:
Until the host presses the Reset button input from other buttons will be
invalid due to the open circuit in the respective rung. Here, Button 2 is
pressed, but the corresponding lamp will not glow due to the open circuit.
Ladder Logic Program:
Here, the Reset button is pressed and momentarily the whole circuit gets
disconnected from power supply and all the contacts are reset to their
initial state.
P 0000 F P 0000 1
P 0001 A
P 0000 F E D C B A 9 8 7 6 5 4 3 2 1 0
P 0001 F E D C B A 9 8 7 6 5 4 3 2 1 0
P 0002 F E D C B A 9 8 7 6 5 4 3 2 1 0
P 0003 F E D C B A 9 8 7 6 5 4 3 2 1 0
.. ..
. .
. .
. .
. .
. .
. P 1023 F
.
. .
P 1023 F E D C B A 9 8 7 6 5 4 3 2 1 0
Timers
Timers can be categorized into three groups according to their resolution. For
example, the total number of built in timer in XGB PLC series is 1024 (T0000-
T1023). Based on resolution these 1024 timers can be categorized into
following three categories:
• 100ms Timer:
Timing step of this type of timer is 100ms. Their total number in XGB PLC
series is 500; beginning from T000 to T499.
• 10ms Timer:
Timing step of this type of timer is 10ms. Their total number in XGB PLC
series is 500; beginning from T500 to T999.
• 1ms Timer :
The gap between two timing interval is 1ms for these timers. Their total
number in XGB PLC series is 24; beginning from T1000 to T1023.
where, y is the expected time; r is the resolution; and t is the time constant.
Timer Classification for XGB PLC series
There are five types of timer used in XGB ladder program. They
are mentioned below:
• ON Delay timer (TON)
• OFF Delay timer (TOFF)
• Integration or Momentary delay timer (TMR)
• Mono-stable timer (TMON)
• Re-trigger timer (TRTG)
ON Delay Timer (TON):
• Delay period counting will start from (+ve) edge of I/P trigger pulse.
• Without interruption after delay period counting (t), timer o/p will be
high.
• The o/p of the timer will be kept high until i/p trigger pulse will be
continuing high after delay period.
OFF Delay Timer (TOFF):
• Timer high state will start with the positive edge of the i/p pulse.
• Delay period counting will start from (-ve) edge of I/P trigger pulse.
• After delay period counting, o/p of the timer will be low from high state.
Integration or Momentary delay timer (TMR):
• At beginning, timer o/p state will remain low.
• Whenever the sum of the duration of the interrupted momentary pulses is
equal to preset time duration then the o/p of the timer will go to high state
from low state. The high state will be continued until providing reset signal.
Mono-stable timer (TMON):
• At beginning, the timer o/p will remain high. After getting (+ve) edge of i/p
trigger pulse, delay period counting will start. No interruption signal will
be allowed during delay period counting.
• After delay period counting, the o/p of the counter will be low from high
state.
Re-trigger timer (TRTG):
• After getting the positive edge i/p pulse, the timer o/p will remain high
and delay period counting will start.
• However, if the input pulse trigger again means if it gets another positive
edge i/p pulse, the counting of the delay period will get reset. That’s why
this is called re-trigger timer.
Counters
In PLC, counter is a function to count input pulses to activate or
deactivate dependent operation. A counter instruction compares
an accumulated count value to a preset value to determine when
the desired action has been done. Counter can be used to start
an operation when a count is reached to the preset value or to
prevent an operation from occurring when the counting has
reached the preset value.
CTUD
R2
Y2 Connections to PLC output ports
G2
P40 → G1
G2
Y2 P41 → Y1
R2
P42 → R1
P43 → G2
R1 Y1 G1
P44 → Y2
P45 → R2
Connections to PLC input/output ports
P00 → Stop P40 → G1
P01 → Start P41 → Y1
P42 → R1
P43 → G2
P44 → Y2
P45 → R2
Ladder Logic Program:
Example: A counting task
Let us consider, that some manufactured items are moved in a particular
direction with the help of a conveyor belt. The conveyor belt is driven by a
motor. It is required to design a control system to direct six items along one
path for packaging in a box and then 12 items along another path for
packaging in another box. A photocell sensor is used to detect the presence
of an item. The number of pulses from the sensor has to be counted and
depending upon that a deflector plate has to be controlled to guide the item
towards a particular box for packaging.
12 item
Box
6 item Box
Photocell
sensor
Example: A counting task
12 item
Box
Connections to PLC input ports
P00 → Stop
P01 → Start
6 item Box
Photocell P02 → Photo sensor
sensor
Connections to PLC output ports
P40 → Motor for driving the
conveyor
P41 → Deflector plate
Connections to PLC input ports
Ladder Logic Program:
P00 → Stop
P01 → Start
P02 → Photo sensor
Connections to PLC output ports
P40 → Motor for driving the
conveyor
P41 → Deflector plate