You are on page 1of 70

FUNDAMENTALS OF PLC

PROGRAMMING

CPM1A
Course Outline
i – Overview of PLC
ii – Basic Command
a. LD/LD not
b. And/And not
c. Or/Or not
d. And Load
e. Or Load
f. Timer/Counter
WHAT A PROGRAMMABLE
CONTROLLER CAN DO ?

Sequence a. Conventional Relay Logic Replacer


Control
b. Timers / Counters

c. PCB Card Controller Replacer

d. Auto/ Semi-auto/Manual control


of machine and processes
WHAT A PROGRAMMABLE
CONTROLLER CAN DO ?

Sophisticated a. Arithmetic Operation


Control b. Information Handling
c. Analog Control
d. PID
e. Servo motor control
f. Stepper motor control
WHAT A PROGRAMMABLE
CONTROLLER CAN DO ?

Supervisory a. Process Monitoring and Alarm


Control b. Fault Diagnostic and monitoring
c. Interfacing w/ Computer
d. Printer / ASCII Interfacing
e. Factory Automation Networking
f. Local Area Network
g. Wide area Network, etc.
ADVANTAGES OF USING P L C
IN AUTOMATION

 Shorter project implementation time


 Shortest training required
 Easy modification of program
 Easy maintenance
 Higher reliability
PROGRAMMABLE LOGIC
CONTROLLER

is an electronic devices with a programmable


memory used for logic, sequencing, timing
counting and arithmetic to control machine
and its processes.
PROGRAMMABLE LOGIC
CONTROLLER

Power Supply

Signal Unit (CPU) Signal to


From Input Output Solenoid,
Switches, Motors,
Sensors Interface Interface Etc.
Etc. Memory

Block Diagram of PLC


Central Processing Unit

is a microprocessor that coordinates the


activities of the PLC system. It executes
the program, processes I/O signals &
communicates with external devices.
Central Processing Unit

CPM2A-_ _ CDR

CPM1A-20EDR
Inputs

Limit Switch Timer Photoelectric


Switch

Rotary Encoder Proximity Switch


Outputs
Memory

It is the area that hold the operating


system and user memory
Memory

The operating system is actually a


system software that coordinates the
PLC.
Memory

Ladder program, timer and counter are


stored in the user memory.
Types of Memory

1. ROM
2. RAM
3. EPROM
4. EEPROM
Read Only Memory (ROM)

is a non-volatile memory that


can be program only once
Random Access Memory (RAM)

volatile RAM would be normally lost if


the power source is removed, but it is
solved by backing up the RAM with a
battery.
Electrically Erasable Programmable
Read Only Memory (EEPROM)

Its content can be erased and reprogram


electrically, however to a limited number
of times.
Omron PLC Software
Types of Software

1. SSS – Sysmac Support Software


2. Syswin
3. CX-Programmer
4. CX-One
SSS – Sysmac Support Software

Processor 80386, 80486,Pentium


Main Memory 535kbytes minimum
Hard Disk 9Mbytes min. disk space
Expansion Memory 1.2 Mbytes
Keyboard Home,ESC,Control,Pg up
Pg down,Backspace,End,
F1-F10,Insert, Delete, Tab
Syswin

 50 Mhz
 OS : Windows 3.1 or higher
 Resolution : SVGA X 600 or larger
 RAM : 8 Mbytes or more
 Hard Disk : 40 MB or more
CX-Programmer

 32 Bit application
 OS : Windows 95, NT3.51, NT 4.0
 Resolution : SVGA X 600 or larger
 RAM : 16 Mbytes or more
 Hard Disk : 40 MB or more
PC TYPES SELECTING POINTS
CPM2A

Max. number of I/O  120 I/O

Program Capacity  4,096 words


TERMINOLOGY

1 Channel = 16 Bits
1 Word = 16 Bits
Internal Relay (IR)

Do not have any specific function, they


Can be freely used within the program

Except those assigned to input, output,


And special I/O cards.
Temporary Relay (TR)

These bits are used to temporary


Store ON and OFF status.
Holding Relay (HR)

