PLC Hardware, Software, Etc PDF
PLC Hardware, Software, Etc PDF
PLC Hardware, Software, Etc PDF
Users Manual
The information contained in this manual is the property of Cutler-Hammer, Inc. Information in this
manual is subject to change without notice and does not represent a commitment on the part of CutlerHammer, Inc.
Any Cutler-Hammer software described in this manual is furnished under a license agreement. The
software may be used or copied only in accordance with the terms of the agreement. It is against the
law to copy the software on any medium except as specifically allowed in the agreement. No part of
this manual may be reproduced or transmitted in any form or by any means, electronic, mechanical,
photocopying, recording or otherwise, without prior written permission of Cutler-Hammer, Inc.
TRADEMARKS
Commercial names of products from other manufacturers or developers that appear in this manual are
registered or unregistered trademarks of those respective manufacturers or developers, which have
expressed neither approval nor disapproval of Cutler-Hammer products.
Copyright Cutler-Hammer, Inc. 1998. All rights reserved.
Catalog Number D50SA122
P/N 01-00478-00
Preface
Preface
Welcome to Cutler-Hammers D50 PLC User's Manual. This preface describes the contents of this
manual and provides information on Support Services.
ii
Whats Inside
This manual is organized in the following way:
Preface
Chapter 1: Introduction
Chapter 2: System Configuration
Chapter 3: Product Specification
Chapter 4: Installation and Wiring
Chapter 5: CPU Operation and Memory
Chapter 6: Instructions
Chapter 7: Testing and Troubleshooting
Chapter 8: Troubleshooting Noise Problems
Appendix A: D50 PLC Communication Protocol
Appendix B: Special I/O Functions
Appendix C: D50PGM10 Pocket Editor
Preface
iii
Support Services
It is Cutler-Hammers goal to ensure your greatest possible satisfaction with the operation of our
products. We are dedicated to providing fast, friendly, and accurate assistance. That is why we offer
you so many ways to get the support you need. Whether its by phone, fax, modem, or mail, you can
access Cutler-Hammer support information 24 hours a day, seven days a week. Our wide range of
services include:
Technical Support
1-800-809-2772
If you are in the U.S. or Canada, you can take advantage of our toll-free line for technical assistance
with hardware and software product selection, system design and installation, and system debugging
and diagnostics. Technical support engineers are available for calls during regular business hours
(8 am - 5:30 pm EST) by calling 1-800-809-2772. International calls can be made to either the Tech
Line at 1-800-809-2772 (toll call) or the Cutler-Hammer main business line at 614-882-3282.
Emergency Technical Support
1-800-809-2772
Because machines do not run on a nine-to-five schedule, we offer emergency after-hours technical
support. A technical support engineer can be paged for emergencies involving plant down situations or
safety issues. Emergency support calls are automatically routed directly to our answering service afterhours (5:30 pm - 8 am EST) and weekends. For emergency technical support, call 1-800-809-2772.
Does not currently include product repairs or shipping outside normal business hours.
Technical Support Fax
614-882-0417
You can also contact our technical support engineers by faxing your support requests directly to APSC
Westerville at 614-882-0417.
Information Fax-Back Service
614-899-5323
The latest Cutler-Hammer product information, specifications, technical notes and company news is
available to you via fax through our direct document request service at 614-899-5323. Using a touchtone phone, you can select any of the info faxes from our automated product literature and technical
document library, punch in a fax number and receive the information immediately.
Bulletin Board Service
614-899-5209
iv
1-800-809-2772
FAX 614-899-4141
We also offer you the opportunity to take advantage of software upgrades, advanced software notices,
and special software promotions through our Software Update Service. When you register your
software, you will receive one-year of free or reduced-price upgrades along with all the other benefits
of membership, including 48-hour shipping of software upgrades. Contact the Software Update Service
at 1-800-809-2772 or fax 614-899-4141.
Repair and Upgrade Service
614-882-3282
FAX 614-882-6532
Authorized Cutler-Hammer distributors may place product orders directly with our Order Processing
department by calling 614-882-3282 x406 or faxing 614-882-6532. For information on your local
distributor, call the Cutler-Hammer Tech Line.
Customer Support Center
1-800-356-1243
Authorized Cutler-Hammer distributors and Cutler-Hammer sales offices can get assistance for CutlerHammer standard and component product lines through the Customer Support Center. Call the
Customer Support Center for the following assistance:
1.
2.
3.
4.
For information on your local distributor or sales office, call the Cutler-Hammer Tech Line at 1-800809-2772.
Correspondence Address
Cutler-Hammer
173 Heatherdown Drive
Westerville, OH 43081
Table of Contents
Table of Contents
Preface
Chapter 1: Introduction
11
21
vi
29
Terminology ........................................................................................................................................................ 30
Overview of CPU Operation Mode ..................................................................................................................... 31
What Is the CPU Operation Mode? ............................................................................................................. 31
Run Mode (operating).................................................................................................................................. 31
Stop Mode ................................................................................................................................................... 31
Error Mode .................................................................................................................................................. 31
CPU Processing Procedure .................................................................................................................................. 32
Program Processing Procedure .................................................................................................................... 32
Introduction to Registers...................................................................................................................................... 33
Internal/External Address Designation ................................................................................................................ 33
Expression Example ............................................................................................................................................ 35
Double Mode Address Designation ..................................................................................................................... 36
Absolute Address Designation............................................................................................................................. 37
I/O Address Designation...................................................................................................................................... 38
Digital I/O Address Designation.................................................................................................................. 38
Analog I/O Address Designation ................................................................................................................. 38
Special Internal Addresses................................................................................................................................... 39
Timer/Counter (TC0-255) ................................................................................................................................... 44
Chapter 6: Instructions
47
Basic Instructions................................................................................................................................................. 48
Timer/Counter Instructions.................................................................................................................................. 49
Comparison Instructions ...................................................................................................................................... 50
Substitution, Increment/Decrement Instructions.................................................................................................. 50
Arithmetic Instructions ........................................................................................................................................ 51
Logic Instructions ................................................................................................................................................ 52
Rotation Instructions............................................................................................................................................ 52
Word Conversion Instructions ............................................................................................................................. 53
Bit Conversion Instructions ................................................................................................................................. 54
Transfer Instructions............................................................................................................................................ 55
Block Processing Instructions.............................................................................................................................. 56
How to Read the Description of Instructions....................................................................................................... 57
Instruction.................................................................................................................................................... 57
Ladder.......................................................................................................................................................... 57
Description................................................................................................................................................... 58
Example ....................................................................................................................................................... 59
Basic Instruction Details...................................................................................................................................... 59
STR, STN .................................................................................................................................................... 59
AND, ANN, (ADN)..................................................................................................................................... 60
OR, ORN ..................................................................................................................................................... 61
OUT, SET, RST........................................................................................................................................... 62
NOT............................................................................................................................................................. 63
STR DIF, STR DFN, AND DIF, AND DFN, OR DIF, OR DFN ............................................................... 64
ANB, ORB................................................................................................................................................... 65
MCS, MCR.................................................................................................................................................. 66
Table of Contents
vii
viii
127
143
155
Table of Contents
ix
173
Overview............................................................................................................................................................ 174
High Speed Counter ................................................................................................................................... 174
Configurable Input Response Delay........................................................................................................... 174
Pulse Catch Input ....................................................................................................................................... 174
Pulse Output............................................................................................................................................... 174
Special I/O Function Registers........................................................................................................................... 175
High Speed Counter ........................................................................................................................................... 176
Register Descriptions ................................................................................................................................. 176
Bit Registers............................................................................................................................................... 177
Programming Procedure............................................................................................................................. 178
Configurable Input Response Delay................................................................................................................... 179
Pulse Catch Input ............................................................................................................................................... 180
Pulse Output....................................................................................................................................................... 181
Register Descriptions ................................................................................................................................. 181
Pulse Mode Programming Procedure......................................................................................................... 183
PWM Mode Programming Procedure........................................................................................................ 184
Appendix C: D50PGM10 Pocket Editor
185
Overview............................................................................................................................................................ 186
Specifications ..................................................................................................................................................... 186
Part Descriptions ................................................................................................................................................ 187
Instruction LEDs....................................................................................................................................... 187
Status LEDs .............................................................................................................................................. 187
Register LEDs........................................................................................................................................... 188
Address/Data LED Display........................................................................................................................ 188
Instruction Keys ......................................................................................................................................... 188
Function Keys ............................................................................................................................................ 189
Operating Procedures ......................................................................................................................................... 190
Clear Program ............................................................................................................................................ 191
Add Instruction........................................................................................................................................... 192
Monitor Program........................................................................................................................................ 193
Edit Program .............................................................................................................................................. 197
Error Checking ........................................................................................................................................... 200
Monitor I/O ................................................................................................................................................ 201
Run/Stop PLC ............................................................................................................................................ 204
Instruction Codes ............................................................................................................................................... 205
Basic Instructions ....................................................................................................................................... 205
Advanced Instructions................................................................................................................................ 206
Programming Examples ..................................................................................................................................... 208
Example 1 Basic Instructions .................................................................................................................. 208
Example 2 Timer Instructions ................................................................................................................. 210
Example 3 Counter Instructions .............................................................................................................. 211
Example 4 Comparison/Advanced Instructions ...................................................................................... 213
Chapter 1: Introduction
Introduction
Welcome to the D50 PLC User's Manual. The D50 Programmable Logic Controller (PLC) is a small
application industrial controller, designed to provide maximum flexibility at a minimum cost. This
manual will give you a complete understanding of how to install and program the D50 PLC. It also
includes complete product specifications, and a description of the various products that work with the
D50 PLC.
This chapter contains:
Chapter 1 introduces the D50 PLC by describing its features and discussing installation
considerations.
Chapter 2 discusses various system configurations and products that can be used with the D50
PLC.
Chapter 3 gives performance specifications and operating ranges of the CPU and the D50
series products.
Chapter 4 describes installation and wiring guidelines and procedures including system design
considerations, wiring the power supply, and connecting the PLC to a PC.
Chapter 5 introduces many concepts you need to know to program the D50 PLC including
terminology, how the registers are used, different types of address designations, and the CPU
processing procedure.
Chapter 6 presents detailed information on the Instruction Set that is used by the D50 PLC.
Chapter 8 describes electrical interference or noise and the ways you can reduce its influence.
Appendix B details the configuration and operation of the integrated special I/O functions of
the D50 PLC, including High Speed counters, Pulse Output, and adjustable inputs.
Appendix C describes mnemonic programming and the use of the D50 Pocket Editor.
The D50 PLC is designed for small-sized control applications that require from 1 to 56
control points, high-speed count or analog capability, and advanced functionality.
The D50 PLC is built to simplify operation, maintenance, and repair with its modular design.
I/O flexibility is achieved through the wide variety of available digital and analog modules,
covering a broad range of voltage and current ratings.
The D50 PLC has many additional features that combine to make it the ideal choice for many control
applications.
Chapter 1: Introduction
Self Diagnostics
When placed in the Run mode, the D50 PLC performs startup self-diagnostics and error-checking on
the processor, control program, and I/O system. Error status information is stored internally, providing
for quick and easy troubleshooting of system and programming errors.
Peripheral Support
The D50 PLC has two program loader software packages available for use on standard PCs: the DOSbased GPC5, and the Windows-based WinGPC. These packages provide advanced programming,
monitoring, editing, and troubleshooting for the D50 PLC. A dedicated hand-held programmer is also
available for harsh environments. Cutler-Hammer also offers a complete line of Operator Interface
products and HMI software packages compatible with the D50 PLC.
Note: When this manual uses the term GPC, either GPC5 or WinGPC can be used.
2.
Direct sunlight.
3.
4.
5.
6.
7.
Locations subject to direct impact greater than 10G or vibrations greater than 1G @ 57-2000
Hz.
Use an isolation transformer and line filter on the incoming power to the PLC when in the
vicinity of equipment using or producing high current, high voltage, or large magnetic fields.
2.
Separate the main PLC power line ground from all other power grounds. Always use triplegrounding.
3.
Do not exceed the current and power rating of the external 24 VDC provided by the D50
power supply.
4.
Avoid system faults due to programming errors by reading and fully understanding this
system manual and the PLC instruction set.
5.
Perform regular preventive maintenance on installed systems, checking devices and wiring for
potential breakdowns and failures.
System Configuration
This chapter provides information on the various products that are available for the D50 PLC. It
includes diagrams that show the D50 PLC system components and expansion configurations.
This chapter contains:
RS232
RS485
Programming Cable
D50CBL10
RS232/485
Adapter
D50CPM485
DC 24V
1
IN
OUT
D50
5
IN
GPC5/WinGPC
Program Loader
Software
DC 24V
1
IN
OUT
5
IN
+24VDC
NC
IN
NC
NC
Programmable Controller
IN
ERR
RUN
STOP
OUT
Cutler-Hammer
IN 100-240V
GND
OUT
C
OUT
3
D50 Controller
GND
NC
NC
OUT
C
NC
NC
NC
NC
Cutler-Hammer
OUT
0
NC
ANALOG OUTPUT
Cutler-Hammer
OUT
0
NC
CONVERSION
ERROR
RUN
IN
OUT
NC
D50 Series
OUT
3
Digital Expander
(up to 3)
NC
4
NC
NC
CH0
NC
I
CH1
G
CH0
G
CH1
G
Analog Expander
(up to 2)
Catalog #
Product Description
Remarks
Controller
D50CR14
D50CRA14
D50CD14
All controllers
have 8 digital
inputs and 6
digital outputs.
D50CAA14
D50DCR14
D50DCD14
Catalog #
Product Description
Remarks
Digital
Expander
D50ER14
D50ERA14
D50ED14
All expanders
have 8 digital
inputs and 6
digital outputs.
D50EAA14
Catalog #
Product Description
Remarks
Analog
Expander
D50AIM410V
4 Channels
D50AOM210V
2 Channels
Analog/Frequency Converters
Name
Catalog #
Product Description
Remarks
A/F Converter
48160-450
Maximum of 2 may
be used per D50
F/A Converter
48160-480
Convert Pulse output from D50 PLC into a 0-10VDC Maximum of 1 may
or 4-20mA analog output signal
be used per D50
Programming Equipment
Name
Catalog #
Handheld
Program
Loader
D320PGM500
Product Description
Remarks
Name
Catalog #
Product Description
Remarks
Includes cable
Pocket Editor
D50PGM10
Name
Catalog #
Product Description
GPC5 (DOS)
D50CCS35
WinGPC
(Windows)
D50WINCS35
Note: When this manual uses the term GPC, either GPC5 or WinGPC can be used.
Programming Cables
Name
Catalog #
Product Description
Remarks
RS232C/485
Cable
D50CBL10
6 ft (2 m)
Manuals
Name
Catalog #
Product Description
Remarks
D50 Hardware
Manual
D50SA122
Analog Expander
Manual
D50SA495
GPC5 Manual
D50SA464
WinGPC Manual
D50SA467
Must be ordered
separately
All digital I/O modules, both controller and expander, contain 14 I/O points 8 digital inputs,
and 6 digital outputs.
Up to 2 analog expansion units can be added to the controller. These can be either two analog
input modules, two analog output modules, or one of each.
Any type of digital and analog expansion unit can be mixed and matched as required for the
application.
The digital and analog expansion units may be added in any order.
A maximum of 56 digital points and 8 analog channels are available. This is achieved by
using three digital expansion units, and two analog input expansion units.
10
Product Specification
This chapter outlines the environmental conditions for D50 PLC operation and the performance
specifications and component functions of the controller.
This chapter discusses:
11
12
Specifications
Ambient
temperature
Ambient
humidity
Operating
Storage
Breakdown voltage
Insulation resistance
Vibration resistance
Impact resistance
Noise resistance
Usage condition
External I/O
Digital
Analog
Basic instruction
25 types
Instruction
Application instruction
Process
speed
Basic instruction
2 to 4 S/step
Program capacity
Memory
capacity
Special
functions
Retentive internal
contact (K)
Timer/Counter (TC or
TIM)
System registers
(W, SR)
High-speed Counter
Pulse Output
Input Delay
0 to 64msec adjustable
Electrical Specifications
Power Supply Specifications
Internal Circuit Diagram
FUSE
AC
Internal
Circuit
85-264V
FG
Wiring Diagram
24VDC Out
DC 24V
1
IN
OUT
D50
0
IN
5
IN
Programmable Controller
1
RUN
ERR
OUT
RUN
STOP
Cutler-Hammer
IN 100-240V
GND
OUT
C
OUT
0
OUT
3
85-264VAC In
Specifications
Voltage Input
AC Frequency
47-63Hz
Current Consumption
Max. 0.6A
Output Power
13
14
INPUT
Wiring Diagram
Current
Sinking
Devices
Current
Sourcing
Devices
24VDC
+
DC 24V
OUT
24VDC
+
1
IN
Specifications
Rated Voltage
12 to 24VDC
9 to 30VDC
Input Resistance
3.3 k
Off On
On Off
4 points/common
Isolation
Photocoupler
5
IN
INPUT
Wiring Diagram
110VAC
DC 24V
OUT
1
IN
Specifications
Rated Voltage
110VAC
85 to 132VAC
Input Current
5mA to 14mA
Operating Voltage
Input Delay Time
Min. On
85VAC
Max. Off
30VAC
Off On
On Off
Number of Inputs
8 points
4 points/common
Isolation
Photocoupler
5
IN
15
16
+24VDC
24VDC
GND
COM
OUT
LOAD
OUT
3
LOAD
OUT
0
LOAD
OUT
C
LOAD
GND
LOAD
IN 100-240V
LOAD
Wiring Diagram
Specifications
Rated Voltage
110/220VAC; 30VDC
85 to 132VAC
Electrical Life
Mechanical Life
10M operations
Per Output
2A
Per Common
4A
Per Output
30mA
Off On
On Off
Number of Outputs
6 points
Isolation
Photocoupler
COM
OUT
GND
24VDC
OUT
3
LOAD
LOAD
OUT
0
LOAD
OUT
C
LOAD
GND
LOAD
IN 100-240V
LOAD
Wiring Diagram
Specifications
Rated Voltage
24VDC
5 to 27VDC
Per Output
0.5A
Per Common
4A
Per Output
10mA
Off On
On Off
Number of Outputs
6 points
Isolation
Photocoupler
17
18
COM
OUT
3
LOAD
LOAD
OUT
0
LOAD
LOAD
OUT
GND
LOAD
IN 100-240V
LOAD
Wiring Diagram
Specifications
Rated Voltage
110/220VAC
85 to 132VAC
Per Output
0.5A
Per Common
3A
Per Output
50mA
Off On
On Off
Isolation
Photocoupler
19
DC 24V
1
IN
OUT
D50
IN
Programmable Controller
RUN
IN
Status LEDs
ERR
OUT
RUN
STOP
GND
OUT
C
OUT
0
OUT
3
Mode Switch
RS485 Communication Port
The mode switch has the following settings:
State
Function
RUN
PROG.
Color
RUN
Green
ERROR
Red
Function
On when the CPU is in Run mode.
Flashing when the CPU is in Stop/Program mode.
On when CPU has an error.
The I/O Expansion Port supplies a 10-pin connector for adding digital and/or analog expansion
modules to the base controller.
The RS485 Communication Port supports an RS485 connection for programming, configuring, and
monitoring the PLC. For communication with most RS232 peripherals, such as a personal computer,
an RS232/485 converter must be used. When placed on an RS485 network with other D50, D300, or
D320 PLCs, the ends of the network should be properly terminated with 120 Ohm resistors to prevent
communication errors due to noise and reflections on the transmission line.
20
This chapter provides considerations and information on installing and wiring the D50 PLC.
Diagrams are included to illustrate the installation procedures.
This chapter contains:
21
22
Main power
source
External
I/O device
PLC
Isolation transformer
Interlock Circuit
An interlock circuit can control and prevent problems such as those caused by unexpected or reversed
operation of a motor. Install the interlock circuit external to the PLC control wiring and circuitry.
23
Power-Up Sequence
In a properly designed control system, the default Off state of the system is the safe state, in which no
machinery is operating. Before the PLC is powered-up, line power and control power are applied to the
system. Once the system is powered up in the safe/default state, the PLC is powered up and begins
system control. As necessary, the control system should be modified to ensure the proper delayed
startup to prevent problems on power-up.
For example: 1) Run the PLC after turning on the power
2) Use an external or internal timer to delay the operation of the PLC.
CAUTION: Steps should be taken to prevent damage to the PLC system through fluctuating
Presence of corrosive solutions such as benzene, thinner, alcohol, ammonia and caustic soda.
Direct sunlight.
Do not install near high-tension wires, high-voltage devices, power cables, power devices,
and other devices which generate large power surges or electromagnetic fields when starting
and stopping.
Do not place near wireless communications devices with transceivers, such as walkie talkies,
cellular phones, or shortwave radios.
Do not mount the PLC system rotated vertically, or facing up or down. This will prevent
proper air cooling of the PLC CPU, which will cause abnormal overheating inside the PLC
(see the following diagrams).
IN 100-240V
GND
OUT
C
OUT
3
C
1
OUT
C
5
4
3
0
OUT
C
IN 100-240V
GND
OUT
Cutler-Hammer
RUN
STOP
ERR
RUN
7
6
5
4
3
2
1
IN
D50
Programmable Controller
5
IN
4
C
3
2
1
IN
0
C
OU T
OUT
0
OUT
3
DC 24V
24
Avoid installation over heat generating equipment such as heaters, transformers, and power
resistors.
Avoid radiation noise by leaving a minimum distance of 4 inches (100 mm) from the surface
of each unit to the power cable, and the noise-generating device (motor starter, solenoid, etc.).
OUT
IN
D50
DC 24V
IN
1
IN
OUT
D50
Programmable Controller
5
IN
DC 24V
1
IN
OUT
D50
Programmable Controller
5
IN
DC 24V
1
IN
OUT
D50
Programmable Controller
5
IN
Programmable Controller
RU N
0
IN
IN
ER R
OUT
RU N
STOP
OUT
Cutler-Hammer
IN 100-240V
GND
OUT
C
IN
OUT
Cutler-Hammer
OUT
0
OUT
3
GND
NC
NC
OUT
C
IN
OUT
Cutler-Hammer
OUT
0
OUT
3
GND
4
NC
NC
OUT
C
Cutler-Hammer
OUT
0
OUT
3
GND
4
NC
NC
OUT
C
OUT
0
OUT
3
Leave at least 2 inches (50 mm) from the duct or other devices:
To prevent overheating.
Leave 4 inches (100 mm) or more from the front surface of unit.
This area in front of the PLC helps to avoid the effects of emission, noise, and heat.
The additional space also allows for easier connection to the programming port as needed.
25
26
1.97
(50mm)
3.15
(80mm)
0.59
(15mm)
3.58
(91mm)
3.93
(100mm)
Removal
2
1
27
The expansion cable is connected between the I/O expansion ports on the controller and
expander units.
The expansion cable is keyed to prevent incorrect wiring, with Pin 1 at the top of the
connector.
The connector can be up to 12 in length for mounting the expansion unit above, below, or
farther away from the controller. A 2.5 cable is included with each expansion unit. The
following table lists the parts required to construct a longer cable.
Description
AMP #746286-1
AMP #499252-5
Ribbon cable
28AWG stranded wire, 0.050 spacing 10 conductor w/ PVC insulation, 105deg. C, wire #1
color-coded
28
An isolation transformer can be used to further reduce noise and to prevent failures from
power problems such as ground faults.
Grounding
For the frame ground, use a cable of at least 14 AWG (2 mm) in size. The ground should be
exclusive to the PLC. Sharing the ground connection with other devices can cause problems
due to ground loops and current feedback.
Other
device
PLC
Right
PLC
Other
device
Wrong
This chapter provides you with information about memory addresses and the CPU operation. It
includes a terminology section and an overview of registers.
This chapter discusses:
29
30
Terminology
This section introduces some terminology you should know.
1.
Address (register)
Address refers to the location of memory being used. It can refer to the external input/output
module or internal memory. An address is categorized into 1 bit, 16 bit (word), or 32 bit
(double word).
2.
Bit
A bit is the minimum unit required for calculation. It can be either On (1) or Off (0).
3.
Byte
A byte is made up of 8 bits. It can hold data values from 0 to 255. In base 16, or hexadecimal,
a byte can be expressed as 0 to FF. You cannot have a value greater than 255 when using one
byte.
4.
Word
A word is made of 16 bits. It can hold data values from 0 to 65,535. In base 16 a word can be
expressed as 0 to FFFF.
5.
Double Word
A double word is made of 32 bits. It can hold data values from 0 to 4,294,976,295. In base 16
a double word can be expressed as 0 to FFFFFFFF. In the D50, a double word is made up of
two consecutive word addresses.
6.
Scan Time
The CPU follows a procedure in which it 1) reads the inputs, 2) processes the ladder program,
and 3) updates the outputs. It continually repeats this process. This 3-step process is called a
scan, and the time it takes to complete this process is the scan time. In a typical PLC
application, most of the scan time is used to process the program. When programming, keep
in mind that the scan time will increase as you increase the number of inputs and outputs
and/or the size of the program.
7.
Edge
An edge is defined as the point when an input changes state. For example, a rising edge
occurs during the very first scan after the input has changed from Off to On. A falling edge
occurs after the input has changed from On to Off.
8.
Hex (Hexadecimal)
A hexadecimal number is a value expressed in Base 16. Base 16 values consist of digits from
0 to F. In a byte, word, or double word, each set of 4 bits corresponds to a single hex digit.
For example, the binary value 01001111 would correspond to the hex value 4F, and a decimal
value of 79. A hex value is designated by the use of the symbol $ in front of the value (i.e.
$4F is the hex value 4F).
8.
9.
EEPROM
EEPROM is electronically erasable and programmable memory that retains its data even
through loss of power. The PLC program is stored in EEPROM and will be retained when
power is off.
31
10. GPC
Graphic Programming Console. Cutler-Hammer offers two program loader software packages
for programming, monitoring, and configuring the D50 PLC. The DOS-based package is
GPC5, the Windows-based package is WinGPC. In this manual, GPC is used to refer to
either of these programs.
Stop Mode
The user program is stopped and the external outputs are turned Off. In the Stop mode, you can
correct, delete, and transfer the program.
Error Mode
The Error mode occurs when the D50 PLC finds an error after running the self-diagnostics. When an
error occurs, the CPU stops program operation and turns off all external outputs. When the Error mode
occurs, do one of the following:
Check the error code and take appropriate measures, then change power from Off to On.
Switch the mode switch back to the STOP position. When the switch is returned to RUN the
program and data are re-initialized (excluding the retentive data).
32
2. Process
input/output
1 scan
time
3. Watchdog
time 0
4. Program
analysis
5. Peripheral device
signal processing
The diagram above indicates the PLC program processing procedure. The CPU regularly repeats
procedure 1 through 5. This cycle is called 1 scan time.
1.
2.
Input/output processing
Preserves the On/Off state of the external I/O and uses it as input in the next scan. (For
accurate processing, input should continue for more than 1 scan time.) The processed program
outputs are sent from the internal memory to the external modules.
3.
4.
Program analysis
Executes the program from its first step to its final step and stores the internal/external output
in the working RAM.
5.
The following illustration shows the difference between the relay board and PLC sequence processing.
The relay carries out all sequences simultaneously while the PLC processes sequentially throughout
the program.
LS1
LS2
R0.1
X1
M0.0
X1
X1
T1
M0.0
T1
TC0
Y1
R0.2
M0.0
(OUT)
TIM CH = 0
V = 100
R15.0
(OUT)
33
Introduction to Registers
The D50 PLC has a series of registers for storing data. Different registers store different types of data.
1.
2.
3.
4.
5.
Each type of register is used for a variety of purposes. The register used will be determined by the type
of function being performed.
1.
When a calculation or input value exceeds 255 ($FF), use double mode instructions which can
store and calculate values up to 65,535 in the K, M, R, and W registers..
2.
When a value needs to be stored even through a loss of system power, use the K area. The K
area is preserved unless specifically erased. The W area is erased by program downloads or
loss of power.
3.
For bit operations, such as setting, resetting, shifting, or rotating use the M, K, or R registers.
You cannot perform bit operations on W registers.
4.
The Set Value of timers and counters is stored in a special area of the W registers, W2048 to
W2303. These values can also be addressed using register type SV. The Set Values are then
referenced as SV000 to SV255.
5.
The Present Value of timers and counters is stored above the Set Values in the W registers,
from W2304 to W2559. These values can also be addressed using the PV designation, PV000
to PV255. The Present Values for channels 0 to 16 are maintained in the Stop state. It is also
retentivethe value is maintained through loss of power.
The memory address designation types are R, L, M, K, F, W, SV, PV, SR, and TC.
34
A bit address is composed of a character (R, L, M, K, F), a three digit word address (000 to
127), a decimal point, and a bit address (0 to 15). The timer/counter contact is represented by
the TC label followed by three digits. The three digits indicate the channel number of the
timer/counter (TC000 to TC255).
A word address is composed of a character (R, L, M, K, W) and a four digit number (i.e.
W0000 to W0255). Special areas of word memory have alternate designations. For example,
words W2560 to W2815 are also referred to as the System Registers, and can be represented
as SR0000 to SR0511.
The bit address indicates an On (1) or Off (0) state. The byte address is composed of 8 bits
that holds data values of 0 to 255. The word address is composed of 16 bits that holds data
values of 0 to 65,535.
Scope
Features
R000.0 to R003.7
R015.0 to R018.5
56 points, 8 words
R004 to R014
R019 to R029
M000.0 to M031.15
System Flag
F000.0 to F001.15
Timer/Counter
TC000 to TC255
W0000 to W0255
SR000 to SR255
35
Expression Example
M 012 . 12
Bit number
2 digits, range is 0 to 15.
Word number
When used with bit number, 3 digits (000 to 127) are used.
When used for word number only, express in 4 digits (0000 to 3071).
Register Type
R, L, M, K, F, or W indicates address type.
The W memory contains the data area (W0000 to W0255), the timer Set Value
area (W2048 to W2303 = SV000 to SV255), the timer Present Value area (W2304
to W2559 = PV000 to PV255), and the System Register area (W2560 to W2815 =
SR000 to SR255).
Note: The basic contact and coil instructions require a bit designation and use the 3.2 bit address
format. Comparison and application instructions most often use word parameters, and are
expressed using the 4 digit word address.
36
Words are composed of two bytes put together. The designation for a word is exactly the
same as the designation for the byte, consisting of a one character register type and a 4 digit
word address. Bytes hold 8 bits of data, words hold 16 bits of data.
The type of instruction used determines whether the register is processed as a single byte or a
word. For comparison instructions (>, <, ==, etc.), the programmer must be in Double
Mode to enter a word comparison (refer to program loader manual for details). For
application instructions, those instructions that start with a D in front of the related instruction
are word instructions, and process the data as 16-bit words instead of bytes.
Example 1:
Byte
Word
LET
D=W0
S=250
DLET
D=W0
S=2500
W0005
=<M0003
D W0005
=<M0003
The example shows comparison instructions being used in the single mode
of GPC. The parameters W0005 and M0003 represent only 8 bits of data.
The high 8 bits are NOT used as part of the comparison.
In this example, GPC is in double mode and comparison instructions are
used. The comparison is performed on 16 bits of data. All of word W0005
and M0003 will be compared.
37
External
I/O
Internal
Contact
Internal
Keep
Contact
Absolute Address
Dec.
Hex.
R0000
0000
R0001
0001
R0002
0002
Register
Address
Data
Words
Absolute Address
Dec.
Hex.
W0000
512
0200
W0001
513
0201
W0002
514
0202
R0028
28
001C
W0254
766
02FE
R0029
29
001D
W0255
767
02FF
M0000
192
00C0
SV000
512
0200
M0001
193
00C1
SV001
2560
0A00
M0002
194
00C2
M0030
222
00DE
T/C Set
Value
T/C
Present
Value
SV255
2815
0AFF
PV000
2816
0B00
PV001
2817
0B01
M0031
223
00DF
K0000
320
0140
K0001
321
0141
PV255
3071
0BFF
K0002
322
0142
SR000
3072
0C00
K0003
323
0143
SR001
3073
0C01
K0014
334
014E
SR254
3326
0CFE
K0015
335
014F
SR255
3327
0CFF
System
Registers
When accessing a bit absolute address using the program loader port communications protocol, the bit
address (0 to 15) is kept separate from the word address (as shown below).
1 word display
15
4
Word absolute address
0
bit number
For example, the absolute bit address for K012.12 internal contact is $14CC (hex).
(word absolute address = $014C + bit number = $C = $14CC)
Refer to the appendix for a detailed explanation of the communications protocol.
38
00
01
02
03
06
07
I/O Points
14
14
4 words
14
2 words
14
Word No.
R0, R15
R1, R16
W240 W243
R2, R17
W248, W249
R3, R18
R0.0 R0.7
R1.0 R1.7
R2.0 R2.7
Bit No.
R17.0 R17.5
R3.0 R3.7
R18.0 R18.5
The CPU assigns addresses to the digital inputs in sequential order, starting at address R0.
Each module uses 8 bits of the address for the 8 inputs.
The CPU assigns addresses to the digital outputs in sequential order, starting at address R15.
Each modules uses 6 bits of the address for the 6 outputs.
A maximum of 3 digital modules, of any mix of voltage I/O type, may be added.
The first analog input module uses data words W240 to W243 for its four analog input
channels. Each word contains the 12-bit representation of the analog input signal for the
channel. The second analog input module is assigned words W244 to W247. These
assignments are independent of the position of the module in the chain, or whether an analog
output module is present.
The first analog output module uses data words W248 and W249 for its two analog output
channels. The 12-bit representation to be output as an analog signal on the channel must be
placed in these words. The second analog input module is assigned words W250 and W251.
These assignments are independent of the position of the module in the chain, or whether an
analog input module is present.
Function
Details
Remarks
F0.0
System check
When power is applied, the system runs selfdiagnostics. Should any fault exist, the error lamp is
turned on. Output and operation are halted.
Normal: Off
F0.1
Normal: Off
F0.2
Normal: Off
F0.3
Normal: Off
F0.4
Program check
Normal: Off
F0.5
Not Used
F0.6
Normal: Off
F0.7
F0.8
F0.9
F0.10
Normal: On
F0.11
Not Used
F0.12
Not Used
F0.13
Not Used
F0.14
Normal: Off
F0.15
Normal: On
Normal: On
39
40
Function
Details
F1.0
F1.1
Scan clock
F1.2
F1.3
1 sec. Clock
10ms
F1.4
10ms
Note
50ms 50ms
F1.5
Instantaneous interrupt
Maintained
F1.6
Execute status
F1.7
F1.8
Carry Flag
F1.9
F1.10
F1.11
Reserved
System use.
Do not use.
F1.12
Reserved
System use.
Do not use.
F1.13
Reserved
System use.
Do not use.
F1.14
Reserved
System use.
Do not use.
F1.15
Reserved
System use.
Do not use.
Note: The 16 bits in the F1 address provide the CPU's special function and self diagnosis result. They
are used for status contacts only, and are not used to modify or control the PLC. Only the F1.5
instantaneous interrupt display contact should be used as an output contact by the user, to be
turned off after power loss indication.
41
Function
Detail
SR000
CPU address
Indicates the CPU ID number in the lower 8 bits. 0 to 223 are the
valid user-defined values, 255 is the default value.
SR001
CPU status
03
02
01
00
Error = 1
Run control (same as F15)
CPU switch RUN, Remote Stop = 1
CPU switch RUN = 1
CPU switch STOP = 0
SR002
User watchdog
SR003
Scan time
SR004
SR005 to
SR0016
Reserved
SR017
Location of undefined
instruction
SR019
Reserved
System use.
SR020
Multiplication
SR021
Remainder Low
SR022
Remainder High
SR023 to
SR0029
Reserved
System use.
42
Address
Function
Detail
Stores syntax error information when the user program fails the
system diagnostic check. Each bit in the word indicates a different
error condition. See table below.
SR031
Reserved
System Use.
SR032
Error Step #
SR033
Error Step #
SR034
Error Step #
SR036
Error Step #
SR037
Error Step #
SR038
Error Step #
SR039
Error Step #
SR040
Error Step #
SR041
Error Step #
SR042
Error Step #
SR043
Error Step #
SR044
Error Step #
SR045
Error Step #
SR047
Error Step #
SR030
43
Indicates the result of the automatic check on user program syntax when the programmer or GPC
executes a syntax check, and when operation mode is switched from the Stop state to the Run state. If
the value of SR30 is not zero, F0.4 turns On. The error lamp also turns On.
There are two error correction methods:
Method 1: Find the error in the CPU online mode, then correct the program.
Method 2: Use the syntax checking function, then correct the program.
Word
SR30
Bit
Detail
On if the I/O number range of bit process instruction is beyond the specified range or
designates an external contact/output module which is not installed.
On if the channel number of the timer or the counter exceeds 255 or is duplicated.
On if the bit or word number in the application program is beyond the specified range or if it
designates a module which is not installed.
Not used.
On if the label numbers of the JMP or CALL instructions exceed 63, the corresponding
instruction (LBL, SBR) does not exist, and/or the corresponding LBL/SBR instructions exist
prior to JMP/CALL instructions.
10
11
12
On if the FOR/NEXT instructions are mistakenly combined and/or used more than five
times. (Loop)
13
On if SBR/RET instructions are not combined and/or used and/or the SBR instructions
overlap or exceed 63.
14
Not used.
15
44
Timer/Counter (TC0-255)
The table below gives the alternate Word address for the timer/counter Set Value and Present Value
Ch
SV
PV
Ch
SV
PV
Ch
SV
PV
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
W2048
W2049
W2050
W2051
W2052
W2053
W2054
W2055
W2056
W2057
W2058
W2059
W2060
W2061
W2062
W2063
W2064
W2065
W2066
W2067
W2068
W2069
W2070
W2071
W2072
W2073
W2074
W2075
W2076
W2077
W2078
W2079
W2080
W2081
W2082
W2083
W2084
W2085
W2086
W2087
W2304
W2305
W2306
W2307
W2308
W2309
W2310
W2311
W2312
W2313
W2314
W2315
W2316
W2317
W2318
W2319
W2320
W2321
W2322
W2323
W2324
W2325
W2326
W2327
W2328
W2329
W2330
W2331
W2332
W2333
W2334
W2335
W2336
W2337
W2338
W2339
W2340
W2341
W2342
W2343
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
W2088
W2089
W2090
W2091
W2092
W2093
W2094
W2095
W2096
W2097
W2098
W2099
W2100
W2101
W2102
W2103
W2104
W2105
W2106
W2107
W2108
W2109
W2110
W2111
W2112
W2113
W2114
W2115
W2116
W2117
W2118
W2119
W2120
W2121
W2122
W2123
W2124
W2125
W2126
W2127
W2344
W2345
W2346
W2347
W2348
W2349
W2350
W2351
W2352
W2353
W2354
W2355
W2356
W2357
W2358
W2359
W2360
W2361
W2362
W2363
W2364
W2365
W2366
W2367
W2368
W2369
W2370
W2371
W2372
W2373
W2374
W2375
W2376
W2377
W2378
W2379
W2380
W2381
W2382
W2383
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
W2128
W2129
W2130
W2131
W2132
W2133
W2134
W2135
W2136
W2137
W2138
W2139
W2140
W2141
W2142
W2143
W2144
W2145
W2146
W2147
W2148
W2149
W2150
W2151
W2152
W2153
W2154
W2155
W2156
W2157
W2158
W2159
W2160
W2161
W2162
W2163
W2164
W2165
W2166
W2167
W2384
W2385
W2386
W2387
W2388
W2389
W2390
W2391
W2392
W2393
W2394
W2395
W2396
W2397
W2398
W2399
W2400
W2401
W2402
W2403
W2404
W2405
W2406
W2407
W2408
W2409
W2410
W2411
W2412
W2413
W2414
W2415
W2416
W2417
W2418
W2419
W2420
W2421
W2422
W2423
45
SV
PV
Ch
SV
PV
Ch
SV
PV
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
W2168
W2169
W2170
W2171
W2172
W2173
W2174
W2175
W2176
W2177
W2178
W2179
W2180
W2181
W2182
W2183
W2184
W2185
W2186
W2187
W2188
W2189
W2190
W2191
W2192
W2193
W2194
W2195
W2196
W2197
W2198
W2199
W2200
W2201
W2202
W2203
W2204
W2205
W2206
W2207
W2208
W2209
W2210
W2211
W2212
W2213
W2424
W2425
W2426
W2427
W2428
W2429
W2430
W2431
W2432
W2433
W2434
W2435
W2436
W2437
W2438
W2439
W2440
W2441
W2442
W2443
W2444
W2445
W2446
W2447
W2448
W2449
W2450
W2451
W2452
W2453
W2454
W2455
W2456
W2457
W2458
W2459
W2460
W2461
W2462
W2463
W2464
W2465
W2466
W2467
W2468
W2469
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
W2214
W2215
W2216
W2217
W2218
W2219
W2220
W2221
W2222
W2223
W2224
W2225
W2226
W2227
W2228
W2229
W2230
W2231
W2232
W2233
W2234
W2235
W2236
W2237
W2238
W2239
W2240
W2241
W2242
W2243
W2244
W2245
W2246
W2247
W2248
W2249
W2250
W2251
W2252
W2253
W2254
W2255
W2256
W2257
W2258
W2259
W2470
W2471
W2472
W2473
W2474
W2475
W2476
W2477
W2478
W2479
W2480
W2481
W2482
W2483
W2484
W2485
W2486
W2487
W2488
W2489
W2490
W2491
W2492
W2493
W2494
W2495
W2496
W2497
W2498
W2499
W2500
W2501
W2502
W2503
W2504
W2505
W2506
W2507
W2508
W2509
W2510
W2511
W2512
W2513
W2514
W2515
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
W2260
W2261
W2262
W2263
W2264
W2265
W2266
W2267
W2268
W2269
W2270
W2271
W2272
W2273
W2274
W2275
W2276
W2277
W2278
W2279
W2280
W2281
W2282
W2283
W2284
W2285
W2286
W2287
W2288
W2289
W2290
W2291
W2292
W2293
W2294
W2295
W2296
W2297
W2298
W2299
W2300
W2301
W2302
W2303
W2516
W2517
W2518
W2519
W2520
W2521
W2522
W2523
W2524
W2525
W2526
W2527
W2528
W2529
W2530
W2531
W2532
W2533
W2534
W2535
W2536
W2537
W2538
W2539
W2540
W2541
W2542
W2543
W2544
W2545
W2546
W2547
W2548
W2549
W2550
W2551
W2552
W2553
W2554
W2555
W2556
W2557
W2558
W2559
46
Note: Channel: The inherent number of the timer and the counter.
Set Value (SV): The designated value for the timer (to turn On) and the counter (number of
times On) to start operation.
Present Value (PV): Current processing value of the timer (elapsed time) and the counter
(number of counts).
Note: When using GPC software, the above W registers can be represented as follows.
Ch
0
1
:
255
CAUTION: Be sure you understand the programming of the timer/counter thoroughly. If you
change the above registers while the program is running or program them
incorrectly, errors or damage may occur.
Chapter 6: Instructions
Instructions
This chapter contains all of the instructions that are used with the D50 PLC. The instructions are
grouped by function, and then explained in detail.
This chapter discusses:
47
48
Basic Instructions
Mnemonic
Command
Ladder Symbol
Description
STR
Start
Start NO contact.
STN
Start Not
Start NC contact.
AND
And
ANN (ADN)
And Not
OR
Or
ORN
Or Not
OUT
Out
(OUT)
Relay output.
SET
Set
(SET)
Turn On output.
RST
Reset
(RST)
NOT
Not
STR DIF
Start Differential
).
STR DFN
).
AND DIF
And Dif.
).
AND DFN
).
OR DIF
Or Dif
).
OR DFN
Or Dif. Not
).
ANB
And Block
ORB
Or Block
MCS
(MCS)
MCR
(MCR)
Chapter 6: Instructions
Timer/Counter Instructions
Mnemonic
TIM
Command
On Delay Timer
Ladder
Symbol
TIM
T CH = 10
SV = 500
Description
Remarks
input
output
SST
SST
T CH = 12
SV = 500
input
output
UC
Up Counter
UC
U CH = 13
SV = 5
R
Up counter
input
present
value
output
set
value
DC
Down Counter
Down counter
input
present
value
output
Up-Down Counter
UDC
U CH = 16
SV = 3
D
R
Up/down counter
input U
input D
present
value
output
reset
reset
UDC
reset
DC
U CH = 14
SV = 5
set value
49
50
Comparison Instructions
Mnemonic
Command
Byte
Word
Description
STR =
AND =
OR =
START =
AND =
OR =
A
= B
D C
= D
STR <>
AND <>
OR <>
START <>
AND <>
OR <>
A
<> B
D C
<> D
STR >
AND >
OR >
START >
AND >
OR >
A
> B
D C
> D
STR >=
AND >=
OR >=
START >=
AND >=
OR >=
A
>= B
D C
>= D
STR <=
AND <=
OR <=
START <=
AND <=
OR <=
A
<= B
D C
<= D
STR <
AND <
OR <
START <
AND <
OR <
A
< B
D C
< D
Command
Byte
Word
Description
LET
(DLET)
Let (Substitution)
LET
D=
S=
INC
(DINC)
Decimal increment
INC
D=
DINC
D=
DEC
(DDEC)
Decimal decrement
DEC
D=
DDEC
D=
INCB
(DINCB)
BCD increment
INCB
D=
DINCB
D=
DECB
(DDECB)
BCD decrement
DECB
D=
DDECB
D=
DLET
D=
S=
Chapter 6: Instructions
Arithmetic Instructions
Mnemonic
Command
Byte
Word
Description
ADD
(DADD)
Decimal addition
ADD
D =
S1 =
S2 =
SUB
(DSUB)
Decimal subtraction
SUB
D =
S1 =
S2 =
DSUB
D =
S1 =
S2 =
D = S1 - S2
(Decimal operation)
MUL
(DMUL)
Decimal
multiplication
MUL
D =
S1 =
S2 =
DMUL
D =
S1 =
S2 =
D = S1 S2
(Decimal operation)
DIV
(DDIV)
Decimal division
DIV
D =
S1 =
S2 =
DDIV
D =
S1 =
S2 =
D = S1/S2
(Decimal operation)
ADDB
(DADDB)
BCD addition
ADDB
D =
S1 =
S2 =
DADDB
D =
S1 =
S2 =
D = S1 + S2
(BCD operation)
SUBB
(DSUBB)
BCD subtraction
SUBB
D =
S1 =
S2 =
DSUBB
D =
S1 =
S2 =
D = S1 - S2
(BCD operation)
MULB
(DMULB)
BCD multiplication
MULB
D =
S1 =
S2 =
DMULB
D =
S1 =
S2 =
D = S1 S2
(BCD operation)
DIVB
(DDIVB)
BCD division
DIVB
D =
S1 =
S2 =
DDIVB
D =
S1 =
S2 =
D = S1/S2
(BCD operation)
ADC
(DADC)
Decimal addition
w/carry
ADC
D =
S1 =
S2 =
DADC
D =
S1 =
S2 =
D = S1 + S2 + CY
(Decimal operation, include carry)
SBC
(DSBC)
Decimal subtraction
w/carry
SBC
D =
S1 =
S2 =
DSBC
D =
S1 =
S2 =
D = S1 - S2 - CY
(Decimal operation, include carry)
ADCB
(DADCB)
BCD addition
w/carry
ADCB
D =
S1 =
S2 =
DADCB
D =
S1 =
S2 =
D = S1 + S2 + CY
(BCD operation, include carry)
SBCB
(DSBCB)
BCD subtraction
w/carry
SBCB
D =
S1 =
S2 =
DSBCB
D =
S1 =
S2 =
D = S1 - S2 - CY
(BCD operation, include carry)
ABS
(DABS)
Absolute value
ABS
D =
DABS
D =
D = |D|
(Absolute value operation)
NEG
(DNEG)
Negative
(2s complement)
NEG
D =
DNEG
D =
NOT
(DNOT)
NOT
(1s complement)
NOT
D =
DNOT
D =
DADD
D =
S1 =
S2 =
D = S1 + S2
(Decimal operation)
51
52
Logic Instructions
Mnemonic
WAND
(DAND)
WOR
(DOR)
XOR
(DXOR)
XNR
(DXNR)
Command
Bitwise AND (logic
multiply)
Bitwise OR (logic
sum)
Exclusive OR
Exclusive OR NOT
(equal circuit)
Byte
AND
D =
S1 =
S2 =
OR
D =
S1 =
S2 =
XOR
D =
S1 =
S2 =
XNR
D =
S1 =
S2 =
Word
DAND
D =
S1 =
S2 =
DOR
D =
S1 =
S2 =
DXOR
D =
S1 =
S2 =
DXNR
D =
S1 =
S2 =
Description
Store AND of S1 and S2 in D.
S1 0
S2 0
D 0
Store OR of S1 and S2 in D.
S1 0
S2 0
D 0
S2 0
D 0
S2 0
D 1
Rotation Instructions
Mnemonic
RLC
(DRLC)
Command
Rotate left without
carry
Byte
RLC
D =
N =
Word
DRLC
D =
N =
Description
Rotate contents of designated
register D to the left N times.
(lowerhigher)
F1.8
RRC
(DRRC)
RRC
D =
N =
DRRC
D =
N =
15 ...D... 0
ROL
(DROL)
Rotate left
ROL
D =
N =
DROL
D =
N =
F1.8
ROR
(DROR)
Rotate right
ROR
D =
N =
DROR
D =
N =
F1.8
SHL
(DSHL)
Shift left
SHL
D =
N =
DSHL
D =
N =
SHR
(DSHR)
Shift right
SHR
D =
N =
DSHR
D =
N =
F1.8
15 ...D...
15 ...D... 0
F1.8
Chapter 6: Instructions
53
Command
Binary Coded
Decimal
Byte
BCD
D =
S =
Word
DBCD
D =
S =
Description
Convert binary number of S to BCD
and store in D.
S ...... 0 0 1 1 1 1 1 1 =63
D ...... 0 1 1 0 0 0 1 1 =$63
BIN
(DBIN)
Binary
BIN
D =
S =
DBIN
D =
S =
XCHG
(DXCHG)
SEG
Exchange
Segment
XCHG
D1 =
D2 =
SEG
D =
S =
DXCHG
D1 =
D2 =
D1 .. 0 0 1 1
D2 .. 0 0 1 1
D2 .. 0 1 0 1
ENCO
Encode
ENCO
D =
S =
b
c
D iable
DECO
Decode
DECO
D =
S =
0 0 0 0 0 1 1 1
6+1=7
x x x x 0 1 0 1 =5
D 0..0 0 0 1 0 0 0 0 0
15..8 7 6 5 4 3 2 1 0
DIS
Dissemble
DIS
D =
Nd =
Sr =
UNI
Unify
UNI
D =
Sr =
Nd =
D
D+1
D+2
D+3
$0000
$0000
$0000
$0000
0
1
0
0
1
1
1
1
0
1
0
1
1
0
0 4
1 7
Sr
S+1
S+2
S+3
$
$
$
$
0
1
1
0
1
1
0
1
0
1
1
0
$ 4 1 1 1 1 0 1 0 1
1
1
0
0
54
Command
Bit Set
Byte
BSET
D =
N =
Word
Description
Set Nth bit of D to 1.
D
......
0 1 1 1 1 1 0 0
N=5
BRST
Bit Reset
BRST
D =
N =
......
0 1 0 1 0 1 0 0
N=3
BNOT
Bit Not
BNOT
D =
N =
......
......
0 1 1 1 0 1 0 0
N=4
BTST
Bit Test
BTST
D =
N =
0 1 1 0 0 1 0 0
......
0 1 1 1 0 1 0 0
N=6
SUM
SC
Sum
Set Carry
SUM
D =
S =
SC
$00
0 1 1 1 0 1 0 0 4 ON(=1)s
0..0
0 0 0 0 0 1 0 0 D=4
RC
Reset Carry
RC
F1.8
CC
Complement Carry
CC
F1.8
F1.8
F1.8
Chapter 6: Instructions
55
Transfer Instructions
Mnemonic
LDR
(DLDR)
Command
Load D(Sr)
Byte
LDR
D =
Sr =
Word
DLDR
D =
Sr =
Description
Store value at absolute address Sr in
D.
Register
Value
Absolute
Address
Sr =
D=
STO
(DSTO)
Store (D)Sr
STO
Sr =
D=
DSTO
Sr =
D=
Sr =
MOV
D =
Sr =
Ns =
Data
Value
X
D=
Move
Y
Y
Register
Value
MOV
Data
Value
...... 1 0 1 0 1 0 1 0
Sr+1
Sr+2
...... 0 0 0 0 1 1 1 1
...... 1 1 1 1 0 0 0 0
...... 1 0 1 0 1 0 1 0
D+1
D+2
...... 0 0 0 0 1 1 1 1
...... 1 1 1 1 0 0 0 0
Ns=3
FMOV
Fill Move
FMOV
D =
Ns =
V =
...... 1 0 1 0 1 0 1 0
...... 1 0 1 0 1 0 1 0
D+1
...... 1 0 1 0 1 0 1 0
D+2
D+3
...... 1 0 1 0 1 0 1 0
...... 1 0 1 0 1 0 1 0
Ns=4
BMOV
Bit Move
BMOV
Db =
Sb =
Ns =
0 1 1 1 0 1 0 0
If Ns=4
Db ......
BFMV
BFMV
Db =
Ns =
V =
0 1 0 1 0 1 0 0
Ns=5
0 1 1 1 1 1 0 0
56
Command
FOR
(DFOR)
For Loop
NEXT
Next
JMP
Jump
LBL
Label
Byte
FOR
D =
NEXT
JMP
L =
LBL
L =
Word
DFOR
D =
Description
Begin execution of instructions
between FOR and corresponding
NEXT. Repeat execution D times.
Decrease D of FOR instruction by 1.
If not zero, repeat from FOR
Instruction.
Jump to LBL instruction L.
(L = 0 to 63)
Position jumped to by JMP
instruction.
(L = 0 to 63)
JMPS
Jump Start
JMPS
JMPE
Jump End
JMPE
CALL
Call Subroutine
SBR
Subroutine Start
CALL
Sb =
SBR
Sb =
RET
Subroutine Return
RET
WAT
Watchdog Timer
WAT
END
END
END
Chapter 6: Instructions
57
Sample Instruction
Mnemonic
Substitution Formula
(Assignment expression)
Range
LET
Bit
DLET
Byte
Word
Explanation of Codes
= unavailable option
= available option
$xx indicates a hexadecimal number.
Explanation of Table
MnemonicA byte (single mode) instruction, D designates word (double mode) instruction.
Sample Ladder
R
LET
D=
S=
D: Destination
S: Source
Example: S = M0, and M0 is 123
D = R17, and R17 is 45
Before execution: M0 = 123, R17 = 45
After execution: M0 = 123, R17 = 123
Explanation of Ladder
The ladder diagram shows the structure of the instruction as it is displayed. Additional text typically
gives an example and explains the processing structure.
58
Sample Description
Range: LET: 0 to 255
DLET: 0 to 65,535
1.
2.
3.
4.
Explanation of Description
The description provides details of the instruction.
Sample Example
Program Expression
R000.2
LET
D = M0000
S = 123
LET
D = M001
S = 100
R000.3
R
Time Chart
R000.2
R000.3
M0000
M0001
R0017
0000
0000
0000
0123
0100
0000
0123
0100
0123
LET
D = R017
S = M0000
Explanation of Example
The example shows an application of an instruction as programmed in GPC. The time chart
demonstrates how the instruction operates with respect to time and the changing input conditions for
the example. The results of the operation may also be shown as part of the example.
Chapter 6: Instructions
Range
STR
Bit
STN
Byte
Word
Ladder
A
( )
( )
Description
1.
2.
3.
4.
Every rung in the ladder program begins with either a STR or STN.
Every rung will contain one or more contacts.
Every rung will end in one or more output coils or application instructions.
When programming a ladder with NO and NC contacts, GPC will automatically use the
proper contact instruction (STR, STN, AND, ANN, OR, ORN).
R000.2
R015.2
(OUT)
R000.3
R015.3
(OUT)
Example
Program Expression
R000.0
M000.0
(OUT)
R000.1
M000.1
(OUT)
M000.2
(OUT)
Time Chart
R000.1
M000.1
R000.1
M000.1
M000.2
59
60
Instruction
Mnemonic
AND
Series Connection
Range
Bit
Series connection
ANN
Byte
(ADN)
Word
Ladder
AND: NO (normally open) contact series connection.
ANN: NC (normally closed) contact series connection.
Description
1.
2.
AND and ADN (AND NOT) indicate a series connection of each contact.
The number of ANDs and ADNs used within one branch (rung) is unlimited.
R000.3
3.
R000.4
M010.15
(OUT)
M010.15 is On only when contact R000.3 is On and contact R000.4 is Off. M010.15 is Off
for all other cases.
Example
Program Expression
R000.1
M000.0
R000.2
M000.0
(OUT)
M000.1
(OUT)
Time Chart
R000.1
R000.2
M000.0
M000.1
Contact M000.0 is On only when R000.1 is On and R000.2 is Off. M000.0 is Off for all other cases.
Chapter 6: Instructions
Instruction
Mnemonic
OR
Parallel Circuit
Range
Bit
Parallel connection
ORN
Byte
Word
Ladder
OR: NO (normally open) contact parallel connection.
ORN: NC (normally closed) contact parallel connection.
Description
1.
2.
Example
Program Expression
R000.1
R000.2
M000.1
(OUT)
Time Chart
R000.1
R000.2
R000.0
61
62
Instruction
Mnemonic
Output
Range
OUT
Relay output
Bit
SET
On output
Byte
RST
Off output
Word
Ladder
OUT: Relay coil turns On or Off based on the state of the input conditions.
SET: Relay coil turns On when the input conditions are true.
RST: Relay coil turns Off when the input conditions are true.
(OUT)
(SET)
(RST)
Description
For an OUT instruction, you cannot use the same address twice.
OUT, SET, and RST instructions must be connected to the right bus and not in the middle of the
circuit.
1.
2.
3.
4.
OUTUse for external I/O (R), internal (M), and retentive (K) contacts. On or Off according
to status of the input condition.
SETUse for external I/O (R), internal (M), and retentive (K) contacts. The same address
can be used more than once. When the input conditions are true, the coil is turned On and
stays on unless turned off by a RST. The output is turned Off in the Stop mode.
RSTUse for external I/O (R), internal (M), and retentive (K) contacts. The same address
can be used more than once. When the input conditions are true, the coil is turned Off and
stays off unless turned on by a SET. The output is Off in the Stop mode.
When using retentive coils (K) in OUT, SET, or RST, the state is maintained. It will remain
On or Off even after placed in the Stop mode and power is turned off.
Example
Program Expression
R001.1
M000.4
(OUT)
R002.2
M000.5
(SET)
R002.3
M000.5
(RST)
Time Chart
R001.1
R002.2
M000.4
M000.5
R002.2
Chapter 6: Instructions
63
Instruction
Mnemonic
Reverse
Range
NOT
Word
Ladder
A
Description
1.
2.
The instruction cannot be connected directly to the busit must come after a contact or set of
contacts.
The instruction directly inverts the result of the input conditions before it. The instruction can
be used for verification of the circuit or in the test stage.
C
(OUT)
On
On
Off
Off
On
On
On
Off
On
Off
Off
On
Example
Program Expression
R000.0 R000.1
Time Chart
R015.0
(OUT)
R000.0
R000.1
R015.0
64
Instruction
Mnemonic
STR DIF
Edge Contact
Range
STR DFN
AND DIF
Bit
Byte
Word
AND DFN
OR DIF
OR DFN
Ladder
DIF
DFN
Description
1.
2.
3.
4.
The DIF and DFN instructions may be used more than once in the ladder program for any of
the bit addresses (R, L, M, K, F, and TC).
The DIF instruction is a contact which is On for the first scan after the signal has changed
from OffOn. The contact is Off for all other scans, when the signal has not changed from
Off or On.
The DFN instruction is a contact which is On for the first scan after the signal has changed
from OnOff. The contact is Off for all other scans, when the signal has not changed from
Off or On.
Both DIF and DFN can be used on the same bit address in a single scan.
Example
Program Expression
R001.4
R
R001.5
F
M002.4
(OUT)
Time Chart
R001.4
R001.5
1scan
1scan
1scan
M002.4
Contact M002.4 is On if contact R001.4 changes from OffOn or contact R001.5 changes from
OnOff.
Chapter 6: Instructions
Instruction
Mnemonic
Block Circuit
ANB
Range
Bit
ORB
Byte
Word
Ladder
R000.0
R000.2
R000.1
R000.3
A block
B block
R015.0
(OUT)
A block
R000.0
R000.2
R000.1
R000.3
R015.0
(OUT)
B block
Description
1.
2.
3.
Block in series:
Example
Program Expression (ANB)
R000.0
R000.2
R000.1
R000.3
A block
B block
R015.0
(OUT)
R0.2
R0.1
R0.3
R15.0
(OUT)
65
66
Instruction
Mnemonic
MCS
MCR
Range
Bit
Byte
Word
Ladder
(MCS)
condition
circuit block
(MCR)
Description
1.
2.
3.
MCS (Master Control Set)Marks the start of a conditional block of instructions. When the
input conditions to the MCS are false, the block of instructions that follow are executed as
false. Must be used with MCR.
MCR (Master Control Reset)Marks the end of a conditional block of instructions. Must be
used with MCS.
Up to seven MCS/MCR blocks can be nested.
MCS..
MCS..
Loop 1
Loop 2
MCS.. Loop 3
MCR
MCR
MCR
4.
If you use eight or more MCS/MCR nested blocks, a syntax error will occur.
Example
Program Expression
F0.15
Time Chart
R15.0
(SET)
R000.0
(MCS)
R00.0
R15.0
R15.0
(RST)
(MCR)
Chapter 6: Instructions
67
Timer
Range
TIM
On delay timer
Bit
SST
Byte
Word
Ladder
TIM
T CH =
SV =
In t seconds (t = SV time base) after the input is On, the output is On.
If the input is Off, the output is Off.
Valid channel numbers: Ch 0 through Ch 255 (256 channels)
Done contact: TC + channel number
SV set range: 0 to 65,535
SST
T CH =
SV =
For t seconds (t = SV time base) after input is On, the output is On. At
the end of t seconds, the output is Off.
If the input is Off, the output is Off.
Valid channel numbers: Ch 0 through Ch 255 (256 channels)
Done contact: TC + channel number
Description
1.
t sec
TIM
SST
2.
3.
4.
5.
68
Example
R000.0
TIM
T CH = 12
SV = 70
R000.0
0.7 sec
R000.1
SST
T CH = 200
SV = 70
TC012
M11.5
(OUT)
TC200
M22.5
(OUT)
TC12
R000.1
7 sec
TC200
Program Expression
Time Chart
Chapter 6: Instructions
69
Instruction
Mnemonic
Timer (I)
Range
UC
Up counter
Bit
DC
Down counter
Byte
Word
Example of UC with SV = 3.
UC
U CH =
SV =
R
condition
1
condition
3
TC0
(OUT)
Input
(condition 1)
Input
(condition 3)
3
Present
Value (PV)
Output
(TC)
2
0
Set Value
(SV)
Example of DC with SV = 3.
DC
D CH =
SV =
R
condition
2
condition
3
Input
(condition 2)
Reset
(condition 3)
Set Value
(SV)
Present
Value (PV)
Output
(TC)
Description
1.
2.
3.
4.
5.
The timer/counter channel can only be used once. It cannot be reused by other timer or
counter instructions (TIM, SST , UDC). A maximum of 256 channels (Ch 0 to
Ch 255) can be used.
The output done contact is displayed as TC + channel no. in the counter.
The elapsed value (PV) of the counter is maintained in case of a power failure and for
retentive purposes.
When SV is 0, the output contact (TC) turns On if one pulse of input occurs.
SV can be specified from 0 to 65,535.
CAUTION: Each input condition to the counter should be on its own line of the rung. They
should not share a common contact or be connected in any way.
70
Example
Program Expression
R000.0
R000.1
TC000
UC
U CH = 0
SV = 3
R
M0.0
(OUT)
Time Chart
R000.0
R000.1
counter
time value
Output TCO
0 0
Chapter 6: Instructions
71
Instruction
Mnemonic
Up/Down Counter
UDC
Range
Bit
Up/Down counter
Byte
Word
Ladder
UDC
U CH =
SV =
S
condition
1
condition
2
condition
3
U input
(condition 1)
D input
(condition 2)
Reset
(condition 3)
Present
Value (PV)
Output (TC)
Set Value
(SV)
Description
1.
2.
When the up count input (U input) turns On, the Present Value (PV) increases by 1. When the
down count input (D input) turns On, PV decreases by 1. When PV is greater than or equal to
the Set Value (SV) or is reduced to 0, the output done contact turns On.
In the following cases, the output done contact changes from On to Off:
3.
4.
5.
6.
7.
8.
72
Example
Program Expression
R000.0
R000.1
TC15
TC64
UDC
U CH = 64
SV = 5
S
Time Chart
U input (R0.0)
R
M1.0
(OUT)
5 4
Chapter 6: Instructions
73
Range
Bit
A = B (A is equal to B)
<>
>
>=
<=
<
Byte
Word
Ladder
A or B: Constant value 0 to 65,535 or a word address (R, L, M, K,
W, PV, SV, SR).
D is displayed when words are input. When using GPC5 to
program, change the mode to double (Ctrl+T) and then enter the
comparison command.
A
= B
A
<= B
D X
<> Y
Description
1.
2.
3.
The comparison functions as a contact, whose On/Off state is determined by the result of the
comparison of A and B. If the comparison is true, the state is On.
Each comparison instruction can be used with the STR, AND, and OR instructions (GPC will
automatically use the correct instruction).
Double mode comparison instructions can process up to 16 bits of data (0 to 65,535).
Example
Program Expression
M0.4
(OUT)
M21
= = K12
R000.0
R001.0
M21
<= 300
Time Chart
R0.0
R1.0
M21
<= K12
M0.5
(OUT)
M0.6
(OUT)
M21
K12
100
M0.4
M0.5
M0.6
100
400
74
Substitution Formula
LET
DLET
Range
Bit
Byte
Word
Ladder
LET
D=
S=
D: Destination
S: Source
Example: S = M0, and M0 is 123
D = R17, and R17 is 45
Before execution: M0 = 123, R17 = 45
After execution:
M0 = 123, R17 = 123
Description
Range: LET: 0 to 255
DLET: 0 to 65,535
1.
2.
3.
4.
Example
Program Expression
R000.2
R
LET
D = M0000
S = 123
LET
D = M0001
S = 100
R000.3
R
LET
D = R0003
S = M0000
Time Chart
R000.2
R000.3
M000.0
M000.1
R000.3
0000
0000
0000
0123
0100
0000
0123
0100
0123
Chapter 6: Instructions
Instruction
Mnemonic
Increment
Range
INC
Bit
DINC
Byte
INCB
Word
DINCB
Ladder
R
INC
D=
INCB
D=
Description
1.
2.
3.
4.
Example
Program Expression
R000.1
R
INC
D = M0005
INCB
D = M0008
Time Chart
Input (R0.1) M0005 (decimal)
M0008(BCD)
...... 0 0 0 0 0
.. 0 0 0 0 0
...... 0 0 0 0 1
.. 0 0 0 0 1
...... 0 0 0 1 0
.. 0 0 0 1 0
...... 0 1 0 0 1
.. 0 1 0 0 1
10
...... 0 1 0 1 0
.. 1 0 0 0 0
...... 0 1 0 1 1
.. 1 0 0 0 1
11
Max
$FFFF
$9999
75
76
Instruction
Mnemonic
Decrement
Range
DEC
Bit
DDEC
Byte
DECB
Word
DDECB
Ladder
R
DEC
D=
DECB
D=
D = D - 1: Decimal decrement
D = D - 1: BCD decrement
Description
1.
2.
3.
Example
Program Expression
R000.1
R
R000.2
R
LET
D = M10
S = $11
Time Chart
R0.1
R0.2
M10 (decimal)
M12 (BCD)
...... 0 0 0 1 0 0 0 1
...... 0 0 0 1 0 0 0 1
LET
D = M12
S = $11
...... 0 0 0 1 0 0 0 0
...... 0 0 0 1 0 0 0 0
...... 0 0 0 0 1 1 1 1
...... 0 0 0 0 1 0 0 1
DEC
D = M10
...... 0 0 0 0 1 1 1 0
...... 0 0 0 0 1 0 0 0
...... 0 0 0 0 0 0 0 0
...... 0 0 0 0 0 0 0 0
DECB
D = M12
Chapter 6: Instructions
77
Addition
Range
ADD
Bit
DADD
Byte
ADDB
Word
DADDB
Ladder
R
ADD
D =
S1 =
S2 =
ADDB
D =
S1 =
S2 =
D = S1 + S2
Decimal:
S1 = 21, and S2 = 22
Hexadecimal: S1 = $15 and S2 = $16
ADD Example:
Decimal: 21 + 22 = 43
ADDB Example:
BCD:
$15 + $16 = $31
Description
1.
2.
Add the data in the S1 and S2 addresses, then store the result in the D register.
When using ADD and ADDB, the calculation ranges are as follows:
3.
When using DADD and DADDB, the calculation ranges are as follows:
4.
5.
If the result exceeds the range of calculation, a carry occurs. The carry flag (F1.8) is changed
to On.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
78
Example
Program Expression
R0
R
ADD
D = W10
S1 = W0
S2 = W2
DADD
D = W11
S1 = W0
S2 = W3
ADDB
D = W12
S1 = W0
S2 = W2
Operation Results
Initial conditions:
W0 = 00017 = $0011
W1 = 00001 = $0001
W2 = 00025 = $0019
W3 = 00250 = $00FA
Operation results: W10 = 00042 = $002A
W11 = 00267 = $010B
W12 = 00048 = $0030
Chapter 6: Instructions
79
Instruction
Mnemonic
Subtraction
Range
SUB
DSUB
SUBB
Byte
Word
DSUBB
Ladder
R
SUB
D =
S1 =
S2 =
SUBB
D =
S1 =
S2 =
D = S1 - S2
Decimal:
S1 = 34 and S2 = 19
Hexadecimal: S1 = $22 and S2 = $13
SUB Example:
Decimal:
34 - 19 = 15
SUBB Example:
BCD:
Description
1.
2.
Subtract the data in S2 from S1, then store the result in the D register.
When using SUB and SUBB, the calculation ranges are as follows:
3.
When using DSUB and DSUBB, the calculation ranges are as follows:
4.
5.
If the result exceeds the range of calculation, a carry occurs. The carry flag (F1.8) is changed
to On.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0
R
SUB
D = W10
S1 = W0
S2 = W2
DSUB
D = W11
S1 = W1
S2 = W3
SUBB
D = W12
S1 = W0
S2 = W2
Operation Results
Initial conditions:
W0 = 00016 = $0010
W1 = 00520 = $0208
W2 = 00007 = $0007
W3 = 00384 = $0180
Operation results: W10 = 00009 = $0009
W11 = 00136 = $0088
W12 = 00003 = $0003
80
Instruction
Mnemonic
Multiplication
MUL
Range
DMUL
MULB
DMULB
Bit
Byte
Word
Ladder
R
MUL
D =
S1 =
S2 =
MULB
D =
S1 =
S2 =
D = S1 S2
Decimal:
S1 = 3 and S2 = 7
Hexadecimal: S1 = $03 and S2 = $07
MUL Example:
Decimal:
3 7 = 21
MULB Example:
BCD:
Description
1.
2.
Multiply the data in the S1 and S2 addresses, then store the result in the D register.
When using MUL and MULB, the calculation ranges are as follows:
3.
When using DMUL and DMULB, the calculation ranges are as follows:
4.
5.
If the result exceeds the range of calculation, a carry occurs. The carry flag (F1.8) is changed
to On. The high word of the result that exceeds the range of D is automatically stored in
SR20.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0
R
MUL
D = W10
S1 = W0
S2 = W2
DMUL
D = W11
S1 = W1
S2 = W3
MULB
D = W12
S1 = W0
S2 = W2
Operation Results
Initial conditions:
W0 = 00002 = $0002
W1 = 00030 = $001D
W2 = 00006 = $0006
W3 = 00500 = $01E4
Operation results: W10 = 00012 = $000C
W11 = 15000 = $3A98
W12 = 00018 = $0012
Chapter 6: Instructions
81
Instruction
Mnemonic
Division
Range
DIV
Bit
DDIV
Byte
DIVB
Word
DDIVB
Ladder
R
DIV
D =
S1 =
S2 =
DIVB
D =
S1 =
S2 =
D = S1 S2
Decimal:
Hexadecimal:
DIV Example:
Decimal:
DIVB Example:
BCD:
S1 = 18 and S2 = 3
S1 = $12 and S2 = $03
18 3 = 6
Description
1.
2.
Divide the data in S1 by S2, then store the result in the D register.
When using DIV and DIVB, the calculation ranges are as follows:
3.
When using DDIV and DDIVB, the calculation ranges are as follows:
4.
5.
The quotient is stored in the D register, and the remainder in special register SR22.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0
R
DIV
D = W10
S1 = W0
S2 = W2
DDIV
D = W11
S1 = W1
S2 = W3
DIVB
D = W12
S1 = W0
S2 = W2
Operation Results
Initial conditions:
W0 = 00024 = $0018
W1 = 01024 = $0400
W2 = 00004 = $0004
W3 = 00128 = $0080
Operation results: W10 = 00006 = $0006
W11 = 00008 = $0008
W12 = 00004 = $0004
82
Instruction
Command
ADC
DADC
ADCB
DADCB
Range
Bit
Byte
Word
Ladder
R
ADC
D =
S1 =
S2 =
ADCB
D =
S1 =
S2 =
D = S1 + S2 + carry
Decimal:
S1 = 21, and S2 = 22
Hexadecimal: S1 = $15 and S2 = $16
Carry Flag:
F1.8 = On
ADC Example:
Decimal:
21 + 22 + 1 = 44
ADCB Example:
BCD:
$15 + $16 + $1 = $32
Description
1.
2.
Add the data in the S1 and S2 addresses. If the carry flag F1.8 is On, add 1, otherwise add 0.
Then store the result in the D register.
When using ADC and ADCB, the calculation ranges are as follows:
3.
When using DADD and DADDB, the calculation ranges are as follows:
4.
5.
If the result exceeds the range of calculation, a carry occurs. The carry flag (F1.8) is changed
to On.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Chapter 6: Instructions
83
Example
Program Expression
Initial conditions:
R0.0
R
R0.0
R
SC
ADC
D = W10
S1 = W0
S2 = W1
R0.0
R
R0.0
R
Operation Results
RC
ADCB
D = W11
S1 = W0
S2 = W1
W0 = 00017 = $0011
W1 = 00025 = $0019
Operation results: W10 = 00017 + 00025 +1 = 00043
W11 = $0011 + $0019 + 0 = $0030
84
Instruction
Command
SBC
DSBC
SBCB
DSBCB
Range
Bit
Byte
Word
Ladder
R
SBC
D =
S1 =
S2 =
SBCB
D =
S1 =
S2 =
D = S1 - S2 - carry
Decimal:
Hexadecimal:
Carry Flag:
SBC Example:
Decimal:
SBCB Example:
BCD:
S1 = 34 and S2 = 19
S1 = $22 and S2 = $13
F1.8 = On
34 - 19 - 1 = 14
$22 - $13 - $01 = $08
Description
1.
2.
Subtract the data in S2 from S1. If the carry flag F1.8 is On, subtract 1. Then store the result
in the D register.
When using SBC and SBCB, the calculation ranges are as follows:
3.
When using DSBC and DSBCB, the calculation ranges are as follows:
4.
5.
If the result exceeds the range of calculation, a carry occurs. The carry flag (F1.8) is changed
to On.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Chapter 6: Instructions
Example
Program Expression
Initial conditions:
R0.0
R
R0.0
R
SC
SBC
D = W10
S1 = W0
S2 = W1
R0.0
R
R0.0
R
Operation Results
RC
SBCB
D = W11
S1 = W0
S2 = W1
W0 = 00016 = $0010
W1 = 00002 = $0002
Operation results: W10 = 00016 - 00002 - 1 = 00013
W11 = $0010 - $0002 - 0 = $0008
85
86
Instruction
Mnemonic
Range
ABS
Bit
DABS
Byte
NEG
Word
DNEG
NOT
DNOT
Ladder
R
ABS
D=
NEG
D=
NOT
D=
Description
1.
For the ABS (absolute value) instruction, if the highest bit (MSB) is 1, take the 2s
complement. If the highest bit is 0, leave it as it is.
2.
For example, the absolute value of $9A52 (=1001 1010 0101 0010) is $65AE (=0110
0101 1010 1110). The absolute value of $7A52 (=0111 1010 0101 0010) is $7A52.
The NEG (2s complement) instruction is expressed as the 1s complement + 1.
3.
For example, DNEG of $7A52 (=0111 1010 0101 0010) is $85AE (=1000 0101 1010
1110)
The NOT (1s complement) instruction is performed by reversing each bit.
4.
For example, DNOT of $7A52 (=0111 1010 0101 0010) is $85AD (=1000 0101 1010
1101)
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0 0
R
DABS
D = W0
DABS
D = W1
DNEG
D = W2
DNOT
D = W3
Operation Results
Initial conditions:
W0 = $9A52
W1 = $7A52
W2 = $7A52
W3 = $7A52
Operation results: W0 = $65AE
W1 = $7A52
W2 = $85AE
W3 = $85AD
Chapter 6: Instructions
87
WAND
Range
Bit
DAND
Byte
Word
Ladder
Process each bit of S1 and S2 in bit AND operation and store the
result in D.
WAND
D =
S1 =
S2 =
S1
0
0
1
1
DAND
D =
S1 =
S2 =
S2
0
1
0
1
D
0
0
0
1
Description
1.
Process the values of the S1 and S2 bits (byte/word) in bit AND operation and store the result
in D.
For example: S1 = $00FF (hex)
S2 = $3333 (hex)
D = $0033 (hex)
S1
2.
S2
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
AND
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
DAND
D = W2
S1 = W0
S2 = W1
Operation Results
Initial conditions:
Operation results:
W0 = $00FF
W1 = $3333
W2 = $XXXX
W0 = $00FF
W1 = $3333
W2 = $0033
88
Instruction
Mnemonic
Bit OR Operation
WOR
Range
Bit
Bit OR operation
DOR
Byte
Word
Ladder
Process S1 and S2 in bit OR operation and store the result in D.
WOR
D =
S1 =
S2 =
S1
0
0
1
1
DOR
D =
S1 =
S2 =
S2
0
1
0
1
D
0
1
1
1
Description
1.
2.
S2
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
OR
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
DOR
D = W2
S1 = W0
S2 = W1
Operation Results
Initial conditions:
Operation results:
W0 = $00FF
W1 = $3333
W2 = $XXXX
W0 = $00FF
W1 = $3333
W2 = $33FF
Chapter 6: Instructions
89
Instruction
Mnemonic
XOR
Range
Bit
DXOR
Byte
Word
Ladder
Process S1 and S2 in bit exclusive OR operation and store the
result in D.
XOR
D =
S1 =
S2 =
S1
0
0
1
1
DXOR
D =
S1 =
S2 =
S2
0
1
0
1
D
0
1
1
0
Description
1.
Process S1 and S2 (byte/word) by bit exclusive OR operation and store the result
in D.
For example: S1 = $00FF (hex)
S2 = $3333 (hex)
D = $33CC (hex)
S1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
XOR (Exclusive OR)
2.
S2
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
DXOR
D = W2
S1 = W0
S2 = W1
Operation Results
Initial conditions:
Operation results:
W0 = $00FF
W1 = $3333
W2 = $XXXX
W0 = $00FF
W1 = $3333
W2 = $33CC
90
Instruction
Mnemonic
XNR
Range
Bit
DXNR
Byte
Word
Ladder
R
XNR
D =
S1 =
S2 =
DXNR
D =
S1 =
S2 =
S2
0
1
0
1
D
1
0
0
1
Description
1.
2.
Process S1 and S2 (word/double word) by bit exclusive OR NOT operation and store the
result in D.
For example: S1 = $00FF (hex)
S2 = $3333 (hex)
D = $CC33 (hex)
S1
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
S2
1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
DXNR
D = W2
S1 = W0
S2 = W1
Operation Results
Initial conditions:
Operation results:
W0 = $00FF
W1 = $3333
W2 = $XXXX
W0 = $00FF
W1 = $3333
W2 = $CC33
Chapter 6: Instructions
91
RLC
DRLC
Range
Bit
Byte
Word
Ladder
MSB
carry
(F1.8)
D = Register address
N = Number of bits to rotate
RLC
D=
N=
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
p o n m l k j
LSB
i h g f e d c b a
p
Description
1.
Order:
2.
3.
The D register is either a byte or a word. For RLC (byte), N = 0 to 7. For DRLC (word), N =
0 to 15.
4.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
RLC
D = M0000
N =1
DRLC
D = M0001
N =2
Operation Results
Initial condition:
Operation results:
M0000 = $0F0F
M0001 = $0F0F
M0000 = $0F1E
M0001 = $3C3C
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0
0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0
92
Instruction
Mnemonic
RRC
DRRC
Range
Bit
Byte
Word
Ladder
D = Register address
N = Number of bits to rotate
RRC
D=
N=
MSB
LSB
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
p o n m l k j
i h g f e d c b a
carry
(F1.8)
Description
1.
Order:
2.
3.
4.
Example
Program Expression
R0.0
R
RRC
D = M0000
N=1
DRRC
D = M0001
N=2
Operation Results
Initial condition:
Operation results:
M0000 = $0F0F
M0001 = $0F0F
M0000 = $0F87
M0001 = $C3C3
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1
1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1
Chapter 6: Instructions
93
Instruction
Mnemonic
ROL
DROL
Range
Bit
Byte
Word
Ladder
carry
(F1.8)
D = Register address
N = Number of bits to rotate
ROL
D=
N=
MSB
C
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
p o n m l k j
LSB
i h g f e d c b a
C
Description
1.
Order:
2.
3.
4.
Shift N bits to the left (from low-order bit to high-order bit) including the carry bit.
The MSB (most significant bit) moves to the carry bit (F1.8).
Input F1.8 (carry bit) in the LSB (least significant bit).
This instruction is different from the RLC instruction because it sends the MSB to the carry
bit and the carry bit moves to the LSB. The input to the LSB can be changed by setting or
clearing the carry bit.
The D register is either a byte or a word. For ROL (word), N = 0 to 7. For DROL (word), N =
0 to 15.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
94
Example
Program Expression
R0.0
R
R0.1
R
F1.8
(OUT)
ROL
D =MO
N=1
Operation Results
R0.0
R0.1
M0 $00 $01
(word)
$03
$06 $0D
C 0
1 1 0 1
1 C
0 1 1 0
0 C
0 0 1 1
1 C
0 0 0 1
1 C
0 0 0 0 0
95
Chapter 6: Instructions
Instruction
Mnemonic
ROR
Range
Bit
DROR
Byte
Word
Ladder
D = Register address
N = Number of bits to rotate
ROR
D=
N=
MSB
LSB
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
p o n m l k j
i h g f e d c b a
carry
(F1.8)
Description
1.
Order:
2.
3.
4.
Shift N bits to the right (from high-order bit to low-order bit) including the carry bit.
Input the carry bit (F1.8) to the MSB (most significant bit).
The LSB (least significant bit) moves to the carry bit (F1.8).
This instruction is different from the RRC instruction because it sends the LSB to the carry
bit, and the carry bit shifts to the MSB. The input to the MSB can be changed by setting or
clearing the carry bit.
The D register is either a byte or a word. For ROR (byte), N = 0 to 7. For DROR (word), N =
0 to 15.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
Operation Results
F1.8
(OUT)
R0.0
R0.1
R
ROR
D = M0
N=2
R0.1
$4000
$0000
$1400
$5000
MO
C
0 0 0 0 1 0 1
1 0 1 0 0 0
0 1 0 1
0 0 0 0
MSB
LSB
0 C
96
Instruction
Mnemonic
Shift to Left
SHL
Range
DSHL
Bit
Byte
Word
Ladder
SHL
D=
N=
carry
(F1.8)
D = Register address
N = Number of bits to rotate
MSB 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
p o n m l k j i h g f e d c b a
LSB
0
Description
1.
Order:
2.
3.
4.
Shift N bits to the left (from low-order bit to high-order bit) including the carry bit.
The MSB (most significant bit) moves to the carry bit (F1.8).
97
Chapter 6: Instructions
Example
Program Expression
R0.0
R
DLET
D = MO
S = $FFFF
R0.1
R
DSHL
D = M0
N=2
Operation Results
R0.0
R0.1
$FFF0
$FFFF
$FFFC
M0
1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
98
Instruction
Mnemonic
Shift to Right
SHR
Range
DSHR
Bit
Byte
Word
Ladder
SHR
D=
N=
MSB
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
po n m l
D = Register address
N = Number of bits to rotate
k j i h g f e d c b a
LSB
C
carry
(F1.8)
Description
1.
Order:
2.
3.
4.
Example
Program Expression
R0.0
R
DLET
D = M0
S = $FFFF
R0.1
R
DSHR
D = M0
N=1
Time Chart
R0.0
R0.1
$FFFF
$7FFF $3FFF
M0
0
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Chapter 6: Instructions
99
BCD Conversion,
Binary Conversion
BCD
DBCD
BIN
Range
Bit
Byte
Word
DBIN
Ladder
R
BCD
D =
S =
BCD: Convert the S value from binary into BCD and store in D.
BIN
D =
S =
BIN: Convert the S value from BCD into binary and store in D.
Description
1.
2.
3.
BCD: Convert S, which is expressed in binary (byte /word), into BCD and store in D. The
range is as follows:
Byte conversion:
S = 0 to $63 (hex) = 99 (decimal)
D = 0 to $99 (hex) = 153 (decimal)
Word conversion:
S = 0 to $270F (hex) = 9999 (decimal)
D = 0 to $9999 (hex) = 39321 (decimal)
BIN: Convert S, which is expressed in BCD (byte /word), into binary (binary code) and store
in D. The range is as follows:
Byte conversion:
S = 0 to $99 (hex) = 153 (decimal)
D = 0 to $63 (hex) = 99 (decimal)
Word conversion:
S = 0 to $9999 (hex) = 39321 (decimal)
D = 0 to $270F = 9999 (decimal)
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
DBCD
D = W2
S = W0
DBIN
D = W3
N = W1
Operation Results
Initial conditions:
Operation results:
100
Instruction
Mnemonic
Data Exchange
Range
XCHG
DXCHG
Word
Ladder
R
XCHG
D1 =
D2 =
DXCHG
D1 =
D2 =
D1 ..
0 1 0 1
D1 .. 0 0 1 1
D2 ... 0 0 1 1
D2 .. 0 1 0 1
Description
1.
2.
Example
Program Expression
R0.0
R
XCHG
D1 = W0
D2 = W1
DXCHG
D1 = W10
D1 = W11
Operation Results
Initial conditions:
Operation results:
W0 = $1234
W1 = $5678
W10 = $5678
W11 = $1234
W0 = $1278
W1 = $5634
W10 = $1234
W11 = $5678
Chapter 6: Instructions
101
Instruction
Mnemonic
7-Segment Decoder
Range
SEG
Ladder
Convert the value in the low-order 4 bits of address S (0 to 15) into
the proper format for display by a 7-segment display and store in
D. In the converted format, if a bit is 1, the segment is illuminated
(= active high output).
SEG
D=
S=
Description
1.
Convert the value in the low-order 4 bits of address S into SEG display format, and store it in
D. The high-order 8 bits of D do not change. The 8th bit of the D register, used with many 7segment display cells as the decimal point, is not affected by this instruction.
For example: S = $XXX5 (hex)
D = $XX6D (hex)
=5
a
f
S ... 0 0 0 0 0 1 0 1
c
d
2.
D ... 0 1 1 0 1 1 0 1
g f e d c b a
dp
c
d
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
SEG
D = W1
S = W0
Operation Results
Initial conditions:
W0 = $8765 (hex)
W1 = $1234 (hex)
Operation results:
W0 = $8765 (hex)
W1 = $126D (hex)
The 8th bit of W1 does not change.
102
Instruction
Mnemonic
Range
ENCO
Bit
DECO
Byte
Word
Ladder
R
ENCO
D=
S=
DECO
D =
S =
Description
1.
2.
ENCO: Set D to the value of the bit number of highest bit in S that is On (0 to 16). If there are
two or more On bits in S, use the location of the highest bit. The high-order 8 bits of D do not
change.
DECO: Set the bit location (0 to 15) in D pointed to by the value in the low 4 bits of S. All
other bits in D are reset to 0.
DECO
ENCO
15..8 7 6 5 4 3 2 1 0
S .....
x x x x 0 1 0 1 =5
S 0..0 0 1 1 1 0 0 0 0
invar
iable
0 0 0 0 0 1 1 1
6+1=7
D 0..0 0 0 1 0 0 0 0 0
15..8 7 6 5 4 3 2 1 0
ENCO
$0000$00
$0001$01
$0002$02
$0004$03
$0008$04
$0010$05
$0020$06
$0040$07
$0080$08
$0100$09
$0200$0A
$0400$0B
$0800$0C
$1000$0D
$2000$0E
$4000$0F
$8000$10
DECO
$0$0001
$1$0002
$2$0004
$3$0008
$4$0010
$5$0020
$6$0040
$7$0080
$8$0100
$9$0200
$A$0400
$B$0800
$C$1000
$D$2000
$E$4000
$F$8000
Chapter 6: Instructions
Example
Program Expression
R0.0
R
ENCO
D = W2
S = W0
DECO
D = W3
S = W1
Operation Results
Initial conditions:
W0 = $0070 (hex)
W1 = $1235 (hex)
W2 = $5678 (hex)
W3 = $9ABC (hex)
Operation results:
W0 = $0070 (hex)
W1 = $1235 (hex)
W2 = $5607 (hex)
W3 = $0020 (hex)
The high-order 8 bits of W2 do not change.
103
104
Instruction
Mnemonic
DIS
UNI
Range
Bit
Byte
Word
Ladder
DIS: Separate Sr into Nd+1 units of 4 bits each, and store in the
low 4 bits of words starting at D.
UNI: Combine the low 4 bits of Nd+1 words starting at Sr, and
store in D.
DIS
D =
Nd =
Sr =
UNI
D =
Sr =
Nd =
Description
1.
2.
DIS: Separate the word value in register Sr into Nd+1 units of 4 bits each, and store these 4
bit units in sequence into registers starting at D. The 12 remaining high-order bits in each
register become 0.
UNI: Combine the low-order 4 bit units from Nd+1 registers starting at Sr, and store in D.
DIS
UNI
Sr $ 7 4 1 1 1 0 0 1 0 1
Nd+1
If Nd=3
D
D+1
D+2
D+3
$0000
$0000
$0000
$0000
0
1
0
0
1
1
1
1
0
1
0
1
1
0
0 4
1 7
Nd+1
If Nd=3
3.
4.
Sr
Sr+1
Sr+2
Sr+3
$
$
$
$
0
1
1
0
1
1
0
1
0
1
1
0
1
1
0
0
$ 4 1 1 1 1 0 1 0 1
Nd + 1 represents the number of 4-bit segments to dissemble or unify. The range for Nd is
Nd = 0 to 3.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Chapter 6: Instructions
105
Example
Program Expression
R0.0
R
DIS
D = W0
Nd = 3
Sr = M0
UNI
D = M10
Sr = W10
Nd = 3
Operation Results
Initial conditions:
M0 = $74E5 (hex)
W0 = $1111 (hex)
W1 = $2222 (hex)
W2 = $3333 (hex)
W3 = $4444 (hex)
M10 = $ABCD (hex)
W0 = $0005 (hex)
W1 = $000E (hex)
W2 = $0004 (hex)
W3 = $0007 (hex)
M10 = $4AF3 (hex)
106
Range
BSET
Bit
BRST
Byte
BNOT
Word
BTST
Ladder
R
BSET
D=
N=
BNOT
D=
N=
BRST
D=
N=
BTST
D=
N=
Description
1.
2.
3.
4.
5.
......
if N=5
BRST
......
if N=3
0 1 1 1 1 1 0 0
BNOT
0 1 0 1 0 1 0 0
0
BTST
......
0 1 1 1 0 1 0 0
if N=4
...... 0 1 1 0 0 1 0 0
......
if N=6
0 1 1 1 0 1 0 0
F1.8
Chapter 6: Instructions
Example
Program Expression
R0.0
R
BSET
D = M0
N=5
BRST
D = M1
N=3
BNOT
D = M2
N=4
BTST
D = M3
N=6
Operation Results
Initial conditions:
107
108
Instruction
Mnemonic
SUM
Range
Bit
Byte
Word
Ladder
SUM
D=
S=
Description
1.
2.
Count the number of On (= 1) bits in the S register and store the result in the D register.
S 1 1 1 0 0 1 1 1 1 0 1 1 0 0 1 1
Number of On(=1) is 11
D 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1
D=$000B=11 (Decimal)
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
SUM
D = W0
S = M0
Operation Results
Initial conditions:
Chapter 6: Instructions
109
Instruction
Mnemonic
Range
Bit
SC
RC
Byte
CC
Word
Ladder
SC
R
RC
R
CC
R
Description
1.
2.
The carry bit (F1.8) is a special internal flag that holds the result of various types of
mathematical and bit shift operations. When rotating, shifting, adding, or subtracting with a
carry, the operation depends on the state of the carry flag, as well as changes the state of the
carry flag. The above instructions are useful for setting the state of the carry flag as needed for
these types of operations.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
SC
R0.1
R
RC
R0.2
R
CC
Operation Results
R0.0
R0.1
R0.2
F1.8
110
LDR
DLDR
Range
Bit
Byte
Word
Ladder
R
LDR
D =
Sr =
DLDR
D =
Sr =
Description
1.
2.
3.
Register
(Absolute
Address)
W100 (612)
W101 (613)
W102 (614)
:
:
W198 (710)
W199 (711)
Register
Value
$22
$10
$33
:
:
$05
$85
111
Chapter 6: Instructions
Example
Program Expression
R0.0
R
INC
D = W0
LDR
D = R15
Sr = W0
Operation Results
Initial conditions:
W0 = 611
R0.0 (bit)
WO
R2 (word)
process output
611
data of
W100
data of
W101
data of
W102
data of
W198
data of
W199
612
613
614
710
711
$22
$10
$33
$05
$85
112
Instruction
Mnemonic
STO
Range
Bit
DSTO
Byte
Word
Ladder
R
STO
Sr =
D =
DSTO
Sr =
D =
Store the data contained in the Sr register into the register pointed
to by the absolute address contained in register D.
R0 word absolute address: 0 (decimal)
M0 word absolute address: 192 (decimal)
W0 word absolute address: 512 (decimal)
Description
1.
2.
3.
This instruction is useful in storing data patterns from a single input register to a sequential
table of registers in memory. For example, if the process measurements (D0 to D99) from an
input module located at address R001 needed to be stored in register addresses W100 through
W199. The STO instruction can be used to load the data from the source register R001 to the
absolute addresses of W100 to W199 (absolute addresses 612 to 711).
In the example below, register W0 is used as the D (destination) register, which contains the
absolute address of the locations to store the process measurements. Initially, W0 contains
612, which is the absolute memory address of register W100. As W0 is incremented, it
successively points to the next higher W register to store data.
See Chapter 5, Absolute Address Designation, for a complete table of absolute addresses.
Process
Measurement
D0
D1
D2
:
:
D98
D99
Register
(Absolute
Address)
W100 (612)
W101 (613)
W102 (614)
:
:
W198 (710)
W199 (711)
Register
Value
$34
$25
$88
:
:
$17
$09
113
Chapter 6: Instructions
Example
Program Expression
R0.0
R
INC
D = W0
STO
Sr = R1
D = W0
Operation Results
Initial conditions:
W0 = 611
R0.0 (bit)
R1
(word process
measurement)
W0 611
$34
$25
$88
$17
$09
612
613
614
710
711
Store in
W100
Store in
W101
Store in
W102
Store in
W198
Store in
W199
114
Instruction
Mnemonic
MOV
FMOV
Range
Bit
Byte
Word
Ladder
R
MOV
D =
Sr =
Ns =
FMOV
D =
Ns =
V =
Description
1.
2.
MOV: Copy a total of Ns registers from registers starting at Sr word into registers starting at
D. This instruction is used for mass duplication of blocks of registers.
FMOV: Copy the constant number V, Ns times into registers starting at D. This instruction is
useful for initializing the internal and external memory of certain areas when initializing a
program.
Sr
...... 1 0 1 0 1 0 1 0
V value
...... 1 0 1 0 1 0 1 0
Sr+1
Sr+2
...... 0 0 0 0 1 1 1 1
...... 1 1 1 1 0 0 0 0
...... 1 0 1 0 1 0 1 0
...... 1 0 1 0 1 0 1 0
D+1
D+2
...... 0 0 0 0 1 1 1 1
...... 1 1 1 1 0 0 0 0
D+1
D+2
D+3
...... 1 0 1 0 1 0 1 0
...... 1 0 1 0 1 0 1 0
...... 1 0 1 0 1 0 1 0
MOV
3.
Ns=3
Ns=4
FMOV
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Chapter 6: Instructions
115
Example
Program Expression
R0.0
R
MOV
D = W0
Sr = M0
Ns = 3
FMOV
D = K0
Ns = 4
V = $55AA
Operation Results
Initial conditions:
M0 = $12AA (hex)
M1 = $340F (hex)
M2 = $56F0 (hex)
K0 = $XXXX (hex)
K1 = $XXXX (hex)
Operation results: M0 = $12AA (hex)
M1 = $340F (hex)
M2 = $56F0 (hex)
K0 = $55AA (hex)
K1 = $55AA (hex)
W0 = $XXXX (hex)
W1 = $XXXX (hex)
W2 = $XXXX (hex)
K2 = $XXXX (hex)
K3 = $XXXX (hex)
W0 = $12AA (hex)
W1 = $340F (hex)
W2 = $56F0 (hex)
K2 = $55AA (hex)
K3 = $55AA (hex)
116
Instruction
Mnemonic
Range
BMOV
Bit
BFMV
Byte
Word
Ladder
R
BMOV
Db =
Sb =
Ns =
BFMV
Db =
Ns =
V =
Description
1.
2.
BMOV: Copy a block of Ns bits starting at bit address Sb to bit address D. This instruction is
useful for moving large blocks of bits at one time, or for copying sections of bits within a
word without copying the entire word.
BFMV: Fill a block of Ns bits starting at bit address D with the value of V (0 or 1). This
instruction is useful for initializing a set of bits to 0 or 1 at the start of a program or process.
Sb ......
BMOV
If Ns=4
Db ......
3.
If V=1
0 1 1 1 0 1 0 0
BFMV
Db ......
If Ns=5
0 1 1 1 1 1 0 0
0 1 0 1 0 1 0 0
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
BMOV
Db = R2.3
Sr = R2.1
Ns = 4
BFMV
Db = R3.2
Ns = 5
V =1
Operation Results
R2 before
operation
0 0 1 1 1 1 0 0 0 1 1 1 0 1 0 0
R2 after
operation
0 0 1 1 1 1 0 0 0 1 0 1 0 1 0 0
R3 before
operation
0 0 1 1 1 1 0 0 0 1 0 1 0 1 0 0
R3 after
operation
0 0 1 1 1 1 0 0 0 1 1 1 1 1 0 0
Chapter 6: Instructions
117
FOR-NEXT Loop
Range
FOR
Bit
DFOR
Byte
NEXT
Word
Ladder
FOR
D =
NEXT
Description
1.
2.
3.
4.
5.
6.
The FOR/NEXT instructions are used to perform a block of instructions inside a ladder
program repeatedly. The parameter D of the FOR instruction is a value indicating how many
times the block of instructions is to be performed.
Branch instructions such as JMP and CALL can be made inside the FOR/NEXT loop.
The number of loops to execute (D value) can be changed inside of the FOR/NEXT loop. This
can be used to dynamically increase or decrease the number of loops performed while
processing the loops.
If the D register is 0 before the FOR instruction, the instructions between the FOR and NEXT
instructions will NOT be executed. Instead, the program will jump directly to the instruction
following the NEXT.
As the FOR/NEXT loop occurs within a single program scan, a large value of D will lengthen
the scan time of the program considerably.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
118
Example
Program Expression
R0.0
R
FOR
D = W0
INC
D = M0
NEXT
Operation Results
Initial condition:
W0 = 10
M0 = 0
Operation results: W0 = 0
M0 = 10
When the R0.0 contact changes from OffOn, execution
of the FOR/NEXT loop occurs. At the FOR instruction,
the value of W0 is evaluated. If W0 is not 0, then the
instructions between the FOR and NEXT (INC D = M0)
is performed. At the NEXT instruction, 1 is subtracted
from the value of W0, and execution returns to the FOR
instruction. This is repeated 10 times, until the value of
W0 is 0. When this occurs, execution goes directly the
instruction following the NEXT instruction.
Chapter 6: Instructions
119
Instruction
Mnemonic
Jump by Pointer
Range
JMP
Bit
LBL
Byte
Word
Ladder
R
JMP
L =
LBL
L =
Description
1.
2.
3.
4.
5.
This instruction is used to conditionally perform a set of instructions in the program. When
the input condition to the JMP instruction is true, execution will jump over the following
instructions, directly to the corresponding LBL label. When the input condition is false, the
instructions following the JMP will be executed normally, and no jump occurs.
The range of L is 0 to 31, allowing 32 jumps to be used.
The given L label may only be used once in a program. It may not be duplicated.
For a given JMP with parameter L, there MUST be a corresponding LBL with the same L
value. Also, the LBL instruction must come after the JMP instruction in the program. If either
of these two conditions is not satisfied, an error will occur preventing execution of the
program.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression
R0.0
R
JMP
L =1
R0.1
R
JMP
L =3
LBL
L =3
LBL
L =1
Operation Results
120
Instruction
Mnemonic
Jump
Range
JMPS
Bit
JMPE
Byte
Word
Ladder
R
JMPS
JMPE
Description
1.
2.
3.
4.
5.
The JMPS and JMPE instruction function identically to the JMP and LBL instructions, but do
not require the use of a label. Additionally, the JMPS/JMPE pair may be used more than once
in a program.
This instruction is used to conditionally perform a set of instructions in the program. When
the input condition to the JMPS instruction is true, execution will jump over the following
instructions, directly to the corresponding JMPE. When the input condition is false, the
instructions following the JMPS will be executed normally, and no jump occurs.
For the JMPS instruction, there MUST be a corresponding JMPE. Also, the JMPE instruction
must come after the JMPS instruction in the program. If either of these two conditions is not
satisfied, an error will occur preventing execution of the program.
The JMPS/JMPE instructions may NOT be nestedafter each JMPS instruction, there must
be a JMPE instruction before the next JMPS instruction may be programmed.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Chapter 6: Instructions
121
Example
Program Expression
R0.0
R
JMPS
JMPE
R0.1
R
JMPS
JMPE
Operation Results
By executing a JMPS:
122
Instruction
Mnemonic
Call Subroutine
Range
CALL
Bit
SBR
Byte
RET
Word
Ladder
CALL
Sb =
SBR
Sb =
RET
Description
1.
The subroutine instructions are used when a block of instructions needs to be called more than
once, or called with different values, from the main program.
2.
The subroutine to be called is specified by the Sb parameter in the CALL and SBR
instructions. The CALL instruction causes execution to jump to the specified SBR instruction.
After executing the instructions between SBR and RET, program execution is returned to the
instruction following the CALL instruction that called the subroutine.
3.
The subroutine defined by the SBR and RET instructions must come after the associated
CALL instruction. All subroutines must be defined and programmed at the end of the control
program. A total of 64 subroutines are available (Sb = 0 to 31).
4.
The same subroutine (SBR Sb) can be called by multiple CALL instructions. However, each
subroutine number may only be used once by an SBR instruction.
5.
This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Chapter 6: Instructions
123
Example
Program Expression
R0.0
R
CALL
Sb = 3
R0.1
R
CALL
Sb = 3
SBR
Sb = 3
RET
Operation Results
When contact R0.0 and/or R0.1 turns On, the CALL Sb =
3 instruction is executed and the instructions between
SBR Sb = 3 and RET are executed. After executing this
subroutine, the program returns to the next instruction
after the CALL.
124
Instruction
Mnemonic
WAT
Range
Bit
Byte
Word
Ladder
WAT
Description
1.
2.
This instruction clears the watchdog timer within the CPU module to prevent the program
from stopping even if the scan time exceeds the maximum watchdog time. The default
watchdog time is 3 seconds.
Under normal operation, the PLC executes the following process:
3.
4.
Example
Program Expression
M0.0
WAT
Operation Results
In certain applications, the user program may contain
loops which cause lengthy scan times. In the example,
turning on M0.0 prevents the PLC from stopping when
the watchdog time (maximum of 3 sec) is exceeded. For
normal PLC control applications, this instruction should
not be used.
Chapter 6: Instructions
Instruction
Mnemonic
END
Range
Bit
Byte
Word
Ladder
END
Description
1.
2.
125
126
This chapter provides information on testing and troubleshooting the D50 PLC.
This chapter discusses:
127
128
Test Precautions
When checking the system:
CAUTION: Always turn off the power whenever you install or remove a module.
1.
Check the module more than one time before exchanging the part.
2.
Include a complete description of the symptoms when you return a defective module for
repair.
3.
When you suspect that a contact may be defective, it might only need cleaning. Clean the
contact using a clean cotton cloth and alcohol. Then retest the module.
4.
System Checks
Before installing the I/O wiring of the PLC and supplying power, check the following items.
Item
What to Check
The connection of the power Check that the wiring is secure and intact.
cable and the I/O expansion
Check that the terminal screws are tightly fastened.
cables.
Check that I/O module is firmly fixed.
Check that the power cable connection is secure.
Check that the cable size is correct.
Grounding
Power source
129
130
Testing Procedures
When the PLC has been installed and wired, begin testing in the following order.
Supply Power
Initialize Memory
Programming
Testing
Correct Program
Store Program
End
Item
What to Check/Do
Power source
Check that the input voltage to the power supply is within specification.
131
Initialize the PLC module using GPC. (This clears the program in the PLC.)
Check the LEDs of the input modules and use the monitor function of GPC after
testing the input device.
Check the wiring of the output by turning the output On/Off using the monitor mode of
GPC (set PLC to Run mode).
Programming
Testing
Check the Run LED for illumination by setting the mode switch of the controller to
Run.
Check for the proper operation of the program.
Correct
programming
Store program
Store the program onto a floppy disk or similar storage device and place in a secure
place.
Program is stored.
Record the PLC type, program capacity, name of installation, and date for the
recorded program.
Print the program (ladder, mnemonic) and store it in a secure place.
132
Correcting Errors
System Check
Refer to the system check flow chart when you encounter problems during startup and testing.
Is RUN LED
ON or Flashing?
No
No
Go to the RUN
Check flowchart
Yes
Go to the Error
Check flowchart
Yes
Is PLC in Run
(RUN LED On)?
Yes
Is ERR LED
illuminated?
No
No
Go to the I/O
Check flowchart
Is power being
applied to the
terminals?
No
Supply power
Yes
No
Is the voltage
within the specified
range?
No
Is RUN LED
On or Flashing?
Yes
Yes
No
No
Is RUN LED
On or Flashing?
Yes
Tighten the
terminal screws
Yes
No
Is RUN LED
On or Flashing?
Yes
END
133
134
Run Check
RUN Check Flowchart
Is the controller
mode switch set
to RUN?
No
Yes
No
Yes
Place in Run
using GPC - Is RUN
LED On?
Yes
END
No
Is the ERR
LED illuminated?
Yes
Go to the Error
Check flowchart
No
No
Set the controller mode
switch to STOP
Yes
Check the PLC program,
and reload
No
Yes
Go to the Error
Check flowchart
*Be certain to save the program before clearing the PLC program so it is not lost.
Error Check
Error Check Flowchart
Are any
of the bits from
F0.0 to F0.7 in the
ON state?
Yes
No
F0.0 = 1
F0.1 = 1
F0.2 = 1
F0.3 = 1
F0.4 = 1
F0.6 = 1
F0.7 = 1
No
Is bit F1.7
in the ON state?
Yes
No
No
Yes
Is bit F1.7
in the ON state?
Yes
No
Go to the System
Check flowchart
Are any
of the bits from
F0.0 to F0.7 in the
ON state?
135
136
I/O Check
This page presents an example of a troubleshooting procedure to follow when errors are encountered
with the external I/O. In this example, two of the inputs on the controller are used to control an output
on the controller. This flow chart is based on the following circuit, and assumes that the error
encountered is that the output connected to R15.0 is not turned On when it should be.
R0.2
R0.3
R15.0
(OUT)
137
138
Expected Cause
Troubleshooting
Program errors
139
Digital Inputs
Symptom
Expected Cause
Troubleshooting
Supply power.
Tighten screw/
Reconnect the module
Tighten screw/
Reconnect module
Noise error
Tighten screw/
Reconnect module
LED error
Input display LED will not
illuminate (input is On in PLC).
140
Digital Outputs
Symptom
Expected Cause
Troubleshooting
Supply power.
Tighten screw/
Reconnect module
Tighten screw/
Reconnect module
Noise error
Tighten screw/
Reconnect module
Defective contact/
Terminal connector
LED error
141
What to Check
Supplied
Power
Does the voltage measured within the Voltage must fall within the power
module input voltage specifications.
power terminal fall within the
specified range?
Environment
Thermometer
Hygrometer
No dust.
Visual
I/O Power
Voltmeter
Module
Mounting and
Wiring
Screwdriver
Criteria
Test
Equipment
Voltmeter
142
143
This chapter outlines the various causes of noise that affect the D50 PLC system. Installation tips and
troubleshooting methods for identifying noise problems are also provided.
This chapter discusses:
144
Noise Occurrence
Types of Noise
Radiation noise is transmitted in the form of a magnetic wave. The amplitude of the magnetic
wave is measured in Gauss.
Conduction noise is transmitted through a direct path such as signal wiring or ground
connections as a strong, high-voltage surge. This type of noise is measured as voltage,
current, or power.
Normal mode (single ended developed) noise can come through the power and/or the signal
cables. This type of noise is not equally distributed across the PLC input terminals.
Common mode noise can come through the power and/or the signal cables. In this case the
noise is close to the same amplitude thus the term common on both leads of the cable.
Impulse noise is electrical or magnetic energy that has less than a 200 msec pulse duration.
Surge noise is electrical energy that has a pulse duration of 200 msec to 2 sec.
Transient noise is electrical energy that has an extremely short duration usually lasting only a
few nanoseconds (1 x 10-9).
Isolation means to physically separate the connection between areas. Isolation is effective for
common mode noise.
Filters are effective against conduction noise such as impulses. Filtering is used to remove
normal mode noise and common mode noise that has been imprinted onto the signal or power
cables. A low-pass filter passes only low frequency signals. Low-pass filters are classified as
either LC (L = inductor and C = capacitor) filters or RC (R = resistor and C = capacitor)
filters, according to the electrical parts that form the filter.
Surge absorbers are devices that protect electronic equipment by clamping down extremely
high voltage spikes (lightning strikes) in power cables to a safe level.
An inductive load is a device which creates a large magnetic field that opposes any change in
the voltage applied across the device. Devices that act as inductive loads are relay coils, motor
coils, starter coils and actuator coils.
Stray capacitance and inductance is created during the installation of an electrical system.
When excess cabling is left wound up this creates stray inductance in the form of a coil. All
cabling inherently has a capacitive rating (so many picofarads per meter). Excessively long
cable runs or untrimmed cable lengths or poorly specified cable types can add large levels of
stray capacitance.
145
Sources of Noise
There are three main sources of noise. Some of these sources generate large noise amplitudes. The
occurrence time can be very short (impulse type) or continuous (power line induced). Some noise
levels can damage the D50 PLC components and peripheral devices.
1.
2.
3.
In the first case, the noise is caused within the equipment and is called internal noise. In the second
case, the noise is caused by external factors and referred to as external noise. These two types of noise
may also be referred to as artificial system noise.
The noise caused by natural occurrences can not be prevented, but can be controlled. Precautions such
as good grounding techniques, surge suppressors, and burying cables underground can help minimize
the affect. This type of noise may be referred to as natural noise.
146
PLC
Others
PLC
Others
PLC
Others
The length of the ground cable should not exceed 65 feet (20 m). For best results, the resistance of the
ground cable should be less than 2 .
147
Attach an isolation transformer between the PLC power supply and the VAC source to help
remove noise that flows in the power cable. Try to attach the isolation transformer as near to
the PLC power supply input terminal strip as possible.
Some isolation transformers come with a shield that can be grounded. This shield, when
properly grounded, enhances the transformers ability to remove unwanted spikes.
Be certain to size the isolation transformer to handle the necessary power rating required by
the system. A good practical rule in specifying an isolation transformer is to multiply the
required load capability by 1.35 (35% additional deliverable power). This allows expansion of
the PLC system at a later date without the immediate need to upgrade the isolation
transformer.
Isolation
Transformer
I
AC power
PLC
AC input
Ground
terminal
Triple ground (Less than 2 of
ground resistance)
When heavy noise is expected, also use an isolation transformer on the AC control power to
the I/O modules and devices. A cost-effective way of specifying the isolation transformer for
this requirement would be to specify a transformer with multiple primary and secondary
windings and wiring the PLC as shown below. Again, be certain to size the isolation
transformer to handle the necessary power required plus a 35% surplus and additional
windings to allow for future expansion of the system.
Breaker
AC power
Load
PLC input
148
Filters
Filters should be used to suppress high frequency noise.
When using a low-pass filter specify one that is designed for power line applications. Many different
types are available from simple modules to complex units.
A single device is not necessarily the most cost-effective device for all applications. In specifying the
proper filter one must take into account the amplitude/power level of the noise and how often the noise
is present.
When the proper device is selected it is best to place the device as close to the PLC power supply
connections as possible. Below is an example of how to install a filter. The chart lists a typical
midrange power line filter for reference.
Filter
AC power
PLC
AC input
Ground
terminal
Triple ground (Less than 100
of ground resistance)
Manufacturer
Remarks
PQI-3120N12
PQI-3220N12
149
A surge absorber reduces the electrical shock to the PLC by taking high-voltage spikes to
ground. Attach a surge absorber in the power line in front of the PLC to prevent damage from
lightning. The surge absorber will clamp the unwanted high voltage and prevent it from
flowing to the PLC power supply. When specifying a surge absorber, the present wiring
system must be carefully reviewed. Some surge absorbers are designed to be placed into the
main power distribution panel while others are designed to be installed in the field close to the
PLC. It is always best to place the surge absorber as close to the PLC as possible.
Surge absorbers can consist of either series resistors with capacitors that will couple the spike
to ground, or Zener diodes that safely clamp the high voltage spikes or MOVs (Metal Oxide
Varistors). Some surge absorbers will need replacement after they have suppressed a spike
(similar to a fuse). Others can be reset. In specifying a surge absorber consider how often the
surges are occurring and the maximum amplitude in volts or joules.
U
AC power
Main breaker
Breaker
Transformer
PLC
AC input
V
Surge Absorber
Special ground (Less than 2
of ground resistance)
It is needed to prevent high voltage
noise such as lightning
Ground
terminal
Triple ground (Less than 2
of ground resistance)
Some typical surge absorbers are listed in the following table. For actual installation and
application details, refer to manufacturers manuals.
Model Name
Specifications
Manufacturer
Remarks
CHSA
470 V
Cutler-Hammer
120/240 V power
CHSA01
490 V
Cutler-Hammer
120/240 V power
Burying Wire
Cabling that is strung from pole to pole in free space is an antenna for lightning. When
possible bury the cable underground. The earth acts like a shield and absorbs most if not all of
the lightning induced noise signals before they are able to reach the cable.
150
Shielding Cabling
When the wiring for the I/O module is more than 165 ft (50 m), shield the wire by installing it
in ferrous (steel) conduit and use shielded wire. Attach the conduit/shield to the ground at the
PLC ground terminal as shown below.
PLC
In
COM
Ground
terminal
Ground (ground resistance
less than 2 )
Separate the input and output module wiring, and power circuit cables. Make sure to properly
ground the shields of each cable directly to ground. Do not create a daisy chain of ground
jumpers over several feet and then pigtail one end lead to ground. This method allows
multiple ground current paths to exist and can induce noise.
151
DC Input Module
Attach a diode in a reverse biased direction parallel to the inductive load, as close as possible to the
load.
DC input module
IN
Inductive
load
Flywheel
diode
COM
DC power
AC Input Module
Attach an RC network parallel to the inductive load.
AC input module
IN
Inductive
load
R
C
COM
R
C
RIN
COM
In case of AC power
152
Countermeasures
Attach a surge
suppressor:
Application
AC
Load
DC
Load
Relay output
Inductive load module
OUT
COM
Characteristics
Selection of Parts
C: 0.5-1.0 F
R: 0.5-1.0
C: 0.25-0.5 F
The example shows how to connect
R: 100-200
the surge suppressor for a DC
power source
For DC circuits use a minimum of a
250 V rated capacitor. For AC
circuits use a minimum of a 1000 V
rated capacitor.
Attach a flyback
diode:
Relay output
Inductive load module
OUT
COM
Attach a varistor:
Relay output
Inductive load module
OUT
COM
153
Warning
The following two protection methods should be avoided. Each of these methods can be effective in
removing the sparks when power to the inductive load is turned off. However when power is turned on
to the inductive load there will be a high inrush current applied across the relay contacts as they are
mating. Since all relay contacts have some bounce while mating, arcing will occur and potentially melt
the relay contact points. This is the reason for having the resistor in the RC network described earlier.
Inductive load
Inductive load
OUT
OUT
C
Power
Power
COM
COM
Transistor Output Moduleit is best to attach a flyback diode parallel to the inductive load,
as close as possible to the load. In this configuration output switching frequency should be
held to less than 20 times per minute.
Transistor output module
Inductive load
OUT
COM
SSR Output Moduleattach a surge suppressor parallel to the inductive load, as close as
possible to the load. In this configuration output switching frequency should be held to less
than 20 times per minute.
Inductive load
R C
COM
154
Troubleshooting
Noise from magnetic fields induced by other electrical/electronic equipment onto the PLC can
be avoided by relocating the PLC during the design process, installing the PLC in a grounded
steel enclosure, or attaching a filtering or suppression shield/circuit to the device which is
generating the magnetic field.
Noise from power cables can be corrected by using a different ground for the PLC, an
isolation transformer, attaching a line/ground filter, or changing the power wire connection of
the PLC so that it is closer to the source of the power, therefore lowering the power source
impedance.
Noise from lightning should be suppressed by use of surge suppressors that are specifically
designed to protect electronic equipment from lightning.
Whenever welding near an electronic device, care must be used to avoid connecting the
ground cable of the welder to a ground of the electronic device. One method of protecting the
PLC is to disconnect the PLC from power and lifting all power and ground connection. An
alternate method is to establish two separate grounds, one for electronic equipment and one
for welding. Test the ground separation carefully before having electronic equipment up and
running while welding.
The quickest way to avoid noise from shared cable trays is to have two cable tray runs. One
for power and power control cabling and the other for electronic equipment and low level
control wiring. Proper cable selection with good shielding properties in some instances will
allow both types of cabling/wiring to co-exist in the same tray system.
Grandfatherd plant wiring has to be analyzed on a case by case basis. The best approach is
to always install new cabling, conduit, and cable tray runs. Though this may not always be
practical, it removes the surprise of high noise and system problems during system startup.
Static electricity suppression requires good grounding practices throughout the plant. Static
electricity is a potential difference developed on a material surface due to the loss of protons
or electrons. Since rubbing action can cause the build up of static electricity, the best
protection is to have the electronic equipment enclosed in a grounded housing that requires
the user to first make contact with a safe discharge path. In high static environments like
styrofoam manufacturing or glass manufacturing, electronic equipment should always be
protected from static electricity.
155
The D50 PLC communication protocol provides a simple, yet complete method of communications
between the Cutler-Hammer program loader software (GPC) and the PLC. Using the open protocol
outlined in this appendix, the user can quickly and easily expand the capabilities of the overall PLC
system by communicating to the PLC using a variety of peripheral communications equipment such as
operator interfaces and computers. Additionally, the communications protocol allows for multiple
Cutler-Hammer D50, D300, and D320 PLCs to communicate to a central computer on a single
network using RS-485, at distances of up to 4000 ft (1.2 km).
156
Communication Rules
Communication Environment
The D50 PLC communications protocol uses the following settings:
No Parity
1 Stop bit
Communication Protocol
Step 1
Query (Q)
Set the network ID number for the PLC to communicate with and send a Q signal from the peripheral
device to the PLC.
Step 2
Query Acknowledge (QA)
A QA signal is sent from the PLC to the peripheral device, indicating that the Q signal from the
peripheral device was received.
Step 3
Response Request (RR)
An RR signal goes from the peripheral device to the PLC, indicating that the QA signal from the PLC
was received, and requesting the final data response. This signal is sent when QQA is normal.
Step 4
Response (R)
When the PLC receives the RR from the peripheral device, it sends an R signal which gives the results
of the original Q signal sent by the peripheral device. The communication cycle for one function code
ends when the PLC sends the R.
157
Step 5
Repeated Response
Once the original Q has been sent to the D50 PLC, the R message containing the requested data for
that query can be repeatedly received by sending only the RR message again.
Communications Delay
The D50 PLC will return a signal after receiving a Q or an RR within a specific time. However, due to
errors in the communications network, CRC values, and communication speed flux, there are
occasions when the PLC will not receive the signal from the peripheral device. The peripheral device
should allow up to three seconds for a response from the PLC. If there are no responses to the Q or the
RR message, the communication is considered to have failed, and the Q or RR should be sent again.
Example
1.
No communication error.
For the internal processing of the PLC CPU
send RR at least 5 msec after receiving QA.
Peripheral device
Q
QA
RR
PLC
2.
QA
RR
RR
RR
PLC
3.
QA
RR
QA
RR
PLC
4.
Peripheral device
Q
PLC
158
CPU ID
All devices connected to the network need a network ID number for communication. There is an
available range of 0 to 191 network ID numbers. Redundancy is not permitted. When a single PLC and
a peripheral device are connected, usually 0, 1, or 255 is assigned as the network ID number to the
PLC. When the peripheral device wishes to communicate to a connected PLC regardless of its
programmed network ID number, it can use global network ID number 255, to which any PLC will
respond. When several CPU modules are connected to one communication network, they must use
individual ID numbers from 0 to 191. The PLCs network ID number is configured using the GPC
program loader software.
Each function code is 1 byte. When the PLC receives a query (Q), the function code of the
final response (R) is formed by adding $80 (hex) to the function code sent by the query.
The function code of the R message can be used by the peripheral device to verify that the
correct Q message has been received by the PLC.
Communication function
* $ notes hexadecimal notations
Query Function Code
Read Bits
Communication Function
$01
$81
Write Bits
$02
$82
Read Words
$03
$83
Write Words
$04
$84
$05
$85
$06
$86
Read Program
$07
$87
Write Program
$08
$88
Read Instruction
$09
$89
Change Instruction
$0A
$8A
Change Parameter
$0B
$8B
Insert Instruction
$0C
$8C
Delete Instruction
$0D
$8D
Find Instruction
$0E
$8E
Find Parameter
$0F
$8F
Delete Section
$10
$90
No Service
$00
$00
Note: Function codes $07 to $10 are used for programming and system control functions, and are
beyond the scope of this manual. Please contact Cutler-Hammer technical support for more
information.
Note: The bit/word address assignment uses the absolute address method for reading memory
locations. (See Chapter 5 for memory map.)
159
The CRC is a 2-byte checksum that is calculated from the data of every message and then
attached to the end of the message by the sender. It is used as an error-checking device to
prevent loss or corruption of data during transmission of the message.
The sender of the message calculates and attaches the CRC when it generates and sends the
message. The receiver should also calculate the CRC from the data of the message and
compare the calculated value to the CRC that was sent. If the calculated CRC does not match
the CRC received, an error has occurred in the message during transmission.
SA
Function
Length
Information
CRC L
CRC H
2 Bytes
The following subroutines illustrate the program code required to calculate the CRC for a message.
The initial value of the CRC (CRC_Sum) is set to 65535 ($FFFF). Then one of these subroutines
would be called once for each byte (data) of the CRC calculation range shown above.
CRC_Sum: CRC-16 reserve code after the calculation (CRC content to be sent at end of message)
Data: CRC-16 Data input to be calculated (Byte Data from message)
CRC_Sum = CRC_Sum XOR Data
FOR I=1 to 8
CARRY=CRC_Sum AND 1
CRC_Sum=CRC_Sum SHR 1
IF CARRY=1 THEN CRC_Sum XOR 0A001H
NEXT I
RETURN
160
SA
FC
Length
Information
CRC L
Length of the
information field (byte)
1-255:1-255 byte
0:256 byte
CRC H
CRC-16 code
(2 byte)
Function Code
Sender ID Number
Receiver ID Number
The frame is sent from the source address (SA) by the sender to the destination address (DA), the
receiving device. For the query (Q) and the response request (RR), the SA is the address of the
peripheral device, and the DA is the address of the PLC to which the message is being sent. For the
query answer (QA) and the response (R), the PLC becomes the sender of the message, and so the PLC
address is the SA and the peripheral devices address is the DA.
Query Acknowledge Frame
DA
SA
$80
01
00
CRC L
CRC H
01
00
CRC L
CRC H
01
Error
CRC L
CRC H
Constant
SA
$00
Constant
SA
$8X
Read Bits
The following can be read:
SA
$01
$03
Base
CRC
Length of
information (bit)
Function Code
Peripheral Device
ID (PC ID)
PLC ID (CPU ID)
DA
SA
$81
Base+0
Base+1
Bit value Bit value
Base+N-1
Bit value
CRC
L
161
162
Write Bits
Writing bits allows you to:
Modify the contents of the bits stored in the absolute address (R, L, M, K, or F).
DA
SA
$02
Base
Base+0
Base+1
BASE
BASE
+0 BASE
+1
L
H
Bit value Bit value
Base+N-3
BASE+N-3
Bit value
CRC
CRC
L
H
DA
SA
$82
$01
Fixed
$00
CRC
Completion Code
163
Read Words
Read the content of the words (R, L, M, K, F, or W) assigned to the absolute address.
DA
SA
$03
$03
Base
CRC
Number of words
to be read.
Word absolute address
(starting address)
For example: K27
Word absolute address = $014C
Base L = $4C, H = $01
SA
$83
CRC
L
164
Write Words
Changes the content of the words assigned to the absolute address (R, L, M, K, F, or W).
SA
$04
SA
$84
$01
Fixed
$00
CRC
CRC
L
165
Reads the bits and/or word contents of the specified absolute addresses.
Can read bits and words regardless of their order and location in memory.
SA
$05
A1
H
AN
H
CRC
H
SA
$85
Lx
DO
Dn
H
CRC
H
For the A0, A1,, An requested by the Q, the content D0, D1,, Dn of
the word/bit is returned.
If Ax denotes a bit address, the Dx data is 1 byte (On = $FF, Off = $00),
and if Ax denotes a word address, the Dx data is 1 word (2 bytes).
166
Changes the content of the bits or words at the specified absolute addresses.
Words and bits may be modified regardless of their order and location in memory.
A0
DA
SA
$06
A1
H
D0
D0
SA
CRC
H
DA
$86
$01
Fixed
$00
CRC
167
void RR_occurring(void);
void Trsport(unsigned int);
unsigned int Recport(void);
BOOL sending_occurring(void);
BOOL receiving_occurring(void);
void Crc16(unsigned int);
void Job(void);
unsigned int communication(void);
void Mword_reading(void);
void Kword_writing(void);
Notes
This program was written in Borland
C++. It uses the peripheral device
(PC) to read the M000 to M127
words, and stores them in the K000 to
K127, and then compares the two
registry values and indicates the
results on the screen using the OK or
the FAIL notation. The user may read
or manipulate the various
communication function codes and
the information sent to control the
PLC in various ways.
This program consists of a header, the
main program and various functions.
The buffers and variables needed to
store the communication data are set
as global variables, so that the main
and various other functions may
reference them.
By using the COM1 and COM2 ports
of the computer, serial
communication is possible. By using
the GPU-300 card, parallel
communication is also enabled
(NOTE: The GPU-300 card is not
currently offered by Cutler-Hammer).
The Qs, QAs, RRs, Rs are handled in
the job functions. If there are
communication errors or a frame
breakdown, retry 3 times, then issue a
communication error.
The procedure of the communication,
according to the JobID is:
1. Q sending
2. QA receiving
3. RR sending
4. R receiving
When an error occurs in a frame, a
retransmission should be made.
Major operations of the program
168
void Job(void)
{
/* JobID=0
/* JobID=1
/* JobID=2
/* JobID=3
/* JobID=4
/* JobID=5
/* JobID=6
Communication sequence
functions:
: Change to sending-Mode for Serial port */
: Transmit sending-Frame
*/
: Change to receiving-Mode for Serial port */
: Address Polling of ACK from CPU */
: Receive ACK from CPU
*/
: Change to sending-Mode for Serial port */
: Transmit RR-Frame
*/
169
CRC Calculation:
Encodes the communication data in
the byte stream. When one
communication function is complete,
it is attached to the most recent frame,
or is compared with the attached CRC
to check for data errors.
170
JobID 0,5:
A frame sends the data from the
peripheral device to the PLC. It resets
the watchdog and the CRC.
Use a delay after the send to avoid
errors due to communications delays.
JobID 1,6:
Sends the Q and RR data.
When there are no errors, it resets the
watchdog and proceeds on to the next
sequence.
JobID=2,7:
A sequence that senses the sending of
the QA and R data to the peripheral
device after the completion of the
functions that are received by the
PLC from the previous frame.
JobID=3,8:
Handles the received data, and
calculates the CRC of the received
data.
JobID=4,9:
Stores the received data in the
internal receivable buffer and
compares the CRC value sent by the
PLC to the calculated CRC value. It
notifies the system that a successful
communication is made when the two
171
if(index==3)
{
if(receiving_frame[3]==0) receiving_Index_max=256+5;
else receiving_Index_max=receiving_frame[3]+5;
}
}
else if(index==receiving_Index_max-1)
{
receiving_frame[index]=Recport();
if(receiving_frame[index]!=lower_byte(Crc)) JobID=(JobID & 0x05);
}
else if(index==receiving_Index_max)
{
receiving_frame[index]=Recport();
if(receiving_frame[index]==upper_byte(Crc)) JobID++;
else JobID=(JobID & 0x05);
}; index++;
}
break;
case 10:Success=TRUE;
}
}
JobID=10:
Receiving
172
void Kword_writing(void)
{
/* Example of Write-Register */
int i;
receiving_frame[2]=4;
/* EXAMPLE write WORD(K000-K063) */
receiving_frame[3]=130;
/* Number Of Byte For Information */
receiving_frame[4]=0x40;
/* BASE(K000=$0140) LOW */
receiving_frame[5]=1;
/* BASE HIGH */
for(i=0;i<=63;i++)
{
receiving_frame[i*2 +6]= lower_byte(K[i]);
receiving_frame[i*2 +7]= upper_byte(K[i]);
}
if(communication() == 0) printf("WRITE K0000-K0063 OK\n");
else printf("communication error\n");
receiving_frame[2]=4;
/* EXAMPLE write WORD(K064-K0127) */
receiving_frame[3]=130;
/* Number Of Byte For Information */
receiving_frame[4]=0x80;
/* BASE(K000=$0180) LOW */
receiving_frame[5]=1;
/* BASE HIGH */
for(i=0;i<=63;i++)
{
receiving_frame[i*2 +6]= lower_byte(K[i+64]);
receiving_frame[i*2 +7]= upper_byte(K[i+64]);
}
if(communication() == 0) printf("WRITE K0064-K0127 OK\n");
else printf("communication error\n");
}
Note:
Sending frame[6] = The number of
words to be read.
Sends a function code requesting to
read the M area, and stores the
received data in the buffer.
Writing Function of the K Register.
Uses the communication function
code 4 (writing N consecutive words)
to store the specified value in the
K000 to K063 word.
Note:
Abs. address of K0 = 0x0140
173
The D50 PLC provides several special functions through the I/O built into the D50 controller. This
appendix details the configuration and operation of the integrated special I/O functions, including the
high-speed counters, pulse output, pulse catch input, and selectable input response delay.
174
Overview
The D50 PLC provides several additional functions through the integrated I/O on the base unit. These
special I/O functions expand the capabilities of the D50 PLC to allow for use in a variety of specialized
applications. This appendix details those capabilities, and provides instructions on configuration,
application, programming, and operation of the special I/O. Four types of advanced operation are
available, as listed below.
Note: These special functions are only available on the controller units. They are not available
through any of the digital expansion modules, only on the base module.
Pulse Output
The D50 also provides one configurable output supporting two modes of pulse operation. The first
mode allows the user to send out a configurable number of pulses, at a desired frequency (Pulse
Mode). The second mode allows the user to set the output to continuous pulses at a given frequency,
with a configurable duty cycle (PWM Mode).
175
Description
Register
Address
Register
Name
R004
H0MODE
Configuration register
R005
H0STRL
R006
H0STRH
High-speed Counter
Channel 0
R007
H0ENDL
R008
H0ENDH
R009
H0PVL
R010
H0PVH
R011
PMODE
Configuration register
R012
PFREQ
R013
PSV
Pulse Output
R014
PPV
R019
H1MODE
Configuration register
R020
H1STRL
R021
H1STRH
High-speed Counter
Channel 1
R022
H1ENDL
R023
H1ENDH
R024
H1PVL
R025
H1PVH
R026
HFLAG
High-speed Counter
R027
FTIME
Input Delay
R028
PCATCH
Pulse Catch
176
Register Descriptions
MODE (R004, R019)
The mode register is used to turn on the high-speed counter, configure which mode it will be operating
in, and enable or disable the inputs used by the counter. Each bit in the low byte of the MODE register
is used to turn On or Off a feature of the high-speed counter channel.
PV (R009/10, R024/25)
The PV registers are a pair of registers that hold the Present Value for the high-speed counter. The PV
registers hold the actual counting value of the inputs coming into the PLC. Like STR and END, PV is
a 24-bit value.
FLAG (R026)
The FLAG register provides comparison bits between the high-speed counter Present Values (PV) and
End Values (END). Each counter channel has three bits in the FLAG register that indicate whether the
PV is greater than (>), less than (<), or equal to (=) the END value. Since the equal to comparison is a
latched bit, a fourth bit is provided to reset the = bit.
177
Bit Registers
Three of the configuration registers used by the high-speed counters are bit registers each bit in the
register serves a different purpose. The three bit registers and the individual bit meanings are
described in further detail below.
H0MODE Mode Register R004
Bit #:
Bit Name:
RUN
UD/2
RING
PRST
R2
R1
R0
Description
Enable R0.0 as Up/Ph. A count input
Enable R0.1 as Down/Ph. B count input
Enable R0.2 as Preset input
Not Used
Preset Counter (STR PV)
Enable Ring Counter mode
Enable Up/Down or 2-phase mode
Run/Stop Turn on Counter
RUN
UD/2
RING
PRST
R6
R5
R4
Description
Enable R0.4 as Up/Ph. A count input
Enable R0.5 as Down/Ph. B count input
Enable R0.6 as Preset input
Not Used
Preset Counter (STR PV)
Enable Ring Counter mode
Enable Up/Down or 2-phase mode
Run/Stop Turn on Counter
EQ1D
GT1
LT1
EQ1
EQ0D
GT0
LT0
EQ0
Description
PV = END on channel 0 (latched)
PV < END on channel 0
PV > END on channel 0
Unlatch EQ0 bit (PV = END)
PV = END on channel 1 (latched)
PV < END on channel 1
PV > END on channel 1
Unlatch EQ1 bit (PV = END)
178
Programming Procedure
The high-speed counter is very easy to use, and requires very little programming. The following steps
outline the standard programming procedure to set up, turn on, and use the D50 high speed counter.
1.
Configure the type of counter to be used by turning on the necessary mode bits in the MODE
register. To set the counter up for 2-phase or Up/Down mode, set bit 6 (UD/2). To configure
the counter as a ring counter, set bit 5 (RING). If the counter uses only a single input, and is
not a ring counter, leave both bits off.
2.
Enable the inputs required by the counter to count. On channel 0, set bit 0 (R0) of its MODE
register R4 if the input on R0.0 will be a count input. Likewise set bit 1 (R1) if the input on
R0.1 will be a count input (for example, for a down-counter or 2-phase counter). On channel
1, set bit 0 (R4) and bit 1 (R5) of its MODE register R19 based on which inputs, R0.4 and
R0.5, will be used as count inputs. The Preset bits PRST are should be set if an external input
will be used to reset the counter value.
3.
Set the start value STR and the end value END for the counter, based on the application. The
STR value will be used to reset the counter, while the END value is used by the comparison
register HFLAG.
4.
Turn on the counter channel. This is done simply by setting the RUN bit, bit 7, of the MODE
register for that channel.
5.
Use either the comparison register (HFLAG) or the D50 PLCs comparison instructions (>, <,
=, >=, <=, <>) on the present value (PV) of the counter in the program, based on the
application.
The following ladder program illustrates the above 5-step procedure for a simple counter application.
For this example, a standard Up Counter is programmed, with an end value of 100. At the count of
9000, the program turns on the D50 PLCs first output R15.0, and at the count of 10000, the second
PLC output R15.1 is turned on. Since this is an Up Counter, the first input of channel 0 is used to
count input pulses.
F1.0
F1.0
F1.0
R4.6
(RST)
R4.5
(RST)
R4.0
(SET)
R4.1
(RST)
R4.2
(RST)
DLET
D = R5
S=0
DLET
D = R7
S = 10000
F1.0
D>
D = R9
S = 9000
R26.0
R4.7
(SET)
R15.0
(OUT)
R15.1
(OUT)
179
Input Signal
The Input Response Delay is automatically set for all the inputs when the new time value is loaded into
the FTIME register, R27. The ladder example below illustrates setting the Input Response Delay time
to a value of 25ms.
F1.0
LET
D = R27
S = 25
180
I/O
Scan
PLC Scan
I/O
Scan
>150usec
Input Signal
The PCATCH special I/O function register determines which of the eight inputs on the controller are
configured for pulse catch inputs, and which operate normally. Each bit in the PCATCH register R28
represents one of the eight inputs. If the bit is set On, then the corresponding input on the controller is
configured as a pulse catch input. The logic required to set the PCATCH register R28 is shown below.
In this example, inputs 1, 3, and 7 are set for Pulse Catch Inputs.
LET
F1.0
D = R28
S = $8A
Pulse Catch
Inputs
DC 24V
1
IN
OUT
D50
5
IN
Programmable Controller
RUN
IN
ERR
OUT
RUN
STOP
Cutler-Hammer
IN 100-240V
GND
OUT
C
OUT
0
OUT
3
181
Pulse Output
The D50 PLC provides two modes of Pulse Output on the first output contact of the controller. The
first mode, Pulse Mode, sends out a given number of pulses at a user-defined frequency. The second
mode, PWM (Pulse Width Modulation) Mode, sends out a continuous stream of pulses, at a userdefined frequency and duty-cycle. Both modes use the same set of special I/O function registers (R11
to R14). The mode used by the D50 is determined by the configuration of the PMODE register, R11.
Register Descriptions
PMODE (R11)
The mode register is used to turn on the pulse output, configure which mode it will be operating in,
enable the output used, and set up the pulse count. Each bit in the low byte of the PMODE register is
used to turn On or Off a feature of the pulse output, as shown below.
PMODE Mode Register R011
Bit #:
Bit Name:
RUN
FUNC
OUT
PRST
CMP
Description
Pulse Output completed.
Not Used
Not Used
Not Used
Preset Pulse Counter (PSV PPV)
Enable Output R15.0 for Pulsing
Mode: Pulse = 0, PWM = 1
Run/Stop Turn on Pulse Output
PFREQ (R012)
The PFREQ register sets the Pulse Frequency, from 20Hz to 5kHz, of the output. Whether in Pulse
Mode, or PWM Mode, the output pulses will be sent at this rate.
182
PSV (R013)
The PSV register is defined by the Mode of operation. In Pulse Mode, the PSV register holds the total
number of Pulses to be sent out, from 0 to 65,535. When set to 0, the pulse output is continuous. In
PWM Mode, the PSV register holds the duty cycle of the pulse, from 0 to 100%.
The Duty Cycle of the pulse is defined as the width of the pulse, from 0 (no pulse) to 100% (constant
On). For example, a 100Hz pulse will generate 100 pulses every second, or 1 pulse every 10ms. If the
duty cycle of the pulse is 75%, the pulse is ON for 75% of that 10ms, or for 7.5ms. It is OFF for the
remaining 25%, or 2.5ms. This is illustrated by the diagram below.
7.5ms
10ms
PPV (R014)
The PPV register holds the Present Value of the Pulse Output when in Pulse Mode. The Present value
counts down from the initial value, set by the PSV register. When the PPV register reaches 0, the
pulses stop. In PWM Mode, the PPV register should always be 0.
183
Configure the pulse output for Pulse Mode by turning Off bit 6 of the PMODE register R11.
2.
Enable the pulse output R15.0 by turning On bit 5 of the PMODE register R11.
3.
Set the Pulse Frequency PFREQ (R12) for the pulses to be sent out.
4.
Set the initial Pulse Value PSV (R13) for the total number of pulses to be sent out.
5.
Turn on the Pulse Output by turning On bit 7 of the PMODE register R11.
6.
Begin the Pulse Output by turning on the Preset bit (bit 4) of the PMODE register R11. This
will move the total number of pulses into the Present Value register, and begin pulsing the
outputs.
The following ladder program illustrates the above procedure by configuring a Pulse Output on the
D50 PLC. The Pulse Output is set to send out exactly 200 pulses at a frequency of 50Hz, when the
PLC is first placed into RUN.
F1.0
F1.0
R11.6
(RST)
R11.5
(SET)
DLET
D = R12
S = 50
DLET
D = R13
S = 200
F1.0
R11.7
(SET)
F1.0
R11.4
(OUT)
184
Configure the pulse output for PWM Mode by turning On bit 6 of the PMODE register R11.
2.
Enable the pulse output R15.0 by turning On bit 5 of the PMODE register R11.
3.
Set the Pulse Frequency PFREQ (R12) for the pulses to be sent out.
4.
Set the Pulse Duty Cycle PSV (R13) for the width of the pulses, from 0 to 100%.
5.
Turn on the Pulse Output by turning On bit 7 of the PMODE register R11.
The following ladder program illustrates the above procedure by configuring a PWM Output on the
D50 PLC. The PWM Output is set to continuously send out pulses at a frequency of 50Hz and a duty
cycle of 25%, when the PLC is first placed into RUN.
F1.0
F1.0
R11.6
(SET)
R11.5
(SET)
DLET
D = R12
S = 50
DLET
D = R13
S = 25
F1.0
R11.7
(SET)
185
The D50PGM10 pocket editor provides a simple, convenient method of troubleshooting, monitoring
and editing a D50 PLC on the shop floor. This appendix describes in detail the various functions of
the pocket editor, and how to use them.
186
Overview
This appendix describes in detail the use of the D50PGM10 pocket editor for programming,
monitoring, and troubleshooting the D50 PLC. The Pocket Editor provides mnemonic-only program
loader support for the D50 PLC in a heavy-duty, light-weight industrial package. The various
functions of the pocket editor are presented in a step-by-step procedural guide to simplify the use and
operation of the editor.
Specifications
Operating Specifications
Item
Specification
Supported PLCs
Power Supply
Display
D50
5VDC supplied from connected PLC
Indicator
Capacity
Keypad
Dimensions
PGM-10
AND
OUT
MCS
SHF
OR
TIM
MCR
RUN
STR
CNT
SET
ON
NOT
DIF
RST
SST
K/7
F/8
W/9
FUN
AND
OUT
MCS
DEL
SHF
M/4
AUX
CHK
OR
TIM
MCR
INS
SCH
R/1
ADR
RD
STR
CNT
SET
ENT
PRE
MON
SST
NOT
DIF
RST
3.45in
(88mm)
TC
3.15in
(80mm)
WR
CLR
NXT
1.0in
(25mm)
187
Part Descriptions
The pocket editor is comprised of 13 Instruction LEDs, 3 Status LEDs, 6 Register LEDs, a 5-digit
Address/Data LED Display, and 20 keys that operate as instruction keys, number keys, and function
keys. The diagram below points out the individual features of the pocket editor.
Status LEDs
Instruction
LEDs
Register
LEDs
PGM-10
R
AND
OUT
MCS
SHF
OR
TIM
MCR
RUN
STR
CNT
SET
ON
NOT
DIF
RST
SST
Address/Data
LED Display
K/7
F/8
W/9
FUN
AND
OUT
MCS
DEL
SHF
M/4
AUX
CHK
OR
TIM
MCR
INS
SCH
R/1
ADR
RD
STR
CNT
SET
ENT
PRE
MON
SST
NOT
DIF
RST
Instruction/
Number Keys
TC
WR
CLR
NXT
Function
Keys
Instruction LEDs
The instruction LEDs are illuminated to indicate the basic instruction for a given step of the
mnemonic program. When displaying a step in the program, one or more of these LEDs will be lit.
Status LEDs
The three status LEDs on the pocket editor are the SHF, ON, and RUN LEDs in the center.
The SHF LED provides visual feedback that the user has pressed the shift (SHF) key.
The RUN LED indicates when the D50 PLC is in the RUN mode.
The ON LED indicates when a given contact or output point is turned On, when monitoring
and instruction or bit register.
188
Register LEDs
The six register LEDs indicate which address type is being displayed, when displaying a data value or
address. The possible register types are R for external I/O, M for internal contacts, K for internal
retentive (Keep) contacts, F for system flags, W for data words, and TC for timer/counter done
contacts.
A 5-digit value is displayed to represent either a bit address (where the first three digits are the
word, and the last two are the bit), or a constant value that is a parameter for an instruction.
Function numbers and timer/counter channel numbers are represented with the first two
characters being Fn and ch, respectively.
When displaying a step address in the mnemonic program, periods appear to the bottom-right
of each digit in the 5-digit address.
Instruction Keys
There are 12 instruction keys on the pocket editor that are used for entering the 25 basic instructions on
the D50 PLC. To enter certain of the basic instructions, more than one of the instruction keys may be
combined. Refer to the Basic Instruction table at the end of this appendix for details.
189
Function Keys
There are 8 function keys on the pocket editor, plus two functions that are accessed using the SHF key.
The 10 functions each have multiple uses, based on the mode of operation the pocket editor is being
used in.
Function Key Descriptions
Key
Function Descriptions
DEL
Delete a step of logic. To accept the Delete request, press the ENT key after the DEL key.
INS
ENT
CLR
SHF
SCH
PRE
NXT
190
Operating Procedures
There are seven separate types of operations that the D50PGM10 pocket editor can perform. These
seven operations provide all of the functionality required to program, edit, monitor, and configure the
D50 PLC. The seven operations are as follows:
Clear Program Deletes the entire program memory from the D50 PLC.
Add Instruction Allows the user to write a new program step by step.
Monitor Program View the D50 mnemonic program, one instruction at a time.
Monitor I/O Allows the user to monitor and force register values.
Run/Stop PLC Switches the PLC between the RUN and STOP modes.
Key Operation
INS DEL ENT
STOP
Basic
Timer/Counter
Add Instruction
Application
Mode
[Operand 1] ENT
STOP
[Operand 2] ENT
[Operand 3] ENT
Monitor Program
Edit Program
Sequential
NXT or PRE
Search by Step
Search by Inst.
Search by Reg.
Insert Inst.
Delete Inst.
DEL ENT
Change Inst.
Error Checking
Monitor I/O
Force I/O
Run/Stop PLC
STOP
SHF CHK
Register Value
RUN/STOP
RUN/STOP
Next:
NXT
Previous:
PRE
Force On:
SET ENT
Force Off:
RST ENT
Clear Force:
CLR
RUN
PLC RUN
INS SET
STOP
PLC STOP
INS RST
RUN
191
Clear Program
The Clear Program function will clear out the program memory from the D50 PLC. All of the register
memory will also be cleared, with the exception of the Keep (K) registers, and the Timer/Counter
registers.
Operating Procedure
Display
Key Sequence
LED
5-Digit Display
Remarks
INS
AUX
DEL
ALL d
ENT
End
Note: To cancel the clear after pressing the DEL key, press the CLR key.
192
Add Instruction
The Add Instruction procedure allows the user to enter new mnemonic programs, one instruction at a
time. In the example below, the small rung of ladder shown is entered one step at a time, as described
in the Operating Procedure table.
Ladder Program
R0.1
R0.2
R15.3
(OUT)
R15.3
Mnemonic Program
STR
OR
ANN
OUT
R0.1
R15.3
R0.2
R15.3
Operating Procedure
Display
Key Sequence
LED
5-Digit Display
Remarks
End
Clears program
STR R 1 INS
STR R
STR
R0.1
OR R 1 5 0 3 INS
OR R
1503
OR
R15.3
AND NOT R
ANN
R0.2
OUT R 1 5 0 3 INS
OUT R
1503
OUT
R15.3
End
193
Monitor Program
The Monitor Program procedure allows the user to view the currently running program in the D50
PLC. There are two ways to select the portion of the program to monitor, either by consecutively
selecting the next or previous step, or by searching for a particular step.
Function: Step forward (and back) through the program instructions in the D50 PLC
Ladder Program
R0.1
K15.2
(OUT)
K15.2
K15.2
R16.3
D = M15
S1 = R15
S2 = K3
Mnemonic Program
R0.1
K15.2
K15.2
K15.2
R16.3
30
30
TC30
M15
R15
Ch = 30
SV = 30
MUL
K15.2
STR
OR
OUT
STR
ANN
TIM
STR
MUL
TIM
K3
194
Operating Procedure
Display
Key Sequence
5-Digit Display
Remarks
NXT
STR R
LED
00001
STR
R0.1
NXT
OR K
01502
OR
K15.2
NXT
OUT K
01502
OUT
K15.2
NXT
STR K
01502
STR
K15.2
ENT
0.0.0.0.3.
NXT
0.0.0.0.4.
ENT
AND NOT R
01603
ANN
R15.3
NXT
OUT TIM
Ch030
TIM
30
30
00030
TIM
30
30
NXT
NXT
STR TC
NXT
030
STR
TC30
Fn039
MUL
M15
R15
K3
NXT
00015
MUL
M15
R15
K3
NXT
00015
MUL
M15
R15
K3
00003
MUL
M15
R15
K3
NXT
End
Note: By pressing the PRE key at any time, the previous instruction will be displayed.
195
Ladder Program
LET
R0.0
M0.5
D = K0
S=0
R0.0
R
INC
D = K0
DEC
D = K0
==
R15.1
(OUT)
A = K15.4
B = 20
R0.0
M8.15
M0.1
M8.15
Mnemonic Program
STR
LET
STR
AND
INC
DEC
STR==
OUT
STR
AND
OUT
STN
AND
LET
R0.0
K0
M0.5
DIF
K0
K0
K15.4
R15.1
R0.0
M8.15
R15.2
M0.1
M8.15
K1
0
R0.0
R15.1
R15.2
(OUT)
LET
D = K1
S=2
196
Operating Procedure
Display
Key Sequence
LED
SHF 0 9 9 9 SCH
5-Digit Display
Remarks
End
00000
SHF 0 0 SCH
STR R
SHF 0 3 SCH
AND DIF R
00000
AND M 8 1 5 SCH
AND M
00815
SCH
AND M
00815
Continue search
SHF 0 8 SCH
STR R
00000
NXT
AND M
00815
PRE
STR R
00000
PRE
OUT R
01501
197
Edit Program
The D50PGM10 pocket editor provides the user the ability to insert, delete, or change an instruction in
the D50 PLC. Each of the three procedures is illustrated on the following pages.
Insert Instruction
In the example below, one contact is inserted in the rung of ladder, as shown.
Ladder Program
R0.1
R15.3
(OUT)
R15.3
R0.1
M1.8
R15.3
(OUT)
R15.3
Mnemonic Program
STR
OR
OUT
R0.1
R15.3
R15.3
STR
OR
AND
OUT
R0.1
R15.3
M1.8
R15.3
Operating Procedure
Display
Key Sequence
LED
5-Digit Display
Remarks
OUT R 1 5 0 3 SCH
OUT R
01503
AND M 1 0 8 INS
AND M
108
OUT R
01503
AND M
00108
PRE
198
Delete Instruction
In the example below, one contact is deleted from the rung of ladder, as shown.
Ladder Program
R0.1
M0.5
K15.4
(OUT)
K15.2
R0.1
K15.4
(OUT)
K15.2
Mnemonic Program
STR
OR
ANN
OUT
R0.1
K15.2
M0.5
K15.4
STR
OR
OUT
R0.1
K15.2
K15.4
Operating Procedure
Display
Key Sequence
LED
5-Digit Display
Remarks
AND NOT M
DEL
AND NOT M
d.0005
ENT
OUT K
01504
Change Instruction
In the example below, the address of one contact is changed in the rung of ladder, as shown.
Ladder Program
R0.3
M12.14
TIM
R0.3
K0.3
TIM
Ch = 10
SV = 240
Ch = 10
SV = 240
Mnemonic Program
STR
AND
TIM
R0.3
M12.14
10
240
STR
ANN
TIM
R0.3
K0.3
10
240
Operating Procedure
Display
5-Digit Display
Remarks
AND M 1 2 1 4 SCH
AND M
01214
AND NOT K
NXT
OUT TIM
ch010
PRE
AND NOT K
00003
Key Sequence
LED
199
200
Error Checking
The D50 has built-in error-checking routines that can check the PLC program for syntax errors such as
multiple output coils using the same reference, invalid coil addresses, and so on. The D50 pocket
editor can request an error check from the D50 PLC using the SHF and CHK keys.
To start the error check, press the SHF key, and then the CHK key. If errors are detected, the 5 digit
display will show an E followed by a two-digit error code. If no errors are detected, the current
instruction will be display with no change.
Function: Check the program in the D50 PLC for syntax errors
Error Codes
Error Number
Error Name
Error Description
E10
I/O Overrange
E11
T/C Overrange
E12
Word Overrange
E13
Illegal Code
E14
E15
System Operation
E16
E17
I/O Mismatch
E18
JMP/CALL
E19
E20
JMPS/JMPE
E21
FOR/NEXT
E22
SBR/RET
E23
END
E30
Not Found
E31
CPU Running
E32
Overrange Error
201
Monitor I/O
There are two types of monitoring that the pocket editor can perform. The first type is bit monitoring,
which displays the state of a given contact or coil in the program. The second type of monitoring is
register monitoring, which displays the 16-bit value of any user-specified register address. The
monitor mode can also be used to force output bits to a given state, On or Off.
Bit Monitoring
I/O bits (contacts and coils) can only be monitored through the PLC program. At each step in the PLC
program, the ON LED will reflect the state of the bit address in that step of the program. If the ON
LED is lit, the bit address displayed is in the On state.
Ladder Program
R0.1
R15.0
(OUT)
R0.1
Mnemonic Program
STR
ORN
OUT
R0.1
R0.1
R15.0
Operating Procedure
Display
Key Sequence
OUT R 1 5 0 0 SCH
LED
OUT ON R
5-Digit Display
Remarks
01500
202
Register Monitoring
Any valid register address can be monitored using the register monitor mode of the pocket editor. In
this mode, the register is continuously updated from the D50 PLC, and can be changed by the user.
To enter the monitor register mode, press the SHF key, the register address, and then the MON (DIF)
key. Use the NXT and PRE keys to move to the next or previous register address. To change the
value, press the 0 (NOT) key, followed by the new value and the enter (ENT) key. To display the
address of the register being monitored, press the ENT key. To exit the monitor register mode, press
the Clear (CLR) key.
Operating Procedure
Display
Key Sequence
5-Digit Display
Remarks
SHF W 0 MON
LED
00000
NXT
00000
00001
ENT
PRE
00000
ENT
00000
1 2 3
123
ENT
00123
CLR
End
203
Force Outputs
The states of output coils can be forced On or Off in the D50 PLC. The output to be forced must be an
output that has been programmed in the PLC. The SET and RST keys are used for Force On and Force
Off, respectively. Using the NXT or PRE keys will clear the force from the coil and move to the next
or previous instruction. The CLR key will remove the force while continuing to display that
instruction.
Ladder Program
R0.1
R0.3
R15.1
(OUT)
M0.0
R0.4
R15.2
(OUT)
K1.2
R1.2
R17.3
(OUT)
Mnemonic Program
STR
AND
OUT
STR
OR
AND
OUT
STR
OUT
R0.1
R0.3
R15.1
M0.0
K1.2
R0.4
R15.2
R1.2
R17.3
Operating Procedure
Display
Key Sequence
LED
5-Digit Display
Remarks
OUT R 1 5 0 1 SCH
OUT R
01501
SET ENT
OUT ON R
01501
Force ON
RST ENT
OUT R
01501
Force OFF
SET ENT
OUT ON R
01501
Force ON
NXT
STR M
00000
OUT R 1 7 0 3 SCH
OUT ON R
01703
Find instruction
RST ENT
OUT R
01703
Force OFF
SET ENT
OUT ON R
01703
Force ON
CLR
OUT ON R
01703
204
Run/Stop PLC
When the RUN/STOP switch on the D50 PLC is in the RUN position, the mode can be overridden by
the pocket editor. To place the D50 PLC in STOP, press the INS key, followed by the RST key. To
return the PLC to the RUN mode, press the INS key followed by the SET key.
Operating Procedure
Display
Key Sequence
INS
LED
RUN
RST
INS
SET
RUN
5-Digit Display
Remarks
AUX
End
PLC is stopped
AUX
End
Instruction Codes
The following tables list the key sequences required to enter each of the mnemonic instructions
supported by the D50 PLC.
Basic Instructions
Mnemonic
Instruction
Display
Key Sequence
LED
STR
STR
STR
STN
STR NOT
STR NOT
AND
AND
AND
ANN
AND NOT
AND NOT
OR
5-Digit Display
OR
OR
ORN
OR NOT
OR NOT
ANB
AND MCS
AND MCS
ORB
OR MCS
OR MCS
OUT
OUT
OUT
NOT
NOT
NOT
MCS
MCS
MCS
MCR
MCR
MCR
SET
SET
SET
RST
RST
RST
STR DIF
STR DIF
STR DIF
AND DIF
AND DIF
AND DIF
OR DIF
OR DIF
STR DFN
AND DFN
OR DIF NOT
OR DIF NOT
TIM
OUT TIM
OUT TIM
ch
SST
OUT SST
OUT SST
ch
UC
OUT CNT
OUT CNT
UC
DC
OUT CNT
dC
OUT CNT
Ud
OR DIF
OR DFN
UDC
205
206
Advanced Instructions
Instruction
Function No.
Instruction
Function No.
STR ==S1, S2
FUN 1
ADD D, S1, S2
FUN 35
AND ==S1, S2
FUN 2
ADC D, S1, S2
FUN 36
OR ==S1, S2
FUN 3
SUB D, S1, S2
FUN 37
FUN 4
SBC D, S1, S2
FUN 38
FUN 5
MUL D, S1, S2
FUN 39
OR <> S1, S2
FUN 6
DIV D, S1, S2
FUN 40
FUN 7
ADDB D, S1, S2
FUN 41
FUN 8
ADCB D, S1, S2
FUN 42
OR > S1, S2
FUN 9
SUBB D, S1, S2
FUN 43
FUN 10
SBCB D, S1, S2
FUN 44
FUN 11
MULB D, S1, S2
FUN 45
OR <= S1, S2
FUN 12
DIVB D, S1, S2
FUN 46
FUN 13
WAND D, S1, S2
FUN 47
FUN 14
WOR D, S1, S2
FUN 48
OR >= S1, S2
FUN 15
XOR D, S1, S2
FUN 49
FUN 16
XNR D, S1, S2
FUN 50
FUN 17
XCHG D1, D2
FUN 51
OR < S1, S2
FUN 18
LDR D, Sr
FUN 52
INC D
FUN 19
STO Sr, D
FUN 53
DEC D
FUN 20
FOR D
FUN 54
INCB D
FUN 21
FUN 55
DECB D
FUN 22
AND D==S1, S2
FUN 56
ABS D
FUN 23
OR D==S1, S2
FUN 57
NEG D
FUN 24
FUN 58
NOT D
FUN 25
FUN 59
RLC D, N
FUN 26
OR D<> S1, S2
FUN 60
RRC D, N
FUN 27
FUN 61
ROL D, N
FUN 28
FUN 62
ROR D, N
FUN 29
OR D> S1, S2
FUN 63
SHL D, N
FUN 30
FUN 64
SHR D, N
FUN 31
FUN 65
LET D, S
FUN 32
OR D<= S1, S2
FUN 66
BCD D, S
FUN 33
FUN 67
BIN D, S
FUN 34
FUN 68
Instruction
Function No.
Instruction
Function No.
OR D>= S1, S2
FUN 69
DOR D, S1, S2
FUN 102
FUN 70
DXOR D, S1, S2
FUN 103
FUN 71
DXNR D, S1, S2
FUN 104
OR D< S1, S2
FUN 72
DXCHG D1, D2
FUN 105
DINC D
FUN 73
DLDR D, Sr
FUN 106
DDEC D
FUN 74
DSTO Sr, D
FUN 107
DINCB D
FUN 75
DFOR D
FUN 108
DDECB D
FUN 76
DIS D, Nd, Sr
FUN 109
DABS D
FUN 77
UNI D, Sr, Nd
FUN 110
DNEG D
FUN 78
MOV D, Sr, Ns
FUN 111
DNOT D
FUN 79
FMOV D, Ns, V
FUN 112
DRLC D, N
FUN 80
BMOV D, Sr, Ns
FUN 113
DRRC D, N
FUN 81
BFMV D, Ns, V
FUN 114
DROL D, N
FUN 82
BSET D, N
FUN 115
DROR D, N
FUN 83
BRST D, N
FUN 116
DSHL D, N
FUN 84
BNOT D, N
FUN 117
DSHR D, N
FUN 85
BTST D, N
FUN 118
DLET D, S
FUN 86
DECO D, S
FUN 119
DBCD D, S
FUN 87
ENCO D, S
FUN 120
DBIN D, S
FUN 88
SEG D, S
FUN 121
DADD D, S1, S2
FUN 89
SUM D, S
FUN 122
DADC D, S1, S2
FUN 90
JMP L
FUN 123
DSUB D, S1, S2
FUN 91
CALL Sb
FUN 124
DSBC D, S1, S2
FUN 92
LBL L
FUN 125
DMUL D, S1, S2
FUN 93
SBR Sb
FUN 126
DDIV D, S1, S2
FUN 94
JMPS
FUN 127
DADDB D, S1, S2
FUN 95
NEXT
FUN 128
DADCB D, S1, S2
FUN 96
SC
FUN 129
DSUBB D, S1, S2
FUN 97
RC
FUN 130
DSBCB D, S1, S2
FUN 98
CC
FUN 131
DMULB D, S1, S2
FUN 99
JMPE
FUN 132
DDIVB D, S1, S2
FUN 100
RET
FUN 133
DAND D, S1, S2
FUN 101
END
FUN 134
207
208
Programming Examples
The following pages present some very basic programming examples, showing how to enter mnemonic
code into the D50 PLC using the pocket editor. Each example program is devided into three sections;
the ladder program, the equivalent mnemonic code, and the key sequence for entering the program
using the pocket editor
M0.0
M0.2
M0.1
M0.3
M0.4
M1.0
M1.1
M1.2
F0.15
Mnemonic Program
STR
MCS
STR
OR
STR
OR
ANB
NOT
OUT
STR
AND
STR
AND
ORB
OUT
STR
MCR
R0.3
M0.0
M0.1
M0.2
M0.3
M0.4
M0.4
M1.0
M1.1
M1.2
R15.2
F0.15
(MCS)
M0.4
(OUT)
R15.2
(OUT)
(MCR)
Operating Procedure
Display
Key Sequence
LED
STR R 3 INS
STR R
MCS INS
MCS
5-Digit Display
Mnemonic Instruction
STR
R0.3
MCS
STR M 0 INS
STR M
STR
M0.0
OR M 1 INS
OR M
OR
M0.1
STR M 2 INS
STR M
STR
M0.2
OR M 3 INS
OR M
OR
M0.3
AND MCS
ANB
NOT INS
NOT
NOT
OUT M 4 INS
OUT M
STR M 4 INS
STR M
AND M 1 0 0 INS
AND M
STR M 1 0 1 INS
OUT
M0.4
STR
M0.4
100
AND
M1.0
STR M
101
STR
M1.1
AND M 1 0 2 INS
AND M
102
AND
M1.2
OR MCS INS
OR MCS
OUT R 1 5 0 2 INS
OUT R
1502
OUT
R15.2
STR F 1 5 INS
STR F
15
STR
F0.15
MCR INS
MCR
ORB
MCR
209
210
TIM
M14.14
SST
Ch = 255
SV = 100
Ch = 254
SV = 50
TC255
M5.2
(SET)
TC254
M0.10
(RST)
Mnemonic Program
STR
TIM
STR
SST
STR
SET
STR
RST
R1.3
255
100
M14.14
254
50
TC255
M5.2
TC254
M0.10
Operating Procedure
Display
Key Sequence
5-Digit Display
Mnemonic Instruction
STR R 1 0 3 INS
STR R
LED
103
STR
R1.3
OUT TIM
ch255
TIM
255
100
100
100
TIM
255
STR M 1 4 1 4 INS
STR M
1414
STR
M14.14
OUT SST
ch254
SST
254
50
50
SST
254
50
1 0 0 INS
5 0 INS
STR TIM 2 5 5 INS
STR TC
255
STR
TC255
SET M 5 0 2 INS
STR M
502
SET
M5.2
STR TC
254
STR
TC254
RST M 1 0
RST M
10
RST
M0.10
UC
U Ch = 25
SV = 100
M0.11
R
M0.12
DC
D Ch = 255
SV = 100
M0.13
R
TC25
M0.11
(SET)
TC255
M0.13
(SET)
Mnemonic Program
STR
STR
UC
STR
STR
DC
STR
SET
STR
SET
M0.10
M0.11
25
100
M0.12
M0.13
255
100
TC25
M0.11
TC255
M0.13
211
212
Operating Procedure
Display
Key Sequence
5-Digit Display
Mnemonic Instruction
STR M 1 0 INS
STR M
LED
10
STR
M0.10
STR M 1 1 INS
STR M
11
STR
M0.11
OUT CNT
1 0 0 INS
UC 25
UC
25
100
100
UC
25
100
STR M 1 2 INS
STR M
12
STR
M0.12
STR M 1 3 INS
STR M
13
STR
M0.13
OUT CNT
OUT CNT
UC
NXT
OUT CNT
dC
DC
255
100
2 5 5 ENT
OUT CNT
dC255
DC
255
100
100
100
DC
255
STR TC
25
STR
TC25
SET M 1 1 INS
SET M
11
SET
M0.11
STR TC
255
STR
TC255
SET M 1 3 INS
SET M
13
SET
M0.13
1 0 0 INS
INC
A = K0
B = K1
D = K4
==
A = 100
B = K3
Mnemonic Program
STR== K0
OR== 100
INC
K4
K1
K3
Operating Procedure
Display
Key Sequence
5-Digit Display
Mnemonic Instruction
SHF FUN 1
Fn 1
STR== K0
K1
ENT
S1
STR== K0
K1
K 0
LED
STR== K0
K1
ENT
Fn. 1
STR== K0
K1
INS
End
SHF FUN 3
Fn 3
OR==
100
K3
ENT
S1
1 0 0
100
OR==
100
K3
ENT
S2
3
OR==
100
K1
ENT
Fn. 3
OR==
100
K1
INS
End
SHF FUN 1 9
Fn 19
INC
K4
ENT
K 1
K 3
S2
ENT
d
4
INC
K4
ENT
Fn. 19
INC
K4
INS
End
K 4
213
214
SEP
SEIT
CURSO: CONTROLADOR
PRACTICA NO.1.
LOGICO PROGRAMABLE.
OBJETIVOS DE LA PRACTICA.
AL TERMINO DE ESTA PRACTICA USTED SERA CAPAZ DE:
MEDIDAS DE SEGURIDAD.
DESARROLLO PRACTICO.
1.
2.
3.
ESPECIFICACIONES GENERALES.
CONCEPTO
TENSION DE ALIMENTACION
MAXIMO CONSUMO DE
POTENCIA
TEMPERATURA AMBIENTE
DE OPERACIN
HUMEDAD DE OPERACIN
RESISTENCIA A LA
VIBRACION
RESISTENCIA AL RUIDO
RESISTENCIA DE
AISLAMIENTO
RESISTENCIA AL IMPACTO
VELOCIDAD DE
PROCESAMIENTO
CAPACIDAD DE LA
MEMORIA DEL USUARIO
TIPO DE MEMORIA
NO.DE INSTRUCCIONES
BASICAS
NO.DE INSTRUCCIONES DE
COMPARASION
NO.DE INSTRUCCIONES
ARITMETICAS
NO.DE INSTRUCCIONES
ESPECIALES
NO.DE PUNTOS EXTERNOS
DE I/O
NO.DE SALIDAS INTERNAS
RETENTIVAS
NO.DE SALIDAS INTERNAS
NO RETENTIVAS
NO.SALIDAS INTERNAS
ESPECIALES
NO.DE PALABRAS INTERNAS
DE SALIDA
NO.DE TEMPORIZADORES Y
CONTADORES
NO.DE TEMPORIZADORES
DE 0.01 S
NO.DE TEMPORIZADORES
DE 0.1 S
NO.DE CONTADORES DE
ALTA VELOCIDAD
NO.DE SALIDAS DE PULSO
VELOCIDAD DEL PUERTO DE
COMUNICACIN
TIPO DE CONVERTIDOR DE
PROTOCOLO
ESPECIFICACION
CIRCUITO
DE
CONFIGURACION
ALAMBRADO EXTERNO
ESPECIFICACION
MAX.
MAX.
CIRCUITO DE CONFIGURACION Y
ALAMBRADO EXTERNO
ESPECIFICACION
CAPACIDAD DEL
DISPLAY
NO.DE TECLAS
ESPECIFICACION
4.
TERMINALES
DE ENTRADA
C-0
C-1
C-2
C-3
C-4
C-5
C-6
C-7
C-0
C-1
C-2
C-3
C-4
C-5
C-6
C-7
C-0
C-1
C-2
C-3
C-4
C-5
C-6
C-7
C-0
C-1
C-2
C-3
C-4
C-5
C-6
C-7
DIRECCION DE
ENTRADA
TERMINALES
DE SALIDA
C-0
C-1
C-2
C-3
C-4
C-5
--C-0
C-1
C-2
C-3
C-4
C-5
--C-0
C-1
C-2
C-3
C-4
C-5
--C-0
C-1
C-2
C-3
C-4
C-5
---
DIRECCION DE
SALIDA
5.
6.
CAPACIDAD
NUMERO DE
BIT
NUMERO DE
PALABRA
OBSERVACIONES
RELEVADORES
AUXILIARES
RELEVADORES
RETENTIVOS
RELEVADORES
ESPECIALES
REGISTROS
ARITMETICOS
7.
TERMINAL DE
ENTRADA/SALIDA
C-0
C-1
C-4
C-5
C-7
C-2
C-3
C-5
C-6
C-7
C-O
C-1
C-2
C-1
C-2
C-3
C-4
C-5
8.
10
VO.BO._________________
CONCLUSIONES.
CUESTIONARIO.
1.
2.
3.
4.
5.
6.
QU SIGNIFICA PLC?
QUE ENTIENDE POR HARDWARE?
A QUE SE LE LLAMA DIRECCION DE ENTRADA Y/O SALIDA?
EN QUE POSICION SE DEBE COLOCAR EL INTERRUPTOR DE ESTADO DEL PLC PARA QUE
SE EJECUTE EL PROGRAMA DEL USUARIO?
USO DEL CONVERTIDOR DE PROTOCOLO?
MENCIONA LOS DISPOSITIVOS DE PROGRAMACION MS COMUNES QUE UTILIZA UN
PLC.
REFERENCIA BIBLIOGRAFICA.
SEP
11
SEMS
LOGICO PROGRAMABLE.
LISTA DE COTEJO
PRACTICA NO.1.
NO.
1
4
5
REACTIVO
CUMPLIMIENTO
SI
NO
OBSERVACIN
CAPACITANDO
_____________________________
NOMBRE Y FIRMA
EVALUADOR
________________________
NOMBRE Y FIRMA
SEP
SEIT
CURSO: CONTROLADOR
PRACTICA NO.2.
LOGICO PROGRAMABLE.
OBJETIVOS DE LA PRACTICA.
AL TERMINO DE ESTA PRACTICA USTED SERA CAPAZ DE:
MEDIDAS DE SEGURIDAD.
DESARROLLO PRACTICO.
SECUENCIA DE TECLAS
A: ENTER
MD GPC ENTER
CD GPC ENTER
MD PLCD50 ENTER
CD PLCD50 ENTER
MD LADDER ENTER
FUNCION
CAMBIO A LA UNIDAD DE DISCO FLEXIBLE
CREACION DEL DIRECTORIO GPC
CAMBIO AL DIRECTORIO GPC
CREACION DEL DIRECTORIO PLCD50
CAMBIO AL DIRECTORIO PLCD50
CREACION DEL DIRECTORIO LADDER
FUNCION
CAMBIO A LA UNIDAD "C" DEL DISCO DURO
CAMBIO AL DIRECTORIO RAIZ DE "C"
CAMBIO AL DIRECTORIO "GPC"
EJECUCION DEL PROGRAMA "GPC"
CON
AYUDA
DE
LAS
TECLAS
DE
9.
10.
11.
12.
13.
14.
CONCLUSIONES.
CUESTIONARIO.
1.
2.
3.
4.
5.
REFERENCIA BIBLIOGRAFICA.
SEP
SEIT
LOGICO PROGRAMABLE.
LISTA DE COTEJO
PRACTICA NO.2.
NO.
1
2
3
4
5
6
7
REACTIVO
CUMPLIMIENTO
SI
NO
OBSERVACIN
CAPACITANDO
_____________________________
NOMBRE Y FIRMA
EVALUADOR
________________________
NOMBRE Y FIRMA
SEP
SEIT
CURSO: CONTROLADOR
PRACTICA NO.4.
LOGICO PROGRAMABLE.
INSTRUCCIONES DE ENTRADA-SALIDA
OBJETIVOS DE LA PRACTICA.
AL TERMINO DE ESTA PRACTICA USTED:
MEDIDAS DE SEGURIDAD.
DESARROLLO PRACTICO.
2. TABLA DE ASIGNACIONES.
PARA RESOLVER LAS TAREAS ANTERIORES LLENE LA SIGUIENTE TABLA CON EL
OBJETO DE ESTABLECER LAS ENTRADAS Y SALIDAS QUE UTILIZARA DEL PLC
IDENTIFICANDO SU RESPECTIVA DIRECCION ADEMAS DE SU ETIQUETA,
DENOMINACION Y COMENTARIO.
UNIDAD PRINCIPAL.
ENTRADA
DIRECCION
DENOMINACION
ETIQUETA
COMENTARIO
DIRECCION
DENOMINACION
ETIQUETA COMENTARIO
C-0
C-1
C-2
C-3
C-4
C-5
C-6
C-7
SALIDA
C-0
C-1
C-2
C-3
C-4
C-5
UNIDAD DE EXPANSION.
ENTRADA
DIRECCION
DENOMINACION
ETIQUETA
DIRECCION
DENOMINACION
ETIQUETA
COMENTARIO
C-0
C-1
C-2
C-3
C-4
C-5
C-6
C-7
SALIDA
C-0
C-1
C-2
C-3
C-4
C-5
COMENTARIO
3. PROGRAMACION.
EFECTUE EL PROGRAMA EN DIAGRAMA DE CONTACTOS (ESCALERA), EN LISTA DE
INSTRUCCIONES Y DETERMINE LA SECUENCIA DE TECLAS DEL PROGRAMADOR QUE
RESUELVA LOS PLANTEAMIENTOS ANTERIORES.
PROGRAMADOR DE
BOLSILLO
PROGRAMA EN LENGUAJE:
LISTA DE INSTRUCCIONES
DIAGRAMA DE ESCALERA
(LADDER)
Al oprimir los botones 0, 1 y 2 N.A.
se activa la lampara 0.
Se apaga la lampara 3
botones 3 o 4 N.C.
(MNEMONICOS)
PASO
COMANDO
OPERANDOS
PGM-10
SECUENCIA DE
TECLAS
4.
DIAGRAMA DE ALAMBRADO.
REALISE EL DIAGRAMA DE CONEXIONES ENTRE LOS DISPOSITIVOS DE ENTRADA Y
SALIDA CON EL PLC QUE RESUELVA LOS PLANTEAMIENTOS ANTERIORES.
5.
6.
7. COMPROBACION DE FUNCIONAMIENTO.
DE ACUERDO A SU DIAGRAMA DE ALAMBRADO CONECTE LOS DISPOSITIVOS DE
ENTRADA/SALIDA AL CONTROLADOR Y VERIFIQUE QUE LA SOLUCION DE SU
PROGRAMA EN DIAGRAMA DE ESCALERA SATISFAGA LAS CONDICIONES DE LOS
PROBLEMAS PLANTEADOS.
EN CASO CONTRARIO MODIFIQUE SU PROGRAMA HASTA CUMPLIR CON LO REQUERIDO.
SOLICITE EL VISTO BUENO.
VO.BO._________________
UNA VEZ COMPROBADO EL CORRECTO FUNCIONAMIENTO DEL PROGRAMA, LIMPIE
TOTALMENTE LA MEMORIA DEL USUARIO E INGRESE AHORA LAS INSTRUCCIONES A
TRAVES DEL PROGRAMADOR.
REVISE NUEVAMENTE EL FUNCIONAMIENTO DEL PROGRAMA.
SOLICITE EL VISTO BUENO
VO,BO._________________
CONCLUSIONES.
CUESTIONARIO.
1.
2.
3.
4.
5.
REFERENCIA BIBLIOGRAFICA.
SEP
SEIT
LOGICO PROGRAMABLE.
LISTA DE COTEJO
PRACTICA NO.4.
INSTRUCCIONES DE ENTRADA-SALIDA
NO.
1
2
3
4
5
6
7
8
REACTIVO
CUMPLIMIENTO
S
NO
OBSERVACIN
CAPACITANDO
_____________________________
NOMBRE Y FIRMA
EVALUADOR
________________________
NOMBRE Y FIRMA
TEMPORIZADORES.
SEP
SEIT
CURSO: CONTROLADOR
PRACTICA NO.5.
LOGICO PROGRAMABLE.
TEMPORIZADORES.
OBJETIVOS DE LA PRACTICA.
AL TERMINO DE ESTA PRACTICA USTED:
MEDIDAS DE SEGURIDAD.
TEMPORIZADORES.
DESARROLLO PRACTICO.
TEMPORIZADORES.
2. TABLA DE ASIGNACIONES.
PARA RESOLVER LAS TAREAS ANTERIORES LLENE LA SIGUIENTE TABLA CON EL
OBJETO DE ESTABLECER LAS ENTRADAS Y SALIDAS QUE UTILIZARA DEL PLC
IDENTIFICANDO SU RESPECTIVA DIRECCION ADEMAS DE SU ETIQUETA,
DENOMINACION Y COMENTARIO.
UNIDAD PRINCIPAL/UNIDAD DE EXPANSION.
ENTRADA
DIRECCION
DENOMINACION
ETIQUETA
DIRECCION
DENOMINACION
ETIQUETA
COMENTARIO
C-0
C-1
C-2
C-3
C-4
C-5
C-6
C-7
SALIDA
C-0
C-1
C-2
C-3
C-4
C-5
COMENTARIO
TEMPORIZADORES.
3. PROGRAMACION.
EFECTUE EL PROGRAMA EN DIAGRAMA DE CONTACTOS (ESCALERA), EN LISTA DE
INSTRUCCIONES Y DETERMINE LA SECUENCIA DE TECLAS DEL PROGRAMADOR QUE
RESUELVA LOS PLANTEAMIENTOS ANTERIORES.
PROGRAMADOR DE
BOLSILLO
PROGRAMA EN LENGUAJE:
LISTA DE INSTRUCCIONES
DIAGRAMA DE ESCALERA
(LADDER)
Lampara con retardo al encendido
.
Lampara con intermitencia.
a.
(MNEMONICOS)
PASO
COMANDO
OPERANDOS
PGM-10
SECUENCIA DE
TECLAS
TEMPORIZADORES.
PROGRAMADOR DE
BOLSILLO
PROGRAMA EN LENGUAJE:
LISTA DE INSTRUCCIONES
DIAGRAMA DE ESCALERA
(LADDER)
Semforo en modo ciclo nico.
(MNEMONICOS)
PASO
COMANDO
OPERANDOS
PGM-10
SECUENCIA DE
TECLAS
TEMPORIZADORES.
4.
DIAGRAMA DE ALAMBRADO.
REALISE EL DIAGRAMA DE CONEXIONES ENTRE LOS DISPOSITIVOS DE ENTRADA Y
SALIDA CON EL PLC QUE RESUELVA LOS PLANTEAMIENTOS ANTERIORES.
TEMPORIZADORES.
5.
6.
7. COMPROBACION DE FUNCIONAMIENTO.
DE ACUERDO A SU DIAGRAMA DE ALAMBRADO CONECTE LOS DISPOSITIVOS DE
ENTRADA/SALIDA AL CONTROLADOR Y VERIFIQUE QUE LA SOLUCION DE SU
PROGRAMA EN DIAGRAMA DE ESCALERA SATISFAGA LAS CONDICIONES DE LOS
PROBLEMAS PLANTEADOS.
EN CASO CONTRARIO MODIFIQUE SU PROGRAMA HASTA CUMPLIR CON LO REQUERIDO.
SOLICITE EL VISTO BUENO.
VO.BO._________________
UNA VEZ COMPROBADO EL CORRECTO FUNCIONAMIENTO DEL PROGRAMA, LIMPIE
TOTALMENTE LA MEMORIA DEL USUARIO E INGRESE AHORA LAS INSTRUCCIONES A
TRAVES DEL PROGRAMADOR.
REVISE NUEVAMENTE EL FUNCIONAMIENTO DEL PROGRAMA Y SOLICITE EL VISTO
BUENO.
VO,BO._________________
TEMPORIZADORES.
CONCLUSIONES.
CUESTIONARIO.
1.
2.
3.
4.
5.
6.
REFERENCIA BIBLIOGRAFICA.
TEMPORIZADORES.
SEP
SEIT
LOGICO PROGRAMABLE.
LISTA DE COTEJO
PRACTICA NO.5.
TEMPORIZADORES
NO.
1
2
3
4
5
6
7
8
REACTIVO
CUMPLIMIENTO
S
NO
OBSERVACIN
CAPACITANDO
_____________________________
NOMBRE Y FIRMA
EVALUADOR
________________________
NOMBRE Y FIRMA
CONTADORES.
SEP
SEIT
CURSO: CONTROLADOR
PRACTICA NO.6.
LOGICO PROGRAMABLE
CONTADORES.
OBJETIVOS DE LA PRACTICA.
AL TERMINAR ESTA PRACTICA USTED:
MEDIDAS DE SEGURIDAD.
CONTADORES.
DESARROLLO PRACTICO.
CONTADORES.
2. TABLA DE ASIGNACIONES.
PARA RESOLVER LAS TAREAS ANTERIORES LLENE LA SIGUIENTE TABLA CON EL
OBJETO DE ESTABLECER LAS ENTRADAS Y SALIDAS QUE UTILIZARA DEL PLC
IDENTIFICANDO SU RESPECTIVA DIRECCION ADEMAS DE SU ETIQUETA,
DENOMINACION Y COMENTARIO.
UNIDAD PRINCIPAL/UNIDAD DE EXPANSION.
ENTRADA
DIRECCION
DENOMINACION
ETIQUETA
DIRECCION
DENOMINACION
ETIQUETA
COMENTARIO
C-0
C-1
C-2
C-3
C-4
C-5
C-6
C-7
SALIDA
C-0
C-1
C-2
C-3
C-4
C-5
COMENTARIO
CONTADORES.
3. PROGRAMACION.
EFECTUE EL PROGRAMA EN DIAGRAMA DE CONTACTOS (ESCALERA), EN LISTA DE
INSTRUCCIONES Y DETERMINE LA SECUENCIA DE TECLAS DEL PROGRAMADOR QUE
RESUELVA LOS PLANTEAMIENTOS ANTERIORES.
PROGRAMADOR DE
BOLSILLO
PROGRAMA EN LENGUAJE:
LISTA DE INSTRUCCIONES
DIAGRAMA DE ESCALERA
(LADDER)
Alarma 0 activada al oprimir tres veces el botn 0.
La alarma se desactiva al presionar el botn 1.
(MNEMONICOS)
PASO
COMANDO
OPERANDOS
PGM-10
SECUENCIA DE
TECLAS
CONTADORES.
PROGRAMADOR DE
BOLSILLO
PROGRAMA EN LENGUAJE:
LISTA DE INSTRUCCIONES
DIAGRAMA DE ESCALERA
(LADDER)
Lampara con intermitencia continua.
Al presionar el botn 2 solo funcionara durante 4 ciclos
completos
(MNEMONICOS)
PASO
COMANDO
OPERANDOS
PGM-10
SECUENCIA DE
TECLAS
CONTADORES.
4.
DIAGRAMA DE ALAMBRADO.
REALISE EL DIAGRAMA DE CONEXIONES ENTRE LOS DISPOSITIVOS DE ENTRADA Y
SALIDA CON EL PLC QUE RESUELVA LOS PLANTEAMIENTOS ANTERIORES.
CONTADORES.
5.
6.
7. COMPROBACION DE FUNCIONAMIENTO.
DE ACUERDO A SU DIAGRAMA DE ALAMBRADO CONECTE LOS DISPOSITIVOS DE
ENTRADA/SALIDA AL CONTROLADOR Y VERIFIQUE QUE LA SOLUCION DE SU
PROGRAMA EN DIAGRAMA DE ESCALERA SATISFAGA LAS CONDICIONES DE LOS
PROBLEMAS PLANTEADOS.
EN CASO CONTRARIO MODIFIQUE SU PROGRAMA HASTA CUMPLIR CON LO REQUERIDO.
SOLICITE EL VISTO BUENO.
VO.BO._________________
UNA VEZ COMPROBADO EL CORRECTO FUNCIONAMIENTO DEL PROGRAMA, LIMPIE
TOTALMENTE LA MEMORIA DEL USUARIO E INGRESE AHORA LAS INSTRUCCIONES A
TRAVES DEL PROGRAMADOR.
REVISE NUEVAMENTE EL FUNCIONAMIENTO DEL PROGRAMA Y SOLICITE EL VISTO
BUENO.
VO,BO._________________
CONTADORES.
CONCLUSIONES.
CUESTIONARIO.
1.
2.
3.
4.
5.
6.
REFERENCIA BIBLIOGRAFICA.
CONTADORES.
SEP
SEIT
LOGICO PROGRAMABLE.
LISTA DE COTEJO
PRACTICA NO.6.
CONTADORES
NO.
1
2
3
4
5
6
7
8
REACTIVO
CUMPLIMIENTO
S
NO
OBSERVACIN
CAPACITANDO
_____________________________
NOMBRE Y FIRMA
EVALUADOR
________________________
NOMBRE Y FIRMA