Sei sulla pagina 1di 374

Cat. No.

W130-E1-05

SYSMAC
Programmable Controllers

C200H
(CPU01-E/03-E/11-E)

OPERATION MANUAL
C200H Programmable Controllers
(CPU01-E/03-E/11-E)
Operation Manual
Revised June 2003
iv
Notice:
OMRON products are manufactured for use according to proper procedures by a qualified operator
and only for the purposes described in this manual.
The following conventions are used to indicate and classify precautions in this manual. Always heed
the information provided with them. Failure to heed precautions can result in injury to people or dam-
age to property.

! DANGER Indicates an imminently hazardous situation which, if not avoided, will result in death or
serious injury.

! WARNING Indicates a potentially hazardous situation which, if not avoided, could result in death or
serious injury.

! Caution Indicates a potentially hazardous situation which, if not avoided, may result in minor or
moderate injury, or property damage.

OMRON Product References


All OMRON products are capitalized in this manual. The word Unit is also capitalized when it refers
to an OMRON product, regardless of whether or not it appears in the proper name of the product.
The abbreviation Ch, which appears in some displays and on some OMRON products, often means
word and is abbreviated Wd in documentation in this sense.
The abbreviation PC means Programmable Controller and is not used as an abbreviation for any-
thing else.

Visual Aids
The following headings appear in the left column of the manual to help you locate different types of
information.
Note Indicates information of particular interest for efficient and convenient operation
of the product.

1, 2, 3... 1. Indicates lists of one sort or another, such as procedures, checklists, etc.

OMRON, 1990
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any
form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permis-
sion of OMRON.
No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is
constantly striving to improve its high-quality products, the information contained in this manual is subject to change
without notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no
responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the informa-
tion contained in this publication.

v
vi
TABLE OF CONTENTS
PRECAUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
1 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
2 General Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
3 Safety Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
4 Operating Environment Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
5 Application Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

SECTION 1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1-2 The Origins of PC Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1-3 PC Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1-4 OMRON Product Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1-5 Overview of PC Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1-6 Peripheral Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1-7 Available Manuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1-8 LSS Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

SECTION 2
Hardware Considerations . . . . . . . . . . . . . . . . . . . . . . . . . 11
2-1 Indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2-2 PC Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

SECTION 3
Memory Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3-1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3-2 Data Area Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3-3 IR (Internal Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3-4 SR (Special Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3-5 AR (Auxiliary Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3-6 DM (Data Memory) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3-7 HR (Holding Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3-8 TC (Timer/Counter) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3-9 LR (Link Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3-10 Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3-11 TR (Temporary Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

SECTION 4
Writing and Inputting the Program . . . . . . . . . . . . . . . . . 43
4-1 Basic Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4-2 Instruction Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4-3 Basic Ladder Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4-4 The Programming Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4-5 Preparation for Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4-6 Inputting, Modifying, and Checking the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4-7 Controlling Bit Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4-8 Work Bits (Internal Relays) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4-9 Programming Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4-10 Program Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

vii
TABLE OF CONTENTS
SECTION 5
Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5-1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5-2 Instruction Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5-3 Data Areas, Definer Values, and Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5-4 Differentiated Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
5-5 Coding Right-hand Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5-6 Ladder Diagram Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5-7 Bit Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5-8 INTERLOCK and INTERLOCK CLEAR IL(02) and ILC(03) . . . . . . . . . . . . . . . . . . . 108
5-9 JUMP and JUMP END JMP(04) and JME(05) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5-10 END END(01) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5-11 NO OPERATION NOP(00) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5-12 Timer and Counter Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5-13 Data Shifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
5-14 Data Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
5-15 Data Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5-16 Data Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5-17 BCD Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
5-18 Binary Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
5-19 Logic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
5-20 Subroutines and Interrupt Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
5-21 Step Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
5-22 Special Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
5-23 SYSMAC NET Link/SYSMAC LINK Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
SECTION 6
Program Execution Timing . . . . . . . . . . . . . . . . . . . . . . . . 219
6-1 Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
6-2 Calculating Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
6-3 Instruction Execution Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
6-4 I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
SECTION 7
Program Monitoring and Execution . . . . . . . . . . . . . . . . 237
7-1 Monitoring Operation and Modifying Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
7-2 Program Backup and Restore Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
SECTION 8
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
8-1 Alarm Indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
8-2 Programmed Alarms and Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
8-3 Reading and Clearing Errors and Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
8-4 Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
8-5 Error Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Appendices
A Standard Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
B Programming Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
C Programming Console Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
D Error and Arithmetic Flag Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
E Data Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
F Word Assignment Recording Sheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
G Program Coding Sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
H Data Conversion Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
I Extended ASCII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

viii
TABLE OF CONTENTS
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

ix
About this Manual:
The OMRON C200H PCs offer a simple but effective way to automate processing. Manufacturing,
assembly, packaging, and many other processes can be automated to save time and money.
This manual describes the characteristics and abilities of the PCs, as well as programming operations
and instructions and other aspects of operation and preparation. Before attempting to operate the PC,
thoroughly familiarize yourself with the information contained herein. Hardware information is pro-
vided in detail in the C200H PCs (CPU01-E/03-E/11-E) Installation Guide. A table of other manuals
that can be used in conjunction with this manual is provided at the end of Section 1 Introduction.
Section 1 Introduction explains the background and some of the basic terms used in ladder-dia-
gram programming. It also provides an overview of the process of programming and operating a PC
and explains basic terminology used with OMRON PCs. Descriptions of Peripheral Devices used with
the C200H PCs and a table of other manuals available to use with this manual for special PC applica-
tions are also provided.
Section 2 Hardware Considerations explains basic aspects of the overall PC configuration and de-
scribes the indicators that are referred to in other sections of this manual.
Section 3 Memory Areas takes a look at the way memory is divided and allocated and explains the
information provided there to aid in programming. It explains how I/O is managed in memory and how
bits in memory correspond to specific I/O points. It also provides information on System DM, a special
area in C200H PCs that provides the user with flexible control of PC operating parameters.
Section 4 Writing and Entering Programs explains the basics of ladder-diagram programming,
looking at the elements that make up the parts of a ladder-diagram program and explaining how exe-
cution of this program is controlled. It also explains how to convert ladder diagrams into mnemonic
code so that the programs can be entered using a Programming Console.
Section 5 Instruction Set describes all of the instructions used in programming.
Section 6 Program Execution Timing explains the scanning process used to execute the program
and tells how to coordinate inputs and outputs so that they occur at the proper times.
Section 7 Program Debugging and Execution explains the Programming Console procedures
used to input and debug the program and to monitor and control operation.
Finally, Section 8 Troubleshooting provides information on error indications and other means of re-
ducing down-time. Information in this section is also useful when debugging programs.
The Appendices provide tables of standard OMRON products available for the C200H PCs, refer-
ence tables of instructions and Programming Console operations, coding sheet to help in program-
ming and parameter input, and other information helpful in PC operation.

! WARNING Failure to read and understand the information provided in this manual may result in
personal injury or death, damage to the product, or product failure. Please read each
section in its entirety and be sure you understand the information provided in the section
and related sections before attempting any of the procedures or operations given.

xi
PRECAUTIONS
This section provides general precautions for using the Programmable Controller (PC) and related devices.
The information contained in this section is important for the safe and reliable application of the Programmable Con-
troller. You must read this section and understand the information contained before attempting to set up or operate a
PC system.

1 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv


2 General Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
3 Safety Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv
4 Operating Environment Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
5 Application Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

xiii
Safety Precautions 3

1 Intended Audience
This manual is intended for the following personnel, who must also have knowl-
edge of electrical systems (an electrical engineer or the equivalent).
Personnel in charge of installing FA systems.
Personnel in charge of designing FA systems.
Personnel in charge of managing FA systems and facilities.

2 General Precautions
The user must operate the product according to the performance specifications
described in the relevant manuals.
Before using the product under conditions which are not described in the manual
or applying the product to nuclear control systems, railroad systems, aviation
systems, vehicles, combustion systems, medical equipment, amusement ma-
chines, safety equipment, and other systems, machines, and equipment that
may have a serious influence on lives and property if used improperly, consult
your OMRON representative.
Make sure that the ratings and performance characteristics of the product are
sufficient for the systems, machines, and equipment, and be sure to provide the
systems, machines, and equipment with double safety mechanisms.
This manual provides information for programming and operating the Unit. Be
sure to read this manual before attempting to use the Unit and keep this manual
close at hand for reference during operation.

! WARNING It is extremely important that a PC and all PC Units be used for the specified
purpose and under the specified conditions, especially in applications that can
directly or indirectly affect human life. You must consult with your OMRON
representative before applying a PC system to the above-mentioned
applications.

3 Safety Precautions
! WARNING Do not attempt to take any Unit apart while the power is being supplied. Doing so
may result in electric shock.

! WARNING Do not touch any of the terminals or terminal blocks while the power is being
supplied. Doing so may result in electric shock.

! WARNING Do not attempt to disassemble, repair, or modify any Units. Any attempt to do so
may result in malfunction, fire, or electric shock.

! WARNING Provide safety measures in external circuits (i.e., not in the Programmable
Controller), including the following items, to ensure safety in the system if an
abnormality occurs due to malfunction of the PC or another external factor
affecting the PC operation. Not doing so may result in serious accidents.

Emergency stop circuits, interlock circuits, limit circuits, and similar safety
measures must be provided in external control circuits.
The PC will turn OFF all outputs when its selfdiagnosis function detects any
error or when a severe failure alarm (FALS) instruction is executed. As a coun-
termeasure for such errors, external safety measures must be provided to en-
sure safety in the system.

xiv
Application Precautions 5

The PC outputs may remain ON or OFF due to deposition or burning of the


output relays or destruction of the output transistors. As a countermeasure for
such problems, external safety measures must be provided to ensure safety in
the system.
When the 24-VDC output (service power supply to the PC) is overloaded or
short-circuited, the voltage may drop and result in the outputs being turned
OFF. As a countermeasure for such problems, external safety measures must
be provided to ensure safety in the system.

4 Operating Environment Precautions


! Caution Do not operate the control system in the following locations:

Locations subject to direct sunlight.


Locations subject to temperatures or humidity outside the range specified in
the specifications.
Locations subject to condensation as the result of severe changes in tempera-
ture.
Locations subject to corrosive or flammable gases.
Locations subject to dust (especially iron dust) or salts.
Locations subject to exposure to water, oil, or chemicals.
Locations subject to shock or vibration.

! Caution Take appropriate and sufficient countermeasures when installing systems in the
following locations:

Locations subject to static electricity or other forms of noise.


Locations subject to strong electromagnetic fields.
Locations subject to possible exposure to radioactivity.
Locations close to power supplies.

! Caution The operating environment of the PC system can have a large effect on the lon-
gevity and reliability of the system. Improper operating environments can lead to
malfunction, failure, and other unforeseeable problems with the PC system. Be
sure that the operating environment is within the specified conditions at installa-
tion and remains within the specified conditions during the life of the system.

5 Application Precautions
Observe the following precautions when using the PC system.

! WARNING Always heed these precautions. Failure to abide by the following precautions
could lead to serious or possibly fatal injury.

Always ground the system to 100 or less when installing the Units. Not con-
necting to a ground of 100 or less may result in electric shock.
Always turn OFF the power supply to the PC before attempting any of the fol-
lowing. Not turning OFF the power supply may result in malfunction or electric
shock.
Mounting or dismounting Power Supply Units, I/O Units, CPU Units,
Memory Units, or any other Units.
Assembling the Units.
Setting DIP switches or rotary switches.
Connecting cables or wiring the system.
Connecting or disconnecting the connectors.

xv
Application Precautions 5

! Caution Failure to abide by the following precautions could lead to faulty operation of the
PC or the system, or could damage the PC or PC Units. Always heed these pre-
cautions.

Fail-safe measures must be taken by the customer to ensure safety in the


event of incorrect, missing, or abnormal signals caused by broken signal lines,
momentary power interruptions, or other causes.
Interlock circuits, limit circuits, and similar safety measures in external circuits
(i.e., not in the Programmable Controller) must be provided by the customer.
Always use the power supply voltages specified in this manual. An incorrect
voltage may result in malfunction or burning.
Take appropriate measures to ensure that the specified power with the rated
voltage and frequency is supplied. Be particularly careful in places where the
power supply is unstable. An incorrect power supply may result in malfunction.
Install external breakers and take other safety measures against short-circuit-
ing in external wiring. Insufficient safety measures against short-circuiting may
result in burning.
Do not apply voltages to the Input Units in excess of the rated input voltage.
Excess voltages may result in burning.
Do not apply voltages or connect loads to the Output Units in excess of the
maximum switching capacity. Excess voltage or loads may result in burning.
Disconnect the functional ground terminal when performing withstand voltage
tests. Not disconnecting the functional ground terminal may result in burning.
Be sure that all the mounting screws, terminal screws, and cable connector
screws are tightened to the torque specified in this manual. Incorrect tighten-
ing torque may result in malfunction.
Leave the label attached to the Unit when wiring. Removing the label may re-
sult in malfunction if foreign matter enters the Unit.
Remove the label after the completion of wiring to ensure proper heat dissipa-
tion. Leaving the label attached may result in malfunction.
Double-check all wiring and switch settings before turning ON the power sup-
ply. Incorrect wiring may result in burning.
Wire correctly. Incorrect wiring may result in burning.
Mount Units only after checking terminal blocks and connectors completely.
Be sure that the terminal blocks, Memory Units, expansion cables, and other
items with locking devices are properly locked into place. Improper locking
may result in malfunction.
Check the user program for proper execution before actually running it on the
Unit. Not checking the program may result in an unexpected operation.
Confirm that no adverse effect will occur in the system before attempting any of
the following. Not doing so may result in an unexpected operation.
Changing the operating mode of the PC.
Force-setting/force-resetting any bit in memory.
Changing the present value of any word or any set value in memory.
Resume operation only after transferring to the new CPU Unit the contents of
the DM Area, HR Area, and other data required for resuming operation. Not
doing so may result in an unexpected operation.
Do not pull on the cables or bend the cables beyond their natural limit. Doing
either of these may break the cables.
Do not place objects on top of the cables or other wiring lines. Doing so may
break the cables.
Use crimp terminals for wiring. Do not connect bare stranded wires directly to
terminals. Connection of bare stranded wires may result in burning.

xvi
Application Precautions 5

When replacing parts, be sure to confirm that the rating of a new part is correct.
Not doing so may result in malfunction or burning.
Before touching a Unit, be sure to first touch a grounded metallic object in order
to discharge any static built-up. Not doing so may result in malfunction or dam-
age.

xvii
SECTION 1
Introduction
This section gives a brief overview of the history of Programmable Controllers and explains terms commonly used in
ladder-diagram programming. It also provides an overview of the process of programming and operating a PC and ex-
plains basic terminology used with OMRON PCs. Descriptions of peripheral devices used with the C200H, and a table of
other manuals available to use with this manual for special PC applications, are also provided.
1-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1-2 The Origins of PC Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1-3 PC Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1-4 OMRON Product Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1-5 Overview of PC Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1-6 Peripheral Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1-7 Available Manuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1-8 LSS Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1-8-1 Offline Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1-8-2 Online Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1-8-3 Offline and Online Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1
The Origins of PC Logic Section 1-2

1-1 Overview
A PC (Programmable Controller) is basically a CPU (Central Processing Unit)
containing a program and connected to input and output (I/O) devices. The
program controls the PC so that when an input signal from an input device
turns ON, the appropriate response is made. The response normally involves
turning ON an output signal to some sort of output device. The input devices
could be photoelectric sensors, pushbuttons on control panels, limit switches,
or any other device that can produce a signal that can be input into the PC.
The output devices could be solenoids, switches activating indicator lamps,
relays turning on motors, or any other devices that can be activated by sig-
nals output from the PC.
For example, a sensor detecting a passing product turns ON an input to the
PC. The PC responds by turning ON an output that activates a pusher that
pushes the product onto another conveyor for further processing. Another
sensor, positioned higher than the first, turns ON a different input to indicate
that the product is too tall. The PC responds by turning on another pusher
positioned before the pusher mentioned above to push the too-tall product
into a rejection box.
Although this example involves only two inputs and two outputs, it is typical of
the type of control operation that PCs can achieve. Actually even this exam-
ple is much more complex than it may at first appear because of the timing
that would be required, i.e., How does the PC know when to activate each
pusher? Much more complicated operations, however, are also possible.
The problem is how to get the desired control signals from available inputs at
appropriate times.
To achieve proper control, the C200H uses a form of PC logic called ladder-
diagram programming. This manual is written to explain ladder-diagram pro-
gramming and to prepare the reader to program and operate the C200H.

1-2 The Origins of PC Logic


PCs historically originate in relay-based control systems. And although the
integrated circuits and internal logic of the PC have taken the place of the
discrete relays, timers, counters, and other such devices, actual PC opera-
tion proceeds as if those discrete devices were still in place. PC control, how-
ever, also provides computer capabilities and accuracy to achieve a great
deal more flexibility and reliability than is possible with relays.
The symbols and other control concepts used to describe PC operation also
come from relay-based control and form the basis of the ladder-diagram pro-
gramming method. Most of the terms used to describe these symbols and
concepts, however, have come in from computer terminology.

Relay vs. PC Terminology The terminology used throughout this manual is somewhat different from re-
lay terminology, but the concepts are the same.
The following table shows the relationship between relay terms and the PC
terms used for OMRON PCs.

Relay term PC equivalent


contact input or condition
coil output or work bit
NO relay normally open condition
NC relay normally closed condition

2
PC Terminology Section 1-3

Actually there is not a total equivalence between these terms. The term con-
dition is only used to describe ladder diagram programs in general and is
specifically equivalent to one of certain set of basic instructions. The terms
input and output are not used in programming per se, except in reference to
I/O bits that are assigned to input and output signals coming into and leaving
the PC. Normally open conditions and normally closed conditions are ex-
plained in 4-3 Basic Ladder Diagrams.

1-3 PC Terminology
Although also provided in the Glossary at the back of this manual, the follow-
ing terms are crucial to understanding PC operation and are thus explained
here.

PC Because the C200H is a Rack PC, there is no one product that is a C200H
PC. That is why we talk about the configuration of the PC, because a PC is a
configuration of smaller Units.
To have a functional PC, you would need to have a CPU Rack with at least
one Unit mounted to it that provides I/O points. When we refer to the PC,
however, we are generally talking about the CPU and all of the Units directly
controlled by it through the program. This does not include the I/O devices
connected to PC inputs and outputs.
If you are not familiar with the terms used above to describe a PC, refer to
Section 2 Hardware Considerations for explanations.

Inputs and Outputs A device connected to the PC that sends a signal to the PC is called an input
device; the signal it sends is called an input signal. A signal enters the PC
through terminals or through pins on a connector on a Unit. The place where
a signal enters the PC is called an input point. This input point is allocated a
location in memory that reflects its status, i.e., either ON or OFF. This mem-
ory location is called an input bit. The CPU, in its normal processing cycle,
monitors the status of all input points and turns ON or OFF corresponding
input bits accordingly.
There are also output bits in memory that are allocated to output points on
Units through which output signals are sent to output devices, i.e., an out-
put bit is turned ON to send a signal to an output device through an output
point. The CPU periodically turns output points ON or OFF according to the
status of the output bits.
These terms are used when describing different aspects of PC operation.
When programming, one is concerned with what information is held in mem-
ory, and so I/O bits are referred to. When talking about the Units that connect
the PC to the controlled system and the places on these Units where signals
enter and leave the PC, I/O points are referred to. When wiring these I/O
points, the physical counterparts of the I/O points, either terminals or connec-
tor pins, are referred to. When talking about the signals that enter or leave
the PC, one refers to input signals and output signals, or sometimes just in-
puts and outputs. It all depends on what aspect of PC operation is being
talked about.

Controlled System and The Control System includes the PC and all I/O devices it uses to control an
Control System external system. A sensor that provides information to achieve control is an
input device that is clearly part of the Control System. The controlled system
is the external system that is being controlled by the PC program through
these I/O devices. I/O devices can sometimes be considered part of the con-
trolled system, e.g., a motor used to drive a conveyor belt.

3
Overview of PC Operation Section 1-5

1-4 OMRON Product Terminology


OMRON products are divided into several functional groups that have ge-
neric names. Appendix A Standard Models list products according to these
groups. The term Unit is used to refer to all of the OMRON PC products. Al-
though a Unit is any one of the building blocks that goes together to form a
C200H PC, its meaning is generally, but not always, limited in context to refer
to the Units that are mounted to a Rack. Most, but not all, of these products
have names that end with the word Unit.
The largest group of OMRON products is the I/O Units. These include all of
the Rack-mounting Units that provide non-dedicated input or output points for
general use. I/O Units come with a variety of point connections and specifica-
tions.
Special I/O Units are dedicated Units that are designed to meet specific
needs. These include Position Control Units, High-speed Counter Units, and
Analog I/O Units.
Link Units are used to create Link Systems that link more than one PC or
link a single PC to remote I/O points. Link Units include Remote I/O Units, PC
Link Units, Host Link Units, SYSMAC NET Link Units, and SYSMAC LINK
Units. SYSMAC NET Link and SYSMAC LINK Units can be used with the
CPU11-E only.
Other product groups include Programming Devices, Peripheral Devices,
and DIN Rail Products.

1-5 Overview of PC Operation


The following are the basic steps involved in programming and operating a
C200H. Assuming you have already purchased one or more of these PCs,
you must have a reasonable idea of the required information for steps one
and two, which are discussed briefly below. This manual is written to explain
steps three through six, eight, and nine. The relevant sections of this manual
that provide more information are listed with each of these steps.
1, 2, 3... 1. Determine what the controlled system must do, in what order, and at
what times.
2. Determine what Racks and what Units will be required. Refer to the
C200H Installation Guide. If a Link System is required, refer to the ap-
propriate System Manual.
3. On paper, assign all input and output devices to I/O points on Units and
determine which I/O bits will be allocated to each. If the PC includes
Special I/O Units or Link Systems, refer to the individual Operation
Manuals or System Manuals for details on I/O bit allocation. (Section 3
Memory Areas)
4. Using relay ladder symbols, write a program that represents the se-
quence of required operations and their inter-relationships. Be sure to
also program appropriate responses for all possible emergency situ-
ations. (Section 4 Writing ana Inputting the Program, Section 5 Instruc-
tion Set, Section 6 Program Execution Timing)
5. Input the program and all required operating parameters into the PC.
(Section 4-6 Inputting, Modifying, and Checking the Program.)
6. Debug the program, first to eliminate any syntax errors, and then to find
execution errors. (Section 4-6 Inputting, Modifying, and Checking the
Program , Section 7 Program Monitoring and Execution, and Section 8
Troubleshooting)
7. Wire the PC to the controlled system. This step can actually be started
as soon as step 3 has been completed. Refer to the C200H Installation

4
Peripheral Devices Section 1-6

Guide and to Operation Manuals and System Manuals for details on


individual Units.
8. Test the program in an actual control situation and carry out fine tuning
as required. (Section 7 Program Monitoring and Execution and Section
8 Troubleshooting)
9. Record two copies of the finished program on masters and store them
safely in different locations. (Section 4-6 Inputting, Modifying, and
Checking the Program)

Control System Design Designing the Control System is the first step in automating any process. A
PC can be programmed and operated only after the overall Control System is
fully understood. Designing the Control System requires, first of all, a thor-
ough understanding of the system that is to be controlled. The first step in
designing a Control System is thus determining the requirements of the con-
trolled system.

Input/Output Requirements The first thing that must be assessed is the number of input and output points
that the controlled system will require. This is done by identifying each device
that is to send an input signal to the PC or which is to receive an output sig-
nal from the PC. Keep in mind that the number of I/O points available de-
pends on the configuration of the PC. Refer to 3-3 IR Area for details on I/O
capacity and the allocation of I/O bits to I/O points.

Sequence, Timing, and Next, determine the sequence in which control operations are to occur and
Relationships the relative timing of the operations. Identify the physical relationships be-
tween the I/O devices as well as the kinds of responses that should occur
between them.
For instance, a photoelectric switch might be functionally tied to a motor by
way of a counter within the PC. When the PC receives an input from a start
switch, it could start the motor. The PC could then stop the motor when the
counter has received a specified number of input signals from the photoelec-
tric switch.
Each of the related tasks must be similarly determined, from the beginning of
the control operation to the end.

Unit Requirements The actual Units that will be mounted or connected to PC Racks must be de-
termined according to the requirements of the I/O devices. Actual hardware
specifications, such as voltage and current levels, as well as functional con-
siderations, such as those that require Special I/O Units or Link Systems will
need to be considered. In many cases, Special I/O Units, Intelligent I/O Units,
or Link Systems can greatly reduce the programming burden. Details on
these Units and Link Systems are available in appropriate Operation Manu-
als and System Manuals.
Once the entire Control System has been designed, the task of program-
ming, debugging, and operation as described in the remaining sections of
this manual can begin.

1-6 Peripheral Devices


The following peripheral devices can be used in programming, either to input/
debug/monitor the PC program or to interface the PC to external devices to
output the program or memory area data. Model numbers for all devices
listed below are provided in Appendix A Standard Models. OMRON product
names have been placed in bold when introduced in the following descrip-
tions.

5
Peripheral Devices Section 1-6

Programming Console A Programming Console is the simplest form of programming device for OM-
RON PCs. Although a Programming Console Adapter is sometimes re-
quired, all Programming Consoles are connected directly to the CPU without
requiring a separate interface. The Programming Console also functions as
an interface to transfer programs to a standard cassette tape recorder.
Various types of Programming Console are available, including both
CPU-mounting and Hand-held models. Programming Console operations are
described later in this manual.

Graphic Programming The GPC allows you to perform all the operations of the Programming Con-
Console: GPC sole as well as many additional ones. PC programs can be written on-screen
in ladder-diagram form as well as in mnemonic form. As the program is writ-
ten, it is displayed on a liquid crystal display, making confirmation and modifi-
cation quick and easy. Syntax checks may also be performed on the pro-
grams before they are downloaded to the PC. Many other functions are avail-
able, depending on the Memory Pack used with the GPC.
A Peripheral Interface Unit is required to interface the GPC to the PC.
The GPC also functions as an interface to copy programs directly to a stan-
dard cassette tape recorder. A PROM Writer, Floppy Disk Interface Unit, or
Printer Interface Unit can be directly mounted to the GPC to output pro-
grams directly to an EPROM chip, floppy disk drive, or printing device, re-
spectively.

Ladder Support Software: LSS is designed to run on IBM AT/XT compatibles to enable all of the opera-
LSS tions available on the GPC.
A Peripheral Interface Unit or Host Link Unit is required to interface a
computer running LSS to the PC. Using an Optical Host Link Unit also en-
ables the use of optical fiber cable to connect the FIT to the PC. Wired Host
Link Units are available when desired. (Although FIT does not have optical
connectors, conversion to optical fiber cable is possible by using converting
Link Adapters.)

Factory Intelligent Terminal: The FIT is an OMRON computer with specially designed software that allows
FIT you to perform all of the operations that are available with the GPC or LSS.
Programs can also be output directly to an EPROM chip, floppy disk drive, or
printing device without any additional interface. The FIT has an EPROM
writer and two 3.5 floppy disk drives built in.
A Peripheral Interface Unit or Host Link Unit is required to interface the
FIT to the PC. Using an Optical Host Link Unit also enables the use of optical
fiber cable to connect the FIT to the PC. Wired Host Link Units are available
when desired. (Although FIT does not have optical connectors, conversion to
optical fiber cable is possible by using converting Link Adapters.)

PROM Writer Other than its applications described above, the PROM Writer can be
mounted to the PCs CPU to write programs to EPROM chips.

Floppy Disk Interface Unit Other than its applications described above, the Floppy Disk Interface Unit
can be mounted to the PCs CPU to interface a floppy disk drive and write
programs onto floppy disks.

Printer Interface Unit Other than its applications described above, the Printer Interface Unit can be
mounted to the PCs CPU to interface a printer or X-Y plotter to print out pro-
grams in either mnemonic or ladder-diagram form.

6
Available Manuals Section 1-7

1-7 Available Manuals


The following table lists other manuals that may be required to program and/
or operate the C200H. Operation Manuals and/or Operation Guides are also
provided with individual Units and are required for wiring and other specifica-
tions.
Name Cat. No. Contents
GPC Operation Manual W84 Programming procedures for the GPC
(Graphics Programming Console)
FIT Operation Manual W150 Programming procedures for using the FIT
(Factory Intelligent Terminal
LSS Operation Manual W237 Programming procedures for using LSS
(Ladder Support Software)
SSS Operation Manual: Basic W247 Programming procedures for using SSS
SSS Operation Manual: C series PCs W248 (SYSMAC Support Software)
Data Access Console Operation Guide W173 Data area monitoring and data modification
procedures for the Data Access Console
Printer Interface Unit Operation Guide W107 Procedures for interfacing a PC to a printer
PROM Writer Operation Guide W155 Procedures for writing programs to EPROM chips
Floppy Disk Interface Unit Operation Guide W119 Procedures for interfacing a PC to a floppy disk
drive
Wired Remote I/O System Manual W120 Information on building a Wired Remote I/O System
(SYSMAC BUS) to enable remote I/O capability
Optical Remote I/O System Manual W136 Information on building an Optical Remote I/O
(SYSMAC BUS) System to enable remote I/O capability
PC Link System Manual W135 Information on building a PC Link System to
automatically transfer data between PCs
Host Link System Manual W143 Information on building a Host Link System to
(SYSMAC WAY) manage PCs from a host computer
SYSMAC NET Link Unit Operation Manual W114 Information on building a SYSMAC NET Link
System and thus create an optical LAN integrating
PCs with computers and other peripheral devices
SYSMAC LINK System Manual W174 Information on building a SYSMAC LINK System to
enable automatic data transfer, programming, and
programmed data transfer between the PCs in the
System
High-speed Counter Unit Operation Manual CT001V1/CT Information on High-speed Counter Unit
002: W141
CT021: W311
Position Control Unit Operation Manuals NC111: W137 Information on Position Control Unit
NC112: W128
NC211: W166
Analog I/O Units Operation Guide W127 Information on the C200H-AD001, C200H-DA001
Analog I/O Units
Analog Input Unit Operation Manual W229 Information on the C200H-AD002 Analog Input Unit
Temperature Sensor Unit Operation Guide W124 Information on Temperature Sensor Unit
ASCII Unit Operation Manual W165 Information on ASCII Unit
ID Sensor Unit Operation Guide W153 Information on ID Sensor Unit
Voice Unit Operation Manual W172 Information on Voice Unit
Fuzzy Logic Unit Operation Manual W208 Information on Fuzzy Logic Unit
Fuzzy Support Software Operation Manual W210 Information on the Fuzzy Support Software which
supports the Fuzzy Logic Units
Temperature Control Unit Operation Manual W225 Information on Temperature Control Unit

7
LSS Capabilities Section 1-8

Name Cat. No. Contents


Heat/Cool Temperature Control Unit Operation W240 Information on Heating and Cooling Temperature
Manual Control Unit
PID Control Unit Operation Manual W241 Information on PID Control Unit
Cam Positioner Unit Operation Manual W224 Information on Cam Positioner Unit

1-8 LSS Capabilities


The LSS is a complete programming and control package designed for C-series
PCs. It provides not only programming capabilities, but also advanced debug-
ging, monitoring, and program/data management. The following tables provide
only a brief introduction to the capabilities of the LSS. For further information and
actual operating procedures, please refer to the Ladder Support Software Op-
eration Manual.

1-8-1 Offline Operations


Group Description
General General programming operations feature function keys to easily read, write, and store programs.
Programming
PROGRAMMING SAVE PROGRAM Writes all or part of the user program to a data disk.
RETRIEVE PROGRAM Retrieves all or part of the user program from on a data disk.
CHANGE DISPLAY Switches the display between four display modes: Ladder, Ladder
with Comments, Mnemonic 1 (function key and numeric key input
mode) and Mnemonic 2 (alphanumeric key input mode).
SEARCH INSTRUCTION Searches for instructions including specified operands.
I/O COMMENT Creates, reads, modifies, and searches for I/O comments.
BLOCK COMMENT Creates, edits, and searches for block comments for output instruc-
tions.
LINE COMMENT Creates, searches for, and edits line comments.
CUT AND PASTE Edits programs by copying, moving, or deleting instruction blocks.
EDIT I/O COMMENT Displays 32 I/O comments at once to write, edit, and search.
RETRIEVE COMMENTS Retrieves comments from programs stored on a data disk.
MEMORY USAGE Displays the used capacity of user program memory, comments,
and internal memory.
CLEAR MEMORY Clears the user program memory.
CHECK PROGRAM Checks whether the user program contains syntax errors. The
check can be performed in three levels.

8
LSS Capabilities Section 1-8

Group Description
DM (data memory) DM operations are used to edit DM data in hexadecimal or ASCII form. There are also features
for copying, filling and printing DM data, as well as data disk save and retrieve operations.
I/O TABLE I/O TABLE is used to edit, check, and print I/O tables. It also provides data disk save and re-
trieve operations.
UTILITY DATA AREA LISTS Displays lists of such items as used areas and cross-references
(i.e., instructions that use specified operands).
CHANGE ADDRESSES Globally changes bit and word addresses in the user program.
PRINT LISTS Prints lists, ladder diagrams, and mnemonics.
EPROM FUNCTIONS Writes, reads, and compares the user program between the PROM
Writer and system work disk.
C500 C2000H Converts the program format from C500 to C2000H
NETWORK DATA LINKS Creates a data link table.
CREATE LIBRARY FILE Formats a floppy disk or hard disk for use with the LSS.
TIME CHART MONITOR Accesses the time chart monitor displays produced online.
UTILITY (contin- SET INSTRUCTIONS Used to assign instructions to function codes in instructions tables
ued)) and to save/retrieve instructions tables to/from data disk files.
RETRIEVE/SAVE INSTR Used to save and retrieve expansion instruction sets to and from
data disk files.
PC SETUP Used to set the PC operating parameters in the PC Setup and to
save and retrieve PC Setups to and from data disk files.

1-8-2 Online Operations

Group Function name Description


ON-LINE MONITOR DATA Used to monitor up to 20 bits/words during program execution. The status
of bits and contents of words being monitored can also be controlled.
TRANSFER PROGRAM Transfers and compares the user program between the LSS and PC.
ON-LINE EDIT Edits the PC program during MONITOR mode execution.
READ CYCLE TIME Reads and displays the cycle time of the PC.
CLEAR DATA AREAS Clears the PC data areas such as HR, CNT, AR, and DM (to zero).
MEMORY USAGE Displays the used capacity of program memory area, comments, and
internal memory.
Operations are also available to change display modes and search for instructions and comments.
DM DM area operations are available to transfer and compare DM data between the PC, LSS, and data
disks, and to monitor DM contents in the PC.
I/O TABLE I/O TABLE operations are used to write, transfer, and compare I/O tables between the PC and LSS.
UTILITY FILE MEMORY Displays file memory lists; transfers file memory contents between PC
and LSS; clears file memory; transfers file memory contents between PC
and File Memory Unit; saves or retrieves file memory contents to or from
floppy disk; and edits file memory data.
XFER DATA LINK TBL Transfers and compares data link tables between the PC and computer.
CLOCK Used to read and set the internal clock in the PC.
TRANSFER INSTR Used to transfer the expansion instruction set from the PC to the LSS.
TRANSFER PC SETUP Used to transfer the PC Setup between the PC and the LSS

9
LSS Capabilities Section 1-8

1-8-3 Offline and Online Operations


Group Description
SYSTEM SETUP The SYSTEM SETUP provides settings for the operating environment of the LSS, including
the PC thats being communicated with (including network and interface settings) and disk
drive, comment, printer, PROM Writer, and monitor settings. It also provides settings for trans-
fer of I/O table and data link tables to UM.
FILE MANAGEMENT FILE MANAGEMENT operations include basic file management features so that files can be
manipulated directly from the LSS. It also provides a feature for merging program files.

10
SECTION 2
Hardware Considerations
This section provides information on hardware aspects of the C200H that are relevant to programming and software op-
eration. These include indicators on the CPU Unit and basic PC configuration. This information is covered in detail in the
C200H Installation Guide.
2-1 Indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2-2 PC Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

11
PC Configuration Section 2-2

2-1 Indicators
CPU indicators provide visual information on the general operation of the PC.
Although not substitutes for proper error programming using the flags and
other error indicators provided in the data areas of memory, these indicators
provide ready confirmation of proper operation.

CPU Indicators CPU indicators are shown below and are described in the following table.

Indicator Function
POWER Lights when power is supplied to the CPU.
RUN Lights when the CPU is operating normally.
ALARM/ERROR ALARM: Flashes when a non-fatal error is discovered in error
diagnosis operations. PC operation will continue.
ERROR: Lights when a fatal error is discovered in error diagnosis
operations. When this indicator lights, the RUN indicator will go
off, CPU operation will be stopped, and all outputs from the PC
will be turned OFF.
OUT INHIBIT Lights when the Output OFF Bit, SR 25215, is turned ON. All
outputs from the PC will be turned OFF.

RUN POWER

OUT INHIBIT

ALARM/ERROR

2-2 PC Configuration
The basic PC configuration consists of two types of Rack: a CPU Rack and
Expansion I/O Racks. The Expansion I/O Racks are not a required part of the
basic system. They are used to increase the number of I/O points. An illustra-
tion of these Racks is provided in 3-3 IR Area. A third type of Rack, called a
Slave Rack, can be used when the PC is provided with a Remote I/O Sys-
tem.

CPU Racks A C200H CPU Rack consists of four components: (1) The CPU Backplane, to
which the CPU and other Units are mounted. (2) The CPU, which executes
the program and controls the PC. (3) Other Units, such as I/O Units, Special
I/O Units, and Link Units, which provide the physical I/O terminals corre-
sponding to I/O points.
A C200H CPU Rack can be used alone or it can be connected to other
Racks to provide additional I/O points. The CPU Rack provides three, five, or
eight slots to which these other Units can be mounted depending on the
backplane used.

Expansion I/O Racks An Expansion I/O Rack can be thought of as an extension of the PC because
it provides additional slots to which other Units can be mounted. It is built

12
PC Configuration Section 2-2

onto an Expansion I/O Backplane to which a Power Supply and up to eight


other Units are mounted.
An Expansion I/O Rack is always connected to the CPU via the connectors
on the Backplanes, allowing communication between the two Racks. Up to
two Expansion I/O Racks can be connected in series to the CPU Rack.

Unit Mounting Position Only I/O Units and Special I/O Units can be mounted to Slave Racks. All I/O
Units, Special I/O Units, Remote I/O Master Units, PC and Host Link Units,
can be mounted to any slot on all other Racks, although mounting to the two
rightmost slots on the CPU Rack may interfere with the mounting of peripher-
al devices. With the CPU11-E CPU Unit, SYSMAC LINK and NET Link Units
can be mounted to the two rightmost slots on the CPU Rack.
Refer to the C200H Installation Guide for details about which slots can be
used for which Units and other details about PC configuration. The way in
which I/O points on Units are allocated in memory is described in 3-3 IR
Area.

13
SECTION 3
Memory Areas

Various types of data are required to achieve effective and correct control. To facilitate managing this data, the PC is pro-
vided with various memory areas for data, each of which performs a different function. The areas generally accessible
by the user for use in programming are classified as data areas. The other memory area is the Program Memory, where
the users program is actually stored. This section describes these areas individually and provides information that will be
necessary to use them. As a matter of convention, the TR area is described in this section, even though it is not strictly a
memory area.

3-1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3-2 Data Area Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3-3 IR (Internal Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3-4 SR (Special Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3-4-1 Remote I/O Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3-4-2 Link System Flags and Control Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3-4-3 Forced Status Hold Bit (CPU11-E Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3-4-4 I/O Status Hold Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3-4-5 Output OFF Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3-4-6 FAL (Failure Alarm) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3-4-7 Low Battery Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3-4-8 Cycle Time Error Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3-4-9 I/O Verification Error Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3-4-10 First Cycle Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3-4-11 Clock Pulse Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3-4-12 Step Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3-4-13 Instruction Execution Error Flag, ER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3-4-14 Arithmetic Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3-5 AR (Auxiliary Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3-5-1 Optical Transmitting I/O Unit Error Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3-5-2 SYSMAC LINK System Data Link Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3-5-3 Error History Bits (CPU11-E Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3-5-4 Active Node Flags (CPU11-E only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3-5-5 SYSMAC LINK/SYSMAC NET Link System Service Time (CPU11-E only) . . 35
3-5-6 Calendar/Clock Area and Bits (CPU11-E Only) . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3-5-7 TERMINAL Mode Key Bits (CPU11-E Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3-5-8 Power-OFF Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3-5-9 CPU Low Battery Flag (CPU11-E Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3-5-10 SCAN(18) Cycle Time Flag (CPU11-E Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3-5-11 Network Parameter Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3-5-12 Link Unit Mounted Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3-5-13 CPU-mounting Device Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3-5-14 FALS-generating Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3-5-15 Cycle Time Indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3-6 DM (Data Memory) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3-7 HR (Holding Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3-8 TC (Timer/Counter) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3-9 LR (Link Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3-10 Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3-11 TR (Temporary Relay) Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

15
Data Area Structure Section 3-2

3-1 Introduction
Details, including the name, acronym, range, and function of each area are
summarized in the following table. All but the last three of these areas are
data areas. Data and memory areas are normally referred to by their acro-
nyms.

Area Acronym Range Function


Internal Relay IR Words: 000 to 235 Used to control I/O points, other bits, timers,
Bits: 00000 to 23515 and counters, and to temporarily store data.
Special Relay SR Words: 236 to 255 Contains system clocks, flags, control bits, and
Bits: 23600 to 25507 status information.
Auxiliary Relay AR Words: AR 00 to AR 27 Contains flags and bits for special functions.
Bits: AR 00 to AR 2715 Retains status during power failure.
Data Memory DM Read/write: DM 0000 to DM 0999 Used for internal data storage and manipula-
Read only: DM 1000 to DM 1999 tion.
Holding Relay HR Words: HR 00 to HR 99 Used to store data and to retain the data values
Bits: HR 0000 to HR 9915 when the power to the PC is turned off.
Timer/Counter TC TC 000 to TC 511 (TC numbers used Used to define timers and counters, and to ac-
to access other information) cess completion flags, PV, and SV. In general,
when used as a bit operand, a TC number ac-
cesses the completion flag for the timer or
counter defined using the TC number. When
used as a word operand, the TC number ac-
cesses the present value of the timer or count-
er.
Link Relay LR Words: LR 00 to LR 63 Available for use as work bits.
Bits: LR 0000 to 6315
Temporary Relay TR TR 00 to TR 07 (bits only) Used to temporarily store and retrieve execu-
tion conditions. These bits can only be used in
the Load and Output instructions. Storing and
retrieving execution conditions is necessary
when programming certain types of branching
ladder diagrams.
Program Memory UM UM: Depends on Memory Unit used. Contains the program executed by the CPU.

Work Bits and Words When some bits and words in certain data areas are not being used for their
intended purpose, they can be used in programming as required to control
other bits. Words and bits available for use in this fashion are called work
words and work bits. Most, but not all, unused bits can be used as work bits.
Those that can be used are described area-by-area in the remainder of this
section. Actual application of work bits and work words is described in Sec-
tion 4 Writing and Inputting the Program.

Flags and Control Bits Some data areas contain flags and/or control bits. Flags are bits that are
automatically turned ON and OFF to indicate particular operation status. Al-
though some flags can be turned ON and OFF by the user, most flags are
read only; they cannot be controlled directly.
Control bits are bits turned ON and OFF by the user to control specific as-
pects of operation. Any bit given a name using the word bit rather than the
word flag is a control bit, e.g., Restart bits are control bits.

3-2 Data Area Structure


When designating a data area, the acronym for the area is always required
for any but the IR and SR areas. Although the acronyms for the IR and SR
areas are often given for clarity in text explanations, they are not required,

16
Data Area Structure Section 3-2

and not entered, when programming. Any data area designation without an
acronym is assumed to be in either the IR or SR area. Because IR and SR
addresses run consecutively, the word or bit addresses are sufficient to differ-
entiate these two areas.
An actual data location within any data area but the TC area is designated by
its address. The address designates the bit or word within the area where the
desired data is located. The TC area consists of TC numbers, each of which
is used for a specific timer or counter defined in the program. Refer to 3-8 TC
Area for more details on TC numbers and to 5-12 Timer and Counter Instruc-
tions for information on their application.
The rest of the data areas (i.e., the IR, SR, HR, DM, AR, and LR areas) con-
sist of words, each of which consists of 16 bits numbered 00 through 15 from
right to left. IR words 000 and 001 are shown below with bit numbers. Here,
the content of each word is shown as all zeros. Bit 00 is called the rightmost
bit; bit 15, the leftmost bit.
The term least significant bit is often used for rightmost bit; the term most
significant bit, for leftmost bit. These terms are not used in this manual be-
cause a single data word is often split into two or more parts, with each part
used for different parameters or operands. When this is done, the rightmost
bits of a word may actually become the most significant bits, i.e., the leftmost
bits in another word,when combined with other bits to form a new word.

Bit number 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00

IR word 000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

IR word 001 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

The DM area is accessible by word only; you cannot designate an individual


bit within a DM word. Data in the IR, SR, HR, AR, and LR areas is accessible
either by word or by bit, depending on the instruction in which the data is be-
ing used.
To designate one of these areas by word, all that is necessary is the acronym
(if required) and the two-, three-, or four-digit word address. To designate an
area by bit, the word address is combined with the bit number as a single
four- or five-digit address. The following table show examples of this. The two
rightmost digits of a bit designation must indicate a bit between 00 and 15,
i.e., the rightmost digit must be 5 or less the next digit to the left, either 0 or 1.
The same TC number can be used to designate either the present value (PV)
of the timer or counter, or a bit that functions as the Completion Flag for the
timer or counter. This is explained in more detail in 3-8 TC Area.

Area Word designation Bit designation


IR 000 00015 (leftmost bit in word 000)
SR 252 25200 (rightmost bit in word 252)
DM DM 1250 Not possible
TC TC 215 (designates PV) TC 215 (designates completion flag)
LR LR 12 LR 1200

Data Structure Word data input as decimal values is stored in binary-coded decimal (BCD);
word data entered as hexadecimal is stored in binary form. Each four bits of
a word represents one digit, either a hexadecimal or decimal digit, numeri-
cally equivalent to the value of the binary bits. One word of data thus con-

17
IR Area Section 3-3

tains four digits, which are numbered from right to left. These digit numbers
and the corresponding bit numbers for one word are shown below.

Digit number 3 2 1 0

Bit number 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00

Contents 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

When referring to the entire word, the digit numbered 0 is called the right-
most digit; the one numbered 3, the leftmost digit.
When inputting data into data areas, it must be input in the proper form for
the intended purpose. This is no problem when designating individual bits,
which are merely turned ON (equivalent to a binary value of 1) or OFF (a bi-
nary value of 0). When inputting word data, however, it is important to input it
either as decimal or as hexadecimal, depending on what is called for by the
instruction it is to be used for. Section 5 Instruction Set specifies when a par-
ticular form of data is required for an instruction.

Converting Different Forms Binary and hexadecimal can be easily converted back and forth because
of Data each four bits of a binary number is numerically equivalent to one digit of a
hexadecimal number. The binary number 0101111101011111 is converted to
hexadecimal by considering each set of four bits in order from the right. Bi-
nary 1111 is hexadecimal F; binary 0101 is hexadecimal 5. The hexadecimal
equivalent would thus be 5F5F, or 24,415 in decimal (163 x 5 + 162 x 15 + 16
x 5 + 15).
Decimal and BCD are easily converted back and forth. In this case, each
BCD digit (i.e., each group of four BCD bits) is numerically equivalent of the
corresponding decimal digit. The BCD bits 0101011101010111 are converted
to decimal by considering each four bits from the right. Binary 0101 is deci-
mal 5; binary 0111 is decimal 7. The decimal equivalent would thus be 5,757.
Note that this is not the same numeric value as the hexadecimal equivalent
of 0101011101010111, which would be 5,757 hexadecimal, or 22,359 in deci-
mal (163 x 5 + 162 x 7 + 16 x 5 + 7).
Because the numeric equivalent of each four BCD binary bits must be nu-
merically equivalent to a decimal value, any four bit combination numerically
greater then 9 cannot be used, e.g., 1011 is not allowed because it is numeri-
cally equivalent to 11, which cannot be expressed as a single digit in decimal
notation. The binary bits 1011 are of course allowed in hexadecimal are a
equivalent to the hexadecimal digit C.
There are instructions provided to convert data either direction between BCD
and hexadecimal. Refer to 5-16 Data Conversion for details. Tables of binary
equivalents to hexadecimal and BCD digits are provided in the appendices
for reference.

Decimal Points Decimal points are used in timers only. The least significant digit represents
tenths of a second. All arithmetic instructions operate on integers only.

3-3 IR (Internal Relay) Area


The IR area is used both as data to control I/O points, and as work bits to
manipulate and store data internally. It is accessible both by bit and by word.
In the C200H PC, the IR area is comprised of words 000 to 235.
Words in the IR area that are used to control I/O points are called I/O words.
Bits in I/O words are called I/O bits. Bits in the IR area which are not as-

18
IR Area Section 3-3

signed as I/O bits can be used as work bits. IR area work bits are reset when
power is interrupted or PC operation is stopped.

I/O Words If a Unit brings inputs into the PC, the bit assigned to it is an input bit; if the
Unit sends an output from the PC, the bit is an output bit. To turn on an out-
put, the output bit assigned to it must be turned ON. When an input turns on,
the input bit assigned to it also turns ON. These facts can be used in the pro-
gram to access input status and control output status through I/O bits.

Input Bit Usage Input bits can be used to directly input external signals to the PC and can be
used in any order in programming. Each input bit can also be used in as
many instructions as required to achieve effective and proper control. They
cannot be used in instructions that control bit status, e.g., the Output, Differ-
entiation Up, and Keep instructions.

Output Bit Usage Output bits are used to output program execution results and can be used in
any order in programming. Because outputs are refreshed only once during
each cycle (i.e., once each time the program is executed), any output bit can
be used in only one instruction that controls its status, including OUT,
KEEP(11), DIFU(13), DIFD(14) and SFT(10). If an output bit is used in more
than one such instruction, only the status determined by the last instruction
will actually be output from the PC.
See 5-13-1 Shift Register - SFT(10) for an example that uses an output bit in
two bit-control instructions.

Word Allocation for Racks I/O words are allocated to the CPU Rack and Expansion I/O Racks by slot
position. One I/O word is allocated to each slot, as shown in the following
table. Since each slot is allocated only one I/O word, a 3-slot rack uses only
the first 3 words, a 5-slot rack uses only the first 5 words, and an 8-slot rack
uses only the first 8 words. Words that are allocated to unused or nonexistent
slots are available as work words.

Left side of rack Right side of a 10-slot rack

Rack Slot 1 Slot 2 Slot 3 Slot 4 Slot 5 Slot 6 Slot 7 Slot 8 Slot 9 Slot 10
CPU IR 000 IR 001 IR 002 IR 003 IR 004 IR 005 IR 006 IR 007 IR 008 IR 009
1st Expansion IR 010 IR 011 IR 012 IR 013 IR 014 IR 015 IR 016 IR 017 IR 018 IR 019
2nd Expansion IR 020 IR 021 IR 022 IR 023 IR 024 IR 025 IR 026 IR 027 IR 028 IR 029

Allocation for Special I/O Up to ten Special I/O Units may be mounted in any slot of the CPU Rack or
Units and Slave Racks Expansion I/O Racks. Up to five Slave Racks may be used, whether one or

19
SR Area Section 3-4

two Masters are used. IR area words are allocated to Special I/O Units and
Slave Racks by the unit number on the unit, as shown in the following tables.

Special I/O Units Slave Racks


Unit number IR address Unit number IR address
0 100 to 109 0 050 to 059
1 110 to 119 1 060 to 069
2 120 to 129 2 070 to 079
3 130 to 139 3 080 to 089
4 140 to 149 4 090 to 099
5 150 to 159
6 160 to 169
7 170 to 179
8 180 to 189
9 190 to 199

The C500-RT 001/002-(P)V1 Remote I/O Slave Rack may be used, but it
requires 20 I/O words, not 10, and therefore occupies the I/O words allocated
to 2 C200H Slave Racks, both the words allocated to the unit number set on
the rack and the words allocated to the following unit number. When using a
C200H CPU Unit, do not set the unit number on a C500 Slave Rack to 4, be-
cause there is no unit number 5. I/O words are allocated only to installed
units, from left to right, and not to slots as in the C200H system.

Allocation for Optical I/O I/O words between IR 200 and IR 231 are allocated to Optical I/O Units by
Units unit number. The I/O word allocated to each unit is IR 200+n, where n is the
unit number set on the unit.

Allocation for Remote I/O Remote Master I/O Units, SYSMAC LINK Units, SYSMAC NET Link Units,
Master and Link Units and Host Link Units do not use I/O words, and the PC Link Units use the LR
area, so words allocated to the slots in which these units are mounted are
available as work words.

Bit Allocation for I/O Units An I/O Unit may require anywhere from 8 to 16 bits, depending on the model.
With most I/O Units, any bits not used for input or output are available as
work bits. Transistor Output Units C200H-OD213 and C200H-OD411, as well
as Triac Output Unit C200H-OA221, however, uses bit 08 for the Blown Fuse
Flag. Transistor Output Unit C200H-OD214 uses bits 08 to 11 for the Alarm
Flag. Bits 08 to 15 of any word allocated to these units, therefore, cannot be
used as work bits.

3-4 SR (Special Relay) Area


The SR area contains flags and control bits used for monitoring PC opera-
tion, accessing clock pulses, and signalling errors. SR area word addresses
range from 236 through 255; bit addresses, from 23600 through 25507.
The following table lists the functions of SR area flags and control bits. Most
of these bits are described in more detail following the table. Descriptions are
in order by bit number except that Link System bits are grouped together.
Unless otherwise stated, flags are OFF until the specified condition arises,
when they are turned ON. Restart bits are usually OFF, but when the user

20
SR Area Section 3-4

turns one ON then OFF, the specified Link Unit will be restarted. Other con-
trol bits are OFF until set by the user.

Word(s) Bit(s) Function


236 00 to 07 Node loop status output area for operating level 0 of
SYSMAC NET Link System
08 to 15 Node loop status output area for operating level 1 of
SYSMAC NET Link System
237 00 to 07 Completion code output area for operating level 0 following
execution of SEND(90)/RECV(98) SYSMAC
LINK/SYSMAC NET Link System
08 to 15 Completion code output area for operating level 1 following
execution of SEND(90)/RECV(98) SYSMAC
LINK/SYSMAC NET Link System
238 to 241 00 to 15 Data link status output area for operating level 0 of
SYSMAC LINK or SYSMAC NET Link System
242 to 245 00 to 15 Data link status output area for operating level 1 of
SYSMAC LINK or SYSMAC NET Link System
246 00 to 15 Not used
247 to 250 00 to 07 PC Link Unit Run Flags or data link status for operating
level 1
08 to 15 PC Link Unit Error Flags or data link status for operating
level 1
251 00 to 15 Remote I/O Error Flags
252 00 SEND(90)/RECV(98) Error Flag for operating level 0 of
SYSMAC LINK or SYSMAC NET Link System
01 SEND(90)/RECV(98) Enable Flag for operating level 0 of
SYSMAC LINK or SYSMAC NET Link System
02 Operating Level 0 Data Link Operating Flag
03 SEND(90)/RECV(98) Error Flag for operating level 1 of
SYSMAC LINK or SYSMAC NET Link System
04 SEND(90)/RECV(98) Enable Flag for operating level 1 of
SYSMAC LINK or SYSMAC NET Link System
05 Operating Level 1 Data Link Operating Flag
06 Host Computer to Rack-mounting Host Link Unit Level 1
Error Flag
07 Rack-mounting Host Link Unit Level 1 Restart Bit
08 CPU-mounting Host Link Unit Error Flag
09 CPU-mounting Host Link Unit Restart Bit
10 Not used.
11 Forced Status Hold Bit (CPU11-E only)
12 I/O Status Hold Bit
13 Rack-mounting Host Link Unit Level 0 Restart Bit
14 Not used.
15 Output OFF Bit

21
SR Area Section 3-4

Word(s) Bit(s) Function


253 00 to 07 FAL number output area.
08 Low Battery Flag
09 Cycle Time Error Flag
10 I/O Verification Error Flag
11 Host Computer to rack-mounting Host Link Unit Level 0
Error Flag
12 Remote I/O Error Flag
13 Normally ON Flag
14 Normally OFF Flag
15 First cycle
254 00 1-minute clock pulse bit
01 0.02-second clock pulse bit
02 to 06 Reserved for function expansion. Do not use.
07 Step Flag
08 to 14 Reserved for function expansion. Do not use.
15 Special Unit Error Flag (Special I/O, PC Link, Host Link,
Remote I/O Master, SYSMAC NET Link, and SYSMAC
LINK)
255 00 0.1-second clock pulse bit
01 0.2-second clock pulse bit
02 1.0-second clock pulse bit
03 Instruction Execution Error (ER) Flag
04 Carry (CY) Flag
05 Greater Than (GR) Flag
06 Equals (EQ) Flag
07 Less Than (LE) Flag

3-4-1 Remote I/O Systems


SR 25312 turns ON to indicate an error has occurred in Remote I/O Sys-
tems. The ALARM/ERROR indicator will flash, but PC operation will continue.
SR 251, as well as AR 0014 and AR 0015, contain information on the source
and type of error. The function of each bit is described below. Refer to Optical
and Wired Remote I/O System Manuals for details.

Bit 00 - Error Check Bit If there are errors in more than one Remote I/O Unit, word 251 will contain
error information for only the first one. Data for the remaining Units will be
stored in memory and can be accessed by turning the Error Check bit ON
and OFF. Be sure to record data for the first error, which will be cleared when
data for the next error is displayed.

Bits 01 and 02 Not used.

Bit 03 Remote I/O Error Flag: Bit 03 turns ON when an error has occurred in a Re-
mote I/O Unit.

Bits 04 to 15 The content of bits 04 to 06 is a 3-digit binary number (04: 20, 05: 21, 06: 22)
and the content of bits 08 to 15 is a 2-digit hexadecimal number (08 to 11:
160, 12 to 15: 161).

22
SR Area Section 3-4

If the content of bits 12 through 15 is B, an error has occurred in a Remote


I/O Master or Slave Unit, and the content of bits 08 through 11 will indicate
the unit number, either 0 or 1, of the Master involved. In this case, bits 04 to
06 contain the unit number of the Slave Rack involved.
If the content of bits 12 through 15 is a number from 0 to 31, an error has
occurred in an Optical I/O Unit. The number is the unit number of the Optical
I/O Unit involved, and bit 04 will be ON if the Unit is assigned leftmost word
bits (08 through 15), and OFF if it is assigned rightmost word bits (00 through
07).

3-4-2 Link System Flags and Control Bits


Use of the following SR bits depends on the configuration of any Link Sys-
tems to which your PC belongs. These flags and control bits are used when
Link Units, such as PC Link Units, SYSMAC LINK Units, Remote I/O Units,
SYSMAC NET Link Units, or Host Link Units, are mounted to the PC Racks
or to the CPU. For additional information, consult the System Manual for the
particular Units involved.
The following bits can be employed as work bits when the PC does not be-
long to the Link System associated with them.
Host Link Systems
Both Error flags and Restart bits are provided for Host Link Systems. Error
flags turn ON to indicate errors in Host Link Units. Restart bits are turned ON
and then OFF to restart a Host Link Unit. SR bits used with Host Link Sys-
tems are summarized in the following table. Rack-mounting Host Link Unit
Restart bits are not effective for the Multilevel Rack-mounting Host Link
Units. Refer to the Host Link System Manual for details.
Bit Flag
25206 Rack-mounting Host Link Unit Level 1 Error Flag
25207 Rack-mounting Host Link Unit Level 1 Restart Bit
25208 CPU-mounting Host Link Unit Error Flag
25209 CPU-mounting Host Link Unit Restart Bit
25213 Rack-mounting Host Link Unit Level 0 Restart Bit
25311 Rack-mounting Host Link Unit Level 0 Error Flag

SYSMAC NET Link and SYSMAC LINK Systems (CPU11-E only)


SR 25200 turns ON to indicate an error has occurred in level 0, while using
SEND(90) or RECV(98) to transfer data in either a SYSMAC NET Link or
SYSMAC LINK System. SR 25203 indicates an error has occurred in level 1.
Turning ON SR 25201 enables SEND(90) and RECV(98) in level 0 in these
Systems. Turning ON SR 25204 enables SEND(90) and RECV(98) in level 1.
SR 25202 turns ON when a data link is active in operating level 0 of either of
these Systems and SR 25205 turns ON with a data link is active in operating
level 1. These flags and corresponding SR bits are shown below.
Bit Flag
25200 Operating Level 0 SEND(90)/RECV(98) Error Flag
25201 Operating Level 0 SEND(90)/RECV(98) Enable Flag
25202 Operating Level 0 Data Link Operating Flag
25203 Operating Level 1 SEND(90)/RECV(98) Error Flag
25204 Operating Level 1 SEND(90)/RECV(98) Enable Flag
25205 Operating Level 1 Data Link Operating Flag

23
SR Area Section 3-4

SYSMAC NET Link Loop SR 236 contains the SYSMAC NET Link Loop Status Flags. Bits 00 through
Status Output 07 are the Loop Status Flags for operating level 0, and bits 08 through 15 are
the Flags for operating level 1. The bit functions are shown below.

Level 0: 07 06 05 04 03 02 01 00
Level 1: 15 14 13 12 11 10 09 08
1 1 1 1

Central Power Supply Unit: Transmission status:


0: Power supply connected. 0: Reception possible
1: Power supply not connected. 1: Reception not possible

Loop status:
11: Normal loop
10: Lower back loop
01: Upper back loop
00: Loop error

Communications When SEND(90) or RECV(98) is used in a SYSMAC LINK System, a com-


Completion Code pletion code is output to SR 23700 through SR 23707 for level 0, or SR
23708 through SR 23715 for level 0, to indicate whether or not the data
transfer was completed successfully and to indicate the nature of the error
when communications are not completed successfully. These error codes are
as follows.
SYSMAC LINK Systems
Completion Name Meaning
code
00 Normal end Data transfer was completed successfully.
01 Parameter error SEND(90)/RECV(98) instruction operands are not within specified
ranges.
02 Transmission impossible The System was reset during execution of the instruction or the
destination node is not in the System.
03 Destination not in System The destination node is not in the System.
04 Busy error The destination node is busy and cannot receive the transfer.
05 Response timeout A response was not received within the time limit.
06 Response error An error response was received from the destination node.
07 Communications controller An error occurred in the communications controller.
error
08 Setting error The node address was set incorrectly.
09 CPU error A CPU error occurred in the PC of the destination node.

24
SR Area Section 3-4

SYSMAC NET Link Systems

Completion Name Meaning


code
00 Normal end Data transfer was completed successfully.
01 Parameter error SEND(90)/RECV(98) instruction operands are not within specified ranges.
02 Transmission impossible The System was reset during execution of the instruction or the destination
node is not in the System.
03 Busy error The destination node is busy and cannot receive the transfer.
04 Transmission error The line server token was not received.
05 Loop error An error occurred in the transmission loop.
06 No response Destination node does not exist or response was not received within the
time limit.
07 Response error Incorrect response format.

Data Link Status SYSMAC LINK/SYSMAC NET Link Data link status is output to SR 238
through SR 241 for the operating level 0 data link, and to SR 242 through SR
245 for the operating level 1 data link in the SYSMAC NET Link or SYSMAC
LINK System.
The meaning of each bit in these areas differs depending on whether the
data link is in a SYSMAC LINK System or SYSMAC NET Link System, as
shown below.
SYSMAC LINK Systems
Level 0 Level 1 Bits
00 to 03 04 to 07 08 to 11 12 to 15
SR 238 SR 242 Node 1 Node 2 Node 3 Node 4
SR 239 SR 243 Node 5 Node 6 Node 7 Node 8
SR 240 SR 244 Node 9 Node 10 Node 11 Node 12
SR 241 SR 245 Node 13 Node 14 Node 15 Node 16

Each of the above sets of four bits operates as shown below.

Leftmost bit Middle bits Rightmost bit


ON when data link is active. ON when there is a data ON when there is a PC ON when PC is in RUN
communications error. error. mode.

SYSMAC NET Link Systems


Level 0 Level 1 Bit numbers in header/Registration number in the data link table
PC Error Flags PC Run Flags
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
SR 238 SR 242 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
SR 239 SR 243 9 10 11 12 13 14 15 16 9 10 11 12 13 14 15 16
SR 240 SR 244 17 18 19 20 21 22 23 24 17 18 19 20 21 22 23 24
SR 241 SR 245 25 26 27 28 29 30 31 32 25 26 27 28 29 30 31 32

PC Link Systems
PC Link Unit Error and Run When the PC belongs to a PC Link System, words 247 through 250 are used
Flags to monitor the operating status of all PC Link Units connected to the PC Link
System. This includes a maximum of 32 PC Link Units. If the PC is in a Multi-
level PC Link System, half of the PC Link Units will be in a PC Link Subsys-

25
SR Area Section 3-4

tem in operating level 0; the other half, in a Subsystem in operating level 1.


The actual bit assignments depend on whether the PC is in a Single-level PC
Link System or a Multilevel PC Link System. Refer to the PC Link System
Manual for details. Error and Run Flag bit assignments are described below.
Bits 00 through 07 of each word are the Run flags, which are ON when the
PC Link Unit is in RUN mode. Bits 08 through 15 are the Error flags, which
are ON when an error has occurred in the PC Link Unit. The following table
shows bit assignments for Single-level and Multi-level PC Link Systems.
Single-level PC Link Systems
Flag type Bit no. SR 247 SR 248 SR 249 SR 250
Run flags 00 Unit #24 Unit #16 Unit #8 Unit #0
01 Unit #25 Unit #17 Unit #9 Unit #1
02 Unit #26 Unit #18 Unit #10 Unit #2
03 Unit #27 Unit #19 Unit #11 Unit #3
04 Unit #28 Unit #20 Unit #12 Unit #4
05 Unit #29 Unit #21 Unit #13 Unit #5
06 Unit #30 Unit #22 Unit #14 Unit #6
07 Unit #31 Unit #23 Unit #15 Unit #7
Error flags 08 Unit #24 Unit #16 Unit #8 Unit #0
09 Unit #25 Unit #17 Unit #9 Unit #1
10 Unit #26 Unit #18 Unit #10 Unit #2
11 Unit #27 Unit #19 Unit #11 Unit #3
12 Unit #28 Unit #20 Unit #12 Unit #4
13 Unit #29 Unit #21 Unit #13 Unit #5
14 Unit #30 Unit #22 Unit #14 Unit #6
15 Unit #31 Unit #23 Unit #15 Unit #7

26
SR Area Section 3-4

Multilevel PC Link Systems


Flag type Bit no. SR 247 SR 248 SR 249 SR 250
Run flags 00 Unit #8, Unit #0, Unit #8, Unit #0,
level 1 level 1 level 0 level 0
01 Unit #9, Unit #1, Unit #9, Unit #1,
level 1 level 1 level 0 level 0
02 Unit #10, Unit #2, Unit #10, Unit #2,
level 1 level 1 level 0 level 0
03 Unit #11, Unit #3, Unit #11, Unit #3,
level 1 level 1 level 0 level 0
04 Unit #12, Unit #4, Unit #12, Unit #4,
level 1 level 1 level 0 level 0
05 Unit #13, Unit #5, Unit #13, Unit #5,
level 1 level 1 level 0 level 0
06 Unit #14, Unit #6, Unit #14, Unit #6,
level 1 level 1 level 0 level 0
07 Unit #15, Unit #7, Unit #15, Unit #7,
level 1 level 1 level 0 level 0
Error flags 08 Unit #8, Unit #0, Unit #8, Unit #0,
level 1 level 1 level 0 level 0
09 Unit #9, Unit #1, Unit #9, Unit #1,
level 1 level 1 level 0 level 0
10 Unit #10, Unit #2, Unit #10, Unit #2,
level 1 level 1 level 0 level 0
11 Unit #11, Unit #3, Unit #11, Unit #3,
level 1 level 1 level 0 level 0
12 Unit #12, Unit #4, Unit #12, Unit #4,
level 1 level 1 level 0 level 0
13 Unit #13, Unit #5, Unit #13, Unit #5,
level 1 level 1 level 0 level 0
14 Unit #14, Unit #6, Unit #14, Unit #6,
level 1 level 1 level 0 level 0
15 Unit #15, Unit #7, Unit #15, Unit #7,
level 1 level 1 level 0 level 0

Application Example If the PC is in a Multilevel PC Link System and the content of word 248 is
02FF, then PC Link Units #0 through #7 of in the PC Link Subsystem as-
signed operating level 1 would be in RUN mode, and PC Link Unit #1 in the
same Subsystem would have an error. The hexadecimal digits and corre-
sponding binary bits of word 248 would be as shown below.
Bit no. 15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 00
Binary 0000 0010 1111 1111
Hex 0 2 F F

3-4-3 Forced Status Hold Bit (CPU11-E Only)


SR 25211 determines whether or not the status of bits that have been force-
set or force-reset is maintained when switching between PROGRAM and
MONITOR mode to start or stop operation. If SR 25211 is ON, bit status will
be maintained; if SR 25211 is OFF, all bits will return to default status when
operation is started or stopped. The Force Status Hold Bit is only effective
when enabled with the Set System instruction (SYS(49)).
The status of SR 25211 in not affected by a power interruption unless the I/O
table is registered; in that case, SR 25211 will go OFF.

27
SR Area Section 3-4

SR 25211 is not effective when switching to RUN mode.


SR 25211 should be manipulated from a Peripheral Device, e.g., a Program-
ming Console or FIT.

Maintaining Status during The status of SR 25211 and thus the status of force-set/force-reset bits can
Startup be maintained when power is turned off and on by inserting the Set System
instruction (SYS(49)) in the program as step 00000 with the proper operand.
If SYS(49) is used in this way, the status of SR 25211 will be preserved when
power is turned off and on. If this is done and SR 25211 is ON, then the sta-
tus of force-set/force-reset bits will also be preserved, as shown in the follow-
ing table. The use of SYS(49) does not affect operation when switching to
run mode, i.e., force-set/force-reset bits always return to default status when
switching to RUN mode.

Status before shutdown Status at next startup


SR 25211 SYS(49) SR 25211 Force-set/reset bits
ON Executed ON Status maintained
Not executed OFF Default status
OFF Executed OFF Default status
Not executed OFF Default status

Refer to Section 5 Instruction Set for details on SYS(49).

3-4-4 I/O Status Hold Bit


SR 25212 determines whether or not the status of IR and LR area bits is
maintained when operation is started or stopped, when operation begins by
switching from PROGRAM mode to MONITOR or RUN modes. If SR 25212
is ON, bit status will be maintained; if SR 25212 is OFF, all IR and LR area
bits will be reset. With the CPU11-E CPU Unit, the I/O Status Hold Bit will
only be effective if enabled with the Set System instruction (SYS(49)).
The status of SR 25211 in not affected by a power interruption unless the I/O
table is registered; in that case, SR 25211 will go OFF.
SR 25212 can be turned ON from the program using the Output instruction,
or it can be turned ON from a Peripheral Device.

Maintaining Status during With the CPU11-E CPU Unit, the status of SR 25212 and thus the status of
Startup IR and LR area bits can be maintained when power is turned off and on by
inserting the System Operation instruction (SYS(49)) into the program as
step 00000 with the proper operand. If SYS(49) is used in this way, the status
of SR 25212 will be preserved when power is turned off and on. If this is
done and SR 25212 is ON, then the status of IR and LR area bits will also be
preserved, as shown in the following table.

Status before shutdown Status at next startup


SR 25212 SYS(49) SR 25212 IR and LR bits
ON Executed ON Status maintained
Not executed OFF Reset
OFF Executed OFF Reset
Not executed OFF Reset

Refer to Section 5 Instruction Set for details on SYS(49).


The status of the I/O Status Hold Bit is maintained for power interruptions or
when PC operation is stopped.

28
SR Area Section 3-4

Operating without a Battery In the following cases, DM (DM 0000 to DM 0999), HR, AR, CNT, and SR
area data will not be retained in the CPU Units internal RAM when the power
is turned OFF.

When a RAM Unit without battery backup is used and the backup time has
been exceeded for the backup capacitor.
When a RAM Unit with battery backup is used, but the battery is low.
Because this data is not retained, the Output OFF Bit (SR 25215) and the I/O
Status Hold Bit (SR 25212) are not reliable when the power is turned ON. If
the Output OFF Bit is ON, the outputs from all of the Output Units will be
turned OFF. To ensure that the outputs from all of the Output Units are not
turned OFF when the power is turned ON, take a preventive measure, such
as writing the following instructions into the ladder program.

First Cycle Flag


(25315)
ANDW (34)
#6FFF
252

252

3-4-5 Output OFF Bit


SR bit 25215 is turned ON to turn OFF all outputs from the PC. The OUT IN-
HIBIT indicator on the front panel of the CPU will light. When the Output OFF
Bit is OFF, all output bits will be refreshed in the usual way.

The status of the Output OFF Bit is maintained for power interruptions or
when PC operation is stopped, unless the I/O table has been registered
(CPU Units CPU01-E and CPU03-E), or the I/O table has been registered
and either the Force Status Hold Bit or the I/O Status Hold Bit has not been
enabled with SYS(49) (CPU Unit CPU11-E).

Operating without a Battery In the following cases, DM (DM 0000 to DM 0999), HR, AR, CNT, and SR
area data will not be retained in the CPU Units internal RAM when the power
is turned OFF.

When a RAM Unit without battery backup is used and the backup time has
been exceeded for the backup capacitor.
When a RAM Unit with battery backup is used, but the battery is low.
Because this data is not retained, the Output OFF Bit (SR 25215) and the I/O
Status Hold Bit (SR 25212) are not reliable when the power is turned ON. If
the Output OFF Bit is ON, the outputs from all of the Output Units will be
turned OFF. To ensure that the outputs from all of the Output Units are not
turned OFF when the power is turned ON, take a preventive measure, such
as writing the following instructions into the ladder program.

First Cycle Flag


(25315)
ANDW (34)
#6FFF
252

252

29
SR Area Section 3-4

3-4-6 FAL (Failure Alarm) Area


A 2-digit BCD FAL code is output to bits 25300 to 25307 when the FAL or
FALS instruction is executed. These codes are user defined for use in error
diagnosis, although the PC also outputs FAL codes to these bits, such as one
caused by battery voltage drop.
This area can be reset by executing the FAL instruction with an operand of
00 or by performing a Failure Read Operation from the Programming Con-
sole.

3-4-7 Low Battery Flag


SR bit 25308 turns ON if the voltage of the RAM Unit or CPU11-E backup
battery drops. The ALARM/ERROR indicator on the front of the CPU will also
flash.
AR bit 2404 is a separate Low Battery Flag for the CPU11-E only. It is there-
fore possible to determine which backup battery is low, that of the RAM Unit
or CPU11-E, by checking the status of AR 2404.
This bit can be programmed to activate an external warning for a low battery
voltage.
The Set System instruction (SYS(49)) can be used to turn off the operation of
the battery alarm if desired, e.g., when DM 1000 to DM 1999 is placed in
ROM and a battery is not used in operation. Refer to Section 5 Instruction
Set for details.

3-4-8 Cycle Time Error Flag


SR bit 25309 turns ON if the cycle time exceeds 100 ms. The ALARM/ER-
ROR indicator on the front of the CPU will also flash. Program execution will
not stop, however, unless the maximum time limit set for the watchdog timer
is exceeded. Timing may become inaccurate after the cycle time exceeds
100 ms.

3-4-9 I/O Verification Error Flag


SR bit 25310 turns ON when the Units mounted in the system disagree with
the I/O table registered in the CPU. The ALARM/ERROR indicator on the
front of the CPU will also flash, but PC operation will continue.
To ensure proper operation, PC operation should be stopped, Units checked,
and the I/O table corrected whenever this flag goes ON.

3-4-10 First Cycle Flag


SR bit 25315 turns ON when PC operation begins and then turns OFF after
one cycle of the program. The First Cycle Flag is useful in initializing counter
values and other operations. An example of this is provided 5-12 Timer and
Counter Instructions.

3-4-11 Clock Pulse Bits


Five clock pulses are available to control program timing. Each clock pulse
bit is ON for the first half of the rated pulse time, then OFF for the second
half. In other words, each clock pulse has a duty factor of 50%.
These clock pulse bits are often used with counter instructions to create tim-
ers. Refer to 5-12 Timer and Counter Instructions for an example of this.
Pulse width 1 min 0.02 s 0.1 s 0.2 s 1.0 s
Bit 25400 25401 25500 25501 25502

30
SR Area Section 3-4

Bit 25400 Bit 25401


1-min clock pulse 0.02-s clock pulse

30 s 30 s .01 s .01 s

1 min. .02 s
Bit 25500 Bit 25501
0.1-s clock pulse 0.2-s clock pulse

.05 s .05 s 0.1 s 0.1 s

0.1 s 0.2 s

Bit 25502 Caution:


1.0-s clock pulse Because the 0.1-second and
0.02-second clock pulse bits have
ON times of 50 and 10 ms, respec-
0.5 s 0.5 s tively, the CPU may not be able to
accurately read the pulses if pro-
1.0 s gram execution time is too long.

3-4-12 Step Flag


SR bit 25407 turns ON for one cycle when step execution is started with the
STEP(08) instruction.

3-4-13 Instruction Execution Error Flag, ER


SR bit 25503 turns ON if an attempt is made to execute an instruction with
incorrect operand data. Common causes of an instruction error are non-BCD
operand data when BCD data is required, or an indirectly addressed DM
word that is non-existent. When the ER Flag is ON, the current instruction
will not be executed.

3-4-14 Arithmetic Flags


The following flags are used in data shifting, arithmetic calculation, and com-
parison instructions. They are generally referred to only by their two-letter
abbreviations.

Caution These flags are all reset when the END(01) instruction is executed, and
therefore cannot be monitored from a programming device.

Refer to 5-13 Data Shifting, 5-15 Data Comparison, 5-17 BCD Calculations,
and 5-18 Binary Calculations for details.
Carry Flag, CY SR bit 25504 turns ON when there is a carry in the result of an arithmetic op-
eration or when a rotate or shift instruction moves a 1 into CY. The content
of CY is also used in some arithmetic operations, e.g., it is added or sub-
tracted along with other operands. This flag can be set and cleared from the
program using the Set Carry and Clear Carry instructions.

Greater Than Flag, GR SR bit 25505 turns ON when the result of a comparison shows the first of two
operands to be greater than the second.

Equal Flag, EQ SR bit 25506 turns ON when the result of a comparison shows two operands
to be equal or when the result of an arithmetic operation is zero.

Less Than Flag, LE SR bit 25507 turns ON when the result of a comparison shows the first of two
operands to be less than the second.
Note The four arithmetic flags are turned OFF when END(01) is executed.

31
AR Area Section 3-5

3-5 AR (Auxiliary Relay) Area


AR word addresses extend from AR 00 to AR 27; AR bit addresses extend
from AR 0000 to AR 2715. Most AR area words and bits are dedicated to
specific uses, such as transmission counters, flags, and control bits, and
words AR 00 through AR 06 and AR 23 through AR 27 cannot be used for
any other purpose. Words and bits from AR 07 to AR 22 are available as
work words and work bits if not used for the following assigned purposes.
Word Use
AR 0713 to AR 0715 Error History Area (CPU11-E only)
AR 07 to AR 15 SYSMAC LINK Units
AR 16, AR 17 SYSMAC LINK and SYSMAC NET Link Units
AR 18 to AR 21 Calendar/clock Area (CPU11-E only)
AR 0708, AR 22 TERMINAL Mode Key Bits (CPU11-E only)

The AR area retains status during power interruptions, when switching from
MONITOR or RUN mode to PROGRAM mode, or when PC operation is
stopped. Bit allocations are shown in the following table and described in the
following pages in order of bit number.
AR Area Flags and Control Bits
Word(s) Bit(s) Function
00 00 to 09 Error Flags for Special I/O Units 0 to 9 (also function as Error Flags for PC Link Units)
10 Error Flag for operating level 1 of SYSMAC LINK or SYSMAC NET Link System
11 Error Flag for operating level 0 of SYSMAC LINK or SYSMAC NET Link System
12 Host Computer to Rack-mounting Host Link Unit Level 1 Error Flag
13 Host Computer to Rack-mounting Host Link Unit Level 0 Error Flag
14 Remote I/O Master Unit 1 Error Flag
15 Remote I/O Master Unit 0 Error Flag
01 00 to 09 Restart Bits for Special I/O Units 0 to 9 (also function as Restart Bits for PC Link Units)
10 Restart Bit for operating level 1 of SYSMAC LINK or SYSMAC NET Link System
11 Restart Bit for operating level 0 of SYSMAC LINK or SYSMAC NET Link System
12, 13 Not used.
14 Remote I/O Master Unit 1 Restart Bit
15 Remote I/O Master Unit 0 Restart Bit
02 00 to 04 Error Flags for Slave Racks 0 to 4
05 to 15 Not used.
03 00 to 15 Error Flags for Optical I/O Units 0 to 7
04 00 to 15 Error Flags for Optical I/O Units 8 to 15
05 00 to 15 Error Flags for Optical I/O Units 16 to 23
06 00 to 15 Error Flags for Optical I/O Units 24 to 31
07 00 to 03 Data Link setting for operating level 0 of SYSMAC LINK System
04 to 07 Data Link setting for operating level 1 of SYSMAC LINK System
08 TERMINAL Mode Input Cancel Bit (CPU11-E only)
09 to 12 Not used.
13 Error History Overwrite Bit (CPU11-E only)
14 Error History Reset Bit (CPU11-E only)
15 Error History Enable Bit (CPU11-E only)
08 to 11 00 to 15 Active Node Flags for SYSMAC LINK System nodes of operating level 0

32
AR Area Section 3-5

Word(s) Bit(s) Function


12 to 15 00 to 15 Active Node Flags for SYSMAC LINK System nodes of operating level 1
16 00 to 15 SYSMAC LINK/SYSMAC NET Link System operating level 0 service time per cycle
17 00 to 15 SYSMAC LINK/SYSMAC NET Link System operating level 1 service time per cycle
18 to 21 00 to 15 Calendar/clock Area (CPU11-E only)
22 00 to 15 TERMINAL Mode Key Bits (CPU11-E only)
23 00 to 15 Power Off Counter
24 00 to 03 Not used.
04 CPU Unit Low Battery Flag (CPU11-E only)
05 Cycle Time Flag
06 SYSMAC LINK System Network Parameter Flag for operating level 1
07 SYSMAC LINK System Network Parameter Flag for operating level 0
08 SYSMAC/SYSMAC NET Link Unit Level 1 Mounted Flag
09 SYSMAC/SYSMAC NET Link Unit Level 0 Mounted Flag
10 to 12 Not used.
13 Rack-mounting Host Link Unit Level 1 Mounted Flag
14 Rack-mounting Host Link Unit Level 0 Mounted Flag
15 CPU-mounting Device Mounted Flag
25 00 to 15 FALS-generating Address
26 00 to 15 Maximum Cycle Time
27 00 to 15 Present Cycle Time

3-5-1 Optical Transmitting I/O Unit Error Flags


AR 03 through AR 06 contain the Error Flags for Optical Transmitting I/O
Units. An error indicates a duplication of a unit number. Up to 64 Optical
Transmitting I/O Units can be connected to the PC. Units are distinguished
by unit number, 0 through 31, and a letter, L or H. Bits are allocated as
shown in the following table.

Bits AR03 allocation AR04 allocation AR05 allocation AR06 allocation


00 0L 8L 16 L 24 L
01 0H 8H 16 H 24 H
02 1L 9L 17 L 25 L
03 1H 9H 17 H 25 H
04 2L 10 L 18 L 26 L
05 2H 10 H 18 H 26 H
06 3L 11 L 19 L 27 L
07 3H 11 H 19 H 27 H
08 4L 12 L 20 L 28 L
09 4H 12 H 20 H 28 H
10 5L 13 L 21 L 29 L
11 5H 13 H 21 H 29 H
12 6L 14 L 22 L 30 L
13 6H 14 H 22 H 30 H
14 7L 15 L 23 L 31 L
15 7H 15 H 23 H 31 H

33
AR Area Section 3-5

3-5-2 SYSMAC LINK System Data Link Settings


AR 0700 to AR 0703 and AR 0704 to AR 0707 are used to designate word
allocations for operating levels 0 and 1 of the SYSMAC LINK System. Alloca-
tion can be set to occur either according to settings from an FIT or automati-
cally in the LR and/or DM areas. If automatic allocation is designated, the
number of words to be allocated to each node is also designated. These set-
tings are shown below.
External/Automatic Allocation
Operating level 0 Operating level 1 Setting
AR 0700 AR 0701 AR 0704 AR 0705
0 0 0 0 Words set externally (FIT)
1 0 1 0 Automatic LR area only
allocation
ll ti
0 1 0 1 DM area only
1 1 1 1 LR and DM
areas

Words per Node


The following setting is necessary if automatic allocation is designated
above.
Operating level 0 Operating level 1 Words per node Max. no.
AR 0702 AR 0703 AR 0706 AR 0707 LR area DM area of nodes
0 0 0 0 4 8 16
1 0 1 0 8 16 8
0 1 0 1 16 32 4
1 1 1 1 32 64 2

The above settings are read every cycle while the SYSMAC LINK System is
in operation.

3-5-3 Error History Bits (CPU11-E Only)


AR 0713 (Error History Overwrite Bit) is turned ON or OFF by the user to
control overwriting of records in the Error History Area in the DM area. Turn
AR 0713 ON to overwrite the oldest error record each time an error occurs
after 10 have been recorded. Turn OFF AR 0713 to store only the first 10
records that occur each time after the history area is cleared.
AR 0714 (Error History Reset Bit) is turned ON and then OFF by the user to
reset the Error Record Pointer (DM 0969) and thus restart recording error
records at the beginning of the history area.
AR 0715 (Error History Enable Bit) is turned ON by the user to enable error
history storage and turned OFF to disable error history storage.
Refer to 3-6 DM Area for details on the Error History Area.
Error history bits are refreshed each cycle.

3-5-4 Active Node Flags (CPU11-E only)


AR 08 through AR 11 and AR 12 through AR 15 provide flags that indicate
which nodes are active in the SYSMAC LINK System at the current time.
These flags are refreshed every cycle while the SYSMAC LINK System is
operating.
The body of the following table show the node number assigned to each bit.
If the bit is ON, the node is currently active.

34
AR Area Section 3-5

Level 0 Level 1 Bit (body of table shows node numbers)


00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
AR 08 AR 12 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
AR 09 AR 13 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
AR 10 AR 14 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
AR 11 AR 15 49 50 51 52 53 54 55 56 57 58 59 60 61 62 * **
*Communication Controller Error Flag
**EEPROM Error Flag

3-5-5 SYSMAC LINK/SYSMAC NET Link System Service Time


(CPU11-E only)
AR 16 provides the time allocated to servicing operating level 0 of the SYS-
MAC LINK System and/or SYSMAC NET Link System during each cycle
when a SYSMAC LINK Unit and/or SYSMAC NET Link Unit is mounted to a
Rack.
AR 17 provides the time allocated to servicing operating level 1 of the SYS-
MAC LINK System and/or SYSMAC NET Link System during each cycle
when a SYSMAC LINK Unit and/or SYSMAC NET Link Unit is mounted to a
Rack.
These times are recorded in 4-digit BCD to tenths of a millisecond (000.0 ms
to 999.9 ms) and are refreshed every cycle.
Bits
15 to 12 11 to 08 07 to 04 03 to 00
102 101 100 101

3-5-6 Calendar/Clock Area and Bits (CPU11-E Only)


Calendar/Clock Area If AR 2114 (Stop Bit) is OFF, then the date, day, and time will be available in
BCD in AR 18 to AR 20 and AR 2100 to AR 2108 as shown below. This area
can also be controlled with AR 2113 (Seconds Round-off Bit) and AR 2115
(Set Bit).

Bits Contents Possible values


AR 1800 to AR 1807 Seconds 00 to 59
AR 1808 to AR 1815 Minutes 00 to 59
AR 1900 to AR 1907 Hours 00 to 23 (24-hour system)
AR 1908 to AR 1915 Day of month 01 to 31 (adjusted by month and for leap year)
AR 2000 to AR 2007 Month 1 to 12
AR 2008 to AR 2015 Year 00 to 99 (Rightmost two digits of year)
AR 2100 to AR 2107 Day of week 00 to 06 (00: Sunday; 01: Monday; 02: Tuesday; 03: Wednesday; 04:
Thursday; 05: Friday; 06: Saturday)

Seconds Round-off Bit AR 2113 is turned ON to round the seconds of the Calendar/clock Area to
zero, i.e., if the seconds is 29 or less, it is merely set to 00; if the seconds is
30 or greater, the minutes is incremented by 1 and the seconds is set to 00.

Stop Bit AR 2114 is turned OFF to enable the operation of the Calendar/clock Area
and ON to stop the operation.

Set Bit AR 2115 is used to set the Calendar/clock Area as described below. This
data must be in BCD and must be set within the limits for the Calendar/clock
Area given above.

35
AR Area Section 3-5

1, 2, 3... 1. Turn ON AR 2114 (Stop Bit).


2. Set the desired date, day, and time, being careful not to turn OFF AR
2114 (Stop Bit) when setting the day of the week (theyre in the same
word). (On the Programming Console, the Bit/Digit Monitor and Force
Set/Reset Operations are the easiest ways to set this data.)
Note A more convenient way is if steps 1 and 2 are executed simulta-
neously as follows.
Set 4000 to 4006 with present value change.

Stop bit ON data

3. Turn ON AR 2115 (Reset Bit). The Calendar/clock will automatically start


operating with the designated settings and AR 2114 and AR 2115 will
both be turned OFF.
The Calendar/clock Area and Bits are refreshed each cycle while operational.

3-5-7 TERMINAL Mode Key Bits (CPU11-E Only)


If the Programming Console is mounted to the PC and is in TERMINAL
mode, any inputs on keys 0 through 9 (including characters A through F, i.e,
keys 0 through 5 with SHIFT) will turn on a corresponding bit in AR 22. TER-
MINAL mode is entered either through Programming Console operations or
by executing KEY(62).
The bits in AR 22 correspond to Programming Console inputs as follows:
Bit Programming Console input
AR 2200 0
AR 2201 1
AR 2202 2
AR 2203 3
AR 2204 4
AR 2205 5
AR 2206 6
AR 2207 7
AR 2208 8
AR 2209 9
AR 2210 A
AR 2211 B
AR 2212 C
AR 2213 D
AR 2214 E
AR 2215 F

Refer to Section 5 Instruction Set for details on KEY(62) and to Section 7


Program Monitoring and Execution for details on the TERMINAL mode.

3-5-8 Power-OFF Counter


AR 23 provides in 4-digit BCD the number of times that the PC power has
been turned off. This counter can be reset as necessary using the PV
Change 1 operation from the Programming Console. (Refer to 7-1-4 Hex/
BCD Data Modification for details.) The Power-OFF Counter is refreshed
every time power is turned on.

36
AR Area Section 3-5

3-5-9 CPU Low Battery Flag (CPU11-E Only)


AR 2404 is the Battery Alarm Flag for the CPU11-E backup battery.
AR 2404 is refreshed every cycle while the PC is in RUN or MONITOR
mode.

3-5-10 SCAN(18) Cycle Time Flag (CPU11-E Only)


AR 2405 turns ON when the cycle time set with SCAN(18) is shorter than the
actual cycle time.
AR 2405 is refreshed every cycle while the PC is in RUN or MONITOR
mode.

3-5-11 Network Parameter Flags


AR 2406 is ON when the actual setting of the network parameter for operat-
ing level 1 of the SYSMAC LINK System differs from the setting at the FIT.
AR 2407 is ON when the actual setting of the network parameter for operat-
ing level 0 of the SYSMAC LINK System differs from the setting at the FIT.

3-5-12 Link Unit Mounted Flags


The following flags indicate when the specified Link Units are mounted to the
Racks. (Refer to 3-5-13 CPU-mounting Device Flag for CPU-mounting Host
Link Units.) These flags are refreshed every cycle.

Name Bit Link Unit


SYSMAC LINK/SYSMAC NET Link Unit AR 2408 SYSMAC LINK/SYSMAC NET Link Unit in operating level 1
Level 1 Mounted Flag
SYSMAC LINK/SYSMAC NET Link Unit AR 2409 SYSMAC LINK/SYSMAC NET Link Unit in operating level 0
Level 0 Mounted Flag
Rack-mounting Host Link Unit Level 1 AR 2413 Rack-mounting Host Link Unit in operating level 1
Rack-mounting Host Link Unit Level 0 AR 2414 Rack-mounting Host Link Unit in operating level 0

3-5-13 CPU-mounting Device Flag


AR 2415 turns ON when any device is mounted directly to the CPU. This in-
cludes CPU-mounting Host Link Units, Programming Consoles, and Interface
Units. This flag is refreshed every cycle.

3-5-14 FALS-generating Address


AR 25 contains the address generating a user-programmed FALS code or a
system FALS code 9F (cycle time error). The address is in 4-digit BCD. FALS
codes are described in 5-22-1 FAILURE ALARM - FAL(06) and SEVERE
FAILURE ALARM - FALS(07). The address is refreshed every cycle when an
FALS code has been generated.

3-5-15 Cycle Time Indicators


AR 26 contains the maximum cycle time that has occurred since program
execution was begun. AR 27 contains the present cycle time.
Both times are to tenths of a millisecond in 4-digit BCD (000.0 ms to 999.9
ms), and are refreshed every cycle.

37
DM Area Section 3-6

3-6 DM (Data Memory) Area


The DM area is divided into various parts as described in the following table.

Addresses User Usage


read/write
DM 0000 to DM 0968 Read/write General User Area
DM 0969 to DM 0999 Read/write Error History Area (CPU11-E only)
DM 1000 to DM 1999 Read only Special I/O Unit Data Area

Although composed of 16-bit words like any other data area, all data in any
part of the DM area cannot be specified by bit for use in instructions with bit
operands. DM 0000 to DM 0999 can be written to by the program, but DM
1000 to DM 1999 can only be written to using a peripheral programming de-
vice, such as a Programming Console, GPC, FIT, or SYSMATE software.
The DM area retains status during power interruptions.

Indirect Addressing Normally, when the content of a data area word is specified for an instruction,
the instruction is performed directly on the content of that word. For example,
suppose MOV(21) is performed with DM 0100 as the first operand and LR 20
as the second operand. When this instruction is executed, the content of DM
0100 is moved to LR 20.
It is possible, however, to use indirect DM addresses as the operands for
many instructions. To indicate an indirect DM address, *DM is input with the
address of the operand. With an indirect address, with content of this oper-
and does not contain the actual data to be used. Instead, its contents is as-
sumed to hold the address of another DM word, the content of which will ac-
tually be used in the instruction. If *DM 0100 was used in our example above
and the content of DM 0100 is 0324, then *DM 0100 actually means that the
content of DM 0324 is to be used as the operand in the instruction, and the
content of DM 0324 will be moved to LR 20.

Word Content
MOV(21)
DM 0099 4C59
*DM 0100
DM 0100 0324
LR 00 Indirect Indicates
DM 0101 F35A
address DM 0324

DM 0324 5555
DM 0325 2506 5555 moved
DM 0326 D541 to LR 00.

Error History Area


DM 0969 to DM 0999 are used to store up to 10 records that show the na-
ture, time, and date of errors that have occurred in the PC. The time and date
entries in these records are only recorded in PCs that are equipped with the
calendar/clock function.
The Error History Area will store system-generated or
FAL(06)/FALS(07)-generated error codes whenever AR 0715 (Error History
Enable Bit) is ON. Refer to Section 8 Troubleshooting for details on error
codes.

38
DM Area Section 3-6

Area Structure Error records occupy three words each stored between DM 0970 and DM
0999. The last record that was stored can be obtained via the content of DM
0969 (Error Record Pointer). The record number, DM words, and pointer val-
ue for each of the ten records are as follows:

Record Addresses Pointer value


None N.A. 0000
1 DM 0970 to DM 0972 0001
2 DM 0973 to DM 0975 0002
3 DM 0976 to DM 0978 0003
4 DM 0979 to DM 0981 0004
5 DM 0982 to DM 0984 0005
6 DM 0985 to DM 0987 0006
7 DM 0988 to DM 0990 0007
8 DM 0991 to DM 0993 0008
9 DM 0994 to DM 0996 0009
10 DM 0997 to DM 0999 000A

Although each of them contains a different record, the structure of each re-
cord is the same: the first word contains the error code; the second and third
words, the day and time. The error code will be either one generated by the
system or by FAL(06)/FALS(07); the time and date will be the date and time
from AR 18 and AR 19 (Calender/date Area). Also recorded with the error
code is an indication of whether the error is fatal (08) or non-fatal (00). This
structure is shown below.

Word Bit Content


First 00 to 07 Error code
08 to 15 00 (non-fatal) or 80 (fatal)
Second 00 to 07 Seconds
08 to 15 Minutes
Third 00 to 07 Hours
08 to 15 Day of month

Operation When the first error code is generated with AR 0715 (Error History Enable
Bit) turned ON, the relevant data will be placed in the error record after the
one indicated by the History Record Pointer (initially this will be record 1) and
the Pointer will be incremented. Any other error codes generated thereafter
will be placed in consecutive records until the last one is used. Processing of
further error records is based on the status of AR 0713 (Error History Over-
write Bit).
If AR 0713 is ON and the Pointer contains 000A, the next error will be written
into record 10, the contents of record 10 will be moved to record 9, and so on
until the contents of record 1 is moved off the end and lost, i.e., the area
functions like a shift register. The Record Pointer will remain set to 000A.
If AR 0713 is OFF and the Pointer reaches 000A, the contents of the Error
History Error will remain as it is and any error codes generate thereafter will
not be recorded until AR 0713 is turned OFF or until the Error History Area is
reset.
The Error History Area can be reset by turning ON and then OFF AR 0714
(Error History Reset Bit). When this is done, the Record Pointer will be reset

39
TC Area Section 3-8

to 0000, the Error History Area will be reset (i.e., cleared), and any further
error codes will be recorded from the beginning of the Error History Area. AR
0715 (Error History Enable Bit) must be ON to reset the Error History Area.

Special I/O Unit Data The DM area between 1000 and 1999 is allocated to Special I/O Units as
shown below. When not used for this purpose, this area is available for other
uses.

Unit Addresses
0 DM 1000 to DM 1099
1 DM 1100 to DM 1199
2 DM 1200 to DM 1299
3 DM 1300 to DM 1399
4 DM 1400 to DM 1499
5 DM 1500 to DM 1599
6 DM 1600 to DM 1699
7 DM 1700 to DM 1799
8 DM 1800 to DM 1899
9 DM 1900 to DM 1999

3-7 HR (Holding Relay) Area


The HR area is used to store/manipulate various kinds of data and can be
accessed either by word or by bit. Word addresses range from HR 00
through HR 99; bit addresses, from HR 0000 through HR 9915. HR bits can
be used in any order required and can be programmed as often as required.
The HR area retains status when the system operating mode is changed,
when power is interrupted, or when PC operation is stopped.
HR area bits and words can be used to to preserve data whenever PC op-
eration is stopped. HR bits also have various special applications, such as
creating latching relays with the Keep instruction and forming self-holding
outputs. These are discussed in Section 4 Writing and Inputting the Program
and Section 5 Instruction Set.
When a SYSMAC LINK System is used, a certain number of HR bits is re-
quired for a routing table and monitor timer. These bits are taken from be-
tween HR 00 to HR 42. Refer to the SYSMAC LINK System Manual for de-
tails.

3-8 TC (Timer/Counter) Area


The TC area is used to create and program timers and counters and holds
the Completion flags, set values (SV), and present values (PV) for all timers
and counters. All of these are accessed through TC numbers ranging from
TC 000 through TC 511. Each TC number is defined as either a timer or
counter using one of the following instructions: TIM, TIMH, CNT, CNTR(12),
TIMW<13>, TMHW<15>, or CNTW<14>. No prefix is required when using a
TC number in a timer or counter instruction.
Once a TC number has been defined using one of these instructions, it can-
not be redefined elsewhere in the program either using the same or a differ-
ent instruction. If the same TC number is defined in more than one of these
instructions or in the same instruction twice, an error will be generated during
the program check. There are no restrictions on the order in which TC num-
bers can be used.

40
LR Area Section 3-9

Once defined, a TC number can be designated as an operand in one or more


of certain set of instructions other than those listed above. When defined as a
timer, a TC number designated as an operand takes a TIM prefix. The TIM
prefix is used regardless of the timer instruction that was used to define the
timer. Once defined as a counter, the TC number designated as an operand
takes a CNT prefix. The CNT is also used regardless of the counter instruc-
tion that was used to define the counter.

TC numbers can be designated for operands that require bit data or for oper-
ands that require word data. When designated as an operand that requires
bit data, the TC number accesses the completion flag of the timer or counter.
When designated as an operand that requires word data, the TC number ac-
cesses a memory location that holds the PV of the timer or counter.

TC numbers are also used to access the SV of timers and counters from a
Programming Device. The procedures for doing so using the Programming
Console are provided in 7-1 Monitoring Operation and Modifying Data.

The TC area retains the SVs of both timers and counters during power inter-
ruptions. The PVs of timers are reset when PC operation is begun and when
reset in interlocked program sections. Refer 5-8 INTERLOCK and INTER-
LOCK CLEAR - IL(02) and ILC(03) for details on timer and counter operation
in interlocked program sections. The PVs of counters are not reset at these
times.

Note that in programming TIM 000 is used to designate three things: the
Timer instruction defined with TC number 000, the completion flag for this
timer, and the PV of this timer. The meaning in context should be clear, i.e.,
the first is always an instruction, the second is always a bit, and the third is
always a word. The same is true of all other TC numbers prefixed with TIM or
CNT.

3-9 LR (Link Relay) Area


The LR area is used as a common data area to transfer information between
PCs. This data transfer is achieved through a PC Link System, a SYSMAC
LINK System, or a SYSMAC NET Link System. Certain words will be allo-
cated as the write words of each PC. These words are written by the PC and
automatically transferred to the same LR words in the other PCs in the Sys-
tem. The write words of the other PCs are transferred in as read words so
that each PC can access the data written by the other PCs in the PC Link
System. Only the write words allocated to the particular PC will be available
for writing; all other words may be read only. Refer to the PC Link System
Manual, SYSMAC LINK System Manual, or SYSMAC NET Link System Man-
ual for details.

The LR area is accessible either by bit or by word. LR area word addresses


range from LR 00 to LR 63; LR area bit addresses, from LR 0000 to LR
6315. Any part of the LR area that is not used by the PC Link System can be
used as work words or work bits.

LR area data is not retained when the power is interrupted, when the PC is
changed to PROGRAM mode, or when it is reset in an interlocked program
section. Refer to 5-8 INTERLOCK and INTERLOCK CLEAR - IL(02) and
ILC(03) for details on interlocks.

41
TR Area Section 3-11

3-10 Program Memory


Program Memory is where the user program is stored. The amount of Pro-
gram Memory available is either 4K or 8K words, depending on the type of
Memory Unit mounted to the CPU.
Memory Units come in different types, such as RAM and ROM Units, and for
each type there are different sizes. (Refer to the Installation Guide for de-
tails.)
To store instructions in Program Memory, input the instructions through the
Programming Console, or download programming data from a FIT, floppy
disk, cassette tape, or host computer, or from a File Memory Unit if one is
mounted to the CPU Rack. Refer to the end of Appendix A Standard Models
for information on FIT and other special products. Programming Console op-
erations, including those for program input, are described in Sections 4 and
7.

3-11 TR (Temporary Relay) Area


The TR area provides eight bits that are used only with the LD and OUT in-
structions to enable certain types of branching ladder diagram programming.
The use of TR bits is described in Section 4 Writing and Inputting the Pro-
gram.
TR addresses range from TR 0 though TR 7. Each of these bits can be used
as many times as required and in any order required as long as the same LR
bit is not used twice in the same instruction block.

42
SECTION 4
Writing and Inputting the Program

This section explains the basic steps and concepts involved in writing a basic ladder diagram program, inputting the pro-
gram into memory, and executing it. It introduces the instructions that are used to build the basic structure of the ladder
diagram and control its execution. The entire set of instructions used in programming is described in Section 5 Instruc-
tion Set.

4-1 Basic Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44


4-2 Instruction Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4-3 Basic Ladder Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4-3-1 Basic Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4-3-2 Mnemonic Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4-3-3 Ladder Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4-3-4 OUTPUT and OUTPUT NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4-3-5 The END Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4-3-6 Logic Block Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4-3-7 Coding Multiple Right-hand Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4-4 The Programming Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4-4-1 The Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4-4-2 PC Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4-4-3 The Display Message Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4-5 Preparation for Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4-5-1 Entering the Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4-5-2 Buzzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4-5-3 Clearing Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
4-5-4 Registering the I/O Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4-5-5 Clearing Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4-5-6 Verifying the I/O Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4-5-7 Reading the I/O Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4-5-8 Clearing the I/O Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4-5-9 NET Link Table Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4-6 Inputting, Modifying, and Checking the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4-6-1 Setting and Reading from Program Memory Address . . . . . . . . . . . . . . . . . . . . . 72
4-6-2 Entering and Editing Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4-6-3 Checking the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4-6-4 Displaying the Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4-6-5 Program Searches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4-6-6 Inserting and Deleting Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4-6-7 Branching Instruction Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4-6-8 Jumps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4-7 Controlling Bit Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4-7-1 DIFFERENTIATE UP and DIFFERENTIATE DOWN . . . . . . . . . . . . . . . . . . . . 89
4-7-2 KEEP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4-7-3 Self-maintaining Bits (Seal) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4-8 Work Bits (Internal Relays) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4-9 Programming Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4-10 Program Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

43
Instruction Terminology Section 4-2

4-1 Basic Procedure


There are several basic steps involved in writing a program. Sheets that can
be copied to aid in programming are provided in Appendix F Word Assign-
ment Recording Sheets and Appendix G Program Coding Sheet.
1, 2, 3... 1. Obtain a list of all I/O devices and the I/O points that have been as-
signed to them and prepare a table that shows the I/O bit allocated to
each I/O device.
2. If the PC has any Units that are allocated words in data areas other than
the IR area or are allocated IR words in which the function of each bit is
specified by the Unit, prepare similar tables to show what words are
used for which Units and what function is served by each bit within the
words. These Units include Special I/O Units and Link Units.
3. Determine what words are available for work bits and prepare a table in
which you can allocate these as you use them.
4. Also prepare tables of TC numbers and jump numbers so that you can
allocate these as you use them. Remember, the function of a TC num-
ber can be defined only once within the program; jump numbers 01
through 99 can be used only once each. (TC number are described in
5-12 Timer and Counter Instructions; jump numbers are described later
in this section.)
5. Draw the ladder diagram.
6. Input the program into the CPU. When using the Programming Console,
this will involve converting the program to mnemonic form.
7. Check the program for syntax errors and correct these.
8. Execute the program to check for execution errors and correct these.
9. After the entire Control System has been installed and is ready for use,
execute the program and fine tune it if required.
10. Make a backup copy of the program.
The basics of ladder-diagram programming and conversion to mnemonic
code are described in 4-3 Basic Ladder Diagrams. Preparing for and input-
ting the program via the Programming Console are described in 4-4 The Pro-
gramming Console through 4-6 Inputting, Modifying, and Checking the Pro-
gram. The rest of Section 4 covers more advanced programming, program-
ming precautions, and program execution. All special application instructions
are covered in Section 5 Instruction Set. Debugging is described in Section 7
Program Monitoring and Execution. Section 8 Troubleshooting also provides
information required for debugging.

4-2 Instruction Terminology


There are basically two types of instructions used in ladder-diagram pro-
gramming: instructions that correspond to the conditions on the ladder dia-
gram and are used in instruction form only when converting a program to
mnemonic code and instructions that are used on the right side of the ladder
diagram and are executed according to the conditions on the instruction lines
leading to them.
Most instructions have at least one or more operands associated with them.
Operands indicate or provide the data on which an instruction is to be per-
formed. These are sometimes input as the actual numeric values, but are
usually the addresses of data area words or bits that contain the data to be
used. For instance, a MOVE instruction that has IR 000 designated as the
source operand will move the contents of IR 000 to some other location. The
other location is also designated as an operand. A bit whose address is des-
ignated as an operand is called an operand bit; a word whose address is

44
Basic Ladder Diagrams Section 4-3

designated as an operand is called an operand word. If the actual value is


entered as a constant, it is preceded by # to indicate that it is not an address.
Other terms used in describing instructions are introduced in Section 5 In-
struction Set.

4-3 Basic Ladder Diagrams


A ladder diagram consists of one line running down the left side with lines
branching off to the right. The line on the left is called the bus bar; the
branching lines, instruction lines or rungs. Along the instruction lines are
placed conditions that lead to other instructions on the right side. The logical
combinations of these conditions determine when and how the instructions at
the right are executed. A ladder diagram is shown below.

00000 06315 25208 HR 0109 LR 2503 24400 24401


Instruction

00001 00501 00502 00503 00504

00100 00002 00003 HR 0050 00007 TIM 001 LR 0515 00403 00405
Instruction

00010 21001 21002

00011 21005 21007

As shown in the diagram above, instruction lines can branch apart and they
can join back together. The vertical pairs of lines are called conditions. Con-
ditions without diagonal lines through them are called normally open condi-
tions and correspond to a LOAD, AND, or OR instruction. The conditions with
diagonal lines through them are called normally closed conditions and corre-
spond to a LOAD NOT, AND NOT, or OR NOT instruction. The number
above each condition indicates the operand bit for the instruction. It is the
status of the bit associated with each condition that determines the execution
condition for following instructions. The way the operation of each of the in-
structions corresponds to a condition is described below. Before we consider
these, however, there are some basic terms that must be explained.
Note When displaying ladder diagrams with a GPC, a FIT, or LSS, a second bus
bar will be shown on the right side of the ladder diagram and will be con-
nected to all instructions on the right side. This does not change the lad-
der-diagram program in any functional sense. No conditions can be placed
between the instructions on the right side and the right bus bar, i.e., all in-
structions on the right must be connected directly to the right bus bar. Refer
to the GPC, FIT, or LSS Operation Manual for details.

4-3-1 Basic Terms

Normally Open and Each condition in a ladder diagram is either ON or OFF depending on the
Normally Closed status of the operand bit that has been assigned to it. A normally open condi-
Conditions tion is ON if the operand bit is ON; OFF if the operand bit is OFF. A normally
closed condition is ON if the operand bit is OFF; OFF if the operand bit is
ON. Generally speaking, you use a normally open condition when you want

45
Basic Ladder Diagrams Section 4-3

something to happen when a bit is ON, and a normally closed condition when
you want something to happen when a bit is OFF.

00000
Instruction
Instruction is executed
when IR bit 00000 is ON.
Normally open
condition
00000
Instruction
Instruction is executed
when IR bit 00000 is OFF.
Normally closed
condition

Execution Conditions In ladder diagram programming, the logical combination of ON and OFF con-
ditions before an instruction determines the compound condition under which
the instruction is executed. This condition, which is either ON or OFF, is
called the execution condition for the instruction. All instructions other than
LOAD instructions have execution conditions.

Operand Bits The operands designated for any of the ladder instructions can be any bit in
the IR, SR, HR, AR, LR, or TC areas. This means that the conditions in a
ladder diagram can be determined by I/O bits, flags, work bits, timers/count-
ers, etc. LOAD and OUTPUT instructions can also use TR area bits, but they
do so only in special applications. Refer to 4-6-7 Branching Instruction Lines
for details.

Logic Blocks The way that conditions correspond to what instructions is determined by the
relationship between the conditions within the instruction lines that connect
them. Any group of conditions that go together to create a logic result is
called a logic block. Although ladder diagrams can be written without actually
analyzing individual logic blocks, understanding logic blocks is necessary for
efficient programming and is essential when programs are to be input in mne-
monic code.

4-3-2 Mnemonic Code


The ladder diagram cannot be directly input into the PC via a Programming
Console; a GPC, a FIT, or LSS is required. To input from a Programming
Console, it is necessary to convert the ladder diagram to mnemonic code.
The mnemonic code provides exactly the same information as the ladder dia-
gram, but in a form that can be typed directly into the PC. Actually you can
program directly in mnemonic code, although it in not recommended for be-
ginners or for complex programs. Also, regardless of the Programming De-
vice used, the program is stored in memory in mnemonic form, making it im-
portant to understand mnemonic code.
Because of the importance of the Programming Console as a peripheral de-
vice and because of the importance of mnemonic code in complete under-
standing of a program, we will introduce and describe the mnemonic code
along with the ladder diagram. Remember, you will not need to use the mne-
monic code if you are inputting via a GPC, a FIT, or LSS (although you can
use it with these devices too, if you prefer).

Program Memory Structure The program is input into addresses in Program Memory. Addresses in Pro-
gram Memory are slightly different to those in other memory areas because
each address does not necessarily hold the same amount of data. Rather,
each address holds one instruction and all of the definers and operands (de-
scribed in more detail later) required for that instruction. Because some in-

46
Basic Ladder Diagrams Section 4-3

structions require no operands, while others require up to three operands,


Program Memory addresses can be from one to four words long.
Program Memory addresses start at 00000 and run until the capacity of Pro-
gram Memory has been exhausted. The first word at each address defines
the instruction. Any definers used by the instruction are also contained in the
first word. Also, if an instruction requires only a single bit operand (with no
definer), the bit operand is also programmed on the same line as the instruc-
tion. The rest of the words required by an instruction contain the operands
that specify what data is to be used. When converting to mnemonic code, all
but ladder diagram instructions are written in the same form, one word to a
line, just as they appear in the ladder diagram symbols. An example of mne-
monic code is shown below. The instructions used in it are described later in
the manual.

Address Instruction Operands


00000 LD HR 0001
00001 AND 00001
00002 OR 00002
00003 LD NOT 00100
00004 AND 00101
00005 AND LD 00102
00006 MOV(21)
000
DM 0000
00007 CMP(20)
DM 0000
HR 00
00008 LD 25505
00009 OUT 00501
00010 MOV(21)
DM 0000
DM 0500
00011 DIFU(13) 00502
00012 AND 00005
00013 OUT 00503

The address and instruction columns of the mnemonic code table are filled in
for the instruction word only. For all other lines, the left two columns are left
blank. If the instruction requires no definer or bit operand, the operand col-
umn is left blank for first line. It is a good idea to cross through any blank
data column spaces (for all instruction words that do not require data) so that
the data column can be quickly scanned to see if any addresses have been
left out.
When programming, addresses are automatically displayed and do not have
to be input unless for some reason a different location is desired for the in-
struction. When converting to mnemonic code, it is best to start at Program
Memory address 00000 unless there is a specific reason for starting else-
where.

4-3-3 Ladder Instructions


The ladder instructions are those instructions that correspond to the condi-
tions on the ladder diagram. Ladder instructions, either independently or in
combination with the logic block instructions described next, form the execu-
tion conditions upon which the execution of all other instructions are based.

LOAD and LOAD NOT The first condition that starts any logic block within a ladder diagram corre-
sponds to a LOAD or LOAD NOT instruction. Each of these instruction re-

47
Basic Ladder Diagrams Section 4-3

quires one line of mnemonic code. Instruction is used as a dummy instruc-


tion in the following examples and could be any of the right-hand instructions
described later in this manual.

00000

Address Instruction Operands


A LOAD instruction.
00000 LD 00000
00000 00001 Instruction
00002 LD NOT 00000
A LOAD NOT instruction. 00003 Instruction

When this is the only condition on the instruction line, the execution condition
for the instruction at the right is ON when the condition is ON. For the LOAD
instruction (i.e., a normally open condition), the execution condition will be
ON when IR 00000 is ON; for the LOAD NOT instruction (i.e., a normally
closed condition), it will be ON when 00000 is OFF.

AND and AND NOT When two or more conditions lie in series on the same instruction line, the
first one corresponds to a LOAD or LOAD NOT instruction; and the rest of
the conditions correspond to AND or AND NOT instructions. The following
example shows three conditions which correspond in order from the left to a
LOAD, an AND NOT, and an AND instruction. Again, each of these instruc-
tions requires one line of mnemonic code.

00000 00100 LR 0000


Instruction

Address Instruction Operands


00000 LD 00000
00001 AND NOT 00100
00002 AND LR 0000
00003 Instruction

The instruction will have an ON execution condition only when all three con-
ditions are ON, i.e., when IR 00000 is ON, IR 00100 is OFF, and LR 0000 is
ON.
AND instructions in series can be considered individually, with each taking
the logical AND of the execution condition (i.e., the total of all conditions up to
that point) and the status of the AND instructions operand bit. If both of these
are ON, an ON execution condition will be produced for the next instruction.
If either is OFF, the result will also be OFF. The execution condition for the
first AND instruction in a series is the first condition on the instruction line.
Each AND NOT instruction in series takes the logical AND of its execution
condition and the inverse of its operand bit.

OR and OR NOT When two or more conditions lie on separate instruction lines which run in
parallel and then join together, the first condition corresponds to a LOAD or
LOAD NOT instruction; the other conditions correspond to OR or OR NOT
instructions. The following example shows three conditions which correspond

48
Basic Ladder Diagrams Section 4-3

(in order from the top) to a LOAD NOT, an OR NOT, and an OR instruction.
Again, each of these instructions requires one line of mnemonic code.

00000
Instruction

00100

LR 0000

Address Instruction Operands


00000 LD 00000
00001 OR NOT 00100
00002 OR LR 0000
00003 Instruction

The instruction will have an ON execution condition when any one of the
three conditions is ON, i.e., when IR 00000 is OFF, when IR 00100 is OFF, or
when LR 0000 is ON.
OR and OR NOT instructions can be considered individually, each taking the
logical OR between its execution condition and the status of the OR instruc-
tions operand bit. If either one of these were ON, an ON execution condition
will be produced for the next instruction.

Combining AND and OR When AND and OR instructions are combined in more complicated dia-
Instructions grams, they can sometimes be considered individually, with each instruction
performing a logic operation on the execution condition and the status of the
operand bit. The following is one example. Study this example until you are
convinced that the mnemonic code follows the same logic flow as the ladder
diagram.

00000 00001 00002 00003


Instruction

00200

Address Instruction Operands


00000 LD 00000
00001 AND 00001
00002 OR 00200
00003 AND 00002
00004 AND NOT 00003
00005 Instruction

Here, an AND is taken between the status of IR 00000 and that of IR 00001
to determine the execution condition for an OR with the status of IR 00200.
The result of this operation determines the execution condition for an AND
with the status of IR 00002, which in turn determines the execution condition
for an AND with the inverse (i.e., and AND NOT) of the status of IR 00003.
In more complicated diagrams, however, it is necessary to consider logic
blocks before an execution condition can be determined for the final instruc-

49
Basic Ladder Diagrams Section 4-3

tion, and thats where AND LOAD and OR LOAD instructions are used. Be-
fore we consider more complicated diagrams, however, well look at the in-
structions required to complete a simple input-output program.

4-3-4 OUTPUT and OUTPUT NOT


The simplest way to output the results of combining execution conditions is to
output it directly with the OUTPUT and OUTPUT NOT. These instructions are
used to control the status of the designated operand bit according to the ex-
ecution condition. With the OUTPUT instruction, the operand bit will be
turned ON as long as the execution condition is ON and will be turned OFF
as long as the execution condition is OFF. With the OUTPUT NOT instruc-
tion, the operand bit will be turned ON as long as the execution condition is
OFF and turned OFF as long as the execution condition is ON. These appear
as shown below. In mnemonic code, each of these instructions requires one
line.

00000 Address Instruction Operands


00200
00000 LD 00000
00001 OUT 00200
00001
00201 Address Instruction Operands
00000 LD 00001
00001 OUT NOT 00201

In the above examples, IR 00200 will be ON as long as IR 00000 is ON and


IR 00201 will be OFF as long as IR 00001 is ON. Here, IR 00000 and IR
00001 will be input bits and IR 00200 and IR 00201 output bits assigned to
the Units controlled by the PC, i.e., the signals coming in through the input
points assigned IR 00000 and IR 00001 are controlling the output points as-
signed IR 00200 and IR 00201, respectively.

The length of time that a bit is ON or OFF can be controlled by combining the
OUTPUT or OUTPUT NOT instruction with TIMER instructions. Refer to Ex-
amples under 5-12-1 TIMER TIM for details.

4-3-5 The END Instruction


The last instruction required to complete a simple program is the END in-
struction. When the CPU cycles the program, it executes all instruction up to
the first END instruction before returning to the beginning of the program and
beginning execution again. Although an END instruction can be placed at any
point in a program, which is sometimes done when debugging, no instruc-
tions past the first END instruction will be executed until it is removed. The
number following the END instruction in the mnemonic code is its function
code, which is used when inputted most instruction into the PC. These are

50
Basic Ladder Diagrams Section 4-3

described later. The END instruction requires no operands and no conditions


can be placed on the same instruction line with it.

00000 00001
Instruction

END(01)
Program execution
ends here.

Address Instruction Operands


00000 LD 00000
00001 AND NOT 00001
00002 Instruction
00003 END(01) ---

If there is no END instruction anywhere in the program, the program will not
be executed at all.
Now you have all of the instructions required to write simple input-output pro-
grams. Before we finish with ladder diagram basic and go onto inputting the
program into the PC, lets look at logic block instruction (AND LOAD and OR
LOAD), which are sometimes necessary even with simple diagrams.

4-3-6 Logic Block Instructions


Logic block instructions do not correspond to specific conditions on the lad-
der diagram; rather, they describe relationships between logic blocks. The
AND LOAD instruction logically ANDs the execution conditions produced by
two logic blocks. The OR LOAD instruction logically ORs the execution condi-
tions produced by two logic blocks.

AND LOAD Although simple in appearance, the diagram below requires an AND LOAD
instruction.

00000 00002
Instruction

00001 00003

Address Instruction Operands


00000 LD 00000
00001 OR 00001
00002 LD 00002
00003 OR NOT 00003
00004 AND LD ---

The two logic blocks are indicated by dotted lines. Studying this example
shows that an ON execution condition will be produced when: either of the
conditions in the left logic block is ON (i.e., when either IR 00000 or IR 00001
is ON), and when either of the conditions in the right logic block is ON (i.e.,
when either IR 00002 is ON or IR 00003 is OFF).
The above ladder diagram cannot, however, be converted to mnemonic code
using AND and OR instructions alone. If an AND between IR 00002 and the
results of an OR between IR 00000 and IR 00001 is attempted, the OR NOT
between IR 00002 and IR 00003 is lost and the OR NOT ends up being an

51
Basic Ladder Diagrams Section 4-3

OR NOT between just IR 00003 and the result of an AND between IR 00002
and the first OR. What we need is a way to do the OR (NOT)s independently
and then combine the results.
To do this, we can use the LOAD or LOAD NOT instruction in the middle of
an instruction line. When LOAD or LOAD NOT is executed in this way, the
current execution condition is saved in a special buffer and the logic process
is restarted. To combine the results of the current execution condition with
that of a previous unused execution condition, an AND LOAD or an OR
LOAD instruction is used. Here LOAD refers to loading the last unused ex-
ecution condition. An unused execution condition is produced by using the
LOAD or LOAD NOT instruction for any but the first condition on an instruc-
tion line.
Analyzing the above ladder diagram in terms of mnemonic instructions, the
condition for IR 00000 is a LOAD instruction and the condition below it is an
OR instruction between the status of IR 00000 and that of IR 00001. The
condition at IR 00002 is another LOAD instruction and the condition below is
an OR NOT instruction, i.e., an OR between the status of IR 00002 and the
inverse of the status of IR 00003. To arrive at the execution condition for the
instruction at the right, the logical AND of the execution conditions resulting
from these two blocks will have to be taken. AND LOAD does this. The mne-
monic code for the ladder diagram is shown below. The AND LOAD instruc-
tion requires no operands of its own, because it operates on previously deter-
mined execution conditions. Here too, dashes are used to indicate that no
operands needs designated or input.

OR LOAD The following diagram requires an OR LOAD instruction between the top log-
ic block and the bottom logic block. An ON execution condition will be pro-
duced for the instruction at the right either when IR 00000 is ON and IR
00001 is OFF, or when IR 00002 and IR 00003 are both ON. The operation
of the OR LOAD instruction and its mnemonic code is exactly the same as
that for an AND LOAD instruction, except that the current execution condition
is ORed with the last unused execution condition.

00000 00001
Instruction

00002 00003

Address Instruction Operands


00000 LD 00000
00001 AND NOT 00001
00002 LD 00002
00003 AND 00003
00004 OR LD ---

Naturally, some diagrams will require both AND LOAD and OR LOAD instruc-
tions.

Logic Block Instructions in To code diagrams with logic block instructions in series, the diagram must be
Series divided into logic blocks. Each block is coded using a LOAD instruction to
code the first condition, and then AND LOAD or OR LOAD is used to logically
combine the blocks. With both AND LOAD and OR LOAD there are two ways
to achieve this. One is to code the logic block instruction after the first two
blocks and then after each additional block. The other is to code all of the

52
Basic Ladder Diagrams Section 4-3

blocks to be combined, starting each block with LOAD or LOAD NOT, and
then to code the logic block instructions which combine them. In this case,
the instructions for the last pair of blocks should be combined first, and then
each preceding block should be combined, working progressively back to the
first block. Although either of these methods will produce exactly the same
result, the second method, that of coding all logic block instructions together,
can be used only if eight or fewer blocks are being combined, i.e., if seven or
fewer logic block instructions are required.

The following diagram requires AND LOAD to be converted to mnemonic


code because three pairs of parallel conditions lie in series. The two options
for coding the programs are also shown.

00000 00002 00004


00500

00001 00003 00005

Address Instruction Operands Address Instruction Operands


00000 LD 00000 00000 LD 00000
00001 OR NOT 00001 00001 OR NOT 00001
00002 LD NOT 00002 00002 LD NOT 00002
00003 OR 00003 00003 OR 00003
00004 AND LD 00004 LD 00004
00005 LD 00004 00005 OR 00005
00006 OR 00005 00006 AND LD
00007 AND LD 00007 AND LD
00008 OUT 00500 00008 OUT 00500

Again, with the method on the right, a maximum of eight blocks can be com-
bined. There is no limit to the number of blocks that can be combined with
the first method.

The following diagram requires OR LOAD instructions to be converted to


mnemonic code because three pairs of series conditions lie in parallel to
each other.

00000 00001
00501

00002 00003

00040 00005

The first of each pair of conditions is converted to LOAD with the assigned bit
operand and then ANDed with the other condition. The first two blocks can
be coded first, followed by OR LOAD, the last block, and another OR LOAD;

53
Basic Ladder Diagrams Section 4-3

or the three blocks can be coded first followed by two OR LOADs. The mne-
monic codes for both methods are shown below.

Address Instruction Operands Address Instruction Operands


00000 LD 00000 00000 LD 00000
00001 AND NOT 00001 00001 AND NOT 00001
00002 LD NOT 00002 00002 LD NOT 00002
00003 AND NOT 00003 00003 AND NOT 00003
00004 OR LD 00004 LD 00004
00005 LD 00004 00005 AND 00005
00006 AND 00005 00006 OR LD
00007 OR LD 00007 OR LD
00008 OUT 00501 00008 OUT 00501

Again, with the method on the right, a maximum of eight blocks can be com-
bined. There is no limit to the number of blocks that can be combined with
the first method.

Combining AND LOAD and Both of the coding methods described above can also be used when using
OR LOAD AND LOAD and OR LOAD, as long as the number of blocks being combined
does not exceed eight.
The following diagram contains only two logic blocks as shown. It is not nec-
essary to further separate block b components, because it can be coded di-
rectly using only AND and OR.

00000 00001 00002 00003


00501

00201

00004

Block Block
a b

Address Instruction Operands


00000 LD 00000
00001 AND NOT 00001
00002 LD 00002
00003 AND 00003
00004 OR 00201
00005 OR 00004
00006 AND LD
00007 OUT 00501

Although the following diagram is similar to the one above, block b in the dia-
gram below cannot be coded without separating it into two blocks combined
with OR LOAD. In this example, the three blocks have been coded first and
then OR LOAD has been used to combine the last two blocks, followed by
AND LOAD to combine the execution condition produced by the OR LOAD
with the execution condition of block a.
When coding the logic block instructions together at the end of the logic
blocks they are combining, they must, as shown below, be coded in reverse
order, i.e., the logic block instruction for the last two blocks is coded first, fol-

54
Basic Ladder Diagrams Section 4-3

lowed by the one to combine the execution condition resulting from the first
logic block instruction and the execution condition of the logic block third from
the end, and on back to the first logic block that is being combined.

Block
b1 Address Instruction Operands
00000 00001 00002 00003 00000 LD NOT 00000
00502
00001 AND 00001
00004 00202
00002 LD 00002
00003 AND NOT 00003
00004 LD NOT 00004
Block
b2 00005 AND 00202
00006 OR LD
Block Block 00007 AND LD
a b
00008 OUT 00502

Complicated Diagrams When determining what logic block instructions will be required to code a dia-
gram, it is sometimes necessary to break the diagram into large blocks and
then continue breaking the large blocks down until logic blocks that can be
coded without logic block instructions have been formed. These blocks are
then coded, combining the small blocks first, and then combining the larger
blocks. Either AND LOAD or OR LOAD is used to combine the blocks, i.e.,
AND LOAD or OR LOAD always combines the last two execution conditions
that existed, regardless of whether the execution conditions resulted from a
single condition, from logic blocks, or from previous logic block instructions.
When working with complicated diagrams, blocks will ultimately be coded
starting at the top left and moving down before moving across. This will gen-
erally mean that, when there might be a choice, OR LOAD will be coded be-
fore AND LOAD.
The following diagram must be broken down into two blocks and each of
these then broken into two blocks before it can be coded. As shown below,
blocks a and b require an AND LOAD. Before AND LOAD can be used, how-
ever, OR LOAD must be used to combine the top and bottom blocks on both
sides, i.e., to combine a1 and a2; b1 and b2.

Block Block
a1 b1 Address Instruction Operands

00000 00001 00004 00005


00000 LD 00000
00503 00001 AND NOT 00001
00002 LD NOT 00002
00002 00003 00006 00007 00003 AND 00003
Blocks a1 and a2 00004 OR LD
Block Block 00005 LD 00004
a2 b2
00006 AND 00005
00007 LD 00006
Block Block
a b 00008 AND 00007
Blocks b1 and b2 00009 OR LD
Blocks a and b 00010 AND LD
00011 OUT 00503

The following type of diagram can be coded easily if each block is coded in
order: first top to bottom and then left to right. In the following diagram,

55
Basic Ladder Diagrams Section 4-3

blocks a and b would be combined using AND LOAD as shown above, and
then block c would be coded and a second AND LOAD would be used to
combined it with the execution condition from the first AND LOAD. Then
block d would be coded, a third AND LOAD would be used to combine the
execution condition from block d with the execution condition from the sec-
ond AND LOAD, and so on through to block n.

00500

Block Block Block Block


a b c n

The following diagram requires an OR LOAD followed by an AND LOAD to


code the top of the three blocks, and then two more OR LOADs to complete
the mnemonic code.

00000 00001 Address Instruction Operands


LR 0000
00000 LD 00000
00002 00003
00001 LD 00001
00002 LD 00002
00004 00005
00003 AND NOT 00003
00006 00007
00004 OR LD --
00005 AND LD --
00006 LD NOT 00004
00007 AND 00005
00008 OR LD --
00009 LD NOT 00006
00010 AND 00007
00011 OR LD --
00012 OUT LR 0000

Although the program will execute as written, this diagram could be drawn as
shown below to eliminate the need for the first OR LOAD and the AND
LOAD, simplifying the program and saving memory space.

00002 00003 00000


Address Instruction Operands
LR 0000 00000 LD 00002
00001 00001 AND NOT 00003
00002 OR 00001
00004 00005 00003 AND 00000
00004 LD NOT 00004
00006 00007 00005 AND 00005
00006 OR LD --
00007 LD NOT 00006
00008 AND 00007
00009 OR LD --
00010 OUT LR 0000

The following diagram requires five blocks, which here are coded in order
before using OR LOAD and AND LOAD to combine them starting from the

56
Basic Ladder Diagrams Section 4-3

last two blocks and working backward. The OR LOAD at program address
00008 combines blocks blocks d and e, the following AND LOAD combines
the resulting execution condition with that of block c, etc.

00000 00001 00002 Address Instruction Operands


LR 0000
00000 LD 00000
Block b 00001 LD 00001
Block a 00002 AND 00002
00003 LD 00003
Block c Block d
00004 AND 00004
00003 00004 00005
00005 LD 00005
00006 LD 00006
00007 AND 00007
00006 00007
Blocks d and e 00008 OR LD --
Block c with result of above 00009 AND LD --
Block e Block b with result of above 00010 OR LD --
Block a with result of above 00011 AND LD --
00012 OUT LR 0000

Again, this diagram can be redrawn as follows to simplify program structure


and coding and to save memory space.

00006 00007 00003 00004 00000


Address Instruction Operands
LR 0000 00000 LD 00006
00005 00001 AND 00007
00002 OR 00005
00001 00002 00003 AND 00003
00004 AND 00004
00005 LD 00001
00006 AND 00002
00007 OR LD --
00008 AND 00000
00009 OUT LR 0000

The next and final example may at first appear very complicated but can be
coded using only two logic block instructions. The diagram appears as fol-
lows:

Block a

00000 00001 00002 00003 00004 00005


00500

01000 01001 00006

00500

Block b Block c

The first logic block instruction is used to combine the execution conditions
resulting from blocks a and b, and the second one is to combine the execu-

57
The Programming Console Section 4-4

tion condition of block c with the execution condition resulting from the nor-
mally closed condition assigned IR 00003. The rest of the diagram can be
coded with OR, AND, and AND NOT instructions. The logical flow for this and
the resulting code are shown below.

Block a Block b

00000 00001 01000 01001

LD 00000 LD 01000
AND 00001 AND 01001
Address Instruction Operands
OR LD 00000 LD 00000
00001 AND 00001
Block c
00002 LD 01000
00500 00004 00005
00003 AND 01001
00004 OR LD --
OR 00500 LD 00004
AND 00005 00005 OR 00500
00006 AND 00002
00002 00003 00006 00007 AND NOT 00003
00008 LD 00004
AND 00002 LD 00006 00009 AND 00005
AND NOT 00003
00010 OR 00006
AND LD 00011 AND LD --
00012 OUT 00500

00500

4-3-7 Coding Multiple Right-hand Instructions


If there is more than one right-hand instruction executed with the same exe-
cution condition, they are coded consecutively following the last condition on
the instruction line. In the following example, the last instruction line contains
one more condition that corresponds to an AND with IR 00004.

00000 00003
HR Address Instruction Operands
0001
00000 LD 00000
00001 00001 OR 00001
00500
00002 OR 00002
00003 OR HR 0000
00002 00004
00506 00004 AND 00003
00005 OUT HR 0001
HR 0000 00006 OUT 00500
00007 AND 00004
00008 OUT 00506

4-4 The Programming Console


Once a program has been written, it must be input into the PC. This can be
done in graphic (ladder diagram) form using a GPC,a FIT, or LSS. The most
common way of inputting a program, however, is through a Programming
Console using mnemonic code. This and the next section describe the Pro-

58
The Programming Console Section 4-4

gramming Console and the operation necessary to prepare for program in-
put. 4-6 Inputting, Modifying, and Checking the Program describes actual
procedures for inputting the program into memory.
Depending on the model of Programming Console used, it is either con-
nected to the CPU via a Programming Console Adapter and Connecting Ca-
ble or it is mounted directly to the CPU.

4-4-1 The Keyboard


The keyboard of the Programming Console is functionally divided by key
color into the following four areas:

White: Numeric Keys The ten white keys are used to input numeric program data such as program
addresses, data area addresses, and operand values. The numeric keys are
also used in combination with the function key (FUN) to enter instructions
with function codes.

Red: CLR Key The CLR key clears the display and cancels current Programming Console
operations. It is also used when you key in the password at the beginning of
programming operations. Any Programming Console operation can be can-
celled by pressing the CLR key, although the CLR key may have to be
pressed two or three times to cancel the operation and clear the display.

Yellow: Operation Keys The yellow keys are used for writing and correcting programs. Detailed ex-
planations of their functions are given later in this section.

Gray: Instruction and Data Except for the SHIFT key on the upper right, the gray keys are used to input
Area Keys instructions and designate data area prefixes when inputting or changing a
program. The SHIFT key is similar to the shift key of a typewriter, and is used
to alter the function of the next key pressed. (It is not necessary to hold the
SHIFT key down; just press it once and then press the key to be used with
it.)

59
The Programming Console Section 4-4

The gray keys other than the SHIFT key have either the mnemonic name of
the instruction or the abbreviation of the data area written on them. The func-
tions of these keys are described below.

Pressed before the function code when inputting an instruction


via its function code.

Pressed to enter SFT (the Shift Register instruction).

Input either after a function code to designate the differentiated


form of an instruction or after a ladder instruction to designate
an inverse condition.

Pressed to enter AND (the AND instruction) or used with NOT


to enter AND NOT.

Pressed to enter OR (the OR instruction) or used with NOT to


enter OR NOT.

Pressed to enter CNT (the Counter instruction) or to designate


a TC number that has already been defined as a counter.

Pressed to enter LD (the Load instruction) or used with NOT to


enter LD NOT. Also pressed to indicate an input bit.

Pressed to enter OUT (the Output instruction) or used with


NOT to enter OUT NOT. Also pressed to indicate an output bit.

Pressed to enter TIM (the Timer instruction) or to designate a


TC number that has already been defined as a timer.

Pressed before designating an address in the TR area.

Pressed before designating an address in the LR area.

Pressed before designating an address in the HR area.

Pressed before designating an address in the AR area.

Pressed before designating an address in the DM area.

Pressed before designating an indirect DM address.

Pressed before designating a word address.

Pressed before designating an operand as a constant.

Pressed before designating a bit address.

Pressed before function codes for block programming instruc-


tions, i.e., those placed between pointed parentheses <>.

4-4-2 PC Modes
The Programming Console is equipped with a switch to control the PC mode.
To select one of the three operating modesRUN, MONITOR, or PRO-
GRAMuse the mode switch. The mode that you select will determine PC

60
The Programming Console Section 4-4

operation as well as the procedures that are possible from the Programming
Console.
RUN mode is the mode used for normal program execution. When the switch
is set to RUN and the START input on the CPU Power Supply Unit is ON, the
CPU will begin executing the program according to the program written in its
Program Memory. Although monitoring PC operation from the Programming
Console is possible in RUN mode, no data in any of the memory areas can
be input or changed.
MONITOR mode allows you to visually monitor in-progress program execu-
tion while controlling I/O status, changing PV (present values) or SV (set val-
ues), etc. In MONITOR mode, I/O processing is handled in the same way as
in RUN mode. MONITOR mode is generally used for trial system operation
and final program adjustments.
In PROGRAM mode, the PC does not execute the program. PROGRAM
mode is for creating and changing programs, clearing memory areas, and
registering and changing the I/O table. A special Debug operation is also
available within PROGRAM mode that enables checking a program for cor-
rect execution before trial operation of the system.
The CPU11-E also has a TERMINAL mode which allows the display of a
32-character message, as well as operation of the keyboard mapping func-
tion. To enter TERMINAL mode, press the CHG key or execute the TERMI-
NAL Mode Change instruction (TERM(48)).

DANGER! Do not leave the Programming Console connected to the PC by an extension


cable when in RUN mode. Noise picked up by the extension cable can enter
the PC, affecting the program and thus the controlled system.

Mode Changes When the PC is turned on, the mode it will be in is affected by any peripheral
device connected or mounted to the CPU, as follows:
1, 2, 3... 1. No Peripheral Device Connected
When power is applied to the PC without a Peripheral Device con-
nected, the PC is automatically set to RUN mode. Program execution is
then controlled through the CPU Power Supply Units START terminal.
2. Programming Console Connected
If the Programming Console is connected to the PC when PC power is
applied, the PC is set to the mode set on the Programming Consoles
mode switch.
3. Other Peripheral Connected
If a Peripheral Interface Unit, a PROM Writer, a Printer Interface Unit, or
a Floppy Disk Interface Unit is attached to the PC when PC power is
turned on, the mode the PC will inter is determined by the the setting of
the Initial Mode Setting on the Memory Unit. If the initial mode switch is
set to OFF, the PC is automatically set to PROGRAM mode. If the initial
mode switch is set to ON, the PC will automatically enter RUN mode.
If the PC power supply is already turned on when a Peripheral Device is at-
tached to the PC, the PC will stay in the same mode it was in before the pe-
ripheral device was attached. The mode can be changed with the mode
switch on the Programming Console once the password has been entered. If
it is necessary to have the PC in PROGRAM mode, (for the PROM Writer,
Floppy Disk Interface Unit, etc.), be sure to select this mode before connect-
ing the peripheral device; or, alternatively, apply power to the PC after the
peripheral device is connected.

61
Preparation for Operation Section 4-5

The mode will not change when a peripheral device is removed from the PC
after PC power is turned on.

DANGER! Always confirm that the Programming Console is in PROGRAM mode when
turning on the PC with a Programming Console connected unless another
mode is desired for a specific purpose. If the Programming Console is in
RUN mode when PC power is turned on, any program in Program Memory
will be executed, possibly causing a PC-controlled system to begin operation.
If the START input on the CPU Power Supply Unit is ON and there is no de-
vice connected to the CPU, ensure that commencing operation is safe and
appropriate before turning on the PC.

4-4-3 The Display Message Switch


Next to the external connector for peripheral devices on the PC there is a
small switch for selecting either Japanese or English language messages for
display on the Programming Console. It is factory set to OFF, which causes
English language messages to be displayed.

4-5 Preparation for Operation


This section describes the procedures required to begin Programming Con-
sole operation. These include password entry, clearing memory, error mes-
sage clearing, and I/O table operations. I/O table operations are also neces-
sary at other times, e.g., when changes are to be made in Units used in the
PC configuration.
The following sequence of operations must be performed before beginning
initial program input.
1, 2, 3... 1. Confirm that all wiring for the PC has been installed and checked prop-
erly.
2. Confirm that a RAM Unit is mounted as the Memory Unit and that the
write-protect switch is OFF.
3. Connect the Programming Console to the PC. Make sure that the Pro-
gramming Console is securely connected or mounted to the CPU; im-
proper connection may inhibit operation.
4. Set the mode switch to PROGRAM mode.
5. Turn on PC power.
6. Enter the password.*
7. Clear memory.
8. Register the I/O table.
9. Check the I/O table until the I/O table and system configuration are cor-
rect and in agreement.
*Unlike the C500 and C1000H PCs, it is not necessary to register the I/O
table. Register the I/O table if you want an error alarm to be given when I/O
Units are added, removed, or interchanged with a different type.
Each of these operations from entering the password on is described in detail
in the following subsections. All operations should be done in PROGRAM
mode unless otherwise noted.

4-5-1 Entering the Password


To gain access to the PCs programming functions, you must first enter the
password. The password prevents unauthorized access to the program.

62
Preparation for Operation Section 4-5

The PC prompts you for a password when PC power is turned on or, if PC


power is already on, after the Programming Console has been connected to
the PC. To gain access to the system when the Password! message ap-
pears, press CLR and then MONTR. Then press CLR to clear the display.
If the Programming Console is connected to the PC when PC power is al-
ready on, the first display below will indicate the mode the PC was in before
the Programming Console was connected. Ensure that the PC is in PRO-
GRAM mode before you enter the password. When the password is en-
tered, the PC will shift to the mode set on the mode switch, causing PC op-
eration to begin if the mode is set to RUN or MONITOR. The mode can be
changed to RUN or MONITOR with the mode switch after entering the pass-
word.

<PROGRAM>
PASSWORD

<PROGRAM> BZ

Indicates the mode set by the mode selector switch.

4-5-2 Buzzer
Immediately after the password is input or anytime immediately after the
mode has been changed, SHIFT and then the 1 key can be pressed to turn
on and off the buzzer that sounds when Programming Console keys are
pressed. If BZ is displayed in the upper right corner, the buzzer is operative.
If BZ is not displayed, the buzzer is not operative.
This buzzer also will also sound whenever an error occurs during PC opera-
tion. Buzzer operation for errors is not affected by the above setting.

4-5-3 Clearing Memory


Using the Memory Clear operation it is possible to clear all or part of the Pro-
gram Memory, and the IR, HR, AR, DM and TC areas. Unless otherwise
specified, the clear operation will clear all of the above memory areas, pro-
vided that the Memory Unit attached to the PC is a RAM Unit or an EEPROM
Unit and the write-enable switch is ON. If the write-enable switch is OFF or
the Memory Unit is an EPROM Unit, Program Memory cannot be cleared.
Before beginning to programming for the first time or when installing a new
program, all areas should normally be cleared. Before clearing memory,
check to see if a program is already loaded that you need. If you need the
program, clear only the memory areas that you do not need, and be sure to
check the existing program with the program check key sequence before us-
ing it. The check sequence is provided later in this section. Further debug-
ging methods are provided in Section 7 Program Monitoring and Execution.
To clear all memory areas press CLR until all zeros are displayed, and then
input the keystrokes given in the top line of the following key sequence. The
branch lines shown in the sequence are used only when performing a partial
memory clear, which is described below.
Memory can be cleared in PROGRAM mode only.

63
Preparation for Operation Section 4-5

Key Sequence

Program Memory cleared

from designated address.


Both AR and HR areas

TC area Retained if pressed

DM area

All Clear The following procedure is used to clear memory completely.

MEMORY ERR

Continue pressing
I/O VER ERR the CLR key once for
each error message
until 00000 appears
on the display

00000

00000

00000 MEM CLR ?


All clear
HR CNT DM

00000MEM CLR
END HR CNT DM

Partial Clear It is possible to retain the data in specified areas or part of the Program
Memory. To retain the data in the HR and AR, TC, and/or DM areas, press
the appropriate key after entering REC/RESET. HR is pressed to designate
both the HR and AR areas. In other words, specifying that HR is to be re-
tained will ensure that AR is retained also. If not specified for retention, both
areas will be cleared. CNT is used for the entire TC area. The display will
show those areas that will be cleared.

It is also possible to retain a portion of the Program Memory from the begin-
ning to a specified address. After designating the data areas to be retained,
specify the first Program Memory address to be cleared. For example, to
leave addresses 00000 to 00122 untouched, but to clear addresses from
00123 to the end of Program Memory, input 00123.

64
Preparation for Operation Section 4-5

To leave the TC area uncleared and retaining Program Memory addresses


00000 through 00122, input as follows:

00000

00000

00000

00000MEM CLR ?
HR CNT DM

00000MEM CLR ?
HR DM

00123MEM CLR ?
HR DM

00000MEM CLR
END HR DM

4-5-4 Registering the I/O Table


The I/O Table Registration operation writes the types of I/O Units controlled
by the PC and the Rack locations of the I/O Units into the I/O table memory
area of the CPU (see Section 3-3 IR Area). It also clears all I/O bits. The I/O
table must be registered before programming operations are begun. As the
I/O table remains in memory, a new I/O table must also be registered when-
ever I/O Units are changed.

Unlike the C500H and C1000H PCs, C200H memory is allocated to slots in
the CPU and Extension I/O Racks, so it is not necessary to register the I/O
table. Register the I/O table if you want an error to occur when I/O Units have
been added, removed, or replaced with another type.

I/O Table Registration can be performed only in PROGRAM mode.

The I/O verification error message, I/O VER ERR, will appear when starting
programming operations or after I/O Units have been changed. This error is
cleared by registering a new I/O table.

When the I/O table has not been registered, the PC will operate according to
the I/O Units mounted when power is applied. The I/O verification error will
not occur.

Key Sequence

65
Preparation for Operation Section 4-5

Initial I/O Table Registration

Memory cleared completely

00000

00000
FUN (??)

00000I/OTBL?
??U=
Register I/O table
00000I/OTBL WRIT
????

00000I/OTBL WRIT
9713

00000I/OTBL WRIT
OK

4-5-5 Clearing Error Messages


After the I/O table has been registered, any error messages recorded in
memory should be cleared. It is assumed here that the causes of any of the
errors for which error messages appear have already been taken care of. If
the beeper sounds when an attempt is made to clear an error message,
eliminate the cause of the error, and then clear the error message (refer to
Section 8 Troubleshooting).
To display any recorded error messages, press CLR, FUN, and then
MONTR. The first message will appear. Pressing MONTR again will clear the
present message and display the next error message. Continue pressing
MONTR until all messages have been cleared.
Although error messages can be accessed in any mode, they can be cleared
only in PROGRAM mode.
Key Sequence

4-5-6 Verifying the I/O Table


The I/O Table Verification operation is used to check the I/O table registered
in memory to see if it matches the actual sequence of I/O Units mounted.
The first inconsistency discovered will be displayed as shown below. Every
subsequent pressing of VER displays the next inconsistency.
Key Sequence

66
Preparation for Operation Section 4-5

Example

00000

00000
FUN (??)

00000I/OTBL?
??U=
(No errors)
00000I/OTBL VER
OK

00000I/OTBL VER
(An error occurred)
01U=O*** I***

Actual I/O words


Registered I/O table words
I/O slot number
Rack number

Meaning of Displays

00000I/OTBL VER
**=R*I R*W
Duplication

00000I/OTBL VER
**U=**** RMT*
Indicates a Remote I/O Unit
that has not been registered

4-5-7 Reading the I/O Table


The I/O Table Read operation is used to access the I/O table that is currently
registered in the CPU memory.

Key Sequence

[0 to 2] [0 to 9]
Rack Unit
number number

Press the EXT key to select Remote


I/O Slave Racks or Optical I/O Units.

67
Preparation for Operation Section 4-5

Example 00000

00000
FUN (??)

00000I/OTBL ? (PC Unit)


??U=
(Slave Rack Units)

00000I/OTBL ?
R???U=
(Optical I/O Unit)

00000I/OTBL ?
2??LU=

00000I/OTBL ?
0?U=

00000I/OTBL ?
05U=

00000I/OTBL READ
05U=i*** 005

00000I/OTBL READ
04U=o*** 004

00000I/OTBL READ
05U=i*** 005

Meaning of Displays:
I/O Unit Designations for Displays (see I/O Units Mounted in Remote Slave Racks, next page)

C500, 1000H/C2000H I/O Units


No. of points Input Unit Output Unit
16 I * * * 0 * * *
32 I I * * 0 0 * *
64 I I I I 0 0 0 0

C200H I/O Units


No. of points Input Unit Output Unit
8 i(*)* * o * * *
16 i i * * o o * *
Note: (*) is i for non-fatal errors or F_

68
Preparation for Operation Section 4-5

I/O Units 00000I/OTBL READ


**U=**** ***

I/O word number


I/O type: i: (input), o: (output)

Unit number (0 to 9)

Rack number (0 to 2)

Special I/O Units 00000I/OTBL READ


**U=$***
Blank: Unit 1 exclusively
W: Unit 2 exclusively
C: High-speed Counter
Special I/O
N: Host Link Unit
Unit type:
A: Other
Unit number (0 to 9)
Indicates Special I/O Unit

Remote I/O Master Units 00000I/OTBL READ


**U=RMT*
Remote I/O
Master no. (0 to 1)

Remote I/O Slave Racks 00000I/OTBL READ


R***U=**** ***

I/O word number


I/O type: I, O
i, o (see tables on previous page)
Unit number (0 to 9)

Remote I/O Slave Unit number (0 to 4)

Remote I/O Master Unit number (0 to 1)

Indicates a Remote I/O Rack

Optical I/O Units and 00000I/OTBL READ


Remote Terminals
2**HU=R**
I/O type: I (input), O (output), or
W (input/output)

Remote I/O Master Unit number (0 to 1)

Word (H: leftmost 8 bits; L: rightmost 8 bits)

I/O word number (200 to 231)

4-5-8 Clearing the I/O Table


The I/O Table Clear operation is used to delete the contents of the I/O table
that is currently registered in the CPU memory. The PC will be set for opera-

69
Preparation for Operation Section 4-5

tion based on the I/O Units mounted when the I/O Table Clear operation is
performed.
The I/O Table Clear operation will reset all Special I/O Units and Link Units
mounted at the time. Do not perform the I/O Table Clear operation when a
Host or PC Link Unit, Remote I/O Master Unit, High-speed Counter Unit, Po-
sition Control Unit, or other Special I/O Unit is in operation.

Key Sequence

Example 00000

00000
FUN (??)

00000I/OTBL
??U=

00000I/OTBL WRIT
????

00000I/OTBL CLR
????

00000I/OTBL CLR
9713

00000I/OTBL CLR
OK

4-5-9 NET Link Table Transfer


The NET Link Table Transfer operation transfers a copy of the SYSMAC NET
Link Data Link table to RAM or EEPROM program memory.This allows the
user program and NET Link table to be written into EPROM together. This
operation is applicable to the CPU11-E only.
Note When power is applied to a PC which has a copy of a NET Link table stored
in its program memory, the NET Link table of the CPU will be overwritten.
Changes made in the NET Link table do not affect the copy of the NET Link
table in program memory; NET Link Table Transfer must be repeated to
change the copy in program memory.
The NET Link Table Transfer operation will not work if:
1. The Memory Unit is not RAM or EEPROM, or the write protect switch is
not set to write.
2. There isnt an END(01) instruction.
3. The contents of program memory exceeds 2.3K words with a 4K
memory, or 6.4K words with an 8K memory. (To find the size of the con-
tents of program memory, do an instruction search for END(01).)
NET Link table transfer can only be done in PROGRAM mode.

70
Preparation for Operation Section 4-5

Key Sequence

Example 00000

00000
FUN(??)

00000LINK TBL~UM
(SYSMACNET)????

00000LINK TBL~UM
(SYSMACNET)9713

00000LINK TBL~UM
OK
The following indicates that the
I/O table cannot be transferred.

00000LINK TBL~UM
DISABLED

71
Inputting, Modifying, and Checking the Program Section 4-6

4-6 Inputting, Modifying, and Checking the Program


Once a program is written in mnemonic code, it can be input directly into the
PC from a Programming Console. Mnemonic code is keyed into Program
Memory addresses from the Programming Console. Checking the program
involves a syntax check to see that the program has been written according
to syntax rules. Once syntax errors are corrected, a trial execution can begin
and, finally, correction under actual operating conditions can be made.

The operations required to input a program are explained below. Operations


to modify programs that already exist in memory are also provided in this
section, as well as the procedure to obtain the current cycle time.

Before starting to input a program, check to see whether there is a program


already loaded. If there is a program loaded that you do not need, clear it first
using the program memory clear key sequence, then input the new program.
If you need the previous program, be sure to check it with the program check
key sequence and correct it as required. Further debugging methods are pro-
vided in Section 7 Program Monitoring and Execution.

4-6-1 Setting and Reading from Program Memory Address


When inputting a program for the first time, it is generally written to Program
Memory starting from address 00000. Because this address appears when
the display is cleared, it is not necessary to specify it.

When inputting a program starting from other than 00000 or to read or modify
a program that already exists in memory, the desired address must be desig-
nated. To designate an address, press CLR and then input the desired ad-
dress. Leading zeros of the address need not be input, i.e., when specifying
an address such as 00053 you need to enter only 53. The contents of the
designated address will not be displayed until the down key is pressed.

Once the down key has been pressed to display the contents of the desig-
nated address, the up and down keys can be used to scroll through Program
Memory. Each time one of these keys is pressed, the next or previous word
in Program Memory will be displayed.

If Program Memory is read in RUN or MONITOR mode, the ON/OFF status


of any displayed bit will also be shown.

Key Sequence

72
Inputting, Modifying, and Checking the Program Section 4-6

Example If the following mnemonic code has already been input into Program Memory,
the key inputs below would produce the displays shown.

00000 Address Instruction Operands


00200 LD 00000
00201 AND 00001
00200 00202 TIM 000
# 0123
00203 LD 00100
00200READ OFF
LD 00000

00201READ ON
AND 00001

00202READ OFF
TIM 000

00202
TIM #0123

00203READ ON
LD 00100

4-6-2 Entering and Editing Programs


Programs can be entered and edited only in PROGRAM mode.
The same procedure is used to either input a program for the first time or to
edit a program that already exists. In either case, the current contents of Pro-
gram Memory is overwritten, i.e., if there is no previous program, the
NOP(00) instruction, which will be written at every address, will be overwrit-
ten.
To enter a program, input the mnemonic code that was produced from the
ladder diagram step-by-step, ensuring that the correct address is set before
starting. Once the correct address is displayed, enter the first instruction
word and press WRITE. Next, enter the required operands, pressing WRITE
after each, i.e., WRITE is pressed at the end of each line of the mnemonic
code. When WRITE is pressed at the end of each line, the designated in-
struction or operand is entered and the next display will appear. If the instruc-
tion requires two or more words, the next display will indicate the next oper-
and required and provide a default value for it. If the instruction requires only
one word, the next address will be displayed. Continue inputting each line of
the mnemonic code until the entire program has been entered.
When inputting numeric values for operands, it is not necessary to input lead-
ing zeros. Leading zeros are required only when inputting function codes
(see below). When designating operands, be sure to designate the data area
for all but IR and SR addresses by pressing the corresponding data area key,
and to designate each constant by pressing CONT/#. CONT/# is not required
for counter or timer SVs (see below). The AR area is designated by pressing
SHIFT and then HR. TC numbers as bit operands (i.e., completion flags) are
designated by pressing either TIM or CNT before the address, depending on
whether the TC number has been used to define a timer or a counter. To des-
ignate an indirect DM address, press CH/* before the address (pressing DM
is not necessary for an indirect DM address).

73
Inputting, Modifying, and Checking the Program Section 4-6

Inputting SV for Counters The SV (set value) for a timer or counter is generally entered as a constant,
and Timers although inputting the address of a word that holds the SV is also possible.
When inputting an SV as a constant, CONT/# is not required; just input the
numeric value and press WRITE. To designate a word, press CLR and then
input the word address as described above.

Designating Instructions The most basic instructions are input using the Programming Console keys
provided for them. All other instructions are entered using function codes.
These function codes are always written after the instructions mnemonic. If
no function code is given, there should be a Programming Console key for
that instruction.
There are two types of function codes: those for normal instructions and
those for block instructions. Function codes for block instructions are always
written between pointed parentheses <like this>. Both types of function
codes are used in basically the same way, but SHIFT must be pressed be-
fore inputting a block instruction function code.
To designate the differentiated form of an instruction, press NOT after the
function code.
To input an instruction using a function code, set the address, press FUN,
press SHIFT if a block instruction is being entered, input the function code
including any leading zeros, press NOT if the differentiated form of the in-
struction is desired, input any bit operands or definers required for the in-
struction, and then press WRITE.

Caution Enter function codes with care and be sure to press SHIFT when required.

Key Sequence

[Address displayed] [Instruction word] [Operand]

74
Inputting, Modifying, and Checking the Program Section 4-6

Example The following program can be entered using the key inputs shown below.
Displays will appear as indicated.

00000 Address Instruction Operands


00200 LD 00002
00201 TIM 000
00200 # 0123
00202 TIMH(15) 001
# 0500
00200
LD 00002

00201READ
NOP (00)

00201
TIM 000

00201 TIM DATA


#0000

00201 TIM
#0123

00202READ
NOP (00)

00202
FUN (??)

00202
TIMH (15) 001

00202 TIMH DATA


#0000

00202 TIMH
#0500

00203READ
NOP (00)

Error Messages The following error messages may appear when inputting a program. Correct
the error as indicated and continue with the input operation. The asterisks in

75
Inputting, Modifying, and Checking the Program Section 4-6

the displays shown below will be replaced with numeric data, normally an
address, in the actual display.

Message Cause and correction


****REPL ROM An attempt was made to write to ROM, or to write-protected RAM or EEPROM. Ensure
that a RAM or EEPROM Unit is mounted and that its write-protect switch is set to OFF.
****PROG OVER The instruction at the last address in memory is not NOP(00). Erase all unnecessary
instructions at the end of the program or use a larger Memory Unit.
****ADDR OVER An address was set that is larger than the highest memory in Program Memory. Input a
smaller address
****SETDATA ERR Data has been input in the wrong format or beyond defined limits, e.g., a hexadecimal
value has been input for BCD. Re-enter the data. This error will generate a FALS 00
error.
****I/O NO. ERR A data area address has been designated that exceeds the limit of the data area, e.g.,
an address is too large. Confirm the requirements for the instruction and re-enter the
address.

4-6-3 Checking the Program


Once a program has been entered, the syntax should be checked to verify
that no programming rules have been violated. This check should also be
performed if the program has been changed in any way that might create a
syntax error.
To check the program, input the key sequence shown below. The numbers
indicate the desired check level (see below). When the check level is en-
tered, the program check will start. If an error is discovered, the check will
stop and a display indicating the error will appear. Press SRCH to continue
the check. If an error is not found, the program will be checked through to the
first END(01), with a display indicating when each 64 instructions have been
checked (e.g., display #1 of the example after the following table).
CLR can be pressed to cancel the check after it has been started, and a dis-
play like display #2, in the example, will appear. When the check has reached
the first END, a display like display #3 will appear.
A syntax check can be performed on a program only in PROGRAM mode.

Key Sequence

To check
up to END(01)

To abort

(0, 1, 2, Check levels)

Check Levels and Error Three levels of program checking are available. The desired level must be
Messages designated to indicate the type of errors that are to be detected. The follow-
ing table provides the error types, displays, and explanations of all syntax
errors. Check level 0 checks for type A, B, and C errors; check level 1, for
type A and B errors; and check level 2, for type A errors only.
The address where the error was generated will also be displayed.

76
Inputting, Modifying, and Checking the Program Section 4-6

Many of the following errors are for instructions that have not yet been de-
scribed yet. Refer to 4-7 Controlling Bit Status or to Section 5 Instruction Set
for details on these.

Type Message Meaning and appropriate response


Type A ????? The program has been lost. Re-enter the program.
NO END INSTR There is no END(01) in the program. Write END(01) at the final address in the
program.
CIRCUIT ERR The number of logic blocks and logic block instructions does not agree, i.e., either
LD or LD NOT has been used to start a logic block whose execution condition has
not been used by another instruction, or a logic block instruction has been used
that does not have the required number of logic blocks. Check your program.
LOCN ERR An instruction is in the wrong place in the program. Check instruction requirements
and correct the program.
DUPL The same jump number, block number, or subroutine number has been used
twice. Correct the program so that the same number is only used once for each.
(Jump number 00 may be used as often as required.)
SBN UNDEFD SBS(91) has been programmed for a subroutine number that does not exist.
Correct the subroutine number or program the required subroutine.
JME UNDEFD A JME(04) is missing for a JMP(05). Correct the jump number or insert the proper
JME(04).
OPERAND ERR A constant entered for the instruction is not within defined values. Change the
constant so that it lies within the proper range.
STEP ERR STEP(08) with a section number and STEP(08) without a section number have
been used correctly. Check STEP(08) programming requirements and correct the
program.
Type B IL-ILC ERR IL(02) and ILC(03) are not used in pairs. Correct the program so that each IL(02)
has a unique ILC(03). Although this error message will appear if more than one
IL(02) is used with the same ILC(03), the program will executed as written. Make
sure your program is written as desired before proceeding.
JMP-JME ERR JMP(04) 00 and JME(05) 00 are not used in pairs. Although this error message will
appear if more than one JMP(04) 00 is used with the same JME(05) 00, the
program will be executed as written. Make sure your program is written as desired
before proceeding.
SBN-RET ERR If the displayed address is that of SBN(92), two different subroutines have been
defined with the same subroutine number. Change one of the subroutine numbers
or delete one of the subroutines. If the displayed address is that of RET(93),
RET(93) has not been used properly. Check requirements for RET(93) and correct
the program.
Type C JMP UNDEFD JME(05) has been used with no JMP(04) with the same jump number. Add a
JMP(04) with the same number or delete the JME(05) that is not being used.
SBS UNDEFD A subroutine exists that is not called by SBS(91). Program a subroutine call in the
proper place, or delete the subroutine if it is not required.
COIL DUPL The same bit is being controlled (i.e., turned ON and/or OFF) by more than one
instruction (e.g., OUT, OUT NOT, DIFU(13), DIFD(14), KEEP(11), SFT(10),
SET<07>). Although this is allowed for certain instructions, check instruction
requirements to confirm that the program is correct or rewrite the program so that
each bit is controlled by only one instruction.

77
Inputting, Modifying, and Checking the Program Section 4-6

Example The following example shows some of the displays that can appear as a re-
sult of a program check.

00000

00000PROG CHK
CHKLEVEL (02)?

00064PROG CHK Display #1

Halts program check


00128PROG CHKEND Display #2

Check continues until END(01)


03000PROG CHK
Display #3
END (01)(03.6KW)

When errors are found


00178CIRCUIT ERR
OUT 00200

00196COIL DUPL
OUT 00200

00200ILILC ERR
ILC (03)

32000NO ENDINSTR
END

4-6-4 Displaying the Cycle Time


Once the program has been cleared of syntax errors, the cycle time should
be checked. This is possible only in RUN or MONITOR mode while the pro-
gram is being executed. See Section 6 Program Execution Timing for details
on the cycle time.

To display the current average cycle time, press CLR then MONTR. The time
displayed by this operation is a typical cycle time. The differences in dis-
played values depend on the execution conditions that exist when MONTR is
pressed.

78
Inputting, Modifying, and Checking the Program Section 4-6

Example

00000

00000CYCLE TIME
054.1MS

00000CYCLE TIME
053.9MS

4-6-5 Program Searches


The program can be searched for occurrences of any designated instruction
or data area address used in an instruction. Searches can be performed from
any currently displayed address or from a cleared display.

To designate a bit address, press SHIFT, press CONT/#, then input the ad-
dress, including any data area designation required, and press SRCH. To
designate an instruction, input the instruction just as when inputting the pro-
gram and press SRCH. Once an occurrence of an instruction or bit address
has been found, any additional occurrences of the same instruction or bit can
be found by pressing SRCH again. SRCHG will be displayed while a search
is in progress.

When the first word of a multiword instruction is displayed for a search opera-
tion, the other words of the instruction can be displayed by pressing the down
key before continuing the search.

If Program Memory is read in RUN or MONITOR mode, the ON/OFF status


of any bit displayed will also be shown.

Key Sequence

79
Inputting, Modifying, and Checking the Program Section 4-6

Example: 00000
Instruction Search

00000
LD 00000

00200SRCH
LD 00000

00202
LD 00000

06000SRCH
END (01)(06.4KW)

00000

00100

00100
TIM 001

00203SRCH
TIM 001

00203 TIM DATA


#0123

Example: 00000
Bit Search

00000CONT SRCH
CONT 00005

00200CONT SRCH
LD 00005

00203CONT SRCH
AND 00005

06000
END (01)(06.4K)

4-6-6 Inserting and Deleting Instructions


In PROGRAM mode, any instruction that is currently displayed can be de-
leted or another instruction can be inserted before it. These are not possible
in RUN or MONITOR modes.
To insert an instruction, display the instruction before which you want the new
instruction to be placed, input the instruction word in the same way as when
inputting a program initially, and then press INS and the down key. If other

80
Inputting, Modifying, and Checking the Program Section 4-6

words are required for the instruction, input these in the same way as when
inputting the program initially.
To delete an instruction, display the instruction word of the instruction to be
deleted and then press DEL and the up key. All the words for the designated
instruction will be deleted.

Caution Be careful not to inadvertently delete instructions; there is no way to recover


them without reinputting them completely.

Key Sequences

When an instruction is inserted or deleted, all addresses in Program Memory


following the operation are adjusted automatically so that there are no blank
addresses or no unaddressed instructions.

Example The following mnemonic code shows the changes that are achieved in a pro-
gram through the key sequences and displays shown below.

Original Program
Address Instruction Operands
00000 LD 00100
00001 AND 00101
00002 LD 00201
00003 AND NOT 00102
00004 OR LD -
00005 AND 00103
00006 AND NOT 00104
00007 OUT 00201
00008 END(01) -

Before Insertion: Before Deletion:

00100 00101 00103 00104


00100 00101 00103 00105 00104
00201
00201

00201 00102
00201 00102 Delete
00105

END(01) END(01)

The following key inputs and displays show the procedure for achieving the
program changes shown above.

81
Inputting, Modifying, and Checking the Program Section 4-6

Inserting an Instruction
00000

Find the address


00000 prior to the inser-
OUT 00000 tion point

00000
OUT 00201 Program After Insertion
Address Instruction Operands
00207SRCH 00000 LD 00100
OUT 00201 00001 AND 00101
00002 LD 00201
00206READ
00003 AND NOT 00102
AND NOT 00104 00004 OR LD -
00005 AND 00103
00206
00006 AND 00105
AND 00000 00007 AND NOT 00104
00008 OUT 00201
00206
00009 END(01) -
AND 00105

00206INSERT?
AND 00105
Insert the
00207INSERT END instruction
AND NOT 00104

00206READ
AND 00105

Deleting an Instruction

00000

Find the instruction


00000 that requires deletion.
OUT 00000
Program After Deletion
00000 Address Instruction Operands
OUT 00201 00000 LD 00100
00001 AND NOT 00101
00208SRCH 00002 LD 00201
OUT 00201 00003 AND NOT 00102
00004 OR LD -
00207READ
00005 AND 00103
AND NOT 00104 00006 AND 00105
00007 AND NOT 00104
00207 DELETE?
00008 OUT 00201
AND NOT 00104

00207DELETE END
OUT 00201 Confirm that this is the
instruction to be deleted.
00206READ
AND 00105

82
Inputting, Modifying, and Checking the Program Section 4-6

4-6-7 Branching Instruction Lines


When an instruction line branches into two or more lines, it is sometimes
necessary to use either interlocks or TR bits to maintain the execution condi-
tion that existed at a branching point. This is because instruction lines are
executed across to a right-hand instruction before returning to the branching
point to execute instructions on a branch line. If a condition exists on any of
the instruction lines after the branching point, the execution condition could
change during this time making proper execution impossible. The following
diagrams illustrate this. In both diagrams, instruction 1 is executed before
returning to the branching point and moving on to the branch line leading to
instruction 2.

Branching
00000 point Address Instruction Operands
Instruction 1
00000 LD 00000
00002 00001 Instruction 1
Instruction 2
00002 AND 00002
00003 Instruction 2
Diagram A: Correct Operation

Branching
00000 point 00001
Instruction 1 Address Instruction Operands
00002 00000 LD 00000
Instruction 2
00001 AND 00001
Diagram B: Incorrect Operation 00002 Instruction 1
00003 AND 00002
00004 Instruction 2

If, as shown in diagram A, the execution condition that existed at the branch-
ing point cannot be changed before returning to the branch line (instructions
at the far right do not change the execution condition), then the branch line
will be executed correctly and no special programming measure is required.

If, as shown in diagram B, a condition exists between the branching point


and the last instruction on the top instruction line, the execution condition at
the branching point and the execution condition after completing the top in-
struction line will sometimes be different, making it impossible to ensure cor-
rect execution of the branch line.

There are two means of programming branching programs to preserve the


execution condition. One is to use TR bits; the other, to use interlocks
(IL(02)/IL(03)).

TR Bits The TR area provides eight bits, TR 0 through TR 7, that can be used to tem-
porarily preserve execution conditions. If a TR bit is placed at a branching
point, the current execution condition will be stored at the designated TR bit.
When returning to the branching point, the TR bit restores the execution sta-
tus that was saved when the branching point was first reached in program
execution.

The previous diagram B can be written as shown below to ensure correct


execution. In mnemonic code, the execution condition is stored at the
branching point using the TR bit as the operand of the OUTPUT instruction.

83
Inputting, Modifying, and Checking the Program Section 4-6

This execution condition is then restored after executing the right-hand in-
struction by using the same TR bit as the operand of a LOAD instruction

TR 0 Address Instruction Operands


00000 00001
Instruction 1 00000 LD 00000
00002 00001 OUT TR 0
Instruction 2 00002 AND 00001
00003 Instruction 1
Diagram B: Corrected Using a TR bit
00004 LD TR 0
00005 AND 00002
00006 Instruction 2

In terms of actual instructions the above diagram would be as follows: The


status of IR 00000 is loaded (a LOAD instruction) to establish the initial ex-
ecution condition. This execution condition is then output using an OUTPUT
instruction to TR 0 to store the execution condition at the branching point.
The execution condition is then ANDed with the status of IR 00001 and in-
struction 1 is executed accordingly. The execution condition that was stored
at the branching point is then re-loaded (a LOAD instruction with TR 0 as the
operand), this is ANDed with the status of IR 00002, and instruction 2 is ex-
ecuted accordingly.
The following example shows an application using two TR bits.

TR 0 TR 1 Address Instruction Operands


00000 00001 00002
Instruction 1
00000 LD 00000
00001 OUT TR 0
00003
Instruction 2 00002 AND 00001
00003 OUT TR 1
00004
Instruction 3 00004 AND 00002
00005
00005 OUT 00500
Instruction 4 00006 LD TR 1
00007 AND 00003
00008 OUT 00501
00009 LD TR 0
00010 AND 00004
00011 OUT 00502
00012 LD TR 0
00013 AND NOT 00005
00014 OUT 00503

In this example, TR 0 and TR 1 are used to store the execution conditions at


the branching points. After executing instruction 1, the execution condition
stored in TR 1 is loaded for an AND with the status IR 00003. The execution
condition stored in TR 0 is loaded twice, the first time for an AND with the
status of IR 00004 and the second time for an AND with the inverse of the
status of IR 00005.
TR bits can be used as many times as required as long as the same TR bit is
not used more than once in the same instruction block. Here, a new instruc-
tion block is begun each time execution returns to the bus bar. If, in a single
instruction block, it is necessary to have more than eight branching points
that require the execution condition be saved, interlocks (which are described
next) must be used.
When drawing a ladder diagram, be careful not to use TR bits unless neces-
sary. Often the number of instructions required for a program can be reduced

84
Inputting, Modifying, and Checking the Program Section 4-6

and ease of understanding a program increased by redrawing a diagram that


would otherwise required TR bits. In both of the following pairs of diagrams,
the bottom versions require fewer instructions and do not require TR bits. In
the first example, this is achieved by reorganizing the parts of the instruction
block: the bottom one, by separating the second OUTPUT instruction and
using another LOAD instruction to create the proper execution condition for
it.
Note Although simplifying programs is always a concern, the order of execution of
instructions is sometimes important. For example, a MOVE instruction may
be required before the execution of a BINARY ADD instruction to place the
proper data in the required operand word. Be sure that you have considered
execution order before reorganizing a program to simplify it.

TR 0
00000 00001
Instruction 1

Instruction 2

00000
Instruction 2

00001
Instruction 1

00000 00003
Instruction 1

TR 0
00001 00002

00004
Instruction 2

00001 00002 00003


Instruction 1

00000

00001 00004
Instruction 2

Note TR bits are only used when programming using mnemonic code. They are
not necessary when inputting ladder diagrams directly, as is possible from a
GPC. The above limitations on the number of branching points requiring TR
bits, and considerations on methods to reduce the number of programming
instructions, still hold.

Interlocks The problem of storing execution conditions at branching points can also be
handled by using the INTERLOCK (IL(02)) and INTERLOCK CLEAR

85
Inputting, Modifying, and Checking the Program Section 4-6

(ILC(03)) instructions to eliminate the branching point completely while allow-


ing a specific execution condition to control a group of instructions. The IN-
TERLOCK and INTERLOCK CLEAR instructions are always used together.
When an INTERLOCK instruction is placed before a section of a ladder pro-
gram, the execution condition for the INTERLOCK instruction will control the
execution of all instruction up to the next INTERLOCK CLEAR instruction. If
the execution condition for the INTERLOCK instruction is OFF, all right-hand
instructions through the next INTERLOCK CLEAR instruction will be ex-
ecuted with OFF execution conditions to reset the entire section of the ladder
diagram. The effect that this has on particular instructions is described in 5-8
INTERLOCK and INTERLOCK CLEAR IL(02) and ILC(03).
Diagram B can also be corrected with an interlock. Here, the conditions lead-
ing up to the branching point are placed on an instruction line for the INTER-
LOCK instruction, all of lines leading from the branching point are written as
separate instruction lines, and another instruction line is added for the IN-
TERLOCK CLEAR instruction. No conditions are allowed on the instruction
line for INTERLOCK CLEAR. Note that neither INTERLOCK nor INTER-
LOCK CLEAR requires an operand.

00000
IL(02) Address Instruction Operands
00001 00000 LD 00000
Instruction 1 00001 IL(02) ---
00002 00002 LD 00001
Instruction 2 00003 Instruction 1
00004 LD 00002
ILC(03) 00005 Instruction 2
00006 ILC(03) ---

If IR 00000 is ON in the revised version of diagram B, above, the status of IR


00001 and that of IR 00002 would determine the execution conditions for in-
structions 1 and 2, respectively. Because IR 00000 is ON, this would produce
the same results as ANDing the status of each of these bits. If IR 00000 is
OFF, the INTERLOCK instruction would produce an OFF execution condition
for instructions 1 and 2 and then execution would continue with the instruc-
tion line following the INTERLOCK CLEAR instruction.

86
Inputting, Modifying, and Checking the Program Section 4-6

As shown in the following diagram, more than one INTERLOCK instruction


can be used within one instruction block; each is effective through the next
INTERLOCK CLEAR instruction.

00000
IL(02)
Address Instruction Operands
00001 00000 LD 00000
Instruction 1 00001 IL(02) ---
00002 LD 00001
00002
IL(02) 00003 Instruction 1
00004 LD 00002
00003 00004
00005 IL(02) ---
Instruction 2
00006 LD 00003
00005
Instruction 3
00007 AND NOT 00004
00008 Instruction 2
00006
Instruction 4 00009 LD 00005
00010 Instruction 3
00011 LD 00006
ILC(03)
00012 Instruction 4
00013 ILC(03) ---

If IR 00000 in the above diagram is OFF (i.e., if the execution condition for
the first INTERLOCK instruction is OFF), instructions 1 through 4 would be
executed with OFF execution conditions and execution would move to the
instruction following the INTERLOCK CLEAR instruction. If IR 00000 is ON,
the status of IR 00001 would be loaded as the execution condition for instruc-
tion 1 and then the status of IR 00002 would be loaded to form the execution
condition for the second INTERLOCK instruction. If IR 00002 is OFF, instruc-
tions 2 through 4 will be executed with OFF execution conditions. If IR 00002
is ON, IR 00003, IR 00005, and IR 00006 will determine the first execution
condition in new instruction lines.

4-6-8 Jumps
A specific section of a program can be skipped according to a designated
execution condition. Although this is similar to what happens when the exe-
cution condition for an INTERLOCK instruction is OFF, with jumps, the oper-
ands for all instructions maintain status. Jumps can therefore be used to con-
trol devices that require a sustained output, e.g., pneumatics and hydraulics,
whereas interlocks can be used to control devices that do not required a sus-
tained output, e.g., electronic instruments.
Jumps are created using the JUMP (JMP(04)) and JUMP END (JME(05))
instructions. If the execution condition for a JUMP instruction is ON, the pro-
gram is executed normally as if the jump did not exist. If the execution condi-
tion for the JUMP instruction is OFF, program execution moves immediately
to a JUMP END instruction without changing the status of anything between
the JUMP and JUMP END instruction.
All JUMP and JUMP END instructions are assigned jump numbers ranging
between 00 and 99. There are two types of jumps. The jump number used
determines the type of jump.
A jump can be defined using jump numbers 01 through 99 only once, i.e.,
each of these numbers can be used once in a JUMP instruction and once in
a JUMP END instruction. When a JUMP instruction assigned one of these
numbers is executed, execution moves immediately to the JUMP END in-
struction that has the same number as if all of the instruction between them

87
Inputting, Modifying, and Checking the Program Section 4-6

did not exist. Diagram B from the TR bit and interlock example could be re-
drawn as shown below using a jump. Although 01 has been used as the
jump number, any number between 01 and 99 could be used as long as it
has not already been used in a different part of the program. JUMP and
JUMP END require no other operand and JUMP END never has conditions
on the instruction line leading to it.

00000
JMP(04) 01 Address Instruction Operands
00001 00000 LD 00000
Instruction 1
00001 JMP(04) 01
00002 00002 LD 00001
Instruction 2
00003 Instruction 1
00004 LD 00002
JME(05) 01
00005 Instruction 2
00006 JME(05) 015
Diagram B: Corrected with a Jump

This version of diagram B would have a shorter execution time when 00000
was OFF than any of the other versions.
The other type of jump is created with a jump number of 00. As many jumps
as desired can be created using jump number 00 and JUMP instructions us-
ing 00 can be used consecutively without a JUMP END using 00 between
them. It is even possible for all JUMP 00 instructions to move program
execution to the same JUMP END 00, i.e., only one JUMP END 00
instruction is required for all JUMP 00 instruction in the program. When 00 is
used as the jump number for a JUMP instruction, program execution moves
to the instruction following the next JUMP END instruction with a jump num-
ber of 00. Although, as in all jumps, no status is changed and no instructions
are executed between the JUMP 00 and JUMP END 00 instructions, the pro-
gram must search for the next JUMP END 00 instruction, producing a slightly
longer execution time.
Execution of programs containing multiple JUMP 00 instructions for one
JUMP END 00 instruction is similar to that of interlocked sections. The follow-
ing diagram is the same as that used for the interlock example above, except
redrawn with jumps. The execution of this diagram would differ from that of
the diagram described above (e.g., in the previous diagram interlocks would
reset certain parts of the interlocked section, however, jumps do not affect
the status of any bit between the JUMP and JUMP END instructions).

00000
JMP(04) 00 Address Instruction Operands

00001
00000 LD 00000
Instruction 1 00001 JMP(04) 00
00002 LD 00001
00002
00003 Instruction 1
JMP(04) 00
00004 LD 00002
00003 00004 00005 JMP(04) 00
Instruction 2
00006 LD 00003
00005 00007 AND NOT 00004
Instruction 3
00008 Instruction 2
00006
00009 LD 00005
Instruction 4
00010 Instruction 3
00011 LD 00006
JME(05) 00
00012 Instruction 4
00013 JME(05) 00

88
Controlling Bit Status Section 4-7

4-7 Controlling Bit Status


There are five instructions that can be used generally to control individual bit
status. These are the OUTPUT, OUTPUT NOT, DIFFERENTIATE UP,
DIFFERENTIATE DOWN, and KEEP instructions. All of these instructions
appear as the last instruction in an instruction line and take a bit address for
an operand. Although details are provided in 5-7 Bit Control Instructions,
these instructions (except for OUTPUT and OUTPUT NOT, which have al-
ready been introduced) are described here because of their importance in
most programs. Although these instructions are used to turn ON and OFF
output bits in the IR area (i.e., to send or stop output signals to external de-
vices), they are also used to control the status of other bits in the IR area or
in other data areas.

4-7-1 DIFFERENTIATE UP and DIFFERENTIATE DOWN


DIFFERENTIATE UP and DIFFERENTIATE DOWN instructions are used to
turn the operand bit ON for one cycle at a time. The DIFFERENTIATE UP
instruction turns ON the operand bit for one cycle after the execution condi-
tion for it goes from OFF to ON; the DIFFERENTIATE DOWN instruction
turns ON the operand bit for one cycle after the execution condition for it
goes from ON to OFF. Both of these instructions require only one line of
mnemonic code.

00000 Address Instruction Operands


DIFU(13) 00200
00000 LD 00000
00001 DIFU(13) 00200
00001
DIFD(14) 00201 Address Instruction Operands
00000 LD 00001
00001 DIFD(14) 00201

Here, IR 00200 will be turned ON for one cycle after IR 00000 goes ON. The
next time DIFU(13) 00200 is executed, IR 00200 will be turned OFF, regard-
less of the status of IR 00000. With the DIFFERENTIATE DOWN instruction,
IR 00201 will be turned ON for one cycle after IR 00001 goes OFF (IR 00201
will be kept OFF until then), and will be turned OFF the next time DIFD(14)
00201 is executed.

4-7-2 KEEP
The KEEP instruction is used to maintain the status of the operand bit based
on two execution conditions. To do this, the KEEP instruction is connected to
two instruction lines. When the execution condition at the end of the first in-
struction line is ON, the operand bit of the KEEP instruction is turned ON.
When the execution condition at the end of the second instruction line is ON,
the operand bit of the KEEP instruction is turned OFF. The operand bit for the
KEEP instruction will maintain its ON or OFF status even if it is located in an
interlocked section of the diagram.
In the following example, HR 0000 will be turned ON when IR 00002 is ON
and IR 00003 is OFF. HR 0000 will then remain ON until either IR 00004 or
IR 00005 turns ON. With KEEP, as with all instructions requiring more than

89
Work Bits Section 4-8

one instruction line, the instruction lines are coded first before the instruction
that they control.

00002 00003 Address Instruction Operands


S: set input 00000 LD 00002
KEEP(11)
00001 AND NOT 00003
HR 0000 00002 LD 00004
00004
00003 OR 00005
R: reset input
00005 00004 KEEP(11) HR 0000

4-7-3 Self-maintaining Bits (Seal)


Although the KEEP instruction can be used to create self-maintaining bits, it
is sometimes necessary to create self-maintaining bits in another way so that
they can be turned OFF when in an interlocked section of a program.
To create a self-maintaining bit, the operand bit of an OUTPUT instruction is
used as a condition for the same OUTPUT instruction in an OR setup so that
the operand bit of the OUTPUT instruction will remain ON or OFF until
changes occur in other bits. At least one other condition is used just before
the OUTPUT instruction to function as a reset. Without this reset, there would
be no way to control the operand bit of the OUTPUT instruction.
The above diagram for the KEEP instruction can be rewritten as shown be-
low. The only difference in these diagrams would be their operation in an in-
terlocked program section when the execution condition for the INTERLOCK
instruction was ON. Here, just as in the same diagram using the KEEP in-
struction, two reset bits are used, i.e., HR 0000 can be turned OFF by turning
ON either IR 00004 or IR 00005.

00002 00003 00004 Address Instruction Operands


HR 0000
00000 LD 00002
00005
00001 AND NOT 00003
HR 0000 00002 OR HR 0000
00003 AND NOT 00004
00004 OR NOT 00005
00005 OUT HR 0000

4-8 Work Bits (Internal Relays)


In programming, combining conditions to directly produce execution condi-
tions is often extremely difficult. These difficulties are easily overcome, how-
ever, by using certain bits to trigger other instructions indirectly. Such pro-
gramming is achieved by using work bits. Sometimes entire words are re-
quired for these purposes. These words are referred to as work words.
Work bits are not transferred to or from the PC. They are bits selected by the
programmer to facilitate programming as described above. I/O bits and other
dedicated bits cannot be used as works bits. All bits in the IR area that are
not allocated as I/O bits, and certain unused bits in the AR area, are avail-
able for use as work bits. Be careful to keep an accurate record of how and
where you use work bits. This helps in program planning and writing, and
also aids in debugging operations.

90
Work Bits Section 4-8

Work Bit Applications Examples given later in this subsection show two of the most common ways
to employ work bits. These should act as a guide to the almost limitless num-
ber of ways in which the work bits can be used. Whenever difficulties arise in
programming a control action, consideration should be given to work bits and
how they might be used to simplify programming.
Work bits are often used with the OUTPUT, OUTPUT NOT, DIFFERENTIATE
UP, DIFFERENTIATE DOWN, and KEEP instructions. The work bit is used
first as the operand for one of these instructions so that later it can be used
as a condition that will determine how other instructions will be executed.
Work bits can also be used with other instructions, e.g., with the SHIFT REG-
ISTER instruction (SFT(10)). An example of the use of work words and bits
with the SHIFT REGISTER instruction is provided 5-13-1 SHIFT REGISTER
SFT(10).
Although they are not always specifically referred to as work bits, many of the
bits used in the examples in Section 5 Instruction Set use work bits. Under-
standing the use of these bits is essential to effective programming.

Reducing Complex Work bits can be used to simplify programming when a certain combination
Conditions of conditions is repeatedly used in combination with other conditions. In the
following example, IR 00000, IR 00001, IR 00002, and IR 00003 are com-
bined in a logic block that stores the resulting execution condition as the sta-
tus of IR 24600. IR 24600 is then combined with various other conditions to
determine output conditions for IR 00100, IR 00101, and IR 00102, i.e., to
turn the outputs allocated to these bits ON or OFF.

00000 00001
Address Instruction Operands
24600 00000 LD 00000
00001 AND NOT 00001
00002 00002 OR 00002
00003 OR NOT 00003
00004 OUT 24600
00003 00005 LD 24600
00006 AND 00004
00007 AND NOT 00005
24600 00004 00005
00100
00008 OUT 00100
00009 LD 24600
00010 OR NOT 00004
24600 00005
00011 AND 00005
00101
00012 OUT 00101
00013 LD NOT 24600
00004
00014 OR 00006
00015 OR 00007
24600 00016 OUT 00102
00102

00006

00007

Differentiated Conditions Work bits can also be used if differential treatment is necessary for some, but
not all, of the conditions required for execution of an instruction. In this exam-

91
Programming Precautions Section 4-9

ple, IR 00100 must be left ON continuously as long as IR 00001 is ON and


both IR 00002 and IR 00003 are OFF, or as long as IR 00004 is ON and IR
00005 is OFF. It must be turned ON for only one cycle each time IR 00000
turns ON (unless one of the preceding conditions is keeping it ON continu-
ously).
This action is easily programmed by using IR 22500 as a work bit as the op-
erand of the DIFFERENTIATE UP instruction (DIFU(13)). When IR 00000
turns ON, IR 22500 will be turned ON for one cycle and then be turned OFF
the next cycle by DIFU(13). Assuming the other conditions controlling IR
00100 are not keeping it ON, the work bit IR 22500 will turn IR 00100 ON for
one cycle only.

00000
Address Instruction Operands
DIFU(13) 22500
00000 LD 00000
22500 00001 DIFU(13) 22500
00100
00002 LD 22500
00001 00002 00003 00003 LD 00001
00004 AND NOT 00002
00004 00005 00005 AND NOT 00003
00006 OR LD ---
00007 LD 00004
00008 AND NOT 00005
00009 OR LD ---
00010 OUT 00100

4-9 Programming Precautions


The number of conditions that can be used in series or parallel is unlimited
as long as the memory capacity of the PC is not exceeded. Therefore, use as
many conditions as required to draw a clear diagram. Although very compli-
cated diagrams can be drawn with instruction lines, there must not be any
conditions on lines running vertically between two other instruction lines. Dia-
gram A shown below, for example, is not possible, and should be drawn as
diagram B. Mnemonic code is provided for diagram B only; coding diagram A
would be impossible.

00000 00002
Instruction 1

00004
00001 00003
Instruction 2

Diagram A

00001 00004 00002 Address Instruction Operands


Instruction 1
00000 LD 00001
00000
00001 AND 00004
00002 OR 00000
00000 00004 00003
Instruction 2
00003 AND 00002
00004 Instruction 1
00001
00005 LD 00000
00006 AND 00004
Diagram B 00007 OR 00001
00008 AND NOT 00003
00009 Instruction 2

92
Programming Precautions Section 4-9

The number of times any particular bit can be assigned to conditions is not
limited, so use them as many times as required to simplify your program.
Often, complicated programs are the result of attempts to reduce the number
of times a bit is used.
Except for instructions for which conditions are not allowed (e.g., INTER-
LOCK CLEAR and JUMP END, see below), every instruction line must also
have at least one condition on it to determine the execution condition for the
instruction at the right. Again, diagram A , below, must be drawn as diagram
B. If an instruction must be continuously executed (e.g., if an output must
always be kept ON while the program is being executed), the Always ON
Flag (SR 25313) in the SR area can be used.

Instruction

Diagram A: Incorrect

25313
Instruction Address Instruction Operands
00000 LD 25313
Diagram B 00001 Instruction

There are a few exceptions to this rule, including the INTERLOCK CLEAR,
JUMP END, and step instructions. Each of these instructions is used as the
second of a pair of instructions and is controlled by the execution condition of
the first of the pair. Conditions should not be placed on the instruction lines
leading to these instructions. Refer to Section 5 Instruction Set for details.
When drawing ladder diagrams, it is important to keep in mind the number of
instructions that will be required to input it. In diagram A, below, an OR LOAD
instruction will be required to combine the top and bottom instruction lines.
This can be avoided by redrawing as shown in diagram B so that no AND
LOAD or OR LOAD instructions are required. Refer to 5-6-2 AND LOAD and
OR LOAD for more details and Section 7 Program Monitoring and Execution
for further examples.

00000 Address Instruction Operands


00207
00000 LD 00000
00001 LD 00001
00001 00207
00002 AND 00207
00003 OR LD ---
00004 OUT 00207
Diagram A

Address Instruction Operands


00001 00207
00207 00000 LD 00001
00001 AND 00207
00000
00002 OR 00000
00003 OUT 002

Diagram B

93
Program Execution Section 4-10

4-10 Program Execution


When program execution is started, the CPU cycles the program from top to
bottom, checking all conditions and executing all instructions accordingly as it
moves down the bus bar. It is important that instructions be placed in the
proper order so that, for example, the desired data is moved to a word before
that word is used as the operand for an instruction. Remember that an in-
struction line is completed to the terminal instruction at the right before exe-
cuting an instruction lines branching from the first instruction line to other ter-
minal instructions at the right.
Program execution is only one of the tasks carried out by the CPU as part of
the cycle time. Refer to Section 6 Program Execution Timing for details.

94
SECTION 5
Instruction Set
The C200H PC has a large programming instruction set that allows for easy programming of complicated control proc-
esses. This section explains each instruction individually and provides the ladder diagram symbol, data areas, and flags
used with each.
The many instructions provided by the C200H are organized in the following subsections by instruction group. These
groups include Ladder Diagram Instructions, Bit Control Instructions, Timer and Counter Instructions, Data Shifting In-
structions, Data Movement Instructions, Data Comparison Instructions, Data Conversion Instructions, BCD Calculation
Instructions, Binary Calculation Instructions, Logic Instructions, Subroutines, Special Instructions, and SYSMAC NET
Link/SYSMAC LINK System Instructions.
Some instructions, such as Timer and Counter instructions, are used to control execution of other instructions, e.g., a TIM
Completion Flag might be used to turn ON a bit when the time period set for the timer has expired. Although these other
instructions are often used to control output bits through the Output instruction, they can be used to control execution of
other instructions as well. The Output instructions used in examples in this manual can therefore generally be replaced by
other instructions to modify the program for specific applications other than controlling output bits directly.
5-1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5-2 Instruction Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5-3 Data Areas, Definer Values, and Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5-4 Differentiated Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
5-5 Coding Right-hand Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5-6 Ladder Diagram Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5-6-1 LOAD, LOAD NOT, AND, AND NOT, OR, and OR NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5-6-2 AND LOAD and OR LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
5-7 Bit Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5-7-1 OUTPUT and OUTPUT NOT OUT and OUT NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5-7-2 DIFFERENTIATE UP and DOWN DIFU(13) and DIFD(14) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5-7-3 KEEP KEEP(11) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
5-8 INTERLOCK and INTERLOCK CLEAR IL(02) and ILC(03) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
5-9 JUMP and JUMP END JMP(04) and JME(05) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5-10 END END(01) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5-11 NO OPERATION NOP(00) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5-12 Timer and Counter Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5-12-1 TIMER TIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
5-12-2 HIGH-SPEED TIMER TIMH(15) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
5-12-3 COUNTER CNT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
5-12-4 REVERSIBLE COUNTER CNTR(12) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5-13 Data Shifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
5-13-1 SHIFT REGISTER SFT(10) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
5-13-2 REVERSIBLE SHIFT REGISTER SFTR(84) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5-13-3 ARITHMETIC SHIFT LEFT ASL(25) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5-13-4 ARITHMETIC SHIFT RIGHT ASR(26) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5-13-5 ROTATE LEFT ROL(27) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
5-13-6 ROTATE RIGHT ROR(28) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
5-13-7 ONE DIGIT SHIFT LEFT SLD(74) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
5-13-8 ONE DIGIT SHIFT RIGHT SRD(75) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
5-13-9 WORD SHIFT WSFT(16) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
5-13-10 REVERSIBLE WORD SHIFT RWS(17) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
5-14 Data Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
5-14-1 MOVE MOV(21) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
5-14-2 MOVE NOT MVN(22) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5-14-3 COLUMN-TO-WORD CTW(63) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5-14-4 WORD-TO-COLUMN WTC(64) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
5-14-5 BLOCK SET BSET(71) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
5-14-6 BLOCK TRANSFER XFER(70) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
5-14-7 DATA EXCHANGE XCHG(73) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
5-14-8 SINGLE WORD DISTRIBUTE DIST(80) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
5-14-9 DATA COLLECT COLL(81) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
5-14-10 MOVE BIT MOVB(82) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
5-14-11 MOVE DIGIT MOVD(83) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
5-15 Data Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5-15-1 MULTI-WORD COMPARE MCMP(19) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5-15-2 COMPARE CMP(20) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
5-15-3 DOUBLE COMPARE CMPL(60) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
5-15-4 BLOCK COMPARE BCMP(68) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
5-15-5 TABLE COMPARE TCMP(85) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

95
5-16 Data Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5-16-1 BCD-TO-BINARY BIN(23) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5-16-2 DOUBLE BCD-TO-DOUBLE BINARY BINL(58) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5-16-3 BINARY-TO-BCD BCD(24) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
5-16-4 DOUBLE BINARY-TO-DOUBLE BCD BCDL(59) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
5-16-5 HOURS-TO-SECONDS HTS(65) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
5-16-6 SECONDS-TO-HOURS STH(66) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
5-16-7 4-TO-16 DECODER MLPX(76) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
5-16-8 16-TO-4 ENCODER DMPX(77) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
5-16-9 7-SEGMENT DECODER SDEC(78) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
5-16-10 ASCII CONVERT ASC(86) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
5-17 BCD Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
5-17-1 INCREMENT INC(38) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
5-17-2 DECREMENT DEC(39) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
5-17-3 SET CARRY STC(40) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
5-17-4 CLEAR CARRY CLC(41) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
5-17-5 BCD ADD ADD(30) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
5-17-6 DOUBLE BCD ADD ADDL(54) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
5-17-7 BCD SUBTRACT SUB(31) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
5-17-8 DOUBLE BCD SUBTRACT SUBL(55) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
5-17-9 BCD MULTIPLY MUL(32) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
5-17-10 DOUBLE BCD MULTIPLY MULL(56) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
5-17-11 BCD DIVIDE DIV(33) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
5-17-12 DOUBLE BCD DIVIDE DIVL(57) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
5-17-13 FLOATING POINT DIVIDE FDIV(79) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
5-17-14 SQUARE ROOT ROOT(72) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
5-18 Binary Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
5-18-1 BINARY ADD ADB(50) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
5-18-2 BINARY SUBTRACT SBB(51) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
5-18-3 BINARY MULTIPLY MLB(52) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
5-18-4 BINARY DIVIDE DVB(53) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
5-19 Logic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
5-19-1 COMPLEMENT COM(29) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
5-19-2 LOGICAL AND ANDW(34) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
5-19-3 LOGICAL OR ORW(35) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
5-19-4 EXCLUSIVE OR XORW(36) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
5-19-5 EXCLUSIVE NOR XNRW(37) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
5-20 Subroutines and Interrupt Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
5-20-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
5-20-2 SUBROUTINE DEFINE and RETURN SBN(92)/RET(93) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
5-20-3 SUBROUTINE ENTER SBS(91) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
5-20-4 INTERRUPT CONTROL INT(89) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
5-21 Step Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
5-21-1 STEP DEFINE and STEP STARTSTEP(08)/SNXT(09) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
5-22 Special Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
5-22-1 FAILURE ALARM FAL(06) and SEVERE FAILURE ALARM FALS(07) . . . . . . . . . . . . . . . . 202
5-22-2 CYCLE TIME SCAN(18) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
5-22-3 MESSAGE DISPLAY MSG(46) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
5-22-4 LONG MESSAGE LMSG(47) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
5-22-5 TERMINAL MODE TERM(48) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
5-22-6 SET SYSTEM SYS(49) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
5-22-7 BIT COUNTER BCNT(67) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
5-22-8 VALUE CALCULATE VCAL(69) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
5-22-9 WATCHDOG TIMER REFRESH WDT(94) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5-22-10 I/O REFRESH IORF(97) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5-23 SYSMAC NET Link/SYSMAC LINK Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
5-23-1 NETWORK SEND SEND(90) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
5-23-2 NETWORK RECEIVE RECV(98) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
5-23-3 About SYSMAC NET Link/SYSMAC LINK Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214

96
Data Areas, Definer Values, and Flags Section 5-3

5-1 Notation
In the remainder of this manual, all instructions will be referred to by their
mnemonics. For example, the Output instruction will be called OUT; the AND
Load instruction, AND LD. If youre not sure of the instruction a mnemonic is
used for, refer to Appendix B Programming Instructions.
If an instruction is assigned a function code, it will be given in parentheses
after the mnemonic. These function codes, which are 2-digit decimal num-
bers, are used to input most instructions into the CPU and are described
briefly below and in more detail in 4-6 Inputting, Modifying, and Checking the
Program. A table of instructions listed in order of function codes, is also pro-
vided in Appendix B.
An @ before a mnemonic indicates the differentiated version of that instruc-
tion. Differentiated instructions are explained in Section 5-4.

5-2 Instruction Format


Most instructions have at least one or more operands associated with them.
Operands indicate or provide the data on which an instruction is to be per-
formed. These are sometimes input as the actual numeric values (i.e., as
constants), but are usually the addresses of data area words or bits that con-
tain the data to be used. A bit whose address is designated as an operand is
called an operand bit; a word whose address is designated as an operand is
called an operand word. In some instructions, the word address designated
in an instruction indicates the first of multiple words containing the desired
data.
Each instruction requires one or more words in Program Memory. The first
word is the instruction word, which specifies the instruction and contains any
definers (described below) or operand bits required by the instruction. Other
operands required by the instruction are contained in following words, one
operand per word. Some instructions require up to four words.
A definer is an operand associated with an instruction and contained in the
same word as the instruction itself. These operands define the instruction
rather than telling what data it is to use. Examples of definers are TC num-
bers, which are used in timer and counter instructions to create timers and
counters, as well as jump numbers (which define which Jump instruction is
paired with which Jump End instruction). Bit operands are also contained in
the same word as the instruction itself, although these are not considered
definers.

5-3 Data Areas, Definer Values, and Flags


In this section, each instruction description includes its ladder diagram sym-
bol, the data areas that can be used by its operands, and the values that can
be used as definers. Details for the data areas are also specified by the oper-
and names and the type of data required for each operand (i.e., word or bit
and, for words, hexadecimal or BCD).
Not all addresses in the specified data areas are necessarily allowed for an
operand, e.g., if an operand requires two words, the last word in a data area
cannot be designated as the first word of the operand because all words for a
single operand must be within the same data area. Other specific limitations
are given in a Limitations subsection. Refer to Section 3 Memory Areas for
addressing conventions and the addresses of flags and control bits.

Caution The IR and SR areas are considered as separate data areas. If an operand
has access to one area, it doesnt necessarily mean that the same operand

97
Data Areas, Definer Values, and Flags Section 5-3

will have access to the other area. The border between the IR and SR areas
can, however, be crossed for a single operand, i.e., the last bit in the IR area
may be specified for an operand that requires more than one word as long as
the SR area is also allowed for that operand.

The Flags subsection lists flags that are affected by execution of an instruc-
tion. These flags include the following SR area flags.

Abbreviation Name Bit


ER Instruction Execution Error Flag 25503
CY Carry Flag 25504
GR Greater Than Flag 25505
EQ Equals Flag 25506
LE Less Than Flag 25507

ER is the flag most commonly used for monitoring an instructions execution.


When ER goes ON, it indicates that an error has occurred in attempting to
execute the current instruction. The Flags subsection of each instruction lists
possible reasons for ER being ON. ER will turn ON if operands are not en-
tered correctly. Instructions are not executed when ER is ON. A table of in-
structions and the flags they affect is provided in Appendix D Error and Arith-
metic Flag Operation.

Indirect Addressing When the DM area is specified for an operand, an indirect address can be
used. Indirect DM addressing is specified by placing an asterisk before the
DM: *DM.
When an indirect DM address is specified, the designated DM word will con-
tain the address of the DM word that contains the data that will be used as
the operand of the instruction. If, for example, *DM 0001 was designated as
the first operand and LR 00 as the second operand of MOV(21), the contents
of DM 0001 was 1111, and DM 1111 contained 5555, the value 5555 would
be moved to LR 00.

Word Content
MOV(21)
DM 0000 4C59
*DM 0001
DM 0001 1111
LR 00 Indirect Indicates
DM 0002 F35A
address DM 1111.

DM 1111 5555
DM 1113 2506 5555 moved
DM 1114 D541 to LR 00.

When using indirect addressing, the address of the desired word must be in
BCD and it must specify a word within the DM area. In the above example,
the content of *DM 0000 would have to be in BCD between 0000 and 1999.

Designating Constants Although data area addresses are most often given as operands, many oper-
ands and all definers are input as constants. The available value range for a
given definer or operand depends on the particular instruction that uses it.
Constants must also be entered in the form required by the instruction, i.e., in
BCD or in hexadecimal.

98
Differentiated Instructions Section 5-4

5-4 Differentiated Instructions


Most instructions are provided in both differentiated and non-differentiated
forms. Differentiated instructions are distinguished by an @ in front of the
instruction mnemonic.
A non-differentiated instruction is executed each time it is cycled as long as
its execution condition is ON. A differentiated instruction is executed only
once after its execution condition goes from OFF to ON. If the execution con-
dition has not changed or has changed from ON to OFF since the last time
the instruction was cycled, the instruction will not be executed. The following
two examples show how this works with MOV(21) and @MOV(21), which are
used to move the data in the address designated by the first operand to the
address designated by the second operand.

00000
Address Instruction Operands
MOV(21)

HR 10
00000 LD 00000
00001 MOV(21)
Diagram A DM 0000
HR 10
DM 0000

00000
@MOV(21) Address Instruction Operands
HR 10 00000 LD 00000
Diagram B DM 0000 00001 @MOV(21)
HR 10
DM 0000

In diagram A, the non-differentiated MOV(21) will move the content of HR 10


to DM 0000 whenever it is cycled with 00000. If the cycle time is 80 ms and
00000 remains ON for 2.0 seconds, this move operation will be performed 25
times and only the last value moved to DM 0000 will be preserved there.
In diagram B, the differentiated @MOV(21) will move the content of HR 10 to
DM 0000 only once after 00000 goes ON. Even if 00000 remains ON for 2.0
seconds with the same 80 ms cycle time, the move operation will be exe-
cuted only once during the first cycle in which 00000 has changed from OFF
to ON. Because the content of HR 10 could very well change during the 2
seconds while 00000 is ON, the final content of DM 0000 after the 2 seconds
could be different depending on whether MOV(21) or @MOV(21) was used.
All operands, ladder diagram symbols, and other specifications for instruc-
tions are the same regardless of whether the differentiated or non-differen-
tiated form of an instruction is used. When inputting, the same function codes
are also used, but NOT is input after the function code to designate the differ-
entiated form of an instruction. Most, but not all, instructions have differenti-
ated forms.
Refer to 5-8 INTERLOCK and INTERLOCK CLEAR IL(02) and IL(03) for
the effects of interlocks on differentiated instructions.
The C200H also provides differentiation instructions: DIFU(13) and DIFD(14).
DIFU(13) operates the same as a differentiated instruction, but is used to turn
ON a bit for one cycle. DIFD(14) also turns ON a bit for one cycle, but does it
when the execution condition has changed from ON to OFF. Refer to 5-7-2
DIFFERENTIATE UP and DOWN DIFU(13) and DIFD(14) for details.
Note If SR25313 (Always ON Flag) or SR25315 (First Cycle Bit) are used as input
bits for differentiated instructions, because thre is no rising edge, the differen-
tiated instruction will not be executed. Do not use SR25313 or SR25315 as
input bits for differentiated instructions.

99
Coding Right-hand Instructions Section 5-5

5-5 Coding Right-hand Instructions


Writing mnemonic code for ladder instructions is described in Section 4 Writ-
ing and Inputting the Program. Converting the information in the ladder dia-
gram symbol for all other instructions follows the same pattern, as described
below, and is not specified for each instruction individually.
The first word of any instruction defines the instruction and provides any de-
finers. If the instruction requires only a signal bit operand with no definer, the
bit operand is also placed on the same line as the mnemonic. All other oper-
ands are placed on lines after the instruction line, one operand per line and in
the same order as they appear in the ladder symbol for the instruction.
The address and instruction columns of the mnemonic code table are filled in
for the instruction word only. For all other lines, the left two columns are left
blank. If the instruction requires no definer or bit operand, the data column is
left blank for first line. It is a good idea to cross through any blank data col-
umn spaces (for all instruction words that do not require data) so that the
data column can be quickly cycled to see if any addresses have been left
out.
If an IR or SR address is used in the data column, the left side of the column
is left blank. If any other data area is used, the data area abbreviation is
placed on the left side and the address is place on the right side. If a con-
stant to be input, the number symbol (#) is placed on the left side of the data
column and the number to be input is placed on the right side. Any numbers
input as definers in the instruction word do not require the number symbol on
the right side. TC bits, once defined as a timer or counter, take a TIM (timer)
or CNT (counter) prefix.
When coding an instruction that has a function code, be sure to write in the
function code, which will be necessary when inputting the instruction via the
Programming Console. Also be sure to designate the differentiated instruc-
tion with the @ symbol.

100
Coding Right-hand Instructions Section 5-5

The following diagram and corresponding mnemonic code illustrates the


points described above.

00000 00001
Address Instruction Data
DIFU(13) 22500 00000 LD 00000
00002
00001 AND 00001
00002 OR 00002
00100 00200 22500 00003 DIFU(13) 22500
BCNT(67)
00004 LD 00100
01001 01002 LR 6300 #0001
00005 AND NOT 00200
004
00006 LD 01001
HR 00
00007 AND NOT 01002
00008 AND NOT LR 6300
00005 00009 OR LD --
TIM 000
00010 AND 22500
#0150
00011 BCNT(67) --
TIM 000 # 0001
MOV(21)
004
HR 00
HR 00
LR 00
00012 LD 00005
00013 TIM 000
HR 0015
00500 # 0150
00014 LD TIM 000
00015 MOV(21) --
HR 00
LR 00
00016 LD HR 0015
00017 OUT NOT 00500

Multiple Instruction Lines If a right-hand instruction requires multiple instruction lines (such as
KEEP(11)), all of the lines for the instruction are entered before the right-
hand instruction. Each of the lines for the instruction is coded, starting with

101
Ladder Diagram Instructions Section 5-6

LD or LD NOT, to form logic blocks that are combined by the right-hand in-
struction. An example of this for SFT(10) is shown below.

Address Instruction Data


00000 00001
I
SFT(10) 00000 LD 00000
00002
P 00001 AND 00001
HR 00
00100 00200 22500 00002 LD 00002
R
HR 00
00003 LD 00100
01001 01002 LR 6300
00004 AND NOT 00200
00005 LD 01001
HR 0015
00500 00006 AND NOT 01002
00007 AND NOT LR 6300
00008 OR LD --
00009 AND 22500
00010 SFT(10) --
HR 00
HR 00
00011 LD HR 0015
00012 OUT NOT 00500

END(01) When you have finished coding the program, make sure you have placed
END(01) at the last address.

5-6 Ladder Diagram Instructions


Ladder Diagram instructions include Ladder instructions and Logic Block in-
structions. Ladder instructions correspond to the conditions on the ladder
diagram. Logic block instructions are used to relate more complex parts of
the diagram that cannot be programmed with Ladder instructions alone.

5-6-1 LOAD, LOAD NOT, AND, AND NOT, OR, and OR NOT
Ladder Symbols Operand Data Areas

B B: Bit
LOAD LD
IR, SR, AR, HR, TC, LR, TR

B B: Bit
LOAD NOT LD NOT
IR, SR, AR, HR, TC, LR

B B: Bit
AND AND
IR, SR, AR, HR, TC, LR

B B: Bit
AND NOT AND NOT
IR, SR, AR, HR, TC, LR

102
Ladder Diagram Instructions Section 5-6

B: Bit
OR OR B
IR, SR, AR, HR, TC, LR

B: Bit
OR NOT OR NOT B
IR, SR, AR, HR, TC, LR

Limitations There is no limit to the number of any of these instructions, or restrictions in


the order in which they must be used, as long as the memory capacity of the
PC is not exceeded.

Description These six basic instructions correspond to the conditions on a ladder dia-
gram. As described in Section 4 Writing and Inputting the Program, the
status of the bits assigned to each instruction determines the execution con-
ditions for all other instructions. Each of these instructions and each bit ad-
dress can be used as many times as required. Each can be used in as many
of these instructions as required.
The status of the bit operand (B) assigned to LD or LD NOT determines the
first execution condition. AND takes the logical AND between the execution
condition and the status of its bit operand; AND NOT, the logical AND be-
tween the execution condition and the inverse of the status of its bit operand.
OR takes the logical OR between the execution condition and the status of its
bit operand; OR NOT, the logical OR between the execution condition and
the inverse of the status of its bit operand. The ladder symbol for loading TR
bits is different from that shown above. Refer to 4-3-3 Ladder Instructions for
details.

Flags There are no flags affected by these instructions.

5-6-2 AND LOAD and OR LOAD

AND LOAD AND LD


00000 00002

Ladder Symbol 00001 00003

OR LOAD OR LD
00000 00001

Ladder Symbol
00002 00003

Description When instructions are combined into blocks that cannot be logically com-
bined using only OR and AND operations, AND LD and OR LD are used.
Whereas AND and OR operations logically combine a bit status and an exe-
cution condition, AND LD and OR LD logically combine two execution condi-
tions, the current one and the last unused one.

103
Bit Control Instructions Section 5-7

In order to draw ladder diagrams, it is not necessary to use AND LD and OR


LD instructions, nor are they necessary when inputting ladder diagrams di-
rectly, as is possible from the GPC. They are required, however, to convert
the program to and input it in mnemonic form. The procedures for these, limi-
tations for different procedures, and examples are provided in 4-6 Inputting,
Modifying, and Checking the Program.
In order to reduce the number of programming instructions required, a basic
understanding of logic block instructions is required. For an introduction to
logic blocks, refer to 4-3-6 Logic Block Instructions. For details and exam-
ples, refer to 4-3-6 Logic Block Instructions.

Flags There are no flags affected by these instructions.

5-7 Bit Control Instructions


There are five instructions that can be used generally to control individual bit
status. These are OUT, OUT NOT, DIFU(13), DIFD(14), and KEEP(11).
These instructions are used to turn bits ON and OFF in different ways.

5-7-1 OUTPUT and OUTPUT NOT OUT and OUT NOT


OUTPUT OUT
Ladder Symbol Operand Data Areas

B: Bit
B
IR, SR, AR, HR, TC, LR, TR

OUTPUT NOT OUT NOT


Ladder Symbol Operand Data Areas

B: Bit
B
IR, SR, AR, HR, TC, LR

Limitations Any output bit can generally be used in only one instruction that controls its
status. Refer to 3-3 IR Area for details.

Description OUT and OUT NOT are used to control the status of the designated bit ac-
cording to the execution condition.
OUT turns ON the designated bit for an ON execution condition, and turns
OFF the designated bit for an OFF execution condition. With a TR bit, OUT
appears at a branching point rather than at the end of an instruction line. Re-
fer to 4-6-7 Branching Instruction Lines for details.
OUT NOT turns ON the designated bit for a OFF execution condition, and
turns OFF the designated bit for an ON execution condition.
OUT and OUT NOT can be used to control execution by turning ON and OFF
bits that are assigned to conditions on the ladder diagram, thus determining
execution conditions for other instructions. This is particularly helpful and al-
lows a complex set of conditions to be used to control the status of a single
work bit, and then that work bit can be used to control other instructions.
The length of time that a bit is ON or OFF can be controlled by combining the
OUT or OUT NOT with TIM. Refer to Examples under 5-12-1 TIMER TIM
for details.

104
Bit Control Instructions Section 5-7

Flags There are no flags affected by these instructions.

5-7-2 DIFFERENTIATE UP and DOWN DIFU(13) and DIFD(14)

Ladder Symbols Operand Data Areas

B: Bit
DIFU(13) B
IR, AR, HR, LR

B: Bit
DIFD(14) B
IR, AR, HR, LR

Limitations Any output bit can generally be used in only one instruction that controls its
status. Refer to 3-3 IR Area for details.

Description DIFU(13) and DIFD(14) are used to turn the designated bit ON for one cycle
only.
Whenever executed, DIFU(13) compares its current execution with the previ-
ous execution condition. If the previous execution condition was OFF and the
current one is ON, DIFU(13) will turn ON the designated bit. If the previous
execution condition was ON and the current execution condition is either ON
or OFF, DIFU(13) will either turn the designated bit OFF or leave it OFF (i.e.,
if the designated bit is already OFF). The designated bit will thus never be
ON for longer than one cycle, assuming it is executed each cycle (see Pre-
cautions, below).
Whenever executed, DIFD(14) compares its current execution with the previ-
ous execution condition. If the previous execution condition was ON and the
current one is OFF, DIFD(14) will turn ON the designated bit. If the previous
execution condition was OFF and the current execution condition is either
ON or OFF, DIFD(14) will either turn the designated bit OFF or leave it OFF.
The designated bit will thus never be ON for longer than one cycle, assuming
it is executed each cycle (see Precautions, below).
These instructions are used when differentiated instructions (i.e., those pre-
fixed with an @) are not available and single-cycle execution of a particular
instruction is desired. They can also be used with non-differentiated forms of
instructions that have differentiated forms when their use will simplify pro-
gramming. Examples of these are shown below.

Flags There are no flags affected by these instructions.

Precautions DIFU(13) and DIFD(14) operation can be uncertain when the instructions are
programmed between IL and ILC, between JMP and JME, or in subroutines.
Refer to 5-8 INTERLOCK and INTERLOCK CLEAR IL(02) and ILC(03), 5-9
JUMP and JUMP END JMP(04) and JME(05), and 5-20 Subroutines and
Interrupt Control for details.

Example 1: In diagram A, below, whenever CMP(20) is executed with an ON execution


When There is No condition it will compare the contents of the two operand words (HR 10 and
Differentiated Instruction DM 0000) and set the arithmetic flags (GR, EQ, and LE) accordingly. If the
execution condition remains ON, flag status may be changed each cycle if
the content of one or both operands change. Diagram B, however, is an ex-

105
Bit Control Instructions Section 5-7

ample of how DIFU(13) can be used to ensure that CMP(20) is executed only
once each time the desired execution condition goes ON.

00000
Address Instruction Operands
CMP(20)
00000 LD 00000
HR 10
00001 CMP(20)
Diagram A DM 0000
HR 10
DM 0000
00000
DIFU(13) 22500
Address Instruction Operands
22500 00000 LD 00000
CMP(20)
00001 DIFU(13) 22500
HR 10 00002 LD 22500
Diagram B DM 0000 00003 CMP(20)
HR 10
DM 0000

Example 2: Although a differentiated form of MOV(21) is available, the following diagram


Simplifying Programming would be very complicated to draw using it because only one of the condi-
tions determining the execution condition for MOV(21) requires differentiated
treatment.

00000
Address Instruction Operands
DIFU(13) 22500
00000 LD 00000
22500 00001 DIFU(13) 22500
MOV(21) 00002 LD 22500
00001 00002 00003 HR 10 00003 LD 00001
DM 0000 00004 AND NOT 00002
00004 00005 00005 AND NOT 00003
00006 OR LD ---
00007 LD 00004
00008 AND NOT 00005
00009 OR LD ---
00010 MOV(21)
HR 10
DM 0000

5-7-3 KEEP KEEP(11)

Ladder Symbol Operand Data Areas


S

KEEP(11) B: Bit
B
IR, AR, HR, LR
R

Limitations Any output bit can generally be used in only one instruction that controls its
status. Refer to 3-3 IR Area for details.

Description KEEP(11) is used to maintain the status of the designated bit based on two
execution conditions. These execution conditions are labeled S and R. S is

106
Bit Control Instructions Section 5-7

the set input; R, the reset input. KEEP(11) operates like a latching relay that
is set by S and reset by R.
When S turns ON, the designated bit will go ON and stay ON until reset, re-
gardless of whether S stays ON or goes OFF. When R turns ON, the desig-
nated bit will go OFF and stay OFF until reset, regardless of whether R stays
ON or goes OFF. The relationship between execution conditions and
KEEP(11) bit status is shown below.

S execution condition

R execution condition

Status of B

KEEP(11) operates like the self-maintaining bit described in 4-7-3 Self-main-


taining Bits. The following two diagrams would function identically, though the
one using KEEP(11) requires one less instruction to program and would
maintain status even in an interlocked program section.

00002 00003 Address Instruction Operands


00500
00000 LD 00002
00500 00001 OR 00500
00002 AND NOT 00003
00003 OUT 00500

00002
S Address Instruction Operands
KEEP(11) 00000 LD 00002
00001 LD 00003
00003 B
R
00002 KEEP(11) 00500

Flags There are no flags affected by this instruction.

Precautions Exercise caution when using a KEEP reset line that is controlled by an exter-
nal normally closed device. Never use an input bit in an inverse condition on
the reset (R) for KEEP(11) when the input device uses an AC power supply.
The delay in shutting down the PCs DC power supply (relative to the AC
power supply to the input device) can cause the designated bit of KEEP(11)
to be reset. This situation is shown below.

Input Unit

A S

KEEP(11)

NEVER A B
R

Bits used in KEEP are not reset in interlocks. Refer to the 5-8 INTERLOCK
and INTERLOCK CLEAR IL(02) and ILC(03) for details.

107
INTERLOCK and INTERLOCK CLEAR IL(02) and ILC(03) Section 5-8

Example If a HR bit or an AR bit is used, bit status will be retained even during a
power interruption. KEEP(11) can thus be used to program bits that will main-
tain status after restarting the PC following a power interruption. An example
of this that can be used to produce a warning display following a system
shutdown for an emergency situation is shown below. Bits 00002, 00003, and
00004 would be turned ON to indicate some type of error. Bit 00005 would be
turned ON to reset the warning display. HR 0000, which is turned ON when
any one of the three bits indicates an emergency situation, is used to turn ON
the warning indicator through 00500.

00002
S Address Instruction Operands
KEEP(11) 00000 LD 00002
00003 00001 OR 00003
Indicates B
emergency 00002 OR 00004
situation
00004
00003 LD 00005
R 00004 KEEP(11) HR 0000
Reset input 00005 LD HR 0000
00005 00006 OUT 00500

HR 0000 Activates
00500 warning
display

KEEP(11) can also be combined with TIM to produce delays in turning bits
ON and OFF. Refer to 5-12-1 TIMER TIM for details.

5-8 INTERLOCK and INTERLOCK CLEAR IL(02) and ILC(03)


Ladder Symbol IL(02)

Ladder Symbol ILC(03)

Description IL(02) is always used in conjunction with ILC(03) to create interlocks. Inter-
locks are used to enable branching in the same way as can be achieved with
TR bits, but treatment of instructions between IL(02) and ILC(03) differs from
that with TR bits when the execution condition for IL(02) is OFF. If the execu-
tion condition of IL(02) is ON, the program will be executed as written, with
an ON execution condition used to start each instruction line from the point
where IL(02) is located through the next ILC(03). Refer to 4-6-7 Branching
Instruction Lines for basic descriptions of both methods.
If the execution condition for IL(02) is OFF, the interlocked section between
IL(02) and ILC(03) will be treated as shown in the following table:

Instruction Treatment
OUT and OUT NOT Designated bit turned OFF.
TIM and TIMH(15) Reset.
CNT, CNTR(12) PV maintained.
KEEP(11) Bit status maintained.
DIFU(13) and DIFD(14) Not executed (see below).
All others Not executed.

108
INTERLOCK and INTERLOCK CLEAR IL(02) and ILC(03) Section 5-8

IL(02) and ILC(03) do not necessarily have to be used in pairs. IL(02) can be
used several times in a row, with each IL(02) creating an interlocked section
through the next ILC(03). ILC(03) cannot be used unless there is at least one
IL(02) between it and any previous ILC(03).

DIFU(13) and DIFD(14) in Changes in the execution condition for a DIFU(13) or DIFD(14) are not re-
Interlocks corded if the DIFU(13) or DIFD(14) is in an interlocked section and the exe-
cution condition for the IL(02) is OFF. When DIFU(13) or DIFD(14) is execu-
tion in an interlocked section immediately after the execution condition for the
IL(02) has gone ON, the execution condition for the DIFU(13) or DIFD(14)
will be compared to the execution condition that existed before the interlock
became effective (i.e., before the interlock condition for IL(02) went OFF).
The ladder diagram and bit status changes for this are shown below. The
interlock is in effect while 00000 is OFF. Notice that 01000 is not turned ON
at the point labeled A even though 00001 has turned OFF and then back ON.

00000
Address Instruction Operands
IL(02)
00001 00000 LD 00000
DIFU(13) 01000 00001 IL(02)
00002 LD 00001
ILC(03)
00003 DIFU(13) 01000
A 00004 ILC(03)

ON

00000 OFF

ON

00001 OFF

ON

01000 OFF

Precautions There must be an ILC(03) following any one or more IL(02).


Although as many IL(02) instructions as are necessary can be used with one
ILC(03), ILC(03) instructions cannot be used consecutively without at least
one IL(02) in between, i.e., nesting is not possible. Whenever a ILC(03) is
executed, all interlocks between the active ILC(03) and the preceding
ILC(03) are cleared.
When more than one IL(02) is used with a single ILC(03), an error message
will appear when the program check is performed, but execution will proceed
normally.

Flags There are no flags affected by these instructions.

109
JUMP and JUMP END JMP(04) and JME(05) Section 5-9

Example The following diagram shows IL(02) being used twice with one ILC(03).

00000 Address Instruction Operands


IL(02)
00000 LD 00000
00001
00001 IL(02)
TIM
TIM511
511
00002 LD 00001
#0015 001.5 s
00003 TIM 511
00002 # 0015
IL(02)
00004 LD 00002
00003 00004
CP
00005 IL(02)
CNT 00006 LD 00003
00100 001
R IR 010 00007 AND NOT 00004
00008 CNT 001
010
00005
00502 00009 LD 00005
00010 OUT 00502
00011 ILC(03)
ILC(03)

When the execution condition for the first IL(02) is OFF, TIM 511 will be reset
to 1.5 s, CNT 001 will not be changed, and 00502 will be turned OFF. When
the execution condition for the first IL(02) is ON and the execution condition
for the second IL(02) is OFF, TIM 511 will be executed according to the
status of 00001, CNT 001 will not be changed, and 00502 will be turned OFF.
When the execution conditions for both the IL(02) are ON, the program will
execute as written.

5-9 JUMP and JUMP END JMP(04) and JME(05)


Ladder Symbols Definer Values

N: Jump number
JMP(04) N
# (00 to 99)

N: Jump number
JME(05) N
# (00 to 99)

Limitations Jump numbers 01 through 99 may be used only once in JMP(04) and once in
JME(05), i.e., each can be used to define one jump only. Jump number 00
can be used as many times as desired.

Description JMP(04) is always used in conjunction with JME(05) to create jumps, i.e., to
skip from one point in a ladder diagram to another point. JMP(04) defines the
point from which the jump will be made; JME(05) defines the destination of
the jump. When the execution condition for JMP(04) in ON, no jump is made
and the program is executed consecutively as written. When the execution
condition for JMP(04) is OFF, a jump is made to the JME(05) with the same
jump number and the instruction following JME(05) is executed next.
If the jump number for JMP(04) is between 01 and 99, jumps, when made,
will go immediately to JME(05) with the same jump number without executing

110
END END(01) Section 5-10

any instructions in between. The status of timers, counters, bits used in OUT,
bits used in OUT NOT, and all other status bits controlled by the instructions
between JMP(04) and JMP(05) will not be changed. Each of these jump
numbers can be used to define only one jump. Because all of instructions
between JMP(04) and JME(05) are skipped, jump numbers 01 through 99
can be used to reduce cycle time.
If the jump number for JMP(04) is 00, the CPU will look for the next JME(05)
with a jump number of 00. To do so, it must search through the program,
causing a longer cycle time (when the execution condition is OFF) than for
other jumps. The status of timers, counters, bits used in OUT, bits used in
OUT NOT, and all other status controlled by the instructions between
JMP(04) 00 and JMP(05) 00 will not be changed. jump number 00 can be
used as many times as desired. A jump from JMP(04) 00 will always go to
the next JME(05) 00 in the program. It is thus possible to use JMP(04) 00
consecutively and match them all with the same JME(05) 00. It makes no
sense, however, to use JME(05) 00 consecutively, because all jumps made
to them will end at the first JME(05) 00.

DIFU(13) and DIFD(14) in Although DIFU(13) and DIFD(14) are designed to turn ON the designated bit
Jumps for one cycle, they will not necessarily do so when written between JMP(04)
and JMP (05). Once either DIFU(13) or DIFD(14) has turned ON a bit, it will
remain ON until the next time DIFU(13) or DIFD(14) is executed again. In
normal programming, this means the next cycle. In a jump, this means the
next time the jump from JMP(04) to JME(05) is not made, i.e., if a bit is
turned ON by DIFU(13) or DIFD(14) and then a jump is made in the next
cycle so that DIFU(13) or DIFD(14) are skipped, the designated bit will re-
main ON until the next time the execution condition for the JMP(04) control-
ling the jump is ON.

Precautions When JMP(04) and JME(05) are not used in pairs, an error message will ap-
pear when the program check is performed. Although this message also ap-
pears if JMP(04) 00 and JME(05) 00 are not used in pairs, the program will
execute properly as written.

Flags There are no flags affected by these instructions.

Examples Examples of jump programs are provided in 4-6-8 Jumps.

5-10 END END(01)

Ladder Symbol END(01)

Description END(01) is required as the last instruction in any program. If there are sub-
routines, END(01) is placed after the last subroutine. No instruction written
after END(01) will be executed. END(01) can be placed anywhere in the pro-
gram to execute all instructions up to that point, as is sometimes done to de-
bug a program, but it must be removed to execute the remainder of the pro-
gram.
If there is no END(01) in the program, no instructions will be executed and
the error message NO END INST will appear.

Flags END(01) turns OFF the ER, CY, GR, EQ, and LE flags.

111
Timer and Counter Instructions Section 5-12

5-11 NO OPERATION NOP(00)


Description NOP(00) is not generally required in programming and there is no ladder
symbol for it. When NOP(00) is found in a program, nothing is executed and
the program execution moves to the next instruction. When memory is
cleared prior to programming, NOP(00) is written at all addresses. NOP(00)
can be input through the 00 function code.

Flags There are no flags affected by NOP(00).

5-12 Timer and Counter Instructions


TIM and TIMH are decrementing ON-delay timer instructions which require a
TC number and a set value (SV).
CNT is a decrementing counter instruction and CNTR is a reversible counter
instruction. Both require a TC number and a SV. Both are also connected to
multiple instruction lines which serve as an input signal(s) and a reset.
Any one TC number cannot be defined twice, i.e., once it has been used as
the definer in any of the timer or counter instructions, it cannot be used
again. Once defined, TC numbers can be used as many times as required as
operands in instructions other than timer and counter instructions.
TC numbers run from 000 through 511. No prefix is required when using a
TC number as a definer in a timer or counter instruction. Once defined as a
timer, a TC number can be prefixed with TIM for use as an operand in certain
instructions. The TIM prefix is used regardless of the timer instruction that
was used to define the timer. Once defined as a counter, a TC number can
be prefixed with CNT for use as an operand in certain instructions. The CNT
is also used regardless of the counter instruction that was used to define the
counter.
TC numbers can be designated as operands that require either bit or word
data. When designated as an operand that requires bit data, the TC number
accesses a bit that functions as a Completion Flag that indicates when the
time/count has expired, i.e., the bit, which is normally OFF, will turn ON when
the designated SV has expired. When designated as an operand that re-
quires word data, the TC number accesses a memory location that holds the
present value (PV) of the timer or counter. The PV of a timer or counter can
thus be used as an operand in CMP(20), or any other instruction for which
the TC area is allowed. This is done by designating the TC number used to
define that timer or counter to access the memory location that holds the PV.
Note that TIM 000 is used to designate the TIMER instruction defined with
TC number 000, to designate the Completion Flag for this timer, and to des-
ignate the PV of this timer. The meaning of the term in context should be
clear, i.e., the first is always an instruction, the second is always a bit oper-
and, and the third is always a word operand. The same is true of all other TC
numbers prefixed with TIM or CNT.
An SV can be input as a constant or as a word address in a data area. If an
IR area word assigned to an Input Unit is designated as the word address,
the Input Unit can be wired so that the SV can be set externally through
thumbwheel switches or similar devices. Timers and counters wired in this
way can only be set externally during RUN or MONITOR mode. All SVs, in-
cluding those set externally, must be in BCD.

112
Timer and Counter Instructions Section 5-12

5-12-1 TIMER TIM


Definer Values

N: TC number
Ladder Symbol
# (000 through 511)
TIM N
SV
Operand Data Areas

SV: Set value (word, BCD)

IR, AR, DM, HR, LR, #

Limitations SV is between 000.0 and 999.9. The decimal point is not entered.
The SV of the timers can be set in the range #0000 to #9999 (BCD). If the
SV for a timer is set to #0000 or #0001, it will operate in the following way. If
the SV is set to #0000, when the timer input goes from OFF to ON, the Com-
pletion Flag will turn ON. If the SV is set to #0001, because the timer accu-
racy is 0 to 0.1 s, the actual time will be a value between 0 and 0.1 s, and
the Completion Flag may turn ON as soon as the timer input goes from OFF
to ON. With other values also, allow for a timer accuracy of 0 to 0.1 s when
setting the SV.
Each TC number can be used as the definer in only one TIMER or COUNT-
ER instruction.
TC 000 through TC 015 should not be used in TIM if they are required for
TIMH(15). Refer to 5-12-2 HIGH-SPEED TIMER TIMH(15) for details.

Description A timer is activated when its execution condition goes ON and is reset (to
SV) when the execution condition goes OFF. Once activated, TIM measures
in units of 0.1 second from the SV.
If the execution condition remains ON long enough for TIM to time down to
zero, the Completion Flag for the TC number used will turn ON and will re-
main ON until TIM is reset (i.e., until its execution condition is goes OFF).
The following figure illustrates the relationship between the execution condi-
tion for TIM and the Completion Flag assigned to it.

ON
Execution condition OFF

ON
Completion Flag OFF

SV SV

Precautions Timers in interlocked program sections are reset when the execution condi-
tion for IL(02) is OFF. Power interruptions also reset timers. If a timer that is
not reset under these conditions is desired, SR area clock pulse bits can be
counted to produce timers using CNT. Refer to 5-12-3 Counter CNT for de-
tails.
Program execution will continue even if a non-BCD SV is used, but timing will
not be accurate.

113
Timer and Counter Instructions Section 5-12

Flags ER: SV is not in BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

Examples All of the following examples use OUT in diagrams that would generally be
used to control output bits in the IR area. There is no reason, however, why
these diagrams cannot be modified to control execution of other instructions.

Example 1: The following example shows two timers, one set with a constant and one set
Basic Application via input word 005. Here, 00200 will be turned ON after 00000 goes ON and
stays ON for at least 15 seconds. When 00000 goes OFF, the timer will be
reset and 00200 will be turned OFF. When 00001 goes ON, TIM 001 is
started from the SV provided through IR word 005. Bit 00201 is also turned
ON when 00001 goes ON. When the SV in 005 has expired, 00201 is turned
OFF. This bit will also be turned OFF when TIM 001 is reset, regardless of
whether or not SV has expired.

00000
TIM 000
Address Instruction Operands
#0150 015.0 s 00000 LD 00000
00001 TIM 000
TIM 000 # 0150
00200
00002 LD TIM 000
00001 00003 OUT 00200
TIM 001 00004 LD 00001
IR 005 IR 005 00005 TIM 001
005
TIM 001
00201 00006 AND NOT TIM 001
00007 OUT 00200

Example 2: There are two ways to achieve timers that operate for longer than 999.9 sec-
Extended Timers onds. One method is to program consecutive timers, with the Completion
Flag of each timer used to activate the next timer. A simple example with two
900.0-second (15-minute) timers combined to functionally form a 30-minute
timer.

00000
TIM 001
Address Instruction Operands
#9000 900.0 s 00000 LD 00000
TIM 001 00001 TIM 001
TIM 002 # 9000
#9000 900.0 s 00002 LD TIM 001
00003 TIM 002
TIM 002 # 9000
00200
00004 LD TIM 002
00005 OUT 00200

In this example, 00200 will be turned ON 30 minutes after 00000 goes ON.
TIM can also be combined with CNT or CNT can be used to count SR area
clock pulse bits to produce longer timers. An example is provided in 5-12-3
COUNTER CNT.

Example 3: TIM can be combined with KEEP(11) to delay turning a bit ON and OFF in
ON/OFF Delays reference to a desired execution condition. KEEP(11) is described in 5-7-3
KEEP KEEP(11).

114
Timer and Counter Instructions Section 5-12

To create delays, the Completion Flags for two TIM are used to determine
the execution conditions for setting and reset the bit designated for
KEEP(11). The bit whose manipulation is to be delayed is used in KEEP(11).
Turning ON and OFF the bit designated for KEEP(11) is thus delayed by the
SV for the two TIM. The two SV could naturally be the same if desired.
In the following example, 00500 would be turned ON 5.0 seconds after
00000 goes ON and then turned OFF 3.0 seconds after 00000 goes OFF. It
is necessary to use both 00500 and 00000 to determine the execution condi-
tion for TIM 002; 00000 in an inverse condition is necessary to reset TIM 002
when 00000 goes ON and 00500 is necessary to activate TIM 002 (when
00000 is OFF).

00000
TIM 001
Address Instruction Operands
#0050 005.0 s 00000 LD 00000
00500 00000 00001 TIM 001
TIM 002 # 0050
#0030 003.0 s 00002 LD 00500
TIM 001 00003 AND NOT 00000
S
00004 TIM 002
KEEP(11) # 0030
00500
00005 LD TIM 001
TIM 002
R 00006 LD TIM 002
00007 KEEP(11) 00500

00000

00500

5.0 s 3.0 s

Example 4: The length of time that a bit is kept ON or OFF can be controlled by combin-
One-Shot Bits ing TIM with OUT or OUT NO. The following diagram demonstrates how this
is possible. In this example, 00204 would remain ON for 1.5 seconds after
00000 goes ON regardless of the time 00000 stays ON. This is achieved by
using 01000 as a self-maintaining bit activated by 00000 and turning ON
00204 through it. When TIM 001 comes ON (i.e., when the SV of TIM 001
has expired), 00204 will be turned OFF through TIM 001 (i.e., TIM 001 will
turn ON which, as an inverse condition, creates an OFF execution condition
for OUT 00204).

115
Timer and Counter Instructions Section 5-12

01000 TIM 001


01000
Address Instruction Operands
00000 LD 01000
00000 00001 AND NOT TIM 001
00002 OR 00000
00003 OUT 01000
01000
TIM 001
00004 LD 01000
#0015
00005 TIM 001
001.5 s
# 0015
00006 LD 01000
01000 TIM 001
00204 00007 AND NOT TIM 001
00008 OUT 00204

00000

00204

1.5 s 1.5 s

The following one-shot timer may be used to save memory.

00000
TIM 001
Address Instruction Operands
#0015 001.5 s
00000 LD 00000
00001 OR 00100
00100 TIM 001 00002 TIM 001
00100 # 0015
00003 AND NOT TIM 001
00004 OUT 00100

Example 5: Bits can be programmed to turn ON and OFF at regular intervals while a des-
Flicker Bits ignated execution condition is ON by using TIM twice. One TIM functions to
turn ON and OFF a specified bit, i.e., the Completion Flag of this TIM turns
the specified bit ON and OFF. The other TIM functions to control the opera-
tion of the first TIM, i.e., when the first TIMs Completion Flag goes ON, the
second TIM is started and when the second TIMs Completion Flag goes ON,
the first TIM is started.

00000 TIM 002


TIM 001
Address Instruction Operands
#0010 1.0 s
00000 LD 00000
TIM 001
00001 AND TIM 002
TIM 002
00002 TIM 001
#0015 1.5 s
# 0010
00003 LD TIM 001
TIM 001 00004 TIM 002
00205 # 0015
00005 LD TIM 001
00006 OUT 00205

00000

00205

1.0 s 1.5 s 1.0 s 1.5 s

116
Timer and Counter Instructions Section 5-12

A simpler but less flexible method of creating a flicker bit is to AND one of the
SR area clock pulse bits with the execution condition that is to be ON when
the flicker bit is operating. Although this method does not use TIM, it is in-
cluded here for comparison. This method is more limited because the ON
and OFF times must be the same and they depend on the clock pulse bits
available in the SR area.
In the following example the 1-second clock pulse is used (25502) so that
00206 would be turned ON and OFF every second, i.e., it would be ON for
0.5 seconds and OFF for 0.5 seconds. Precise timing and the initial status of
00206 would depend on the status of the clock pulse when 00000 goes ON.

Address Instruction Operands


00000 25502
00206 00000 LD 00000
00001 LD 25502
00002 OUT 00206

5-12-2 HIGH-SPEED TIMER TIMH(15)


Definer Values

N: TC number
Ladder Symbol
# (000 through 015 preferred)
TIMH(15) N
SV
Operand Data Areas

SV: Set value (word, BCD)

IR, AR, DM, HR, LR, #

Limitations SV is between 00.00 and 99.99. (Although 00.00 and 00.01 may be set,
00.00 will disable the timer, i.e., turn ON the Completion Flag immediately,
and 00.01 is not reliably cycled.) The decimal point is not entered.
Each TC number can be used as the definer in only one TIMER or COUNT-
ER instruction.
TC 000 through TC 047 must be used to ensure accuracy if the cycle time is
greater than 10 ms.

Description TIMH(15) operates in the same way as TIM except that TIMH measures in
units of 0.01 second.
The cycle time affects TIMH(15) accuracy if TC 016 through TC 511 are
used. If the cycle time is greater than 10 ms, use TC 000 through TC 015.
Refer to 5-12-1 TIMER TIM for operational details and examples. Except
for the above, and all aspects of operation are the same.

Precautions Timers in interlocked program sections are reset when the execution condi-
tion for IL(02) is OFF. Power interruptions also reset timers. If a timer that is
not reset under these conditions is desired, SR area clock pulse bits can be
counted to produce timers using CNT. Refer to 5-12-3 COUNTER CNT for
details.
Program execution will continue even if a non-BCD SV is used, but timing will
not be accurate.

117
Timer and Counter Instructions Section 5-12

The SV of the timers can be set in the range #0000 to #9999 (BCD). If the
SV for a timer is set to #0000 or #0001, it will operate in the following way. If
the SV is set to #0000, when the timer input goes from OFF to ON, the Com-
pletion Flag will turn ON. There may be a time delay if TC 000 to TC 003 are
used. If the SV is set to #0001, because the timer accuracy is 0 to 0.1 s, the
actual time will be a value between 0 and 0.1 s, and the Completion Flag
may turn ON as soon as the timer input goes from OFF to ON. With other
values also, allow for a timer accuracy of 0 to 0.1 s when setting the SV.

Flags ER: SV is not in BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

5-12-3 COUNTER CNT

Definer Values

N: TC number
Ladder Symbol
# (000 through 511)
CP
CNT N

R SV Operand Data Areas

SV: Set value (word, BCD)

IR, AR, DM, HR, LR, #

Limitations Each TC number can be used as the definer in only one TIMER or COUNT-
ER instruction.

Description CNT is used to count down from SV when the execution condition on the
count pulse, CP, goes from OFF to ON, i.e., the present value (PV) will be
decremented by one whenever CNT is executed with an ON execution condi-
tion for CP and the execution condition was OFF for the last execution. If the
execution condition has not changed or has changed from ON to OFF, the
PV of CNT will not be changed. The Completion Flag for a counter is turned
ON when the PV reaches zero and will remain ON until the counter is reset.

CNT is reset with a reset input, R. When R goes from OFF to ON, the PV is
reset to SV. The PV will not be decremented while R is ON. Counting down
from SV will begin again when R goes OFF. The PV for CNT will not be reset
in interlocked program sections or by power interruptions.

Changes in execution conditions, the Completion Flag, and the PV are illus-
trated below. PV line height is meant only to indicate changes in the PV.

118
Timer and Counter Instructions Section 5-12

Execution condition ON
on count pulse (CP) OFF

Execution condition ON
on reset (R) OFF

ON
Completion Flag OFF

SV SV
PV SV 1 0002

SV 2 0001
0000

Precautions Program execution will continue even if a non-BCD SV is used, but the SV
will not be correct.

Flags ER: SV is not in BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

Example 1: In the following example, the PV will be decremented whenever both 00000
Basic Application and 00001 are ON provided that 00002 is OFF and either 00000 or 00001
was OFF the last time CNT 004 was executed. When 150 pulses have been
counted down (i.e., when PV reaches zero), 00205 will be turned ON.

00000 00001
CP Address Instruction Operands
CNT 004
00002 00000 LD 00000
R
#0150 00001 AND 00001
00002 LD 00002
CNT 004
00003 CNT 0004
00205
# 0150
00004 LD CNT 004
00005 OUT 00205

Here, 00000 can be used to control when CNT is operative and 00001 can
be used as the bit whose OFF to ON changes are being counted.
The above CNT can be modified to restart from SV each time power is
turned ON to the PC. This is done by using the First Cycle Flag in the SR
area (25315) to reset CNT as shown below.

00000 00001
CP Address Instruction Operands
CNT 004
00002 00000 LD 00000
R
#0150 00001 AND 00001
25315 00002 LD 00002
00003 OR 25315
00004 CNT 004
CNT 004
00205 # 0150
00005 LD CNT 004
00006 OUT 00205

Example 2: Counters that can count past 9,999 can be programmed by using one CNT to
Extended Counter count the number of times another CNT has counted to zero from SV.

119
Timer and Counter Instructions Section 5-12

In the following example, 00000 is used to control when CNT 001 operates.
CNT 001, when 00000 is ON, counts down the number of OFF to ON
changes in 00001. CNT 001 is reset by its Completion Flag, i.e., it starts
counting again as soon as its PV reaches zero. CNT 002 counts the number
of times the Completion Flag for CNT 001 goes ON. Bit 00002 serves as a
reset for the entire extended counter, resetting both CNT 001 and CNT 002
when it is OFF. The Completion Flag for CNT 002 is also used to reset CNT
001 to inhibit CNT 001 operation, once SV for CNT 002 has been reached,
until the entire extended counter is reset via 00002.

Because in this example the SV for CNT 001 is 100 and the SV for CNT 002
is 200, the Completion Flag for CNT 002 turns ON when 100 x 200 or 20,000
OFF to ON changes have been counted in 00001. This would result in 00203
being turned ON.

00000 00001
CP Address Instruction Operands
CNT 001
00000 LD 00000
00002 #0100 00001 AND 00001
R
00002 LD NOT 00002
CNT 001
00003 OR CNT 001
00004 OR CNT 002
00005 CNT 001
CNT 002 # 0100
00006 LD CNT 001
CNT 001
00007 LD NOT 00002
CP
00008 CNT 002
CNT 002
# 0200
00002 #0200 00009 LD CNT 002
R
00010 OUT 00203
CNT 002
00203

CNT can be used in sequence as many times as required to produce count-


ers capable of counting any desired values.

Example 3: CNT can be used to create extended timers in two ways: by combining TIM
Extended Timers with CNT and by counting SR area clock pulse bits.

In the following example, CNT 002 counts the number of times TIM 001
reaches zero from its SV. The Completion Flag for TIM 001 is used to reset
TIM 001 so that it runs continuously and CNT 002 counts the number of
times the Completion Flag for TIM 001 goes ON (CNT 002 would be exe-
cuted once each time between when the Completion Flag for TIM 001 goes
ON and TIM 001 is reset by its Completion Flag). TIM 001 is also reset by
the Completion Flag for CNT 002 so that the extended timer would not start
again until CNT 002 was reset by 00001, which serves as the reset for the
entire extended timer.

Because in this example the SV for TIM 001 is 5.0 seconds and the SV for
CNT 002 is 100, the Completion Flag for CNT 002 turns ON when 5 seconds
x 100 times, i.e., 500 seconds (or 8 minutes and 20 seconds) have expired.
This would result in 00201 being turned ON.

120
Timer and Counter Instructions Section 5-12

00000 TIM 001 CNT 002


TIM 001
Address Instruction Operands
#0050 005.0 s 00000 LD 00000
TIM 001 00001 AND NOT TIM 001
CP
00002 AND NOT CNT 002
CNT
002 00003 TIM 001
00001
# 0050
#0100
R 00004 LD TIM 001
CNT 002 00005 LD 00001
00201 00006 CNT 002
# 0100
00007 LD CNT 002
00008 OUT 00201

In the following example, CNT 001 counts the number of times the 1-second
clock pulse bit (25502) goes from OFF to ON. Here again, 00000 is used to
control the times when CNT is operating.
Because in this example the SV for CNT 001 is 700, the Completion Flag for
CNT 002 turns ON when 1 second x 700 times, or 11 minutes and 40 sec-
onds have expired. This would result in 00202 being turned ON.

00000 25502
CP Address Instruction Operands
CNT
001 00000 LD 00000
00001 00001 AND 25502
R
#0700
00002 LD NOT 00001
CNT 001
00003 CNT 001
0202 # 0700
00004 LD CNT 001
00005 OUT 00202

Caution The shorter clock pulses will not necessarily produce accurate timers be-
cause their short ON times might not be read accurately during longer cycles.
In particular, the 0.02-second and 0.1-second clock pulses should not be
used to create timers with CNT instructions.

5-12-4 REVERSIBLE COUNTER CNTR(12)


Definer Values

N: TC number
Ladder Symbol
# (000 through 511)
II
CNTR(12)
DI N
Operand Data Areas
SV
R
SV: Set value (word, BCD)

IR, AR, DM, HR, LR, #

Limitations Each TC number can be used as the definer in only one TIMER or COUNT-
ER instruction.
Description The CNTR(12) is a reversible, up/down circular counter, i.e., it is used to
count between zero and SV according to changes in two execution condi-
tions, those in the increment input (II) and those in the decrement input (DI).

121
Timer and Counter Instructions Section 5-12

The present value (PV) will be incremented by one whenever CNTR(12) is


executed with an ON execution condition for II and the last execution condi-
tion for II was OFF. The present value (PV) will be decremented by one
whenever CNTR(12) is executed with an ON execution condition for DI and
the last execution condition for DI was OFF. If OFF to ON changes have oc-
curred in both II and DI since the last execution, the PV will not be changed.
If the execution conditions have not changed or have changed from ON to
OFF for both II and DI, the PV of CNT will not be changed.
When decremented from 0000, the present value is set to SV and the Com-
pletion Flag is turned ON until the PV is decremented again. When incre-
mented past the SV, the PV is set to 0000 and the Completion Flag is turned
ON until the PV is incremented again. CNTR(12) is reset with a reset input,
R. When R goes from OFF to ON, the PV is reset to zero. The PV will not be
incremented or decremented while R is ON. Counting will begin again when
R goes OFF. The PV for CNTR(12) will not be reset in interlocked program
sections or by the effects of power interruptions.
Changes in II and DI execution conditions, the Completion Flag, and the PV
are illustrated below starting from part way through CNTR(12) operation (i.e.,
when reset, counting begins from zero). PV line height is meant to indicate
changes in the PV only.

Execution condition ON
on increment (II) OFF

Execution condition ON
on decrement (DI) OFF

ON
Completion Flag OFF

SV SV
PV SV 1 SV 1
0001
SV 2 SV 2
0000 0000

Precautions Program execution will continue even if a non-BCD SV is used, but the SV
will not be correct.

Flags ER: SV is not in BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

122
Data Shifting Section 5-13

5-13 Data Shifting


All of the instructions described in this section are used to shift data, but in
differing amounts and directions. The first shift instruction, SFT(10), shifts an
execution condition into a shift register; the rest of the instructions shift data
that is already in memory.

5-13-1 SHIFT REGISTER SFT(10)


Ladder Symbol Operand Data Areas
I St: Starting word
SFT(10)
P IR, AR, HR, LR
St

R E: End word
E

IR, AR, HR, LR

Limitations E must be greater than or equal to St, and St and E must be in the same
data area.
If a bit address in one of the words used in a shift register is also used in an
instruction that controls individual bit status (e.g., OUT, KEEP(11)), an error
(COIL DUPL) will be generated when program syntax is checked on the
Programming Console or another Programming Device. The program, how-
ever, will be executed as written. See Example 2: Controlling Bits in Shift
Registers for a programming example that does this.

Description SFT(10) is controlled by three execution conditions, I, P, and R. If SFT(10) is


executed and 1) execution condition P is ON and was OFF the last execu-
tion, and 2) R is OFF, then execution condition I is shifted into the rightmost
bit of a shift register defined between St and E, i.e., if I is ON, a 1 is shifted
into the register; if I is OFF, a 0 is shifted in. When I is shifted into the regis-
ter, all bits previously in the register are shifted to the left and the leftmost bit
of the register is lost.

E St+1, St+2, ... St

Lost
data Execution
condition I

The execution condition on P functions like a differentiated instruction, i.e., I


will be shifted into the register only when P is ON and was OFF the last time
SFT(10) was executed. If execution condition P has not changed or has gone
from ON to OFF, the shift register will remain unaffected.
St designates the rightmost word of the shift register; E designates the left-
most. The shift register includes both of these words and all words between
them. The same word may be designated for St and E to create a 16-bit (i.e.,
1-word) shift register.
When execution condition R goes ON, all bits in the shift register will be
turned OFF (i.e., set to 0) and the shift register will not operate until R goes
OFF again.

Flags There are no flags affected by SFT(10).

123
Data Shifting Section 5-13

Example 1: The following example uses the 1-second clock pulse bit (25502) so that the
Basic Application execution condition produced by 00005 is shifted into a 3-word register be-
tween IR 010 and IR 012 every second.

00005
I Address Instruction Operands
SFT(10)
25502 00000 LD 00005
P
010 00001 LD 25502
00006 00002 LD 00006
R
012
00003 SFT(10)
010
012

Example 2: The following program is used to control the status of the 17th bit of a shift
Controlling Bits in Shift register running from AR 00 through AR 01. When the 17th bit is to be set,
Registers 00004 is turned ON. This causes the jump for JMP(04) 00 not to be made for
that one cycle, and AR 0100 (the 17th bit) will be turned ON. When 12800 is
OFF (i.e., at all times except during the first cycle after 00004 has changed
from OFF to ON), the jump is executed and the status of AR 0100 will not be
changed.

00200 00201
I Address Instruction Operands

SFT(10) 00000 LD 00200


00202 00001 AND 00201
P
AR 00
00002 LD 00202
00203 AR 01 00003 LD 00203
R
00004 SFT(10)
AR 00
00004 AR 01
DIFU(13) 12800
00005 LD 00004
12800 00006 DIFU(13) 12800
JMP(04) 00 00007 LD 12800
00008 JMP(04) 00
12800
00009 LD 12800
AR 0100
00010 OUT AR 0100
00011 JME(05) 00
JME(05) 00

When a bit that is part of a shift register is used in OUT (or any other instruc-
tion that controls bit status), a syntax error will be generated during the pro-
gram check, but the program will executed properly (i.e., as written).

Example 3: The following program controls the conveyor line shown below so that faulty
Control Action products detected at the sensor are pushed down a shoot. To do this, the
execution condition determined by inputs from the first sensor (00001) are
stored in a shift register: ON for good products; OFF for faulty ones. Con-
veyor speed has been adjusted so that HR 0003 of the shift register can be
used to activate a pusher (00500) when a faulty product reaches it, i.e., when
HR 0003 turns ON, 00500 is turned ON to activate the pusher.
The program is set up so that a rotary encoder (00000) controls execution of
SFT(10) through a DIFU(13), the rotary encoder is set up to turn ON and
OFF each time a product passes the first sensor. Another sensor (00002) is

124
Data Shifting Section 5-13

used to detect faulty products in the shoot so that the pusher output and HR
0003 of the shift register can be reset as required.

Sensor
(00001)
Pusher
(00500)

Sensor
Rotary Encoder (00002)
(00000)
Chute

00001 Address Instruction Operands


I
SFT(10) 00000 LD 00001
00000
P 00001 LD 00000
HR 00
00003 00002 LD 00003
R
HR 01 00003 SFT(10)
HR 00
HR 01
HR 0003
00500 00004 LD HR 0003
00005 OUT 00500
00006 LD 00002
00002
00500
00007 OUT NOT 00500
00008 OUT NOT HR 0003

HR 0003

5-13-2 REVERSIBLE SHIFT REGISTER SFTR(84)

Operand Data Areas

Ladder Symbols C: Control word

IR, AR, DM, HR, LR


SFTR(84) @SFTR(84)
St: Starting word
C C
IR, AR, DM, HR, LR
St St
E: End word
E E
IR, AR, DM, HR LR

Limitations St and E must be in the same data area and St must be less than or equal
to E.

Description SFTR(84) is used to create a single- or multiple-word shift register that can
shift data to either the right or the left. To create a single-word register, desig-
nate the same word for St and E. The control word provides the shift direc-

125
Data Shifting Section 5-13

tion, the status to be put into the register, the shift pulse, and the reset input.
The control word is allocated as follows:

15 14 13 12 Not used.

Shift direction
1 (ON): Left (LSB to MSB)
0 (OFF): Right (MSB to LSB)

Status to input into register

Shift pulse bit

Reset

The data in the shift register will be shifted one bit in the direction indicated
by bit 12, shifting one bit out to CY and the status of bit 13 into the other end
whenever SFTR(84) is executed with an ON execution condition as long as
the reset bit is OFF and as long as bit 14 is ON. If SFTR(84) is executed with
an OFF execution condition or if SFTR(84) is executed with bit 14 OFF, the
shift register will remain unchanged. If SFTR(84) is executed with an ON
execution condition and the reset bit (bit 15) is OFF, the entire shift register
and CY will be set to zero.

Flags ER: St and E are not in the same data area or ST is greater than E.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

CY: Receives the status of bit 00 of St or bit 15 of E, depending on the


shift direction.

Example In the following example, IR 00005, IR 00006, IR 00007, and IR 00008 are
used to control the bits of C used in @SHIFT(84). The shift register is be-
tween LR 20 and LR 21, and it is controlled through IR 00009.

00005
Address Instruction Operands
05012 Direction
00000 LD 00005
00001 OUT 05012
00006 00002 LD 00006
05013 Status to input 00003 OUT 05013
00004 LD 00007
00005 OUT 00514
00007
Shift pulse
00006 LD 00008
05014
00007 OUT 05015
00008 LD 00009
00008 00009 @SFT(10)
05015 Reset 050
LR 20
00009 LR 21
@SFTR(84)
050
LR 20

LR 21

126
Data Shifting Section 5-13

5-13-3 ARITHMETIC SHIFT LEFT ASL(25)

Ladder Symbols Operand Data Areas

Wd: Shift word


ASL(25) @ASL(25)
IR, AR, DM, HR, LR
Wd Wd

Description When the execution condition is OFF, ASL(25) is not executed. When the
execution condition is ON, ASL(25) shifts a 0 into bit 00 of Wd, shifts the bits
of Wd one bit to the left, and shifts the status of bit 15 into CY.

Bit Bit
CY 15 00
1 0 0 1 1 1 0 0 0 1 0 1 0 0 1 1
0

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
CY: Receives the status of bit 15.
EQ: ON when the content of Wd is zero; otherwise OFF.

5-13-4 ARITHMETIC SHIFT RIGHT ASR(26)

Ladder Symbols Operand Data Areas

Wd: Shift word


ASR(26) @ASR(26)
IR, AR, DM, HR, LR
Wd Wd

Description When the execution condition is OFF, ASR(25) is not executed. When the
execution condition is ON, ASR(25) shifts a 0 into bit 15 of Wd, shifts the bits
of Wd one bit to the right, and shifts the status of bit 00 into CY.

Bit Bit
15 00 CY
1 1 0 0 1 0 1 1 0 0 1 1 0 0 1 0
0

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
CY: Receives the data of bit 00.
EQ: ON when the content of Wd is zero; otherwise OFF.

127
Data Shifting Section 5-13

5-13-5 ROTATE LEFT ROL(27)

Ladder Symbols Operand Data Areas

Wd: Rotate word


ROL(27) @ROL(27)
IR, AR, DM, HR, LR
Wd Wd

Description When the execution condition is OFF, ROL(27) is not executed. When the
execution condition is ON, ROL(27) shifts all Wd bits one bit to the left, shift-
ing CY into bit 00 of Wd and shifting bit 15 of Wd into CY.

Bit Bit
CY 15 00
0 1 0 1 1 0 0 1 1 1 0 0 0 1 1 0 1

Precautions Use STC(41) to set the status of CY or CLC(41) to clear the status of CY be-
fore doing a rotate operation to ensure that CY contains the proper status
before execution ROL(27).

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
CY: Receives the data of bit 15.
EQ: ON when the content of Wd is zero; otherwise OFF.

5-13-6 ROTATE RIGHT ROR(28)

Ladder Symbols Operand Data Areas

Wd: Rotate word


ROR(28) @ROR(28)
IR, AR, DM, HR, LR
Wd Wd

Description When the execution condition is OFF, ROR(28) is not executed. When the
execution condition is ON, ROR(28) shifts all Wd bits one bit to the right,
shifting CY into bit 15 of Wd and shifting bit 00 of Wd into CY.

Bit Bit
CY 15 00
0 0 1 0 1 0 1 0 0 0 1 1 1 0 0 0 1

Precautions Use STC(41) to set the status of CY or CLC(41) to clear the status of CY be-
fore doing a rotate operation to ensure that CY contains the proper status
before execution ROR(28).

128
Data Shifting Section 5-13

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
CY: Receives the data of bit 15.
EQ: ON when the content of Wd is zero; otherwise OFF.

5-13-7 ONE DIGIT SHIFT LEFT SLD(74)

Ladder Symbols Operand Data Areas


St: Starting word
SLD(74) @SLD(74)
IR, AR, DM, HR, LR
St St
E: End word
E E
IR, AR, DM, HR, LR

Limitations St and E must be in the same data area, and E must be greater than or equal
to St.

Description When the execution condition is OFF, SLD(74) is not executed. When the
execution condition is ON, SLD(74) shifts data between St and E (inclusive)
by one digit (four bits) to the left. 0 is written into the rightmost digit of the St,
and the content of the leftmost digit of E is lost.

E ... St
8 F C 5 D 7 9 1

Lost data 0

Precautions If a power failure occurs during a shift operation across more than 50 words,
the shift operation might not be completed.

Flags ER: The St and E words are in different areas, or St is greater than E.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

5-13-8 ONE DIGIT SHIFT RIGHT SRD(75)

Ladder Symbols Operand Data Areas


E: End word
SRD(75) @SRD(75)
IR, AR, DM, HR, LR
E E
St: Starting word
St St
IR, AR, DM, HR, LR

129
Data Shifting Section 5-13

Limitations St and E must be in the same data area, and E must be less than or equal to
St.

Description When the execution condition is OFF, SRD(75) is not executed. When the
execution condition is ON, SRD(75) shifts data between St and E (inclusive)
by one digit (four bits) to the right. 0 is written into the leftmost digit of St and
the rightmost digit of E is lost.

St E
...
3 4 5 2 F 8 C 1

0 Lost data

Precautions If a power failure occurs during a shift operation across more than 50 words,
the shift operation might not be completed.

Flags ER: The St and E words are in different areas, or St is less than E.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

5-13-9 WORD SHIFT WSFT(16)

Ladder Symbols Operand Data Areas


St: Starting word
WSFT(16) @WSFT(16)
IR, AR, DM, HR, LR
St St
E: End word
E E
IR, AR, DM, HR, LR

Limitations St and E must be in the same data area, and E must be greater than or equal
to St.

Description When the execution condition is OFF, WSFT(16) is not executed. When the
execution condition is ON, WSFT(16) shifts data between St and E in word
units. Zeros are written into St and the content of E is lost.

E St + 1 St

F 0 C 2 3 4 5 2 1 0 2 9

Lost

0000

E St + 1 St

3 4 5 2 1 0 2 9 0 0 0 0

Flags ER: The St and E words are in different areas, or St is greater than E.

130
Data Shifting Section 5-13

Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)

5-13-10 REVERSIBLE WORD SHIFT RWS(17)

Operand Data Areas

C: Control word
Ladder Symbols
IR, SR, AR, DM, HR, TC, LR, #
RWS(17) RWS(17) St: Starting word
C C IR, AR, DM, HR, LR
St St
E: End word
E E IR, AR, DM, HR, LR

Limitations Can be performed with the CPU11-E only. St and E must be in the same data
area, and E must be less than or equal to St.

Description When the execution condition is OFF, RWS(17) does nothing and the pro-
gram moves to the next instruction. When the execution condition is ON,
RWS(17) is used to create and control a reversible asynchronous word shift
register between St and E. This register only shifts words when the next word
in the register is zero, e.g., if no words in the register contain zero, nothing is
shifted. Also, only one word is shifted for each word in the register that con-
tains zero. When the contents of a word are shifted to the next word, the orig-
inal words contents are set to zero. In essence, when the register is shifted,
each zero word in the register trades places with the next word. (See Exam-
ple below.)

The shift direction (i.e. whether the next word is the next higher or the next
lower word) is designated in C. C is also used to reset the register. All of any
portion of the register can be reset by designating the desired portion with St
and E.

Control Word Bits 00 through 12 of C are not used. Bit 13 is the shift direction: turn bit 13
ON to shift down (toward lower addressed words) and OFF to shift up (to-
ward higher addressed words). Bit 14 is the Shift Enable Bit: turn bit 14 ON to
enable shift register operation according to bit 13 and OFF to disable the reg-
ister. Bit 15 is the Reset bit: the register will be reset (set to zero) between St
and E when RWS(17) is executed with bit 15 ON. Turn bit 15 OFF for normal
operation.

Flags ER: The St and E words are in different areas, or St is greater than E.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

Example The following example shows instruction RWS(17) used to shift words in an
11-word shift register created between DM 0100 and DM 0110 assuming that
HR 1215 (the Reset Bit in the control word) is ON, the entire register would

131
Data Movement Section 5-14

be set to 0000. The data changes that would occur for the given register and
control word contents are also shown.

Before After
execution execution

HR 1213: OFF (Shift upward) DM 0100 1234 0000


HR 1214: ON (Shift enabled) DM 0101 0000 1234
HR 1215: OFF (Reset OFF) DM 0102 0000 0000
DM 0103 2345 2345
DM 0104 3456 0000
DM 0105 0000 3456
DM 0106 4567 4567
DM 0107 5678 5678
DM 0108 6789 0000
DM 0109 0000 6789
DM 0110 789A 789A

5-14 Data Movement


This section describes the instructions used for moving data between differ-
ent addresses in data areas. These movements can be programmed to be
within the same data area or between different data areas. Data movement is
essential for utilizing all of the data areas of the PC. Effective communica-
tions in Link Systems also requires data movement. All of these instructions
change only the content of the words to which data is being moved, i.e., the
content of source words is the same before and after execution of any of the
data movement instructions.

5-14-1 MOVE MOV(21)


Ladder Symbols Operand Data Areas
S: Source word
MOV(21) @MOV(21)
IR, SR, AR, DM, HR, TC, LR, #
S S
D: Destination word
D D
IR, AR, DM, HR, LR

Description When the execution condition is OFF, MOV(21) is not executed. When the
execution condition is ON, MOV(21) copies the content of S to D.

Source word Destination word

Bit status
not changed.

Precautions TC numbers cannot be designated as D to change the PV of the timer or


counter. You can, however, easily change the PV of a timer or a counter by
using BSET(71).

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)

132
Data Movement Section 5-14

EQ: ON when all zeros are transferred to D.

5-14-2 MOVE NOT MVN(22)


Ladder Symbols Operand Data Areas
S: Source word
MVN(22) @MVN(22)
IR, SR, AR, DM, HR, TC, LR, #
S S
D: Destination word
D D
IR, AR, DM, HR, LR

Description When the execution condition is OFF, MVN(22) is not executed. When the
execution condition is ON, MVN(22) transfers the inverted content of S
(specified word or four-digit hexadecimal constant) to D, i.e., for each ON bit
in S, the corresponding bit in D is turned OFF, and for each OFF bit in S, the
corresponding bit in D is turned ON.

Source word Destination word

Bit status
inverted.

Precautions TC numbers cannot be designated as D to change the PV of the timer or


counter. However, these can be easily changed using BSET(71).

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when all zeros are transferred to D.

5-14-3 COLUMN-TO-WORD CTW(63)

Operand Data Areas

Ladder Symbols S: First word of 16 word source set

IR, SR, AR, DM, HR, LR


CTW(63) @CTW(63)
C: Column bit designator (BCD)
S S
IR, AR, DM, HR, TC, LR, #
C C
D: Destination word
D D
IR, AR, DM, HR, LR

Limitations Can be performed with the CPU11-E only. C must be between #0000 and
#0015.

Description When the execution condition is OFF, CTW(63) is not executed. When the
execution condition is ON, CTW(63) copies bit column C from the 16-word
set (S to S+15) to the 16 bits of word D (00 to 15).

133
Data Movement Section 5-14

Bit
C Bit
15 00
S 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 1
S+1 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1
S+2 0 0 0 1 1 0 1 1 0 0 1 0 0 1 1 1
S+3 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1
. . . .
. . . .
. . . .
S+15 0 1 1 1 0 0 0 1 1 0 0 0 1 0 1 0 Bit Bit
15 00

D 0 . . . 0 1 1 1

Flags ER: The column bit designator C is not BCD, or it is specifying a non-ex-
istent bit (i.e., bit specification must be between 00 and 15).
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

EQ: ON when the content of D is zero; otherwise OFF.

Example The following example shows how to use CTW(63) to move bit column 07
from the set (IR 100 to IR 115) to DM 0100.

00000
Address Instruction Operands
CTW(63)
100 00000 LD 00000
#0007
00001 CTW(63)
DM 0100
100
# 0007
DM 0100

5-14-4 WORD-TO-COLUMN WTC(64)

Operand Data Areas

Ladder Symbols S: Source word

IR, SR, AR, DM, HR, LR


WTC(64) @WTC(64)
D: First word of the destination set
S S
IR, AR, DM, HR, LR
D D
C: Column bit designator (BCD)
C C
IR, AR, DM, HR, TC, LR, #

Limitations Can be performed with the CPU11-E only. C must be between 00 and 15.

Description When the execution condition is OFF, WTC(64) is not executed. When the
execution condition is ON, WTC(64) copies the 16 bits of word S (00 to 15) to
the column of bits, C, of the 16-word set (D to D+15).

134
Data Movement Section 5-14

Bit Bit
15 00

S 0 . . . . . . . 0 1 1 1

Bit C Bit
15 00
D 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 1
D+1 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1
D+2 0 0 0 1 1 0 1 1 0 0 1 0 0 1 1 1
D+3 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1
. . . .
. . . .
. . . .
D+15 0 1 1 1 0 0 0 1 1 0 0 0 1 0 1 0

Flags ER: The bit designator C is not BCD, or it is specifying a non-existent bit
(i.e., bit specification must be between 00 and 15).
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the content of S is zero; otherwise OFF.

Example The following example shows how to use WTC(64) to move the contents of
word DM 0100 (00 to 15) to bit column 15 of the set (DM 0200 to DM 0215).

00000
WTC(64)
Address Instruction Operands
DM 0100 00000 LD 00000
DM 0200 00001 WTC(64)
#0015 DM 0100
DM 0200
# 0015

5-14-5 BLOCK SET BSET(71)


Operand Data Areas

Ladder Symbols S: Source data

IR, SR, AR, DM, HR, TC, LR, #


BSET(71) @BSET(71)
St: Starting word
S S
IR, AR, DM, HR, TC, LR
St St
E: End Word
E E
IR, AR, DM, HR, TC, LR

Limitations St must be less than or equal to E, and St and E must be in the same data
area.

Description When the execution condition is OFF, BSET(71) is not executed. When the
execution condition is ON, BSET(71) copies the content of S to all words
from St through E.

135
Data Movement Section 5-14

S St
3 4 5 2 3 4 5 2

St+1
3 4 5 2

St+2
3 4 5 2

E
3 4 5 2

BSET(71) can be used to change timer/counter PV. (This cannot be done


with MOV(21) or MVN(22).) BSET(71) can also be used to clear sections of a
data area, i.e., the DM area, to prepare for executing other instructions.

Flags ER: St and E are not in the same data area or St is greater than E.

Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)

Example The following example shows how to use BSET(71) to change the PV of a
timer depending on the status of IR 00003 and IR 00004. When IR 00003 is
ON, TIM 010 will operate as a 50-second timer; when IR 00004 is ON, TIM
010 will operate as a 30-second timer.

00003 00004 Address Instruction Operands


@BSET(71)
00000 LD 00003
#0500
00001 AND NOT 00004
TIM 010
00002 @BSET(71)
TIM 010
# 0500
00004 00003 TIM 010
@BSET(71)
TIM 010
#0300
00003 LD 00004
TIM 010 00004 AND NOT 00003
TIM 010 00005 @BSET(71)
# 0300
00003 TIM 010
TIM 010
TIM 010
00004 #9999
00006 LD 00003
00007 OR 00004
00008 TIM 010
# 9999

136
Data Movement Section 5-14

5-14-6 BLOCK TRANSFER XFER(70)

Operand Data Areas

Ladder Symbols N: Number of words (BCD)

IR, SR, AR, DM, HR, TC, LR, #


XFER(70) @XFER(70)
S: Starting source word
N N
IR, SR, AR, DM, HR, TC, LR
S S
D: Starting destination word
D D
IR, AR, DM, HR, TC, LR

Limitations Both S and D may be in the same data area, but their respective block areas
must not overlap. S and S+N must be in the same data area, as must D and
D+N.

Description When the execution condition is OFF, XFER(70) is not executed. When the
execution condition is ON, XFER(70) copies the contents of S, S+1, ..., S+N
to D, D+1, ..., D+N.

S D
3 4 5 2 3 4 5 2

S+1 D+1
3 4 5 1 3 4 5 1

S+2 D+2
3 4 2 2 3 4 2 2

S+N D+N
6 4 5 2 6 4 5 2

Flags ER: N is not BCD


S and S+N or D and D+N are not in the same data area.

Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)

5-14-7 DATA EXCHANGE XCHG(73)

Ladder Symbols Operand Data Areas


E1: Exchange word 1
XCHG(73) @XCHG(73)
IR, AR, DM, HR, TC, LR
E1 E1
E2: Exchange word 2
E2 E2
IR, AR, DM, HR, TC, LR

137
Data Movement Section 5-14

Description When the execution condition is OFF, XCHG(73) is not executed. When the
execution condition is ON, XCHG(73) exchanges the content of E1 and E2.

E1 E2

If you want to exchange content of blocks whose size is greater than 1 word,
use work words as an intermediate buffer to hold one of the blocks using
XFER(70) three times.

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)

5-14-8 SINGLE WORD DISTRIBUTE DIST(80)


Operand Data Areas

Ladder Symbols S: Source data

IR, SR, AR, DM, HR, TC, LR, #


DIST(80) @DIST(80)
DBs: Destination base word
S S
IR, AR, DM, HR, TC, LR
DBs DBs
Of: Offset data (BCD)
Of Of
IR, AR, DM, HR, TC, LR, #

Limitations Of must be a BCD. DBs must be in the same data area as DBs+Of.

Description When the execution condition is OFF, DIST(80) is not executed. When the
execution condition is ON, DIST(80) copies the content of S to DBs+Of,
i.e.,Of is added to DBs to determine the destination word.

S DBs + Of
3 4 5 2 3 4 5 2

Flags ER: The specified offset data is not BCD, or when added to the DBs, the
resulting address lies outside the data area of the DBs.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the content of S is zero; otherwise OFF.

5-14-9 DATA COLLECT COLL(81)


Operand Data Areas

Ladder Symbols SBs: Source base word

IR, SR, AR, DM, HR, TC, LR


COLL(81) @COLL(81)
Of: Offset data (BCD)
SBs SBs
IR, AR, DM, HR, TC, LR, #
Of Of
D: Destination word
D D
IR, AR, DM, HR, TC, LR

138
Data Movement Section 5-14

Limitations Of must be a BCD. SBs must be in the same data area as SBs+Of.

Description When the execution condition is OFF, COLL(81) is not executed. When the
execution condition is ON, COLL(81) copies the content of SBs + Of to D,
i.e., Of is added to SBs to determine the source word.

SBs + Of D
3 4 5 2 3 4 5 2

Flags ER: Of is not BCD, or when added to the SBs, or when added to the SBs,
the resulting address lies outside the data area of the SBs.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the content of S is zero; otherwise OFF.

5-14-10 MOVE BIT MOVB(82)


Operand Data Areas

Ladder Symbols S: Source word

IR, SR, AR, DM, HR, LR, #


MOVB(82) @MOVB(82)
Bi: Bit designator (BCD)
S S
IR, AR, DM, HR, TC, LR, #
Bi Bi
D: Destination word
D D
IR, AR, DM, HR, LR

Limitations The rightmost two digits and the leftmost two digits of Bi must each be be-
tween 00 and 15.

Description When the execution condition is OFF, MOVB(82) is not executed. When the
execution condition is ON, MOVB(82) copies the specified bit of S to the spe-
cified bit in D. The bits in S and D are specified by Bi. The rightmost two dig-
its of Bi designate the source bit; the leftmost two bits designate the destina-
tion bit.

Bit Bit
15 00
Bi 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1
Bi
Bit 1 2 0 1 Bit
MSB 1 2 0 1 LSB
15 00
S 0 1 0 1 0 1 0 0 0 1 1 1 0 0 0 1
Source bit (00 to 15)
Bit Bit
Destination bit (00 to 15) 15 00
D 0 1 0 0 0 1 0 0 0 1 1 1 0 0 0 1

Flags ER: C is not BCD, or it is specifying a non-existent bit (i.e., bit specifica-
tion must be between 00 and 15).
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

139
Data Movement Section 5-14

5-14-11 MOVE DIGIT MOVD(83)


Operand Data Areas

Ladder Symbols S: Source word

IR, SR, AR, DM, HR, TC, LR, #


MOVD(83) @MOVD(83)
Di: Digit designator (BCD)
S S
IR, AR, DM, HR, TC, LR, #
Di Di
D: Destination word
D D
IR, AR, DM, HR, TC, LR

Limitations The rightmost three digits of Di must each be between 0 and 3.


Description When the execution condition is OFF, MOVD(83) is not executed. When the
execution condition is ON, MOVD(83) copies the content of the specified
digit(s) in S to the specified digit(s) in D. Up to four digits can be transferred
at one time. The first digit to be copied, the number of digits to be copied,
and the first digit to receive the copy are designated in Di as shown below.
Digits from S will be copied to consecutive digits in D starting from the desig-
nated first digit and continued for the designated number of digits. If the last
digit is reached in either S or D, further digits are used starting back at digit 0.

Digit number: 3 2 1 0

First digit in S (0 to 3)

Number of digits (0 to 3)
0: 1 digit
1: 2 digits
2: 3 digits
3: 4 digits
First digit in D (0 to 3)

Not used.

Digit Designator The following show examples of the data movements for various values of
Di.

Di: 0010 Di: 0030


S D S D

0 0 0 0
1 1 1 1
2 2 2 2
3 3 3 3

Di: 0031 Di: 0023


S D S D
0 0 0 0
1 1 1 1
2 2 2 2
3 3 3 3

Flags ER: At least one of the rightmost three digits of Di is not between 0 and 3.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

140
Data Comparison Section 5-15

5-15 Data Comparison


This section describes the instructions used for comparing data. CMP(20) is
used to compare the contents of two words; BCMP(68) is used to determine
within which of several preset ranges the content of one word lies; and
TCMP(85) is used to determine which of several preset values the content of
one word equals.

5-15-1 MULTI-WORD COMPARE MCMP(19)

Operand Data Areas

Ladder Symbols TB1: First word of table 1

IR, SR, AR, DM, HR, TC, LR


MCMP(19) @MCMP(19)
TB2: First word of table 2
TB1 TB1
IR, SR, AR, DM, HR, TC, LR
TB2 TB2
R: Result word
R R
IR, AR, DM, HR, TC, LR

Limitations Can be performed with the CPU11-E only.

Description When the execution condition is OFF, MCMP(19) is not executed. When the
execution condition is ON, MCMP(19) compares the content of TB1 to TB2,
TB1+1 to TB2+1, TB1+2 to TB2+2, ..., and TB1+15 to TB2+15. If the first pair
is equal, the first bit in R is turned OFF, etc., i.e., if the content of TB1 equals
the content of TB2, bit 00 is turned OFF, if the content of TB1+1 equals the
content of TB2+1, bit 01 is turned OFF, etc. The rest of the bits in R will be
turned ON.

Flags ER: One of the tables (i.e., TB1 through TB1+15, or TB2 through
TB2+15) exceeds the data area.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

141
Data Comparison Section 5-15

Example The following example shows the comparisons made and the results pro-
vided for MCMP(19). Here, the comparison is made during each cycle when
00000 is ON.

00000
MCMP(19)
Address Instruction Operands
100 00000 LD 00000
DM 0200 00001 MCMP(19)
DM 0300 100
DM 0200
DM 0300

TB1: IR 100 TB2: DM 0200 R: DM 0300

IR 100 0100 DM 0200 0100 DM 030000 0


IR 101 0200 DM 0201 0200 DM 030001 0
IR 102 0210 DM 0202 0210 DM 030002 0
IR 103 ABCD DM 0203 0400 DM 030003 1
IR 104 ABCD DM 0204 0500 DM 030004 1
IR 105 ABCD DM 0205 0600 DM 030005 1
IR 106 ABCD DM 0206 0210 DM 030006 1
IR 107 0800 DM 0207 0800 DM 030007 0
IR 108 0900 DM 0208 0900 DM 030008 0
IR 109 1000 DM 0209 1000 DM 030009 0
IR 110 ABCD DM 0210 0210 DM 030010 1
IR 111 ABCD DM 0211 1200 DM 030011 1
IR 112 ABCD DM 0212 1300 DM 030012 1
IR 113 1400 DM 0213 1400 DM 030013 0
IR 114 0210 DM 0214 0210 DM 030014 0
IR 115 1212 DM 0215 1600 DM 030015 1

5-15-2 COMPARE CMP(20)


Ladder Symbols Operand Data Areas
Cp1: First compare word
CMP(20)
IR, SR, AR, DM, HR, TC, TR, #
Cp1
Cp2: Second compare word
Cp2
IR, SR, AR, DM, HR, TC, LR, #

Limitations When comparing a value to the PV of a timer or counter, the value must be in
BCD.

Description When the execution condition is OFF, CMP(20) is not executed. When the
execution condition is ON, CMP(20) compares Cp1 and Cp2 and outputs the
result to the GR, EQ, and LE flags in the SR area.

Precautions Placing other instructions between CMP(20) and the operation which ac-
cesses the EQ, LE, and GR flags may change the status of these flags. Be
sure to access them before the desired status is changed.

142
Data Comparison Section 5-15

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
EQ: ON if Cp1 equals Cp2.
LE: ON if Cp1 is less than Cp2.
GR: ON if Cp1 is greater than Cp2.

Flag Address C1 < C2 C1 = C2 C1 > C2


GR 25505 OFF OFF ON
EQ 25506 OFF ON OFF
LE 25507 ON OFF OFF

Example 1: The following example shows how to save the comparison result immedi-
Saving CMP(20) Results ately. If the content of HR 09 is greater than that of 010, 00200 is turned ON;
if the two contents are equal, 00201 is turned ON; if content of HR 09 is less
than that of 010, 00202 is turned ON. In some applications, only one of the
three OUTs would be necessary, making the use of TR 0 unnecessary. With
this type of programming, 00200, 00201, and 00202 are changed only when
CMP(20) is executed.

TR
0
00000
CMP(20)

HR 09

010

25505
00200 Greater Than

25506
00201 Equal

25507
00202 Less Than

Address Instruction Operands Address Instruction Operands

00000 LD 00000 00005 OUT 00200


00001 OUT TR 0 00006 LD TR 0
00002 CMP(20) 00007 AND 25506
010 00008 OUT 00201
HR 09 00009 LD TR 0
00003 LD TR 0 00010 AND 25507
00004 AND 25505 00011 OUT 00202

Example 2: The following example uses TIM, CMP(20), and the LE flag (25507) to pro-
Obtaining Indications duce outputs at particular times in the timers countdown. The timer is started
during Timer Operation by turning ON 00000. When 00000 is OFF, TIM 010 is reset and the second
two CMP(20)s are not executed (i.e., executed with OFF execution condi-
tions). Output 00200 is produced after 100 seconds; output 00201, after 200
seconds; output 00202, after 300 seconds; and output 00204, after 500 sec-
onds.
The branching structure of this diagram is important in order to ensure that
00200, 00201, and 00202 are controlled properly as the timer counts down.

143
Data Comparison Section 5-15

Because all of the comparisons here use to the timers PV as reference, the
other operand for each CMP(20) must be in 4-digit BCD.

00000
TIM 010
#5000 500.0 s

CMP(20)

TIM 010

#4000

25507
00200 Output at
100 s.
00200
CMP(20)

TIM 010

#3000

25507
00201 Output at
200 s.

00201
CMP(20)

TIM 010

#2000

25507
Output at
00202
300 s.

TIM 010
00204 Output at
500 s.

Address Instruction Operands Address Instruction Operands

00000 LD 00000 00007 AND 25507


00001 TIM 010 00008 OUT 00201
# 5000 00009 LD 00201
00002 CMP(20) 00010 CMP(20)
TIM 010 TIM 010
# 4000 # 2000
00003 AND 25507 00011 AND 25507
00004 OUT 00200 00012 OUT 00202
00005 LD 00200 00013 LD TIM 010
00006 CMP(20) 00014 OUT 00204
TIM 010
# 3000

5-15-3 DOUBLE COMPARE CMPL(60)


Ladder Symbols Operand Data Areas
Cp1: First word of first compare word pair
CMPL(60)
IR, SR, AR, DM, HR, TC, TR
Cp1
Cp2: First word of second compare word pair
Cp2
IR, SR, AR, DM, HR, TC, LR
___

144
Data Comparison Section 5-15

Limitations Can be performed with the CPU11-E only.

Description When the execution condition is OFF, CMPL(60) is not executed. When the
execution condition is ON, CMPL(60) joins the 4-digit hexadecimal content of
Cp1+1 with that of Cp1, and that of Cp2+1 with that of Cp2 to create two
8-digit hexadecimal numbers, Cp+1,Cp1 and Cp2+1,Cp2. The two 8-digit
numbers are then compared and the result is output to the GR, EQ, and LE
flags in the SR area.

Precautions Placing other instructions between CMPL(60) and the operation which ac-
cesses the EQ, LE, and GR flags may change the status of these flags. Be
sure to access them before the desired status is changed.

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
GR: ON if Cp1+1,Cp1 is greater than Cp2+1,Cp2.
EQ: ON if Cp1+1,Cp1 equals Cp2+1,Cp2.
LE: ON if Cp1+1,Cp1 is less than Cp2+1,Cp2.

Example: The following example shows how to save the comparison result immedi-
Saving CMPL(60) Results ately. If the content of HR 10, HR 09 is greater than that of 011, 010, then
00200 is turned ON; if the two contents are equal, 00201 is turned ON; if
content of HR 10, HR 09 is less than that of 011, 010, then 00202 is turned
ON. In some applications, only one of the three OUTs would be necessary,
making the use of TR 0 unnecessary. With this type of programming, 00200,
00201, and 00202 are changed only when CMPL(60) is executed.

TR
0
00000
CMPL(60)

HR 09

010

---

25505
00200 Greater Than

25506
00201 Equal

25507
00202 Less Than

Address Instruction Operands Address Instruction Operands

00000 LD 00000 00005 OUT 00200


00001 OUT TR 0 00006 LD TR 0
00002 CMPL(60) 00007 AND 25506
HR 09 00008 OUT 00201
010 00009 LD TR 0
00010 AND 25507
00003 LD TR 0 00011 OUT 00202
00004 AND 25505

145
Data Comparison Section 5-15

5-15-4 BLOCK COMPARE BCMP(68)

Operand Data Areas

Ladder Symbols CD: Compare data

IR, SR, DM, HR, TC, LR, #


BCMP(68) @BCMP(68)
CB: First comparison block word
CD CD
IR, SR, DM, HR, TC, LR
CB CB
R: Result word
R R
IR, AR, DM, HR, TC, LR

Limitations Each lower limit word in the comparison block must be less than or equal to
the upper limit.

Description When the execution condition is OFF, BCMP(68) is not executed. When the
execution condition is ON, BCMP(68) compares CD to the ranges defined by
a block consisting of of CB, CB+1, CB+2, ..., CB+32. Each range is defined
by two words, the first one providing the lower limit and the second word pro-
viding the upper limit. If CD is found to be within any of these ranges (inclu-
sive of the upper and lower limits), the corresponding bit in R is set. The
comparisons that are made and the corresponding bit in R that is set for each
true comparison are shown below. The rest of the bits in R will be turned
OFF.

CB CD CB+1 Bit 00
CB+2 CD CB+3 Bit 01
CB+4 CD CB+5 Bit 02
CB+6 CD CB+7 Bit 03
CB+8 CD CB+9 Bit 04
CB+10 CD CB+11 Bit 05
CB+12 CD CB+13 Bit 06
CB+14 CD CB+15 Bit 07
CB+16 CD CB+17 Bit 08
CB+18 CD CB+19 Bit 09
CB+20 CD CB+21 Bit 10
CB+22 CD CB+23 Bit 12
CB+24 CD CB+25 Bit 13
CB+26 CD CB+27 Bit 14
CB+28 CD CB+29 Bit 15
CB+30 CD CB+31 Bit 16

Flags ER: The comparison block (i.e., CB through CB+31) exceeds the data
area.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

146
Data Comparison Section 5-15

Example The following example shows the comparisons made and the results pro-
vided for BCMP(68). Here, the comparison is made during each cycle when
00000 is ON.

00000
BCMP(68)
Address Instruction Operands
001 00000 LD 00000
HR 10 00001 BCMP(88)
HR 05 001
HR 10
HR 05

CD 001 Lower limits Upper limits R: HR 05

001 0210 HR 10 0000 HR 11 0100 HR 0500 0


Compare data in IR 001 HR 12 0101 HR 13 0200 HR 0501 0
(which contains 0210) HR 14 0201 HR 15 0300 HR 0502 1
with the given ranges.
HR 16 0301 HR 17 0400 HR 0503 0
HR 18 0401 HR 19 0500 HR 0504 0
HR 20 0501 HR 21 0600 HR 0505 0
HR 22 0601 HR 23 0700 HR 0506 0
HR 24 0701 HR 25 0800 HR 0507 0
HR 26 0801 HR 27 0900 HR 0508 0
HR 28 0901 HR 29 1000 HR 0509 0
HR 30 1001 HR 31 1100 HR 0510 0
HR 32 1101 HR 33 1200 HR 0511 0
HR 34 1201 HR 35 1300 HR 0512 0
HR 36 1301 HR 37 1400 HR 0513 0
HR 38 1401 HR 39 1500 HR 0514 0
HR 40 1501 HR 41 1600 HR 0515 0

5-15-5 TABLE COMPARE TCMP(85)


Operand Data Areas

Ladder Symbols CD: Compare data

IR, SR, AR, DM, HR, TC, LR, #


TCMP(85) @TCMP(85)
TB: First comparison table word
CD CD
IR, SR, DM, HR, TC, LR
TB TB
R: Result word
R R
IR, AR, DM, HR, TC, LR

Description When the execution condition is OFF, TCMP(85) is not executed. When the
execution condition is ON, TCMP(85) compares CD to the content of TB,
TB+1, TB+2, ..., and TB+15. If CD is equal to the content of any of these
words, the corresponding bit in R is set, e.g., if the CD equals the content of
TB, bit 00 is turned ON, if it equals that of TB+1, bit 01 is turned ON, etc. The
rest of the bits in R will be turned OFF.

Flags ER: The comparison table (i.e., TB through TB+15) exceeds the data
area.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

147
Data Comparison Section 5-15

Example The following example shows the comparisons made and the results pro-
vided for TCMP(85). Here, the comparison is made during each cycle when
00000 is ON.

00000 Address Instruction Operands


TCMP(85)
00000 LD 00000
001 00001 TCMP(85)
HR 10 001
HR 05 HR 10
HR 05

CD: 001 Upper limits R: HR 05

001 0210 HR 10 0100 HR 0500 0


Compare the data in IR 001 HR 11 0200 HR 0501 0
with the given ranges. HR 12 0210 HR 0502 1
HR 13 0400 HR 0503 0
HR 14 0500 HR 0504 0
HR 15 0600 HR 0505 0
HR 16 0210 HR 0506 1
HR 17 0800 HR 0507 0
HR 18 0900 HR 0508 0
HR 19 1000 HR 0509 0
HR 20 0210 HR 0510 1
HR 21 1200 HR 0511 0
HR 22 1300 HR 0512 0
HR 23 1400 HR 0513 0
HR 24 0210 HR 0514 1
HR 25 1600 HR 0515 0

148
Data Conversion Section 5-16

5-16 Data Conversion


The conversion instructions convert word data that is in one format into an-
other format and output the converted data to specified result word(s). Con-
versions are available to convert between binary (hexadecimal) and BCD, to
7-segment display data, to ASCII, and between multiplexed and non-multi-
plexed data. All of these instructions change only the content of the words to
which converted data is being moved, i.e., the content of source words is the
same before and after execution of any of the conversion instructions.

5-16-1 BCD-TO-BINARY BIN(23)


Ladder Symbols Operand Data Areas
S: Source word (BCD)
BIN(23) @BIN(23)
IR, SR, AR, DM, HR, TC, LR
S S
R: Result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, BIN(23) is not executed. When the
execution condition is ON, BIN(23) converts the BCD content of S into the
numerically equivalent binary bits, and outputs the binary value to R. Only
the content of R is changed; the content of S is left unchanged.

BCD S

Binary R

BIN(23) can be used to convert BCD to binary so that displays on the Pro-
gramming Console or any other programming device will appear in hexadeci-
mal rather than decimal. It can also be used to convert to binary to perform
binary arithmetic operations rather than BCD arithmetic operations, e.g.,
when BCD and binary values must be added.

Flags ER: The content of S is not BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is zero.

5-16-2 DOUBLE BCD-TO-DOUBLE BINARY BINL(58)


Ladder Symbols Operand Data Areas
S: First source word (BCD)
BINL(58) @BINL(58)
IR, SR, AR, DM, HR, TC, LR
S S
R: First result word
R R
IR, AR, DM, HR, LR

149
Data Conversion Section 5-16

Description When the execution condition is OFF, BINL(58) is not executed. When the
execution condition is ON, BINL(58) converts an eight-digit number in S and
S+1 into 32-bit binary data, and outputs the converted data to R and R+1.

BCD S+1 S

Binary R+1 R

Flags ER: The contents of S and/or S+1 words are not BCD.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is zero.

5-16-3 BINARY-TO-BCD BCD(24)

Ladder Symbols Operand Data Areas


S: Source word (binary)
BCD(24) @BCD(24)
IR, SR, AR, DM, HR, LR
S S
R: Result word
R R
IR, AR, DM, HR, LR

Limitations If the content of S exceeds 270F, the converted result would exceed 9999
and BCD(24) will not be executed. When the instruction is not executed, the
content of R remains unchanged.

Description BCD(24) converts the binary (hexadecimal) content of S into the numerically
equivalent BCD bits, and outputs the BCD bits to R. Only the content of R is
changed; the content of S is left unchanged.

Binary S

BCD R

BCD(24) can be used to convert binary to BCD so that displays on the Pro-
gramming Console or any other programming device will appear in decimal
rather than hexadecimal. It can also be used to convert to BCD to perform
BCD arithmetic operations rather than binary arithmetic operations, e.g.,
when BCD and binary values must be added.

Flags ER: S is greater than 270F.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is zero.

150
Data Conversion Section 5-16

5-16-4 DOUBLE BINARY-TO-DOUBLE BCD BCDL(59)

Ladder Symbols Operand Data Areas


S: First source word (binary)
BCDL(59) @BCDL(59)
IR, SR, AR, DM, HR, LR
S S
R: First result word
R R
IR, AR, DM, HR, LR

Limitations If the content of S exceeds 05F5E0FF, the converted result would exceed
99999999 and BCDL(59) will not be executed. When the instruction is not
executed, the content of R and R+1 remain unchanged.

Description BCDL(59) converts the 32-bit binary content of S and S+1 into eight digits of
BCD data, and outputs the converted data to R and R+1.

Binary S+1 S

BCD R+1 R

Flags ER: Content of R and R+1 exceeds 99999999.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is zero.

5-16-5 HOURS-TO-SECONDS HTS(65)


Operand Data Areas

Ladder Symbols S: Beginning source word (BCD)

IR, SR, AR, DM, HR, TC, LR


HTS(65) @HTS(65)
R: Beginning result word (BCD)
S S
IR, SR, AR, DM, HR, TC, LR
R R
---: Not used.
--- ---

Limitations Can be performed with the CPU11-E only. S and S+1 must be within the
same data area. R and R+1 must be within the same data area. S and S+1
must be BCD and must be in the proper hours/minutes/seconds format.

Description HTS(65) is used to convert time notation in hours/minutes/seconds to an


equivalent in just seconds.

151
Data Conversion Section 5-16

For the source data, the seconds is designated in bits 00 through 07 and the
minutes is designated in bits 08 through 15 of S. The hours is designated in
S+1. The maximum is thus 9,999 hours, 59 minutes, and 59 seconds.
The results is output to R and R+1. The maximum obtainable value is
35,999,999 seconds.

Flags ER: S and S+1 or R and R+1 are not in the same data area.
S and/or S+1 do not contain BCD.
Number of seconds and/or minutes exceeds 59.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: Turns ON when the result is zero.

Example When 00000 is OFF (i.e., when the execution condition is ON), the following
instruction would convert the hours, minutes, and seconds given in HR 12
and HR 13 to seconds and store the results in DM 0100 and DM 0101 as
shown.

00000
HTS(65)
Address Instruction Operands
HR 12 00000 LD NOT 00000
DM 0100 00001 HTS(65)
000 HR 12
DM 0100
HR 12 3 2 0 7 2,815 hrs, 32 min, 07 s
000
HR 13 2 8 1 5

DM 0100 5 9 2 7 10,135,927 s
DM 0101 1 0 1 3

5-16-6 SECONDS-TO-HOURS STH(66)


Operand Data Areas

Ladder Symbols S: Beginning source word (BCD)

IR, SR, AR, DM, HR, TC, LR


STH(66) @STH(66)
R: Beginning result word (BCD)
S S
IR, SR, AR, DM, HR, TC, LR
R R
---: Not used.
--- ---

Limitations Can be performed with the CPU11-E only. S and S+1 must be within the
same data area. R and R+1 must be within the same data area. S and S+1
must be BCD and must be between 0 and 35,999,999 seconds.

Description STH(66) is used to convert time notation in seconds to an equivalent in hour-


s/minutes/seconds.
The number of seconds designated in S and S+1 is converted to hours/minu-
tes/seconds and placed in R and R+1.

152
Data Conversion Section 5-16

For the results, the seconds is placed in bits 00 through 07 and the minutes
is placed in bits 08 through 15 of R. The hours is placed in R+1. The maxi-
mum will be 9,999 hours, 59 minutes, and 59 seconds.

Flags ER: S and S+1 or R and R+1 are not in the same data area.
S and/or S+1 do not contain BCD or exceed 36,000,000 seconds.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: Turns ON when the result is zero.

Example When 00000 is OFF (i.e., when the execution condition is ON), the following
instruction would convert the seconds given in HR 12 and HR 13 to hours,
minutes, and seconds and store the results in DM 0100 and DM 0101 as
shown.

00000
STH(66)
Address Instruction Operands
HR 12 00000 LD NOT 00000
DM 0100 00001 STH(66)
000 HR 12
DM 0100
HR 12 5 9 2 7 10,135,927 s
000
HR 13 1 0 1 3

DM 0100 3 2 0 7 2,815 hrs, 32 min, 07 s


DM 0101 2 8 1 5

5-16-7 4-TO-16 DECODER MLPX(76)

Operand Data Areas

Ladder Symbols S: Source word

IR, SR, AR, DM, HR, TC, LR


MLPX(76) @MLPX(76)
Di: Digit designator
S S
IR, AR, DM, HR, TC, LR, #
Di Di
R: First result word
R R
IR, AR, DM, HR, LR

Limitations The rightmost two digits of Di must each be between 0 and 3.


All result words must be in the same data area.

Description When the execution condition is OFF, MLPX(76) is not executed. When the
execution condition is ON, MLPX(76) converts up to four, four-bit hexadeci-
mal digits from S into decimal values from 0 to 15, each of which is used to
indicate a bit position. The bit whose number corresponds to each converted
value is then turned ON in a result word. If more than one digit is specified,

153
Data Conversion Section 5-16

then one bit will be turned ON in each of consecutive words beginning with R.
(See examples, below.)
The following is an example of a one-digit decode operation from digit num-
ber 1 of S, i.e., here Di would be 0001.

Source word
C

Bit C (i.e., bit number 12) turned ON.

First result word


0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0

The first digit and the number of digits to be converted are designated in Di. If
more digits are designated than remain in S (counting from the designated
first digit), the remaining digits will be taken starting back at the beginning of
S. The final word required to store the converted result (R plus the number of
digits to be converted) must be in the same data area as R, e.g., if two digits
are converted, the last word address in a data area cannot be designated; if
three digits are converted, the last two words in a data area cannot be desig-
nated.

Digit Designator The digits of Di are set as shown below.

Digit number: 3 2 1 0

Specifies the first digit to be converted (0 to 3)

Number of digits to be converted (0 to 3)


0: 1 digit
1: 2 digits
2: 3 digits
3: 4 digits

Not used

Some example Di values and the digit-to-word conversions that they produce
are shown below.

Di: 0010 Di: 0030


S S

0 R 0 R
1 R+1 1 R+1
2 2 R+2
3 3 R+3

Di: 0031 Di: 0023


S S
0 R 0 R
1 R+1 1 R+1
2 R+2 2 R+2
3 R+3 3

154
Data Conversion Section 5-16

Flags ER: Undefined digit designator, or R plus number of digits exceeds a data
area.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

Example The following program converts three digits of data from DM 0020 to bit posi-
tions and turns ON the corresponding bits in three consecutive words starting
with HR 10.

00000
MLPX(76) Address Instruction Operands
DM 0020 00000 LD 00000
#0021 00001 MLPX(76)
HR 10 DM 00200
# 0021
HR 10

S: DM 0020 R: HR 10 R+1: HR 11 R+2: HR 12

DM 00 20 HR 1000 0 HR 1100 0 HR 1200 1


DM 01 21 Not HR 1001 0 HR 1101 0 HR 1201 0
DM 02 22 Converted HR 1002 0 HR 1102 0 HR 1202 0
DM 03 23 HR 1003 0 HR 1103 0 HR 1203 0
DM 04 1 20 HR 1004 0 HR 1104 0 HR 1204 0
15
DM 05 1 21 1 HR 1005 0 HR 1105 0 HR 1205 0
DM 06 1 22 HR 1006 0 HR 1106 1 HR 1206 0
DM 07 1 23 HR 1007 0 HR 1107 0 HR 1207 0
DM 08 0 20 HR 1008 0 HR 1108 0 HR 1208 0
6
DM 09 1 21 2 HR 1009 0 HR 1109 0 HR 1209 0
DM 10 1 22 HR 1010 0 HR 1110 0 HR 1210 0
DM 11 0 23 HR 1011 0 HR 1111 0 HR 1211 0
DM 12 0 20 HR 1012 0 HR 1112 0 HR 1212 0
0
DM 13 0 21 3 HR 1013 0 HR 1113 0 HR 1213 0
DM 14 0 22 HR 1014 0 HR 1114 0 HR 1214 0
DM 15 0 23 HR 1015 1 HR 1115 0 HR 1215 0

5-16-8 16-TO-4 ENCODER DMPX(77)

Operand Data Areas

Ladder Symbols SB: First source word

IR, SR, AR, DM, HR, TC, LR


DMPX(77) @DMPX(77)
R: Result word
SB SB
IR, AR, DM, HR, LR
R R
Di: Digit designator
Di Di
IR, AR, DM, HR, TC, LR, #

Limitations The rightmost two digits of Di must each be between 0 and 3.

155
Data Conversion Section 5-16

All source words must be in the same data area.

Description When the execution condition is OFF, DMPX(77) is not executed. When the
execution condition is ON, DMPX(77) determines the position of the highest
ON bit in S, encodes it into single-digit hexadecimal value corresponding to
the bit number of the highest ON bit number, then transfers the hexadecimal
value to the specified digit in R. The digits to receive the results are specified
in Di, which also specifies the number of digits to be encoded.
The following is an example of a one-digit encode operation to digit number 1
of R, i.e., here Di would be 0001.

First source word


0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 0

C transferred to indicate bit number 12 as


the highest ON bit.

Result word
C

Up to four digits from four consecutive source words starting with S may be
encoded and the digits written to R in order from the designated first digit. If
more digits are designated than remain in R (counting from the designated
first digit), the remaining digits will be placed at digits starting back at the be-
ginning of R.
The final word to be converted (S plus the number of digits to be converted)
must be in the same data area as SB.

Digit Designator The digits of Di are set as shown below.

Digit numbers: 3 2 1 0

Specifies the first digit to receive converted data (0 to 3).

Number of words to be converted (0 to 3)


0: 1 word
1: 2 words
2: 3 words
3: 4 words

Not used.

156
Data Conversion Section 5-16

Some example Di values and the word-to-digit conversions that they produce
are shown below.

Di: 0011 Di: 0030


R R
S 0 S 0
S+1 1 S+1 1
2 S+2 2
3 S+3 3

Di: 0013 Di: 0032


R R
S 0 S 0
S+1 1 S+1 1
2 S+2 2
3 S+3 3

Flags ER: Undefined digit designator, or S plus number of digits exceeds a data
area.
Content of a source word is zero.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

Example When 00000 is ON, the following diagram encodes IR words 010 and 011 to
the first two digits of HR 20 and then encodes LR 10 and 11 to the last two
digits of HR 20. Although the status of each source word bit is not shown, it is

157
Data Conversion Section 5-16

assumed that the bit with status 1 (ON) shown is the highest bit that is ON in
the word.

00000
DMPX(77) Address Instruction Operands
010 00000 LD 00000
HR 20 00001 DMPX(77)
#0010 010
HR 20
DMPX(77)
# 0010
00002 DMPX(77)
LR 10
LR 10
HR 20
HR 20
#0012
# 0012
IR 010 IR 011
01000 01100
: :
01011 1 01109 1
01012 0 01110 0
: : : : : :
HR 20
01015 0 01115 0
Digit 0 B
Digit 1 9
LR 10 LR 11 Digit 2 1
LR 1000 LR 1100 Digit 3 8
LR 1001 1 :
LR 1002 0 LR 1108 1
: : : LR 1109 0
: : : : : :
LR 1015 0 LR 1115 0

5-16-9 7-SEGMENT DECODER SDEC(78)


Operand Data Areas

Ladder Symbols S: Source word (binary)

IR, SR, AR, DM, HR, TC, LR


SDEC(78) @SDEC(78)
Di: Digit designator
S S
IR, AR, DM, HR, TC, LR, #
Di Di
D: First destination word
D D
IR, AR, DM, HR, LR

Limitations Di must be within the values given below


All destination words must be in the same data area.

Description When the execution condition is OFF, SDEC(78) is not executed. When the
execution condition is ON, SDEC(78) converts the designated digit(s) of S
into the equivalent 8-bit, 7-segment display code and places it into the desti-
nation word(s) beginning with D.
Any or all of the digits in S may be converted in sequence from the desig-
nated first digit. The first digit, the number of digits to be converted, and the

158
Data Conversion Section 5-16

half of D to receive the first 7-segment display code (rightmost or leftmost 8


bits) are designated in Di. If multiple digits are designated, they will be placed
in order starting from the designated half of D, each requiring two digits. If
more digits are designated than remain in S (counting from the designated
first digit), further digits will be used starting back at the beginning of S.

Digit Designator The digits of Di are set as shown below.

Digit number: 3 2 1 0

Specifies the first digit to receive converted data (0 to 3).

Number of digits to be converted (0 to 3)


0: 1 digit
1: 2 digits
2: 3 digits
3: 4 digits
First half of D to be used.
0: Rightmost 8 bits (1st half)
1: Leftmost 8 bits (2nd half)

Not used; set to 0.

Some example Di values and the 4-bit binary to 7-segment display conver-
sions that they produce are shown below.

Di: 0011 Di: 0030


S digits D S digits D
0 1st half 0 1st half
1 2nd half 1 2nd half
2 2
3 3 D+1
1st half
2nd half

Di: 0112 Di: 0130


S digits D S digits D
0 0
1st half 1st half
1 1
2nd half 2nd half
2 2
3 D+1 3 D+1
1st half 1st half
2nd half 2nd half

D+2
1st half
2nd half

Example The following example shows the data to produce an 8. The lower case let-
ters show which bits correspond to which segments of the 7-segment display.

159
Data Conversion Section 5-16

The table underneath shows the original data and converted code for all hex-
adecimal digits.

a
Di S D

Bit 00 f b
or g
0 20 0 bit 08 1 a

1 21 1 1 b
1: Second digit e c
x100 0 1 c
0 22 0

0 23 0 1 d d

0 20 0 1 e

0 21 0 8 1 f
x101 0: One digit 1
0 22 0 1 g
Bit 07 0
1 23 1
or
0 20 0 bit 15

1 21 1
x102 0 or 1: 2
1 bits 00 through 07 or 22 1
08 through 15.
1 23 1

1 20 1

0 x103 3 21 0
Not used.
1 22 1

1 23 1

Original data Converted code (segments) Display


Digit Bits - g f e d c b a
0 0 0 0 0 0 0 1 1 1 1 1 1
1 0 0 0 1 0 0 0 0 0 1 1 0
2 0 0 1 0 0 1 0 1 1 0 1 1
3 0 0 1 1 0 1 0 0 1 1 1 1
4 0 1 0 0 0 1 1 0 0 1 1 0
5 0 1 0 1 0 1 1 0 1 1 0 1
6 0 1 1 0 0 1 1 1 1 1 0 1
7 0 1 1 1 0 0 1 0 0 1 1 1
8 1 0 0 0 0 1 1 1 1 1 1 1
9 1 0 0 1 0 1 1 0 1 1 1 1
A 1 0 1 0 0 1 1 1 0 1 1 1
B 1 0 1 1 0 1 1 1 1 1 0 0
C 1 1 0 0 0 0 1 1 1 0 0 1
D 1 1 0 1 0 1 0 1 1 1 1 0
E 1 1 1 0 0 1 1 1 1 0 0 1
F 1 1 1 1 0 1 1 1 0 0 0 1

Flags ER: Incorrect digit designator, or data area for destination exceeded
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

160
Data Conversion Section 5-16

5-16-10 ASCII CONVERT ASC(86)

Operand Data Areas

Ladder Symbols S: Source word

IR, SR, AR, DM, HR, TC, LR


ASC(86) @ASC(86)
Di: Digit designator
S S
IR, AR, DM, HR, TC, LR, #
Di Di
D: First destination word
D D
IR, AR, DM, HR, LR

Limitations Di must be within the values given below

All destination words must be in the same data area.

Description When the execution condition is OFF, ASC(86) is not executed. When the
execution condition is ON, ASC(86) converts the designated digit(s) of S into
the equivalent 8-bit ASCII code and places it into the destination word(s) be-
ginning with D.

Any or all of the digits in S may be converted in order from the designated
first digit. The first digit, the number of digits to be converted, and the half of
D to receive the first ASCII code (rightmost or leftmost 8 bits) are designated
in Di. If multiple digits are designated, they will be placed in order starting
from the designated half of D, each requiring two digits. If more digits are
designated than remain in S (counting from the designated first digit), further
digits will be used starting back at the beginning of S.

Refer to Appendix I for a table of extended ASCII characters.

Digit Designator The digits of Di are set as shown below.

Digit number: 3 2 1 0

Specifies the first digit to be converted (0 to 3).

Number of digits to be converted (0 to 3)


0: 1 digit
1: 2 digits
2: 3 digits
3: 4 digits
First half of D to be used.
0: Rightmost 8 bits (1st half)
1: Leftmost 8 bits (2nd half)

Parity 0: none,
1: even,
2: odd

161
BCD Calculations Section 5-17

Some examples of Di values and the 4-bit binary to 8-bit ASCII conversions
that they produce are shown below.

Di: 0011 Di: 0030


S D S D
0 1st half 0 1st half
1 2nd half 1 2nd half
2 2
3 3 D+1
1st half
2nd half

Di: 0112 Di: 0130


S D S D
0 1st half 0 1st half
1 1
2nd half 2nd half
2 2
3 D+1 3 D+1
1st half 1st half
2nd half 2nd half

D+2
1st half
2nd half

Parity The leftmost bit of each ASCII character (2 digits) can be automatically ad-
justed for either even or odd parity. If no parity is designated, the leftmost bit
will always be zero.
When even parity is designated, the leftmost bit will be adjusted so that the
total number of ON bits is even, e.g., when adjusted for even parity, ASCII
31 (00110001) will be B1 (10110001: parity bit turned ON to create an
even number of ON bits); ASCII 36 (00110110) will be 36 (00110110: par-
ity bit turned OFF because the number of ON bits is already even). The sta-
tus of the parity bit does not affect the meaning of the ASCII code.
When odd parity is designated, the leftmost bit of each ASCII character will
be adjusted so that there is an odd number of ON bits.

Flags ER: Incorrect digit designator, or data area for destination exceeded.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

5-17 BCD Calculations


The BCD calculation instructions INC(38), DEC(39), ADD(30), ADDL(54),
SUB(31), SUBL(55), MUL(32), MULL(56), DIV(33), DIVL(57), FDIV(79), and
ROOT(72) all perform arithmetic operations on BCD data.
For INC(38) and DEC(39) the source and result words are the same. That is,
the content of the source word is overwritten with the instruction result. All
other instructions change only the content of the words in which results are
placed, i.e., the contents of source words are the same before and after exe-
cution of any of the other BCD calculation instructions.
STC(40) and CLC(41), which set and clear the carry flag, are included in this
group because most of the BCD operations make use of the Carry Flag (CY)
in their results. Binary calculations and shift operations also use CY.

162
BCD Calculations Section 5-17

The addition and subtraction instructions include CY in the calculation as well


as in the result. Be sure to clear CY if its previous status is not required in the
calculation, and to use the result placed in CY, if required, before it is
changed by execution of any other instruction.

5-17-1 INCREMENT INC(38)

Ladder Symbols Operand Data Areas

Wd: Increment word (BCD)


INC(38) @INC(38)
IR, AR, DM, HR, LR
Wd Wd

Description When the execution condition is OFF, INC(38) is not executed. When the
execution condition is ON, INC(38) increments Wd, without affecting Carry
(CY).

Flags ER: Wd is not BCD


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the incremented result is 0.

5-17-2 DECREMENT DEC(39)

Ladder Symbols Operand Data Areas

Wd: Decrement word (BCD)


DEC(39) @DEC(39)
IR, AR, DM, HR, LR
Wd Wd

Description When the execution condition is OFF, DEC(39) is not executed. When the
execution condition is ON, DEC(39) decrements Wd, without affecting CY.
DEC(39) works the same way as INC(38) except that it decrements the value
instead of incrementing it.

Flags ER: Wd is not BCD


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the decremented result is 0.

5-17-3 SET CARRY STC(40)

Ladder Symbols

STC(40) @STC(40)

When the execution condition is OFF, STC(40) is not executed.When the ex-
ecution condition is ON, STC(40) turns ON CY (SR 25504).

163
BCD Calculations Section 5-17

5-17-4 CLEAR CARRY CLC(41)

Ladder Symbols

CLC(41) @CLC(41)

When the execution condition is OFF, CLC(41) is not executed.When the ex-
ecution condition is ON, CLC(41) turns OFF CY (SR 25504).

CLEAR CARRY is used to reset (turn OFF) CY (SR 25504) to 0.

5-17-5 BCD ADD ADD(30)

Operand Data Areas

Ladder Symbols Au: Augend word (BCD)

IR, SR, AR, DM, HR, TC, LR, #


ADD(30) @ADD(30)
Ad: Addend word (BCD)
Au Au
IR, SR, AR, DM, HR, TC, LR, #
Ad Ad
R: Result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, ADD(30) is not executed. When the
execution condition is ON, ADD(30) adds the contents of Au, Ad, and CY,
and places the result in R. CY will be set if the result is greater than 9999.

Au + Ad + CY CY R

Flags ER: Au and/or Ad is not BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
CY: ON when there is a carry in the result.
EQ: ON when the result is 0.

Example If 00002 is ON, the program represented by the following diagram clears CY
with CLC(41), adds the content of LR 25 to a constant (6103), places the re-
sult in DM 0100, and then moves either all zeros or 0001 into DM 0101 de-
pending on the status of CY (25504). This ensures that any carry from the

164
BCD Calculations Section 5-17

last digit is preserved in R+1 so that the entire result can be later handled as
eight-digit data.

TR 0
Address Instruction Operands
00002 00000 LR 00002
CLC(41) 00001 OUT TR 0
00002 CLC(41)
ADD(30)
00003 AND(30)
LR 25
LR 25
# 6103
#6103
DM 0100
DM 0100
00004 AND 25504
25504
00005 MOV(21)
MOV(21)
# 0001
#0001
DM 0101
DM 0101
00006 LD TR 0
25504 00007 AND NOT 25504
MOV(21)
00008 MOV(21)
#0000
# 0000
DM 0101
DM 0101

Although two ADD(30) can be used together to perform eight-digit BCD addi-
tion, ADDL(54) is designed specifically for this purpose.

5-17-6 DOUBLE BCD ADD ADDL(54)

Operand Data Areas

Ladder Symbols Au: First augend word (BCD)

IR, SR, AR, DM, HR, TC, LR


ADDL(54) @ADDL(54)
Ad: First addend word (BCD)
Au Au
IR, SR, AR, DM, HR, TC, LR
Ad Ad
R: First result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, ADDL(54) is not executed. When the
execution condition is ON, ADDL(54) adds the contents of CY to the 8-digit
value in Au and Au+1 to the 8-digit value in Ad and Ad+1, and places the re-
sult in R and R+1. CY will be set if the result is greater than 99999999.

Au + 1 Au

Ad + 1 Ad

+ CY

CY R+1 R

165
BCD Calculations Section 5-17

Flags ER: Au and/or Ad is not BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
CY: ON when there is a carry in the result.
EQ: ON when the result is 0.

Example When 00000 is ON, the following program adds two 12-digit numbers, the
first contained in LR 20 through LR 22 and the second in DM 0012. The re-
sult is placed in LR 10 through HR 13. In the second addition (using
ADD(30)), any carry from the first addition is included. The carry from the
second addition is placed in HR 13 by using @ADB(50) (see Section 5-18-1)
with two all-zero constants to indirectly place the content of CY into HR 13.

00000
Address Instruction Operands
CLC(41)
00000 LD 00000
@ADDL(54) 00001 CLC(41)
LR 20 00002 @ADDL(54)
DM 0010 LR 20
HR 10 DM 0010
HR 10
@ADD(30)
00003 @ADD(30)
LR 22
LR 22
DM 0012
DM 0012
HR 12
HR 12
@ADB(50) 00004 @ADB(50)
#0000 # 0000
#0000
# 0000
HR 13
HR 13

5-17-7 BCD SUBTRACT SUB(31)

Operand Data Areas

Ladder Symbols Mi: Minuend word (BCD)

IR, SR, AR, DM, HR, TC, LR, #


SUB(31) @SUB(31)
Su: Subtrahend word (BCD)
Mi Mi
IR, SR, AR, DM, HR, TC, LR, #
Su Su
R: Result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, SUB(31) is not executed. When the
execution condition is ON, SUB(31) subtracts the contents of Su and CY
from Mi, and places the result in R. If the result is negative, CY is set and the
10s complement of the actual result is placed in R. To convert the 10s com-
plement to the true result, subtract the content of R from zero (see example
below).

Mi Su CY CY R

166
BCD Calculations Section 5-17

Flags ER: Mi and/or Su is not BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
CY: ON when the result is negative, i.e., when Mi is less than Su plus CY.
EQ: ON when the result is 0.

Caution Be sure to clear the carry flag with CLC(41) before executing SUB(31) if its
previous status is not required, and check the status of CY after doing a sub-
traction with SUB(31). If CY is ON as a result of executing SUB(31) (i.e., if
the result is negative), the result is output as the 10s complement of the true
answer. To convert the output result to the true value, subtract the value in R
from 0.

Example When 00002 is ON, the following ladder program clears CY, subtracts the
contents of DM 0100 and CY from the content of 010 and places the result in
HR 20.
If CY is set by executing SUB(31), the result in HR 20 is subtracted from zero
(note that CLC(41) is again required to obtain an accurate result), the result
is placed back in HR 20, and HR 2100 is turned ON to indicate a negative
result.
If CY is not set by executing SUB(31), the result is positive, the second sub-
traction is not performed, and HR 2100 is not turned ON. HR 2100 is pro-
grammed as a self-maintaining bit so that a change in the status of CY will
not turn it OFF when the program is recycled.
In this example, differentiated forms of SUB(31) are used so that the subtrac-
tion operation is performed only once each time 00002 is turned ON. When
another subtraction operation is to be performed, 00002 will need to be

167
BCD Calculations Section 5-17

turned OFF for at least one cycle (resetting HR 2100) and then turned back
ON.

TR 0
00002
CLC(41)

@SUB(31) First
010
subtraction
DM 0100

HR 20
25504
CLC(41)

@SUB(31) Second
#0000
subtraction
HR 20
Address Instruction Operands
HR 21
00000 LD 00002
25504
HR 2100 00001 OUT TR 0
00002 CLC(41)
HR 2100 Turned ON to indicate 00003 @SUB(31)
negative result. 010
DM 0100
HR 20
00004 AND 25504
00005 CLC(41)
00006 @SUB(31)
# 0000
HR 20
HR 20
00007 LD TR 0
00008 AND 25504
00009 OR HR 2100
00010 OUT HR 2100

The first and second subtractions for this diagram are shown below using
example data for 010 and DM 0100.

Note The actual SUB(31) operation involves subtracting Su and CY from 10,000
plus Mi. For positive results the leftmost digit is truncated. For negative
results the 10s complement is obtained. The procedure for establishing the
correct answer is given below.

First Subtraction
IR 010 1029
DM 0100 3452
CY 0

HR 20 7577 (1029 + (10000 3452))


CY 1 (negative result)

168
BCD Calculations Section 5-17

Second Subtraction
0000
HR 20 7577
CY 0
HR 20 2423 (0000 + (10000 7577))
CY 1 (negative result)
In the above case, the program would turn ON HR 2100 to indicate that the
value held in HR 20 is negative.

5-17-8 DOUBLE BCD SUBTRACT SUBL(55)

Operand Data Areas

Ladder Symbols Mi: First minuend word (BCD)

IR, SR, AR, DM, HR, TC, LR, #


SUBL(55) @SUBL(55)
Su: First subtrahend word (BCD)
Mi Mi
IR, SR, AR, DM, HR, TC, LR, #
Su Su
R: First result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, SUBL(55) is not executed. When the
execution condition is ON, SUBL(55) subtracts CY and the 8-digit contents of
Su and Su+1 from the 8-digit value in Mi and Mi+1, and places the result in R
and R+1. If the result is negative, CY is set and the 10s complement of the
actual result is placed in R. To convert the 10s complement to the true result,
subtract the content of R from zero. Since an 8-digit constant cannot be di-
rectly entered, use the BSET(71) instruction (see Section 5-14-5) to create
an 8-digit constant.

Mi + 1 Mi

Su + 1 Su

CY

CY R+1 R

Flags ER: Mi, M+1,Su, or Su+1 are not BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
CY: ON when the result is negative, i.e., when Mi is less than Su.
EQ: ON when the result is 0.

Example The following example works much like that for single-word subtraction. In
this example, however, BSET(71) is required to clear the content of DM 0000

169
BCD Calculations Section 5-17

and DM 0001 so that a negative result can be subtracted from 0 (inputting an


8-digit constant is not possible).

TR 0
00003
CLC(41)

@SUBL(55) First
HR 20 subtraction
120

DM 0100
25504
@BSET(71)

#0000

DM 0000

DM 0001

CLC(41)

@SUBL(55) Second
DM 0000 subtraction
DM 0100

DM 0100

25504
HR 2100

HR 2100 Turned ON to indicate


negative result.

Address Instruction Operands Address Instruction Operands

00000 LD 00003 00006 CLC(41)


00001 OUT TR 0 00007 @SUBL(55)
00002 CLC(41) DM 0000
00003 @SUBL(55) DM 0100
HR 20 DM 0100
120 00008 LD TR 0
DM 0100 00009 AND 25504
00004 AND 25504 00010 OR HR 2100
00005 @BSET(71) 00011 OUT HR 2100
# 0000
DM 0000
DM 0001

170
BCD Calculations Section 5-17

5-17-9 BCD MULTIPLY MUL(32)


Operand Data Areas

Ladder Symbols Md: Multiplicand (BCD)

IR, SR, AR, DM, HR, TC, LR, #


MUL(32) @MUL(32)
Mr: Multiplier (BCD)
Md Md
IR, SR, AR, DM, HR, TC, LR, #
Mr Mr
R: First result word
R R
IR, AR, DM, HR LR

Description When the execution condition is OFF, MUL(32) is not executed. When the
execution condition is ON, MUL(32) multiplies Md by the content of Mr, and
places the result In R and R+1.

Md

X Mr

R +1 R

Example When IR 00000 is ON with the following program, the contents of IR 013 and
DM 0005 are multiplied and the result is placed in HR 07 and HR 08. Exam-
ple data and calculations are shown below the program.

00000
Address Instruction Operands
MUL(32)

013
00000 LD 00000
00001 MUL(32)
DM 0005
013
HR 07
DM 00005
HR 07

Md: IR 013
3 3 5 6

Mr: DM 0005
X 0 0 2 5

R+1: HR 08 R: HR 07
0 0 0 8 3 9 0 0

Flags ER: Md and/or Mr is not BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
CY: ON when there is a carry in the result.
EQ: ON when the result is 0.

171
BCD Calculations Section 5-17

5-17-10 DOUBLE BCD MULTIPLY MULL(56)

Operand Data Areas

Ladder Symbols Md: First multiplicand word (BCD)

IR, SR, AR, DM, HR, TC, LR, #


MULL(56) @MULL(56)
Mr: First multiplier word (BCD)
Md Md
IR, SR, AR, DM, HR, TC, LR, #
Mr Mr
R: First result word
R R
IR, AR, DM, HR LR

Description When the execution condition is OFF, MULL(56) is not executed. When the
execution condition is ON, MULL(56) multiplies the eight-digit content of Md
and Md+1 by the content of Mr and Mr+1, and places the result in R to R+3.

Md + 1 Md

x Mr + 1 Mr

R+1 R+2 R+1 R

Flags ER: Md, Md+1,Mr, or Mr+1 is not BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
CY: ON when there is a carry in the result.
EQ: ON when the result is 0.

5-17-11 BCD DIVIDE DIV(33)

Operand Data Areas

Ladder Symbol Dd: Dividend word (BCD)

IR, SR, AR, DM, HR, TC, LR, #


DIV(33)
Dr: Divisor word (BCD)
Dd
IR, SR, AR, DM, HR, TC, LR, #
Dr
R: First result word (BCD)
R
IR, AR, DM, HR, LR

Limitations R and R+1 must be in the same data area.

Description When the execution condition is OFF, DIV(33) is not executed and the pro-
gram moves to the next instruction. When the execution condition is ON, Dd

172
BCD Calculations Section 5-17

is divided by Dr and the result is placed in R and R + 1: the quotient in R and


the remainder in R + 1.

Remainder Quotient

R+1 R

Dr Dd

Flags ER: Dd or Dr is not in BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

Example When IR 00000 is ON with the following program, the content of IR 020 is
divided by the content of HR 09 and the result is placed in DM 0017 and DM
0018. Example data and calculations are shown below the program.

00000
Address Instruction Operands
DIV(33)
00000 LD 00000
020
00001 DIV(33)
HR 09
020
DM 0017 HR 09
Quotient Remainder DM 0017

R: DM 0017 R + 1: DM 0018
1 1 5 0 0 0 0 2

Dd: HR 09 Dd: IR 020


0 0 0 3 3 4 5 2

5-17-12 DOUBLE BCD DIVIDE DIVL(57)

Operand Data Areas

Ladder Symbols Dd: First dividend word (BCD)

IR, SR, AR, DM, HR, TC, LR


DIVL(57) @DIVL(57)
Dr: First divisor word (BCD)
Dd Dd
IR, SR, AR, DM, HR, TC, LR
Dr Dr
R: First result word
R R
IR, AR, DM, HR LR

Description When the execution condition is OFF, DIVL(57) is not executed. When the
execution condition is ON, DIVL(57) the eight-digit content of Dd and D+1 is

173
BCD Calculations Section 5-17

divided by the content of Dr and Dr+1 and the result is placed in R to R+3:
the quotient in R and R+1, the remainder in R+2 and R+3.

Remainder Quotient

R+3 R+2 R+1 R

Dr+1 Dr Dd+1 Dd

Flags ER: Dr and Dr+1 contain 0.


Dd, Dd+1, Dr, or Dr+1 is not BCD.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

5-17-13 FLOATING POINT DIVIDE FDIV(79)

Operand Data Areas

Ladder Symbols Dd: First dividend word (BCD)

IR, SR, AR, DM, HR, TC, LR


FDIV(79) @FDIV(79)
Dr: First divisor word (BCD)
Dd Dd
IR, SR, AR, DM, HR, TC, LR
Dr Dr
R: First result word
R R
IR, AR, DM, HR LR

Limitations Dr and Dr+1 cannot contain zero. Dr and Dr+1 must be in the same data
area, as must Dd and Dd+1; R and R+1.

Description When the execution condition is OFF, FDIV(79) is not executed. When the
execution condition is ON, FDIV(79) divides the floating-point value in Dd and
Dd+1 by that in Dr and Dr+1 and places the result in R and R+1.

Quotient

R+1 R

Dr+1 Dr Dd+1 Dd

To represent the floating point values, the rightmost seven digits are used for
the mantissa and the leftmost digit is used for the exponent, as shown below.

174
BCD Calculations Section 5-17

The mantissa is expressed as a value less than one, i.e., to seven decimal
places.

First word
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00

1 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1

Exponent (0 to 7) Mantissa (leftmost 3 digits)


Sign of exponent 0: +
1:

Second word
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00

0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1

Mantissa (leftmost 4 digits)

= 0.1111111 x 102

Flags ER: Dr and Dr+1 contain 0.


Dd, Dd+1, Dr, or Dr+1 is not BCD.
The result is not between 0.0000001 x 107 and 0.999999 x 10+7.
Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

Example The following example shows how to divide two whole four-digit numbers
(i.e., numbers without fractions) so that a floating-point value can be ob-
tained.
First the original numbers must be placed in floating-point form. Because the
numbers are originally without decimal points, the exponent will be 4 (e.g.,
3452 would equal 0.3452 x 104). All of the moves are to place the proper
data into consecutive words for the final division, including the exponent and
zeros. Data movements for Dd and Dd+1 are shown at the right below.
Movements for Dr and Dr+1 are basically the same.The original values to be
divided are in DM 0000 and DM 0001. The final division is also shown.

175
BCD Calculations Section 5-17

00000
@MOV(21)
HR 01 HR 00
#0000
0 0 0 0
HR 00

@MOV(21)
0000
#0000
HR 02

@MOV(21)
HR 01 HR 00
#4000
4 0 0 0 0 0 0 0
HR 01

@MOV(21)
4000
#4000
HR 03

DM 0000
@MOVD(83)
3 4 5 2
DM 0000
#0021

HR 01 HR 01 HR 00
4 3 4 5 0 0 0 0
@MOVD(83)
DM 0000
DM 0000
3 4 5 2
#0300

HR 00
HR 01 HR 00
4 3 4 5 2 0 0 0
@MOVD(83)
DM 0001
#0021

HR 03

@MOVD(83)
HR 01 HR 00
DM 0001
4 3 4 5 2 0 0 0
#0300


HR 02 HR 03 HR 02
4 0 0 7 9 0 0 0
@FDIV(79)
HR 00 DM 0003 DM 0002
HR 02 2 4 3 6 9 6 2 0
DM 0002 0.4369620 x 102

Address Instruction Operands Address Instruction Operands

00000 LD 00000 00006 @MOVD(83)


00001 @MOV(21) DM 0000
# 0000 # 0300
HR 00 HR 00
00002 @MOV(21) 00007 @MOVD(83)
# 0000 DM 0001
HR 02 # 0021
00003 @MOV(21) HR 03
# 4000 00008 @MOVD(83)
HR 01 DM 0001
00004 @MOV(21) # 0300
# 4000 HR 02
HR 03 00009 @FDIV(79)
00005 @MOVD(83) HR 00
DM 0000 HR 02
# 0021 DM 0002
HR 01

176
BCD Calculations Section 5-17

5-17-14 SQUARE ROOT ROOT(72)

Ladder Symbols Operand Data Areas


Sq: First source word (BCD)
ROOT(72) @ROOT(72)
IR, SR, AR, DM, HR, TC, LR
Sq Sq
R: Result word
R R
IR, AR, DM, HR, LR,

Description When the execution condition is OFF, ROOT(72) is not executed. When the
execution condition is ON, ROOT(72) computes the square root of the
eight-digit content of Sq and Sq+1 and places the result in R. The fractional
portion is truncated.

Sq+1 Sq

Flags ER: Sq is not BCD.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

Example The following example shows how to take the square root of a four-digit num-
ber and then round the result.
First the words to be used are cleared to all zeros and then the value whose
square root is to be taken is moved to Sq+1. The result, which has twice the
number of digits required for the answer (because the number of digits in the
original value was doubled), is placed in DM 0102, and the digits are split into
two different words, the leftmost two digits to IR 011 for the answer and the
rightmost two digits to DM 0103 so that the answer in IR 011 can be rounded
up if required. The last step is to compare the value in DM 0103 so that IR
011 can be incremented using the Greater Than flag.
In the following example, 6017 = 77.56, and 77.56 is rounded off to 78.

177
BCD Calculations Section 5-17

00000
@BSET(71) DM 0101 DM 0100
#0000 0 0 0 0 0 0 0 0
DM 0100

DM 0101
0000 0000

@MOV(21)
010
6 0 1 7
010
DM 0101
DM 0101 DM 0100
@ROOT(72) 6 0 1 7 0 0 0 0
DM 0100
DM 0102 60170000= 7756.932

@MOV(21)
#0000
DM 0103 IR 011
011
0 0 0 0 0 0 0 0

@MOV(21)
#0000
0000 0000
DM 0103

@MOVD(83)
DM 0102
DM 0102
7 7 5 6
#0012

011

@MOVD(83)
IR 011 DM 0103
0 0 7 7 5 6 0 0
DM 0102
#0210

DM 0103

@CMP(20)
DM 0103 5600 > 4900
#4900
25505
@INC(38) IR 011
011
0 0 7 8

Address Instruction Operands Address Instruction Operands

00000 LD 00000 00006 @MOVD(83)


00001 @BSET(71) DM 0102
# 0000 # 0012
DM 0100 011
DM 0101 00007 @MOVD(83)
00002 @MOV(21) DM 0102
010 # 0210
DM 0101 DM 0103
00003 @ROOT(72) 00008 @CMP(20)
DM 0100 DM 0103
DM 0102 # 4900
00004 @MOV(21) 00009 LD 25505
# 0000 00010 @INC(38)
011 011
00005 @MOV(21)
# 0000
DM 0103

178
Binary Calculations Section 5-18

5-18 Binary Calculations


The binary calculation instructions - ADB(50), SBB(51), MLB(52) and
DVB(53) - all perform arithmetic operations on hexadecimal data.
The addition and subtraction instructions include CY in the calculation as well
as in the result. Be sure to clear CY if its previous status is not required in the
calculation, and to use the result placed in CY, if required, before it is
changed by the execution of any other instruction. STC(40) and CLC(41) can
be used to control CY. Refer to 5-17 BCD Calculations.

5-18-1 BINARY ADD ADB(50)


Operand Data Areas

Ladder Symbols Au: Augend word (binary)

IR, SR, AR, DM, HR, TC, LR, #


ADB(50) @ADB(50)
Ad: Addend word (binary)
Au Au
IR, SR, AR, DM, HR, TC, LR, #
Ad Ad
R: Result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, ADB(50) is not executed. When the
execution condition is ON, ADB(50) adds the contents of Au, Ad, and CY,
and places the result in R. CY will be set if the result is greater than FFFF.

Au + Ad + CY CY R

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
CY: ON when the result is greater than FFFF.
EQ: ON when the result is 0.

Examples The following example shows a four-digit addition with CY used to place ei-
ther #0000 or #0001 into R+1 to ensure that any carry is preserved.

TR 0 Address Instruction Operands


00000 00000 LD 00000
CLC(41)
00001 OUT TR 0
00002 CLC(41)
ADB(50)
00003 ADB(50)
010
010
DM 0100
DM 0100
HR 10 =R
HR 10
25504
MOV(21)
00004 AND NOT 25504
#0000
00005 MOV(21)
HR 11
# 0000
= R+1
25504 HR 11
MOV(21) 00006 LD TR 0
#0001 00007 AND 25504
HR 11 = R+1 00008 MOV(21)
# 00001
HR 11

179
Binary Calculations Section 5-18

In the case below, A6E2 + 80C5 = 127A7. The result is a 5-digit number, so
CY (SR 25504) = 1, and the content of R + 1 becomes #0001.

Au: IR 010
A 6 E 2

Ad: DM 0100
+ 8 0 C 5

R+1: HR 11 R: HR 10
0 0 0 1 2 7 A 7

The following example performs eight-digit addition by using ADB(50) twice.


ADB(50) is also used to place the carry into DM 0302 (one word greater than
the rest of the answer). The complete answer thus ends up in DM 0300
through DM 0302.

00000
CLC(41)
Address Instruction Operands
00000 LD 00000
@ADB(50)
00001 CLC(41)
LR 20
00002 @ADB(50)
DM 0200
LR 20
DM 0300
DM 0200
@ADB(50)
DM 0300
LR 21
00003 @ADB(50)
LR 21
DM 0201
DM 0201
DM 0301
DM 0301
@ADB(50) 00004 @ADB(50)
#0000 # 0000
#0000 # 0000
DM 0302 DM 0302

180
Binary Calculations Section 5-18

In the case below, 4F52A6E2 + EC3B80C5 = 13B8E27A7. The sum of the


lower 4-digit addition is a 5-digit number, so CY (SR 25504) = 1, and the sum
of the higher 4-digit addition is incremented by 1.

Lower 4 digits. Higher 4 digits.

Au: LR 20 Au: LR 21
A 6 E 2 4 F 5 2

Ad: DM 0200 Ad: DM 0201


+ 8 0 C 5
+ E C 3 B
CY = 1

R: DM 0300 R: DM 0301
2 7 A 7 3 B 8 E

CY = 1

R+2: DM 0302 R+1: DM 0301 R: DM 0300


0 0 0 1 3 B 8 E 2 7 A 7

5-18-2 BINARY SUBTRACT SBB(51)

Operand Data Areas

Ladder Symbols Mi: Minuend word (binary)

IR, SR, AR, DM, HR, TC, LR, #


SBB(51) @SBB(51)
Su: Subtrahend word (binary)
Mi Mi
IR, SR, AR, DM, HR, TC, LR, #
Su Su
R: Result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, SBB(51) is not executed. When the
execution condition is ON, SBB(51) subtracts the contents of Su and CY from
Mi and places the result in R. If the result is negative, CY is set and the 2s
complement of the actual result is placed in R.

Mi Su CY CY R

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
CY: ON when the result is negative, i.e., when Mi is less than Su plus CY.
EQ: ON when the result is 0.

Example The following example shows eight-digit subtraction. CY is tested following


the first two subtractions to see if the result is negative. If it is, the first result
is subtracted from zero to obtain the true result, which is placed in HR 10 and

181
Binary Calculations Section 5-18

HR 11, and either #0000 or #0001 is placed in HR 12 (0001 indicates a nega-


tive answer).

TR 0 Address Instruction Operands


00000 00000 LD 00000
CLC(41)
00001 OUT TR 0
00002 CLC(41)
SBB(51)
00003 SBB(51)
010
010
DM 0100
DM 0100
HR 10
HR 10
00004 SBB(51)
SBB(51)
011
011
DM 0101
DM 0101
HR 11
HR 11
25504 00005 AND 25505
CLC(41) 00006 CLC(41)
00007 SBB(51)
SBB(51) # 0000
#0000 HR 10
HR 10 HR 10
HR 10 00008 SBB(51)
# 0000
SBB(51) HR 11
#0000 HR 11
HR 11 00009 LD TR 0
HR 11 00010 AND NOT 25504
25504 00011 MOV(21)
MOV(21)
# 0000
#0000
HR 12
HR 12 00012 LD TR 0
25504
00013 AND 25504
MOV(21)
00014 MOV(21)
#0001
# 0000
HR 12
HR 12

In the case below, 20F55A10 B8A360E3 = 97AE06D3. In the the lower


4-digit subtraction, Su > Mi, so CY(SR 25504) becomes 1, and the result of
the higher 4-digit subtraction is decremented by 1. In the final calculations,
#0000 F9D2 = 0000 + (10000 F9D2) = 06D3.

182
Binary Calculations Section 5-18

#0000 6851 1 (from CY = 1) = 0000 + (10000 6851 1) = 97AE.


The content of HR 12, #0001, indicates a negative result.

Lower 4 digits. Higher 4 digits.

Mi: IR 010 Mi: IR 011


5 A 1 0 2 0 F 5

Su: DM 0100 Su: DM 0101


6 0 E 3 CY = 0 B 8 A 3
(from CLC(41))
0 0 0 0 0 0 0 1

5A10 + (10000 60E3) CY = 1 20F5 + (10000 B8A3) 1

R: HR 10 R: HR 11
F 9 2 D 6 8 5 1

CY = 1

R+2: HR 12 R+1: HR 11 R: HR 10
0 0 0 1 9 7 A E 0 6 D 3

5-18-3 BINARY MULTIPLY MLB(52)

Operand Data Areas

Ladder Symbols Md: Multiplicand word (binary)

IR, SR, AR, DM, HR, TC, LR, #


MLB(52) @MLB(52)
Mr: Multiplier word (binary)
Md Md
IR, SR, AR, DM, HR, TC, LR, #
Mr Mr
R: First result word
R R
IR, AR, DM, HR LR

Description When the execution condition is OFF, MLB(52) is not executed. When the
execution condition is ON, MLB(52) multiplies the content of Md by the con-
tents of Mr, places the rightmost four digits of the result in R, and places the
leftmost four digits in R+1.

Md

X Mr

R +1 R

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

183
Logic Instructions Section 5-19

5-18-4 BINARY DIVIDE DVB(53)


Operand Data Areas

Ladder Symbols Dd: Dividend word (binary)

IR, SR, AR, DM, HR, TC, LR, #


DVB(53) @DVB(53)
Dr: Divisor word (binary)
Dd Dd
IR, SR, AR, DM, HR, TC, LR, #
Dr Dr
R: First result word
R R
IR, AR, DM, HR LR

Description When the execution condition is OFF, DVB(53) is not executed. When the
execution condition is ON, DVB(53) divides the content of Dd by the content
of Dr and the result is placed in R and R+1: the quotient in R, the remainder
in R+1.

Quotient Remainder

R R+1

Dr Dd

Flags ER: Dr contains 0.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

5-19 Logic Instructions


The logic instructions - COM(29), ANDW(34), ORW(35), XORW(36), and
XNRW(37) - perform logic operations on word data.

5-19-1 COMPLEMENT COM(29)


Ladder Symbols Operand Data Areas

Wd: Complement word


COM(29) @COM(29)
IR, AR, DM, HR, LR
Wd Wd

Description When the execution condition is OFF, COM(29) is not executed. When the
execution condition is ON, COM(29) clears all ON bits and sets all OFF bits
in Wd.

Example 15 00

Original 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1

15 00
Complement 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0

184
Logic Instructions Section 5-19

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

5-19-2 LOGICAL AND ANDW(34)


Operand Data Areas
Ladder Symbols I1: Input 1

IR, SR, AR, DM, HR, TC, LR, #


ANDW(34) @ANDW(34)
I2: Input 2
I1 I1
IR, SR, AR, DM, HR, TC, LR, #
I2 I2
R: Result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, ANDW(34) is not executed. When the
execution condition is ON, ANDW(34) logically ANDs the contents of I1 and
I2 bit-by-bit and places the result in R.

Example 15 00

I1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1

15 00

I2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

15 00

R 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

5-19-3 LOGICAL OR ORW(35)


Operand Data Areas

Ladder Symbols I1: Input 1

IR, SR, AR, DM, HR, TC, LR, #


ORW(35) @ORW(35)
I2: Input 2
I1 I1
IR, SR, AR, DM, HR, TC, LR, #
I2 I2
R: Result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, ORW(35) is not executed. When the
execution condition is ON, ORW(35) logically ORs the contents of I1 and I2
bit-by-bit and places the result in R.

185
Logic Instructions Section 5-19

Example 15 00

I1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1

15 00

I2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

15 00

R 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

5-19-4 EXCLUSIVE OR XORW(36)

Operand Data Areas

Ladder Symbols I1: Input 1

IR, SR, AR, DM, HR, TC, LR, #


XORW(36) @XORW(36)
I2: Input 2
I1 I1
IR, SR, AR, DM, HR, TC, LR, #
I2 I2
R: Result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, XORW(36) is not executed. When the
execution condition is ON, XORW(36) exclusively ORs the contents of I1
and I2 bit-by-bit and places the result in R.

Example 15 00

I1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1

15 00

I2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

15 00

R 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

186
Subroutines and Interrupt Control Section 5-20

5-19-5 EXCLUSIVE NOR XNRW(37)

Operand Data Areas

Ladder Symbols I1: Input 1

IR, SR, AR, DM, HR, TC, LR, #


XNRW(37) @XNRW(37)
I2: Input 2
I1 I1
IR, SR, AR, DM, HR, TC, LR, #
I2 I2
R: Result word
R R
IR, AR, DM, HR, LR

Description When the execution condition is OFF, XNRW(37) is not executed. When the
execution condition is ON, XNRW(37) exclusively NORs the contents of I1
and I2 bit-by-bit and places the result in R.

15 00

I1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1

15 00

I2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

15 00

R 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word


is not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the result is 0.

5-20 Subroutines and Interrupt Control


5-20-1 Overview
Subroutines break large control tasks into smaller ones and enable you to
reuse a given set of instructions. When the main program calls a subroutine,
control is transferred to the subroutine and the subroutine instructions are
executed. The instructions within a subroutine are written in the same way as
main program code. When all the subroutine instructions have been ex-
ecuted, control returns to the main program to the point just after the point
from which the subroutine was entered (unless otherwise specified in the
subroutine).
Subroutines may also be activated by interrupts. Like subroutine calls, inter-
rupts cause a break in the flow of the main program execution such that the
flow can be resumed from that point after completion of the subroutine. An
interrupt is caused either by an external source, such as an input signal from
an Interrupt Input Unit, or a scheduled interrupt. In the case of the scheduled
interrupt, the interrupt signal is repeated at regular intervals.

187
Subroutines and Interrupt Control Section 5-20

Whereas subroutine calls are controlled from within the main program, sub-
routines activated by interrupts are triggered when the interrupt signal is re-
ceived. Also, multiple interrupts from different Interrupt Input Units can occur
at the same time. To effectively deal with this, the PC employs a priority
scheme for handling interrupts.
In the case of the scheduled interrupt, the time interval between interrupts is
set by the user and is unrelated to the cycle timing of the PC. This capability
is useful for periodic supervisory or executive program execution.
INT(89) is used to control the interrupt signals received from the Interrupt
Input Units, and also to control the scheduling of the scheduled interrupt.
INT(89) provides such functions as masking of interrupts (so that they are
recorded but ignored) and clearing of interrupts.

5-20-2 SUBROUTINE DEFINE and RETURN SBN(92)/RET(93)


Ladder Symbols Definer Data Areas

N: Subroutine number
SBN(92) N
# (00 to 99)

RET(93)

Limitations Each subroutine number can be used in SBN(92) once only, i.e., up to 100
subroutines may be programmed. Subroutine numbers 00 through 31 are
used by Interrupt Input Units and subroutine number 99 is used for the
scheduled interrupt. Refer to 5-20-4 INTERRUPT CONTROL INT(89) for
details.

Description SBN(92) is used to mark the beginning of a subroutine program; RET(93) is


used to mark the end. Each subroutine is identified with a subroutine number,
N, that is programmed as a definer for SBN(92). This same subroutine num-
ber is used in any SBS(91) that calls the subroutine (see next subsection).
No subroutine number is required with RET(93).

All subroutines must be programmed at the end of the main program. When
one or more subroutines have been programmed, the main program will be
executed up to the first SBN(92) before returning to address 00000 for the
next cycle. Subroutines will not be executed unless called by SBS(91) or acti-
vated by an interrupt.
END(01) must be placed at the end of the last subroutine program, i.e., after
the last RET(93). It is not required at any other point in the program. (Refer to
the next subsection for further details.)

Precautions If SBN(92) is mistakenly placed in the main program, it will inhibit program
execution past that point, i.e., program execution will return to the beginning
when SBN(92) is encountered.

If either DIFU(13) or DIFU(14) is placed within a subroutine, the operand bit


will not be turned OFF until the next time the subroutine is executed, i.e., the
operand bit may stay ON longer than one cycle.

Flags There are no flags directly affected by these instructions.

188
Subroutines and Interrupt Control Section 5-20

5-20-3 SUBROUTINE ENTER SBS(91)

Ladder Symbol Definer Data Areas

N: Subroutine number
SBS(91) N
# (00 to 99)

Description A subroutine can be executed by placing SBS(91) in the main program at the
point where the subroutine is desired. The subroutine number used in
SBS(91) indicates the desired subroutine. When SBS(91) is executed (i.e.,
when the execution condition for it is ON), the instructions between the
SBN(92) with the same subroutine number and the first RET(93) after it are
executed before execution returns to the instruction following the SBS(91)
that made the call.

Main program

SBS(91) 00

Main program

SBN(92) 00

Subroutine

RET(93)
END(01)

SBS(91) may be used as many times as desired in the program, i.e., the
same subroutine may be called from different places in the program).
SBS(91) may also be placed into a subroutine to shift program execution
from one subroutine to another, i.e., subroutines may be nested. When the
second subroutine has been completed (i.e., RET(93) has been reached),
program execution returns to the original subroutine which is then completed
before returning to the main program. Nesting is possible to up to sixteen
levels. A subroutine cannot call itself (e.g., SBS(91) 00 cannot be pro-
grammed within the subroutine defined with SBN(92) 00). The following dia-
gram illustrates two levels of nesting.

SBN(92) 10 SBN(92) 11 SBN(92) 12

SBS(91) 10 SBS(91) 11 SBS(91) 12

RET(93) RET(93) RET(93)

189
Subroutines and Interrupt Control Section 5-20

Although subroutines 00 through 31 can be called by using SBS(91), they


are also activated by interrupt signals from Interrupt Input Units. Subroutine
99, which can also be called using SBS(91), is used for the scheduled inter-
rupt. (Refer to the next subsection for details.)
The following diagram illustrates program execution flow for various execu-
tion conditions for two SBS(91).

SBS(91) 00 OFF execution conditions for


subroutines 00 and 01
B A B C
Main
program SBS(91) 01
ON execution condition for
subroutine 00 only

C
A D B C

ON execution condition for


SBN(92) 00 subroutine 01 only
A B E C
D

RET(93) ON execution conditions for


SBN(92) 01 subroutines 00 and 01
Subroutines
A D B E C
E

RET(93)
END(01)

Flags ER: A subroutine does not exist for the specified subroutine number.
A subroutine has called itself.
Subroutines have been nested to more than sixteen levels.

Caution SBS(91) will not be executed and the subroutine will not be called when ER
is ON.

5-20-4 INTERRUPT CONTROL INT(89)


Operand Data Areas

Ladder Symbols CC: Control code

# (000 to 002)
INT(89) @INT(89)
N: Interrupt designator
CC CC
# (004)
N N
D: Control data
D D
IR, AR, DM, HR, TC, LR, TR, #

190
Subroutines and Interrupt Control Section 5-20

Limitations D may be a constant only when CC is 000 or 001. D must be a word address
when CC is 002. See below for details. INT(89) is used only to control the
scheduled interrupts with the C200H and N must be set to 0004.

Caution INT(89) cannot be used during execution of step programs or in C2000H Du-
plex CPUs. Refer to 5-21 Step Instructions for details on step programs.

Description INT(89) is used to control the scheduled interrupt. Subroutine 99 can be es-
tablished so that it will be executed repeatedly at a fixed interval through
scheduled interrupts.The actual time at which it is executed is independent of
the cycle time. INT(89) is used to control the scheduled interrupt. If N is 004,
CC is used to designate the desired function as follows:
CC = 000: Setting time interval
001: Setting the time to first scheduled interrupt
002: Reading the current time interval

Scheduling the Interrupt Even when a subroutine 99 has been written, it will not be executed accord-
ing to scheduled interrupts unless INT(89) is used to set the proper times.
INT(89) should be used to set both the time interval (CC = 000) for the
scheduled interrupt and the time to the first scheduled interrupt (CC = 001.
Unstable operation may result is the time to the first interrupt is not set.

CC = 000 To set the time interval for the scheduled interrupt, set CC to 000 and set D
(Interval) to any value between 00.01 and 99.99 seconds. The decimal point is not in-
put. The time interval can be changed at any time.
To cancel the scheduled interrupt, set the time interval to 00.00 seconds.

Caution If the scheduled execution time of the subroutine becomes too large, it will
have a serious effect on the overall execution time of the main program.
Therefore, you should take extra care to write a subroutine that is fast and
efficient. INT(89), with a CC of 000, is used to change the scheduled interrupt
time interval, the new time interval is not effective until after the next sched-
uled interrupt. (cf. CC = 001 below)

CC = 001 To set the time to the first interrupt, set CC to 001 and set D to any value be-
(Time to First Interrupt) tween 00.01 and 99.99 seconds. The decimal point is not entered. If D is set
to 00.00, the interrupt will not occur.

Caution INT(89), with a CC code of 001, can be used to change the scheduled inter-
rupt time interval for one cycle. The new time interval is effective immediately.
The scheduled interrupt may never actually occur if the time to the first inter-
rupt is changed repeatedly, i.e., before the interrupt has time to occur.

CC = 002 To access the current time interval for the scheduled interrupt, set CC 002.
(Read Interval) The current time interval will be places in D

Flags ER: CC, D, or N is not within specified values.


Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)

191
Subroutines and Interrupt Control Section 5-20

Example The following program shows the overall structure and operation of the
scheduled interrupt.
Here, the scheduled subroutine is started and will be repeated every 20 ms.
The control flow logic of the main program is unaffected by execution of the
scheduled subroutine, i.e., immediately after the sub
routine has finished execution, control returns to the point in the main pro-
gram where it was suspended.

25315 First Cycle Flag


INT(89)

001

004

#0002

INT(89)

000

004

#0002 Set at 20 ms.


Main program
Main program execution

Interrupts every 20 ms Returned from


SBN(92) 99 scheduled
interrupt rou-
Subroutine tine
RET(93)

Address Instruction Operands Address Instruction Operands

00000 LD 25315
00001 INT(89) Main program.
001
004 00500 SBN(92) 99
# 0002
00002 INT(89) Subroutine.
000
004 00600 RET(93)
# 0002

192
Step Instructions