These bits retain their ON and OFF


Status during power interruption.
Data Memory (DM)

Can be read in as WORD, retain status


During power interruption
Special Relay (SR)

These bits serve specific function


Such as flag and control bits.
Common Special Relay (SR)

253.13 Always ON flag


253.15 First cycle flag
255.00 0.1 sec clock pulse
255.01 0.2 sec clock pulse
255.02 1 sec clock pulse
Programming Console Operation
Function Key Mode Operation
Run Monitor Program

Input the CLR MONTR CLR


Password

Clear the CLR SET NOT RESET


Memory MONTR CLR
Inserting instruction

Instruction INS
Deleting Instruction

Instruction Currently
Display DEL
Overview of Instruction
Load / Load Not (LD/LD NOT)
Electrical Control Circuit Diagram

L1 Sw 1 L2
Lamp 1

Sw 2 Lamp 2
Load / Load Not (LD/LD NOT)
Control Ladder Diagram

Address Command Data Enter


L1 L2
000.01
10.01
00000 LD 1 write
00001 OUT 1001 write
000.02 10.05 00002 LD NOT 2 write
00003 OUT 1005 write
00004 FUN 01 write
End
And / And Not
Electrical Control Circuit Diagram

Sw 1 Sw 2 Lamp 2

Sw 3 Sw 4 Lamp 4
And / And Not
Control Ladder Diagram

Address Command Data Enter


000.01 000.02 10.02 00000 LD 1 write
00001 AND 2 write
00002 OUT 1002 write
00003 LD 3 write
00004 AND NOT 4 write
00005 OUT 1004 write
000.03 000.04 10.04 00006 FUN 01 write

End
OR / OR NOT
Electrical Control Circuit Diagram

Sw 1 Lamp 3

Sw 2
Lamp 5
Sw 3
Sw 4
OR / OR NOT
Control Ladder Diagram

Address Command Data Enter

00000 LD 1 write
000.01 10.03 00001 OR 2 write
00002 OUT 1003 write
00003 LD 3 write
000.02 00004 OR NOT 4 write
00005 OUT 1005 write
000.03 10.05 00006 FUN 01 write

000.04

End
AND LD
Control Ladder Diagram

000.03 000.05 000.07

10.06
000.02 000.04

End
AND LD
Control Ladder Diagram

000.03 000.05 000.07 Address Command Data Enter


00000 LD 3 write
10.06 00001 OR 2 write
000.02 000.04
00002 LD 5 write
00003 OR 4 write
00004 AND LD write
End 00005 AND 7 write
00006 OUT 1006 write
00007 FUN 01 write
OR LD
Control Ladder Diagram

000.02 000.03 000.11

10.05
000.04 000.05

End
OR LD
Control Ladder Diagram

000.02 000.03 000.11 Address Command Data Enter


00000 LD 2 write
10.05 00001 AND 3 write
000.04 000.05
00002 LD 4 write
00003 AND NOT 5 write
00004 OR LD write
End 00005 AND NOT 11 write
00006 OUT 1005 write
00007 FUN 01 write
Practice 1
Convert the ladder diagram below
to the equivalent mnemonic code:
01 02
10.07
03 04

05 06

07 08

End
Practice 1
Convert the ladder diagram below
to the equivalent mnemonic code:
01 02
10.07
03 04

05 06

07 08

End
Practice 2
Convert the ladder diagram below
to the equivalent mnemonic code:
TR 0 TR 1
03 04 05
10.00

06
10.02

07 08
10.04

End
Workbits / Internal Relay

A certain bits to trigger other instruction


Indirectly to manipulate the program.

Often used with OUTPUT, OUTPUT NOT,


DIFFERENTIAL UP (DIFU), DIFFERENTIAL
DOWN (DIFD), and KEEP instruction.
Work bits / Internal Relay

A relay for the used of the program only,


it is used when you don’t have to turn ON,
or turn OFF external I/O devices.

The relays of CH to which units are not


mounted are also available for work bits.
Work bits / Internal Relay

The work bits is useful, example, when the


same combination of I/O signal is repeatedly
in the ladder diagram.
Work bits / Internal Relay
The ff. diagram gives an illustration in which a work bit
Can be used to simplify the program:

01 03 04 01 03
10.00 200.00
02 02

01 03 05 200.00 04
10.01 10.00
02 200.00 05
10.01
01 03 06
200.00 06
10.02
10.02
02
Differential UP – DIFU (13)

Turns an output ON for one scan only

Turns an output ON when it detects an


OFF to ON transition in its input signal.
Differential UP – DIFU (13)

input
DIFU(13)
_____ Bits of
IR, SR, AR, HR,LR
Differential UP – DIFU (13)
Self Holding Circuit

Address Command Data Enter


01
DIFU(13)
200.00 00000 LD 1 write
00001 FUN 13
200.00 200.01 DIFU 20000 write
00002 LD 20000 write
00003 OR 1003 write
10.03 10.03 00004 AND NOT 200.01 write
00005 OUT 1003 write
00006 LD 2 write
02
DIFU(13) 00007 FUN 13
200.01 DIFU 200.01 write
00008 FUN 01 write
End
Differential Down – DIFD (14)

input
DIFD(14)
_____ Bits of
IR, SR, AR, HR,LR
Differential down – DIFD (14)
KEEP (11) Latching relay

Address Command Data Enter


02
DIFD(14)
200.01 00000 LD 2 write
00001 FUN 14
200.01 DIFD 20001 write
set 00002 LD 20001 write
KEEP(11) 00003 LD 04 write
04
reset 10.04 00004 FUN 11
KEEP 1004 write
00005 FUN 01 write
End
TIMER

Address :

Input TIM 000


TIM _ _ _ TIM 001
#_ _ _ _

TIM 127

Max of 999.9 sec.


TIMER
Address Command Data Enter
000.01 00000 LD 1 write
TIM 000 00001 TIM 0 write
#0050
#0050 write
TIM 000 Tim 001 00002 LD TIM 0 write
00003 OR 1000 write
010.00 write
010.00 00004 AND NOT TIM 1
00005 OUT 1000 write
010.00
00006 LD 1000 write
TIM 001 00007 TIM 1 write
#0050
#0050 write
End
00008 write
FUN 01
COUNTER

Address :

Set CNT 000


CNT _ _ _ CNT 001
Reset
#_ _ _ _

CNT 127

Max of 9999 counts


COUNTER
Address Command Data Enter

000.01 S
00000 LD 1 write
00001 LD 2 write
CNT 127
000.02 R # 0005 00002 CNT 127 write
#0005 write
CNT 127 00003 LD CNT 127 write
00004 OUT 1006 write
00005 OUT 1007 write
010.06
00006 FUN 01 write

End 010.07
EXERCISE

1. After 1 sec. a push button(000.01) is pushed,


let CH 10 bits 00, 01, and 02 lit consecutively
with one second interval.
2. Then, will turn OFF all output 1 second after
the last LED is ON
3. The sequence will repeat only for 10 times
then, the circuit will be totally OFF after the
last LED is ON.
4.The circuit will start again when PB1 is press.
INTERLOCK (02) /
INTERLOCK CLEAR (03)

IL and ILC instruction unify the several contact


points and enable the program to be simple.
IL is always used in conjunction with ILC to
create interlocks.
INTERLOCK (02) /
INTERLOCK CLEAR (03)

10.00 01
01 02 IL (02)
02 10.00
01 03 10.01

03 10.01
10.02
01 04
10.02
04
End

ILC (03)
End
APPLICATION OF BASIC COMMAND
When a start button is pushed, the motor (M) will move from
Left to right. When LS2 is ON, the motor stops, delay for 5 s
And then moves back to home. When LS1 is ON, the motor
Cuts off signifying the sequence is completed.

LS1 LS2
Start

HOME
PRACTICE – ESCALATOR CONTROL
This escalator is s stationary until someone approaches.
when someone passes by the sensor, the motor starts to
operate, and stop one minute after the last person passed by.

You might also like