Você está na página 1de 612

PROGRAMMABLE CONTROLLER

FP0
Programming

This manual was created using Adobe Acrobat.


Adobe, the Adobe logo, and Acrobat are trademarks
of Adobe Systems Incorporated.
BEFORE BEGINNING
This manual and everything described in it are copyrighted. You may not copy this
manual, in whole or part, without written consent of Matsushita Electric Works, Ltd.

Matsushita Electric Works, Ltd. pursues a policy of continuous improvement of the


design and performance of its products, therefore, we reserve the right to change the
manual/product without notice. In no event will Matsushita Electric Works, Ltd. be
liable for direct, special, incidental, or consequential damage resulting from any
defect in the product or its documentation, even if advised of the possibility of such
damages.

LIMITED WARRANTY

If physical defects caused by distribution are found, Matsushita Electric Works, Ltd.,
will replace/repair the product free of charge. Exceptions include:
D When physical defects are due to different usage/treatment of the
product other than described in the manual.
D When physical defects are due to defective equipment other than the
distributed product.
D When physical defects are due to modifications/repairs by someone
other than Matsushita Electric Works, Ltd.
D When physical defects are due to natural disasters.

MS-DOS and Windows are registered trademarks of Microsoft Corporation.


IBM Personal Computer AT is a registered trademark of the International Business
Machines Corporation.
Table of Contents
Basic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
High - level Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

Chapter 1 Relays, Memory Areas and Constants

1.1 Type and Function of Relays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 - 3


1.2 Type and Function of Memory Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 - 12
1.3 Type and Function of Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 - 21
1.4 Data Ranges Which can be Handled in the PLC . . . . . . . . . . . . . . . . . . . . . 1 - 24
1.4.1 Data Ranges Which can be Handled in the PLC . . . . . . . . . . . . . 1 - 24
1.4.2 Overflow and Underflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 - 27

Chapter 2 Basic Instructions

2.1 Composition of Basic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 - 3


2.2 Table of Basic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 - 7
2.3 Explanation of Basic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 - 13

Chapter 3 High-level Instructions

3.1 Composition of High-level Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 3


3.1.1 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 3
3.1.2 High-level Instruction Numbers and Program Input . . . . . . . . . . . . 3 - 4
3.1.3 High-level Instructions and Execution Condition (Trigger) . . . . . . 3 - 4
3.1.4 Types of High-level Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 6
3.2 Table of High-level Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 11
3.3 Explanation of High - level Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 22

Chapter 4 Precautions During Programming4 - 1

4.1 Use of Duplicated Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3


4.1.1 Duplicated Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
4.1.2 When Output is Repeated with an OT, KP, SET, or RST
Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 4
4.2 Handling BCD Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 5
4.2.1 BCD Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 5
4.2.2 Handling BCD Data in the PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 5

i
Table of Contents FP0

4.3 Handling Index Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 7


4.3.1 Index Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 7
4.3.2 Memory Areas Which can be Modified with Index Registers . . . . 4 - 7
4.3.3 Example of Using an Index Register . . . . . . . . . . . . . . . . . . . . . . . . 4 - 8
4.4 Operation Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 10
4.4.1 Outline of Operation Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 10
4.4.2 Operation Mode When an Operation Error Occurs . . . . . . . . . . . 4 - 10
4.4.3 Dealing with Operation Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 11
4.4.4 Points to Check in Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 12
4.5 Instruction of Leading Edge Detection Method . . . . . . . . . . . . . . . . . . . . . . 4 - 13
4.5.1 Instructions of Leading Edge Detection Method . . . . . . . . . . . . . . 4 - 13
4.5.2 Operation and Precautions at Run Start Time . . . . . . . . . . . . . . . 4 - 14
4.5.3 Precautions When Using a Control Instruction . . . . . . . . . . . . . . . 4 - 16
4.6 Precautions for Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 18
4.7 Rewrite Function During RUN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 19
4.7.1 Operation of Rewrite During RUN . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 19
4.7.2 Cases Where Rewriting During Run is not Possible . . . . . . . . . . 4 - 20
4.7.3 Procedures and Operation of Rewrite During RUN . . . . . . . . . . . 4 - 21
4.7.4 Changing Modes in FP Programmer II . . . . . . . . . . . . . . . . . . . . . 4 - 22
4.8 Changing the Set Value of Timer/Counter During RUN . . . . . . . . . . . . . . . 4 - 23
4.8.1 Method of Rewriting Constant in FP Programmer II . . . . . . . . . . 4 - 23
4.8.2 Method of Rewriting a Value in the Set Value Area . . . . . . . . . . . 4 - 24
4.9 Processing During Forced Input and Output . . . . . . . . . . . . . . . . . . . . . . . . 4 - 27

Chapter 5 High - speed Counter/Pulse Output/ PWM Output

5.1 Outline of Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 3


5.1.1 Three Functions that Use Built- in High - speed Counter . . . . . . . . 5 - 3
5.1.2 Performance of Built- in High - speed Counter . . . . . . . . . . . . . . . . . 5 - 4
5.2 Specifications and Restricted Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 5
5.2.1 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 5
5.2.2 Functions and Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 7
5.3 High - speed Counter Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 9
5.3.1 Outline of High - speed Counter Function . . . . . . . . . . . . . . . . . . . . . 5 - 9
5.3.2 Types of Input Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 9
5.3.3 I/O Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 11
5.3.4 Instructions Used with High - speed Counter Function . . . . . . . . . 5 - 12
5.3.5 Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 14

ii
FP0 Table of Contents

5.4 Pulse Output Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 18


5.4.1 Outline of Pulse Output Function . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 18
5.4.2 Control Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 19
5.4.3 I/O Allocation and Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 20
5.4.4 Instructions Used with Pulse Output Function . . . . . . . . . . . . . . . 5 - 22
5.4.5 Sample Program for Positioning Control . . . . . . . . . . . . . . . . . . . . 5 - 25
5.5 PWM Output Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 33
5.5.1 Outline of PWM Output Function . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 33
5.5.2 Instruction Used with PWM Output Function . . . . . . . . . . . . . . . . 5 - 33

Chapter 6 General - use Serial Communications

6.1 General - use Serial Communications Function . . . . . . . . . . . . . . . . . . . . . . . 6 - 3


6.1.1 General - use Serial Communications . . . . . . . . . . . . . . . . . . . . . . . . 6 - 3
6.1.2 Data Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 - 3
6.1.3 Data Reception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 - 4
6.2 System Register Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 - 5
6.3 Explanation of Operations When Using General - use Serial
Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 - 8
6.3.1 If “None” is Set for Start and Terminal Codes . . . . . . . . . . . . . . . . . 6 - 8
6.3.2 If “Yes” has been Set for the Start and Terminal Codes
(Start Code: STX, Terminal Code: ETX) . . . . . . . . . . . . . . . . . . . . . 6 - 9

Chapter 7 Programming for FP0 Analog I/O Unit

7.1 Analog I/O Unit Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 - 3

Chapter 8 Appendix

8.1 Performance Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 3


8.2 I/O Allocation Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 7
8.3 Relays, Memory Areas and Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 9
8.4 Table of System Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 11
8.4.1 System Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 11
8.4.2 Content of System Register Settings . . . . . . . . . . . . . . . . . . . . . . . 8 - 13
8.4.3 Table of System Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 15
8.5 Table of Special Internal Relays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 26
8.6 Table of Special Data Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 29

iii
Table of Contents FP0

8.7 Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 39


8.7.1 Error Confirmation When “ERROR/ALARM LED” Turns ON . . . 8 - 39
8.7.1.1 Error Confirmation Method . . . . . . . . . . . . . . . . . . . . . 8 - 39
8.7.1.2 Syntax Check Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 39
8.7.1.3 Self - diagnostic Error . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 40
8.7.2 Table of Syntax Check Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 41
8.7.3 Table of Self - diagnostic Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 42
8.8 FP0 - SL1 S - LINK Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 43
8.9 Binary/Hexadecimal/BCD Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 44
8.10 ASCII Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 45

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I - 1
Record of changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . R - 1

iv
FP0 Table of Contents

Basic Instructions

Sequence basic instructions LOOP Loop . . . . . . . . . . . . . . . . . . 2 - 59


ST Start . . . . . . . . . . . . . . . . . . 2 - 14 ED End . . . . . . . . . . . . . . . . . . . 2 - 63
ST/ Start Not . . . . . . . . . . . . . . 2 - 14 CNDE Conditional end . . . . . . . . 2 - 64
OT Out . . . . . . . . . . . . . . . . . . . 2 - 14
/ Not . . . . . . . . . . . . . . . . . . . 2 - 16
Step ladder instructions
AN AND . . . . . . . . . . . . . . . . . . 2 - 17 SSTP Start step . . . . . . . . . . . . . . 2 - 66
NSTL Next step . . . . . . . . . . . . . . 2 - 66
AN/ AND Not . . . . . . . . . . . . . . 2 - 17
NSTP Next step . . . . . . . . . . . . . . 2 - 66
OR OR . . . . . . . . . . . . . . . . . . . 2 - 18
CSTP Clear step . . . . . . . . . . . . . 2 - 66
OR/ OR Not . . . . . . . . . . . . . . . . 2 - 18
STPE Step end . . . . . . . . . . . . . . 2 - 66
ANS AND stack . . . . . . . . . . . . . 2 - 19
ORS OR stack . . . . . . . . . . . . . . 2 - 21
Subroutine instructions
PSHS Push stack . . . . . . . . . . . . 2 - 23
CALL Subroutine call . . . . . . . . . 2 - 76
RDS Read stack . . . . . . . . . . . . 2 - 23
SUB Subroutine entry . . . . . . . . 2 - 76
POPS Pop stack . . . . . . . . . . . . . 2 - 23
RET Subroutine return . . . . . . . 2 - 76
DF Leading edge differential . 2 - 26
DF/ Trailing edge differential . 2 - 26 Interrupt instructions
SET Set . . . . . . . . . . . . . . . . . . . 2 - 30 INT Interrupt . . . . . . . . . . . . . . . 2 - 79
RST Reset . . . . . . . . . . . . . . . . . 2 - 30 IRET Interrupt return . . . . . . . . . 2 - 79
KP Keep . . . . . . . . . . . . . . . . . . 2 - 32 ICTL Interrupt control . . . . . . . . 2 - 84
NOP No operation . . . . . . . . . . . 2 - 34
Data compare instructions
Basic function instructions ST= 16 - bit data compare
TML On - delay timer TML . . . . 2 - 35 (Start) . . . . . . . . . . . . . . . . . 2 - 90

TMR On - delay timer TMR . . . . 2 - 35 ST<> 16 - bit data compare


(Start) . . . . . . . . . . . . . . . . . 2 - 90
TMX On - delay timer TMX . . . . 2 - 35
ST> 16 - bit data compare
TMY On - delay timer TMY . . . . 2 - 35 (Start) . . . . . . . . . . . . . . . . . 2 - 90
CT Counter . . . . . . . . . . . . . . . 2 - 42 ST>= 16 - bit data compare
(Start) . . . . . . . . . . . . . . . . . 2 - 90
SR Shift register . . . . . . . . . . . 2 - 49
ST< 16 - bit data compare
(Start) . . . . . . . . . . . . . . . . . 2 - 90
Control instructions ST<= 16 - bit data compare
MC Master control relay . . . . . 2 - 52 (Start) . . . . . . . . . . . . . . . . . 2 - 90

MCE Master control relay end . 2 - 52 STD= 32 - bit data compare


(Start) . . . . . . . . . . . . . . . . . 2 - 92
JP Jump . . . . . . . . . . . . . . . . . 2 - 56
STD<> 32 - bit data compare
LBL Label . . . . . . . . . . . 2 - 56, 2 - 59 (Start) . . . . . . . . . . . . . . . . . 2 - 92

v
Table of Contents FP0

STD> 32 - bit data compare ORD<> 32 - bit data compare


(Start) . . . . . . . . . . . . . . . . . 2 - 92 (OR) . . . . . . . . . . . . . . . . . 2 - 100
STD>= 32 - bit data compare ORD> 32 - bit data compare
(Start) . . . . . . . . . . . . . . . . . 2 - 92 (OR) . . . . . . . . . . . . . . . . . 2 - 100
STD< 32 - bit data compare
ORD>= 32 - bit data compare
(Start) . . . . . . . . . . . . . . . . . 2 - 92
(OR) . . . . . . . . . . . . . . . . . 2 - 100
STD<= 32 - bit data compare
(Start) . . . . . . . . . . . . . . . . . 2 - 92 ORD< 32 - bit data compare
(OR) . . . . . . . . . . . . . . . . . 2 - 100
AN= 16 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 94 ORD<= 32 - bit data compare
AN<> 16 - bit data compare (OR) . . . . . . . . . . . . . . . . . 2 - 100
(AND) . . . . . . . . . . . . . . . . . 2 - 94
AN> 16 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 94
AN>= 16 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 94
AN< 16 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 94
AN<= 16 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 94
AND= 32 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 96
AND<> 32 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 96
AND> 32 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 96
AND>= 32 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 96
AND< 32 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 96
AND<= 32 - bit data compare
(AND) . . . . . . . . . . . . . . . . . 2 - 96
OR= 16 - bit data compare
(OR) . . . . . . . . . . . . . . . . . . 2 - 98
OR<> 16 - bit data compare
(OR) . . . . . . . . . . . . . . . . . . 2 - 98
OR> 16 - bit data compare
(OR) . . . . . . . . . . . . . . . . . . 2 - 98
OR>= 16 - bit data compare
(OR) . . . . . . . . . . . . . . . . . . 2 - 98
OR< 16 - bit data compare
(OR) . . . . . . . . . . . . . . . . . . 2 - 98
OR<= 16 - bit data compare
(OR) . . . . . . . . . . . . . . . . . . 2 - 98
ORD= 32 - bit data compare
(OR) . . . . . . . . . . . . . . . . . 2 - 100

vi
FP0 Table of Contents

High - level Instructions

Data transfer instructions


F0 MV 16-bit data move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 23
F1 DMV 32-bit data move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 24
F2 MV/ 16-bit data invert and move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 25
F3 DMV/ 32-bit data invert and move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 27
F5 BTM Bit data move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 29
F6 DGT Hexadecimal digit (4-bit) data move . . . . . . . . . . . . . . . . . . . . . . . . 3 - 31
F10 BKMV Block move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 34
F11 COPY Block copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 36
F12 ICRD Data read from EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 38
P13 PICWT Data write to EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 40
F15 XCH 16-bit data exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 42
F16 DXCH 32-bit data exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 44
F17 SWAP Higher/ lower byte in 16-bit data exchange . . . . . . . . . . . . . . . . . . 3 - 46

Binary arithmetic instructions


F20 + 16-bit data addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 47
F21 D+ 32-bit data addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 49
F22 + 16-bit data addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 51
F23 D+ 32-bit data addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 53
F25 - 16-bit data subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 55
F26 D- 32-bit data subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 57
F27 - 16-bit data subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 59
F28 D- 32-bit data subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 61
F30 * 16-bit data multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 63
F31 D* 32-bit data multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 65
F32 % 16-bit data division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 67
F33 D% 32-bit data division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 69
F35 +1 16-bit data increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 71
F36 D+1 32-bit data increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 73
F37 -1 16-bit data decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 75
F38 D-1 32-bit data decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 77

BCD arithmetic instructions


F40 B+ 4-digit BCD data addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 79

vii
Table of Contents FP0

F41 DB+ 8-digit BCD data addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 81


F42 B+ 4-digit BCD data addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 83
F43 DB+ 8-digit BCD data addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 85
F45 B- 4-digit BCD data subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 87
F46 DB - 8-digit BCD data subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 89
F47 B- 4-digit BCD data subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 91
F48 DB - 8-digit BCD data subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 93
F50 B* 4-digit BCD data multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 95
F51 DB* 8-digit BCD data multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 97
F52 B% 4-digit BCD data division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 99
F53 DB% 8-digit BCD data division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 101
F55 B+1 4-digit BCD data increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 103
F56 DB+1 8-digit BCD data increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 105
F57 B-1 4-digit BCD data decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 107
F58 DB - 1 8-digit BCD data decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 109

Data comparison instructions


F60 CMP 16-bit data compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 111
F61 DCMP 32-bit data compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 115
F62 WIN 16-bit data band compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 119
F63 DWIN 32-bit data band compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 121
F64 BCMP Block data compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 123

Logic operation instructions


F65 WAN 16-bit data AND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 126
F66 WOR 16-bit data OR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 128
F67 XOR 16-bit data exclusive OR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 130
F68 XNR 16-bit data exclusive NOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 132

Data conversion instructions


F70 BCC Block check code calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 134
F71 HEXA Hexadecimal data → ASCII code . . . . . . . . . . . . . . . . . . . . . . . . 3 - 137
F72 AHEX ASCII code → Hexadecimal data . . . . . . . . . . . . . . . . . . . . . . . . 3 - 140
F73 BCDA 4-digit BCD data → ASCII code . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 144
F74 ABCD ASCII code → 4-digit BCD data . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 148
F75 BINA 16-bit binary data → ASCII code . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 152
F76 ABIN ASCII code → 16-bit binary data . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 155
F77 DBIA 32-bit binary data → ASCII code . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 158

viii
FP0 Table of Contents

F78 DABI ASCII code → 32-bit binary data . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 161


F80 BCD 16-bit binary data → 4-digit BCD data . . . . . . . . . . . . . . . . . . . . . 3 - 165
F81 BIN 4-digit BCD data → 16-bit binary data . . . . . . . . . . . . . . . . . . . . . 3 - 167
F82 DBCD 32-bit binary data → 8-digit BCD data . . . . . . . . . . . . . . . . . . . . . 3 - 169
F83 DBIN 8-digit BCD data → 32-bit binary data . . . . . . . . . . . . . . . . . . . . . 3 - 170
F84 INV 16-bit data invert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 171
F85 NEG 16-bit data complement of 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 172
F86 DNEG 32-bit data complement of 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 173
F87 ABS 16-bit data absolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 174
F88 DABS 32-bit data absolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 175
F89 EXT 16-bit data sign extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 176
F90 DECO Decode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 178
F91 SEGT 7-segment decode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 181
F92 ENCO Encode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 183
F93 UNIT 16-bit data combine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 186
F94 DIST 16-bit data distribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 188
F95 ASC Character → ASCII code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 190
F96 SRC 16-bit table data search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 193

Data shift instructions


F100 SHR Right shift of multiple bits (n bits) in a 16-bit data . . . . . . . . . . . 3 - 195
F101 SHL Left shift of multiple bits (n bits) in a 16-bit data . . . . . . . . . . . . . 3 - 197
F105 BSR Right shift of one hexadecimal digit (4-bit) . . . . . . . . . . . . . . . . . 3 - 199
F106 BSL Left shift of one hexadecimal digit (4-bit) . . . . . . . . . . . . . . . . . . 3 - 201
F110 WSHR Right shift of one word (16-bit) . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 203
F111 WSHL Left shift of one word (16-bit) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 205
F112 WBSR Right shift of one hexadecimal digit (4-bit) . . . . . . . . . . . . . . . . . 3 - 207
F113 WBSL Left shift of one hexadecimal digit (4-bit) . . . . . . . . . . . . . . . . . . 3 - 209

Basic function instructions


F118 UDC UP/DOWN counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 211
F119 LRSR Left/right shift register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 214

Data rotate instructions


F120 ROR 16-bit data right rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 217
F121 ROL 16-bit data left rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 219
F122 RCR 16-bit data right rotate with carry flag (R9009) data . . . . . . . . . 3 - 221
F123 RCL 16-bit data left rotate with carry flag (R9009) data . . . . . . . . . . 3 - 223

ix
Table of Contents FP0

Bit manipulation instructions


F130 BTS 16-bit data bit set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 225
F131 BTR 16-bit data bit reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 227
F132 BTI 16-bit data bit invert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 229
F133 BTT 16-bit data bit test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 231
F135 BCU Number of on (1) bits in 16-bit data . . . . . . . . . . . . . . . . . . . . . . . 3 - 233
F136 DBCU Number of on (1) bits in 32-bit data . . . . . . . . . . . . . . . . . . . . . . . 3 - 234

Basic function instruction


F137 STMR Auxiliary timer (16 - bit) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 235

Special instructions
F140 STC Carry flag (R9009) set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 238
F141 CLC Carry flag (R9009) reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 239
F143 IORF Partial I/O update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 240
F144 TRNS Serial data communication control for R232C port . . . . . . . . . . 3 - 241
F147 PR Printout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 247
F148 ERR Self-diagnostic error set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 251
F149 MSG Message display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 253

Special instructions (High - speed counter instructions)


F0 MV High - speed counter control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 254
F1 DMV Change and read of the elapsed value of high- speed counter 3 - 257
F166 HC1S Target value match on instruction (with channel specification) 3 - 260
F167 HC1R Target value match off instruction (with channel specification) 3 - 262
F168 SPD1 Positioning control (with channel specification) . . . . . . . . . . . . 3 - 264
F169 PLS Pulse output instruction (with channel specification) . . . . . . . . . 3 - 268
F170 PWM PWM output instruction (with channel specification) . . . . . . . . . 3 - 270

Basic function instruction


F183 DSTM Auxiliary timer (32-bit) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 272

Floating point type real number operation instructions


F309 FMV Floating point type data move . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 275
F310 F+ Floating point type data addition . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 277
F311 F- Floating point type data subtraction . . . . . . . . . . . . . . . . . . . . . . . 3 - 279
F312 F* Floating point type data multiplication . . . . . . . . . . . . . . . . . . . . . 3 - 281
F313 F% Floating point type data division . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 283

x
FP0 Table of Contents

F314 SIN Floating point type data sine operation . . . . . . . . . . . . . . . . . . . . 3 - 285


F315 COS Floating point type data cosine operation . . . . . . . . . . . . . . . . . . 3 - 287
F316 TAN Floating point type data tangent operation . . . . . . . . . . . . . . . . . 3 - 289
F317 ASIN Floating point type data arcsine operation . . . . . . . . . . . . . . . . . 3 - 291
F318 ACOS Floating point type data arccosine operation . . . . . . . . . . . . . . . 3 - 293
F319 ATAN Floating point type data arctangent operation . . . . . . . . . . . . . . 3 - 295
F320 LN Floating point type data natural logarithm . . . . . . . . . . . . . . . . . . 3 - 297
F321 EXP Floating point type data exponent . . . . . . . . . . . . . . . . . . . . . . . . 3 - 299
F322 LOG Floating point type data logarithm . . . . . . . . . . . . . . . . . . . . . . . . 3 - 301
F323 PWR Floating point type data power . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 303
F324 FSQR Floating point type data square root . . . . . . . . . . . . . . . . . . . . . . 3 - 305
F325 FLT 16-bit integer data to floating point type data conversion . . . . . 3 - 307
F326 DFLT 32-bit integer data to floating point type data conversion . . . . . 3 - 309
F327 INT Floating point type data to 16-bit integer conversion
(the largest integer not exceeding the floating point type
data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 311
F328 DINT Floating point type data to 32-bit integer conversion
(the largest integer not exceeding the floating point type
data) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 313
F329 FIX Floating point type data to 16-bit integer conversion
(rounding the first decimal point down to integer) . . . . . . . . . . . 3 - 315
F330 DFIX Floating point type data to 32-bit integer conversion
(rounding the first decimal point down to integer) . . . . . . . . . . . 3 - 317
F331 ROFF Floating point type data to 16-bit integer conversion
(rounding the first decimal point off to integer) . . . . . . . . . . . . . . 3 - 319
F332 DROFF Floating point type data to 32-bit integer conversion
(rounding the first decimal point off to integer) . . . . . . . . . . . . . . 3 - 321
F333 FINT Floating point type data rounding the first decimal
point down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 323
F334 FRINT Floating point type data rounding the first decimal
point off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 325
F335 F+/ - Floating point type data sign changes . . . . . . . . . . . . . . . . . . . . . 3 - 327
F336 FABS Floating point type data absolute . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 329
F337 RAD Floating point type data degrees → radians . . . . . . . . . . . . . . . . 3 - 331
F338 DEG Floating point type data radians → degrees . . . . . . . . . . . . . . . . 3 - 333

Time series processing instruction


F355 PID PID processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 335

xi
Table of Contents FP0

xii
Chapter 1
Relays, Memory Areas and Constants

1.1 Type and Function of Relays . . . . . . . . . . . . . . . . . . . . . 1 - 3

1.2 Type and Function of Memory Areas . . . . . . . . . . . . . 1 - 12

1.3 Type and Function of Constants . . . . . . . . . . . . . . . . . 1 - 21

1.4 Data Ranges Which can be Handled in the PLC . . . 1 - 24


1.4.1 Data Ranges Which can be Handled
in the PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 - 24
1.4.2 Overflow and Underflow . . . . . . . . . . . . . . . . 1 - 27
Relays, Memory Areas and Constants FP0

1- 2
FP0 Relays, Memory Areas and Constants

1.1 Type and Function of Relays

1.1 Type and Function of Relays

Item Numbering Function


C10/C14/C16/C32/T32/SL1
Relays External input X 208 points (X0 to X12F) Turns on or off based on external input.
relay (* Note 1)
External output Y 208 points (Y0 to Y12F) Externally outputs on or off state.
relay (* Note 1)
Internal relay R 1,008 points (R0 to R62F) Relay which turns on or off only within
(* Note 2) program.
Timer T 144 points (* Note 3) If a TM instruction has timed out, the con-
(* Note 2) (T0 to T99/C100 to C143) tact with the same number turns on.
Counter C If a CT instruction has counted up, the
(* Note 2) contact with the same number turns on.
Special internal R 64 points (R9000 to R903F) Relay which turns on or off based on spe-
relay cific conditions and is used as a flag.
For detailed information section 8.5

Notes

1) The number of points noted is the number of points which the


system has. For the actual number of points, refer to the table
of I/O allocations in section 8.2.
2) There are two unit types, the hold type that saves the
conditions that exist just before turning the power off or
changing from the RUN mode to PROG. mode, and the
non - hold type that resets them. For the FP0 T32, the selection
of hold type and non - hold type can be changed by the setting
of system register ( section 8.4).
For the FP0 C10/C14/C16/C32/SL1, that area is fixed and
allotted the numbers as shown below.
Hold type and Non-hold type areas
Item C10/C14/C16 C32/SL1
Timer All non-hold type
Counter Non-hold type From the set value to C139 From the set value to C127
Hold type 4 points (C140 to C143) 16 points (C128 to C143)
Internal relay Non-hold type 976 points (R0 to R60F) 880 points (R0 to R54F)
61 words (WR0 to WR60) 55 words (WR0 to WR54)
Hold type 32 points (R610 to R62F) 128 points (R550 to R62F)
2 words (WR61 to WR62) 8 words (WR55 to WR62)

3) The points for the timer and counter can be changed by the
setting of system register 5. The numbers given in the table
are the numbers when system register 5 is at its default
setting. For more detailed information section 8.4

1- 3
Relays, Memory Areas and Constants FP0

1.1 Type and Function of Relays

How to Specify Relay Numbers


External input relays (X), External output relays (Y), and Internal relays (R)
Since external input relays (X), external output relays (Y) and internal relays (R) are
handled in units of 16 points, they are expressed as a combination of decimal and
hexadecimal numbers as shown below.

Example: External input relay (X)


X

Decimal number
1, 2, 3⋅⋅⋅⋅⋅⋅⋅⋅12

Hexadecimal number
0, 1, 2, 3,⋅⋅⋅⋅⋅ 9, A, B⋅⋅⋅⋅⋅F

X 0, X 1 . . . . . . . . . . . . . . . . . . . . X F
X 10, X 11 . . . . . . . . . . . . . . . . . . . . X 1F
X 20, X 21 . . . . . . . . . . . . . . . . . . . . X 2F
to to . . . . . . . . . . . . . . . . . . . . . . . . to
X120, X121 . . . . . . . . . . . . . . . . . . . . X12F

Timers (T) and Counters (C)


The addresses for timer contacts (T) and counter contacts (C) are correspond to the
timer and counter instruction numbers and expressed in decimals as shown below.

Example: Timer contact


T

Decimal number
0, 1, 2,⋅⋅⋅⋅⋅⋅⋅99

T0, T1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T99
C100, C101 . . . . . . . . . . . . . . . . . . . . . . . . . . . . C143

Note
Counters and timers share the same area. The division of the
area can be changed with system register 5. (The table and
example are when settings are the default values.)

1- 4
FP0 Relays, Memory Areas and Constants

1.1 Type and Function of Relays

Relay Number of External I/O Relays


Only relays with numbers actually allocated to input contacts can be used as external
input relay (X).
Only relays with numbers actually allocated to output contacts can output as external
output relay (Y). The external output relays (Y) which are not allocated can be used as
internal relays.
Allocation of numbers is determined by the combination of units used. For detailed
information section 8.2

Number of Points for Timer and Counter


If you do not have enough timer or counter points, you can change the number of points
by setting system register 5. However, the overall number of counter and timer points
cannot be changed.
For detailed information about the system register setting section 8.4

Relation of WX, WY and WR to X, Y and R


WX, WY and WR correspond respectively to groups of 16 external input relay (X) points,
16 external output relay (Y) points and 16 internal relay (R) points.

Example: Word external input relay (WX)


Each relay is composed of 16 external input relay (X) points as
shown below.

XFXE XDXCXB XA X9 X8 X7 X6 X5 X4 X3 X2 X1 X0
WX0

X1F X1E X1D X12 X11 X10

WX1

X12FX12E X12D X122 X121X120

WX12

When the state of an external input relay (X) changes, the


content of WX also changes.

1- 5
Relays, Memory Areas and Constants FP0

1.1 Type and Function of Relays

External Input Relays (X)


Function of external input relays (X)
This relay feeds signals to the programmable controller from an external device such
as a limit switch or a photoelectric sensor and the intelligent units.

Program
X contact: on
X Y Operation Input
control inter- Input: on
section face
Input

Usage restrictions
The addresses for inputs which do not actually exist cannot be used.
The on or off status of the external input relays cannot be changed by the operation
(program).
There is no limitation regarding the number of times one external input relay is
programmed.

External Output Relays (Y)


Function of external output relays (Y)
This relay outputs the program operation result at operation control section and
activates the load (external device) such as a solenoid or operating panel.
The on or off status of the external output relay is output as a control signal.

Program
Output relay
Operation Output
X R Y inter-
control Load: on
face
R section output
Operation Output

Usage restrictions
External output relays which are not actually allocated can be used in the same way as
internal relays. However, they cannot be specified as hold types.
When used as contacts, there are no restrictions on the number of times that can be
used.
As a rule, when specified as the output destination for operation results of OT and KP
instructions, use is limited to once in a program (to inhibit double output).

1- 6
FP0 Relays, Memory Areas and Constants

1.1 Type and Function of Relays

Note
You can permit duplicated use of an output by changing the
system register 20 setting. Even if the same relay is used as an
operand for instructions such as SET and RST, it is not regarded
as duplicated use of outputs.
Example of duplicated use of external output relay (Y3)
Y3

Y3 Duplicated output

Internal Relays (R)


Function of internal relays (R)
This relay can be used only within program and on or off status does not provide an
external output. When the coil of the relay is energized, its contacts turn on.
Internal
relay
R0

R0
F0 MV

Usage restrictions
When used as contacts, there are no restrictions on the number of times that can be
used.
As a rule, when specified as the output destination for operation results of OT and KP
instructions, use is limited to once in a program (to inhibit double output).

Note
You can permit duplicated use of an output by changing the
system register 20 setting. Even if the same relay is used as an
operand for instructions such as SET and RST, it is not regarded
as duplicated use of outputs.

1- 7
Relays, Memory Areas and Constants FP0

1.1 Type and Function of Relays

Non- hold type relay and hold type relay


There are two types of internal relays: hold type relays and non - hold type relays. When
the power is turned off or the mode changed from RUN to PROG.
Hold type relays hold their on or off status and resume operation in that status when the
system is restarted.
Non - hold type relays reset.
For the FP0 C10/C14/C16/C32/SL1, non - hold type and hold type relay numbers are
as follows:
Item C10/C14/C16 C32/SL1
Internal Non-hold 976 points (R0 to R60F) 880 points (R0 to R54F)
y
relay type 61 words (WR0 to WR60) 55 words (WR0 to WR54)
Hold type 32 points (R610 to R62F) 128 points (R550 to R62F)
2 words (WR61 to WR62) 8 words (WR55 to WR62)

For FP0 T32, system register 7 can be used to specify whether a hold type or a non - hold
type is used. If the beginning of a hold type relay is specified using a word number,
relays before that point will be non - hold types, and subsequent relays will be hold
types.

Non-hold
type
Value of system register 7
(initial number of hold type)
Hold type

Default settings for hold types and non - hold types


Item T32
Internal Non - hold 160 points (R0 to R9F)
y
relay type 10 words (WR0 to WR9)
Hold type 848 points (R100 to R62F)
53 words (WR10 to WR62)

1- 8
FP0 Relays, Memory Areas and Constants

1.1 Type and Function of Relays

Special Internal Relays (from R9000)


Function of special internal relays
The special internal relays turn on or off under specific conditions. The on or off state
is not externally output and only functions within the program.

The principal special internal relays are as follows:


Operation status flags:
Operation status is indicated by on or off.
- Operation (RUN mode) in progress (R9020)
- Turns on and off at each scan (R9012)
- Result of comparison instruction (R900A to R900C)
- High - speed counter control flag (R903A to R903D)
Error flags:
Turns on when an error occurs.
- Operation error (R9007, R9008)
Relays which turn on and off under special conditions:
The required conditions can be selected in the program and the relays used
accordingly.
- Always on relay (R9010)
- Clock pulse relay (R9018 to R901E)

REFERENCE
For detailed information about the content of special internal relay
section 8.5

1- 9
Relays, Memory Areas and Constants FP0

1.1 Type and Function of Relays

Timer (T)
Function of timers (T)
When a timer is activated and the set time elapses, the timer contact with the same
number as the timer turns on.
When the timer is in the time - up state and the timer execution condition (trigger) turns
off, the timer contact turns off.
TM n
Time - up
Timer number
Tn: on

Tn

Timer contact: on n: Timer number

Usage restrictions
When used as contacts, there are no restrictions on the number of times that can be
used.

Counter (C)
Function of counters (C)
When the decrement - type preset counter is activated and the elapsed value reaches
zero, the counter contact with the same number as the counter turns on.
When the counter’s reset input is turned on, the counter contact turns off.
Count input Counter number
CT n
Reset input
Count - up

Cn:on

Cn

Counter contact: on n: Counter number

Usage restrictions
When used as contacts, there are no resrictions on the number of times that can be
used.

1 - 10
FP0 Relays, Memory Areas and Constants

1.1 Type and Function of Relays

Items Shared by the Timer and Counter


Timer and counter partitioning
Timers and counters share the same area. The partitioning of the area can be changed
to obtain the number of timers or counters needed.
Partition the area by setting system register 5.
0

Timers to (T0 to T99)


99
100

Counters to (C100 to C143)


143

Set the number of the leading counter in system register 5. The initial setting is 100,
therefore 100 points are timers and 44 points are counters as shown above.
For detailed information about the system register setting section 8.4

Hold type and non - hold type partitioning


The contents of timer contacts, counter contacts, set value areas and elapsed value
areas can be held when the power is turned off or the mode switched from RUN to
PROG., and operation later resumed based on those contents.

In the case of the FP0 C10/C14/C16/C32/SL1, the areas which hold their contents
when the power is turned off are fixed as shown below. System register settings 6 to
8 as well as 14 become invalid.
Timer Non- hold type: all points
Counter Non- hold type C10, C14, C16: From set value to C139
C32, SL1: From set value to C127
Hold type C10, C14, C16: C140 to C143
C32, SL1: C128 to C143

For the FP0 T32, system register 6 can be used to specify whether a hold type or a
non - hold type is used. If the beginning of a hold type is specified using a word number,
the contents of timer/counter contacts before that point will be non - hold types, and
subsequent the contents of timer/counter contacts will be hold types.
Default settings for hold types and non - hold types
Non - hold type Hold type
T0 to T99 (100 points) C100 to C143 (44 points)

If the same value is set for system register 5 and 6, timers are non - hold types, and
counters are hold types. Normally, the same value should be set for both system
registers.

1 - 11
Relays, Memory Areas and Constants FP0

1.2 Type and Function of Memory Areas

1.2 Type and Function of Memory Areas


Item Numbering Function
C10/C14/ C32/SL1 T32
C16
Memory External input WX 13 words (WX0 to WX12) Code for specifying 16 external input
Areas relay (* Note 1) points as one word (16 bits) of data.
External output WY 13 words (WY0 to WY12) Code for specifying 16 external output
relay (* Note 1) points as one word (16 bits) of data.
Internal relay WR 63 words (WR0 to WR62) Code for specifying 16 internal relay
points as one word (16 bits) of data.
Data register DT 1,660 6,144 16,384 Data memory used in program. Data
(* Note 2) words words words is handled in 16-bit units (one word).
(DT0 to (DT0 to (DT0 to
DT1659) DT6143) DT16383)
Timer/Counter SV 144 words (SV0 to SV143) Data memory for storing a target value
set value area of a timer and an initial value of a
(* Note 3) counter. Stores by timer/counter num-
ber.
Timer/Counter EV 144 words (EV0 to EV143) Data memory for storing the elapsed
elapsed value value during operation of a timer/
area counter. Stores by timer/counter num-
(* Note 3) ber.
Special data DT 112 words 112 words Data memory for storing specific data.
register (DT9000 to DT9111) (DT90000 Various settings and error codes are
to stored. ( section 8.6)
DT90111)
Index register IX 2 words (IX, IY) Register can be used as an address of
IY memory area and constants modifier.

Notes

1) The number of points noted is the number of points which the


system has. For the actual number of points, refer to the table
of I/O allocations in section 8.2.
2) There are two unit types, the hold type that saves the
conditions that exist just before turning the power off or
changing from the RUN mode to PROG. mode, and non - hold
type that resets them. For the FP0 T32, the selection of hold
type and non - hold type can be changed by the setting of
system register. ( section 8.4)
For the FP0 C10/C14/C16/C32/SL1, that area is fixed and
allotted the numbers as shown below.
Hold type and Non-hold type areas
Item C10/C14/C16 C32/SL1
Data register Non-hold type 1652 words 6112 words
(DT0 to DT1651) (DT0 to DT6111)
Hold type 8 words 32 words
(DT1652 to DT1659) (DT6112 to DT6143)

1 - 12
FP0 Relays, Memory Areas and Constants

1.2 Type and Function of Memory Areas

3) The points for the timer and counter can be changed by the
setting of system register 5. The numbers given in the table
are the numbers when system register 5 is at its default
setting.
For detailed information section 8.4

Data Register (DT)


Function of data registers (DT)
Data registers are memory areas which are handled in word (16 - bit) units, and are used
to store data such as numerical data configured of 16 bits.
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DTn 0 0 0 1 1 0 1 0 0 1 0 1 1 0 0 0

Example of a program which writes a numeric value to DTn.

F0, MV, ffff, DT n

Decimal constant (K) or


hexadecimal constant (H)

When 32-bit (double word) data is handled in data registers, use two data registers as
a set. The number of the data register for the lower 16 bits is specified.
DTn+1 DTn
0 0 0 1 1 0 1 0 0 1 0 1 0 0 1 0 0 0 0 1 1 0 1 0 0 1 0 1 1 0 0 0

higher 16-bit area lower 16-bit area

1 - 13
Relays, Memory Areas and Constants FP0

1.2 Type and Function of Memory Areas

Non- hold type data and hold type data


There are two types of data registers which handle data differently when the power is
turned off or the mode is changed from RUN to PROG.:
Hold type data registers hold their contents while operation stops and allow operation
to be restarted with the contents still effective.
Non - hold type data registers reset when operation stops.

In the case of the FP0 C10/C14/C16/C32/SL1, non - hold type and hold type register
numbers are as shown in the following table.
Item C10/C14/C16 C32/SL1
Data register Non - hold type 1652 words (DT0 to DT1651) 6112 words (DT0 to DT6111)
Hold type 8 words (DT1652 to DT1659) 32 words (DT6112 to DT6143)

For the FP0 T32, system register 8 can be used to specify whether hold types or
non - hold types are to be used. If the beginning of a hold type data register is specified
using a word number, data registers before that point will be non - hold types, and
subsequent data registers will be hold types.

Non-hold
type
Value of system register 8
(initial number of hold type)
Hold type

For the default value, all data registers are hold types (set value: 0).

1 - 14
FP0 Relays, Memory Areas and Constants

1.2 Type and Function of Memory Areas

Special Data Registers (from DT9000/DT90000)


Function of the special data registers
These data registers have specific applications.
Data cannot be written to most of them using instructions such as F0 (MV).

The main functions of these registers are:


Environmental settings and operation statuses
The operation statuses of the PLC (programmable controller) specified with the system
registers and the various types of instructions are stored.
- High - speed counter control register (DT9052/DT90052) etc.
Error contents
The unit in which the error occurred, and other information, is stored.
- Self - diagnostic error code (DT9000/DT90000)
- Address where the operation error occurred (DT9017/DT90017)
High - speed counter
These registers are used for reading and writing the target value and elapsed value of
the high- speed counters.
- High - speed counter elapsed/target value area
(DT9044 to DT9051/DT9104 to DT9111, DT90044 to DT90051/DT90104 to
DT90111)
Clock/calendar timers (can be used with FP0 T32C only)
The year, month, day, hour, minute, second, and day of the week tracked by the
calendar timer are stored here (DT90054 to DT90057).

Note
The values stored for the clock/calendar timer can be overwritten
(to calibrate the date and time). Values should be written to
DT90054 to DT90057 either using the F0 (MV) instruction or
directly, using programming tools.

1 - 15
Relays, Memory Areas and Constants FP0

1.2 Type and Function of Memory Areas

WX, WY and WR
Function of WX, WY and WR
Relays (X, Y, R) can be handled as blocks of 16 points.
These are one - word (16 - bit) memory areas, thus they can be treated as data memory.
The composition of the one - word memory areas is as follows.
The numbers correspond to the words as shown.
WR0
RF RE RD RC RB RA R9 R8 R7 R6 R5 R4 R3 R2 R1 R0

WR1
R1F R1E · · · · · · · · · · · R12 R11 R10

WR2
R2F R2E · · · · · · · · · · · R22 R21 R20

Examples of using WX, WY and WR


WX can be used to read in digital switch and keyboard inputs, and WY can be used for
output to 7 - segment displays.
WR can also be used as a shift register.
All of the relays can be used to monitor 16 - bit words.
Precautions concerning usage
If an on or off status of one of the relays composing the memory area changes, the
memory area value will also change.
WR0
0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1

When R1 is turned on

WR0
0 0 0 0 1 1 0 0 0 1 0 0 1 0 1 1

1 - 16
FP0 Relays, Memory Areas and Constants

1.2 Type and Function of Memory Areas

Set Value Area for Timer/Counter (SV)


Function of set value areas (SV)
A set value for a timer or counter is stored in the set value area (SV) with the same
number as the timer or counter.
Set value
TM n, K30

SVn
K30
(Decimal number)

A decimal number or SV area number is specified for the set value when the TM or CT
instruction is entered in the program.
An SV is a one - word, 16 - bit memory area which stores a decimal number from K0 to
K32767.
Using set value area (SV)
During RUN mode, a set value for a timer or counter can be changed by rewriting the
corresponding set value area.
The value in a set value area can be read and changed from the program by specifying
the destination and other information in a data transfer instruction.
The value in a set value area can be read and rewritten using a programming tool.
- Using programming tool software (NPST - GR/FPWIN GR)
In the online monitor, execute “MONITOR & TEST RUN”/“Monitoring
Registers” and specify the set value area.
- Using FP Programmer II
Execute “OP8” and specify the set value area.
For detailed information section 4.8
SV and EV areas are in a one - to - one correspondence with timers and counters.
Timer/Counter Set value area Elapsed value
number (SV) area (EV)
T0 SV0 EV0
T1 SV1 EV1
⋮ ⋮ ⋮
T99 SV99 EV99
C100 SV100 EV100
⋮ ⋮ ⋮

1 - 17
Relays, Memory Areas and Constants FP0

1.2 Type and Function of Memory Areas

Elapsed Value Area for Timer/Counter (EV)


Function of elapsed value areas (EV)
While a timer or counter is operating, the elapsed value is stored in the elapsed value
area (EV) with the same number as the timer or counter.
When the EV reaches zero, the timer or counter contact with the same number turns
on.
An EV is a one - word, 16 - bit memory area which stores a decimal number from K0 to
K32767.
Value of SVn
SVn EVn
TM n, K 30 K30 K30
0

Value of EVn 29
Tn
28

Decrements

EVn
Tn turns on when decrement operation ends
0

Using elapsed value area (EV)


The elapsed value of a timer or counter in operation can be changed to prolong or
shorten the operation.
The value in elapsed value area can be read and changed from the program by
specifying the a data transfer instruction.
The value in elapsed value area can be read and rewritten using a programming tool.
- Using programming tool software (NPST - GR/FPWIN GR)
In the online monitor, execute “MONITOR & TEST RUN”/“Monitoring
Registers” and specify the elapsed value area.
- Using FP Programmer II
Execute “OP8” and specify the elapsed value area.
For detailed information section 4.8

1 - 18
FP0 Relays, Memory Areas and Constants

1.2 Type and Function of Memory Areas

Index Registers (IX, IY)


Function of index registers (IX, IY)
Index registers are used to indirectly specify constants and memory area addresses in
high- level instructions. Two 16 - bit registers are available, IX and IY. Changing
addresses and constants using a value in an index register is called “index
modification”.
Modifying an address
Address = Base address + Value in IX or IY (K constant)

Example: Modifying DT11

IXDT11
Base address IX value Target address
11 + K0 = DT11
11 + K10 = DT21
11 + K - 10 = DT1

Modifying a constant
Constant = Base value + Value in IX or IY

Example 1: Modifying K100

IXK100
Base value IX value Constant
K100 + K0 = K100
K100 + K10 = K110
K100 + K - 10 = K90

Example 2: Modifying H10

IXH10
Base value IX value Constant
H10 + HA = H1A
H10 + H10 = H20

For detailed information about the index register section 4.3

1 - 19
Relays, Memory Areas and Constants FP0

1.2 Type and Function of Memory Areas

Index modification method

Example 1: Modifying a destination address


X0
F0 MV, DT 0, IX IX setting

F0 MV, K100, IXWR0

The value of DT0 determines the WR address where K100 is


written.
When the DT0 value is K10, K100 is written to WR10.
IX WR0 → WR10

K10

10 + 0 = 10

Example 2: Modifying a source address


X0
F0 MV, DT 1, IX IX setting

F0 MV, IXWR0, DT 0

The value of DT1 determines the WR address for transferring a


value to DT0.
When the DT1 value is K9, the value in WR9 is transferred to
DT0.
IX WR0 → WR9

K9

9 + 0 = 9

Cautions when using index registers


An index register can not be modified with an index register.
IXIX, IXIY
If the result of address modification overflows the memory area, an operation error will
result.
When the address resulting from modification is negative or a large number.
When modifying 32 - bit constants, IX is specified. At this point, IX and IY in combination
are handled as 32 - bit data.
Higher 16- bit area Lower 16- bit area

Contents of IY Contents of IX

The modification result is 32 - bit data.

1 - 20
FP0 Relays, Memory Areas and Constants

1.3 Type and Function of Constants

1.3 Type and Function of Constants


Item Numbering Function
C10/C14/ C32/SL1 T32
C16
Constant Decimal K K - 32768 to K32767 (for 16-bit operation)
constants K - 2147483648 to K2147483647 (for 32-bit operation)
Hexadecimal H H0 to HFFFF (for 16-bit operation)
constants H0 to HFFFFFFFF (for 32-bit operation)

Decimal Constants (K)


Function of decimal constants (K)
This binary data that has been converted to the decimal format.
When entering and reading a decimal constant, specify the value by entering a “K” at
the beginning.
Decimal constants are primarily used to specify data sizes and quantities such as set
values for timers.
In the PLC, the decimal constant (K) is processed as binary (BIN) data in units of 16 bits,
as shown below.
The sign is determined by the MSB “Most Significant Bit” (bit position 15). [A “0”
indicates a positive sign (+), and a “1” indicates a negative sign ( - ).] The MSB (Most
Significant Bit) is called the “sign bit”.

Example: Decimal number “+32” (K32)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary data 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0

“+”

Example: Decimal number “ - 32” (K - 32)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary data 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0

“-”
Data is normally handled in units of one word (16 bits), however, it is also occasionally
handled in units of two words (32 bits). In this case, as well, the MSB serves as the sign
bit.
The available range of a decimal constant is:
For 16-bit operation: K-32768 to K32767
For 32-bit operation: K-2147483648 to K2147483647

1 - 21
Relays, Memory Areas and Constants FP0

1.3 Type and Function of Constants

Hexadecimal Constants (H)


Function of hexadecimal constants (H)
Hexadecimal constants are values which have been converted from binary into
hexadecimal. When entering and reading a hexadecimal constant, specify the value by
entering an “H” at the beginning.
Hexadecimal constants are primarily used to specify an ordering of 1’s and 0’s in 16 - bit
data, such as system register settings and specification of control data for high- level
instructions. Hexadecimal constants are also used to specify BCD data.
In the PLC, the hexadecimal constant (H) is processed as binary (BIN) data in units of
16 bits, as shown below.

Example: Hexadecimal number “2A” (H2A)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Hexadecimal 0 0 2 A
Binary data 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0

Data is normally handled in units of one word (16 bits), however, it is also occasionally
handled in units of two words (32 bits).
The available range of a hexadecimal constant is:
For 16-bit operation: H0 to HFFFF
For 32-bit operation: H0 to HFFFFFFFF

1 - 22
FP0 Relays, Memory Areas and Constants

1.3 Type and Function of Constants

Character Constants (M)


Function of character constants (M)
The character constant is used to express ASCII code in binary data.
The character constant is expressed by adding the prefix “M” to the data.
There are only two instructions in which character constants can be specified, F95
(ASC) instruction and F149 (MSG) instruction. Input can be done using the
programming tool software (NPST - GR/FPWIN GR).
The character constant is stored in a specified memory area in the PLC as BIN data,
as shown below.

Example: When character constant “MEWNET” is input


T E N W E M Character constant
54 45 4E 57 45 4D ASCII Hex code

One word One word One word

When using an FP programmer II, you can only confirm program. When an F149 (MSG)
instruction is executed, the set characters appear in the display on FP programmer II.

1 - 23
Relays, Memory Areas and Constants FP0

1.4 Data Ranges Which can be Handled in the PLC

1.4 Data Ranges Which can be Handled in the PLC

1.4.1 Data Ranges Which can be Handled in the PLC

16-bit data
Data which can be handled in the PLC Decimal Hexadecimal
(16-bit binary data) constants constants
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 K 32767 H7FFF
· · ·
· · ·
· · ·
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 K 1 H0001
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 K 0 H0000
K -1 HFFFF
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
· ·
·
· ·
·
· ·
·
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 K - 32768 H8000

32-bit data
Data which can be handled in the PLC Decimal Hexadecimal
(32-bit binary data) constants constants
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 K 2147483647 H7FFFFFFF
· · ·
· · ·
· · ·
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 K 1 H00000001
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 K 0 H00000000
K -1 HFFFFFFFF
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
· · ·
· · ·
· · ·
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 K - 2147483648 H80000000

1 - 24
FP0 Relays, Memory Areas and Constants

1.4 Data Ranges Which can be Handled in the PLC

Expression of decimal numbers in PLC


Decimal number is basically processed in 16-bit or 32-bit binary.
The most significant bit (MSB) expresses negative or positive sign of the data. When
the MSB is “0”, data is regarded as having a zero or positive value and when the MSB
is “1”, data is regarded as having a negative value.
In the case of positive numbers, the bits following the most significant bit express the
size of the data.

Example 1: Expressing the decimal number “1868”


0 0 0 0 0 1 1 1 0 1 0 0 1 1 0 0
16,384

512
256
128
8,192
4,096
2,048
1,024

64
32
16
8
4
2
1
The data size is indicated by the these bits.
1,024 + 512 + 256 + 64 + 8 + 4 = 1,868

Most significant bit: 0 (positive value)

A negative number is expressed as a two’s complement (the bits of the 16 - bit binary
data of the positive number are inverted and 1 is added to the result).

Example 2: Expressing the decimal number “ - 4”


0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 Binary expression of
decimal number “4”
Invert each bit

1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1

Add 1

1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 Binary expression of
decimal number “ - 4”

Most significant bit: 1 (negative value)

1 - 25
Relays, Memory Areas and Constants FP0

1.4 Data Ranges Which can be Handled in the PLC

Data ranges which can be handled in the PLC


Data which can be handled by binary operation are:
For 16-bit operation: K-32768 to K32767
For 32-bit operation: K-2147483648 to K2147483647
Data which can be handled by BCD operation are:
For 16-bit (4-digit BCD H code) operation: H0 to H9999
For 32-bit (8-digit BCD H code) operation: H0 to H99999999
If any of the above ranges are exceeded when processing the corresponding data,
overflow or underflow will result.

BCD is an acronym for binary coded decimal and refers to expressing each digit of a
decimal number by four binary digits.
When the decimal number is expressed in BCD
Decimal number
6 4 5
Each digit is converted to binary

BCD code 0110 0100 0101 → H645


(Binary coded
decimal)

1 - 26
FP0 Relays, Memory Areas and Constants

1.4 Data Ranges Which can be Handled in the PLC

1.4.2 Overflow and Underflow

Operation instructions occasionally produce a value which is outside of the allowed


range. This is called “overflow” if the value exceeds the maximum value and “underflow”
if the value falls short of the minimum value. When an overflow or underflow occurs, the
carry flag R9009 turns on.
Overflow and underflow during binary operation
If any of the following values are exceeded, overflow or underflow will result.
16- bit binary operation 32- bit binary operation
(Overflow results if over (Overflow results if over
the maximum value.) the maximum value.)
Max. value K 32767 H 7FFF Max. value K 2147483647 H 7FFFFFFF
. . . .
. . . .
K 1 H 0001 K 1 H 00000001
K 0 H 0000 K 0 H 00000000
K . -1 H FFFF
. K . -1 H FFFFFFFF
.
. . . .

Min. value K-32768 H 8000 Min. value K-2147483648 H 80000000


(Underflow results if under (Underflow results if under
the minimum value.) the minimum value.)

Overflow and underflow during BCD operation


If any of the following values are exceeded, overflow or underflow will result.
Only positive values can be handled.
4 - digit BCD code operation 8 - digit BCD code operation
(Overflow results if over the (Overflow results if over the
maximum value.) maximum value.)
Max. value H 9999 Max. value H 99999999
. .
. .
. .
. .
. .
. .
Min. value H 0 Min. value H 0
(Underflow results if under (Underflow results if under
the minimum value.) the minimum value.)

1 - 27
Relays, Memory Areas and Constants FP0

1.4 Data Ranges Which can be Handled in the PLC

Values when overflow or underflow occurs


Numerical value handled by the FP0 all form a loop joined at the maximum value and
the minimum value as shown below.
16 - bit binary operation
Overflow

Max. value K 32767 H 7FFF


...

...

K 1 H 0001 The max. value


K 0 H 0000 links with the min.
K -1 H FFFF value.
...

...

Min. value K-32768 H 8000

Underflow

Example 1: For K32767 + K1 (overflow)


The operation result is K - 32768 and the carry flag turns on.

Example 2: For K - 32768 - K1 (underflow)


The operation result is K32767 and the carry flag turns on.

4 - digit BCD code operation

Overflow
Max. value H 9999
The max. value
.....

links with the min.


value.
Min. value H 0

Underflow

Example 1: For H9999 + H1 (overflow)


The operation result is H0 and the carry flag turns on.

Example 2: For H0 - H1 (underflow)


The operation result is H9999 and the carry flag turns on.

1 - 28
Chapter 2
Basic Instructions

2.1 Composition of Basic Instructions . . . . . . . . . . . . . . . . 2 - 3

2.2 Table of Basic Instructions . . . . . . . . . . . . . . . . . . . . . . . 2 - 7

2.3 Explanation of Basic Instructions . . . . . . . . . . . . . . . . 2 - 13


Basic Instructions FP0

2- 2
FP0 Basic Instructions

2.1 Composition of Basic Instructions

2.1 Composition of Basic Instructions

Sequence Basic Instructions


These basic instructions perform bit unit logic operations and are the basis of the relay
sequence circuit.
As shown in the illustration below, this is expressed by the combination of the relay coil
and contact.

Example:
Input contacts
Internal relay coil
Address
X0 X1 R0
0
ST AN OT

R0
1 OR Output coil
Internal
relay
contacts R0 Y10
4

ST OT

Bus line

There are several relay types which are explained in section 1.1, and the relay which
can be specified depends on the instruction. Refer to the explanation of each
instruction.

Example:
Start (ST) instruction
Read the on or off status of the specified contact.

Read the status of


external input (X0).

Out (OT) instruction


Output the operation result to the specified coil.

Output the operated result (on and off)


to the external output (Y0).

2- 3
Basic Instructions FP0

2.1 Composition of Basic Instructions

Basic Function Instructions


These are the timer, counter and shift register instructions.
To specify set values, the instructions are composed of several steps.

Example:
0.1s units timer (Timer 5)
Set value

X0 TMX 5, K 30

Constant of Y0
T5
timer 5

Example of setting 3.0 seconds in the 0.1s units timer (timer 5)


Timing begins when X0 turns on, and T5 turns on when 3.0
seconds elapses.

2- 4
FP0 Basic Instructions

2.1 Composition of Basic Instructions

Control Instructions
These instructions determine the order and flow of program execution.
It is possible to change the sections to be executed, or to execute only the necessary
segments, depending on the conditions.
Specify the section which will execute. This is composed of several steps.
Master control relay
A certain part of the program (specified with MC or MCE) is only executed when the
appropriate condition is met.
Jump
Skips execution of part of the program (specified with JP or LBL) when the appropriate
condition is met. This shortens program execution time.
Step ladder control
Part of the program (specified with SSTP or STPE) is treated as an independent
“process”, and sequential and branch execution is carried out.
Subroutine program
A program which is repeatedly executed for a particular operation is called as a
subroutine (specified with SUB or RET) and executed when needed.
Interrupt program
In addition to the normal program, enter an interrupt program (specified with INT or
IRET) if you need a program which will execute immediately when a certain condition
is met. When an interrupt is received, the normal program is interrupted and the interrupt
program is executed.

2- 5
Basic Instructions FP0

2.1 Composition of Basic Instructions

Data Compare Instructions


This is a group of instructions which compare two data. A contact is turned on or off
based on the result of the comparison. Each comparison instruction is composed of
several steps.

Example:

<=, DT 10, K100 Y0

Example of comparing the value of DT10 to K100.


If the value of DT10 is less than K100, Y0 is turned on.
If the value of DT10 is greater than K100, Y0 is turned off.

2- 6
FP0 Basic Instructions

2.2 Table of Basic Instructions

2.2 Table of Basic Instructions

Name Boolean Symbol Description Steps Page


Sequence basic instructions
Start ST X,Y,R,T,C Begins a logic operation with a Form A (normally 1 2 - 14
open) contact.
Start Not ST/ X,Y,R,T,C Begins a logic operation with a Form B (normally 1 2 - 14
closed) contact.
Out OT Y,R Outputs the operated result to the specified out- 1 2 - 14
put.
Not / Inverts the operated result up to this instruction. 1 2 - 16
AND AN X,Y,R,T,C Connects a Form A (normally open) contact se- 1 2 - 17
rially.
AND Not AN/ X,Y,R,T,C Connects a Form B (normally closed) contact 1 2 - 17
serially.
OR OR Connects a Form A (normally open) contact in 1 2 - 18
X,Y,R,T,C
parallel.
OR Not OR/ Connects a Form B (normally closed) contact in 1 2 - 18
X,Y,R,T,C
parallel.
AND stack ANS Connects the multiple instruction blocks serially. 1 2 - 19

OR stack ORS Connects the multiple instruction blocks in paral- 1 2 - 21


lel.

Push stack PSHS Stores the operated result up to this instruction. 1 2 - 23

Read stack RDS Reads the operated result stored by the PSHS 1 2 - 23
instruction.

Pop stack POPS Reads and clears the operated result stored by 1 2 - 23
the PSHS instruction.

Leading edge DF (DF )


Turns on the contact for only one scan when the 1 2 - 26
differential leading edge of the trigger is detected.
Trailing edge DF/ (DF/ )
Turns on the contact for only one scan when the 1 2 - 26
differential trailing edge of the trigger is detected.
Set SET Y,R Output is set to and held at on. 3 2 - 30
<S>

Reset RST Y,R Output is set to and held at off. 3 2 - 30


<R>

Keep KP Set
KP
Outputs at set trigger and holds until reset trig- 1 2 - 32
Reset ger turns on.

No operation NOP No operation. 1 2 - 34

2- 7
Basic Instructions FP0

2.2 Table of Basic Instructions

Name Boolean Symbol Description Steps Page


Basic function instructions
Timer TML After set value “n” × 0.001 second, timer 3 2 - 35
(*Note) contact is set to on.
TMR TM n After set value “n” × 0.01 second, timer 3 2 - 35
contact is set to on.
TMX After set value “n” × 0.1 second, timer 3 2 - 35
contact is set to on.
TMY After set value “n” × 1 second, timer con- 4 2 - 35
tact is set to on.
Auxiliary timer F137 Y,R After set value “S” × 0.01 second, the 5 3 - 235
F137 STMR, S, D
(16- bit) (STMR) specified output and R900D are set to on.
Auxiliary timer F183 Y,R After set value “S” × 0.01 second, the 5 3 - 272
(32- bit) (DSTM) F183 DSTM, S, D specified output and R900D are set to on.
(*Note)
Counter CT Count
CT
Decrements from the preset value “n”. 3 2 - 42
Reset n

UP/DOWN F118 UP/DOWN


F118 UDC
Increments or decrements from the preset 5 3 - 211
counter (UDC) Count
value “S” based on up/down input.
S
Reset
D

Shift register SR Data


SR WR n Shifts one bit of 16-bit data [word internal 1 2 - 49
Shift
relay (WR)] to the left.

Reset

Left/right shift F119 L/R


F119 LRSR Shifts one bit of the 16-bit data range spe- 5 3 - 214
register (LRSR) Data
cified by “D1” and “D2” to the left or to the
D1 right.
Shift
D2
Reset

Control instructions
Master control MC (MC n) Starts the master control program. 2 2 - 52
relay Master control area
Master control MCE Ends the master control program. 2 2 - 52
relay end (MCE n)

Note
NPST - GR Ver. 4.2 or later or FP Programmer II (AFP1114V2) is
needed to enter the TML and F183 (DSTM) instruction.

2- 8
FP0 Basic Instructions

2.2 Table of Basic Instructions

Name Boolean Symbol Description Steps Page


Jump JP (JP n) The program jumps to the label instruction 2 2 - 56
Label LBL and continues from there. 1
(LBL n)

Loop LOOP (LBL n) The program jumps to the label instruction 4 2 - 59


Label LBL and continues from there (the number of 1
LOOP n, S jumps is set in “S”).
End ED The operation of program is ended. Indi- 1 2 - 63
(ED )
cates the end of a main program.
Conditional end CNDE (CNDE )
The operation of program is ended when 1 2 - 64
the trigger turns on.
Step ladder instructions
Start step SSTP The start of program “n” for process con- 3 2 - 66
(SSTP n)
trol
Next step NSTL Start the specified process “n” and clear 3 2 - 66
(NSTL n) the process currently started. (Scan
execution type)
NSTP Start the specified process “n” and clear 3 2 - 66
(NSTP n) the process currently started. (Pulse
execution type)
Clear step CSTP (CSTP n)
Resets the specified process “n”. 3 2 - 66

Step end STPE End of step ladder area 1 2 - 66


(STPE )

Subroutine instructions
Subroutine call CALL (CALL n)
Executes the specified subroutine pro- 2 2 - 76
gram.
Subroutine entry SUB Indicates the start of the subroutine pro- 1 2 - 76
(SUB n)
gram “n”.
Subroutine RET Ends the subroutine program. 1 2 - 76
return (RET )

Interrupt instructions
Interrupt INT Indicates the start of the interrupt program 1 2 - 79
(INT n)
“n”.

Interrupt return IRET (IRET )


Ends the interrupt program. 1 2 - 79

Interrupt control ICTL Select interrupt enable/disable or clear in 5 2 - 84


(DF) ICTL S1, S2
“S1” and “S2” and execute.

2- 9
Basic Instructions FP0

2.2 Table of Basic Instructions

Name Boolean Symbol Description Steps Page


Data compare instructions
16- bit data ST = = S1, S2
Begins a logic operation by comparing two 5 2 - 90
compare 16- bit data in the comparative condition
((Start)) “S1 = S2.”
ST <> < > S1, S2
Begins a logic operation by comparing two 5 2 - 90
16- bit data in the comparative condition
“S1 ≠ S2.”
ST > Begins a logic operation by comparing two 5 2 - 90
> S1, S2
16- bit data in the comparative condition
“S1 > S2.”
ST >= > = S1, S2
Begins a logic operation by comparing two 5 2 - 90
16- bit data in the comparative condition
“S1 ≧ S2.”
ST < < S1, S2
Begins a logic operation by comparing two 5 2 - 90
16- bit data in the comparative condition
“S1 < S2.”
ST <= < = S1, S2
Begins a logic operation by comparing two 5 2 - 90
16- bit data in the comparative condition
“S1 ≦ S2.”
32- bit data STD = D= S1, S2
Begins a logic operation by comparing two 9 2 - 92
compare 32- bit data in the comparative condition
((Start)) “(S1+1, S1) = (S2+1, S2).”
STD <> D< > S1, S2
Begins a logic operation by comparing two 9 2 - 92
32- bit data in the comparative condition
“(S1+1, S1) ≠ (S2+1, S2).”
STD > D> S1, S2
Begins a logic operation by comparing two 9 2 - 92
32- bit data in the comparative condition
“(S1+1, S1) > (S2+1, S2).”
STD >= D> = S1, S2
Begins a logic operation by comparing two 9 2 - 92
32- bit data in the comparative condition
“(S1+1, S1)≧ (S2+1, S2).”
STD < D< S1, S2
Begins a logic operation by comparing two 9 2 - 92
32- bit data in the comparative condition
“(S1+1, S1) < (S2+1, S2).”
STD <= D< = S1, S2
Begins a logic operation by comparing two 9 2 - 92
32- bit data in the comparative condition
“(S1+1, S1)≦ (S2+1, S2).”

2 - 10
FP0 Basic Instructions

2.2 Table of Basic Instructions

Name Boolean Symbol Description Steps Page


16- bit data AN = Connects a Form A (normally open) contact 5 2 - 94
compare = S1, S2 serially by comparing two 16- bit data in the
(AND) comparative condition “S1 = S2.”
AN <> Connects a Form A (normally open) contact 5 2 - 94
< > S1, S2 serially by comparing two 16- bit data in the
comparative condition “S1 ≠ S2.”
AN > Connects a Form A (normally open) contact 5 2 - 94
> S1, S2 serially by comparing two 16- bit data in the
comparative condition “S1 > S2.”
AN >= Connects a Form A (normally open) contact 5 2 - 94
> = S1, S2 serially by comparing two 16- bit data in the
comparative condition “S1 ≧ S2.”
AN < Connects a Form A (normally open) contact 5 2 - 94
< S1, S2 serially by comparing two 16- bit data in the
comparative condition “S1 < S2.”
AN <= Connects a Form A (normally open) contact 5 2 - 94
< = S1, S2 serially by comparing two 16- bit data in the
comparative condition “S1 ≦ S2.”
32- bit data AND = Connects a Form A (normally open) contact 9 2 - 96
compare D= S1, S2
serially by comparing two 32- bit data in the
(AND) comparative condition
“(S1+1, S1) = (S2+1, S2).”
AND <> Connects a Form A (normally open) contact 9 2 - 96
D< > S1, S2
serially by comparing two 32- bit data in the
comparative condition
“(S1+1, S1) ≠ (S2+1, S2).”
AND > Connects a Form A (normally open) contact 9 2 - 96
D> S1, S2
serially by comparing two 32- bit data in the
comparative condition
“(S1+1, S1) > (S2+1, S2).”
AND >= Connects a Form A (normally open) contact 9 2 - 96
D> = S1, S2
serially by comparing two 32- bit data in the
comparative condition
“(S1+1, S1) ≧ (S2+1, S2).”
AND < Connects a Form A (normally open) contact 9 2 - 96
D< S1, S2 serially by comparing two 32- bit data in the
comparative condition
“(S1+1, S1) < (S2+1, S2).”
AND <= Connects a Form A (normally open) contact 9 2 - 96
D< = S1, S2
serially by comparing two 32- bit data in the
comparative condition
“(S1+1, S1) ≦ (S2+1, S2).”

2 - 11
Basic Instructions FP0

2.2 Table of Basic Instructions

Name Boolean Symbol Description Steps Page


16- bit data OR = Connects a Form A (normally open) contact 5 2 - 98
compare = S1, S2 in parallel by comparing two 16- bit data in
((OR)) the comparative condition “S1 = S2.”
OR <> Connects a Form A (normally open) contact 5 2 - 98
< > S1, S2 in parallel by comparing two 16- bit data in the
comparative condition “S1 ≠ S2.”
OR > Connects a Form A (normally open) contact 5 2 - 98
> S1, S2 in parallel by comparing two 16- bit data in
the comparative condition “S1 > S2.”
OR >= Connects a Form A (normally open) contact 5 2 - 98
> = S1, S2 in parallel by comparing two 16- bit data in the
comparative condition “S1 ≧ S2.”
OR < Connects a Form A (normally open) contact 5 2 - 98
< S1, S2 in parallel by comparing two 16- bit data in
the comparative condition “S1 < S2.”
OR <= Connects a Form A (normally open) contact 5 2 - 98
< = S1, S2 in parallel by comparing two 16- bit data in the
comparative condition “S1 ≦ S2.”
32- bit data ORD = Connects a Form A (normally open) contact 9 2 - 100
compare D= S1, S2
in parallel by comparing two 32- bit data in
(OR) the comparative condition
“(S1+1, S1) = (S2+1, S2).”
ORD <> Connects a Form A (normally open) contact 9 2 - 100
D< > S1, S2
in parallel by comparing two 32- bit data in
the comparative condition
“(S1+1, S1) ≠ (S2+1, S2).”
ORD > Connects a Form A (normally open) contact 9 2 - 100
D> S1, S2
in parallel by comparing two 32- bit data in
the comparative condition
“(S1+1, S1) > (S2+1, S2).”
ORD >= Connects a Form A (normally open) contact 9 2 - 100
D> = S1, S2
in parallel by comparing two 32- bit data in
the comparative condition
“(S1+1, S1) ≧ (S2+1, S2).”
ORD < Connects a Form A (normally open) contact 9 2 - 100
D< S1, S2
in parallel by comparing two 32- bit data in
the comparative condition
“(S1+1, S1) < (S2+1, S2).”
ORD <= Connects a Form A (normally open) contact 9 2 - 100
D< = S1, S2
in parallel by comparing two 32- bit data in
the comparative condition
“(S1+1, S1) ≦ (S2+1, S2).”

2 - 12
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

2.3 Explanation of Basic Instructions


Layout of instruction explanations

Ladder diagram
This indicates the
ladder diagram
screen displayed
when data is entered
using the program-
ming tool software
(NPST - GR/FPWIN
GR). Number of steps
On the programming This is the number of steps
tool software used with this instruction.
(NPST - GR/FPWIN
GR) screen, coils are
displayed using the
[ ] symbol.

Available
operands
This indicates types
of relays which can
be used with the
instruction, types of
registers and
constants which
can be used as
operands.
For information on
types of relays,
refer to section 1.1.
For information on
types of memory
areas, refer to
section 1.2.
Boolean
Explanation of This indicates
program how codes are
example and used when data
flag conditions is entered using
boolean entry
Using the program with the pro-
given in the above gramming tool
ladder diagram as software (NPST -
an example, the GR/FPWIN GR).
operation and relay Data is also
movements are entered in this
shown, as well as format when
types of flags and using the FP
the conditions under Programmer II.
which they go on
and off.

2 - 13
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

ST Start 1

ST/ Start Not 1 FP0 C10, C14, C16,


C32, T32, SL1

OT Out 1

Outline ST, ST/: Begins a logic operation.


OT: Outputs the operation result. 1

Program example
Boolean
Ladder Diagram
Address Instruction

X0 Y0 0 ST X 0
0 1 OT Y 0
X0 Start Out Y1
2 ST/ X 0
2
Start Not Out 3 OT Y 1

Operands
Timer/Counter
Relay
Instruction Contact
X Y R T C
ST, ST/ A A A A A
A: Available
OT N/A A A N/A N/A N/A: Not Available
Explanation of example
Y0 goes on when X0 turns on.
Y1 goes on when X0 turns off.
on
X0 off
on
Y0 off
on
Y1 off

Description
The ST instruction starts logic operations and regards the input contact specified at the start as a Form A
(normally open) contact.
The ST/ instruction starts logic operations and regards the input contact specified at the start as a Form B
(normally closed) contact.
The OT instruction outputs the operation result to a specified coil.

2 - 14
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Precautions during programming


The ST and ST/ instructions start from the bus line.
X0 Y0

The OT instruction cannot start directly from the bus line.


Y0

The OT instruction can be used consecutively.


X0 Y0

Y1

Y2

When an external switch, such as emergency stop switch with a Form B (normally closed) contact is
programmed, be sure to use the ST instruction.

2 - 15
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

/ Not 1 FP0 C10, C14, C16,


C32, T32, SL1

Outline Inverts the operation result up to this instruction. 2

Program example
Boolean
Ladder Diagram
Address Instruction

X0 Y0 0 ST X 0
0
1 OT Y 0
Y1
2 /
Not 3 OT Y 1

Explanation of example
Y0 goes on and Y1 goes off when X0 turns on.
Y0 goes off and Y1 goes on when X0 turns off.
X0 on
off
on
Y0 off
on
Y1 off

Description
The / (Not) instruction inverts the operation result up to this instruction.

2 - 16
FP0 Basic Instructions

2.3 Explanation of Basic Instructions


Step Availability

AN AND 1
FP0 C10, C14, C16,
C32, T32, SL1
AN/ AND Not 1

Outline AN: Connects Form A (normally open) contacts in series.


AN/: Connects Form B (normally closed) contacts in series. 3

Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0
X0 X1 X2 Y0
1 AN X 1
0
2 AN/ X 2
AND AND Not
3 OT Y 0

Operands
Timer/Counter
Relay
Instruction Contact
X Y R T C
AN, AN/ A A A A A A: Available
Explanation of example
Y0 goes on when both X0 and X1 turn on and also X2 turns off.
on
X0 off
on
X1 off
on
X2 off
on
Y0 off

Description
Performs a logical AND operation with the results of the immediately preceding serially connected operation.

Precautions during programming


Use the AN instruction when normally open contacts (Form A contacts) are serially connected.
Use the AN/ instruction when normally closed contacts (Form B contacts) are serially connected.
X0 X1 Y0

X2 X3 Y1

The AN and AN/ instructions can be used consecutively.


X0 X1 X2 X3

2 - 17
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

OR OR 1
FP0 C10, C14, C16,

OR/ OR Not 1 C32, T32, SL1

Outline OR: Connects Form A (normally open) contacts in parallel.


OR/: Connects Form B (normally closed) contacts in parallel. 4
Program example
Boolean
Ladder Diagram
Address Instruction
X0 Y0
0 ST X 0
0
X1 1 OR X 1
2 OR/ X 2
X2 OR
3 OT Y 0
OR Not

Operands
Timer/Counter
Relay
Instruction Contact
X Y R T C
OR, OR/ A A A A A A: Available
Explanation of example
Y0 goes on when either X0 or X1 turns on or X2 turns off.
X0 on
off
on
X1 off
on
X2 off

Y0 on
off

Description
Performs a logical OR operation with the results of the immediately preceding operation connected in
parallel.
Precautions during programming
Use the OR instruction when normally open contacts (Form A contacts) are connected in parallel.
Use the OR/ instruction when normally closed contacts (Form B contacts) are connected in parallel.
The OR instruction starts from the bus line.
The OR and OR/ instructions can be used consecutively.
X0 Y0

X1

X2

X3

2 - 18
FP0 Basic Instructions

2.3 Explanation of Basic Instructions


Step Availability

ANS AND stack 1 FP0 C10, C14, C16,


C32, T32, SL1

Outline Multiple blocks are connected in series.


Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0
X0 X2 Y0 1 OR X 1
0
2 ST X 2
X1 X3
Block 2 3 OR X 3
4 ANS
Block 1
5 OT Y 0

Explanation of example
Y0 goes on when X0 or X1 and X2 or X3 turn on.

(X0 OR X1) AND (X2 OR X3) → Y0

Block 1 Block 2

on
X0 off
on
X1 off
on
X2 off
on
X3 off

on
Y0 off

Description
Blocks connected in parallel are connected in series.

A block begins with the ST instruction.

2 - 19
Basic Instructions FP0

2.3 Explanation of Basic Instructions

When blocks are consecutive


When blocks are consecutive, a division of the blocks should be considered, such as that shown below.

Block ST X 0
1 2
Block 1 OR X 1
4 ST X 2
Block
5 X0 X2 X4 Y0 Block
2 OR X 3
Block Block
X1 X3 X5 5 ANS . . . . . . . . . . 1
4
ST X 4
Block
3 OR X 5
Block Block Block
1 2 3 ANS . . . . . . . . . . 2

OUT Y 0

When entered using FP Programmer II


Key operation
AN STK
ANS: Y-WY IX/IY WRT

2 - 20
FP0 Basic Instructions

2.3 Explanation of Basic Instructions


Step Availability

ORS OR stack 1
FP0 C10, C14, C16,
C32, T32, SL1

Outline Multiple blocks are connected in parallel. 5

Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0
1 AN X 1
X0 X1 Block 1 Y0
0 2 ST X 2
X2 X3 Block 2 3 AN X 3
4 ORS
5 OT Y 0

Explanation of example
Y0 goes on when both X0 and X1 or both X2 and X3 turn on.
(X0 AND X1) OR (X2 AND X3) → Y0

Block 1 Block 2
on
X0 off

on
X1 off
on
X2 off
on
X3 off

on
Y0 off

Description
Blocks connected in series are connected in parallel.

+ 
A block begins with the ST instruction.

2 - 21
Basic Instructions FP0

2.3 Explanation of Basic Instructions

When blocks are consecutive


When blocks are consecutive, a division of the blocks should be considered, such as that shown below.

Block ST X 0
Block 4 Block 1 AN X 1
4 ST X 2
X0 X1 Y0
Block Block
2 AN X 3
1 Block
X2 X3 1 ORS . . . . . . . . . 1
Block 5
2
X4 X5 2 Block ST X 4
Block 3 AN X 5
3
ORS . . . . . . . . . 2
Block 5 OUT Y 0

When entered using FP Programmer II


Key operation
OR STK
ORS: R-WR IX/IY WRT

2 - 22
FP0 Basic Instructions

2.3 Explanation of Basic Instructions


Step Availability

PSHS Push stack 1

RDS Read stack 1


FP0 C10, C14, C16,
C32, T32, SL1

POPS Pop stack 1

Outline PSHS: Stores the operation result up to this instruction. 6


RDS: Reads the operation result stored by the PSHS instruction.
POPS: Reads and clears the operation result stored by the PSHS
instruction.
Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0
1 PSHS
2 AN X 1
X0 X1 Y0
0 3 OT Y 0
X2 Push Stack Y1 4 RDS
5 AN X 2
X3 Read Stack Y2
6 OT Y 1
Pop Stack
7 POPS
8 AN/ X 3
9 OT Y 2

Explanation of example
When X0 turns on:
Stores the operation result up to the PSHS instruction and Y0 goes on when X1 turns on.
Reads the stored result using the RDS instruction and Y1 goes on when X2 turns on.
Reads the stored result using the POPS instruction and Y2 goes on when X3 turns off. Also clears the result
stored by the PSHS instruction.
on
X0 off

on
X1 off
on
Y0 off
on
X2 off

on
Y1 off
on
X3 off

on
Y2 off

2 - 23
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Description
One operation result can be stored in memory and read, and multiple processes performed.
PSHS (stores operation result):
Stores the operation result up to this instruction and continues execution from the next step.
RDS (reads operation result):
Reads the operation result stored using the PSHS instruction and, using this result, continues operation from
the next step.
POPS (resets operation contents):
Reads the operation result stored using the PSHS instruction and, using this result, continues operation from
the next step. Also clears the operation result stored by the PSHS instruction.
These instructions are used if there is branching from a single contact, followed by another contact or
contacts.
Precautions during programming
You can continue to use the same operation result several times by repeatedly using the RDS instruction.
When you are finished, be sure to issue the POPS instruction.

X0 X1 Y0

PSHS X2 Y1

RDS X3 X4 Y2

POPS

An RDS instruction can be used repeatedly any number of times.

X0 Y0

X1 Y1

X2 X3 Y2
RDS
X4 X5 Y3

X6 X7 Y4

2 - 24
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Caution regarding repeated use of a PSHS instruction


A PSHS instruction can be used up to eight times before the next POPS instruction is entered. If used nine
times, caution is required as correct operation cannot be guaranteed.
X0 X1 X2 X3 X4 X5 X6 X7 X8 Y0 ST X 0
PSHS . . . . 1
AN X 1
PSHS . . . . 2
AN X 2
1 2 3 4 5 6 7 8
PSHS . . . . 3
AN X 3
Max. 8 times PSHS . . . . 4
AN X 4
PSHS . . . . 5
AN X 5
PSHS . . . . 6
AN X 6
PSHS . . . . 7
AN X 7
PSHS . . . . 8
AN X 8
OT Y 0

If a POPS instruction is used during repeated use of a PSHS instruction, reading will take place in order
beginning from the last data stored by the PSHS instruction.

X0 X1 X2 X3 X4 X5 Y0 POPS . . . . . 5 Reading
AN X 6
OT Y 1
X6 Y1
POPS . . . . . 4 Reading
AN X 7
1 2 3 4 5
X7 Y2 OT Y 2
POPS . . . . . 3 Reading
Y3 AN X 8
X8
OT Y 3

X9 Y4

XA Y5

2 - 25
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

DF Leading edge differential 1


FP0 C10, C14, C16,

DF/ Trailing edge differential 1 C32, T32, SL1

Outline DF: Turns on the contact for only one scan when the leading edge of
the trigger is detected.
DF/: Turns on the contact for only one scan when the trailing edge of
the trigger is detected. 7
Program example
Boolean
Ladder Diagram
Address Instruction

Leading edge differential 0 ST X 0


X0 Y0 1 DF
0 (DF)
2 OT Y 0
X1 Y1
3 (DF/) 3 ST X 1
4 DF/
Trailing edge differential 5 OT Y 1

Explanation of example
Y0 goes on for only one scan when the leading edge (off → on) of X0 is detected.
Y1 goes on for only one scan when the trailing edge (on → off) of X1 is detected.
on
X0 off

X1 on
off
on
Y0 off
↔ ↔
on 1 scan 1 scan
Y1 off
↔ ↔
1 scan 1 scan

Leading Trailing
edge edge

2 - 26
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Description
The DF instruction executes and turns on output for only one scan duration when the trigger changes from an
off to an on state.
The DF/ instruction executes and turns on output for only one scan duration when the trigger changes from an
on to an off state.
There is no limit on the number of times the DF and DF/ instructions can be used.
With the DF and DF/ differential instructions, only a change in the on and off status of the contact is detected.
Thus, if the execution condition is initially on such as when the mode is changed to RUN or the power turned
on in RUN mode, output will not be obtained.

Example: Leading edge differential (DF) instruction

X0 on
off

Y0 on
off

DF instruction
Leading
RUN not executed. edge

For detailed information section 4.5

Precautions during programming


With a program such as the one in the figure below, operation will be as follows.
X0 X1 Y0
(DF)

X0

X1

Y0

1 2 3

1 When X1 is off, even if X0 rises, Y0 remains off.


2 Even if X1 rises when X0 is on, Y0 remains off.
3 If X0 rises when X1 is on, then Y0 will go on for one scan.

2 - 27
Basic Instructions FP0

2.3 Explanation of Basic Instructions

In the following program the execution condition (trigger) is initially on, therefore output is not obtained.
R9013 Y0
DF R9013 only turns on during the first scan after
RUN begins.

R9010 Y0
DF R9010 is always on.

With the following program, output is obtained.


R9014 Y0
DF R9014 turns on from the second scan after
RUN begins.

Exercise caution when used in combination with instructions which change the order of instruction execution
such as MC and MCE or JP and LBL (see below).
For detailed information section 4.5
- MC and MCE instructions
- JP and LBL instructions
- LOOP and LBL instructions
- CNDE instruction
- Step ladder instructions
- Subroutine instructions
When combining a differential instruction with an AND stack or pop stack instruction, take care that the syntax
is correct. For detailed information section 4.6

2 - 28
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Example of a differential instruction application


Using a differential instruction makes it easier to adjust a program.
Application to a self - hold circuit
Using a differential instruction makes it possible to handle long input signals.

X0 R0 Y0
DF X0
Y0 X1

X1 R0 R0
DF
Y0

Y0
With no differential instruction

Application to an alternating circuit


A differential instruction can also be applied to an alternating circuit to hold and release the circuit using a
single signal.

Example 1:
X0 R0
DF
R0 Y0 Y0

R0 Y0

Example 2:

X0 R0
DF
R0 R0 Y0

Y0 Y0

2 - 29
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

SET Set 3
FP0 C10, C14, C16,

RST Reset 3 C32, T32, SL1

Outline SET: When the execution conditions have been satisfied, the output is
turned on, and the on status is retained.
RST: When the execution conditions have been satisfied, the output is
turned off, and the off status is retained.
Program example
Boolean
Ladder Diagram
Address Instruction
Set 20 ST X 0
X0 Y0
20
〈S

21 SET Y 0
X1 Y0 24 ST X 1
〈R
24

25 RST Y 0
Output destination
Reset

Operands
Timer/Counter
Relay
Instruction Contact
X Y R T C
A: Available
SET, RST N/A A A N/A N/A N/A: Not Available
Explanation of example
When X0 turns on, Y0 goes on and holds on.
When X1 turns on, Y0 goes off and stays off.
on
X0 off

X1 on
off
on
Y0 off

Description
The SET instruction executes when the trigger is turned on. Output turns on and holds on even if the trigger’s
state changes.
The RST instruction executes when the trigger is turned on. Output turns off and stays off even if the trigger’s
state changes.
You can use relays with the same number as many times as you like with the SET and RST instructions.
(Even if a total check is run, this is not handled as a syntax error.)

2 - 30
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

When SET and RST instructions are used


When the SET and RST instructions are used, the output changes with each step during processing of the
operation.

Example: When X0, X1, and X2 are turned on


X0 Y0
〈S

Y0
This portion of the program is processed as if Y0 were on.

X1 Y0
〈R

This portion is processed as if Y0 were off.


X2 Y0
〈S

This portion is processed as if Y0 were on.

I/O update is performed when an ED instruction is executed, therefore the data actually output is determined
by the final operation result. In the above example, the Y0 output is on.
To output a result while operation is still in progress, use a partial I/O update instruction (F143).
Precautions during programming
The output destination of a SET instruction is held even during the operation of an MC instruction.
For detailed information MC and MCE instructions

The output destination of a SET instruction is reset when the mode is changed from RUN to PROG. or when
the power is turned off, except when a hold type internal relay is specified as the output destination.

SET and RST instructions and differential instructions


Be sure to place a differential instruction before the SET and RST instructions to make program development
and refinement easier.
This is particularly effective when the same output destination is used in several places in the program.

X0 Y0
〈S

(DF)
X1 Y0
〈R

(DF)

2 - 31
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

KP Keep 1 FP0 C10, C14, C16,


C32, T32, SL1

Outline This is output which is accompanied by set or reset input, and which is
retained. 4
Program example
Boolean
Ladder Diagram
Address Instruction
Set input
X0 0 ST X 0
KP R 30
0
X1 Reset input 1 ST X 1
1 2 KP R 30
Output destination

Operands
Timer/Counter
Relay
Instruction Contact
X Y R T C
A: Available
KP N/A A A N/A N/A N/A: Not Available
Explanation of example
When X0 turns on, output relay R30 goes on and stays on.
R30 goes off when X1 turns on.
on
X0 off
on
X1 off
on
R30 off

Set Reset Reset takes


precedence
Description
When the set input turns on, output of the specified relay goes on and stays on.
Output relay goes off when the reset input turns on.
The output relay’s on state is maintained until a reset input turns on, regardless of the on or off states of the set
input.
If the set input and reset input turn on simultaneously, the reset input has priority.

2 - 32
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Precautions during programming


When the KP instruction is programmed between the MC and MCE instructions, the status of output
destination is maintained. For detailed infromation MC and MCE instructions
If an internal relay (R) is set as the non-hold type, it is reset when the mode of operation is changed from RUN
to PROG or when the power is turned off.
If an internal relay set as a hold type is specified as the output destination, a reset does not take place.

2 - 33
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

NOP No operation 1 FP0 C10, C14, C16,


C32, T32, SL1

Outline No operation 5
Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0
X0 X1 X2 Y0 1 AN X 1
0 S
2 NOP
NOP 3 AN/ X 2
4 OT Y 0

Description
This instruction has no effect on the operation result to that point.
The same operation takes place without a NOP instruction.
The NOP instruction can be used to make the program easier to read when checking or correcting.
When you want to delete an instruction without changing addresses, write a NOP instruction (overwrite the
previous instruction).
When you want to move the addresses of one part of a program without changing the program, insert a NOP
instruction.
This is a convenient means of breaking a long program into several blocks.

Example:
To move the starting point of a program block from address 39
to address 40, insert a NOP instruction at address 39.
Address Address
36 ST X0 36 ST X0
S OR X1 S OR X1
S OT Y1 S OT Y1
39 ST X2 This moves the 39 NOP Insert a NOP
40 AN X3 starting point to 40 ST X2 instruction.
S OT R20 address 40. 41 AN X3
S ST R2 S OT R20
S DF S ST R2
44 ST X3 S DF
45 ST X3

Deleting a NOP instruction


To delete the NOP instruction after editing in the PROG. mode, use the programming tools.
Using programming tool software (NPST - GR/FPWIN GR): Select [DELETE ALL NOPS] on the menu, and
execute the instruction.
Using the FP programmer II: Enter the following series of key operations.
(-) SHIFT (DELT)
Key operation: ACLR OP 1 ENT SC INST

2 - 34
FP0 Basic Instructions

2.3 Explanation of Basic Instructions


Step Availability

TML 0.001s units timer 3

TMR 0.01s units timer 3


FP0 C10, C14, C16,
C32, T32, SL1
TMX 0.1s units timer 3

TMY 1s units timer 4

Outline TML: Sets the on-delay timer for 0.001s units


TMR: Sets the on-delay timer for 0.01s units
TMX: Sets the on-delay timer for 0.1s units
TMY: Sets the on-delay timer for 1.0s units 6
Program example
Boolean
Ladder Diagram
Address Instruction
Timer number
Unit of timer 0 ST X 0
Trigger Set value
TMX 5 K 30 1 TMX 5
X0
0 K 30
Elapsed value
T5 Y0 4 ST T 5
4
5 OT Y 0
Timer contact of timer No.5

Operands
Timer/ Index
Relay Register Constant Index
Instruction Counter register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
Set value N/A N/A N/A A N/A N/A N/A N/A A N/A N/A N/A: Not Available

2 - 35
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Description
The 100 points from T0 to T99 can be used for the timer.
If there are not enough the point number of timer, you can increase the number by changing the setting of
system register 5. For detailed information section 8.4.
For FP0 C10, C14, C16, C32 CPU Ver. 2.1 or later and FP0 T32, the timer is reset and does not retain its data
when the power is turned off or the mode is changed from the RUN to the PROG mode. (If you need to retain
the operating state, set system register 6.)
When the execution condition (trigger) is on, the set time [n] decrements, and when the elapsed value
reaches zero, timer contact Tn (n is the timer contact number) turns on.
If the execution condition (trigger) turns off during operation, operation stops and the elapsed value is reset
(cleared to 0).
An OT instruction can be entered immediately after a timer coil.

Note on programming tools


The programming tool software (NPST - GR Ver. 4.2 or later) or FP Programmer II (AFP1114V2) is
necessary to read or write a TML instruction (0.001 sec increment timer).

Timer set time


The formula of the timer set time is [the time unit] × [set value].
The timer set value [n] must be a decimal constant from K1 to K32767.
- TML is from 0.001 to 32.767 seconds in increments of 0.001 second.
- TMR is from 0.01 to 327.67 seconds in increments of 0.01 second.
- TMX is from 0.1 to 3276.7 seconds in increments of 0.1 second.
- TMY is from 1 to 32767 seconds in increments of 1 second.

Example:
When K43 is set in TMX, the set time is 0.1 × 43 = 4.3
seconds.
When K500 is set in TMR, the set time is 0.01 × 500 = 5
seconds.
Precautions during programming
The timer value decrements during processing, therefore, create the program so that one decrement occurs
during one scan. (A correct result will not be obtained if no processing operations or multiple processing
operations take place during one scan due to an interrupt program or JP/LOOP instruction.)
Take care that the syntax is correct when combining a timer instruction with an AND stack or pop stack
instruction. For detailed information section 4.6

2 - 36
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Timer operation
The following is an example of setting the set value with a K constant. For an explanation of operation when a
set value area (SV) is specified, see page 2 - 39.
1 When the mode is changed to RUN or when the power is turned on with the mode set to RUN, the
timer set value is transferred to the set value area (SV) with the same number.
1 Transfers to SV area
Set value
SV5
X0 TMX 5, K 30 30

T5 Y0

2 When the timer trigger rises from off to on, the setting is transferred from the set value area (SV) to the
elapsed value area (EV) with the same number. (The same operation takes place if the mode is
changed to RUN when the trigger is on.)
3 The value in the elapsed value area (EV) decrements every scan if the trigger stays on.
2 Transfers to EV area
SV5 EV5
X0 TMX 5, K 30 30 30
29
T5 Y0 28
27
3 Decrements

4 When the value in the elapsed value area (EV) reaches zero, the timer contact (T) with same number
turns on.
SV5 EV5
X0 TMX 5, K 30
30 0
4 Decrement operation ends
T5 Y0

See section 1.2 for an explanation of the set value area (SV) and the elapsed value area (EV).

2 - 37
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Examples of timer instruction applications


Serial connection of timer
Ladder diagram Boolean Time chart
on
ST X 0 X0 off
X0 TMX 0, K 30 TMX 1, K 20 TMX 0 on
K 30 T0 off

T0 Y0 TMX 1 on 3s
T1 off
K 20
2s
T1 Y1 ST T 0 Y0
on
off
OT Y 0
ST T 1 on
Y1 off
OT Y 1

Parallel connection of timer


Ladder diagram Boolean Time chart
on
ST X 0 X0 off
X0 TMX 0, K 30 PSHS on
T0 off
TMX 0
TMX 1, K 20 K 30 on 3s
T1 off
POPS
TMX 1 on 2s
T0 Y0 Y0 off
K 20
T1
ST T 0 Y1 on
off
Y1
OT Y 0
ST T 1
OT Y 1

Changing a timer setting time while in operation


A timer setting time can be changed during RUN. For detailed information section 4.8
Related instructions
There are also auxiliary timer instructions (F137, F183) for timers.

2 - 38
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Directly specifying a set value area number as a timer setting value


X0
F0 MV, K30, SV5 ............. 1

X1 TMX 5, SV5 ............. 2

T5 Y0

The above program operates as follows:


1 When execution condition (trigger) X0 is on the data transfer instruction [F0 (MV)] is executed, set the
K30 in SV5.
2 When execution condition (trigger) X1 turns on, decrement operation begins from the set value 30.

Specify [n] (the number of the set value area SV) to be the same number as the timer.
Key operation of FP Programmer II: T-TMSV X-STWX 5 ENT T-TMSV 5
Display: Timer number Set value area number (n)

TMX 5 SV 5

These must be the same.

Even if the value of the set value area (SV) is changed during decrement operation, the decrement operation
will continue from the value before the change. Timer operation from the new value will not begin until
decrement operation has ended or is interrupted and the execution condition (trigger) subsequently changes
from off to on.
The set value area (SV) is normally a non - hold type which resets if the power is turned off or the mode is
changed from RUN to PROG.

2 - 39
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Timer operation when a set value area number is directly specified


1 When the execution condition (trigger) for a high - level instruction is on, the value is set in the set
value area (SV). The following diagram shows an example of using the high - level instruction F0(MV).
Set value
X0
F0 MV, K30, SV5
SV5
30
X1 TMX 5, SV 5
1 Transfers to SV area
T5 Y0

2 When the timer execution condition (trigger) rises from off to on, the setting is transferred from the set
value area (SV) to the elapsed value area (EV) with the same number. (The same operation takes
place if the mode is changed to RUN when the execution condition (trigger) is on.)
3 The value in the elapsed value area (EV) decrements if the execution condition (trigger) stays on
every scan.
2 Transfers to EV area
X0
F0 MV, K30, SV5 SV5 EV5
30 30
X1 TMX 5, SV 5 29
28
3 Decrement 27
T5 Y0 operation

4 When the value in the elapsed value area (EV) reaches zero, the timer contact (T) with same number
turns on.

X1 TMX 5, SV 5 SV5 EV5


30 0
T5 Y0 4 Decrement operation ends

See section 1.2 for an explanation of the set value area (SV) and the elapsed value area (EV).

2 - 40
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Examples of applying direct specification of set value area numbers

Example 1: Changing set values based on specified conditions


The set value is K50 when X0 is on and K30 when X1 is on.
Ladder diagram Boolean
ST/ X 1
X1 X0 AN X 0
F0 MV, K 50, SV 5 F0 (MV)
X0 X1 K 50
F0 MV, K 30, SV 5 SV 5
X2 TMX 5, SV 5 ST/ X 0
AN X 1
T5 Y0 F0 (MV)
K 30
SV 5
ST X 2
TMX 5
Time chart SV 5
on
ST T 5
X0 off OT Y 0
on
X1 off
on
X2 off
on
T5 off
5s
3s
SV5 K0 K50 K30 K50

Example 2: Example of setting a set value from external digital switches


The BCD data of the digital switches connected to X0 through XF
is converted and becomes the set value
Connection example

FP0 control unit

0 7 9 4 Set value
of timer
WX0 Digital switch

Ladder diagram Boolean


R10 ST R 10
F81 BIN, WX 0, SV 5 F81 (BIN)
R11 TMX 5, SV 5 WX 0
SV 5
ST R 11
T5 Y0
TMX 5
SV 5
ST T 5
OT Y 0

2 - 41
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

CT Counter 3 FP0 C10, C14, C16,


C32, T32, SL1

Outline Decrements a preset counter. 5

Program example
Boolean
Ladder Diagram
Address Instruction
Count number
0 ST X 0
X0 CT 100
Count input 1 ST X 1
0
K 10 2 CT 100
X1 Reset input
1 K 10
Elapsed value
C 100 Set value Y0 5 ST C 100
5 6 OT Y 0
Counter contact for counter no. 100
(example showing a case where
100 and subsequent numbers are
specified for counters)

Operands
Index
Relay Timer/Counter Register Constant Index
Instruction register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
Set value N/A N/A N/A A N/A N/A N/A N/A A N/A N/A N/A: Not Available

Explanation of example
When the leading edge of X0 is detected ten times, counter contact C100 turns on and then Y0 goes on.
The elapsed value is reset when X1 turns on.
on
X0 off ....
on
X1 off 10 times

C100 on
off

Y0 on
off

2 - 42
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Description
The counter is a decremental preset counter.
The following point numbers can be used for counters depending on the type of FP0 C10/C14/C16/C32/
T32/SL1.
Type Useable counter point numbers
FP0 C10/C14/C16 44 points (C100 to C143)
Non- hold type: 40 points (C100 to C139)
Hold type: 4 points (C140 to C143)
FP0 C32/SL1 44 points (C100 to C143)
Non- hold type: 28 points (C100 to C127)
Hold type: 16 points (C128 to C143)
FP0 T32 44 points (C100 to C143)

For FP0 C10/C14/C16/C32/SL1, there is a hold type, in which the counter status is retained even if the power
supply is turned off, or if the mode is switched from RUN to PROG, and a non - hold type, in which the counter
is reset under these conditions.
For FP0 T32, there is a hold type, in which the counter status is retained even if the power supply is turned off,
or if the mode is switched from RUN to PROG. System register 6 can be used to specify a non - hold type. For
detailed information section 8.4
At the fall time when the reset input goes from on to off, the value of the set value area (SV) is preset in the
elapsed value area (EV).
When the reset input is on, the elapsed value is reset to 0.
When the count input changes from off to on, the set value begins to decrement, and when the elapsed value
reaches 0, the counter contact Cn (n is the counter number) turns on.
If the count input and reset input both turn on at the same time, the reset input is given priority.
If the count input rises and the reset input falls at the same time, the count input is ignored and preset is
executed.
An OT instruction can be entered immediately after a counter instruction.

Setting the counting value


The counting value can be set to a decimal constant (K constant) from K0 to K32767.

2 - 43
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Counter operation
The following are examples of specifying a K constant as the set value. For an explanation of operation when
a set value area number is specified, see page 2 - 46.
1 When the mode is changed to RUN or the power is turned on with the mode set to RUN, the counter
set value is transferred to the set value area (SV) with the same number.
2 When the reset input falls, the value in the set value area (SV) is preset in the elapsed value area
(EV).
1 Transfer
X0 CT 100 2 Preset
SV100 EV100
K 10 10 10
X1

C100 Y0

3 Each time the count input X0 turns on, the value in the elapsed value area (EV) decrements.
X0 CT 100
SV100 EV100
10 10
K 10
X1 9
8 3 Decrements
7
C100 Y0

4 When the value in the elapsed value area (EV) reaches zero, the counter contact (C) with the same
number turns on.
X0 CT 100
SV100 EV100
10 0
K 10
X1 4 Decrement operation ends

C100 Y0

For information on the set value area (SV) and the elapsed value area (EV), see section 1.2.

2 - 44
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Changing counter set value during RUN


The counter set value can be changed during RUN. For the procedure, see section 4.8.

Precautions of counting input detection


In a counter instruction, the decrement takes place when the rise of the count input from off to on is
detected.
If the count input remains continuously on, since a decrement will only take place at the rise, no further
subtraction will take place.
In cases where the count input is initially on such as when the mode is changed to RUN or the power is turned
on with the mode set to RUN, decrement operation will not take place at the first scan.

RUN
(Power: on)

Counter input

Operation of
instruction
Not counting Counting

When used in combination with instructions which change the order of instruction execution such as MC and
MCE or JP and LBL (see below), the operation of the instruction may change depending on the timing of
instruction execution and the count input. Exercise caution in these cases.
- MC and MCE instructions
- JP and LBL instructions
- LOOP and LBL instructions
- CNDE instructions
- Step ladder instructions
- Subroutine instructions

For detailed information section 4.5

When combining a counter instruction with an AND stack instruction or pop stack instruction, take care that
the syntax is correct. For detailed information section 4.6
Related instructions
Counter instructions also include an up/down counter instruction (F118).
An increment instruction (F35) can be used to provide the same type of function.

2 - 45
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Directly specifying a set value area number as a counter set value


X0
F0 MV, K30, SV100 ........... 1

X1 CT 100
........... 2

X2 SV 100

C100 Y0

The above program operates as follows:


1 When execution condition (trigger) X0 is on the data transfer instruction [F0 (MV)] is executed, set the
K30 in SV100.
2 When the count input X1 turns on, decrement operation begins from the set value 30.

Specify [n] (the number of the set value area SV) to be the same number as the counter.
CT TM
Key input of FP Programmer II: C- EV
1 0 0 ENT T- SV
1 0 0

Counter number
Display:

CT 100

SV 100

These must Set value area number [n]


be the same.

Even if the value in the set value area (SV) is changed during decrement operation, the decrement operation
will continue from the value before the change. Counter operation from the new value will not begin until the
counter is reset and the count input subsequently changes from off to on.
In the case of a hold type counter, the set value area (SV) will not reset if the power is turned off or the mode
changed from RUN to PROG. If the SV value is changed during RUN, the set value will be preset the next time
the power is turned on or the mode is changed from PROG. to RUN.

2 - 46
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Counter operation when a set value area number is directly specified


1 When the execution condition (trigger) for a high - level instruction is on, the value is set in the set
value area (SV). The following diagram shows an example of using the high - level instruction F0 (MV).

X0
F0 MV, K30, SV100
SV100
X1 CT 100 30

SV 100 1 Transfers to SV area


X2

C100 Y0

2 When the reset input is off, the value in the set value area (SV) is preset in the elapsed value area
(EV).

X1 CT 100
SV100 EV100
SV 100 30 30
X2
2 Presetting
C100 Y0

3 Each time the count input X1 turns on, the value in the elapsed value area (EV) decrements.

X1 CT 100
SV100 EV100
SV 100 30 30
X2
29
28 3 Decrements
C100 Y0 27

4 When the elapsed value area (EV) reaches zero, the counter contact C with the same number turns
on.

X1 CT 100
SV100 EV100
SV 100 30 0
X2
4 Decrement operation ends
C100 Y0

See section 1.2 for an explanation of the set value area (SV) and the elapsed value area (EV).

2 - 47
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Examples of applying direct specification of set value area numbers

Example 1: Changing set values based on specified conditions


The set value is K50 when X0 is on and K30 when X1 is on.
Ladder diagram Boolean
X1 X0 ST/ X 1
F0 MV, K 50, SV 100 AN X 0
X0 X1
F0 (MV)
F0 MV, K 30, SV 100 K 50
SV 100
X2
CT 100 ST/ X 0
AN X 1
X3 F0 (MV)
SV 100
K 30
C100 Y0 SV 100
ST X 2
ST X 3
Time chart CT 100
SV 100
Example when X0 turns on ST C 100
on OT Y 0
X0 off
on
X1 off
on 50 times
X2 off ......
on
X3 off
on
C100 off

SV100 K0 K50

Example 2: Example of setting a set value from external digital switches


The BCD data of the digital switches connected to X0 through XF
is converted and becomes the set value.
Connection diagram

FP0 control unit

0 7 9 4 Set value
of counter
Digital switch: WX0
Ladder diagram Boolean
R10 ST R 10
F81 (BIN)
F81 BIN, WX 0, SV 100 WX 0
R11 SV 100
CT 100
ST R 11
ST R 12
R12 SV 100 CT 100
SV 100
C100 Y0 ST C 100
OT Y 0

2 - 48
FP0 Basic Instructions

2.3 Explanation of Basic Instructions


Step Availability

SR Shift register 1 FP0 C10, C14, C16,


C32, T32, SL1

Outline One bit shift of 16-bit [word internal relay (WR)] data to the left. 5

Program example
Boolean
Ladder Diagram
Address Instruction

X0 Data input SR WR 3 0 ST X 0
0 D 1 ST X 1
X1
Shift input 2 ST X 2
1
X2 3 SR WR 3
Reset input
2

Operands
Index
Relay Timer/Counter Register Constant Index
Instruction register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D: Data area N/A N/A A N/A N/A N/A N/A N/A N/A N/A N/A N/A: Not Available

Explanation of example
If the X1 turns on when X2 is in the off state, the contents of the internal relay WR3 (internal relays R30 to R3F)
are shifted one bit to the left.
“1” is shifted in R30 if X0 is on, and “0” is shifted in R30 if X0 is off.
If the X2 turns on, the contents of WR3 are reset to 0.
on
X0 off
on
X1 off
on
X2 off
on
R30 off
on
R31 off
on
R32 off
on
R33 off
on
R34 off

2 - 49
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Description
Shifts the specified data area (WR) one bit to the left.
When the shift input turns on (rises), the contents of WR are shifted one bit to the left.
During the shift, 1 is set in the empty bit (least significant bit) if the data input is on, or 0 if the data input is off.
When shift input is turned on:
WR3 3F . . . . . . . . . . . . . . . . 30
Bit position 15 . . 12 11 . . 8 7 . . 4 3 . . 0
Binary data 0 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0

Shifts one bit


to the left.

Binary data 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0

Data input (X0) on: set bit to 1.


Data input (X0) off: set bit to 0.

When the reset input turns on, the contents of WR are cleared.
When reset input is turned on:
WR (Binary data) 0 0 1 1 0 1 0 0 0 0 0 1 1 0 0 1
Contents of WR3 are
cleared to 0.

WR (Binary data) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Precautions during programming


The SR instruction needs data input, a shift input, and a reset input.
When the reset input and the shift input are detected simultaneously, the reset input has priority.

Shift input

Reset input

Data area (Rn)

Reset input is given priority

If the internal relay area is specified as a hold type, take care that the data in the area is not reset to “0” when
the power turns on.
When combining a shift register instruction with an AND stack instruction or pop stack instruction, take care
that the syntax is correct. For details, refer to section 4.6.

2 - 50
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Cautions on shift input detection


With SR instructions, shift operation takes place when the off - on rise of the shift input is detected.
If the shift input remains continuously on, a shift will only take place at the rise. No further shifts will take place.
In cases where the shift input is initially on such as when the mode is changed to RUN or when the power is
turned on with the mode set to RUN, a shift operation will not take place at the first scan.

RUN
(Power: on)

Shift input

Opration of
instruction
Does not shift Shifts

When used in combination with instructions which change the order of instruction execution such as MC and
MCE or JP and LBL (see below), the operation of the instruction may change depending on the timing of
instruction execution and the shift input.
Exercise caution in these cases.
- MC and MCE instructions
- JP and LBL instructions
- LOOP and LBL instructions
- CNDE instruction
- Step ladder instructions
- Subroutine instructions

For detailed information section 4.5

Related instructions
In addition to the shift register instruction, there is also a left/right shift register instruction (F119).
The same type of operation can also be implemented using a data shift instructions (F100 to F113) or a data
rotate instructions (F120 to F123).

2 - 51
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

MC Master control relay 2


FP0 C10, C14, C16,
C32, T32, SL1
MCE Master control relay end 2

Outline Executes the program between the MC and MCE when the execution
condition (trigger) turns on. 6
When the execution condition (trigger) is off, output between the MC
and MCE is turned off.
Program example
Boolean
Ladder Diagram
Address Instruction

Execution condition Master control relay number


0 ST/ X 0
X0 (trigger)
0 (MC 1 ) 1 MC 1
X1 Y1 3 ST X 1
3
4 OR Y 1
Y1
Master 5 OT Y 1
control
X2 Y2 6 ST X 2
area
6
Y2 7 OR Y 2
8 OT Y 2

9 (MCE 1 ) 9 MCE 1

Master control relay number

Explanation of example
Executes the program from the MC1 instruction to the MCE1 instruction when the execution condition
(trigger) turns on.
If the execution condition (trigger) is off, output is turned off without processing being carried out between the
MC1 and MCE1 instructions.

on
X0 off
Execution
on
condition off
(trigger)
on
X1 off
on
Y1 off
on
X2 off
on
Y2 off

2 - 52
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Description
Executes program between the MC and MCE instructions when the execution condition (trigger) turns on.
When the execution condition (trigger) is in the off state, the instructions operate as follows.
Instruction Condition of input and output
OT All off
KP Holds the state.
SET Holds the state.
RST Holds the state.
TM Reset
CT Holds the value.
SR Holds the value.
Differential See next page.
Other instructions Not executed

You must be careful when using one of the instructions below, which are executed by detecting the leading
edge of execution condition such as the differential instruction. For more details, refer to section 4.5.
- DF instruction
- Count input for CT instruction
- Count input for F118 (UDC) instruction
- Shift input for SR instruction
- Shift input for F119 (LRSR) instruction
- NSTP instruction

The numbers of points noted below can be used with the MC and MCE instructions.
Type Number of points
FP0 all types 32 points (MC0 to MC31)

2 - 53
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Operation of differential instructions between MC and MCE


If a differential instruction is used between MC and MCE, the output will vary as follows depending on the
timing of the MC execution condition (trigger) and the input of differential instruction.

X0
MC 0
X1 Y0
DF

MCE 0

Time chart 1 Time chart 2


on on
off off
X0 X0
on on
off off
X1 on
X1 on
off off
Y0 Y0
Execution of previous Execution of previous
differential instruction differential instruction
The input X1 of the differential instruction has not The input X1 of the differential instruction has
changed with respect to the previous execution, changed from off to on with respect to the
therefore differential output is not obtained. previous execution, therefore differential output
is obtained.

Output will not be obtained if the same execution condition (trigger) is specified for an MC instruction and a
differential instruction. If output is needed, enter the differential instruction outside of the MC to MCE
instruction sequence.

X0
MC 0
X0 Y0
DF

MCE 0

X0
MC 0
X0 R0

MCE 0
R0 Y0
DF

2 - 54
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Precautions during programming


A second MC- MCE instruction pair can be entered (nested) between an initial MC- MCE instruction pair.
(There is no limit to the number of nestings.)
X0
MC 0
X1 Y0

X2
MC 1
X3 Y1

X4
MC 2
X5 Y2

MCE 2

MCE 1

MCE 0

The program cannot be executed if:


If either MC or MCE is missing
The order of the MC and MCE instructions is reversed.

MCE 0
X1 Y0

X0
MC 0

There are two or more master control instruction sets with the same number.
X0
MC 0
X1 Duplicated use
MC 0
X2 Y0

MCE 0

MCE 0

2 - 55
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

JP Jump 2
FP0 C10, C14, C16,
C32, T32, SL1
LBL Label 1

Outline Skips to the LBL instruction with the same number as the JP instruction.
Program example
Boolean
Ladder Diagram
Address Instruction

X1 10 ST X 1
10 (JP 1)
11 JP 1
Label number

....

....
20 (LBL 1 ) 20 LBL 1

Explanation of example
When the execution condition (trigger) X1 turns on, the program skips from JP1 to LBL1.
X1 Program
(JP 1) X1: on
No
Program execution
(LBL 1 )
Program

Description
When the execution condition (trigger) turns on, the program jumps to the label (LBL) instruction that has the
same number as the specified jump number.
The program then continues with the instructions starting from the address of the label that is the jump
destination.
The same label is used for the JP and LOOP instructions. Any of these instructions can be used as the
starting point for the jump destination.
The numbers of points noted below can be used with the JP and LBL instructions.
Type Number of points
FP0 all types 64 points (JP0 to 63)
(LBL0 to LBL63)

Two or more JP instructions with the same number can be used in a program.
X0
(JP 1)
R20
(JP 1)
X20
LOOP 1, DT0

(LBL 1 )

2 - 56
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Two or more LBL instructions with same number cannot be specified in a program.
If a label for the jump destination is not programmed, a syntax error will occur.
You must be careful when using one of the instructions below, which are executed by detecting the rise of a
execution condition such as the differential instruction. For more details, refer to section 4.5.
- DF (leading edge differential)
- Count input with CT (counter)
- Count input with F118 (up/down counter)
- Shift input with SR (shift register)
- Shift input with F119 (left/right shift register)
- NSTP (next step)
Precautions during programming
If the address of the LBL instruction precedes the address of the JP instruction, the scan will not terminate
and an operation bottleneck error may occur.
The JP instruction and LBL instruction cannot be used in the step ladder area (the area between SSTP and
STPE).
You cannot perform a jump from a main program to a sub program (a subroutine program or interrupt program
after the ED instruction), from a sub program to a main program, or from a sub program to another sub
program.
TM, CT, and SR instruction operation between JP and LBL instructions
When the LBL instruction is located after the JP instruction:
- TM instruction: The TM instruction is not executed. X1
If it is not executed once during a single scan (JP 1)
the correct time cannot be guaranteed.
- CT instruction: Even if the count input is on, counting is not
performed. The elapsed value is preserved. (LBL 1 )
- SR instruction: Even if the shift input is on, no shift is
The program jumps when
performed. The contents of the specified the execution condition
register are preserved. (trigger) turns on.

When the LBL instruction is located before the JP instruction: (LBL 1 )


- TM instruction: Because the TM will run several times during a
single scan, the correct time cannot be
guaranteed. X1
(JP 1)
- CT instruction: If the state of the count input does not change
during the scan, it will operate in the usual way. The program is repeated
- SR instruction: If the state of the shift input does not change when the execution condi-
during the scan, it will operate in the usual way. tion (trigger) turns on.

2 - 57
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Differential instruction operation between JP and LBL instructions


If a differential instruction is used in the area between a JP and LBL instruction, be aware that the output will
differ as shown below depending on the execution condition (trigger) of the JP and the input timing of
differential instruction.
X0
JP 1
X1 Y0
DF

LBL 1

Time chart 1 Time chart 2


on on
X0 off X0 off
on on
X1 off X1 off
on on
off off
Y0 Y0
Previous Previous
execution of Since the execution Since the execution
condition (trigger) X1 for execution of
differential differential condition (trigger) X1 for
instruction the differential instruction the differential instruction
did not change from the instruction
changed from on to off
previous execution, the from the previous
differential output cannot execution, the differential
be obtained. output can be obtained.

When the execution condition (trigger) for the JP instruction equals the execution condition (trigger) for the
differential instruction, the leading edge (or trailing edge) of the execution condition for the differential
instruction will not be detected.
If the differential output is required, do not write the differential instruction between the JP and LBL
instructions.
X1
JP 1
X1 Y1
DF/ Not executed.

LBL 1

X1 Y1
DF/
X1 Placed outside of the area
JP 1 between JP and LBL.

LBL 1

2 - 58
FP0 Basic Instructions

2.3 Explanation of Basic Instructions


Step Availability

LOOP Loop 4
FP0 C10, C14, C16,
C32, T32, SL1
LBL Label 1

Outline Skips to the LBL instruction that has the same number as the LOOP
instruction and executes what follows, repeatedly, until the data of a
specified operand becomes “0”. 7
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST X 1
X1
11 F0 (MV)
10 F0 MV, K5, DT 0
K 5
Label number
DT 0
16 (LBL 1 )
16 LBL 1
X1 Number of timers for loop

....
30 LOOP 1 , DT 0
30 ST X 1
S
31 LOOP 1
Label number
DT 0

S 16-bit area for setting number of times for loop operation

Operands
Index
Relay Timer/Counter Register Constant Index
Instruction register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
S N/A A A A A A A A N/A N/A A N/A: Not Available

2 - 59
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Description
When the execution condition (trigger) turns on, 1 is subtracted from the contents of S and if the result is other
than 0, the program jumps to the label (LBL instruction) that has the same number as the specified number.
The program then continues with the instructions starting from the address of the label that is the loop
destination.
Set the number of times to execute the program with the LOOP instruction. When the number of times set in S
(K constant) reaches 0, the jump will not occur even if the execution condition (trigger) turns on.
X0
F0 MV, K5 , DT 0

(LBL 1 )
If the value of DT0 is K5, then after performing the jump 5 times,
X1 even if X1 is set to on, the jump operation is not executed.
LOOP 1 , DT 0

If the contents of memory area specified by S is 0 from the beginning, the jump operation is not executed (it is
ignored).
The numbers of points noted below can be used with the LOOP and LBL instructions.
Type Number of points
FP0 all types 64 points (LOOP0 to 63)
(LBL0 to LBL63)

A label is common for the JP instruction and the LOOP instruction. One can be used as the destination for all
instructions as many times as required.
X0
JP 1
R20
JP 1

LBL 1
X20
LOOP 1, DT0

Two or more LBL instructions with the same number cannot be specified in a program.
If a label for the loop destination is not programmed, a syntax error will occur.
Flag conditions
S Error flag (R9007): Turns on and remains on when the specified value in the data area “S”
becomes less than “0” (when the most significant bit (bit position 15) of the
specified data area becomes “1”).
S Error flag (R9008): Turns on for an instant when the specified value in the data area becomes
less than “0” (when the most significant bit (bit position 15) of the specified
data area becomes “1”).

2 - 60
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

TM, CT, and SR instruction operation between the LOOP and LBL instructions
When the LBL instruction is located before the LOOP instruction:
- TM instruction: Because the timer will run several times during (LBL 1 )
a single scan, the correct time cannot be
guaranteed.
- CT instruction: If the state of the count input does not change X0
during the scan, it will operate in the usual way. LOOP 1, DT 0
- SR instruction: If the state of the shift input does not change The program is repeated
during the scan, it will operate in the usual way. when the execution
condition (trigger) turns on
(DT0=1).

When the LBL instruction is located after the LOOP instruction: X0


LOOP 1, DT 0
- TM instruction: The TM instruction is not executed.
If it is not executed once during a single scan,
the correct time cannot be guaranteed.
- CT instruction: Even if the count input is on, counting is not (LBL 1 )
performed. The elapsed value is preserved.
The program jumps when
- SR instruction: Even if the shift input is on, no shift is the execution condition
performed. (trigger) turns on (DT0=1).
The contents of the specified register are
preserved.
Precautions during programming
When the label is written in an address before the LOOP instruction, be careful of the following points.
- Be sure to have the instruction that sets the number of times for loop operation before the area
between the LBL and LOOP instructions.
- Set the instructions that will be repeated between LBL and LOOP so that they have the same trigger
as the LOOP instruction.
- During repeating, it is possible that one scan can exceed the surveillance time for operation jams and
cause a operation bottleneck error.

Example 1: Execute 5 times of both F0 (MV) instructions when X5 is on.


X5
F0 MV, K 5, DT 0

LBL 10
X5
F0 MV, WR 0, DT 10
F0 MV, WR 1, DT 20
LOOP 10, DT 0

Example 2: Send the value of DT100 to DT200 through DT219.


R0
F0 MV, K 20, DT 0
F0 MV, K 0, IX
LBL 10
R0
F0 MV, DT100, IXDT200
F35 +1, IX
LOOP 10, DT 0

2 - 61
Basic Instructions FP0

2.3 Explanation of Basic Instructions

The LOOP instruction and LBL instruction cannot be used in the step ladder area (the area between SSTP
and STPE).
You cannot perform a jump from a main program to a sub - program (a subroutine program or interrupt
program after the ED instruction), from a sub - program to a main program, or from a sub - program to another
sub - program.
You must be careful when using one of the instructions below, which are executed by detecting the leading
edge of execution condition (trigger) such as the differential instruction. For more details, refer to section 4.5.
- DF (leading edge differential)
- Count input of CT (counter)
- Count input of F118 (up/down counter)
- Shift input of SR (shift register)
- Shift input of F119 (left/right shift register)
- NSTP (next step)

2 - 62
FP0 Basic Instructions

2.3 Explanation of Basic Instructions


Step Availability

ED End 1 FP0 C10, C14, C16,


C32, T32, SL1

Outline Indicates the end of the ordinary program. 8

Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0
1 OR R 0
X0 X1 R0
0 2 AN/ X 1
R0 3 OT R 0

....

....
R0 X2 Y0
96 96 ST R 0
97 AN X 2
99 ( ED )
98 OT Y 0
99 ED

Description
Indicates the end of the ordinary program.

Program area
Address 0

Ordinary program

( ED )
Subroutine program

Interrupt program

Program areas are divided into an ordinary program area (main program) and “subroutine” and “interrupt
program” areas (sub - programs) using this instruction.
Enter subroutine programs and interrupt programs after the ED instruction.

2 - 63
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

CNDE Conditional end 1 FP0 C10, C14, C16,


C32, T32, SL1

Outline Ends one scan of the program when the execution condition (trigger)
turns on. 9
Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0
1 OR Y 0
X0 X1 Y0 2 AN/ X 1
0
3 OT Y 0
Y0

....
....
Execution condition (Trigger)
X3 96 ST X 3
96 ( CNDE )
97 CNDE
R0 X2 Y1
98 98 ST R 0
99 AN/ X 2
100 OT Y 1

Description
The CNDE instruction enables you to end one scan of the program.
When the execution condition (trigger) turns on, the program finishes and the input, output, and other such
operations are performed. When the operations are completed, the program then returns to the starting
address.
You can adjust the timing that operations are performed by performing the operations only after a required
number of program scans are completed.
The CNDE instruction cannot be performed in sub - programs such as subroutine programs or interrupt
programs. Use the CNDE instruction in the main program area only.
Two or more CNDE instructions can be used within the main program.
You must be careful when using one of the instructions below, which are executed by detecting the leading
edge of a execution condition (trigger) such as the differential instruction. For more details, refer to section
4.5.
- DF (leading edge differential)
- Count input for CT (counter)
- Count input for F118 (UDC) (up/down counter)
- Shift input for SR (shift register)
- Shift input for F119 (LRSR) (left/right shift register)
- NSTP (next step)

2 - 64
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Program execution when the CNDE


instruction is executed (when X3 turns on).
X0 X1 Y0

Y0

X3
CNDE Program execution
during normal scanning.
This part of the program is
not executed when the CNDE
instruction is executed.
ED

2 - 65
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

SSTP Start step 3

NSTP Next step (pulse execution type) 3

NSTL Next step (scan execution type) 3


FP0 C10, C14, C16,
C32, T32, SL1

CSTP Clear step 3

STPE Step end 1

Outline SSTP: Indicates the start of a step ladder process. 10


NSTP: Opens a step ladder process.
NSTP is executed when the leading edge of its trigger is detected.
NSTL: Opens a step ladder process.
NSTL is executed every scan if its trigger is on.
CSTP: Resets the specified process.
STPE: Indicates the end of step ladder area.
Program example
Boolean
Ladder Diagram
Address Instruction
X0
(NSTP 1) 10 ST X 0
10
11 NSTP 1
14 (SSTP 1)
14 SSTP 1
Y0
17 17 OT Y 0
X1 18 ST X 1
18 (NSTL 2)
19 NSTL 2

22 (SSTP 2) 22 SSTP 2
....

....

X3 100 ST X 3
100 (CSTP 50 )
101 CSTP 50

104 (STPE ) 104 STPE

2 - 66
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Description
When the NSTL instruction or the NSTP instruction is executed, the process starting with the SSTP
instruction of the specified number is started and executed.
In a step ladder program, a process is identified as being from one SSTP instruction to the next SSTP or
STPE instruction.
The numbers of points noted below can be controled with the SSTP instruction.
Type Number of points
FP0 all types 128 processes (SSTP0 to SSTP127)

(SSTP 1)
Example:
X0 Y0

X1 Process 1
F0 MV, DT 0, DT 100

(SSTP 2)

Operations such as the sequence control, selection branch control, parallel branch control are easily
executed.

Sequence control
Only the necessary processes are switched and executed in order.

Process 1 Process 2 Process 3 Process 4

Selection branch control


The processes are selected and executed according to conditions.

Process 2

Process 1 Process 4

Process 3

Parallel branch merge control


Multiple processes are executed simultaneously.
After each process is completed, the next process is executed.
Process 2

Process 1 Process 4

Process 3

Note
The step ladder of FP0 is not held, so be sure to take the
necessary precautions.

2 - 67
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Syntax of step ladder instruction


SSTP (start step) instruction:
This instruction indicates the start of a process n.
Always have the SSTPn instruction at the head address of the program for process n (n: process number
from 0 to 127).

SSTP 1
Program
Process 1
SSTP 2
Program Process 2
SSTP 5
Program

In a step ladder program, a process n is identified as being from one SSTPn instruction to the next SSTP or
STPE instruction.
No two processes can have the same process number.
The OT instruction can be programmed at the address just after the SSTP instruction.
The SSTP instruction cannot be programmed in sub - program (subroutine or interrupt program area).
The area starting from the first SSTP instruction to the STPE instruction is referred to as the step ladder area.
The programs in this area are all controlled as processes. Other areas are referred to as ordinary ladder
areas.
Ordinary ladder area
SSTP 1

Step ladder area


SSTP n

STPE
Ordinary ladder area

There is a special internal relay that turns on for one scan only when a process on the step ladder starts.
(R9015: step ladder initial pulse relay.) This relay is used to perform operations for only one scan for counter
reset or other such process starts.

NSTL (Next step, scan execution type) instruction:


NSTP (Next step, differential (pulse) execution type) instruction:
When an NSTPn or NSTLn instruction is executed, the process with the same process number “n” as the
NSTP or NSTL instruction is opened.
The execution condition (trigger) for the next step instruction means the execution condition (trigger) to start
the process.
X0
NSTP 1 X0: off → on

SSTP 1 SSTP1: Starts

R0
NSTL 2 R0: on

SSTP 2 SSTP1: Cleared
SSTP2: Starts

2 - 68
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Declare the first process to start in the next step instruction in the ordinary ladder area.
A process can be started from the ordinary ladder area or from an already started process.
However, when you start a process with a next step instruction from within a process, the process that is
operating and contains the next step instruction is automatically cleared and the specified process starts.
Be aware that the outputs and other processes are actually turned off by the clear operation during the next
scan.
The NSTP instruction is a differential (pulse) execution type instruction, so it is executed for only one time
when the execution condition (trigger) turns on. Also, since it only detects if the execution condition (trigger)
has changed between on and off, when switched to the RUN mode or when the power supply is turned on
while in the RUN mode and the execution condition (trigger) is already on, the instruction is not executed.
RUN
(Power: on)

Shift input

Operations
with NSTP Not Executed
executed
Operations
with NSTL
Executed Executed

When you use the NSTP instruction with one of the following instructions that changes the order of the
execution of instructions, be aware that the operation of the instructions will differ depending on the timing of
their execution and their triggers.
- MC to MCE instructions
- JP to LBL instructions
- LOOP to LBL instructions
- CNDE instruction
- Step ladder instructions
- Subroutine instruction

For detailed information section 4.5

When combining the NSTP instruction with an AND stack instruction or POP stack instruction, be careful that
the programming is correct. For more details, refer to section 4.6.

2 - 69
Basic Instructions FP0

2.3 Explanation of Basic Instructions

CSTP (clear step) instruction:


When a CSTP instruction is executed, the process “n” with the same process number “n” is cleared. This
instruction can be used to clear the final process or to clear the processes when the parallel branch merge
control is executed.
X0
NSTP 50 X1: on
X1 ↓
CSTP 50 Process 50: cleared

SSTP 50
Program Process 50
SSTP 51

A process can also be cleared from the ordinary ladder area or from a process that is already started.

STPE (step end) instruction:


The STPE instruction indicates the end of the step ladder area. Be sure to write this instruction at the end of
the last process. Thus, the final process of the step ladder is from SSTP to STPE.
Ordinary ladder area
SSTP 1

Step ladder area


SSTP n
Process n
STPE
Ordinary ladder area

In the above situation, process n is the last process.


The STPE instruction is used only once in the main program. (This instruction cannot be programmed in
sub - program such as a subroutine program or interrupt program.)
Precautions during programming
You do not have to program processes in the order of process numbers.
In the step ladder area, you cannot use the following instructions:
- Jump instructions (JP and LBL)
- Loop instructions (LOOP and LBL)
- Master control instructions (MC and MCE)
- Subroutine instructions (SUB and RET) (*)
- Interrupt instructions (INT and IRET)
- ED instruction
- CNDE instruction
(*): The CALL instruction can be used within the step ladder area.

2 - 70
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

When you need to clear an entire processes in step ladder program, use the master control (MC and MCE)
instructions as shown below.

Example: All processes are cleared when X0 becomes on.


X0
MC 0

SSTP 1

SSTP 2 Step Master control


ladder instructions
SSTP 3 area

STPE

MCE 0

ED

It is not necessary to execute processes in order of process numbers. You can execute two or more
processes at the same time.
Once you force on or off an output that is programmed in a process not yet executed, the output condition is
maintained until the process starts even if the forced on and off operation is canceled.
Step ladder operations
When the step ladder processes are programmed, program execution proceeds in the ordinary ladder area
and in the processes triggered by the next step instructions (NSTL or NSTP). Processes that have not been
triggered are ignored.

Ordinary ladder area Executing


SSTP 1
Not executing process 1 Not executing

SSTP 2
Executing process 2 Executing
SSTP 9
Not executing process 9 Not executing
STPE
Ordinary ladder area Executing
ED

In the diagram, program execution occurs in the ordinary ladder areas and in process 2.
The moment the step ladder process is opened, step ladder internal pulse relay R9015 turns on for an instant
only in the first scan of the process. You can use R9015 to reset a counter or shift register used in the opened
process.

2 - 71
Basic Instructions FP0

2.3 Explanation of Basic Instructions

The execution state (start/stop) for processes are stored in special data registers DT9060 to DT9067.

Example: The start - up conditions for processes No. 16 to No. 31


Bit position 15 . . 12 11 . . 8 7 . . 4 3 . . 0
Process number 31 . . 28 27 . . 24 23 . . 20 19 . . 16
DT9061 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
When bit position 8 of DT9061 is “1”, the process no. 24 is starting.

For the relationship between the register number and process number, refer to section 8.6.

Notes on process clear


If the next step instruction is executed in an active process, that process is automatically cleared. However,
the actual clear operation does not occur until the next scan. Therefore, for one scan during the process
transition, there will be two simultaneously active processes. If you do not want them to be on at the same
time, program with an interlock circuit. If there is a possibility of processes being simultaneously on because
of hardware response delays, adapt hardware processing to take the response delay into account.

Example:
SSTP 0
Y1 Y0

X0
NSTP 1

SSTP 1
Y0 Y1

If the process is cleared, the instructions in that process operate as follows.


Instruction Operation status
OT All off
KP Holds the state.
SET Holds the state.
RST Holds the state.
TM Reset the elapsed value and timer contact output.
CT Holds the state at the time just before the trigger turns off.
SR Holds the state at the time just before the trigger turns off.
Differential instructions (*) Remembers the state of execution condition (trigger).
Other instructions Not executed.

(*): Same operation as when the execution condition (trigger) for the MC instruction turns off. Refer to the
explanation of the MC and MCE instructions.

2 - 72
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

You must be careful when using one of the instructions below, which are executed by detecting the leading
edge of execution condition (trigger) such as the differential instruction. For more details, refer to section 4.5.
- DF (leading edge differential)
- Count input of CT (counter)
- Count input of F118 (UDC) (up/down counter)
- Shift input of SR (shift register)
- Shift input of F119 (LRSR) (left/right shift register)
- NSTP (next step)
Examples of step ladder instructions
1 Sequence control of a process
This program repeats the same process until the work in a particular process is completed, then
switches to be the next process as soon as the work is completed.
Program an NSTL instruction to trigger the next process in each process. When the NSTL instruction
is executed, the next process is activated, and the currently executing process is cleared.
It is not necessary to execute in order of process number. You can also program the NSTL instruction
to trigger a previous process in response to current conditions.

Program example Process flowchart


1) When the X0 turns on, process 10 is executed.
2) When X1 turns on, process 10 is cleared and X0: on
process 11 is executed. Process 10 R0 turns on
3) When X2 turns on, process 11 is cleared and
process 12 is executed. X1: on
4) When X4 turns on, process 12 is cleared and
Process 11 R1 turns on
step ladder operation finishes.
X2: on

Process 12 R2 turns on
Program
X4: on
X0
(NSTP 10 )
END
(SSTP 10 )
R0
Time chart
X1 Process 10 on
(NSTL 11 ) X0 off
on
(SSTP 11 ) X1 off
R1
on
X2 Process 11 X2 off
(NSTL 12 ) on
X4 off
(SSTP 12 )
Executing
R2 R0 Cleared Process 10
X4 Process 12 Executing
R1 Cleared Process 11
(CSTP 12 )

(STPE ) R2 Executing
Cleared Process 12

2 - 73
Basic Instructions FP0

2.3 Explanation of Basic Instructions

2 Selection branch control of a process


This program selects and switches to the next process according to the actions and results of a
particular process. Each process loops until its work is completed.
Program two or more NSTL instructions to trigger the next process in a process. Depending on the
execution conditions, the next process is selected, triggered and program execution is transferred.

Program example Process flowchart


1) When X0 turns on, process 50 is executed.
X0: on
2) When X1 turns on in process 50, process 51 is
executed. Or when X2 turns on in process 50, Process 50 R0 turns on.
process 52 is executed.
3) When X3 turns on in process 51, process 51 is
cleared and process 60 is executed. X1: on X2: on
When X4 turns on in process 52, process 52 is Process 51 R1 turns Process 52 R2 turns
cleared and process 60 is executed. on. on.
4) When X5 turns on, process 60 is cleared and X3: on X4: on
step ladder operation finishes.
Process 60 R3 turns on.

X5: on

END

Program Time chart


When X1 turns on
X0 on
(NSTP 50 ) X0 off
(SSTP 50 ) on
R0 X1 off

X1 on
X2 off
(NSTL 51 ) Process 50
X2 on
(NSTL 52 ) X3 off

(SSTP 51 ) on
X4 off
R1
on
X5 off
Process 51
X3
(NSTL 60 ) Executing
R0 Cleared Process 50
(SSTP 52 )
Executing
R2 R1 Cleared Process 51
Executing
X4 R2 Cleared
Process 52
(NSTL 60 ) Executing
R3 Cleared Process 60
(SSTP 60 )
R3
Process 60
X5
(CSTP 60 )
(STPE )

2 - 74
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

3 Parallel branch merge control of a process


This program triggers multiple processes simultaneously. After each of the branch processes has
completed its work, they merge again before transferring execution to the next process.
Program multiple NSTL instructions for one trigger in a process.
To merge processes, include a flag indicating the state of the other processes in the transfer condition
for the next process.
When they merge and execute the next process, clear all uncleared processes at the same time.

Program example Process flowchart


1) When X0 turns on, process 0 is executed.
2) When X1 turns on, process 0 is cleared and X0: on
process 10 and process 20 are executed Process 0 R0 turns on.
simultaneously (Parallel branch control).
X1: on
3) When X2 turns on, process 10 is cleared and
process 11 is executed.
4) When X3 turns on, process 11 and process 20 R1 R2
Process 10 turns on. Process 20 turns
are cleared and process 30 is activated. (Merge
on.
control) X2: on
Clear process 20 with the clear instruction. Process 11
R3
Clear process 11 and execute process 30. turns on.
5) When X4 turns on, process 30 is cleared and
initial process 0 is executed again. X3: on
Process 30 R4 turns on.

X4: on

Program
X0
Time chart
on
(NSTP 0) X0 off
(SSTP 0) on
R0 X1 off

X1 on
Process 0 X2 off
(NSTL 10 )
(NSTL 20 ) on
X3 off
(SSTP 10 )
on
R1 X4 off
Process 10 Executing
X2 R0 Cleared Process 0
(NSTL 11 )
Executing Process 0
(SSTP 20 ) R1 Cleared
R2
Executing Process 10
R2 Cleared Process 20
R100 Process 20
Executing
R3 Cleared
(SSTP 11 )
Executing Process 11
R3 R4 Cleared Process 30
X3 R100 Process 11
(NSTL 30 )
(CSTP 20 )
(SSTP 30 )
R4
Process 30
X4
(NSTL 0 )
(STPE )

2 - 75
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

CALL Subroutine call 2

SUB Subroutine entry 1 FP0 C10, C14, C16,


C32, T32, SL1

RET Subroutine return 1

Outline CALL: Executes the specified subroutine program. 11


SUB: Indicates the start of the subroutine program.
RET: Indicates the end of the subroutine program.
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST X 0
X0
10 (CALL 1) 11 CALL 1
Subroutine program number

....

....
20 (ED )
20 ED
21 (SUB 1) 21 SUB 1
Subroutine

....

....
30 (RET )
30 RET

Description
When the execution condition (trigger) turns on, the CALL instruction is executed and the subroutine
program of the specified number is executed starting with the SUB instruction.
When the subroutine reaches the RET instruction, the program returns to the address after the CALL
instruction of the main program and the execution of the main program resumes.
X0 Main program
1
CALL n
Main program 3

ED
SUB n
2
Subroutine program

RET

When CALLn is executed, the program is executed in the order 1 , 2 , 3 shown above.

2 - 76
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Subroutine Program Syntax


The numbers of points noted below can be used with the subroutines.
Type Number of points
FP0 all types 16 subroutines (SUB0 to SUB15)

The subroutine program n (n: 0 to 15) is the program from the SUBn instruction to the RET instruction. Always
place the address (subroutine) after the ED instruction.
The CALL instruction can be programmed in the main program area, interrupt program area, or subroutine
program area.
Two or more CALL instructions with the same program number can be specified in a program.
Nesting of subroutines is possible until the 5th nesting.

SUB 0 (Stage 2)
CALL1 SUB 1 (Stage 3)
RET CALL2 SUB 2 (Stage 4)
RET CALL3 SUB 3 (Stage 5)
RET CALL4 SUB 4
RET
RET
Called up from inside of the subroutine.

5th nesting example

Flag conditions
S Error flag (R9007): Turns on and stays on when performing five nestings and executing the
CALL instruction for the subroutine of the 5th nesting.
S Error flag (R9008): Turns on for an instant when performing five nestings and executing the
CALL instruction for the subroutine of the 5th nesting.
Precautions during programming
In the interrupt program, a subroutine program cannot be used.

INT 1

SUB 11
Subroutine
RET

IRET

In the subroutine program, an interrupt program cannot be used.

SUB 11

INT 0

Interrupt program Subroutine

IRET

RET

2 - 77
Basic Instructions FP0

2.3 Explanation of Basic Instructions

A subroutine program cannot be written inside another subroutine program.

SUB 0

SUB 2 Subroutine program


Subroutine
program
RET

When the CALL instruction execution condition (trigger) is off


When the execution condition (trigger) of a subroutine turns off, the operations of that subroutine are not
carried out. (This is the same for CALL instructions within master controls or step ladders.)
If the execution condition (trigger) for the CALL instruction is in the off state, the subroutine program is not
executed. When the execution condition (trigger) for the CALL instruction is in the off state, the instructions in
the subroutine operate as follows.

Instruction Operation status


OT Holds the state.
KP Holds the state.
SET Holds the state.
RST Holds the state.
TM Does not perform any timing. If timing is not performed once per scan, the correct
time cannot be guaranteed.
CT Holds the elapsed value.
SR Holds the elapsed value.
Differential instuctions Same as when a differential instruction is used between MC and MCE instructions.
Refer to MC/MCE instruction.
Other instructions Not executed.

You must be careful when you use, in a subroutine, one of the instructions below that is executed by detecting
the leading of execution condition (trigger) such as the differential instruction. For more details, refer to
section 4.5.
- DF (leading edge differential)
- Count input of CT (counter)
- Count input of F118 (up/down counter)
- Shift input of SR (shift register)
- Shift input of F119 (left/right shift register)
- NSTP (next step)

2 - 78
FP0 Basic Instructions

2.3 Explanation of Basic Instructions


Step Availability

INT Interrupt 1
FP0 C10, C14, C16,
C32, T32, SL1
IRET Interrupt return 1

Outline INT: Indicates the start of the interrupt program.


IRET: Indicates the end of the interrupt program.
Program example
Boolean
Ladder Diagram
Address Instruction

(ED ) 20 ED
20
21 (INT 0) 21 INT 0

....

....
Interrupt program number
26 (IRET ) 26 IRET

Description
When an interrupt is input, the interrupt program of the number specified is executed starting from the INT
instruction.
When the interrupt program reaches the IRET instruction, the program returns to the address where the
interrupt occurred and the main program resumes.
X0 Interrupting
1
DF ICTL, S1, S2

Main program 3

ED
INT n
2
Interrupt
program n

IRET

When the interrupt occurs, the program is executed in the order 1 - 2 - 3 shown above.
Syntax of interrupt program
An interrupt program n is the program between the INTn instruction and the IRET instruction. The interrupt
program must always be placed after the ED instruction.
The number of the interrupt program is decided by the type of the interrupt.

Interrupt program Interrupt input (trigger) setting High - speed counter setting
number <when using F166/F167
instructions>
INT0 X0 Equal to ch0 target value
INT1 X1 Equal to ch1 target value
INT2 X2 
INT3 X3 Equal to ch2 target value
INT4 X4 Equal to ch3 target value
INT5 X5 
INT24 Periodical interrupt

2 - 79
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Before inputting an interrupt program


1 Declare the contact point to be used as the interrupt input (trigger).
Select the contact point to be used as the interrupt input (trigger) from between X0 to X5 and indicate
it at system register 403. For more details, refer to section 8.4.

Notes
• If the high - speed counter/pulse catch is set, that contact
cannot be used as the interrupt input (trigger).
• For the high speed counter - initiated interrupts and periodical
interrupts, it is not necessary to indicate the input (trigger)
contact.

2 Enable the execution of interrupt programs.


The default conditions are set with interrupt programs disabled. Enable the execution of interrupt
programs with the ICTL instruction. Refer to the explanation of the ICTL instruction.
Precaution when rewriting in RUN mode
If the program is rewritten in the RUN mode, execution will be inhibited for all interrupt programs, and will have
to be enabled again after the rewriting has been completed in the RUN mode. For details, refer to the
explanation of the ICTL instruction.
Interrupt program execution
There are three types of interrupt.
1 Interrupt from the input (trigger) contact (INT0 to INT5)

The interrupt occurs when the input (trigger) specified at system register 403 rises (on) or falls (off).
2 High - speed counter - initiated interrupt (INT0, INT1, INT3, INT4)
When executing either instruction F166 or instruction F167, the interrupt occurs when the high - speed
counter elapsed value equals the set target value. Refer to the explanations of the F166 instruction
and F167 instruction.
3 Periodical interrupt (INT24)
The interrupt occurs in fixed time intervals. Set the time interval with the ICTL instruction.
Set in 10 ms units ranging from 10 ms to 30 s (ICTL S1 = H2)
Set in 0.5 ms units ranging from 0.5 ms to 1.5 s (ICTL S1 = H3)
When the interrupt occurs, the interrupt program with the corresponding number is executed.
Main program Execution Execution

INT program Execution


on
Interrupt input off

If interrupts are disabled, an interrupt will occur only at the point when interrupts are enabled with the ICTL
instruction.

Main program Execution

INT program Execution

on
Interrupt input off

Enabled

2 - 80
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

When another interrupt program is being executed, an interrupt will occur after the current program is
completed.
Execution
Main program

INT1 program Execution

INT2 program Execution


on
INT2 input off

Precautions during programming


If either the INT instruction or IRET instruction is missing, a syntax error will result.
When an interrupt is issued, the operation memory corresponding to the interrupt input contact does not
undergo I/O refreshing. Therefore, contacts other than the interrupt input contact, such as the constantly - on
relay R9010, should be specified by the input conditions in the interrupt program.

INT 5
Specify R9010 or other
X5 contact instead of X5.
F0 MV, K10, DT100

IRET

A subroutine program cannot be used in an interrupt program.

INT 1

SUB 11
Subroutine
RET

IRET

An interrupt program cannot be used in a subroutine program.

SUB 11

INT 0

Interrupt program Subroutine

IRET

RET

2 - 81
Basic Instructions FP0

2.3 Explanation of Basic Instructions

An interrupt program cannot be programmed into another interrupt program.

INT 0

INT 1

IRET

Control when more than one interrupt occurs simultaneously.


When more than one interrupt occurs simultaneously, the interrupt program with the smaller number is
executed first. The other interrupt programs are then placed in the execution waiting state. After the first
interrupt program is completed, the other programs will be executed in order from the smallest number to the
greatest.

Example: Main program

INT1 program

INT2 program

INT3 program
on
INT1 input off
on
INT2 input off
on
INT3 input off

When more than one interrupt occurs while a interrupt program is being executed, the other programs will be
executed in order from the smallest number to the greatest after the program currently being executed is
finished.

Example: Main program

INT1 program
INT2 program

INT3 program

INT4 program
on
INT1 input off
on
INT2 input off
on
INT3 input off
on
INT4 input off

During execution of the INT3 program in the example above,


the INT2 input occured before INT1. But, after INT3 program is
done, the INT1 program is executed first and then INT2 is
executed.

2 - 82
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Interrupt program execution waiting state and clearing


When multiple interrupt programs occur simultaneously or new interrupt programs occur during the
execution of another interrupt program, the interrupt programs of lower preference are placed in the
execution waiting state. They are then executed in order of preference when the other interrupt programs are
completed.

Example: Main program

INT1 program

INT2 program
on
INT1 input off
on
INT2 input off

Execution waiting state


If placed in the execution waiting state, there is a time difference between the time of when the interrupt
occurs and when the interrupt program is actually executed. If you do not want to execute the interrupt
program placed in the execution waiting state because of this, it can be cleared with the ICTL instruction. An
interrupt program that is cleared will not be executed.
ICTL (INT2 clear) execution
Example: Main program

INT1 program

INT2 program
on Clear
INT1 input off
on
INT2 input off

When the execution of interrupt programs is disabled with the ICTL instruction, interrupts that occur are still
placed in the execution waiting state. When the execution is enabled with the ICTL instruction, the waiting
interrupt programs will then be executed. Programs in the execution waiting state can be cleared with the
ICTL instruction.

2 - 83
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

ICTL Interrupt control 5 FP0 C10, C14, C16,


C32, T32, SL1

Outline Performs the interrupt enable or disable and the interrupt clear.
Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0
X0 1 DF
0 ( DF ) ICTL, H 0, H 1
2 ICTL
S1 S2 H 0
H 1

S1 16-bit equivalent constant or 16-bit area for interrupt control data setting
S2 16-bit equivalent constant or 16-bit area for interrupt condition setting

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A A: Available

Description
When the ICTL instruction is executed, the interrupt program enable/disable and interrupt clear are set
according to the settings in S1 and S2.
Be sure to use ICTL instructions so that they are executed once at the leading edge of the execution condition
(trigger) using the DF instruction.
Two or more ICTL instructions can have the same execution condition (trigger).
Before executing an interrupt program, be sure to execute the ICTL instruction and enable the
execution of the interrupt program.

Note
If rewriting is done in the RUN mode while the interrupt function
is being used, the interrupt function will be disabled.
The ICTL instruction must be used to enable execution of the
interrupt program before it can be resumed.
Example of setting a periodical interrupt every 10ms from the
start of operations (enables the interrupt function to be resumed
for rewriting in the RUN mode)
R9013
ICTL, H2, K1 Executes INT24 every 10ms
R9034

2 - 84
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Input examples

Example 1: Setting a periodical interrupt every 10ms from the start of


operations
R9013
ICTL, H2, K1 Executes INT24 every 10ms

The R9013 (initial pulse relay) turns on only for the first scan after
operations begin.

Example 2: Enable INT0 to INT3 when X0 rises.


X0
DF ICTL, H0, HF X0: Enables INT0 to INT3 when on

Example 3: Clear interrupts other than INT0 after the INT0 program is
completed.
INT 0
R0 Interrupts other than INT0 are
ICTL, H100, H1 cleared when the program of
INT0 is finished
IRET

Specifying control data


S1: Specifying the control functions and interrupt types

Bit position 15 . . 12 11 . . 8 7 . . 4 3 . . 0
S1

Interrupt type selection


H00: INT 0 to INT5
H02: INT24 (10ms units)
H03: INT24 (0.5ms units)

Selection of control function


H00: Interrupt execution “enabled/disabled”
H01: Interrupt clear

If execution has been specified as enabled or disabled for INT0 to INT5, S1 = H0.
If an interrupt clear has been specified for INT0 to INT5, S1 = H100.
Set S1 = H2 (for units of 10ms) or S1 = H3 (for units of 0.5ms) to set the time interval for INT24.

2 - 85
Basic Instructions FP0

2.3 Explanation of Basic Instructions

S2: Specifying the control of interrupts


1 Enabling or disabling interrupt programs (when S1 = H0 or S1 = H1).
Set the control data in the bit corresponding to the number of the interrupt program that you want to control.
Set the bit corresponding to the number of the program you want to enable to “1.”
Set the bit corresponding to the number of the program you want to disable to “0.”

Example: Enabling interrupt programs INT1 and INT2 and disabling


interrupt programs INT3 through INT5.
Bit position 15 . . 12 11 . . 8 7 . . 4 3 . . 0
INT program
number 5 4 3 2 1 0
S2 (Enabled/ 0: INT program disabled
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0
disabled) 1: INT program enabled

2 Clearing interrupt programs (when S1 = H100 or S1 = H101)


Set the control data in the bit corresponding to the number of the interrupt program that you want to control.
Set the bit corresponding to the number of the program you want to clear to “0.”
Set the bit corresponding to the number of the program you want to not clear to “1.”

Example: Clear interrupt programs INT1 and INT2 and do not clear interrupt
programs INT3 through INT5.
Bit position 15 . . 12 11 . . 8 7 . . 4 3 . . 0
INT program
number 5 4 3 2 1 0
S2 (Enabled/ 0: INT program disabled
disabled) 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1: INT program enabled

3 Specifying periodical interrupt (when S1 = H2)


Specify the setting with decimal number. The time interval = value of S2 × 10 (ms).
Bit position 15 . .12 11 . . 8 7 . . 4 3 . . 0
S2

K0 to K3000

Time interval setting: K1 to K3000 (10ms to 30s)


INT24 disabled: K0

4 Specifying periodical interrupt programs (when S1 = H3)


The time interval = value of S2 × 0.5 (ms).
Bit position 15 . .12 11 . . 8 7 . . 4 3 . . 0
S2

K0 to K3000

Time interval setting: K1 to K3000 (0.5ms to 1.5s)


INT24 disabled: K0

2 - 86
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Example of enabling the execution of interrupt programs

Example:
DF ICTL, H0, H21

S1
S2

S1: H0000
Specifies enabling or disabling of interrupt programs that
correspond to interrupts at specified input (trigger) contact or
to target value match interrupts.
S2: H0021
Enable INT0 and INT5 (set bits 0 and 5 to “1”) and disable all
others.
Bit position 15 . . 12 11 . . 8 7 . . 4 3 . . 0
S2 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1
INT No. 5 4 3 2 1 0

Input contact
X0 (INT0)
X1 (INT1)
X2 (INT2)
X3 (INT3)
X4 (INT4)
X5 (INT5)

Set the bits to “1” that correspond to the interrupts to be enabled.


To enable all interrupts INT0 to INT5, set S2 = HFF.

When this ICTL instruction is executed, interrupt programs No. 1 and No. 5 will be executed when their
corresponding interrupt inputs occur.
ICTL instruction

Main program Execution


Execution
INT0 program Execution

INT5 program
on Execution
INT0 input off
on
INT5 input off

Condition Disabled Enabled

2 - 87
Basic Instructions FP0

2.3 Explanation of Basic Instructions

Example for clearing interrupt programs

Example:
DF ICTL, H100, HFE

S1
S2

S1: H0100
Clears interrupts from specified input (trigger) contact or
target value match interrupts.
S2: HFE
Clears interrupt INT0 (bit 0 is “0”) and does not clear the other
interrupts.
For the relationship between the set value and the interrupt
input (trigger) contact, refer to page 2 - 87 “Example of
enabling the execution of interrupt programs.”
Even though the INT0 interrupt input occured, when the interrupt program is disabled, the ICTL instruction
can still be used to clear the INT0 interrupt.
ICTL instruction

Main program Execution


Execution
INT0 program

INT1 program
on
INT0 input off Clear Execution
on
INT1 input off

Condition Disabled Enabled

Note
Since INT0 is cleared, the INT0 program will not be executed
even after execution is enabled. Since INT1 is not cleared, the
INT1 program will be executed after execution is enabled.

2 - 88
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Example for setting periodical interrupt

Example:
DF ICTL, H2, K1500

S1
S2

S1: H0002
Specifies periodical interrupt
S2: K1500
Specifies the time interval for the periodical interrupt.
With K1500, the time interval is K1500 x 10ms = 15000ms (15
sec)
After this ICTL instruction is executed, the periodical interrupt will occur every 15 seconds. At these times, the
INT24 interrupt program will be executed.
ICTL instruction
Execution

Main program Execution Execution

INT24 program

15s 15s

To stop the periodical interrupt program (INT24), execute the following program.

DF ICTL, H2, K0

2 - 89
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

ST = Word compare: Start equal 5

ST <> Word compare: Start equal not 5

ST > Word compare: Start larger 5


FP0 C10, C14, C16,
C32, T32, SL1
Word compare: Start equal
ST >= or larger
5

ST < Word compare: Start smaller 5

Word compare: Start equal


ST <= or smaller
5

Outline Performs start operation by comparing two word data items with the
comparison condition. The contact goes on or off depending on the
result of the comparison.
Program example
Boolean
Ladder Diagram
Address Instruction

0 ST =
DT 0
S1 S2
K 50
Y0
0 =, DT 0, K 50 5 OT Y 0
Y1 6 ST > =
> =, DT 0, K 60
6
DT 0
S1 S2
K 60
11 OT Y 1

S1 16-bit equivalent constant or 16-bit area to be compared


S2 16-bit equivalent constant or 16-bit area to be compared

Operand
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A A: Available

2 - 90
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Explanation of example
Compares the contents of data register DT0 with the constant K50 and K60. If DT0 = K50, the external output
relay Y0 goes on and if DT0 ≧ K60, the external output relay Y1 turns on.
DT0
60
50

10
on
Y0 off
on
Y1 off

Description
Compares the word data specified by S1 with the word data specified by S2 according to the comparison
condition.
The ST instruction initiates a logical operation as the liaison contact when the comparison result is a specified
status (=, <, >, etc.).
The result of the comparison operation is as follows:

Comparison Condition
instruction
S1 < S2 S1 = S2 S1 > S2
ST= off on off
ST < > on off on
ST> off off on
ST> = off on on
ST< on off off < > indicates ≠
>= indicates ≧
ST< = on on off <= indicates ≦

Precautions concerning usage


The start comparison instructions ST =, ST<>, ST >, ST >=, ST <, and ST <= are programmed from the bus
line.
If mixed with BCD or other type of data, the value will be regarded as negative when the most significant bit is 1
and a correct comparison may not be obtained. In this case, use an F81 or similar instruction to change the
data to binary data before making the comparison.
Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

2 - 91
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability
Double word compare:
STD = Start equal
9

Double word compare:


STD <> Start equal not
9

Double word compare:


STD > Start larger
9
FP0 C10, C14, C16,
Double word compare: C32, T32, SL1
STD >= Start equal or larger
9

Double word compare:


STD < Start smaller
9

Double word compare:


STD <= Start equal or smaller
9

Outline Performs start operation by comparing two double word data items with
the comparison condition. The contact goes on or off depending on the
result of the comparison. 12
Program example
Boolean
Ladder Diagram
Address Instruction

0 STD =
DT 0
S1 S2
DT 100
Y0
0 D =, DT 0, DT 100 9 OT Y 0
Y1 10 STD >
10 D >, DT 0, DT 100
DT 0
S1 S2
DT 100
19 OT Y 1

S1 32-bit equivalent constant or lower 16-bit area of 32-bit data to be compared


S2 32-bit equivalent constant or lower 16-bit area of 32-bit data to be compared

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
A: Available
S2 A A A A A A A N/A A A A N/A: Not Available

2 - 92
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Explanation of example
Compares the contents of data registers (DT1, DT0) with the data registers (DT101, DT100).
If (DT1, DT0) = (DT101, DT100), the external output relay Y0 goes on and if (DT1, DT0) > (DT101, DT100),
the external output relay Y1 goes on.
Description
Compares the double word data specified by S1 and S1+1 with the double word data specified by S2 and
S2+1 according to the comparison condition.
The STD instruction initiates a logical operation as the liaison contact when the comparison result is a
specified status (=, <, >, etc.).
The result of the comparison operation is as follows:

Comparison Condition
instruction
(S1+1, S1) < (S1+1, S1) = (S1+1, S1) >
(S2+2, S2) (S2+2, S2) (S2+2, S2)
STD= off on off
STD< > on off on
STD> off off on
STD> = off on on
STD< on off off < > indicates ≠
>= indicates ≧
STD< = on on off <= indicates ≦
When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1) are automatically determined once the
lower 16-bit areas (S1, S2) are specified.

The specified data area and the


following data area are handled
S1+1 S1 together as 32 - bit data.
Comparison

S2+1 S2

Precautions concerning usage


The start comparison instructions STD =, STD <>, STD >, STD >=, STD <, and STD <= are programmed from
the bus line.
If mixed with BCD or other type of data, the value will be regarded as negative when the most significant bit is 1
and a correct comparison may not be obtained. In this case, use an F83 or similar instruction to change the
data to binary data before making the comparison.
Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

2 - 93
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability
5
AN = Word compare: AND equal 5

AN <> Word compare: AND equal not 5

AN > Word compare: AND larger 5


FP0 C10, C14, C16,
Word compare: AND equal C32, T32, SL1
AN >= or larger
5

AN < Word compare: AND smaller 5

Word compare: AND equal


AN <= or smaller
5

Outline Performs AND operation by comparing two word data items with the
comparison condition. The contact goes on or off depending on the
result of the comparison. The contacts are connected in series. 13
Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0

X0 Y0 1 AN > =
0
> =, DT 0, K 60
DT 0
S1 S2 K 60
6 OT Y 0

S1 16-bit equivalent constant or 16-bit area to be compared


S2 16-bit equivalent constant or 16-bit area to be compared

Operand
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A A: Available

2 - 94
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Explanation of example
Compares the contents of data register DT0 with the constant K60 when X0 turns on. If DT0 ≧ K60 in the X0
on state, external output relay Y0 goes on. If DT0 < K60 or if X0 is in the off state, external output relay Y0 goes
off.
DT0

60

10
on
X0 off
on
Y0 off

Description
Compares the word data specified by S1 with the word data specified by S2 according to the comparison
condition.
The AN instruction results in serial connection as the liaison contact when the comparison result is a
specified status (=, <, >, etc.).
The result of the comparison operation is as follows:

Comparison Condition
instruction
S1 < S2 S1 = S2 S1 > S2
AN= off on off
AN< > on off on
AN> off off on
AN> = off on on
AN< on off off < > indicates ≠
>= indicates ≧
AN< = on on off <= indicates ≦

Precautions concerning usage


Multiple AND comparison instructions AN =, AN <>, AN >, AN >=, AN <, and AN <= can be used
consecutively.
If mixed with BCD or other type of data, the value will be regarded as negative when the most significant bit is 1
and a correct comparison may not be obtained. In this case, use an F81 or similar instruction to change the
data to binary data before making the comparison.
Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

2 - 95
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability
Double word compare:
AND = AND equal
9

Double word compare:


AND <> AND equal not
9

Double word compare:


AND > AND larger
9
FP0 C10, C14, C16,
Double word compare: C32, T32, SL1
AND >= AND equal or larger
9

Double word compare:


AND < AND smaller
9

Double word compare:


AND <= AND equal or smaller
9

Outline Performs AND operation by comparing two double word data items with
the comparison condition. The contact goes on or off depending on the
result of the comparison. The contacts are connected in series. 14
Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0

X0 Y0 1 AND >=
0
D> =, DT 0, DT100
DT 0

S1 S2 DT 100
10 OT Y 0

S1 32-bit equivalent constant or lower 16-bit area of 32-bit data to be compared


S2 32-bit equivalent constant or lower 16-bit area of 32-bit data to be compared

Operand
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
A: Available
S2 A A A A A A A N/A A A A N/A: Not Available

Explanation of example
Compares the contents of data registers (DT1, DT0) with the data registers (DT101, DT100) when X0 turns
on. If (DT1, DT0) ≧ (DT101, DT100) in the X0 on state, the external output relay Y0 goes on.
If (DT1, DT0) < (DT101, DT100) or if X0 is in the off state, the external output relay Y0 goes off.

2 - 96
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Description
Compares the double word data specified by S1 and S1+1 with the double word data specified by S2 and
S2+1 according to the comparison condition.
The AND instruction results in serial connection as the liaison contact when the comparison result is a
specified status (=, <, >, etc.).
The result of the comparison operation is as follows:

Comparison Condition
instruction
(S1+1, S1) < (S1+1, S1) = (S1+1, S1) >
(S2+1, S2) (S2+1, S2) (S2+1, S2)
AND= off on off
AND< > on off on
AND> off off on
AND> = off on on
AND< on off off < > indicates ≠
>= indicates ≧
AND< = on on off <= indicates ≦
When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1) are automatically determined once the
lower 16-bit areas (S1, S2) are specified.

The specified data area and the


following data area are handled
S1+1 S1 together as 32 - bit data.
Comparison

S2+1 S2

Precautions concerning usage


Multiple AND comparisons instructions AND =, AND <>, AND >, AND >=, AND <, and AND <= can be used
consecutively.
If mixed with BCD or other type of data, the value will be regarded as negative when the most significant bit is 1
and a correct comparison may not be obtained. In this case, use an F83 or similar instruction to change the
data to binary data before making the comparison.
Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

2 - 97
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability

OR = Word compare: OR equal 5

OR <> Word compare: OR equal not 5

OR > Word compare: OR larger 5


FP0 C10, C14, C16,
Word compare: OR equal C32, T32, SL1
OR >= or larger
5

OR < Word compare: OR smaller 5

Word compare: OR equal


OR <= or smaller
5

Outline Performs OR operation by comparing two word data items with the
comparison condition. The contact goes on or off depending on the
result of the comparison. The contacts are connected in parallel. 15
Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0
X0 Y0
0 1 OR > =

> =, DT 0, K 60 DT 0
K 60
S1 S2
6 OT Y 0

S1 16-bit equivalent constant or 16-bit area to be compared


S2 16-bit equivalent constant or 16-bit area to be compared

Operand
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A A: Available

2 - 98
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Explanation of example
Y0 goes on when X0 is in the on state, or when DT0 ≧ K60. If DT0 < K60 and if X0 is in the off state, then Y0
goes off.
DT0

60

10
on
X0 off
on
Y0 off

Description
Compares the word data specified by S1 with the word data specified by S2 according to the comparison
condition.
The OR instruction results in parallel connection as the liaison contact when the comparison result is a
specified status (=, <, >, etc.).
The result of the comparison operation is as follows:

Comparison Condition
instruction
S1 < S2 S1 = S2 S1 > S2
OR= off on off
OR< > on off on
OR> off off on
OR> = off on on
OR< on off off < > indicates ≠
>= indicates ≧
OR< = on on off <= indicates ≦

Precautions concerning usage


The OR comparison instructions OR =, OR <>, OR >, OR >=, OR <, and OR<= are programmed from the bus
line.
Multiple OR comparison instructions OR =, OR <>, OR >, OR >=, OR <, and OR <= can be used
consecutively.
If mixed with BCD or other type of data, the value will be regarded as negative when the most significant bit is 1
and a correct comparison may not be obtained. In this case, use an F81 or similar instruction to change the
data to binary data before making the comparison.
Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

2 - 99
Basic Instructions FP0

2.3 Explanation of Basic Instructions


Step Availability
Double word compare:
ORD = OR equal
9

Double word compare:


ORD <> OR equal not
9

Double word compare:


ORD > OR larger
9
FP0 C10, C14, C16,
Double word compare: C32, T32, SL1
ORD >= OR equal or larger
9

Double word compare:


ORD < OR smaller
9

Double word compare:


ORD <= OR equal or smaller
9

Outline Performs OR operation by comparing two double word data items with
the comparison condition. The contact goes on or off depending on the
result of the comparison. The contacts are connected in parallel. 16
Program example
Boolean
Ladder Diagram
Address Instruction

0 ST X 0
X0 Y0
0 1 ORD> =

D> =, DT 0, DT100 DT 0
1
DT 100
S1 S2 10 OT Y 0

S1 32-bit equivalent constant or lower 16-bit area of 32-bit data to be compared


S2 32-bit equivalent constant or lower 16-bit area of 32-bit data to be compared

Operand
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
A: Available
S2 A A A A A A A N/A A A A N/A: Not Available

Explanation of example
Compares the contents of data registers (DT1, DT0) with the data registers (DT101, DT100). When X0 turns
on or if (DT1, DT0) ≧ (DT101, DT100), the external output relay Y0 goes on.
If (DT1, DT0) < (DT101, DT100) and if X0 is in the off state, the external output relay Y0 goes off.

2 - 100
FP0 Basic Instructions

2.3 Explanation of Basic Instructions

Description
Compares the double word data specified by S1 and S1+1 with the double word data specified by S2 and
S2+1 according to the comparison condition.
The ORD instruction results in parallel connection as the liaison contact when the comparison result is a
specified status (=, >, <, etc.).
The result of the comparison operation is as follows:

Comparison Condition
instruction
(S1+1, S1)< (S1+1, S1) = (S1+1, S1) >
(S2+1, S2) (S2+1, S2) (S2+1, S2)
ORD= off on off
ORD< > on off on
ORD> off off on
ORD> = off on on
ORD< on off off < > indicates ≠
>= indicates ≧
ORD< = on on off <= indicates ≦
When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1) are automatically determined once the
lower 16-bit areas (S1, S2) are specified.
The specified data area and the
following data area are handled
S1+1 S1 together as 32 - bit data.
Comparison

S2+1 S2

Precautions concerning usage


The OR comparison instructions ORD =, ORD <>, ORD >, ORD >=, ORD <, and ORD <= are programmed
from the bus line.
Multiple OR comparison instructions ORD =, ORD <>, ORD >, ORD >=, ORD<, and ORD <= can be used
consecutively.
If mixed with BCD or other type of data, the value will be regarded as negative when the most significant bit is 1
and a correct comparison may not be obtained. In this case, use an F83 or similar instruction to change the
data to binary data before making the comparison.
Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

2 - 101
Basic Instructions FP0

2.3 Explanation of Basic Instructions

2 - 102
Chapter 3
High-level Instructions

3.1 Composition of High-level Instructions . . . . . . . . . . . . 3 - 3


3.1.1 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 3
3.1.2 High-level Instruction Numbers and
Program Input . . . . . . . . . . . . . . . . . . . . . . . . . . 3 - 4
3.1.3 High-level Instructions and Execution
Condition (Trigger) . . . . . . . . . . . . . . . . . . . . . . 3 - 4
3.1.4 Types of High-level Instructions . . . . . . . . . . 3 - 6

3.2 Table of High-level Instructions . . . . . . . . . . . . . . . . . . . 3 - 11

3.3 Explanation of High - level Instructions . . . . . . . . . . . . 3 - 22


High-level Instructions FP0

3- 2
FP0 High-level Instructions

3.1 Composition of High-level Instructions

3.1 Composition of High-level Instructions

3.1.1 Composition

Each high-level instruction is composed of a “F” type high-level instruction number,


boolean and operands.

Example: F0 (MV) instruction


The K0 (S) is copied to DT0 (D)
Execution condition
(Trigger)
Operand
Address
R0
0 F0 MV , K0 , DT 0

S D
Boolean
F type high- level instruction number: “0”

High - level instruction number:


High - level instruction numbers are used for inputting high-level instructions.
Boolean:
Boolean indicate the processing content of each instruction.
Operand:
Operands are used to specify the processing method and the storage area for
processed data, etc. Operands are classified into three types: S (source), D
(destination) and n (number for specifying control methods).
The number of operands differ depending on the instruction.

Operand types

S (Source): Data which is to be processed or data which sets the processing method.
D (Destination): Location where result of processing is stored.
n (number): Numeric data which is to be processed or which sets the processing method.
Operands are specified using constants or memory areas (registers) as explained in
section 1.2.
Refer to the explanations of the instructions as only certain memory areas (registers)
and constants can be used with each instruction.

3- 3
High-level Instructions FP0

3.1 Composition of High-level Instructions

3.1.2 High-level Instruction Numbers and Program Input

High-level instruction numbers are assigned to high-level instructions. For example, the
number assigned to the MV instruction (16-bit data transfer instruction) is F0.
A high- level instruction is entered by entering its high-level instruction number. Enter
“F” and then the number.

Example: F0 (MV) instruction


R0
F0 MV , K 0 , DT 0

F
0

3.1.3 High-level Instructions and Execution Condition (Trigger)

A high-level instruction is always used in a pair with its execution condition (trigger).
When the operation result of the relay sequence circuit specified as the execution
condition (trigger) is on, the high-level instruction is executed.

Example:
When the execution condition (trigger) R0 is on, the F0 (MV)
instruction is executed and K0 is transferred to DT0.
R0
F0 MV, K0, DT0

Execution condition
(Trigger)

Execution of high-level instructions


The high-level instruction of FP0 is executed once every scan (F type). While the
execution condition (trigger) is on, the instruction is executed at each scan repeatedly.
Execution condition on
(trigger) (R0) off

F - type High-level
instruction Execution
[ex. F0 (MV)] 1 scan

3- 4
FP0 High-level Instructions

3.1 Composition of High-level Instructions

There is no need to program the same execution condition (trigger) many times when
two or more high-level instructions are programmed consecutively with the same
execution condition (trigger).

Example:
R0
F81 BIN, WX3, DT3
R0
F60 CMP, DT3, K50

This execution condition (trigger) is not required.

R0
F81 BIN, WX3, DT3

F60 CMP, DT3, K50

3- 5
High-level Instructions FP0

3.1 Composition of High-level Instructions

3.1.4 Types of High-level Instructions

Data transfer instructions


These instructions transfer data to the specified memory area.

Example:
16-bit move: [F0 (MV)]
32-bit move: [F1 (DMV)]
Hexadecimal digit data move: [F6 (DGT)]
Block move: [F10 (BKMV)]
Program Example
R0
F0 MV, K50, DT1

An example of transferring K50 to DT1. The value of DT1 will


be K50.

BIN arithmetic instructions


These instructions add, subtract, multiply, or divide data.

Example:
16-bit data addition: [F22 (+)]
16-bit data subtraction: [F27 ( - )]
16-bit data multiplication: [F30 (*)]
16-bit data division: [F32 (%)]
Program Example
R0
F22 +, DT0, DT10, DT20

An example of adding the contents of DT0 and DT10.


The result is stored in DT20.
When DT0 = K12 and DT10 = K13, DT20 = K25.

3- 6
FP0 High-level Instructions

3.1 Composition of High-level Instructions

BCD arithmetic instructions


These instructions add, subtract, multiply, or divide BCD data.

Example:
4-digit BCD data addition: [F42 (B+)]
4-digit BCD data subtraction: [F47 (B - )]
4-digit BCD data multiplication: [F50 (B*)]
4-digit BCD data division: [F52 (B%)]
Program Example
R0
F42 B+, DT0, DT10, DT20

An example of adding the contents of DT0 and DT10 as BCD


data. The result is stored in DT20.
When DT0 = H12 and DT10 = H23, DT20 = H35.

Data comparison instructions


These instructions compare two data.

Example:
16-bit data compare: [F60 (CMP)]
32-bit data compare: [F61 (DCMP)]
Program Example
R0
F60 CMP, DT0, K100
R0 R900B R1

This program compares the value in DT0 and K100, and turns
R1 on if they are equal.
R900B is a flag which turns on when the result of a
comparison is “equal” (=).

3- 7
High-level Instructions FP0

3.1 Composition of High-level Instructions

Logic operation instructions


These instructions perform logic operations.

Example:
AND operation: [F65 (WAN)]
OR operation: [F66 (WOR)]
Exclusive OR operation: [F67 (XOR)]
Exclusive NOR operation: [F68 (XNR)]
Program Example
R0
F65 WAN, H1, H3, DT20

H1 : 0 ··· 0 0 0 1
Logic operation (1 when both are 1)
H3 : 0 ··· 0 0 1 1

DT20 : 0 ··· 0 0 0 1 (Operation result)

Data conversion instructions


These are instructions for converting data to and from binary data, ASCII code, BCD,
and other data types.

Example:
Hexadecimal data → ASCII code: [F71 (HEXA)]
ASCII code → Hexadecimal data: [F72 (AHEX)]
16-bit binary data → ASCII code: [F75 (BINA)]
16-bit data invert: [F84 (INV)]
Program Example
R0
F75 BINA, DT0, H4, DT10

DT0 : K - 110 Binary data


1 -
(minus sign) conversion
DT10 : H31 2D
DT11 : H20 31
ASCII code
0 1

3- 8
FP0 High-level Instructions

3.1 Composition of High-level Instructions

Data shift instructions


These instructions shift data.

Example:
Right shift of n bits: [F100 (SHR)]
Right shift of one hexadecimal digit: [F105 (BSR)]
Program Example
Shift 4 bits
R0
F100 SHR, DT0, K4

Example of a program which shifts the content of DT0 to the right


(toward the least significant bit) four bits (as specified) at a time.

DT0: 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

DT0: 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

R9009 (Carry flag) : 0

Data rotate instructions


These instructions rotate data within the specified range of the memory area.

Example:
16-bit data right rotate: [F120 (ROR)]
16-bit data left rotate: [F121 (ROL)]
Program Example
R0
F120 ROR, DT0, K4

Example of a program which rotates the content of DT0 to the right


(toward the least significant bit) four bits (as specified) at a time.

DT0: 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

DT0: 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

3- 9
High-level Instructions FP0

3.1 Composition of High-level Instructions

Bit manipulation instructions


These are instructions for operating on individual bits of 16-bit data such as data
registers.

Example:
Bit set: [F130 (BTS)]
Bit invert: [F132 (BTI)]
Number of on bits: [F135 (BCU)]
Program Example
R0
F130 BTS, DT0, K15

Example of a program which sets bit position 15 of DT0 to 1.


15
12 11 8 7 4 3 0
DT0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

15
12 11 4 3 0
DT0: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Bit position 15 is turned on (1).

Special instructions
These consist of a special instruction for use of the high-speed counter or other
functions and an instruction which performs operation or control for specific purposes.

Example:
On when equals target value: [F166 (HC1S)]
Pulse output: [F169 (PLS)]
Program Example
R0
F166, FC1S, K1, K10000, Y5

Example of a program which turns output relay Y5 on when the elapsed


value of channel 0 of the built - in high-speed counter reaches the target
value (K10000).

Value of
DT0
Elapsed
value
Time
on
Y5
off

3 - 10
FP0 High-level Instructions

3.2 Table of High-level Instructions

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


Data transfer instructions
F0 16-bit data move MV S, D (S) → (D) 5 3 - 23
F1 32-bit data move DMV S, D (S+1, S) → (D+1, D) 7 3 - 24
F2 16-bit data invert and MV/ S, D (S) → (D) 5 3 - 25
move
F3 32-bit data invert and DMV/ S, D (S+1, S) → (D+1, D) 7 3 - 27
move
F5 Bit data move BTM S, n, D The specified one bit in “S” is 7 3 - 29
transferred to the specified one bit
in “D”. The bit is specified by “n”.
F6 Hexadecimal digit DGT S, n, D The specified one digit in “S” is 7 3 - 31
(4- bit) data move transferred to the specified one digit
in “D”. The digit is specified by “n”.
F10 Block move BKMV S1, S2, D The data between “S1” and “S2” is 7 3 - 34
transferred to the area starting at
“D”.
F11 Block copy COPY S, D1, D2 The data of “S” is transferred to the 7 3 - 36
all area between “D1” and “D2”.
F12 Data read from ICRD S1, S2, D The data stored in the EEPROM 11 3 - 38
(* Note) EEPROM specified by “S1” and “S2” are
transferred to the area starting at
“D.”
P13 Data write to PICWT S1, S2, D The data specified by “S1” and “S2” 11 3 - 40
(* Note) EEPROM are transferred to the EEPROM
area starting at “D.”
F15 16-bit data exchange XCH D1, D2 (D1) → (D2), (D2) → (D1) 5 3 - 42
F16 32-bit data exchange DXCH D1, D2 (D1+1, D1) → (D2+1, D2) 5 3 - 44
(D2+1, D2) → (D1+1, D1)
F17 Higher/lower byte in SWAP D The higher byte and lower byte of 3 3 - 46
16-bit data exchange “D” are exchanged.
Binary arithmetic instructions
F20 16-bit data addition + S, D (D) + (S) → (D) 5 3 - 47
F21 32-bit data addition D+ S, D (D+1, D) + (S+1, S) → (D+1, D) 7 3 - 49
F22 16-bit data addition + S1, S2, D (S1) + (S2) → (D) 7 3 - 51
F23 32-bit data addition D+ S1, S2, D (S1+1, S1) + (S2+1, S2) → 11 3 - 53
(D+1, D)

Note
The instruction is available for FP0 T32 and FP0 C10/C14/C16/
C32 CPU Ver. 2.1 or later.
The instruction should be input using programming tool software
(FPWIN GR/NPST- GR Ver. 4.3 or later) and FP Programmer II
(AFP1114V2).

3 - 11
High-level Instructions FP0

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


F25 16-bit data - S, D (D) - (S) → (D) 5 3 - 55
subtraction
F26 32-bit data D- S, D (D+1, D) - (S+1, S) → (D+1, D) 7 3 - 57
subtraction
F27 16-bit data - S1, S2, D (S1) - (S2) → (D) 7 3 - 59
sutraction
F28 32-bit data D- S1, S2, D (S1+1, S1) - (S2+1, S2) → 11 3 - 61
subtraction (D+1, D)
F30 16-bit data * S1, S2, D (S1) × (S2) → (D+1, D) 7 3 - 63
multiplication
F31 32-bit data D* S1, S2, D (S1+1, S1) × (S2+1, S2) → 11 3 - 65
multiplication (D+3, D+2, D+1, D)
F32 16-bit data division % S1, S2, D (S1) ÷ (S2) → quotient (D) 7 3 - 67
remainder (DT9015)
F33 32-bit data division D% S1, S2, D (S1+1, S1) ÷ (S2+1, S2) → 11 3 - 69
quotient (D+1, D)
remainder (DT9016, DT9015)
F35 16-bit data +1 D (D) + 1 → (D) 3 3 - 71
increment
F36 32-bit data increment D+1 D (D+1, D) +1 → (D+1, D) 3 3 - 73
F37 16-bit data -1 D (D) - 1 → (D) 3 3 - 75
decrement
F38 32-bit data D- 1 D (D+1, D) - 1 → (D+1, D) 3 3 - 77
decrement
BCD arithmetic instructions
F40 4-digit BCD data B+ S, D (D) + (S) → (D) 5 3 - 79
addition
F41 8-digit BCD data DB+ S, D (D+1, D) + (S+1, S) → (D+1, D) 7 3 - 81
addition
F42 4-digit BCD data B+ S1, S2, D (S1) + (S2) → (D) 7 3 - 83
addition
F43 8-digit BCD data DB+ S1, S2, D (S1+1, S1) + (S2+1, S2) → 11 3 - 85
addition (D+1, D)
F45 4-digit BCD data B- S, D (D) - (S) → (D) 5 3 - 87
subtraction
F46 8-digit BCD data DB- S, D (D+1, D) - (S+1, S) → (D+1, D) 7 3 - 89
subtraction
F47 4-digit BCD data B- S1, S2, D (S1) - (S2) → (D) 7 3 - 91
subtraction
F48 8-digit BCD data DB- S1, S2, D (S1+1, S1) - (S2+1, S2) → 11 3 - 93
subtraction (D+1, D)
F50 4-digit BCD data B* S1, S2, D (S1) × (S2) → (D+1, D) 7 3 - 95
multiplication
F51 8-digit BCD data DB* S1, S2, D (S1+1, S1) × (S2+1, S2) → 11 3 - 97
multiplication (D+3, D+2, D+1, D)
F52 4-digit BCD data B% S1, S2, D (S1) ÷ (S2) → quotient (D) 7 3 - 99
division remainder (DT9015)

3 - 12
FP0 High-level Instructions

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


F53 8-digit BCD data DB% S1, S2, D (S1+1, S1) ÷ (S2+1, S2) → 11 3 - 101
division quotient (D+1, D)
remainder (DT9015, DT9016)
F55 4-digit BCD data B+1 D (D) + 1 → (D) 3 3 - 103
increment
F56 8-digit BCD data DB+1 D (D+1, D) + 1 → (D+1, D) 3 3 - 105
increment
F57 4-digit BCD data B- 1 D (D) - 1 → (D) 3 3 - 107
decrement
F58 8-digit BCD data DB- 1 D (D+1, D) - 1 → (D+1, D) 3 3 - 109
decrement
Data comparison instructions
F60 16-bit data compare CMP S1, S2 (S1) > (S2) → R900A:on 5 3 - 111
(S1) = (S2) → R900B:on
(S1) < (S2) → R900C:on
F61 32-bit data compare DCMP S1, S2 (S1+1, S1) > (S2+1, S2)→ 9 3 - 115
R900A:on
(S1+1, S1) = (S2+1, S2)→
R900B:on
(S1+1, S1) < (S2+1, S2)→
R900C:on
F62 16-bit data band WIN S1, S2, S3 (S1) > (S3) → R900A:on 7 3 - 119
compare (S2) ≦ (S1) ≦ (S3) → R900B:on
(S1) < (S2) → R900C:on
F63 32-bit data band DWIN S1, S2, S3 (S1+1, S1) > (S3+1, S3) → 13 3 - 121
compare R900A:on
(S2+1, S2) ≦ (S1+1, S1) ≦ (S3+1,
S3) → R900B:on
(S1+1, S1) < (S2+1, S2) →
R900C:on
F64 Block data compare BCMP S1, S2, S3 Compares the two blocks beginning 7 3 - 123
with “S2” and “S3” to see if they are
equal.
Logic operation instructions
F65 16-bit data AND WAN S1, S2, D (S1) ∧ (S2) → (D) 7 3 - 126
F66 16-bit data OR WOR S1, S2, D (S1) ∨ (S2) → (D) 7 3 - 128
F67 16-bit data exclusive XOR S1, S2, D {(S1) ∧ (S2)} ∨ {(S1) ∧ (S2)} → 7 3 - 130
OR (D)
F68 16-bit data exclusive XNR S1, S2, D {(S1) ∧ (S2)} ∨ {(S1) ∧ (S2)} → 7 3 - 132
NOR (D)
Data conversion instructions
F70 Block check code BCC S1, S2, Creates the code for checking the 9 3 - 134
calculation S3, D data specified by “S2” and “S3”
and stores it in “D”. The operation
method is specified by “S1”.
F71 Hexadecimal data → HEXA S1, S2, D Converts the hexadecimal data 7 3 - 137
ASCII code specified by “S1” and “S2” to
ASCII code and stores it in “D”.
Example:
HABCD → H 42 41 44 43
B A D C

3 - 13
High-level Instructions FP0

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


F72 ASCII code → AHEX S1, S2, D Converts the ASCII code specified 7 3 - 140
Hexadecimal data by “S1” and “S2” to hexadecimal
data and stores it in “D”.
Example:
H 44 43 42 41 → HCDAB
D C B A
F73 4 - digit BCD data → BCDA S1, S2, D Converts the four digits of BCD 7 3 - 144
ASCII code data specified by “S1” and “S2” to
ASCII code and stores it in “D”.
Example:
H1234 → H 32 31 34 33
2 1 4 3
F74 ASCII code → ABCD S1, S2, D Converts the ASCII code specified 9 3 - 148
4 - digit BCD data by “S1” and “S2” to four digits of
BCD data and stores it in “D”.
Example:
H 34 33 32 31 → H3412
4 3 2 1
F75 16-bit binary data → BINA S1, S2, D Converts the 16 bits of binary data 7 3 - 152
ASCII code specified by “S1” to ASCII code and
stores it in “D” (area of “S2” bytes).
Example:
K-100 → H 30 30 31 2D 20 20
0 0 1 -
F76 ASCII code → 16-bit ABIN S1, S2, D Converts the ASCII code specified 7 3 - 155
binary data by “S1” and “S2” to 16 bits of binary
data and stores it in “D”.
Example:
H 30 30 31 2D 20 20 → K-100
0 0 1 -
F77 32-bit binary data → DBIA S1, S2, D Converts the 32 bits of binary data 11 3 - 158
ASCII code of (S1+1, S1) to ASCII code and
stores it in (D+1, D).
F78 ASCII code → 32-bit DABI S1, S2, D Converts the ASCII code specified 11 3 - 161
binary data by “S1” and “S2” to 32 bits of
binary data and stores it in (D+1,
D).
F80 16-bit binary data → BCD S, D Converts the 16 bits of binary data 5 3 - 165
4-digit BCD data specified by “S” to four digits of
BCD data and stores it in “D”.
Example: K100 → H100
F81 4-digit BCD data → BIN S, D Converts the four digits of BCD 5 3 - 167
16-bit binary data data specified by “S” to 16 bits of
binary data and stores it in “D”.
Example: H100 → K100
F82 32-bit binary data → DBCD S, D Converts the 32 bits of binary data 7 3 - 169
8-digit BCD data specified by (S+1, S) to eight digits
of BCD data and stores it in (D+1,
D).
F83 8-digit BCD data → DBIN S, D Converts the eight digits of BCD 7 3 - 170
32-bit binary data data specified by (S+1, S) to 32
bits of binary data and stores it in
(D+1, D).
F84 16-bit data invert INV D Inverts each bit of data of “D”. 3 3 - 171
F85 16-bit data comple- NEG D Inverts each bit of data of “D” and 3 3 - 172
ment of 2 adds 1 (inverts the sign).

3 - 14
FP0 High-level Instructions

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


F86 32-bit data comple- DNEG D Inverts each bit of data of (D+1, D) 3 3 - 173
ment of 2 and adds 1 (inverts the sign).
F87 16-bit data absolute ABS D Gives the absolute value of the 3 3 - 174
data of “D”.
F88 32-bit data absolute DABS D Gives the absolute value of the 3 3 - 175
data of (D+1, D).
F89 16-bit data sign EXT D Extends the 16 bits of data in “D” 3 3 - 176
extension to 32 bits in (D+1, D).
F90 Decode DECO S, n, D Decodes part of the data of S and 7 3 - 178
stores it in “D”. The part is speci-
fied by “n”.
F91 7-segment decode SEGT S, D Converts the data of “S” for use in 5 3 - 181
a 7 - segment display and stores it
in (D+1, D).
F92 Encode ENCO S, n, D Encodes part of the data of “S” and 7 3 - 183
stores it in “D”. The part is speci-
fied by “n”.
F93 16-bit data combine UNIT S, n, D The least significant digit of each of 7 3 - 186
the “n” words of data beginning at
“S” are stored (united) in order in
“D”.
F94 16-bit data distrib- DIST S, n, D Each of the digits of the data of “S” 7 3 - 188
ute are stored in (distributed to) the
least significant digits of the areas
beginning at “D”.
F95 Character → ASCII ASC S, D Twelve characters of the character 15 3 - 190
code constants of “S” are converted to
ASCII code and stored in “D” to
“D+5”.
F96 16- bit table data SRC S1, S2, S3 The data of “S1” is searched for in 7 3 - 193
search the areas in the range “S2” to “S3”
and the result is stored in DT9037
and DT9038.
Data shift instructions
F100 Right shift of SHR D, n Shifts the “n” bits of “D” to the right. 5 3 - 195
multiple bits (n bits)
in a 16-bit data
F101 Left shift of multiple SHL D, n Shifts the “n” bits of “D” to the left. 5 3 - 197
bits (n bits) in a
16-bit data
F105 Right shift of one BSR D Shifts the one digit of data of “D” to 3 3 - 199
hexadecimal digit the right.
(4- bit)
F106 Left shift of one BSL D Shifts the one digit of data of “D” to 3 3 - 201
hexadecimal digit the left.
(4- bit)
F110 Right shift of one WSHR D1, D2 Shifts the one word of the areas by 5 3 - 203
word (16- bit) “D1” and “D2” to the right.
F111 Left shift of one WSHL D1, D2 Shifts the one word of the areas by 5 3 - 205
word (16- bit) “D1” and “D2” to the left.
F112 Right shift of one WBSR D1, D2 Shifts the one digit of the areas by 5 3 - 207
hexadecimal digit “D1” and “D2” to the right.
(4- bit)

3 - 15
High-level Instructions FP0

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


F113 Left shift of one WBSL D1, D2 Shifts the one digit of the areas by 5 3 - 209
hexadecimal digit “D1” and “D2” to the left.
(4- bit)
Basic function instructions
F118 UP/DOWN counter UDC S, D Counts up or down from the value 5 3 - 211
preset in “S” and stores the
elapsed value in “D”.
F119 Left/right shift LRSR D1, D2 Shifts one bit to the left or right with 5 3 - 214
register the area between “D1” and “D2” as
the register.
Data rotate instructions
F120 16-bit data right ROR D, n Rotate the “n” bits in data of “D” to 5 3 - 217
rotate the right.
F121 16-bit data left ROL D, n Rotate the “n” bits in data of “D” to 5 3 - 219
rotate the left.
F122 16-bit data right RCR D, n Rotate the “n” bits in 17- bit area 5 3 - 221
rotate with carry consisting of “D” plus the carry flag
flag (R9009) data (R9009) data to the right.
F123 16-bit data left RCL D, n Rotate the “n” bits in 17- bit area 5 3 - 223
rotate with carry consisting of “D” plus the carry flag
flag (R9009) data (R9009) data to the left.
Bit manipulation instructions
F130 16-bit data bit set BTS D, n Set the value of bit position “n” of 5 3 - 225
the data of “D” to 1.
F131 16-bit data bit reset BTR D, n Set the value of bit position “n” of 5 3 - 227
the data of “D” to 0.
F132 16-bit data bit invert BTI D, n Invert the value of bit position “n” of 5 3 - 229
the data of “D”.
F133 16-bit data bit test BTT D, n Test the value of bit position “n” of 5 3 - 231
the data of “D” and output the re-
sult to R900B.
F135 Number of on (1) BCU S, D Store the number of on bits in the 5 3 - 233
bits in 16-bit data data of “S” in ”D”.
F136 Number of on (1) DBCU S, D Store the number of on bits in the 7 3 - 234
bits in 32-bit data data of (S+1, S) in ”D”.
Basic function instruction
F137 Auxiliary timer STMR S, D Turn on the specified output and 5 3 - 235
(16- bit) R900D after 0.01 sec. × set value.
Special instructions
F140 Carry flag (R9009) STC  Turns on the carry flag (R9009). 1 3 - 238
set
F141 Carry flag (R9009) CLC  Turns off the carry flag (R9009). 1 3 - 239
reset
F143 Partial I/O update IORF D1, D2 Updates the I/O from the number 5 3 - 240
specified by “D1” to the number
specified by “D2”. Only possible for
I/O numbers X0 to XF and Y0 to
YF.

3 - 16
FP0 High-level Instructions

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


F144 Serial data commu- TRNS S, n The reception flag (R9038) is set to 5 3 - 241
(* Note 1) nication control for off to enable reception.
RS232C port Beginning at “S”, “n” bytes of the
data registers are sent from the
RS232C port.
F147 Printout PR S, D Converts the ASCII code data in 5 3 - 247
the area starting with “S” for print-
ing, and outputs it to the word ex-
ternal output relay WY specified by
“D”.
F148 Self - diagnostic ERR n Stores the self - diagnostic error 3 3 - 251
error set (n: K100 number “n” in DT9000, turns R9000
to K299) on, and turns on the ERROR/
ALARM LED.
F149 Message display MSG S Displays the character constant of 13 3 - 253
“S” in the connected programming
tool.
Special instructions (High - speed counter instructions)
F0 High - speed counter MV S, DT9052 Performs high- speed counter con- 5 3 - 254
control trol according to the control code
specified by “S”. The control code
is stored in DT9052.
F1 Change and read of DMV S, DT9044 Transfers (S+1, S) to high- speed 7 3 - 257
p
the elapsed value of (* Note 2) counter elapsed value area.
high - speed counter
DT9044,D Transfers value in high- speed 7 3 - 257
(* Note 2) counter elapsed value area to
(D+1, D).

Notes

1) This instruction is available for FP0 T32 and FP0 C10/C14/C16/


C32 CPU Ver. 1.2 or later.
2) Specify one of the following values for the elapsed value area
depending on the channel used.
ch0...DT9044, ch1...DT9048, ch2...DT9104, ch3...DT9108

3 - 17
High-level Instructions FP0

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


F166 Target value match HC1S n, S, Yn Turns output Yn on when the 11 3 - 260
(* Note ) on instruction elapsed value of the built-in high-
(with channel speed counter reaches the target
specification) value of (S+1,S).
F167 Target value match HC1R n, S, Yn Turns output Yn off when the 11 3 - 262
(* Note ) off instruction elapsed value of the built - in high-
(with channel speed counter reaches the target
specification) value of (S+1,S).
F168 Positioning control SPD1 n, S, Yn Outputs a positioning pulse from 5 3 - 264
(* Note ) (with channel the specified output (Y0 or Y1) ac-
specification) cording to the contents of the data
table beginning at “S”.
F169 Pulse output PLS S, n Outputs a pulse from the specified 5 3 - 268
(* Note ) instruction output (Y0 or Y1) according to the
(with channel contents of the data table begin-
specification) ning at “S”.
F170 PWM output PWM S, n Performs PWM output from the 5 3 - 270
(* Note ) instruction specified output (Y0 or Y1) accord-
(with channel ing to the contents of the data table
specification) beginning at “S”.
Basic function instruction
F183 Auxiliary timer DSTM S, D Turn on the specified output and 7 3 - 272
(32- bit) R900D after 0.01 sec. × set value.
(* Note)

Note
To input instructions F166 to F170 and F183, NPST - GR Ver. 4.2 or
later or FP Programmer II (AFP1114V2) is necessary.

3 - 18
FP0 High-level Instructions

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


Floating point type real number operation instructions
F309 Floating point type FMV S, D (S+1, S) → (D+1, D) 8 3 - 275
(* Note ) data move

F310 Floating point type F+ S1, S2, D ( S1+1, S1) + (S2+1, S2)→(D+1, D) 14 3 - 277
(* Note ) data addition

F311 Floating point type F- S1, S2, D ( S1+1, S1) - (S2+1, S2)→ (D+1,D) 14 3 - 279
(* Note ) data subtraction

F312 Floating point type F* S1, S2, D ( S1+1, S1)×(S2+1, S2)→(D+1, D) 14 3 - 281
(* Note ) data multiplication

F313 Floating point type F% S1, S2, D ( S1+1, S1)÷(S2+1, S2)→(D+1, D) 14 3 - 283
(* Note ) data division

F314 Floating point type SIN S, D SIN (S+1, S) → (D+1, D) 10 3 - 285


(* Note ) data sine operation

F315 Floating point type COS S, D COS (S+1, S) → (D+1, D) 10 3 - 287


(* Note ) data cosine opera-
tion
F316 Floating point type TAN S, D TAN (S+1, S) → (D+1, D) 10 3 - 289
(* Note ) data tangent
operation
F317 Floating point type ASIN S, D SIN - 1 (S+1, S) → (D+1, D) 10 3 - 291
(* Note ) data arcsine
operation
F318 Floating point type ACOS S, D COS - 1 (S+1, S) → (D+1, D) 10 3 - 293
(* Note ) data arccosine
operation
F319 Floating point type ATAN S, D TAN - 1 (S+1, S) → (D+1, D) 10 3 - 295
(* Note ) data arctangent
operation
F320 Floating point type LN S, D LN (S+1, S) → (D+1, D) 10 3 - 297
(* Note ) data natural
logarithm
F321 Floating point type EXP S, D EXP (S+1, S) → (D+1, D) 10 3 - 299
(* Note ) data exponent

F322 Floating point type LOG S, D LOG (S+1, S) → (D+1, D) 10 3 - 301


(* Note ) data logarithm

F323 Floating point type PWR S1, S2, D (S1+1, S1) ^ (S2+1, S2)→ (D+1, D) 14 3 - 303
(* Note ) data power

F324 Floating point type FSQR S, D (S+1, S) → (D+1, D) 10 3 - 305


(* Note ) data square root

F325 16-bit integer data to FLT S, D Converts the 16-bit integer data- 6 3 - 307
(* Note ) floating point type with sign specified by “S” to real
data conversion number data, and the converted
data is stored in “D.”

Note
The instruction is available for FP0 T32 and FP0 C10/C14/C16/C32
CPU Ver. 2.1 or later.

3 - 19
High-level Instructions FP0

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


F326 32-bit integer data to DFLT S, D Converts the 32-bit integer data 8 3 - 309
(* Note ) floating point type with sign specified by (S+1, S) to
data conversion real number data, and the con-
verted data is stored in (D+1, D).
F327 Floating point type INT S, D Converts real number data speci- 8 3 - 311
(* Note ) data to 16-bit fied by (S+1, S) to the 16-bit inte-
integer conversion ger data with sign (the largest inte-
(the largest integer ger not exceeding the floating point
not exceeding the data), and the converted data is
floating point type stored in “D.”
data)
F328 Floating point type DINT S, D Converts real number data speci- 8 3 - 313
(* Note ) data to 32-bit fied by (S+1, S) to the 32-bit inte-
integer conversion ger data with sign (the largest inte-
(the largest integer ger not exceeding the floating point
not exceeding the data), and the converted data is
floating point type stored in (D+1, D).
data)
F329 Floating point type FIX S, D Converts real number data speci- 8 3 - 315
(* Note ) data to 16-bit fied by (S+1, S) to the 16-bit inte-
integer conversion ger data with sign (rounding the
(rounding the first first decimal point down), and the
decimal point down converted data is stored in “D.”
to integer)
F330 Floating point type DFIX S, D Converts real number data speci- 8 3 - 317
(* Note ) data to 32-bit fied by (S+1, S) to the 32-bit inte-
integer conversion ger data with sign (rounding the
(rounding the first first decimal point down), and the
decimal point down converted data is stored in (D+1,
to integer) D).
F331 Floating point type ROFF S, D Converts real number data speci- 8 3 - 319
(* Note ) data to 16-bit fied by (S+1, S) to the 16-bit inte-
integer conversion ger data with sign (rounding the
(rounding the first first decimal point off), and the con-
decimal point off to verted data is stored in “D.”
integer)
F332 Floating point type DROFF S, D Converts real number data speci- 8 3 - 321
(* Note ) data to 32-bit fied by (S+1, S) to the 32-bit inte-
integer conversion ger data with sign(rounding the first
(rounding the first decimal point off), and the con-
decimal point off to verted data is stored in (D+1, D).
integer)
F333 Floating point type FINT S, D The decimal part of the real num- 8 3 - 323
(* Note ) data rounding the ber data specified in (S+1, S) is
first decimal point rounded down, and the result is
down stored in (D+1, D).
F334 Floating point type FRINT S, D The decimal part of the real num- 8 3 - 325
(* Note ) data rounding the ber data stored in (S+1, S) is
first decimal point rounded off, and the result is
off stored in (D+1, D).

Note
The instruction is available for FP0 T32 and FP0 C10/C14/C16/C32
CPU Ver. 2.1 or later.

3 - 20
FP0 High-level Instructions

3.2 Table of High-level Instructions

Number Name Boolean Operand Description Steps Page


F335 Floating point type F+/ - S, D The real number data stored in 8 3 - 327
(* Note ) data sign changes (S+1, S) is changed the sign, and
the result is stored in (D+1, D).
F336 Floating point type FABS S, D Takes the absolute value of real 8 3 - 329
(* Note ) data absolute number data specified by (S+1, S),
and the result (absolute value) is
stored in (D+1, D).
F337 Floating point type RAD S, D The data in degrees of an angle 8 3 - 331
(* Note ) data degrees → specified in (S+1, S) is converted
radians to radians (real number data), and
the result is stored in (D+1, D).
F338 Floating point type DEG S, D The angle data in radians (real 8 3 - 333
(* Note ) data radians → number data) specified in (S+1, S)
degrees is converted to angle data in de-
grees, and the result is stored in
(D+1, D).
Time series processing instruction
F355 PID processing PID S PID processing is performed de- 4 3 - 335
(* Note ) pending on the control value
(mode and parameter) specified by
(S to S+2) and (S+4 to S+10), and
the result is stored in the (S+3).

Note
The instruction is available for FP0 T32 and FP0 C10/C14/C16/C32
CPU Ver. 2.1 or later.

3 - 21
High - level Instructions FP0

3.3 Explanation of High - level Instructions

3.3 Explanation of High - level Instructions


Layout of instruction explanations

Ladder diagram
This indicates the
ladder diagram
screen displayed
when data is en- Number of steps
tered using the pro- This is the number of
gramming tool soft- steps used with this
ware (NPST - GR/ instruction.
FPWIN GR).

Available
operands
This indicates
types of registers
and constants Boolean
which can be
used as operands. This indicates how
codes are used
For information on
when data is en-
types of memory
tered using bool-
areas, refer to
ean entry with the
section 1.2.
programming tool
software (NPST -
GR/FPWIN GR).
Data is also en-
tered in this format
Explanation of
when using the FP
program Programmer II.
example and
flag
conditions
Using the pro-
gram shown in
the above ladder
diagram as an
example,
changes in
movements and
stored values are
shown, as well as
types of flags and
the conditions un-
der which they go
on and off.

3 - 22
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F0 (MV) 16-bit data move 5
C32, T32, SL1

Outline Copies 16-bit data to the specified 16-bit area.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 0 (MV)
DT 0
R0
F0 MV , DT 0 , DT 1 DT 1
10
S D

S 16-bit equivalent constant or 16-bit area (source)


D 16-bit area (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
The contents of data register DT0 are copied to data register DT1 when execution condition (trigger) R0 turns
on.

Description
The 16-bit data or 16-bit equivalent constant specified by S is copied to the area specified by D.
Application example

Example 1: Transfer K30 to timer set value area SV0 when R1 turns on.
R1
F0 MV, K 30, SV 0

Example 2: Transfer the timer elapsed value EV0 to data register DT0 when
R2 turns on.
R2
F0 MV, EV 0, DT 0

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 23
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F1 (DMV) 32-bit data move 7
C32, T32, SL1

Outline Copies 32-bit data to the specified 32-bit area.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 1 (DMV)
R0 DT 0
10 F1 DMV , DT 0 , DT100 DT 100

S D

S 32-bit equivalent constant or lower 16-bit area of 32-bit data (source)


D Lower 16-bit area for 32-bit area (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
The contents of data registers DT1 and DT0 are copied to data registers DT101 and DT100 when execution
condition (trigger) R0 turns on.
Higher Lower
16- bit area 16- bit area
.... The content (16 bits) of DT0 and the content (16 bits) of DT1 are joined and
treated as 32- bit data.
Content for Content for
DT1 DT0

.... 32- bit data is separated into the higher 16- bit data and the lower 16- bit data,
and stored in DT101 and DT100.
To DT101 To DT100

Description
The 32-bit data or 32-bit equivalent constant specified by S is copied to the 32-bit area specified by D.
When processing 32-bit data, the higher 16-bit areas (S+1, D+1) are automatically determined once the
lower 16-bit areas (S, D) are specified.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 24
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability

F2 (MV/) 16-bit data invert and move 5 FP0 C10, C14, C16,
C32, T32, SL1

Outline Inverts 16-bit data and transfers it to the specified 16-bit area.
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 2 (MV/)
DT 1
R0
10 F2 MV/ , DT 1 , DT 0 DT 0

S D

S 16-bit equivalent constant or 16-bit area to be inverted (source)


D 16-bit area (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
The contents of data register DT1 are inverted and transferred to data register DT0 when execution condition
(trigger) R0 turns on.
DT DT
0 H 3F 0 H 1111 [D]
1 H 5555 [S] 1 H 23A
2
Source [S]: H5555
H 1234 2 H FFFF
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
R0: on “F2 (MV/)” execution
Invert and transfer
Destination [D]: HAAAA
Invert and
DT DT Bit position 15
transfer · · 1211 · · 8 7 · · 4 3 · · 0
0 H 3F 0 H AAAA [D] 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
DT0
1 H 5555 1 H 23A
[S]
2 H 1234 2 H FFFF

3 - 25
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 16-bit data or 16-bit equivalent constant specified by S is inverted and transferred to the 16-bit area
specified by D.
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary data 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


Binary data 1 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 26
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F3 (DMV/) 32-bit data invert and move 7


FP0 C10, C14, C16,
C32, T32, SL1

Outline Inverts 32-bit data and transfers it to the specified 32-bit area.
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 3 (DMV/)
DT 100
R0
10 F3 DMV/ , DT100 , DT 0 DT 0

S D

S 32-bit equivalent constant or lower 16-bit area of 32-bit data to be inverted


(source)
D Lower 16-bit area of 32-bit data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
The contents of data registers DT101 and DT100 are inverted and transferred to data registers DT1 and DT0
when execution condition (trigger) R0 turns on.
DT DT
99 H 25AC 0 H 1111 [D]
100 H 2 [S] 1 H 34A
101 H FFFF 2 H FFFF

R0: on “F3 (DMV/)” execution

Invert and
DT transfer DT
99 H 25AC 0 H FFFD [D]
100 H 2 [S] 1 H 0
101 H FFFF 2 H FFFF

3 - 27
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 32-bit data or 32-bit equivalent constant specified by S is inverted and transferred to the 32-bit area
specified by D.

S 1 1 0 0 1 1 0 1 0 0 0 1 0 1 0 1
S+1 0 0 0 0 0 1 1 1 0 1 0 1 1 0 1 1

D 0 0 1 1 0 0 1 0 1 1 1 0 1 0 1 0
D+1 1 1 1 1 1 0 0 0 1 0 1 0 0 1 0 0

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 28
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability

F5 (BTM) Bit data move 7


FP0 C10, C14, C16,
C32, T32, SL1

Outline Copies bit data of one 16-bit area to the specified bit of another 16-bit
area

Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 5 (BTM)
R0 DT 1
10 F5 BTM , DT 1 , H C04 , DT 0
H C04
S n D DT 0

S 16-bit equivalent constant or 16-bit area (source)


n 16-bit equivalent constant or 16-bit area (specifies source and destination bit
positions)
D 16-bit area (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
n A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
The data at bit position 4 in data register DT1 is copied to bit position 12 in data register DT0 when execution
condition (trigger) R0 turns on.

Source [S]
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT1 1 1 0 0 1 1 0 1 0 0 0 1 0 1 0 1

Destination [D]
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
R0: on “F5 (BTM)”
Destination [D] execution
Bit position 15
· · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 1 0 1 0 0 1 1 0 1 0 0 1 0

3 - 29
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
A single bit in the 16-bit data or the 16-bit equivalent constant specified by S is copied to a bit of the 16-bit area
specified by D, as specified by n.
How to specify n
The “n” specifies the source and destination bit positions using hexadecimal data as follows:

n:H j 0 j

Bit position of source “S” (set range: H0 to HF)

Bit position of destination “D” (set range: H0 to HF)

Bit position specification for S and D


Bit position 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Set value HF HE HD HC HB HA H9 H8 H7 H6 H5 H4 H3 H2 H1 H0

For example, when bit position 10 is specified, “HA” should be specified.


If bit position 4 of S is being transferred to bit position 12 of D, n = HC04.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 30
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F6 (DGT) Hexadecimal digit move 7
C32, T32, SL1

Outline Copies hexadecimal digits at one 16-bit area to the specified digit
position in another 16-bit area
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 6 (DGT)
R0
DT 100
10 F6 DGT , DT 100 , H 0 , DT 0
H 0

S n D DT 0

S 16-bit equivalent constant or 16-bit area (source)


n 16-bit equivalent constant or 16-bit area (specifies source and destination
hexadecimal digit position and number of hexadecimal digits)
D 16-bit area (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
n A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Hexadecimal
3 2 1 0
digit position
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT100 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1
The lower four bits in the data register
DT100 is copied.
Hexadecimal
digit position
3 2 1 0
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 1

In this example, the upper 12 bits of DT0 do not change.

3 - 31
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The hexadecimal digits in the 16-bit data or in the 16-bit equivalent constant specified by S are copied to the
16-bit area specified by D, as specified by n.
Digits
Digits are units of 4 bits used when handling data.
With this instruction, 16 - bit data is separated into four digits. The digits are called in order hexadecimal digit 0,
digit 1, digit 2 and digit 3, beginning from the least significant four bits

16-bit data
15 · · 1211 · · 8 7 · · 4 3 · · 0
0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1

Hexadecimal Hexadecimal
digit 3 digit 1
Hexadecimal Hexadecimal
digit 2 digit 0

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

How to specify n
The n specifies the 3 source hexadecimal digit position, the 2 number of digits and the 1 destination
hexadecimal digit position to be copied using hexadecimal data as follows:
n:H j j j

3 Source: Starting hexadecimal digit position


H0: Hexadecimal digit 0
H1: Hexadecimal digit 1
H2: Hexadecimal digit 2
H3: Hexadecimal digit 3

2 Number of hexadecimal digits to be copied


H0: Copies 1 hexadecimal digits (4 bits)
H1: Copies 2 hexadecimal digits (8 bits)
H2: Copies 3 hexadecimal digits (12 bits)
H3: Copies 4 hexadecimal digits (16 bits)

1 Destination: Starting hexadecimal digit position


H0: Hexadecimal digit 0
H1: Hexadecimal digit 1
H2: Hexadecimal digit 2
H3: Hexadecimal digit 3

If the value for 1 , 2 and 3 is 0, such as “H000” in the example program on the previous page, use the short
form, “H0.”

3 - 32
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Examples of hexadecimal digit copy


The following patterns of digit transfer are possible based on the specification of n.
(1) When hexadecimal digit 1 of the source is copied to hexadecimal digit 1 of the destination:
digit 3 2 1 0

Specify n: H 1 0 1

D
digit 3 2 1 0
(2) When hexadecimal digit 3 of the source is copied to hexadecimal digit 0 of the destination:
digit 3 2 1 0
S

Specify n: H 0 0 3 (Short form: H3)

D
digit 3 2 1 0
(3) When multiple hexadecimal digits (hexadecimal digits 2 and 3) of the source are copied to multiple
hexadecimal digits (hexadecimal digits 2 and 3) of the destination:
digit 3 2 1 0
S

Specify n: H 2 1 2

D
digit 3 2 1 0
(4) When multiple hexadecimal digits (hexadecimal digits 0 and 1) of the source are copied to multiple
hexadecimal digits (hexadecimal digits 2 and 3) of the destination:
digit 3 2 1 0
S

Specify n: H 2 1 0

D
digit 3 2 1 0
(5) When 4 hexadecimal digits (hexadecimal digits 0 to 3) of the source are copied to 4 hexadecimal
digits (hexadecimal digits 0 to 3) of the destination:
digit 3 2 1 0

Specify n: H 1 3 0

D
digit 3 2 1 0

3 - 33
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability

F10 (BKMV) Block move 7


FP0 C10, C14, C16,
C32, T32, SL1

Outline Copies block data to the specified area. 4


Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 10 (BKMV)
R0 DT 0
10 F10 BKMV , DT 0 , DT 3 , DT 11
DT 3

S1 S2 D DT 11

S1 Starting 16-bit area (source)


S2 Ending 16-bit area (source)
D Starting 16-bit area (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A N/A N/A N/A N/A A
S2 A A A A A A N/A N/A N/A N/A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
The data of data register “DT0 to DT3” is copied to the data registers “DT11 to DT14” when execution
condition (trigger) R0 turns on.
DT DT
[S1] 0 K 10 10 K 0
1 K 11 11 K 0
Source
2 K 12 12 K 0
[S2] 3 K 13 13 K 0
4 K 14 14 K 0

R0: on “F10 (BKMV)” execution

DT DT
[S1] 0 K 10 10 K 0
1 K 11 11 K 10 [D]
2 K 12 12 K 11
[S2] 3 K 13 13 K 12
4 K 14 14 K 13

3 - 34
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
The data block specified by S1 and S2 is copied to the block starting from the 16-bit area specified by D.

Precautions during programming


The starting area S1 and ending area S2 should be the same type of operand.
The number of the lower address should be specified by S1, and the number of the higher address should be
specified by S2. If S1 is specified as higher than S2 and the instruction is executed, an operation error will
occur.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- S1 > S2
- The data block to be copied exceeds the limit of the destination area.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- S1 > S2
- The data block to be copied exceeds the limit of the destination area.

Precautions if the same type of memory area is specified for S1, S2, and D
The instruction is not executed if the address and type of memory area is the same for S1 and D.
If the block being transferred overlaps the transfer destination, the transfer results will be overwritten.
If S1 < D, the source data is copied starting from the higher address to the lower address in order (DT4 → DT3
→ DT2 → DT1).
DT DT
[S1] 0 K 10 0 K 10
1 K 11 1 K 10 [D]
2 K 12 2 K 11
[S2] 3 K 13 3 K 12
4 K 14 4 K 13

If S1 > D, the source data is copied starting from the lower address to the higher address in order (DT0 → DT1
→ DT2).
DT DT
0 K 10 0 K 12 [D]
1 K 11 1 K 13
[S1] 2 K 12 2 K 14
3 K 13 3 K 13
[S2] 4 K 14 4 K 14

3 - 35
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability

F11 (COPY) Block copy 7 FP0 C10, C14, C16,


C32, T32, SL1

Outline Copies the specified 16-bit data to a block with one or more 16-bit
areas.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 11 (COPY)
R0
DT 1
10 F11 COPY , DT 1 , DT10 , DT14
DT 10
S D1 D2 DT 14

S 16-bit equivalent constant or 16-bit area (source)


D1 Starting 16-bit area (destination)
D2 Ending 16-bit area (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
D1 N/A A A A A A N/A N/A N/A N/A A
A: Available
D2 N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
The contents of data register DT1 are copied to the block ranging from data register DT10 to DT14 when
execution condition (trigger) R0 turns on.
DT DT
0 K 10 10 K 0 [D1]
[S] 1 K 11 11 K 0
2 K 12 12 K 0
3 K 13 13 K 0
4 K 14 14 K 0 [D2]

R0: on “F11 (COPY)” execution

DT DT
0 K 10 10 K 11 [D1]
[S] 1 K 11 11 K 11
2 K 12 12 K 11
3 K 13 13 K 11
4 K 14 14 K 11 [D2]

3 - 36
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
The 16-bit equivalent constant or 16-bit area specified by S is copied to all 16-bit areas of the block specified
by D1 and D2.
Precautions during programming
The starting area D1 and ending area D2 should be the same type of operand.
The area of the lower address for the block being copied should be specified by D1, and the higher address
should be specified by D2. If D1 is specified as higher than D2 and the instruction is executed, an operation
error will occur.
When the same number as D1 and D2 is specified, the 16 - bit data will be copied to the 16 - bit area of that
number.
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- D1 > D2.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- D1 > D2.

3 - 37
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
11 C32, SL1 CPU ver. 2.1
F12 (ICRD) Data read from EEPROM or later/FP0 T32

Outline Reads data from the EEPROM area.


Program example
Boolean Non-ladder
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 12 (ICRD)
R0
K 0
10 F12 ICRD , K 0 , K10 , DT0
K 10
S1 S2 D DT 0

S1 Constant for specifying the starting address of EEPROM (for source data)
S2 32- bit equivalent constant or lower 16- bit area of 32- bit data for specifying
number of words to be read
D Starting 16- bit area for storing data read from EEPROM (for destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR WL SV EV DT LD FL IX IY K H
S1 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A A N/A N/A
S2 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A A N/A N/A
D N/A N/A N/A N/A N/A N/A A N/A N/A N/A N/A N/A N/A N/A
A: Available
N/A: Not Available
Explanation of example
10 blocks of data stored in blocks 0 to 9 of the EEPROM are transferred to data registers DT0 to DT639 when
execution condition (trigger) R0 turns on.
EEPROM area Data register DT
[S1] 0 64 words 0 [D]
1 64 words 64
[S2] 2 64 words 128

9 64 words 576

Address
(Block)

3 - 38
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
S2 blocks of data stored in the EEPROM starting from S1 are transferred into the data register specified by D.
At this time, the transferred data is handled in units of 1 block/64 words.
Precautions during programming
Values that can be specified by S1, S2 and D
Type
yp Memory area
S1 S2 D
FP0 C10, C14, C16 K0 to K9 K1 to K10 DT0 to DT1595
FP0 C32, T32, SL1 K0 to K95 K0 to K96 DT0 to DT6080

Volume of data held in the EEPROM


Type Volume that can be read
FP0 C10, C14, C16 640 words
FP0 C32, T32, SL1 6144 words

Because the initial data in the EEPROM is not fixed, caution is required when reading data that has not been
written to the EEPROM.
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The address specified by S1 does not exist in the EEPROM area.
- The area specified by S2 exceeds the limit of the EEPROM area.
- The area is exceeded when blocks specified by D and subsequent
parameters are transferred.
S Error flag (R9008): Turns on for an instant when:
- The address specified by S1 does not exist in the EEPROM area.
- The area specified by S2 exceeds the limit of the EEPROM area.
- The area is exceeded when blocks specified by D and subsequent
parameters are transferred.

3 - 39
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
11 C32, SL1 CPU ver. 2.1
P13 (PICWT) Data write to EEPROM or later/FP0 T32

Outline Writes data to the EEPROM area.


Program example
Boolean Non-ladder
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 P 13 (PICWT)
R0 DT 0
10 P13 PICWT , DT 0 , K10 , K0
K 10

S1 S2 D K 0

This instruction is a differential execution


type of instruction, and should be specified
with a “P” in front of the instruction number.

S1 Starting 16-bit area for storing source data


S2 32- bit equivalent constant or lower 16- bit area of 32- bit data for specifying
number of words to be write
D Starting address (constant) of EEPROM area for storing received data (for
destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR WL SV EV DT LD FL IX IY K H
S1 N/A N/A N/A N/A N/A N/A A N/A N/A N/A N/A N/A N/A N/A
S2 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A A N/A N/A
D N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A A N/A N/A
A: Available
N/A: Not Available
Explanation of example
10 blocks (640 words) of data stored in data registers DT0 to DT576 are transferred to blocks 0 to 9 in the
EEPROM area when execution condition (trigger) R0 turns on.
Data register DT EEPROM area

[S1] 0 64 words 0 [D]


64 64 words 1
[S2] 128 64 words 2

576 64 words 9

Address
(Block)

3 - 40
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
S2 blocks of data stored in the data register starting from S1 are transferred into the EEPROM area specified
by D. At this time, the transferred data is handled in units of 1 block/64 words.
Precautions during programming
Values that can be specified by S1, S2 and D
Type
yp Memory area
S1 S2 D
FP0 C10, C14, C16 DT0 to DT1595 K1 to K10 K0 to K9
FP0 C32, T32, SL1 DT0 to DT6080 K0 to K96 K0 to K95

Volume of data that can be held in the EEPROM


Type Volume that can be read
FP0 C10, C14, C16 640 words
FP0 C32, T32, SL1 6144 words

Data can be written to the EEPROM up to 10,000 times.


In order to prevent this instruction from being written to the EEPROM numerous times through erroneous
programming, it has been set up as a differential execution type of instruction (P13). When setting up the
program, however, please make sure that this instruction is not written to the EEPROM numerous times.
When the instruction is executed, the operation execution time will be approximately 5 ms longer for each
block (64 words).
This instruction should not be used in interrupt programs.
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The number specified by S1 does not exist in the memory area.
- The area specified by S2 exceeds the limit of the memory area.
- The area is exceeded when blocks specified by D and subsequent
parameters are transferred.
S Error flag (R9008): Turns on for an instant when:
- The number specified by S1 does not exist in the memory area.
- The area specified by S2 exceeds the limit of the memory area.
- The area is exceeded when blocks specified by D and subsequent
parameters are transferred.

3 - 41
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability

F15 (XCH) 16-bit data exchange 5 FP0 C10, C14, C16,


C32, T32, SL1

Outline Exchanges two 16-bit data items.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 15 (XCH)
DT 0
R0
10 F15 XCH , DT 0 , DT 12 DT 12

D1 D2

D1 16-bit area to be exchanged


D2 16-bit area to be exchanged

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D1 N/A A A A A A A A N/A N/A A
A: Available
D2 N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
The contents of data register DT0 and data register DT12 are exchanged when execution condition (trigger)
R0 turns on.
DT DT
[D1] 0 K 10 10 K 20
1 K 11 11 K 21
2 K 12 12 K 22 [D2]
3 K 13 13 K 23
4 K 14 14 K 24

R0: on “F15 (XCH)” execution

DT DT
[D1] 0 K 22 10 K 20
1 K 11 11 K 21
2 K 12 12 K 10 [D2]
3 K 13 13 K 23
4 K 14 14 K 24

3 - 42
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
The contents in the 16-bit areas specified by D1 and D2 are exchanged.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 43
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F16 (DXCH) 32-bit data exchange 5 FP0 C10, C14, C16,


C32, T32, SL1

Outline Exchanges two 32-bit data items.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 16 (DXCH)
R0 DT 0
10 F16 DXCH , DT 0 , DT12 DT 12

D1 D2

D1 Lower 16-bit area of 32-bit data to be exchanged


D2 Lower 16-bit area of 32-bit data to be exchanged

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D1 N/A A A A A A A N/A N/A N/A A
A: Available
D2 N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
The contents of data registers DT1 and DT0 and data registers DT13 and DT12 are exchanged when
execution condition (trigger) R0 turns on.
DT DT
[D1] 0 H 2 10 H 1234
1 H FFFD 11 H 5678
2 H 25AC 12 H 9ABC [D2]
3 H F23 13 H DEF1

R0: on “F16 (DXCH)” execution

DT DT
[D1] 0 H 9ABC 10 H 1234
1 H DEF1 11 H 5678
2 H 25AC 12 H 2 [D2]
3 H F23 13 H FFFD

3 - 44
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
The contents in the 32-bit areas specified by D1 and D2 are exchanged.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 45
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability
Higher/lower byte in FP0 C10, C14, C16,
F17(SWAP) 16-bit data exchange
3
C32, T32, SL1

Outline Exchanges higher and lower order bytes of the specified 16-bit data.
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 17 (SWAP)
DT 0
R0
10 F17 SWAP , DT 0

D 16-bit area to be exchanged higher and lower bytes

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR EV DT IX IY K H
A: Available
D N/A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
The higher and lower bytes of data register DT0 are exchanged when execution condition (trigger) R0 turns
on.
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0
Hexadecimal 0 4 D 2

Higher byte (8-bit) Lower byte (8-bit)

R0: on “F17 (SWAP)” execution

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


DT0 1 1 0 1 0 0 1 0 0 0 0 0 0 1 0 0
Hexadecimal D 2 0 4

Description
The higher order byte (higher 8-bit) and lower order byte (lower 8-bit) of the 16-bit area specified by D are
exchanged.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 46
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability
16-bit data addition
F20 (+) [D + S → D]
5 FP0 C10, C14, C16,
C32, T32, SL1

Outline Adds two 16-bit data items.


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0

R0 11 F 20 (+ )
10 F20 +, DT 0 , DT 2 DT 0
DT 2
S D
S 16-bit equivalent constant or 16-bit area (for addend)
D 16-bit area (for augend and result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
The contents of data register DT2 and data register DT0 are added together when execution condition
(trigger) R0 turns on.
When the decimal number 4 is in DT0 and the decimal number 8 is in DT2, as shown below.
Augend [D]: K8
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT2 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0

Addend [S]: K4 +
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0

Result [D]: K12


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT2 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0

Description
The 16-bit equivalent constant or 16-bit area specified by S and the 16-bit area specified by D are added
together.

Augend data Addend data Trigger turns on Result


(D) + (S) (D)

3 - 47
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow or underflow will result.
Under normal circumstances, do not allow an overflow or underflow to occur.
If the calculated result accidentally overflows or underflows, use of the F21 (D+) instruction (32-bit data
addition) is recommended.
When you use the F21 (D+) instruction instead of F20 (+), be sure to convert the 16-bit addend and augend
into 32-bit data using the F89 (EXT) instruction.
If an overflow or underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 16-bit
data (overflows or underflows).

3 - 48
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability
32-bit data addition
F21(D+) [(D+1, D) + (S+1, S) → (D+1, D)] 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Adds two 32-bit data items.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 21 (D+)
DT 0
R0
10 F21 D+ , DT 0 , DT 2 DT 2

S D

S 32-bit equivalent constant or lower 16-bit area of 32-bit area (for addend)
D Lower 16-bit area of 32-bit data (for augend and result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
The contents (32 bits) of data registers DT3 and DT2 and the contents (32 bits) of data registers DT1 and DT0
are added together when execution condition (trigger) R0 turns on.
Higher 16 bits Lower 16 bits

The specified data area and the


Contents of Contents of following data area are handled
DT3 DT2 together as 32- bit data.
(Addition)

Contents Contents
of DT1 of DT0
(Result is stored.)

← The lower 16 bits of added result is


stored in DT2 and the higher 16
Store to DT3 Store to DT2 bits of the result is stored in DT3.

3 - 49
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 32-bit equivalent constant or the 32-bit area specified by S and the 32-bit data specified by D are added
together.

Augend data Addend data Result


(D+1, D) + (S+1, S) (D+1, D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow or underflow will result.
Under normal circumstances, do not allow an overflow or underflow to occur.
If an overflow or underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 32-bit
data (overflows or underflows).

3 - 50
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
16-bit data addition FP0 C10, C14, C16,
F22 (+) [S1 + S2 → D]
7
C32, T32, SL1

Outline Adds two 16-bit data items and stores the result in the specified area.

Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 22 (+ )
R0
DT 0
10 F22+, DT 0 , DT 1 , DT 100
DT 1
S1 S2 D DT 100

S1 16-bit equivalent constant or 16-bit area (for augend)


S2 16-bit equivalent constant or 16-bit area (for addend)
D 16-bit area (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
The contents of data registers DT0 and DT1 are added when execution condition (trigger) R0 turns on. The
added result is stored in data register DT100.
when the decimal number 8 is in DT0 and the decimal number 4 is in DT1, as shown below.
Augend [S1]: K8
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0

Addend [S2]: K4 + (Addition)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0

Result [D]: K12


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT100 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0

3 - 51
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 16-bit data or 16-bit equivalent constant specified by S1 and S2 are added together. The added result is
stored in D.

Augend data Addend data Result


(S1) + (S2) (D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow or underflow will result.
Under normal circumstances, do not allow an overflow or underflow to occur.
If the calculated result accidentally overflows or underflows, use of the F23 (D+) instruction (32-bit data
addition) is recommended.
When you use the F23 (D+) instruction instead of F22 (+), be sure to convert the 16-bit addend and augend
into 32-bit data using the F89 (EXT) instruction.
If an overflow or underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 16-bit
data (overflows or underflows).

3 - 52
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


32-bit data addition Step Availability
[(S1+1, S1) + (S2+1, S2) FP0 C10, C14, C16,
F23 (D+) → (D+1, D)]
11
C32, T32, SL1

Outline Adds two 32-bit data items and stores the result in the specified area.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 23 (D+)
R0 DT 0
10 F23 D+ , DT 0 , DT 100 , DT 200
DT 100
S1 S2 D DT 200

S1 32-bit equivalent constant or lower 16-bit area of 32-bit data (for augend)
S2 32-bit equivalent constant or lower 16-bit area of 32-bit data (for addend)
D Lower 16-bit area of 32-bit data (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
S2 A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
The contents of data registers DT1 and DT0 and the contents of data registers DT101 and DT100 are added
when execution condition (trigger) R0 turns on. The added result is stored in data registers DT201 and
DT200.
Higher 16 bits Lower 16 bits

The specified data area and the


Contents of Contents of following data area are handled
DT1 DT0 together as 32- bit data.
(Addition)

Contents of Contents of
DT101 DT100

(Result is stored.)

← The lower 16 bits of added result is


stored in DT200 and the higher 16 bits
Store to DT201 Store to DT200 of the result is stored in DT201.

3 - 53
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 32-bit data or 32-bit equivalent constant specified by S1 and S2 are added together. The added result is
stored in D+1 and D.

Augend data Addend data Result


(S1+1, S1) + (S2+1, S2) (D+1, D)

When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1, D+1) are automatically determined once
the lower 16-bit areas (S1, S2, D) are specified.
Precautions during programming
If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow or underflow will result.
Under normal circumstances, do not allow an overflow or underflow to occur.
If an overflow or underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 32-bit
data (overflows or underflows).

3 - 54
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability
16-bit data subtraction
F25 ( - ) [D - S → D] 5 FP0 C10, C14, C16,
C32, T32, SL1

Outline Subtracts 16-bit data from the minuend.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 25 (- )
R0 DT 0
10 F25 - , DT 0 , DT 2
DT 2
S D

S 16-bit equivalent constant or 16-bit area (for subtrahend)


D 16-bit area (for minuend and result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Subtracts the contents of data register DT0 from the contents of data register DT2 when execution condition
(trigger) R0 turns on.

Example 1: When the decimal number 16 is in DT2 and the decimal number
4 is in DT0.
DT2
D: 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 K16
(Subtraction) -
DT0
S: K4
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
=
DT2
D: K12
0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0

Example 2: When the decimal number 3 is in DT2 and the decimal number 5
is in DT0.
DT2
D: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 K3
(Subtraction) -
DT0
S: K5
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
=
D: DT2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
K-2

3 - 55
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Subtracts the 16-bit equivalent constant or 16-bit area specified by S from the 16-bit area specified by D.

Minuend data Subtrahend data Result


(D) - (S) (D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow or underflow will result.
Under normal circumstances, do not allow an overflow or underflow to occur.
If the calculated result accidentally overflows or underflows, use of the F26 (D - ) instruction (32-bit data
subtraction) is recommended.
When you use the F26 (D - ) instruction instead of F25 ( - ), be sure to convert the 16-bit subtrahend and
minuend into 32-bit data using the F89 (EXT) instruction.
If an overflow or underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 16-bit
data (overflows or underflows).

3 - 56
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
32-bit data Subtraction
F26 (D - ) [(D+1, D) - (S+1, S) → (D+1, D)] 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Subtracts 32-bit data from the minuend.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 26 (D- )
DT 0
R0
10 F26 D - , DT 0 , DT 2 DT 2

S D

S 32-bit equivalent constant or lower 16-bit area of 32-bit area (for subtrahend)
D Lower 16-bit area of 32-bit data (for minuend and result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Subtracts the contents (32 bits) of data registers DT1 and DT0 from the contents (32 bits) of data registers
DT3 and DT2 when execution condition (trigger) R0 turns on.
Higher 16 bits Lower 16 bits

The specified data area and the


Contents of Contents of
following data area are handled
DT3 DT2
together as 32- bit data.
(Subtraction)

Contents of Contents of
DT1 DT0

(Result is stored.)

← The lower 16 bits of subtracted result


is stored in DT2 and the higher 16 bits
Store to DT3 Store to DT2 of the result is stored in DT3.

3 - 57
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Subtracts the 32-bit equivalent constant or the 32-bit data specified by S from the 32-bit data specified by D.

Minuend data Subtrahend data Result


(D+1, D) — (S+1, S) (D+1, D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow or underflow will result.
Under normal circumstances, do not allow an overflow or underflow to occur.
If an overflow or underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 32-bit
data (overflows or underflows).

3 - 58
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
16-bit data subtraction FP0 C10, C14, C16,
F27 ( - ) [S1 - S2 → D]
7
C32, T32, SL1

Outline Subtracts 16-bit data from the minuend and stores the result in the
specified area.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 27 (- )
R0
DT 0
10 F27 - , DT 0 , DT 1 , DT 100
DT 1
S1 S2 D DT 100

S1 16-bit equivalent constant or 16-bit area (for minuend)


S2 16-bit equivalent constant or 16-bit area (for subtrahend)
D 16-bit area (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Subtracts the contents of data register DT1 from the contents of data register DT0 when execution condition
(trigger) R0 turns on. The subtracted result is stored in data register DT100.

Example 1: When the decimal nmber 16 is in DT0 and the decimal number 4
is in DT1.
Minuend [S1]: K16
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0

Subtrahend [S2]: K4
- (Subtraction)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0

Result [D]: K12


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT100 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0

3 - 59
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Example 2: When the decimal nmber 3 is in DT0 and the decimal number 5
is in DT1.
Minuend [S1]: K3
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1

Subtrahend [S2]: K5
- (Subtraction)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1

Result [D]: K - 2
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT100 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0

Description
Subtracts the 16-bit data or 16-bit equivalent constant specified by S2 from the 16-bit data or 16-bit equivalent
constant specified by S1. The subtracted result is stored in D.

Minuend data Subtrahend data Result


(S1) - (S2) (D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow or underflow will result.
Under normal circumstances, do not allow an overflow or underflow to occur.
If the calculated result accidentally overflows or underflows, use of the F28 (D - ) instruction (32-bit data
subtraction) is recommended.
When you use the F28 (D - ) instruction instead of F27 ( - ) be sure to convert the 16-bit subtrahend and
minuend into 32-bit data using the F89 (EXT) instruction.
If an overflow or underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 16-bit
data (overflows or underflows).

3 - 60
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


32-bit data subtraction Step Availability
[(S1+1, S1) - (S2+1, S2) FP0 C10, C14, C16,
F28 (D - ) → (D+1, D)]
11
C32, T32, SL1

Outline Subtracts 32-bit data from the minuend and stores the result in the
specified area.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 28 (D- )
R0 DT 100
10 F28 D - , DT 100 , DT 200 , DT 0
DT 200
S1 S2 D DT 0

S1 32-bit equivalent constant or lower 16-bit area of 32-bit data (for minuend)
S2 32-bit equivalent constant or lower 16-bit area of 32-bit data
(for subtrahend)
D Lower 16-bit area of 32-bit data (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
S2 A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Subtracts the contents of data registers DT201 and DT200 from the contents of data registers DT101 and
DT100 when execution condition (trigger) R0 turns on. The subtracted result is stored in data registers DT1
and DT0.
Higher 16 bits Lower 16 bits

Contents of Contents of The specified data area and the


DT101 DT100 following data area are handled
(Subtraction) together as 32- bit data.

Contents of Contents of
DT201 DT200
(Result is stored.)

← The lower 16 bits of subtracted result


is stored in DT0 and the higher 16 bits
Store to DT1 Store to DT0 of the result is stored in DT1.

3 - 61
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Subtracts the 32-bit data or 32-bit equivalent constant specified by S2 from the 32-bit data or 32-bit equivalent
constant specified by S1. The subtracted result is stored in D+1 and D.

Minuend data Subtrahend data Result


(S1+1, S1) — (S2+1, S2) (D+1, D)

When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1 D+1) are automatically determined once
the lower 16-bit areas (S1, S2, D) are specified.
Precautions during programming
If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow or underflow will result.
Under normal circumstances, do not allow an overflow or underflow to occur.
If an overflow or underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 32-bit
data (overflows or underflows).

3 - 62
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
16-bit data multiplication FP0 C10, C14, C16,
F30 (*) [S1 × S2 → (D+1, D)]
7
C32, T32, SL1

Outline Multiplies two 16-bit data items.

Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 30 (*)
R0 DT 0
10 F30 *, DT 0 , DT 10 , DT 100
DT 10
S1 S2 D DT 100

S1 16-bit equivalent constant or 16-bit area (for multiplicand)


S2 16-bit equivalent constant or 16-bit area (for multiplier)
D Lower 16-bit area of 32-bit data (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Multiplies the contents of data register DT0 and DT10 when execution condition (trigger) R0 turns on.
The result is stored in data registers DT101 and DT100.
When the decimal number 8 is in DT0 and the decimal number 2 is in DT10.
Multiplicand [S1]: K8
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0

Multiplier [S2]: K2
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0

Result [D+1, D]: K16


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT101 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DT100 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0

Higher 16-bit area Lower 16-bit area

The lower 16 bits of the 32 - bit multiplication result are stored in the specified memory area (DT100), and the
higher16 bits are stored in the area following the specified area (DT101).

3 - 63
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Multiplies the 16-bit data or 16-bit equivalent constant specified by S1 and the 16-bit data or 16-bit equivalent
constant specified by S2. The multiplied result is stored in D+1 and D (32-bit area).

Multiplicand data Multiplier data Result


(S1) × (S2) (D+1, D)

The multiplied result is stored in the 32-bit area.


The higher 16-bit area (D+1) is automatically determined once the lower 16-bit area (D) is specified.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.

3 - 64
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

32-bit data multiplication Step Availability


[(S1+1, S1) ¢ (S2+1, S2) FP0 C10, C14, C16,
F31(D*) → (D+3, D+2, D+1, D)]
11
C32, T32, SL1

Outline Multiplies two 32-bit data items.


Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 31 (D*)
R0 DT 0
10 F31 D* , DT 0 , DT 100 , DT 200
DT 100
S1 S2 D DT 200

S1 32-bit equivalent constant or lower 16-bit area of 32-bit data (for multiplicand)
S2 32-bit equivalent constant or lower 16-bit area of 32-bit data (for multiplier)
D Lower 16-bit area of 64-bit data (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
S2 A A A A A A A N/A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
16 bits 16 bits
The specified data area and the following data
Contents of Contents of area are handled together as 32- bit data.
DT1 DT0

16 bits 16 bits

Contents of Contents of
DT101 DT100
16 bits 16 bits 16 bits 16 bits
← The 64 bits of multiplication result are stored in
order in DT200 to DT203 beginning from the
Store to Store to Store to Store to lowest 16 bits.
DT203 DT202 DT201 DT200

3 - 65
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Multiplies the 32-bit data or 32-bit equivalent constant specified by S1 and the one specified by S2.
The multiplied result is stored in D+3, D+2, D+1 and D.

Multiplicand data Multiplier data Result


(S1+1, S1) × (S2+1, S2) (D+3, D+2, D+1, D)

The multiplied result is stored in the 64-bit area.


When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1) are automatically determined once the
lower 16-bit areas (S1, S2) are specified.
The areas (D+3, D+2, D+1) other than the lowest 16-bit area (D) are automatically determined once the
lowest 16-bit area is specified.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.

3 - 66
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
16-bit data division FP0 C10, C14, C16,
F32 (%) [S1/S2 → D… (DT9015)]
7
C32, T32, SL1

Outline Divides 16-bit data by the divisor.


Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 32 (% )
R0 DT 100
10 F32 % , DT 100 , DT10 , DT 0
DT 10
S1 S2 D DT 0

S1 16-bit equivalent constant or 16-bit area (for dividend)


S2 16-bit equivalent constant or 16-bit area (for divisor)
D 16-bit area (for quotient),
(Remainder is stored in special data register DT9015.)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Divides the contents of data register DT100 by decimal constant DT10 when execution condition (trigger) R0
turns on. The quotient is stored in data register DT0 and the remainder is stored in special data register
DT9015.
When the decimal number 15 is in DT100 and the decimal number 4 is in DT10, as shown below.
Dividend [S1]: K15
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT100 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1

Divisor [S2]: K4
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT10 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0

Quotient [D]: K3 Remainder: K3


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 ... DT9015 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1

3 - 67
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 16-bit data or 16-bit equivalent constant specified by S1 is divided by the 16-bit data or 16-bit equivalent
constant specified by S2.
The quotient is stored in D and the remainder is stored in the special data register DT9015.
Dividend data Divisor Quotient Remainder
(S1) ÷ (S2) (D) .... (DT9015)

Precautions during programming


The operation error occurs and the error flag (special internal relay R9007 or R9008) turns on when the
divisor (specified by S2) is “0”.
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The divisor (specified by S2) is “0”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The divisor (specified by S2) is “0”.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the negative minimum value K-32768 (H8000) is
divided by K-1 (HFFFF).

3 - 68
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


32-bit data division Step Availability
[(S1+1, S1)/(S2+1, S2) FP0 C10, C14, C16,
F33 (D%) → (D+1, D)…(DT9016, DT9015)]
11
C32, T32, SL1

Outline Divides 32-bit data by the divisor.


Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 33 (D%)
R0 DT 200
10 F33 D% , DT 200 , DT 100 , DT 0
DT 100
S1 S2 D DT 0

S1 32-bit equivalent constant or lower 16-bit area of 32-bit data (for dividend)
S2 32-bit equivalent constant or lower 16-bit area of 32-bit data (for divisor)
D Lower 16-bit area of 32-bit data (for quotient) (Remainder is stored in
special data registers DT9016 and DT9015.)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
S2 A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Higher 16 bits Lower 16 bits

Contents of Contents of DT200


DT201
÷
(Division)

Contents of Contents of
DT101 DT100

← Quotient is stored in DT1 and DT0.

To DT1 To DT0

← The lower 16 bits of the remainder is stored in DT9015 and the higher
16 bits of the remainder is stored in DT9016.
To DT9016 To DT9015

3 - 69
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 32-bit data or 32-bit equivalent constant specified by S1 is divided by the 32-bit data or 32-bit equivalent
constant specified by S2. The quotient is stored in D+1 and D and the remainder is stored in the special data
registers DT9016 and DT9015.
Dividend data Divisor Quotient Remainder
S1: lower 16-bit S2: lower 16-bit D: lower 16-bit DT9015
÷
S1+1: higher 16-bit S2+1: higher 16-bit D+1: higher 16-bit DT9016

When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1, D+1) are automatically determined once
the lower 16-bit areas (S1, S2, D) are specified.

Precautions during programming


The operation error occurs and the error flag (special internal relay R9007 or R9008) turns on when the
divisor (specified by S2) is “0”.
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The divisor (specified by S2) is “0”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The divisor (specified by S2) is “0”.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when negative minimum value K-2147483648
(H80000000) is divided by K-1 (HFFFFFFFF).

3 - 70
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
16-bit data increment FP0 C10, C14, C16,
F35 (+1) [D + 1 → D]
3
C32, T32, SL1

Outline Adds 1 to 16-bit data.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 35 (+1)
DT 0
R0
10 F35 +1 , DT 0

D 16-bit area to be increased by 1

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Adds 1 to the contents of data register DT0 when execution condition (trigger) R0 turns on.
Original data [D]: K9
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1

+1
Result [D]: K10
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0

Description
Adds 1 to the 16-bit data specified by D. The result is stored in D.
Original data Result
(D) + 1 (D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow will result.
Under normal circumstances, do not allow an overflow to occur.
If the operation result accidentally overflows, use of the F36 (D+1) instruction (32-bit data increment) is
recommended.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

3 - 71
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 16-bit
data (overflows).

3 - 72
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
32-bit data increment FP0 C10, C14, C16,
F36 (D+1) [(D + 1, D) + 1 → (D + 1, D)]
3
C32, T32, SL1

Outline Adds 1 to 32-bit data.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 36 (D+1)
DT 0
R0
10 F36 D+1 , DT 0

D
D Lower 16-bit area of 32-bit data to be increased by 1

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Adds 1 to the content of data registers DT1 and DT0 when execution condition (trigger) R0 turns on.
Higher 16 bits Lower 16 bits
The specified data area and the
following data area are handled
Contents of Contents of together as 32- bit data.
DT1 DT0
+1

Store to DT1 Store to DT0

Description
Adds 1 to the 32-bit data specified by D. The result is stored in D+1 and D.
Original data Result
(D+1, D) + 1 (D+1, D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow will result.
Under normal circumstances, do not allow an overflow to occur.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

3 - 73
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 32-bit
data (overflows).

3 - 74
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
16-bit data decrement FP0 C10, C14, C16,
F37 ( - 1) [D - 1 → D]
3
C32, T32, SL1

Outline Subtracts 1 from 16-bit data.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 37 (- 1 )

R0 DT 0
10 F37 - 1 , DT 0

D 16-bit area to be decreased by 1

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Subtracts 1 from the contents of data register DT0 when execution condition (trigger) R0 turns on.
Original data [D]: K10
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0

-1
Result [D]: K9
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1

Description
Subtracts 1 from the 16-bit data specified by D. The result is stored in D.
Original data Result
(D) - 1 (D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an underflow will result.
Under normal circumstances, do not allow an underflow to occur.
If the operation result accidentally underflows, use of the F38 (D - 1) instruction (32-bit data decrement) is
recommended.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

3 - 75
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 16-bit
data (underflows).

3 - 76
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
32-bit data decrement FP0 C10, C14, C16,
F38 (D - 1) [(D+1, D) - 1 → (D+1, D)]
3
C32, T32, SL1

Outline Subtracts 1 from 32-bit data.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 38 (D- 1)

R0 DT 0
10 F38 D - 1 , DT 0

D Lower 16-bit area of 32-bit data to be decreased by 1

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Subtracts 1 from the content of data registers DT1 and DT0 when execution condition (trigger) R0 turns on.
Higher 16 bits Lower 16 bits
The specified data area and the
following data area are handled
together as 32- bit data.
Contents of Contents of
DT1 DT0
-1

Store to DT1 Store to DT0

Description
Subtracts 1 from the 32-bit data specified by D. The result is stored in D+1 and D.
Original data Result
(D+1, D) - 1 (D+1, D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an underflow will result.
Under normal circumstances, do not allow an underflow to occur.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

3 - 77
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 32-bit
data (underflows).

3 - 78
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability
4-digit BCD data addition
F40 (B+) [D + S → D]
5 FP0 C10, C14, C16,
C32, T32, SL1

Outline Adds two BCD data items that express 4-digit decimal numbers (4-digit
BCD H codes).
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 40 (B+ )
DT 0
R0
10 F40 B+, DT 0 , DT 2 DT 2

S D

S 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data (for addend)
D 16-bit area for 4-digit BCD data (for augend and result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
The contents of data register DT2 and data register DT0 are added together when execution condition
(trigger) R0 turns on.
When H4 (BCD)is in DT0 and H8 (BCD) is in DT2, as shown below.
Augend [D]: H8 (BCD)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT2 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
BCD H code 0 0 0 8

Addend [S]: H4 (BCD) + (Addition)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
BCD H code 0 0 0 4

Result [D]: H12 (BCD)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT2 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0
BCD H code 0 0 1 2

3 - 79
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data specified by S and the 16-bit area for
4-digit BCD data specified by D are added together.

Augend data Addend data Result


(D) + (S) (D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow will result.
Under normal circumstances, do not allow an overflow to occur.
If the calculated result accidentally overflows, use of the F41 (DB+) instruction (8-digit BCD data addition) is
recommended.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 4-digit
BCD data (overflows).

3 - 80
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability
8-digit BCD data Addition
F41(DB+) [(D+1, D) + (S+1, S) → (D+1, D)] 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Adds two BCD data items that express 8-digit decimal numbers (8-digit
BCD H codes).
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 41 (DB+)
DT 0
R0
10 F41 DB+ , DT 0 , DT 2 DT 2

S D

S 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (for
addend)
D Lower 16-bit area for 8-digit BCD data (for augend and result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
The contents of data registers DT3 and DT2 and the contents of data registers DT1 and DT0 are added
together when execution condition (trigger) R0 turns on.
Higher 16 bits Lower 16 bits

The specified data area and the


Contents of Contents of following data area are handled
DT3 DT2 together as 32- bit data.
(Addition)

Contents Contents
of DT1 of DT0
(Result is stored.)

← The lower 16 bits of added result is


stored in DT2 and the higher 16
Store to DT3 Store to DT2 bits of the result is stored in DT3.

3 - 81
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 8-digit BCD equivalent constant or 8-digit BCD data specified by S and the 8-digit BCD data specified by
D are added together.
Augend data Addend data Result
D: lower 4-digit S: lower 4-digit D: lower 4-digit
+
D+1: higher 4-digit S+1: higher 4-digit D+1: higher 4-digit

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow will result.
Under normal circumstances, do not allow an overflow to occur.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 8-digit
BCD data (overflows).

3 - 82
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
4-digit BCD data Addition FP0 C10, C14, C16,
F42 (B+) [S1 + S2 → D]
7
C32, T32, SL1

Outline Adds two BCD data items that express 4-digit decimal numbers (4-digit
BCD H codes) and stores the result in the specified area.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 42 (B+)
R0 DT 0
10 F42 B+, DT 0 , DT 1 , DT100
DT 1
S1 S2 D DT 100

4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data
S1
(for augend)
4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data
S2
(for addend)
D 16-bit area for 4-digit BCD data (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
The contents of data register DT0 and data register DT1 are added together when execution condition
(trigger) R0 turns on. The added result is stored in data register DT100.
When H (BCD) 8 is in DT0 and H (BCD) 4 is in DT1, as shown below.
Augend [S1]: H8 (BCD)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
BCD H code 0 0 0 8

Addend [S2]: H4 (BCD) + (Addition)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
BCD H code 0 0 0 4

Result [D]: H12 (BCD)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT100 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0
BCD H code 0 0 1 2

3 - 83
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 4-digit BCD equivalent constants or 16-bit areas for 4-digit BCD data specified by S1 and S2 are added
together. The added result is stored in D.

Augend data Addend data Result


(S1) + (S2) (D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow will result.
Under normal circumstances, do not allow an overflow to occur.
If the calculated result accidentally overflows, use of the F43 (DB+) instruction (8-digit BCD data addition) is
recommended.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 4-digit
BCD data (overflows).

3 - 84
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


8-digit BCD data Addition Step Availability
[(S1+1, S1) + (S2+1, S2) →
F43 (DB+) (D+1, D)] 11 FP0 C10, C14, C16,
C32, T32, SL1

Outline Adds two BCD data items that express 8-digit decimal numbers
(8-digit BCD H codes) and stores the result in the specified area.
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 43 (DB+)
R0
10 F43 DB+ , DT 0 , DT 2 , DT100 DT 0
DT 2
DT 100
S1 S2 D
S1 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (for
augend)
S2 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (for
addend)
D Lower 16-bit area for 8-digit BCD data (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
S2 A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
The contents of data registers DT1 and DT0 and the contents of data registers DT3 and DT2 are added
together when execution condition (trigger) R0 turns on. The added result is stored in data registers DT101
and DT100.
Higher 16 bits Lower 16 bits

The specified data area and the


Contents of Contents of following data area are handled
DT1 DT0 together as 32- bit data.
(Addition)

Contents of Contents of
DT3 DT2

(Result is stored.)

← The lower 16 bits of added result is


stored in DT100 and the higher 16 bits
Store to DT101 Store to DT100 of the result is stored in DT101.

3 - 85
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The 8-digit BCD equivalent constants or 8-digit BCD data specified by S1 and S2 are added together. The
added result is stored in D+1 and D.
Augend data Addend data Result
S1: lower 4-digit + S2: lower 4-digit
D: lower 4-digit
S1+1: higher 4-digit S2+1: higher 4-digit D+1: higher 4-digit

When processing 8-digit BCD data, the higher 16-bit areas for 8-digit BCD data (S+1, D+1) are automatically
determined once the lower 16-bit areas (S, D) are specified.
Precautions during programming
If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow will result.
Under normal circumstances, do not allow an overflow to occur.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 8-digit
BCD data (overflows).

3 - 86
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
4-digit BCD data Subtraction
F45 (B - ) [D - S → D]
5 FP0 C10, C14, C16,
C32, T32, SL1

Outline Subtracts one BCD data item that expresses a 4-digit decimal number
(4-digit BCD H codes) from another (minuend).
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 45 (B - )
R0
10 F45 B - , DT 0 , DT 2 DT 0
DT 2
S D
S 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data (for subtrahend)
D 16-bit area for 4-digit BCD data (for minuend and result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Subtracts the contents of data register DT0 from the contents of data register DT2 when execution condition
(trigger) R0 turns on.
When H (BCD) 16 is in DT2 and H (BCD) 4 is in DT0, as shown below.
Minuend [D]: H16 (BCD)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT2 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0
BCD H code 0 0 1 6

Subtrahend [S]: H4 (BCD)


- (Subtraction)

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


DT0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
BCD H code 0 0 0 4

Result [D]: H12 (BCD)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT2 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0
BCD H code 0 0 1 2

Description
Subtracts the 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data specified by S from the 16-bit
area for 4-digit BCD data specified by D.

Minuend data Subtrahend data Result


(D) - (S) (D)

3 - 87
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an underflow will result.
Under normal circumstances, do not allow an underflow to occur.
If the calculated result accidentally underflows, use of the F46 (DB - ) instruction (8 - digit BCD data
subtraction) is recommended.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 4-digit
BCD data (underflow).

3 - 88
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
8-digit BCD data Subtraction
F46 (DB - ) [(D+1, D) - (S+1, S) → (D+1, D)] 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Subtracts one BCD data item that expresses an 8-digit decimal number
(8-digit BCD H code) from another (minuend).
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 46 (DB- )
DT 0
R0
10 F46 DB - , DT 0 , DT 2 DT 2

S D

S 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (for
subtrahend)
D Lower 16-bit area for 8-digit BCD data (for minuend and result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Subtracts the contents of data registers DT1 and DT0 from the contents of data registers DT3 and DT2 when
execution condition (trigger) R0 turns on.
Higher 16 bits Lower 16 bits

The specified data area and the


Contents of Contents of
following data area are handled
DT3 DT2
together as 32- bit data.
(Subtraction)

Contents of Contents of
DT1 DT0

(Result is stored.)

← The lower 16 bits of subtracted result


is stored in DT2 and the higher 16 bits
Store to DT3 Store to DT2 of the result is stored in DT3.

3 - 89
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Subtracts the 8-digit BCD equivalent constant or 8-digit BCD data specified by S from the 8-digit BCD data
specified by D.
Augend data Addend data Result
D: lower 4-digit S: lower 4-digit D: lower 4-digit
-
D+1: higher 4-digit S+1: higher 4-digit D+1: higher 4-digit

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an underflow will result.
Under normal circumstances, do not allow an underflow to occur.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 8-digit
BCD data (underflows).

3 - 90
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability
4-digit BCD data Subtraction FP0 C10, C14, C16,
F47 (B - ) [S1 - S2 → D]
7
C32, T32, SL1

Outline Subtracts one BCD data item that expresses a 4-digit decimal number
(4-digit BCD H code) from another (minuend) and stores the result in
the specified area.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 47 (B - )
R0
DT 0
10 F47 B - , DT 0 , DT 2 , DT100
DT 2
S1 S2 D DT 100

S1 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data (for minuend)
S2 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data (for subtrahend)
D 16-bit area for 4-digit BCD data (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Subtracts the contents of data register DT2 from the contents of data register DT0 when execution condition
(trigger) R0 turns on. The subtracted result is stored in data register DT100.
When H (BCD) 16 is in DT0 and H (BCD) 4 is in DT2, as shown below.
Minuend [S1]: H16 (BCD)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0
BCD H code 0 0 1 6

Subtrahend [S2]: H4 (BCD)


- (Subtraction)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
BCD H code 0 0 0 4

Result [D]: H12 (BCD)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT100 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0
BCD H code 0 0 1 2

3 - 91
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Subtracts the 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data specified by S2 from the
4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data specified by S1.
The subtracted result is stored in D.

Minuend data Subtrahend data Result


(S1) - (S2) (D)

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an underflow will result.
Under normal circumstances, do not allow an underflow to occur.
If the calculated result accidentally underflows, use of the F48 (DB - ) instruction (8 - digit BCD data
subtraction) is recommended.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 4-digit
BCD data (underflows).

3 - 92
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 8-digit BCD data Subtraction Step Availability


[(S1+1, S1) - (S2+1, S2) →
F48 (DB - ) (D+1, D)]
11 FP0 C10, C14, C16,
C32, T32, SL1

Outline Subtracts one BCD data item that expresses an 8-digit decimal number
(8-digit BCD H code) from another (minuend) and stores the result in
the specified area.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 48 (DB- )
R0
DT 0
10 F48 DB - , DT 0 , DT 2 , DT100
DT 2
S1 S2 D DT 100

S1 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (for
minuend)
S2 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (for
subtrahend)
D Lower 16-bit area for 8-digit BCD data (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
S2 A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Subtracts the contents of data registers DT3 and DT2 from the contents of data registers DT1 and DT0 when
execution condition (trigger) R0 turns on. The subtracted result is stored in data registers DT101 and DT100.
Higher 16 bits Lower 16 bits

Contents of Contents of The specified data area and the


DT1 DT0 following data area are handled
(Subtraction) together as 32- bit data.

Contents of Contents of
DT3 DT2
(Result is stored.)

← The lower 16 bits of subtracted result


is stored in DT100 and the higher 16
Store to Store to DT100 bits of the result is stored in DT101.
DT101

3 - 93
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Subtracts the 8-digit BCD equivalent constant or 8-digit BCD data specified by S2 from the 8-digit BCD
equivalent constant or the 8-digit BCD data specified by S1. The subtracted result is stored in D+1 and D.
Minuend data Subtrahend data Result
S1: lower 4-digit S2: lower 4-digit D: lower 4-digit
-
S1+1: higher 4-digit S2+1: higher 4-digit D+1: higher 4-digit

When processing 8-digit BCD data, the higher 16-bit areas for 8-digit BCD data (S+1, D+1) are automatically
determined once the lower 16-bit areas (S, D) are specified.

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an underflow will result.
Under normal circumstances, do not allow an underflow to occur.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 8-digit
BCD data (underflows).

3 - 94
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
4-digit BCD data Multiplication FP0 C10, C14, C16,
F50 (B*) [S1 × S2 → (D+1, D)] 7
C32, T32, SL1

Outline Multiplies two BCD data items that express 4-digit decimal numbers
(4-digit BCD H codes).
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 50 (B*)
R0
DT 0
10 F50 B*, DT 0 , DT 2, DT 100
DT 2
DT 100
S1 S2 D
S1 4-digit BCD equivalent constant or 16-bit area for BCD data (for multiplicand)
S2 4-digit BCD equivalent constant or 16-bit area for BCD data (for multiplier)
D Lower 16-bit area for 8-digit BCD data (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
When H (BCD) 8 is in DT0 and H (BCD) 2 is in DT2, as shown below.

Multiplicand [S1]: H8 (BCD)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
BCD H code 0 0 0 8

Multiplier [S2]: H2 (BCD)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
BCD H code 0 0 0 2

R0: on
Result [D+1, D]: H16 (BCD)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT101 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DT100 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0
BCD H code 0 0 0 0 BCD H code 0 0 1 6

Higher 4-digit area Lower 4-digit area


The lower 16 bits of the 32 - bit multiplication result are stored in the specified memory area (DT100), and the
higher16 bits are stored in the area following the specified area (DT101).

3 - 95
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Multiplies the 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data specified by S1 and S2. The
multiplied result is stored in D+1 and D.
Multiplicand data Multiplier data Multiplied result
(S1) × (S2) (D+1, D)

The multiplied result is stored in the 8-digit area (32 - bit area).
The higher 16-bit area (D+1) is automatically determined once the lower 16-bit area (D) is specified.
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.

3 - 96
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


8-digit BCD data Multiplication Step Availability
[(S1+1, S1) ¢ (S2+1, S2) FP0 C10, C14, C16,
F51(DB*) → (D+3, D+2, D+1, D)]
11
C32, T32, SL1

Outline Multiplies two BCD data items that express 8-digit decimal numbers
(8-digit BCD H codes).
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 51 (DB*)
R0
DT 0
10 F51 DB* , DT 0 , DT 2 , DT 100
DT 2
DT 100
S1 S2 D
S1 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (for
multiplicand)
S2 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (for
multiplier)
D Lowest 16-bit area for 16-digit BCD data (for result)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
S2 A A A A A A A N/A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
16 bits 16 bits
The specified data area and the following data
Contents of Contents of area are handled together as 32- bit data.
DT1 DT0

16 bits 16 bits

Contents of Contents of
DT3 DT2
16 bits 16 bits 16 bits 16 bits
← The 64 bits of multiplication result are stored in
order in DT100 to DT103 beginning from the
Store to Store to Store to Store to lowest 16 bits.
DT103 DT102 DT101 DT100

3 - 97
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Multiplies the 8-digit BCD equivalent constant or 8-digit BCD data specified by S1 and the one specified by
S2. The multiplied result is stored in D+3, D+2, D+1, and D.

Multiplicand data Multiplier data Result


(S1+1, S1) × (S2+1, S2) (D+3, D+2, D+1, D)

The multiplied result is stored in the 64-bit area (16 - digit BCD).
When processing 8-digit BCD data, the higher 16-bit areas (S1+1, S2+1) are automatically determined once
the lower 16-bit areas (S1, S2) are specified.The areas (D+3, D+2, D+1) other than the lowest 16-bit area (D)
are automatically determined when the lowest 16-bit area is specified.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.

3 - 98
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
4-digit BCD data Division
F52 (B%) [S1/S2 → D… (DT9015)]
7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Divides one BCD data item that expresses a 4-digit decimal number
(4-digit BCD H code) by another (divisor).
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 52 (B%)
R0 DT 0
10 F52 B% , DT 0 , DT 2 , DT 100
DT 2
DT 100
S1 S2 D
S1 4-digit BCD equivalent constant or 16-bit area for BCD data (for dividend)
S2 4-digit BCD equivalent constant or 16-bit area for BCD data (for divisor)
D 16-bit area for BCD data (for quotient)
(Remainder is stored in special data register DT9015.)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

3 - 99
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Explanation of example
Divides the contents of data register DT0 by the contents of data register DT2 when execution condition
(trigger) R0 turns on. The quotient is stored in data register DT100 and the remainder is stored in special data
register DT9015.
When H (BCD) 15 is in DT0 and H (BCD) 4 is in DT2, as shown below.
Dividiend [S1]: H15 (BCD)
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1
BCD H code 0 0 1 5

Divisor [S2]: H4 (BCD)


Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
BCD H code 0 0 0 4

R0: on
Quotient [D]: H3 (BCD)
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
BCD H code 0 0 0 3

Remainder: H3 (BCD)
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT9015 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
BCD H code 0 0 0 3

Description
The 4-digit BCD equivalent constant or the 16-bit area for 4-digit BCD data specified by S1 is divided by the
4-digit BCD equivalent constant or the 16-bit area for 4-digit BCD data specified by S2. The quotient is stored
in the area specified by D and the remainder is stored in a special data register DT9015.
Dividend data Divisor Quotient Remainder
(S1) ÷ (S2) (D)
....
(DT9015)

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
- The 4-digit BCD equivalent constant or 4-digit BCD data for the divisor
(specified by S2) is 0.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
- The 4-digit BCD equivalent constant or 4-digit BCD data for the divisor
(specified by S2) is 0.
S = flag (R900B): Turns on for an instant when the calculated result (quotient) is recognized as
“0”.

3 - 100
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


8-digit BCD data Division Step Availability
[(S1+1, S1)/(S2+1, S2) →
F53 (DB%) (D+1, D)… (DT9016, DT9015)]
11 FP0 C10, C14, C16,
C32, T32, SL1

Outline Divides one BCD data item that expresses an 8-digit decimal number
(8-digit BCD H code) by another (divisor).
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 53 (DB%)
R0 DT 0
10 F53 DB% , DT 0 , DT 2 , DT100
DT 2

S1 S2 D DT 100

S1 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (for
dividend)
S2 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (for
divisor)
D Lower 16-bit area for 8-digit BCD data (for quotient)
(Remainder is stored in special data registers DT9016 and DT9015)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
S2 A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

3 - 101
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Explanation of example
Higher 16 bits Lower 16 bits

Contents of Contents of DT0


DT1 ÷
(Division)

Contents of Contents of
DT3 DT2

← Quotient is stored in DT101 and DT100.

To DT101 To DT100

← The lower 16 bits of the remainder is stored in DT9015 and the higher
16 bits of the remainder is stored in DT9016.
To DT9016 To DT9015

Description
The 8-digit BCD equivalent constant or the 8-digit BCD data specified by S1 is divided by the 8-digit BCD
equivalent constant or the 8-digit BCD data specified by S2. The quotient is stored in the areas specified by
D+1 and D, and the remainder is stored in special data registers DT9016 and DT9015.
Dividend data Divisor Quotient Remainder
S1: lower 4-digit S2: lower 4-digit D: lower 4-digit DT9015
÷ ....
DT9016
S1+1: higher 4-digit S2+1: higher 4-digit D+1: higher 4-digit

When processing 8-digit BCD data, the higher 16-bit areas (S1+1, S2+1, D+1) are automatically determined
once the lower 16-bit areas (S1, S2, D) are specified.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
- The 8-digit BCD equivalent constant or the 8-digit BCD data for the divisor
(specified by S2) is 0.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
- The 8-digit BCD equivalent constant or the 8-digit BCD data for the divisor
(specified by S2) is 0.
S = flag (R900B): Turns on for an instant when the calculated result (quotient) is recognized as
“0”.

3 - 102
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
4-digit BCD data increment FP0 C10, C14, C16,
F55 (B+1) [D + 1 → D]
3
C32, T32, SL1

Outline Adds 1 to BCD data that expresses a 4-digit decimal number (4-digit
BCD H code).
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 55 (B+1)
DT 0
R0
10 F55 B+1 , DT 0

D 16-bit area for 4-digit BCD data to be increased by 1

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Adds 1 to the contents of data register DT0 when execution condition (trigger) R0 turns on.
Original data [D]: H9 (BCD)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1
BCD H code 0 0 0 9

+1
Result [D]: H10 (BCD)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
BCD H code 0 0 1 0

Description
Adds 1 to the 4-digit BCD data specified by D. The result is stored in D.
Original data Result
(D) + 1 (D)

3 - 103
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow will result.
Under normal circumstances, do not allow an overflow to occur.
If the calculated result accidentally overflows, use of the F56 (DB+1) instruction (8-digit BCD data increment)
is recommended.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 4-digit
BCD data (overflows).

3 - 104
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
8-digit BCD data increment FP0 C10, C14, C16,
F56 (DB+1) [(D+1, D) + 1 → (D+1, D)]
3
C32, T32, SL1

Outline Adds 1 to BCD data that expresses an 8-digit decimal number (8-digit
BCD H code).
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 56 (DB+1)
DT 0
R0
10 F56 DB+1 , DT 0

D Lower 16-bit area for 8-digit BCD data to be increased by 1

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Adds 1 to the contents (8 - digit BCD data) of data registers DT1 and DT0 when execution condition (trigger)
R0 turns on.
Higher 16 bits Lower 16 bits
The specified data area and the
following data area are handled
Contents of Contents of together as 32- bit data.
DT1 DT0
+1

Store to DT1 Store to DT0

Description
Adds 1 to the 8-digit BCD data specified by D. The result is stored in D+1 and D.
Original data Result
(D+1, D) + 1 (D+1, D)

3 - 105
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an overflow will result.
Under normal circumstances, do not allow an overflow to occur.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 8-digit
BCD data (overflows).

3 - 106
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
4-digit BCD data decrement FP0 C10, C14, C16,
F57(B - 1) [D - 1 → D]
3
C32, T32, SL1

Outline Subtracts 1 from BCD data that expresses a 4-digit decimal number
(4-digit BCD H code).
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 57 (B - 1)
DT 0
R0
10 F57 B - 1 , DT 0

D 16-bit area for BCD data to be decreased by 1

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Subtracts 1 from the contents of data register DT0 when execution condition (trigger) R0 turns on.
Original data [D]: H10 (BCD)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
BCD H code 0 0 1 0

-1
Result [D]: H9 (BCD)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1
BCD H code 0 0 0 9

Description
Subtracts 1 from the 4-digit BCD data specified by D. The result is stored in D.
Original data Result
(D) - 1 (D)

3 - 107
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an underflow will result.
Under normal circumstances, do not allow an underflow to occur.
If the calculated result accidentally underflow, use of the F58 (DB - 1) instruction (8-digit BCD data decrement)
is recommended.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 4-digit
BCD data (underflows).

3 - 108
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
8-digit BCD data decrement FP0 C10, C14, C16,
F58 (DB - 1) [(D+1, D) - 1 → (D+1, D)]
3
C32, T32, SL1

Outline Subtracts 1 from BCD data that expresses an 8-digit decimal number
(8-digit BCD H code).
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 58 (DB- 1)
DT 0
R0
10 F58 DB - 1 , DT 0

D Lower 16-bit area for 8-digit BCD data to be decreased by 1

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Subtracts 1 from the contents (8 - digit BCD data) of data registers DT1 and DT0 when execution condition
(trigger) R0 turns on.
Higher 16 bits Lower 16 bits
The specified data area and the
following data area are handled
together as 32- bit data.
Contents of Contents of
DT1 DT0
-1

Store to DT1 Store to DT0

Description
Subtracts 1 from the 8-digit BCD data specified by D. The result is stored in D+1 and D.
Original data Result
(D+1, D) - 1 (D+1, D)

3 - 109
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Precautions during programming


If the result of an arithmetic operation instruction does not fall within the range of values which can be
handled, an underflow will result.
Under normal circumstances, do not allow an underflow to occur.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.
For detailed information section 1.4.2

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data is not BCD data.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the calculated result exceeds the range of 8-digit
BCD data (underflows).

3 - 110
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F60 (CMP) 16-bit data compare 5
C32, T32, SL1

Outline The two specified 16 - bit data are compared and the result is output to
the special internal relay.
Program example
Boolean
Ladder Diagram
Address Instruction

40 ST R 0
41 F 60 (CMP)
DT 0
Trigger
S1 S2 K 100
R0 46 ST R 0
40 F60 CMP , DT 0 , K 100
47 AN R 900A
R0 R900A Y0
48 OT Y 0
46
R0 R900B Y1 49 ST R 0
49 50 AN R 900B
R0 R900C Y2 51 OT Y 1
52
52 ST R 0
53 AN R 900C
54 OT Y 2

S1 16-bit equivalent constant or 16-bit area to be compared


S2 16-bit equivalent constant or 16-bit area to be compared

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A A: Available

Explanation of example
Compares decimal constant K100 with the contents of data register DT0 when execution condition (trigger)
R0 turns on.
When DT0 > K100, R900A turns on and external output relay Y0 turns on.
When DT0 = K100, R900B turns on and external output relay Y1 turns on.
When DT0 < K100, R900C turns on and external output relay Y2 turns on.

3 - 111
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Compares the 16-bit data specified by S1 with that specified by S2. The comparison result is output to the
special internal relays R9009, R900A, R900B and R900C.
The following table lists the states of the carry flag (R9009), > flag (R900A), = flag (R900B), and < flag
(R900C), depending on the relative sizes of S1 and S2.
Flag
Comparison between
S1 and S2 R900A R900B R900C R9009
(> flag) (= flag) (< flag) (carry flag)
S1 < S2 off off on ↕
S1 = S2 off on off off
S1 > S2 on off off ↕
“↕”: turns on or off according to the conditions

Execution condition (Trigger)


In this program example, the comparison will be performed only when R0 turns on.
If ongoing comparison is necessary, relay R9010, which is always on, should be used in the execution
conditions (trigger).
↗Always on relay.
R9010
F60 CMP, DT 0, K 100
R9010 R900A Y0

R9010 R900B Y1

R9010 R900C Y2

R9010 can be eliminated in this case.

You can also program the above using the PSHS, RDS, and POPS instructions.
R0 ↗ PSHS
F60 CMP, DT 0, K 100
R900A Y0


RDS R900B Y1

POPS R900C Y2

This is a program in which operation is the same as the program example on page 3 - 111.

3 - 112
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Precautions when using two or more comparison instructions


The comparison instruction flags R900A to R900C are updated with each execution of the comparison
instruction.
If you use two or more comparison instructions in your program, be sure to use the flags immediately after
each comparison instruction, by employing output relays or internal relays.

Example: Compares DT0 with K100, and DT1 with K200.


R0
1 F60 CMP, DT 0, K 100
R0 R900A Y0

R0 R900B Y1
2
R0 R900C Y2

R1
3 F60 CMP, DT 1, K 200
R1 R900A Y3

R1 R900B Y4
4
R1 R900C Y5

The comparison result for 1 is output to the output relays


(Y0, Y1, and Y2) of program 2 .
The comparison result for 3 is output to the output relays
(Y3, Y4, and Y5) of program 4 .

Precautions when comparing BCD or external data


When comparing special data, such as BCD or unsigned binary (0 to FFFF), construct your program as
shown in the program example below, using special internal relays R900B and R9009.

Example: Compares BCD data in DT0 and DT1.


R1
F60 CMP, DT 0, DT 1
R1 R9009 R2
1 ....When DT0 < DT1,
R1 R900B R3 internal relay R2 turns on
2 ....When DT0 = DT1,
R1 R900B R9009 R4 internal relay R3 turns on
3 ....When DT0 > DT1,
internal relay R4 turns on

3 - 113
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag operation when comparing BCD data or unsigned 16 - bit data (0 to FFFF)
Flag
Comparison between
S1 and S2 R900A R900B R900C R9009
(> flag) (= flag) (< flag) (carry flag)
S1 < S2 ↕ off ↕ on
S1 = S2 off on off off
S1 > S2 ↕ off ↕ off
“↕”: turns on or off according to the conditions

For example, when S1 = H8000 and S2 = H1000, R900A will turn off and R900C will turn on. For this reason,
the correct comparison result will not be obtained in a program which uses R900A and R900C.

S1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BCD 8 0 0 0

S2 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
BCD 1 0 0 0

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 114
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F61(DCMP) 32-bit data compare 9
C32, T32, SL1

Outline The two specified 32 - bit data are compared and the result is output to
the special internal relay.
Program example
Boolean
Ladder Diagram
Address Instruction

50 ST R 0
51 F 61(DCMP)
DT 0
Trigger
S1 S2 DT 100
R0 56 ST R 0
50 F61 DCMP , DT 0 , DT 100 57 AN R 900A
R0 R900A Y0
58 OT Y 0
56
R0 R900B Y1 59 ST R 0
59 60 AN R 900B
R0 R900C Y2 61 OT Y 1
62
62 ST R 0
63 AN R 900C
64 OT Y 2

S1 32-bit equivalent constant or lower 16-bit area of 32-bit data to be compared


S2 32-bit equivalent constant or lower 16-bit area of 32-bit data to be compared

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
A: Available
S2 A A A A A A A N/A A A A N/A: Not Available

Explanation of example
Compares the content (32 - bit data) of data registers DT101 and DT100 with the content (32 - bit data) of data
registers DT1 and DT0 when execution condition (trigger) R0 turns on.
When (DT1 and DT0) > (DT101 and DT100), R900A turns on and external output relay Y0 turns on.
When (DT1 and DT0) = (DT101 and DT100), R900B turns on and external output relay Y1 turns on.
When (DT1 and DT0) < (DT101 and DT100), R900C turns on and external output relay Y2 turns on.

3 - 115
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Compares the 32-bit data or 32-bit equivalent constant specified by S1 with that specified by S2. The
comparison result is output to special internal relays R9009, R900A, 900B, and R900C.
The following table lists the states of the carry flag (R9009), > flag (R900A), = flag (R900B), and < flag
(R900C), depending on the relative sizes of (S1+1, S1) and (S2+1, S2).
Flag
Comparison between
(S1+1, S1) and (S2+1, S2) R900A R900B R900C R9009
(> flag) (= flag) (< flag) (carry flag)
(S1+1, S1) < (S2+1, S2) off off on ↕
(S1+1, S1) = (S2+1, S2) off on off off
(S1+1, S1) > (S2+1, S2) on off off ↕
“↕”: turns on or off according to the conditions
When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1) are automatically determined once the
lower 16-bit areas (S1, S2) are specified.
Execution condition (Trigger)
In this program example, the comparison will be performed only when R0 turns on.
If ongoing comparison is necessary, relay R9010, which is always on, should be used in the execution
conditions.
↗Always on relay.
R9010
F61 CMP, DT 0, K100
R9010 R900A Y0

R9010 R900B Y1

R9010 R900C Y2

R9010 can be eliminated in this case.

You can also program the above using the PSHS, RDS, and POPS instructions.
R0 ↗ PSHS
F61 DCMP, DT 0, DT100
R900A Y0


RDS R900B Y1

POPS R900C Y2

This is a program in which operation is the same as the program example on page 3 - 115.

3 - 116
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Precautions when using two or more comparison instructions


The comparison instruction flags R900A to R900C are updated with each execution of the comparison
instruction.
If you use two or more comparison instructions in your program, be sure to use the flags immediately after
each comparison instruction, by employing output relays or internal relays.

Example: Compares DT1 and DT0 with DT101 and DT100, and DT3 and DT2
with DT201 and DT200.
R0
1 F61 DCMP, DT 0, DT 100
R0 R900A Y0

R0 R900B Y1
2
R0 R900C Y2

R1
3 F61 DCMP, DT 2, DT 200
R1 R900A Y3

R1 R900B Y4
4
R1 R900C Y5

The comparison result for 1 is output to the output relays (Y0,


Y1, and Y2) of program 2 .
The comparison result for 3 is output to the output relays (Y3,
Y4, and Y5) of program 4 .

Precautions when comparing BCD or external data


When comparing special data, such as BCD or unsigned binary (0 to FFFFFFFF), flags R9009, R900A,
R900B, and R900C work as shown in the table below. In this case, construct your program as shown in the
program example below, using special internal relays R900B and R9009.

Example: Compares BCD data in (DT1, DT0) and (DT3, DT2).


R1
F61 DCMP, DT 0, DT 2
R1 R9009 R2
1 ....When (DT1, DT0) < (DT3, DT2),
R1 R900B R3
internal relay R2 turns on
2 ....When (DT1, DT0) = (DT3, DT2),
R1 R900B R9009 R4 internal relay R3 turns on
3 ....When (DT1, DT0) > (DT3, DT2),
internal relay R4 turns on

3 - 117
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag operation when comparing BCD data or unsigned 32 - bit data (0 to FFFFFFFF)
Flag
Comparison between
(S1+1, S1) and (S2+1, S2) R900A R900B R900C R9009
(> flag) (= flag) (< flag) (carry flag)
(S1+1, S1) < (S2+1, S2) ↕ off ↕ on
(S1+1, S1) = (S2+1, S2) off on off off
(S1+1, S1) > (S2+1, S2) ↕ off ↕ off
“↕”: turns on or off according to the conditions

For example, if an F61 (DCMP) instruction is executed when S1 = H80000000 (K - 2147483648) and S2 =
H10000001 (K+268435457), the result will be S1<S2. Thus R900A will turn off and R900C will turn on. In a
program which uses R900A and R900C, the correct comparison result will not be obtained.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 118
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F62 (WIN) 16-bit data band compare 7
C32, T32, SL1

Outline Compares one 16-bit data item with the data band specified by two
other 16-bit data items and the comparison result is output to the
special internal relay.
Program example
Boolean
Ladder Diagram
Address Instruction

50 ST R 0
51 F 62 (WIN)
Lower limit value
Trigger DT 0
Upper limit value
DT 2
S1 S2 S3
R0 DT 3
50 F62 WIN , DT 0 , DT 2 , DT 3 58 ST R 0

R0 R900A Y0 59 AN R 900A
58 60 OT Y 0
R0 R900B Y1 61 ST R 0
61 62 AN R 900B
R0 R900C Y2 63 OT Y 1
64 64 ST R 0
65 AN R 900C
66 OT Y 2

S1 16-bit equivalent constant or 16-bit area to be compared


S2 16-bit equivalent constant or 16-bit area for lower limit
S3 16-bit equivalent constant or 16-bit area for upper limit

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
S3 A A A A A A A A A A A A: Available

3 - 119
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Explanation of example
Compares the contents of data register DT0 with the contents of data register DT2 (lower limit of the data
band) and data register DT3 (upper limit of the data band) when execution condition (trigger) R0 turns on.

Example: When K - 500 is in DT2 and K500 is in DT3, as shown below.

R900A : on +500

R900B : on

R900C : on - 500

When DT0 is K - 680, R900C turns on and external output relay Y2 goes on.
When DT0 is K - 500, R900B turns on and external output relay Y1 goes on.
When DT0 is K256, R900B turns on and external output relay Y1 goes on.
When DT0 is K680, R900A turns on and external output relay Y0 goes on.

Description
Compares the 16-bit equivalent constant or 16-bit data specified by S1 with the data band specified by S2
and S3. This instruction checks whether S1 is in the data band between S2 (lower limit) and S3 (upper limit),
larger than S3, or smaller than S2. The comparison result is output to special internal relays R9009, R900A,
R900B, and R900C.
The following table lists the states of the R9009, R900A, R900B and R900C.
Flag
Comparison between
S1, S2 and S3 R900A R900B R900C R9009
(> flag) (= flag) (< flag) (carry flag)
S1 < S2 off off on ———
S2≦S1≦S3 off on off ———
S3 < S1 on off off ———

Precautions during programming


Set it so that the value of the lower limit is less than the value of the upper limit (S2 ≦ S3).

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- S2 > S3.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- S2 > S3.

3 - 120
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F63 (DWIN) 32-bit data band compare 13
C32, T32, SL1

Outline Compares one 32-bit data item with the data band specified by two
other 32-bit data items and the comparison result is output to the
special internal relay.
Program example
Boolean
Ladder Diagram
Address Instruction

50 ST R 0
51 F 63 (DWIN)
Lower limit value
Trigger DT 0
Upper limit value
DT 2
S1 S2 S3
R0 DT 4
50 F63 DWIN , DT 0 , DT 2 , DT 4 64 ST R 0

R0 R900A Y0 65 AN R 900A
64 66 OT Y 0
R0 R900B Y1 67 ST R 0
67 68 AN R 900B
R0 R900C Y2 69 OT Y 1
70 70 ST R 0
71 AN R 900C
72 OT Y 2

S1 32-bit equivalent constant or lower 16-bit area of 32-bit data to be compared


S2 32-bit equivalent constant or lower 16-bit area of 32-bit data for lower limit
S3 32-bit equivalent constant or lower 16-bit area of 32-bit data for upper limit

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
S2 A A A A A A A N/A A A A
A: Available
S3 A A A A A A A N/A A A A N/A: Not Available

3 - 121
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Explanation of example
Compares the contents of data registers DT1 and DT0 with the contents of data registers DT3 and DT2 (lower
limit of the data band) and data registers DT5 and DT4 (upper limit of the data band), when execution
condition (trigger) R0 turns on.

Example: When K - 50000 is in DT3 and DT2 and K50000 is in DT5 and DT4,
as shown below.

R900A : on +50000

R900B : on

R900C : on - 50000

When (DT1, DT0) is K - 68000, R900C turns on and external output relay
Y2 goes on.
When (DT1, DT0) is K - 50000, R900B turns on and external output relay
Y1 goes on.
When (DT1, DT0) is K25600, R900B turns on and external output relay
Y1 goes on.
When (DT1, DT0) is K68000, R900A turns on and external output relay
Y0 goes on.

Description
Compares the 32-bit equivalent constant or 32-bit data specified by S1 with the data band specified by S2
and S3. This instruction checks whether S1 is in the data band between S2 (lower limit) and S3 (upper limit),
larger than S3, or smaller than S2. The comparison result is output to the special internal relays R9009,
R900A, R900B, and R900C.
The following table lists the states of the R9009, R900A, R900B and R900C.
Comparison between Flag
(S1+1, S1), (S2+1, S2) R900A R900B R900C R9009
and (S3+1, S3) (> flag) (= flag) (< flag) (carry flag)
(S1+1, S1) < (S2+1, S2) off off on ———
(S2+1, S2)≦(S1+1, S1)
off on off ———
≦(S3+1, S3)
(S3+1, S3) < (S1+1, S1) on off off ———

Precautions during programming


Set it so that the value of the lower limit (S2 + 1, S2) is less than the value of the upper limit (S3 + 1, S3)
[(S2+1, S2) ≦ (S3+1, S3)].

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- (S2+1, S2) > (S3+1, S3).
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- (S2+1, S2) > (S3+1, S3).

3 - 122
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F64 (BCMP) Block data compare 7
C32, T32, SL1

Outline Compares one specified data block with another in byte units.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
S1 S2 S3 11 F 64 (BCMP)
R0 DT 0
10 F64 BCMP , DT 0 , DT 10 , DT 20 DT 10
DT 20
18 ST R 0
R0 R900B R1 19 AN R 900B
18 20 OT R 1

16-bit equivalent constant or 16-bit area (specifies starting byte positions and
S1
number of bytes to be compared)
S2 Starting 16-bit area to be compared
S3 Starting 16-bit area to be compared

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A N/A N/A N/A N/A A
A: Available
S3 A A A A A A N/A N/A N/A N/A A N/A: Not Available

3 - 123
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Explanation of example
Compares the data block of data register DT10 (4 bytes from DT10 lower order byte) with data register DT20
(4 bytes from DT20 higher order byte) according to the comparison condition in data register DT0 when
execution condition (trigger) R0 turns on. When the contents of the two data blocks are the same, internal
relay R1 turns on.
If H1004 is entered in DT0, the two blocks are as follows.
Higher Lower
byte byte ·

Data block DT10 2 1


specified by DT11 4 3
S2

Comparation
Data block DT20
specified by DT21 1
S3
DT22 3 2
4

Area compared

Description
Compares the contents of the data block specified by S2 with the contents of the data block specified by S3
according to content specified by S1.
When the comparison result is S2 = S3, special internal relay R900B (=flag) turns on.
S1 is the control data that determines factors such as the size of the comparison.
How to specify control data “S1”
S1 specifies the starting byte position and the number of bytes to be compared using 4-digit BCD data as
follows:
S1 = H j j j j


Number of bytes to be compared


range: H01 to H99 (BCD)

Starting byte position for data block specified by S2


1: Starting from higher order byte
0: Starting from lower order byte

Starting byte position for data block specified by S3


1: Starting from higher order byte
0: Starting from lower order byte

Setting example:
To specify the 4 bytes beginning with the lower byte of the data block specified by S2 and the 4 bytes
beginning with the upper byte of the data block specified by S3, set S1 to H1004.

3 - 124
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data specified by S1 is not BCD data.
- The specified data block area exceeds the limit.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data specified by S1 is not BCD data.
- The specified data block area exceeds the limit.

Precautions during programming


The flag R900B used for the compare instruction is renewed each time a compare instruction is executed.
Accordingly:
- The program that uses R900B should be just after the F64 (BCMP) instruction.
- Output to an output relay or internal relay and save the result.

R0
F64 BCMP, DT 0, DT 1, WR 5

R0 R900B Y0

Result of F64

R1
F60 CMP, DT 2, K 100

R1 R900B R2

Result of F60

Note
As shown in the above program, be sure to have the trigger (R0
or R1) before flag R900B. However, if you are using R9010 (on all
the time), then it is unnecessary to have the trigger before
R900B.

3 - 125
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F65 (WAN) 16-bit data AND 7
C32, T32, SL1

Outline Performs bit-wise AND operation on two 16-bit data items.


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 65 (WAN)
R0
DT 0
10 F65 WAN , DT 0 , DT 2 , DT 1
DT 2
DT 1
S1 S2 D
S1 16-bit equivalent constant or 16-bit area
S2 16-bit equivalent constant or 16-bit area
D 16-bit area for storing AND operation result

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Performs AND operation on each bit in data registers DT0 and DT2 when trigger R0 turns on.
The AND operation result is stored in data register DT1.
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[S1] DT0 0 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[S2] DT2 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

R0: on

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT1 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0 1

3 - 126
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Performs AND operation on each bit in the 16-bit equivalent constant or 16-bit data specified by S1 and S2.
The AND operation result is stored in the 16-bit area specified by D.
(S1) ∧ (S2) → (D)
You can use this instruction to turn off certain bits of the 16-bit data.
AND operation
The AND operation is shown below.
S1 S2 D
0 0 0
0 1 0
1 0 0
1 1 1

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.

3 - 127
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F66 (WOR) 16-bit data OR 7
C32, T32, SL1

Outline Performs bit-wise OR operation on two 16-bit data items.


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 66 (WOR)
R0
DT 0
10 F66 WOR , DT 0 , DT 2 , DT 1
DT 2
DT 1
S1 S2 D
S1 16-bit equivalent constant or 16-bit area
S2 16-bit equivalent constant or 16-bit area
D 16-bit area for storing OR operation result

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Performs OR operation on each bit in data registers DT0 and DT2 when execution condition (trigger) R0 turns
on.
The OR operation result is stored in data register DT1.

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[S1] DT0 0 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[S2] DT2 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

R0: on

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT1 0 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1

3 - 128
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Performs OR operation on each bit in the 16-bit equivalent constant or 16-bit data specified by S1 and S2.
The OR operation result is stored in the 16-bit area specified by D.
(S1) ∨ (S2) → (D)
You can use this instruction to turn on certain bits of the 16-bit data.
OR operation
The OR operation is shown below.
S1 S2 D
0 0 0
0 1 1
1 0 1
1 1 1

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.

3 - 129
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F67 (XOR) 16-bit data exclusive OR 7
C32, T32, SL1

Outline Performs bit-wise exclusive OR operation on two 16-bit data items.


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 67 (XOR)
R0 DT 0
10 F67 XOR , DT 0 , DT 2 , DT 1
DT 2
DT 1
S1 S2 D
S1 16-bit equivalent constant or 16-bit area
S2 16-bit equivalent constant or 16-bit area
D 16-bit area for storing exclusive OR operation result

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Performs exclusive OR operation on each bit in data registers DT0 and DT2 when execution condition
(trigger) R0 turns on. The exclusive OR operation result is stored in data register DT1.
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[S1] DT0 0 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[S2] DT2 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

R0: on

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT1 0 1 0 0 1 1 0 1 0 1 0 0 0 1 1 0

3 - 130
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Performs exclusive OR operation on each bit in the 16-bit equivalent constant or 16-bit data specified by S1
and S2. The exclusive OR operation result is stored in the 16-bit area specified by D.
(S1) ∧ (S2) ∨ (S1) ∧ (S2) → (D)
Detects the bits whose on and off states do not match.
If the values of S1 and S2 are equal, all the bits of the data specified by D become 0.
Exclusive OR operation
The exclusive OR operation is shown below.
S1 S2 D
0 0 0
0 1 1
1 0 1
1 1 0

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.

3 - 131
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F68 (XNR) 16-bit data exclusive NOR 7
C32, T32, SL1

Outline Performs bit-wise exclusive NOR operation on two 16-bit data items.
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 68 (XNR)
R0 DT 0
10 F68 XNR , DT 0 , DT 2 , DT 1
DT 2
DT 1
S1 S2 D
S1 16-bit equivalent constant or 16-bit area
S2 16-bit equivalent constant or 16-bit area
D 16-bit area for storing exclusive NOR operation result

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
When the execution condition (trigger) R0 is on, if the values of the bits for the same positions with regard to
the contents of data registers DT0 and DT2 are equal, the bit for that position is turned on (1) for data register
DT1. If the values are not equal, the bit is turned off (0).

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[S1] DT0 0 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[S2] DT2 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

R0: on

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT1 1 0 1 1 0 0 1 0 1 0 1 1 1 0 0 1

3 - 132
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Performs exclusive NOR operation on each bit in the 16-bit equivalent constant or 16-bit data specified by S1
and S2. The exclusive NOR operation result is stored in the 16-bit area specified by D.
(S1) ∧ (S2) ∨ (S1) ∧ (S2) → (D)
Detects the bits whose on and off states match.
If the values of S1 and S2 are equal, all the bits of the data specified by D become 1.
Exclusive NOR operation
The exclusive NOR operation is shown below.
S1 S2 D
0 0 1
0 1 0
1 0 0
1 1 1

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the calculated result is recognized as “0”.

3 - 133
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability

F70 (BCC) Block check code calculation 9 FP0 C10, C14, C16,
C32, T32, SL1

Outline Calculates Block Check Code (BCC).


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F 70 (BCC)

R0 K 2
10 F70 BCC , K 2 , DT 0 , K 12 , DT 6 DT 0
K 12
S1 S2 S3 D
DT 6

S1 16-bit equivalent constant or 16-bit area (specifies BCC calculation method)


S2 Starting 16-bit area to calculate BCC
S3 16-bit equivalent constant or 16-bit area (specifies number of bytes for BCC
calculation)
D 16-bit area for storing BCC

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A N/A N/A N/A N/A A
S3 A A A A A A A A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Calculates the Block Check Code (BCC) of 12 bytes of ASCII data starting from data register DT0, via an
exclusive OR operation, when execution condition (trigger) R0 turns on. The Block Check Code (BCC) is
stored in the lower byte of data register DT6.

3 - 134
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Calculates the Block Check Code (BCC) of S3 bytes of ASCII data starting from the 16-bit area specified by
S2, according to the calculation method specified by S1. The Block Check Code (BCC) is stored in the lower
byte of the 16-bit area specified by D. (BCC is one byte. The higher byte of D does not change.)
S1: Specifying the Block Check Code (BCC) calculation method
K0: Addition
K1: Subtraction
K2: Exclusive OR operation
S2 and S3: Specifying the target data
For instance, if 12 bytes of data from DT0 are to be targeted, the following applies:
S2: DT0
S3: K12 (specified as a decimal number)

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The number of specified bytes for the target data exceeds the limit of the
specified data area.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number of specified bytes for the target data exceeds the limit of the
specified data area.

Application example
In this example, the block check code of the message being sent, ”%01#RCSX0000”, is calculated and is
added after the message.
Transmission is done using ASCII codes.
BCC is calculated as an exclusive logical OR.
The message should be stored in the memory area as shown below.
Data register DT6 DT5 DT4 DT3 DT2 DT1 DT0
ASCII HEX code 3 0 3 0 3 0 3 0 5 8 5 3 4 3 5 2 2 3 3 1 3 0 2 5
ASCII character 0 0 0 0 X S C R # 1 0 %

12 bytes
Block Check Code (BCC)
The F70 (BCC) instruction is as shown below.
R0
10 F70 BCC, K 2 , DT 0 , K 12 , DT 6

S1: Exclusive logical OR


S2: Start of target data
S3: Length of target data
D: Calculation results
When this is executed, BCC (H 1D) is stored in the last byte of DT6 of D.

3 - 135
High - level Instructions FP0

3.3 Explanation of High - level Instructions

How to calculate the Block Check Code (BCC)


Exclusive ORing calculates the Block Check Code (BCC) with each ASCII character.

ASCII HEX code 2 5


% ASCII BIN code 0 0 1 0 0 1 0 1 Exclusive ORing

ASCII HEX code 3 0


0 ASCII BIN code 0 0 1 1 0 0 0 0 Exclusive ORing
ASCII HEX code 3 1
1 ASCII BIN code 0 0 1 1 0 0 0 1 Exclusive ORing
ASCII HEX code 2 3
# ASCII BIN code 0 0 1 0 0 0 1 1 Exclusive ORing
ASCII HEX code 5 2
R ASCII BIN code 0 1 0 1 0 0 1 0 Exclusive ORing
ASCII HEX code 4 3
C ASCII BIN code 0 1 0 0 0 0 1 1 Exclusive ORing
ASCII HEX code 5 3
S ASCII BIN code 0 1 0 1 0 0 1 1 Exclusive ORing

ASCII HEX code 5 8


X ASCII BIN code 0 1 0 1 1 0 0 0 Exclusive ORing

ASCII HEX code 3 0


0 ASCII BIN code 0 0 1 1 0 0 0 0 Exclusive ORing
ASCII HEX code 3 0
0 ASCII BIN code 0 0 1 1 0 0 0 0 Exclusive ORing
ASCII HEX code 3 0
0 ASCII BIN code 0 0 1 1 0 0 0 0
Exclusive ORing
ASCII HEX code 3 0
0 ASCII BIN code 0 0 1 1 0 0 0 0

calculation

Block Check Code (BCC)


ASCII HEX code 1 D This calculation result (H1D) is stored in the lower byte of DT6.
ASCII BIN code 0 0 0 1 1 1 0 1

3 - 136
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability
Hexadecimal data →
F71 (HEXA) ASCII code 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Converts 16-bit data to ASCII code that expresses the equivalent
hexadecimals.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 71 (HEXA)
R0 DT 0
10 F71 HEXA , DT 0 , K 2 , DT 10
K 2
S1 S2 D DT 10

S1 Starting 16-bit area for hexadecimal number (source)


S2 16-bit equivalent constant or 16-bit area to specify number of source data
bytes to be converted
D Starting 16-bit area for storing ASCII code (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A N/A N/A N/A N/A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts 2 bytes of data stored in data register DT0 to ASCII codes that express the equivalent
hexadecimals when execution condition (trigger) R0 turns on. The converted data is stored in data registers
DT11 and DT10.
DT0
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary data 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1
Hexadecimal A B C D

DT11 DT10
ASCII HEX code 4 2 4 1 4 4 4 3
ASCII character B A D C

3 - 137
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts the data starting from the 16-bit area specified by S1 to ASCII codes that express the equivalent
hexadecimals. The converted result is stored in the area starting from the 16-bit area specified by D.
S2 specifies the number of source data bytes to be converted.
Since ASCII code requires eight bits (one byte) to express one hexadecimal character, the data length when
converted to ASCII code becomes double the source data.
Precautions during programming
The two characters that make up one byte are interchanged when stored.
Two bytes are converted as one segment of data.
Hexadecimal data A B C D

Converted
result 4 2 4 1 4 4 4 3

B A D C

D+1 D
S1 1 2 3 4 2 1 4 3

S1+1 5 6 7 8 D+3 D+2


Hexadecimal 6 5 8 7
data
Converted result

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by S2 exceeds the area specified by S1.
- The converted result exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by S2 exceeds the area specified by S1.
- The converted result exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.

3 - 138
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Conversion example
The following shows conversion of hexadecimal data to ASCII codes.
Conversion of four bytes of data (S2 = K4)
Hexadecimal data S1+1 S1
EF 12 AB CD

4 bytes

F71 (HEXA) instruction execution


Converted
result D+3 D+2 D+1 D
46 45 32 31 42 41 44 43
F E 2 1 B A D C

Result of S1 + 1 Result of S1 conversion


conversion
Conversion of three bytes of data (S2 = K3)
Since “byte” is specified as the unit, it is possible to convert only the last byte of the data for one word if
desired.
Hexadecimal data S1+1 S1
12 AB CD

3 bytes

F71 (HEXA) instruction execution

Converted result D+2 D+1 D


32 31 42 41 44 43
2 1 B A D C

Hexadecimal number to express ASCII code


Hexadecimal ASCII code
number
0 H30
1 H31
2 H32
3 H33
4 H34
5 H35
6 H36
7 H37
8 H38
9 H39
A H41
B H42
C H43
D H44
E H45
F H46

3 - 139
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability
ASCII code →
F72 (AHEX) Hexadecimal data
7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Converts ASCII code that expresses hexadecimal characters to


hexadecimal data.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 72 (AHEX)
R0 DT 0
10 F72 AHEX , DT 0 , K 4 , DT 40
K 4
S1 S2 D DT 40

S1 Starting 16-bit area for ASCII code (source)


S2 16-bit equivalent constant or 16-bit area to specify number of source data
bytes to be converted
D Starting 16-bit area for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A N/A N/A N/A N/A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts 4 ASCII codes stored in data registers DT0 and DT1 to hexadecimal numbers when execution
condition (trigger) R0 turns on. The converted data is stored in data register DT40.
DT1 DT0
ASCII HEX code 4 4 4 3 4 2 4 1
ASCII character D C B A

DT40
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary data 1 1 0 0 1 1 0 1 1 0 1 0 1 0 1 1
Hexadecimal C D A B

3 - 140
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Converts ASCII code that expresses hexadecimal characters, starting from the 16-bit area specified by S1, to
hexadecimal numbers as specified by S2. The converted result is stored in the area starting from the 16-bit
area specified by D.
The volume of the results (hexadecimal numeric data) is half that of the converted ASCII code.
Precautions during programming
The data for two ASCII code characters is converted to two numeric digits for one word. When this takes
place, the characters of the upper and lower bytes are interchanged.
Four characters are converted as one segment of data.
ASCII code character

4 4 4 3 4 2 4 1

Converted C D A B
result

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by S2 exceeds the area specified by S1.
- The converted result exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
- ASCII code, not a hexadecimal number (0 to F), is specified.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by S2 exceeds the area specified by S1.
- The converted result exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
- ASCII code, not a hexadecimal number (0 to F), is specified.
Conversion Example
The following shows conversion of ASCII codes to hexadecimal data.
Conversion of eight characters (S2 = K8)
ASCII code
S1+3 S1+2 S1+1 S1
32 31 46 45 44 43 42 41
2 1 F E D C B A
8 characters (8 bytes)

F72 (AHEX) instruction execution

Converted result D+1 D


12 EF CD AB

Result of S1 + 3, Result of S1 + 1, S1
S1 + 2 conversion conversion

3 - 141
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Conversion of 7 characters (S2 = K7)


ASCII code
S1+3 S1+2 S1+1 S1

31 46 45 44 43 42 41
1 F E D C B A
7 characters (7 bytes)

This position is F72 (AHEX) instruction execution


filled with “0”.
Converted result D+1 D

10 EF CD AB

Conversion of 6 characters (S2 = K6)


ASCII code
S1+2 S1+1 S1

46 45 44 43 42 41
F E D C B A
6 characters (6 bytes)

F72 (AHEX) instruction execution

Converted result D+1 D

EF CD AB

Result of Result of S1+1,


S1+2 S1 conversion
conversion

Note
In the conversion results, only the data for the lower byte is
stored in D + 1 word. The data for the higher byte is left as it is,
and does not change.

3 - 142
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

The converted results are stored in byte units.


If an odd number of characters is being converted, “0” will be entered for bit position 0 to 3 of the final data
(byte) of the converted results.
ASCII code Converted result

44 n n-1 n-2

Converted
result n 0 n-1 n-2

This position is n = S2, (odd number)


filled with “0”.

ASCII code to express hexadecimal number


ASCII code Hexadecimal
number
H30 0
H31 1
H32 2
H33 3
H34 4
H35 5
H36 6
H37 7
H38 8
H39 9
H41 A
H42 B
H43 C
H44 D
H45 E
H46 F

3 - 143
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F73 (BCDA) BCD data → ASCII code 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Converts 4 - digit BCD code to ASCII code that expresses the
equivalent decimals.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 73 (BCDA)
R0 DT 0
10 F73 BCDA , DT 0 , H4 , DT 10
H 4
S1 S2 D DT 10

S1 Starting 16-bit area for BCD data (source)


S2 16-bit equivalent constant or 16-bit area to specify number of source data
bytes to be converted and direction of the converted data
D Starting 16-bit area for storing conversion result (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A N/A N/A N/A N/A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts BCD code that express a 4-digit decimal number (4-digit BCD H code) stored in data register DT0 to
ASCII code when execution condition (trigger) R0 turns on. The converted data is stored in data registers
DT10 and DT11.
When S2 = H2 (normal direction, 2 bytes convertion)

DT0
BCD
1 2 3 4
H code

DT11 DT10
ASCII
3 2 3 1 3 4 3 3
HEX code

ASCII
2 1 4 3
character

3 - 144
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

When S2 = H1002 (reverse direction, 2 bytes convertion)


DT0
BCD
1 2 3 4
data

DT11 DT10
ASCII
3 4 3 3 3 2 3 1
HEX code

ASCII 4 3 2 1
character

Description
Converts the BCD code starting from the 16-bit area specified by S1 to ASCII code that expresses the
equivalent decimals as specified by S2. The converted result is stored in the area starting from the 16-bit area
specified by D. A maximum of four bytes (eight characters of data) can be converted.
S2 specifies the number of source data bytes and the direction of converted data (normal/reverse).
The data length when converted to ASCII code becomes double the BCD data.
How to specify S2
S2 = H j 0 0 j

Number of bytes for BCD data


H1: 1 byte (BCD code that expresses a 2-digit decimal)
H2: 2 bytes (BCD code that expresses a 4-digit decimal)
H3: 3 bytes (BCD code that expresses a 6-digit decimal)
H4: 4 bytes (BCD code that expresses a 8-digit decimal)

Direction of converted data


H0: Normal direction
H1: Reverse direction

Since you can specify source data in byte units, it is possible to convert only the lower byte of S1 to ASCII
code.
For information on the direction of conversion, refer to ”Explanation of example”.

3 - 145
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Precautions during programming


The two characters that make up one byte are interchanged when stored.
Two bytes are converted as one segment of data.
Normal direction Reverse direction
S1 S1
1 2 3 4 1 2 3 4

2 1 4 3 Converted 4 3 2 1
result
D+1 D D+1 D

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data specified by S1 is not BCD data.
- The number of bytes specified by S2 exceeds the area specified by S1.
- The converted result exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
- The number of bytes specified by S2 is more than H4.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data specified by S1 is not BCD data.
- The number of bytes specified by S2 exceeds the area specified by S1.
- The converted result exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
- The number of bytes specified S2 is more than H4.
Conversion Example
The following shows conversion from BCD data to ASCII codes.
Normal direction convertion of 4 bytes (S2 = H0004)
BCD data
S1+1 S1
BCD H code 12 34 56 78

4 bytes

F73 (BCDA) instruction execution

Converted result D+3 D+2 D+1 D


ASCII HEX
code 32 31 34 33 36 35 38 37
ASCII
2 1 4 3 6 5 8 7
character
Result of S1 + 1 Result of S1
conversion conversion

3 - 146
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Reverse direction convertion of 4 bytes (S2 = H1004)


BCD data
S1+1 S1
BCD H code 12 34 56 78

4 bytes

F73 (BCDA) instruction execution

Converted result D+3 D+2 D+1 D


ASCII HEX
code 38 37 36 35 34 33 32 31
ASCII 8 7 6 5 4 3 2 1
character
Result of S1 Result of S1 + 1
conversion conversion

BCD code to express ASCII code


BCD code ASCII code
0 H30
1 H31
2 H32
3 H33
4 H34
5 H35
6 H36
7 H37
8 H38
9 H39

3 - 147
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F74 (ABCD) ASCII code → BCD data 9 FP0 C10, C14, C16,
C32, T32, SL1

Outline Converts ASCII code that expresses decimal characters to BCD code.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 74 (ABCD)
R0 DT 0
10 F74 ABCD , DT 0 , H8 , DT 40
H 8
S1 S2 D DT 40

S1 Starting 16-bit area for storing ASCII code (source)


S2 16-bit equivalent constant or 16-bit area to specify number of source data
bytes to be converted and to arrange converted data
D Starting 16-bit area for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A N/A N/A N/A N/A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts ASCII codes stored in data registers DT1 and DT0 to BCD data when execution condition (trigger)
R0 turns on. The converted data is stored in data register DT40.
When S2 = H4 (normal direction, 4 bytes)

DT1 DT0
ASCII
3 4 3 3 3 2 3 1
HEX code

ASCII
4 3 2 1
character

DT40
BCD
3 4 1 2
H code

3 - 148
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

When S2 = H1004 (reverse direction, 4 bytes):


DT1 DT0
ASCII
3 4 3 3 3 2 3 1
HEX code

ASCII 4 3 2 1
character

DT40
BCD
1 2 3 4
H code

Description
Converts ASCII codes that express decimal characters, starting from the 16-bit area specified by S1, to BCD
data as specified by S2. The converted result is stored in the area starting from the 16-bit area specified by D.
A maximum of eight characters of data can be converted.
S2 specifies the number of source data bytes and the direction of converted data (normal/reverse).
The data length when converted to a BCD number becomes half the ASCII code source data.
How to specify S2
S2 = H j 0 0 j
Number of bytes for ASCII character
H1: 1 byte (1 ASCII character)
H2: 2 bytes (2 ASCII characters)
H3: 3 bytes (3 ASCII characters)
H4: 4 bytes (4 ASCII characters)
H5: 5 bytes (5 ASCII characters)
H6: 6 bytes (6 ASCII characters)
H7: 7 bytes (7 ASCII characters)
H8: 8 bytes (8 ASCII characters)

Direction converted data


H0: Normal direction
H1: Reverse direction

3 - 149
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Precautions during programming


The data for two ASCII code characters is converted to two numeric digits for one byte. When this takes place,
the characters of the upper and lower bytes are interchanged.
Four characters are converted as one segment of data.
The converted results are stored in byte units.
If an odd number of characters is being converted, “0” will be entered for bit position 0 to 3 of the final data
(byte) of the converted results if data is sequenced in the normal direction, and “0” will be entered for bit
position 4 to 7 if data is being sequenced in the reverse direction.

Normal direction Reverse direction

2 1 4 3 ASCII 4 3 2 1
code

1 2 3 4 BCD data 1 2 3 4

Conversion Example
The following shows conversion from ASCII codes to BCD data.
8 ASCII characters convertion (S2=H0008)
ASCII code
S1+3 S1+2 S1+1 S1
ASCII HEX
code 38 37 36 35 34 33 32 31
ASCII 8 7 6 5 4 3 2 1
character
8 ASCII characters (8 bytes)

F74 (ABCD) instruction execution

Converted result D+1 D


BCD H code 78 56 34 12

7 ASCII characters (S2=H1007)


ASCII code
S1+3 S1+2 S1+1 S1
ASCII HEX
code 37 36 35 34 33 32 31
ASCII character 7 6 5 4 3 2 1
7 ASCII characters (7 bytes)

This position is F74 (ABCD) instruction execution


filled with “0”.
Converted result D+1 D
BCD H code 01 23 45 67

3 - 150
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

ASCII code to express BCD code


ASCII code BCD code
H30 0
H31 1
H32 2
H33 3
H34 4
H35 5
H36 6
H37 7
H38 8
H39 9

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- ASCII code not corresponding to decimal numbers (0 to 9) is specified.
- The number of bytes specified by S2 exceeds the area specified by S1.
- The converted result exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
- The number of bytes for ASCII characters in S2 is more than H8.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- ASCII code not corresponding to decimal numbers (0 to 9) is specified.
- The number of bytes specified by S2 exceeds the area specified by S1.
- The converted result exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
- The number of bytes for ASCII characters in S2 is more than H8.

3 - 151
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F75 (BINA) 16-bit data → ASCII code 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Converts 16-bit data to ASCII code that expresses the equivalent
decimals.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 75 (BINA)
R0
DT 0
10 F75 BINA , DT 0 , K 6 , DT 50
K 6
S1 S2 D DT 50

S1 16-bit equivalent constant or 16-bit area to be converted (source)


S2 16-bit equivalent constant or 16-bit area to specify number of bytes used to
express destination data (ASCII codes)
D Starting 16-bit area for storing ASCII codes (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts the 16-bit data stored in data register DT0 to ASCII codes that express the equivalent decimals
when execution condition (trigger) R0 turns on. The converted data is stored in data registers DT52 to DT50.
Source DT0
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Decimal data K - 100

Destination
DT52 DT51 DT50
ASCII HEX code 3 0 3 0 3 1 2 D 2 0 2 0
ASCII character 0 0 1 -

6 bytes
SPACE

3 - 152
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Converts the 16-bit data specified by S1 to ASCII codes that express the equivalent decimals. The converted
result is stored in the area starting from the 16-bit area specified by D as specified by S2.
Specify the number of bytes in decimal number in the S2. (This specification cannot be made with BCD data.)
Precautions during programming
If a positive number is converted, the “+” sign is not converted.
When a negative number is converted, the “ - ” sign is also converted to ASCII code (ASCII HEX code: H2D).
If the area specified by S2 is more than that required by the converted data, the ASCII code for “SPACE”
(ASCII HEX code: H20) is stored in the extra area.
Data is stored in the direction towards the final address, so the position of the ASCII code may change,
depending on the size of the data storage area.
When S2=K8 (8 bytes)
D+3 D+2 D+1 D
30 30 31 2D 20 20 20 20
0 0 1 - (Space) (Space) (Space) (Space)

ASCII code Extra bytes

Range specified by S2

If the number of bytes of ASCII codes following conversion (including the minus sign) is larger than the
number of bytes specified by the S2, an operation error occurs. Make sure the sign is taken into consideration
when specifying the object of conversion for the S2.
Conversion Example
The following shows conversion from 16 - bit decimal data to ASCII codes.
When a negative number is converted
16- bit data S1
FF 9C
K - 100

F75 (BINA) instruction execution


Converted
result D+2 D+1 D
30 30 31 2D 20 20
0 0 1 - (Space) (Space)

ASCII code Extra bytes

Range specified by S2 (6 bytes)

3 - 153
High - level Instructions FP0

3.3 Explanation of High - level Instructions

When a positive number is converted


16- bit data S1
04 D2
K1234

F75 (BINA) instruction execution


Converted
result D+2 D+1 D
34 33 32 21 20 20
4 3 2 1 (Space) (Space)

ASCII code Extra bytes

Range specified by S2 (6 bytes)

Decimal characters to express ASCII HEX code


Decimal ASCII HEX
characters code
SPACE H20
- H2D
0 H30
1 H31
2 H32
3 H33
4 H34
5 H35
6 H36
7 H37
8 H38
9 H39

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by S2 exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
- The converted result exceeds the area specified by D.
- The number of bytes of converted result exceeds the number of bytes
specified by S2.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by S2 exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
- The converted result exceeds the area specified by D.

3 - 154
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability

F76 (ABIN) ASCII code → 16-bit data 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Converts ASCII code that expresses decimal digits to 16-bit data that
expresses the equivalent number.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 76 (ABIN)
R0
DT 0
10 F76 ABIN , DT 0 , K 6 , DT 50
K 6
S1 S2 D DT 50

S1 Starting 16-bit area for ASCII code (source)


S2 16-bit equivalent constant or 16-bit area to specify number of source data bytes
to be converted
D 16-bit area for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A N/A N/A N/A N/A A
S2 A A A A A A A A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts ASCII codes (6 bytes) that express decimal digits in data registers DT2 to DT0 to 16-bit data when
execution condition (trigger) R0 turns on. The converted data is stored in data register DT50.
Source DT2 DT1 DT0
ASCII HEX code 3 0 3 0 3 1 2 D 3 0 3 0
ASCII character 0 0 1 —

6 bytes
In this case, this position should
be set to “SPACE” or “0”.
Destination DT50
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
Decimal data K - 100

3 - 155
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts the ASCII codes that express the decimal digits, starting from the 16-bit area specified by S1 to
16-bit data as specified by S2. The converted result is stored in the area specified by D.
S2 specifies the number of source data bytes to be converted using decimal number. (This specification
cannot be made with BCD data.)

Precautions during programming


The ASCII codes being converted should be stored in the direction of the last address in the specified area.
If the area specified by S1 and S2 is more than that required for the data you want to convert, place “0” (ASCII
HEX code: H30) or “SPACE” (ASCII HEX code: H20) into the extra bytes.
ASCII codes with signs (such as +: H2B and - : H2D) are also converted. The + codes can be omitted.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
-The area specified using the index modifier exceeds the limit.
-The number of bytes specified by S2 exceeds the area specified by S1.
-The data specified by S2 is recognized as “0”.
-The converted result exceeds the 16-bit area specified by D.
-The converted result exceeds the 16 - bit area.
-ASCII code not corresponding to decimal numbers (0 to 9) or ASCII
characters (+, - , and SPACE) is specified.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by S2 exceeds the area specified by S1.
- The data specified by S2 is recognized as “0”.
- The converted result exceeds the 16-bit area specified by D.
- The converted result exceeds the 16 - bit area.
- ASCII code not corresponding to decimal numbers (0 to 9) or ASCII
characters (+, - , and SPACE) is specified.

Conversion Example
The following shows conversion from ASCII codes to decimal data in a 16 - bit configuration.
Example of converting an ASCII code indicating a negative number
ASCII code
S1+2 S1+1 S1
30 30 31 2D 30 30
0 0 1 - (0) (0)

ASCII code Extra bytes

Range specified by S2

F76 (ABIN) instruction execution


Converted result D
FF 9C
K - 100

3 - 156
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Example of converting an ASCII code indicating a positive number

Example 1:

ASCII code
S1+2 S1+1 S1
30 30 31 2B 20 20
0 0 1 + (Space) (Space)

ASCII code Extra bytes

Range specified by S2

Example 2:

ASCII code
S1+2 S1+1 S1
30 30 31 20 20 20
0 0 1 (Space) (Space) (Space)

ASCII code Extra bytes

Range specified by S2

F76 (ABIN) instruction execution


Converted result
of example 1 or 2 D
00 64
K100

ASCII code to express decimal characters


ASCII code Decimal
characters
H20 SPACE
H2B +
H2D -
H30 0
H31 1
H32 2
H33 3
H34 4
H35 5
H36 6
H37 7
H38 8
H39 9

3 - 157
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F77 (DBIA) 32-bit data → ASCII code 11 FP0 C10, C14, C16,
C32, T32, SL1

Outline Converts 32-bit data to ASCII code that expresses the equivalent
decimals.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 77 (DBIA)
R0
DT 0
10 F77 DBIA , DT 0 , K 10 , DT 50
K 10
S1 S2 D DT 50

S1 32-bit equivalent constant or lower 16-bit area of 32-bit data to be converted


(source)
S2 16-bit equivalent constant or 16-bit area to specify number of bytes used to
express destination data (ASCII codes)
D Starting 16-bit area for storing ASCII codes (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A N/A A A A
S2 A A A A A A A N/A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts the 32-bit data stored in data registers DT1 and DT0 to ASCII code that expresses the equivalent
decimals when execution condition (trigger) R0 turns on. The converted data is stored in data registers DT54
to DT50 (10 bytes).
Source DT1 DT0
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 15 · · 1211 · · 8 7 · · 4 3 · · 0
Decimal K12345678

Destination DT54 DT53 DT52 DT51 DT50


ASCII HEX code 3 8 3 7 3 6 3 5 3 4 3 3 3 2 3 1 2 0 2 0
ASCII character 8 7 6 5 4 3 2 1

Number of bytes specified by S2 (10 bytes) SPACE

3 - 158
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Converts the 32-bit data specified by S1 to ASCII code that expresses the equivalent decimals. The
converted result is stored in the area starting from the 16-bit area specified by D as specified by S2.
S2 specifies the number of bytes used to express the destination data using decimal.

Precautions during programming


When a positive number is converted, the “+” sign is not converted.
When a negative number is converted, the “ - ” sign is also converted to ASCII code (ASCII HEX code: H2D).
If the area specified by S2 is more than that required by the converted data, the ASCII code for “SPACE”
(ASCII HEX code: H20) is stored in the extra area.
Data is stored in the direction of the last address, so the position of the ASCII code may change depending on
the size of the data storage area.
If the number of bytes of ASCII codes following conversion (including the minus sign) is larger than the
number of bytes specified by the S2, an operation error occurs. Make sure the sign is taken into consideration
when specifying the object of conversion for the S2.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by S2 exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
- The converted result exceeds the area specified by D.
- The number of bytes of converted result exceeds the number of bytes
specified by S2.
- Number of bytes specified by S2 < Number of bytes specified by S1.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by S2 exceeds the area specified by D.
- The data specified by S2 is recognized as “0”.
- The converted result exceeds the area specified by D.
- The number of bytes of converted result exceeds the number of bytes
specified by S2.
- Number of bytes specified by S2 < Number of bytes specified by S1.

3 - 159
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Conversion Example
The following shows conversion from 32 - bit decimal format data to ASCII codes.
Example of converting a negative number
32- bit data S1+1 S1
FF 43 9E B2

K - 12345678

Converted F77 (DBIA) instruction execution


result
D+4 D+3 D+2 D+1 D
38 37 36 35 34 33 32 31 2D 20
8 7 6 5 4 3 2 1 - (Space)

ASCII code Extra byte

Range specified by S2 (10 bytes)

Example of converting a positive number


32- bit data S1+1 S1
00 BC 61 4E

K12345678

F77 (DBIA) instruction execution


Converted
result D+3 D+2 D+1 D
38 37 36 35 34 33 32 31
8 7 6 5 4 3 2 1

ASCII code

Range specified by S2 (8 bytes)

Decimal characters to express ASCII code


Decimal ASCII code
characters
SPACE H20
+ H2B
- H2D
0 H30
1 H31
2 H32
3 H33
4 H34
5 H35
6 H36
7 H37
8 H38
9 H39

3 - 160
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F78 (DABI) ASCII code → 32-bit data 11 FP0 C10, C14, C16,
C32, T32, SL1

Outline Converts ASCII code that expresses decimal digits to 32-bit data that
expresses the equivalent number.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F 78 (DABI)
R0
DT 0
10 F78 DABI , DT 0 , K 10 , DT 50
K 10
S1 S2 D DT 50

S1 Starting 16-bit area for ASCII code (source)


S2 16-bit equivalent constant or 16-bit area to specify number of source data bytes
to be converted
D Lower 16-bit area of 32-bit data for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A N/A N/A N/A N/A A
S2 A A A A A A A N/A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts ASCII codes (10 bytes) that express decimal digits in data registers DT4, DT3, DT2, DT1 and DT0
to 32-bit data when execution condition (trigger) R0 turns on. The converted data is stored in data registers
DT51 and DT50.
Source DT4 DT3 DT2 DT1 DT0
ASCII HEX code 3 8 3 7 3 6 3 5 3 4 3 3 3 2 3 1 2 0 2 0
ASCII character 8 7 6 5 4 3 2 1

ASCII codes (10 bytes) specified by S2 SPACE

Destination DT51 DT50


Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0 15 · ·· 12 11 · · 8 7 · · 4 3 · · 0
Decimal K12345678

3 - 161
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts ASCII code that expresses the decimal digits, starting from the 16-bit area specified by S1 to 32-bit
data as specified by S2. The converted result is stored in the area starting from the 16-bit area specified by D.
S2 specifies the number of bytes used to express the destination data using decimals.

Precautions during programming


The ASCII codes being converted should be stored in the direction of the last address in the specified area.
If the area specified by S1 and S2 is more than that required by the data you want to convert, place “0” (ASCII
HEX code: H30) or “SPACE” (ASCII HEX code: H20) in the extra bytes.
ASCII codes with signs (such as +: H2B and - : H2D) are also converted. The + codes can be omitted.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
-The area specified using the index modifier exceeds the limit.
-The number of bytes specified by S2 exceeds the area specified by S1.
-The data specified by S2 is recognized as “0”.
-The converted result exceeds the area specified by D.
-The converted result exceeds the 32-bit area.
-ASCII code not corresponding to decimal numbers (0 to 9) or ASCII
characters (+, - , and SPACE) is specified.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by S2 exceeds the area specified by S1.
- The data specified by S2 is recognized as “0”.
- The converted result exceeds the area specified by D.
- The converted result exceeds the 32-bit area.
- ASCII code not corresponding to decimal numbers (0 to 9) or ASCII
characters (+, - , and SPACE) is specified.

3 - 162
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Conversion Example
The following shows conversion from ASCII codes to decimal data in a 32 - bit configuration.
Example of converting an ASCII code indicating a negative number
ASCII code
S1+4 S1+3 S1+2 S1+1 S1
38 37 36 35 34 33 32 31 2D 20
8 7 6 5 4 3 2 1 - (Space)

ASCII code Extra byte

Range specified by S2 (10 bytes)

F78 (DABI) instruction execution

Converted result D+1 D


FF 43 9E B2

K - 12345678

Example of converting an ASCII code indicating a positive number

Example 1:

ASCII code
S1+3 S1+2 S1+1 S1
38 37 36 35 34 33 32 31
7 8 6 5 4 3 2 1

ASCII code

Range specified by S2 (8 bytes)

Example 2:
ASCII code
S1+4 S1+3 S1+2 S1+1 S1
38 37 36 35 34 33 32 31 2B 20
8 7 6 5 4 3 2 1 + (Space)

ASCII code Extra byte

Range specified by S2 (10 bytes)

F78 (DABI) instruction execution


Converted result of
example 1 or 2 D+1 D
00 BC 61 4E

K12345678

3 - 163
High - level Instructions FP0

3.3 Explanation of High - level Instructions

ASCII code to express decimal characters


ASCII code Decimal
characters
H20 SPACE
H2B +
H2D -
H30 0
H31 1
H32 2
H33 3
H34 4
H35 5
H36 6
H37 7
H38 8
H39 9

3 - 164
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F80 (BCD) 16-bit data → 4-digit BCD data 5
C32, T32, SL1

Outline Converts 16-bit binary data to BCD code the expresses a 4-digit
decimal.
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 80 (BCD)

R0 DT 10
10 F80 BCD , DT10 , DT20 DT 20

S D

S 16-bit equivalent constant or 16-bit area for storing 16- bit binary data (source)
D 16-bit area for 4-digit BCD data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Converts the contents of data register DT10 to BCD code that expresses a 4-digit decimal when execution
condition (trigger) R0 turns on. The converted data is stored in data register DT20.
If DT10 is 16 using decimal number conversion, the following will be stored in DT20.
Source [S]: K16
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT10 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
Decimal K16

Conversion (to BCD code)

Destination [D]: H16 (BCD)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT20 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0
BCD H code 0 0 1 6

3 - 165
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts the 16-bit binary data specified by S to BCD code that expresses a 4-digit decimal. The converted
data is stored in D.

Precautions during programming


The maximum value of 16 - bit binary data that can be converted to BCD code is K9999 (H270F).
For detailed information about the BCD data section 4.2.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- 16-bit binary data outside the range of K0 (H0) to K9999 (H270F) is
converted.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- 16-bit binary data outside the range of K0 (H0) to K9999 (H270F) is
converted.

3 - 166
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F81 (BIN) 4-digit BCD data → 16-bit data 5 C32, T32, SL1

Outline Converts BCD code that expresses a 4-digit decimal to 16-bit binary
data.
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 81 (BIN)

R0 DT 10
10 F81 BIN , DT10 , DT0 DT 0

S D

S 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data (source)
D 16-bit area for storing 16-bit binary data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Converts the contents of data register DT10 to 16-bit binary data when execution condition (trigger) R0 turns
on. The converted data is stored in data register DT0.
If DT10 is BCD data consisting of H15, the following will be stored in DT0.
Source [S]: H15 (BCD)
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT10 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1
BCD H code 0 0 1 5

Conversion (to binary data)


Destination [D]: K15
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
Decimal K15

Description
Converts BCD code that expresses a 4-digit decimal specified by S to 16-bit binary data. The converted data
is stored in D.

For detailed information about the BCD data section 4.2.

3 - 167
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data specified by S is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data specified by S is not BCD data.

3 - 168
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F82 (DBCD) 32-bit data → 8-digit BCD data 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Converts 32-bit binary data to BCD code that expresses an 8-digit
decimal.
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 20
Trigger
11 F 82 (DBCD)
R20 DT 0
10 F82 DBCD, DT 0 , DT 2 DT 2

S D
S 32-bit equivalent constant or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area for 8-digit BCD code (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts the contents of data registers DT1 and DT0 to BCD code that expresses an 8-digit decimal when
execution condition (trigger) R20 turns on. The converted data is stored in data registers DT3 and DT2.

Description
Converts the 32-bit data specified by S to BCD code that expresses an 8-digit decimal. The converted data is
stored in D+1 and D.

Precautions during programming


The maximum value of binary data that can be converted to BCD code is K99999999 (H5F5E0FF).
For detailed information about the BCD data section 4.2.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- 32-bit data specified by S outside the range of K0 (H0) to K99999999
(H5F5E0FF) is converted.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- 32-bit data specified by S outside the range of K0 (H0) to K99999999
(H5F5E0FF) is converted.

3 - 169
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F83 (DBIN) 8-digit BCD data → 32-bit data 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Converts BCD code that expresses an 8-digit decimal to 32-bit binary
data.
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 10
Trigger
11 F 83 (DBIN)

R10 DT 0
10 F83 DBIN, DT 0 , DT 2 DT 2

S D
S 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD code
(source)
D Lower 16-bit area for 32-bit data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts BCD code that expresses an 8 - digit decimal of data registers DT1 and DT0 to 32-bit binary data
when execution condition (trigger) R10 turns on. The converted data is stored in data registers DT3 and DT2.

Description
Converts BCD code that expresses an 8-digit decimal specified by S to 32-bit binary data. The converted
data is stored in D+1 and D.
For detailed information about the BCD data section 4.2.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The data specified by S is not BCD data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The data specified by S is not BCD data.

3 - 170
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F84 (INV) 16-bit data invert 3 FP0 C10, C14, C16,


C32, T32, SL1

Outline Inverts all bits in the 16-bit area.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 20
Trigger
11 F 84 (INV)

R20 DT 0
10 F84 INV , DT 0

D 16-bit area to be inverted

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Inverts the contents of data register DT0 when execution condition (trigger) R20 turns on.
Destination
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 1 0 1 1 1 1 0 1 0 1 1 1 1 0 1

Destination R20: on (inversion)


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0

Description
Inverts each bit (0 or 1) of the 16-bit data specified by D.
This instruction is useful for controlling an external device (7 - segment display) that uses negative logic
operation.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 171
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F85 (NEG) 16-bit data two’s complement 3 FP0 C10, C14, C16,
C32, T32, SL1

Outline Takes two’s complement of 16-bit data.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 20
Trigger
11 F 85 (NEG)

R20 DT 0
10 F85 NEG , DT 0

D
D 16-bit area for storing original data and its two’s complement

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Takes two’s complement of data register DT0 when execution condition (trigger) R20 turns on.
Destination
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
Decimal data K3

R20: on
Destination
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
Decimal data K-3

Description
Takes two’s complement of 16-bit data specified by D.
The two’s complement is obtained by inverting all bits and adding 1 to the inverted result.
This instruction is useful for changing the sign of 16-bit data from positive to negative or from negative to
positive.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 172
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F86 (DNEG) 32-bit data two’s complement 3 FP0 C10, C14, C16,
C32, T32, SL1

Outline Takes two’s complement of 32-bit data


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 20
11 F 86 (DNEG)
R20
10 F86 DNEG , DT 0 DT 0

D
D Lower 16-bit area of 32-bit data for storing original data and its two’s
complement

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Takes two’s complement of data registers DT1 and DT0 when execution condition (trigger) R20 turns on.
Destination DT1 DT0
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary data 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
Decimal data K-3

Higher 16-bit area Lower 16-bit area


R20: on

Destination DT1 DT0


Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary data 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
Decimal data K3

Higher 16-bit area Lower 16-bit area

Description
Takes two’s complement of 32-bit data specified by D.
The two’s complement is obtained by inverting all bits and adding 1 to the inverted result.
This instruction is useful for changing the sign of 32-bit data from positive to negative or from negative to
positive.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 173
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F87 (ABS) 16-bit data absolute 3 FP0 C10, C14, C16,


C32, T32, SL1

Outline Takes absolute value of signed 16-bit data.


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 20
11 F 87 (ABS)
R20
10 F87 ABS , DT 0 DT 0

D
D 16-bit area for storing original data and its absolute value

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Takes absolute value of data register DT0 when execution condition (trigger) R20 turns on.
For instance, regardless of whether the value of DT0 is K1 or K - 1, it will be K1 when the instruction is
executed.

Description
Takes absolute value of signed 16-bit data specified by D. The absolute value of the signed 16-bit data is
stored in D.
This is effective for processing data in which the polarity (+ or - ) changes.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The 16-bit data is the negative minimum value “K-32768 (H8000).”
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The 16-bit data is the negative minimum value “K-32768 (H8000).”
S Carry flag (R9009): Turns on for an instant when 16-bit data is the negative value “range: K-1 to
K-32767 (HFFFF to H8001).”

3 - 174
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F88 (DABS) 32-bit data absolute 3 FP0 C10, C14, C16,


C32, T32, SL1

Outline Takes absolute value of signed 32-bit data.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 20
Trigger
11 F 88 (DABS)
R20 DT 0
10 F88 DABS , DT 0

D Lower 16-bit area of 32-bit data for storing original data and its absolute value

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Takes absolute value of data registers DT1 and DT0 when execution condition (trigger) R20 turns on. The
absolute value of DT1 and DT0 is stored in data registers DT1 and DT0.

Description
Takes the absolute value of signed 32-bit data specified by D. The absolute value of the 32-bit data is stored
in D+1 and D.
This is effective for processing data in which the polarity (+ or - ) changes.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The 32-bit data is the negative minimum value “K-2147483648
(H80000000).”
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The 32-bit data is the negative minimum value “K-2147483648
(H80000000).”
S Carry flag (R9009): Turns on for an instant when 32-bit data is negative value “range K-1 to
K-2147483647 (HFFFFFFFF to H80000001).”

3 - 175
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability
FP0 C10, C14, C16,
F89 (EXT) 16-bit data sign extension 3
C32, T32, SL1

Outline Copies the sign bit of the specified 16-bit data to all the bits of the higher
16-bit area (extended 16-bit area).
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 20
Trigger
11 F 89 (EXT)
R20 DT 0
10 F89 EXT , DT 0

D 16-bit area for storing original 16-bit binary data

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Copies the sign bit (bit position 15) of data register DT0 to all the bits of data register DT1 when execution
condition (trigger) R20 turns on.
If K - 2 is stored in DT0, the data will be as follows.
Sign bit (0: positive, 1: negative)
DT0
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary data 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
Decimal data K-2

16-bit data
R20: on

DT1 DT0
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary data 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
Decimal data K-2

Higher 16-bit area Lower 16-bit area


(extended 16-bit area)

32-bit data

3 - 176
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
16 - bit data is converted to 32 - bit data, without signs and values being changed.
If the sign bit (bit position 15) of the 16 - bit data specified by D is 0, all 16 bits of the next area of D will be set to
0. If the sign bit is 1, all 16 bits will be set to 1.
Double word data with D as the first data can be used as the operand of 32 - bit operation instructions
following execution of the F89 (EXT) instruction.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 177
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F90 (DECO) Decode 7
C32, T32, SL1

Outline Decodes the specified data.


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 20
11 F 90 (DECO)
R20 DT 10
10 F90 DECO, DT10, H404, DT20 H 404
DT 20
S n D
S 16-bit equivalent constant or 16-bit area to be decoded (source)
n 16-bit area equivalent constant or 16-bit area to specify starting bit position
and number of bits to be decoded
D Starting 16-bit area for storing decoded data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
n A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Decodes data register DT10 according to the contents of n “H404” when execution condition (trigger) R20
turns on. The decoded result is stored in data register DT20.
When n: H404
Bit position 4
Source
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 4 bits from bit position 4 to 7 of DT10 are decoded.
DT10 0 1 0 0 0 1 1 0 0 1 1 1 1 0 0 1 [Binary: 0111 (decimal: K7)]

4 bits
R20: on
Destination
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 The decoded data “1 (on)” is stored in bit position 7 of
DT20 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 DT20.
The bits except bit position 7 become 0.

Description
Decodes the contents of 16-bit data specified by S according to the contents of n. The decoded result is
stored in the area starting from 16-bit area specified by D.
The length of the area required to store decoding results changes depending on the length of the data being
decoded.

3 - 178
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

How to specify control data “n”


n specifies the starting bit position and the number of bits to be decoded using hexadecimal data.

16-bit data
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
n ———— 0 1 0 0 ———— 0 1 0 0 The bits of “ - ” mark are invalid.

Number of bits to be decoded


Starting bit position to be decoded (set range: H1 to H8)
(set range: H0 to HF) Set value Number of
bits
Set value Starting bit
position
H1 1
H0 0 H2 2
H1 1 H3 3
H2 2 H4 4
H3 3 H5 5
H4 4 H6 6
H5 5 H7 7
H6 6 H8 8
H7 7
H8 8
H9 9
HA 10
HB 11
HC 12
HD 13
HE 14
HF 15

Relationship between number of bits and occupied data area for decoded result

Number of bits to be decoded Data area required for the result Valid bits in the area for the
result
1 1-word 2-bit*
2 1-word 4-bit*
3 1-word 8-bit*
4 1-word 16-bit
5 2-word 32-bit
6 4-word 64-bit
7 8-word 128-bit
8 16-word 256-bit

* Invalid bits in the data area required for the result are set to “0”.

3 - 179
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Decoded example
When decoding 4-bit data, 16-bit data for the decoded result is shown below.
Decoding conditions (n)
Starting bit position: H0 (bit position 0)
Number of bits to be decoded: H4 (4 bits)

Data to be decoded Decoded result


[Binary (decimal)] 15 S S 12 11 S S 8 7 S S 4 3 S S 0
0000 (K0) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0001 (K1) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
0010 (K2) 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
0011 (K3) 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0100 (K4) 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0101 (K5) 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
0110 (K6) 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
0111 (K7) 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
1000 (K8) 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
1001 (K9) 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
1010 (K10) 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
1011 (K11) 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
1100 (K12) 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
1101 (K13) 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
1110 (K14) 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1111 (K15) 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The number of bits to be decoded is outside the range of 1 to 8.
- The sum of the number of bits to be decoded and the starting bit position to
be decoded is outside the range of 1 to 16.
- The last data area for the decoded result exceeds the limit.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number of bits to be decoded is outside the range of 1 to 8.
- The sum of the number of bits to be decoded and the starting bit position to
be decoded is outside the range of 1 to 16.
- The last data area for the decoded result exceeds the limit.

3 - 180
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F91(SEGT) 16-bit data 7-segment decode 5
C32, T32, SL1

Outline Converts 16-bit data to 4-digit data for 7-segment indication.


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F 91 (SEGT)
DT 0
R0
10 F91 SEGT , DT 0 , DT10 DT 10

S D

S 16-bit equivalent constant or 16-bit area to be converted to the 7-segment


indication (source)
D Starting 16-bit area for storing 4-digit data for 7-segment indication
(destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Converts the contents of data register DT0 to 4-digit data for 7-segment indication when execution condition
(trigger) R0 turns on. The converted data is stored in word internal relays DT11 and DT10.
For example, to display ”ABCD”, the following would be entered.
Source
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1
Hexadecimal A B C D

Destination
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT11 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 0 DT10 0 0 1 1 1 0 0 1 0 1 0 1 1 1 1 0
7-segment 7-segment
A B C D
indication indication

3 - 181
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts the 16-bit equivalent constant or 16-bit data specified by S to 4-digit data for 7-segment indication.
The converted data is stored in the area starting from the 16-bit area specified by D.
The relationship between the displayed contents and the contents specified for S, and the data of the
7 - segment display is shown below.

One digit data to be 8-bit data for


converted 7-segment indication 7-segment Organization of
indication 7 segment indication
7-segment
Hexadecimal Binary g f e d c b a
H0 0 0 0 0 0 0 1 1 1 1 1 1

H1 0 0 0 1 0 0 0 0 0 1 1 0

H2 0 0 1 0 0 1 0 1 1 0 1 1 LSB

H3 0 0 1 1 0 1 0 0 1 1 1 1 a

H4 0 1 0 0 0 1 1 0 0 1 1 0 b

H5 0 1 0 1 0 1 1 0 1 1 0 1 c
a
H6 0 1 1 0 0 1 1 1 1 1 0 1 d
f g b
H7 0 1 1 1 0 0 1 0 0 1 1 1 e

H8 1 0 0 0 0 1 1 1 1 1 1 1 f
e c
H9 1 0 0 1 0 1 1 0 1 1 1 1 g
d
HA 1 0 1 0 0 1 1 1 0 1 1 1

HB 1 0 1 1 0 1 1 1 1 1 0 0 MSB

HC 1 1 0 0 0 0 1 1 1 0 0 1

HD 1 1 0 1 0 1 0 1 1 1 1 0

HE 1 1 1 0 0 1 1 1 1 0 0 1

HF 1 1 1 1 0 1 1 1 0 0 0 1

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The last data area for the converted result exceeds the limit.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The last data area for the converted result exceeds the limit.

3 - 182
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F92 (ENCO) Encode 7
C32, T32, SL1

Outline Encodes the specified data.


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 92 (ENCO)
R0 DT 10
10 F92 ENCO, DT10, DT 0 , DT 1
DT 0
DT 1
S n D
S Starting 16-bit area to be encoded (source)
n 16-bit equivalent constant or 16-bit area to specify starting bit position and
number of bits to be encoded
D 16-bit area for storing encoded data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A N/A N/A N/A N/A A
n A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Encodes contens of data register DT11 and DT10 according to the contents of DT0 when execution condition
(trigger) R0 turns on. The encoded result is stored in 8 bits of data register DT1 starting from bit position 0.
When DT0: H0005

Number of bits to be encoded: 25 = 32 bits


Starting bit position to be encoded for destination data: bit position 0
The 8th bit of 32-bit
data is in the on state.
Source 32 bits specified by H5

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


[S] DT11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DT10 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
Starting bit position
Destination
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
[D] DT1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 The encoded result K8
Decimal K8 (decimal) is stored in DT1.

Bit position 8 to 15 Encoded result:K8


are filled with 0.

3 - 183
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Encodes the contents of data specified by S according to the contents of n. The encoded result is stored in the
16-bit area specified by D starting from the specified bit position.
If more than one bit is on in a segment being decoded, the uppermost bit is effective.
The contents of the 2nL segment at the beginning of the area specified by the S are encoded. The encoded
results are stored as decimal data, in the eight bits starting from the bit specified as the nH bit.
Invalid bits in the specified area for the result are set to 0.
How to specify control data “n”
n specifies the starting bit position of destination data and the number of bits to be decoded using
hexadecimal data.
16-bit data
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
n ———— 0 0 0 0 ———— 0 1 0 1
The bits of “ - ” mark are invalid.

Number of bits to be encoded


(set range: H1 to H8)
Starting bit position of destina-
Set value Number of
tion data to be encoded
(set range: H0 to HF) bits

Set value Starting bit H1 2


position H2 4
H0 0 H3 8 (1 byte)
H1 1 H4 16 (1 word)
H2 2 H5 32 (2 words)
H3 3 H6 64 (4 words)
H4 4 H7 128 (8 words)
H5 5 H8 256 (16 words)
H6 6
H7 7
H8 8
H9 9
HA 10
HB 11
HC 12
HD 13
HE 14
HF 15

3 - 184
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Encoded example
When encoding 16-bit data (nL=4), the encoded results are shown below.

Data to be encoded Encoded result


15 S S 12 11 S S 8 7 S S 4 3 S S 0 [Binary (decimal)]
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 (K0)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 (K1)
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 (K2)
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 (K3)
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 (K4)
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 (K5)
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 (K6)
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 (K7)
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 (K8)
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 (K9)
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 (K10)
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 (K11)
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 (K12)
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 (K13)
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 (K14)
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 (K15)

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The number of bits to be encoded is outside the range of 1 to 8.
- The sum of the number of bits to be encoded and the starting bit position to
be encoded is outside the range of 1 to 16.
- The data to be encoded is 0.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number of bits to be decoded is outside the range of 1 to 8.
- The sum of the number of bits to be decoded and the starting bit position to
be decoded is outside the range of 1 to 16.
- The data to be encoded is 0.

3 - 185
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F93 (UNIT) 16-bit data combine 7
C32, T32, SL1

Outline Extracts the lower 4 bits (bit positions 0 to 3) of the specified 16-bit areas
and combines them into one word.
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 93 (UNIT)
R0 DT 0
10 F93 UNIT, DT 0, K 3 , DT 100
K 3
DT 100
S n D
S Starting 16-bit area to be extracted (source)
n 16-bit equivalent constant or 16-bit area to specify number of data to be extracted
D 16-bit area for storing combined data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A N/A N/A N/A N/A A
n A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Extracts lower 4 bits of data registers DT2 to DT0, combines the extracted data, and stores it in data register
DT100 when execution condition (trigger) R0 turns on.

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
DT1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
DT2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT100 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

When the n < K4, “0” is set to bit position 12 to 15.

3 - 186
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Extracts the lower 4 bits (bit positions 0 to 3) of each specified area, starting from the 16-bit area specified by
S and combines the extracted data into one word. The result is stored in the 16-bit area specified by D.
n specifies the number of data areas to be extracted (range of n: K0 to K4).
When K0 is specified for n, this instruction is not executed.
When n < K4, “0” is automatically set to positions at D where the corresponding 16-bit source data does not
exist.
Source
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
S Digit 1
S+1 Digit 2
n
S+2 Digit 3
S+3 Digit 4

Bit positions 4 to 15 of each


data area are invalid.

Destination
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
D Digit 4 Digit 3 Digit 2 Digit 1

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The number of data areas to be combined “n” is K5 or more.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number of data areas to be combined “n” is K5 or more.

3 - 187
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F94 (DIST) 16-bit data distribute 7
C32, T32, SL1

Outline Divides the specified 16-bit data into four 4-bit units and distributes the
divided data into the lower 4 bits of the specified 16-bit areas.
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F 94 (DIST)
R0 DT 100
10 F94 DIST, DT100, K 4 , DT 0
K 4
DT 0
S n D
S 16-bit equivalent constant or 16-bit area to be divided (source)
n 16-bit equivalent constant or 16-bit area to specify number of data to be divided
D Starting 16-bit area for storing divided data (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
n A A A A A A A A A A A
A: Available
D N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Divides the 16-bit data of data register DT100 into 4-bit units and the divided data is stored in the lower 4 bits
(bit positions 0 to 3) of data registers DT0 to DT3 when execution condition (trigger) R0 turns on.
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT100 0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 0

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DT1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
DT2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
DT3 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1

3 - 188
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Divides the 16-bit data specified by S into 4-bit units and distributes the divided data into the lower 4 bits (bit
positions 0 to 3) of 16-bit areas starting from D.
n specifies the number of data divisions.(range of n: K0 to K4)
When K0 is specified for n, this instruction is not executed.
n
Source
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
S Digit 4 Digit 3 Digit 2 Digit 1

Destination
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
D Digit 1
D+1 Digit 2
D+2 Digit 3
D+3 Digit 4

Bit positions 4 to 15 are filled with 0s.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The number n is 5 or more.
- Transferring address specified by D to n data, and when area is exceeded.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The number n is 5 or more.
- Transferring address specified by D to n data, and when area is exceeded.

3 - 189
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F95 (ASC) Character → ASCII code 15
C32, T32, SL1

Outline Converts character constants to ASCII code. 4


Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 20
11 F 95 (ASC)

R20 M
10 ABC1230_DEF
F95 ASC, M ABC1230_DEF, DT 2
DT 2
S D

“_” indicates a space. In actuality, this will be blank.

S Character constants (max. 12 letters) (source)


D Starting 16-bit area for storing 6-word ASCII code (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H M
S N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A N/A: Not Available

Explanation of example
Converts the character constants “ABC1230_DEF” to ASCII code when execution condition (trigger) R20
turns on. The ASCII code is stored in data registers DT7 to DT2.
Character constant

[S] Character constants M ABC1230 DEF

R20: on

Data register DT7 DT6 DT5 DT4 DT3 DT2


[D] ASCII HEX code 2 0 4 6 4 5 4 4 2 0 3 0 3 3 3 2 3 1 4 3 4 2 4 1
ASCII character F E D 0 3 2 1 C B A

SPACE

When the number of character constants specified by S is less than 12, the ASCII code H20 (SPACE) is
stored in the extra destination area.

Description
Converts the character constants specified by S to ASCII code. The converted ASCII code is stored in 6
words starting from the 16-bit area specified by D.

3 - 190
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Precautions during programming


The character constant M can be input with the programming tool software.
Convertion example of one character constant “A”
S: MA
]
]
]
]
]
]
]
]
]
]
]
11 spaces
R20
F95 ASC, MA , DT 2

R20: on
DT2: H20 ( ) H41 (A)
[

DT3: H20 ( ) H20 ( )


[

DT4: H20 ( ) H20 ( )


[

DT5: H20 ( ) H20 ( )


[

DT6: H20 ( ) H20 ( )


[

DT7: H20 ( ) H20 ( )


[

Higher byte Lower byte


S: M A S: M A
]
]
]
]
]
]
]
]
]
]
]

]
]
]
]
]
]

]
]
]
]
]
11 spaces 6 spaces 5 spaces
R20 R20
F95 ASC, M A , DT 2 F95 ASC, M A , DT 2

R20: on R20: on
DT2: H20 ( ) H20 ( ) DT2: H20 ( ) H20 ( )
[

[
DT3: H20 ( ) H20 ( ) DT3: H20 ( ) H20 ( )
[

DT4: H20 ( ) H20 ( ) DT4: H20 ( ) H20 ( )


[

DT5: H20 ( ) H20 ( ) DT5: H20 ( ) H41 (A)


[

DT6: H20 ( ) H20 ( ) DT6: H20 ( ) H20 ( )


[

DT7: H41 (A) H20 ( ) DT7: H20 ( ) H20 ( )


[

Higher byte Lower byte Higher byte Lower byte

3 - 191
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when the last area for ASCII code exceeds the limit
(6 words: six 16-bit areas).
S Error flag (R9008): Turns on for an instant when the last area for ASCII code exceeds the limit
(6 words: six 16-bit areas).
ASCII code
b7

b6 0 0 0 0 1 1 1 1

b5 0 0 1 1 0 0 1 1
b4 0 1 0 1 0 1 0 1

Most significant digit


ASCII
b7 b6 b5 b4 b3 b2 b1 b0 HEX code
0 1 2 3 4 5 6 7

0 0 0 0 0 NUL DLE SPACE 0 @ P p

0 0 0 1 1 SOH DC1 ! 1 A Q a q

0 0 1 0 2 STX DC2 ” 2 B R b r

0 0 1 1 3 ETX DC3 # 3 C S c s

0 1 0 0 4 EOT DC4 $ 4 D T d t

0 1 0 1 5 ENQ NAK % 5 E U e u
Least significant digit

0 1 1 0 6 ACK SYN & 6 F V f v

0 1 1 1 7 BEL ETB ’ 7 G W g w

1 0 0 0 8 BS CAN ( 8 H X h x

1 0 0 1 9 HT EM ) 9 I Y i y

1 0 1 0 A LF SUB * : J Z j z

1 0 1 1 B VT ESC + ; K [ k {

FF FS , < L \ l 
1 1 0 0 C

1 1 0 1 D CR GS - = M ] m }

1 1 1 0 E SO RS . > N ^ n ~

1 1 1 1 F SI US / ? O _ o DEL

3 - 192
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F96 (SRC) Table data search 7
C32, T32, SL1

Outline Searches for a specified value in a block of 16-bit areas.


Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 10
11 F 96 (SRC)
R10 DT 100
10 F96 SRC , DT100 , DT 0 , DT 20
DT 0
DT 20
S1 S2 S3
S1 16-bit equivalent constant or 16-bit area to store the searched value
S2 Starting 16-bit area of the block
S3 Ending 16-bit area of the block

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S1 A A A A A A A A A A A
S2 A A A A A A N/A N/A N/A N/A A
A: Available
S3 N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

3 - 193
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Explanation of example
Searches for the value given in data register DT100 in the block of data register DT0 through DT20 when
execution condition (trigger) R10 turns on.
For example, to search the area of the value called H1234, “H1234” would be written to DT100.
Searched data Block of 16- bit areas
DT100: 1 2 3 4 DT0: 1 2 1 1 0 [S2]
[S1] DT1: 1 2 F F 1
DT2: 1 2 3 4 2
DT3: 7 F F F 3
Searching

DT19: 1 2 3 4 19
DT20: 1 2 3 4 20 [S3]

Relative position number

If DT2, DT19, and DT20 match the search data, the following occurs.
- If the number of registers matching the search data = 3
“K3” is stored in DT9037.
- If the position of the first matching data (the relative position number) = 2
“K2” is stored in DT9038.

Description
Searches for values matching S1 in the block of 16-bit areas specified by S2 (starting area) through S3
(ending area).
When the search operation is performed, the search results are stored as follows.
- The number of data items that match S1 is stored in special data register DT9037.
- The position of the first matching data item, counting from the starting 16-bit area S2, is stored in
special data register DT9038.
Starting area S2 and ending area S3 should:
- Be the same type of operand.
- Satisfy S2 ≦ S3.
Data is searched from S2 to S3.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- S2 > S3.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- S2 > S3.

3 - 194
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Right shift of 16-bit data in bit FP0 C10, C14, C16,
F100 (SHR) units
5
C32, T32, SL1

Outline Shifts a specified number of bits to the right in bit units.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F100 (SHR)
DT 0
R0
10 F100 SHR , DT 0 , K 4 K 4

D n

D 16-bit area to be shifted to the right


n 16-bit equivalent constant or 16-bit area (specifies number of shifted bits)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D N/A A A A A A A A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Explanation of example
Shifts 4 bits in data register DT0 to the right when execution condition (trigger) R0 turns on.
The data in bit position 3 is transferred to special internal relay R9009 (carry flag).

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


DT0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 1
The data in bit position 3 is
R0: on
transferred to R9009 (carry flag).
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 0 0· 0 1 0 1 0 0 1 1 0 1 1 0 0

In this case, the higher 4 bits


of DT0 are filled with 0s.

3 - 195
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Shifts n bits of the 16-bit data area specified by D to the right (to the lower bit position).
n
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
D
The data in the n th bit is transferred to R9009 (carry flag).

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


D 0 0 0 0

The higher n bits of D are filled with 0s.

When n bits are shifted to the right,


- The higher n bits of the 16-bit data area are filled with 0s.
- The data in the n th bit is transferred to special internal relay R9009 (carry flag).
The n is effective only for the lower 8 bits of the 16 - bit data. The amount of the shift can be specified within a
range of 1 bit to 255 bits.
15 · · 1211 · · 8 7 · · 4 3 · · 0
n ———— ———— 0 0 0 0 0 0 0 0

Upper 8 bits K0 to K255


are invalid (H00 to HFF)

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S Carry flag (R9009): Turns on for an instant when the content of bit transferred to R9009 (n th bit)
is recognized as 1.

3 - 196
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Left shift of 16-bit data in bit FP0 C10, C14, C16,
F101(SHL) units
5
C32, T32, SL1

Outline Shifts a specified number of bits to the left in bit units.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F101 (SHL)
DT 0
R0
10 F101 SHL , DT 0 , K4 K 4

D n

D 16-bit area to be shifted to the left


n 16-bit equivalent constant or 16-bit area (specifies number of shifted bits)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D N/A A A A A A A A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Explanation of example
Shifts 4 bits in data register DT0 to the left when execution condition (trigger) R0 turns on.
The data in bit position 12 is transferred to special internal relay R9009 (carry flag).

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


DT0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 1
The data in bit position 12
is transferred to R9009
(carry flag). Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
DT0 0 1 1· 0 1 1 0 0 1 0 1 1 0 0 0 0

In this case, the lower


4 bits of DT0 are filled with 0s.

3 - 197
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Shifts n bits of the 16-bit area specified by D to the left (to the higher bit position).
n
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
D
The data in the n th bit is
transferred to R9009
(carry flag). Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
D 0 0 0 0

n bits starting from bit position 0 are filled with 0s.

When the n bits are shifted to the left,


- The n bits starting from bit position 0 are filled with 0s.
- The data in the n th bit is transferred to special internal relay R9009 (carry flag).
The n is effective only for the lower 8 bits of the 16 - bit data. The amount of the shift can be specified within a
range of 1 bit to 255 bits.

15 · · 1211 · · 8 7 · · 4 3 · · 0
n ———— ———— 0 0 0 0 0 0 0 0

Upper 8 bits K0 to K255


are invalid (H00 to HFF)

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S Carry flag (R9009): Turns on for an instant when the content of bit transferred to R9009 (n th bit)
is recognized as 1.

3 - 198
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Right shift of one hexadecimal FP0 C10, C14, C16,
F105 (BSR) digit (4 bits) of 16-bit data
3
C32, T32, SL1

Outline Shifts one hexadecimal digit (4 bits) of the specified 16-bit data to the
right.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F105 (BSR)
DT 0
R0
10 F105 BSR , DT 0

D 16-bit area to be shifted to the right

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Shifts one hexadecimal digit (4 bits) in data register DT0 to the right when execution condition (trigger) R0
turns on.
The data in hexadecimal digit position 1 (bit positions 0 to 3) is shifted out and transferred to the lower digit
position (bit positions 0 to 3) of special data register DT9014.
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
DT0
Hexadecimal 9 9 9 9 (H9999)

R0: on

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


Binary 0 0 0 0 1 0 0 1 1 0 0 1 1 0 0 1
DT0
Hexadecimal 0 9 9 9 (H999)

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


Binary 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1
DT9014
Hexadecimal 0 0 0 9 (H9)

3 - 199
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Shifts one hexadecimal digit (4 bits) of the 16-bit area specified by D to the right (to the lower digit position).
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
D Hexadecimal Digit 4 Digit 3 Digit 2 Digit 1

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


D Hexadecimal 0 Digit 4 Digit 3 Digit 2

This hexadecimal digit position becomes 0.

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


DT9014 Hexadecimal 0 0 0 Digit 1

When one hexadecimal digit (4 bits) is shifted to the right,


- The data in hexadecimal digit position 1 (bit positions 0 to 3) of the 16 - bit area specified by D is
shifted out and is transferred to the lower digit (bit positions 0 to 3) of special data register DT9014.
- The hexadecimal digit 4 (bit positions 12 to 15) of the 16-bit area specified by D becomes 0.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 200
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Left shift of one hexadecimal FP0 C10, C14, C16,
F106 (BSL) digit (4 bits) of 16-bit data
3
C32, T32, SL1

Outline Shifts one hexadecimal digit (4 bits) of the specified 16-bit data to the
left.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F106 (BSL)
DT 0
R0
10 F106 BSL, DT 0

D 16-bit area to be shifted to the left

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Shifts one hexadecimal digit (4 bits) in data register DT0 to the left when execution condition (trigger) R0 turns
on.The data in hexadecimal digit position 4 (bit positions 12 to 15) is shifted out and transferred to the lower
digit position (bit positions 0 to 3) of special data register DT9014.
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
DT0
Hexadecimal 8 1 0 0 (H8100)

R0: on
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
Binary 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
DT0
Hexadecimal 1 0 0 0 (H1000)

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


Binary 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
DT9014
Hexadecimal 0 0 0 8 (H8)

3 - 201
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Shifts one hexadecimal digit (4 bits) of the 16-bit area specified by D to the left (to the higher digit position).
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
D Hexadecimal Digit 4 Digit 3 Digit 2 Digit 1

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


D Hexadecimal Digit 3 Digit 2 Digit 1 0

This hexadecimal digit


position becomes 0.
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0

DT9014 Hexadecimal 0 0 0 Digit 4

When one hexadecimal digit (4 bits) is shifted to the left,


- The data in hexadecimal digit position 4 (bit positions 12 to 15) of the 16 - bit data specified by D is
shifted out and is transferred to the lower digit (bit positions 0 to 3) of special data register DT9014.
- The hexadecimal digit position 1 (bit positions 0 to 3) of the 16-bit data specified by D becomes 0.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 202
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Right shift of one word (16 bits) FP0 C10, C14, C16,
F110 (WSHR) of 16-bit data range
5
C32, T32, SL1

Outline Shifts one word (16 bits) of a specified 16-bit data range to the right.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F110 (WSHR)
DT 0
R0
10 F110 WSHR , DT 0 , DT 2 DT 2

D1 D2

D1 Starting 16-bit area


D2 Ending 16-bit area

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D1 N/A A A A A A N/A N/A N/A N/A A
A: Available
D2 N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Shifts one word (16 bits) of the data range (3 words) from DT0 through DT2 to the right when execution
condition (trigger) R0 turns on.
Specified data range (3 words)

Data register DT2 DT1 DT0


Hexadecimal 0 2 1 2 0 0 3 0 0 2 3 2
The data in DT0 is shifted out.

Data register DT2 DT1 DT0


Hexadecimal 0 0 0 0 0 2 1 2 0 0 3 0

3 - 203
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Shifts one word (16 bits) of the data range specified by D1 (starting) and D2 (ending) to the right (to the lower
word address).
Specified data range

D2 D1

The starting word is shifted out.

D2 D1
0

The data in the ending


word becomes 0.

Starting area D1 and ending area D2 should be:


- The same type of operand.
- D1 ≦ D2.
When one word (16 bits) is shifted to the right,
- The starting word (D1) is shifted out.
- The data in the ending word (D2) becomes 0.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- D1 > D2.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- D1 > D2.

3 - 204
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Left shift of one word (16 bits) FP0 C10, C14, C16,
F111(WSHL) of 16-bit data range
5
C32, T32, SL1

Outline Shifts one word (16 bits) of a specified 16-bit data range to the left.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F111 (WSHL)
DT 0
R0
10 F111 WSHL , DT 0 , DT 2 DT 2

D1 D2

D1 Starting 16-bit area


D2 Ending 16-bit area

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D1 N/A A A A A A N/A N/A N/A N/A A
A: Available
D2 N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Shifts one word (16 bits) of the data range (3 words) from DT0 through DT2 to the left when execution
condition (trigger) R0 turns on.
Specified data range (3 words)

Data register DT2 DT1 DT0


Hexadecimal 0 2 1 2 0 0 3 0 0 2 3 2
The data in
DT2 is shifted out.

Data register DT2 DT1 DT0


Hexadecimal 0 0 3 0 0 2 3 2 0 0 0 0

3 - 205
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Shifts one word (16 bits) of the data range specified by D1 (starting) and D2 (ending) to the left (to the higher
word address).
Specified data range

D2 D1

The ending
word is shifted out.

D2 D1
0

The data in the starting


word becomes 0.

Starting area D1 and ending area D2 should be:


- The same type of operand.
- D1 ≦ D2.
When one word (16 bits) is shifted to the left,
- The ending word (D2) is shifted out.
- The data in the starting word (D1) becomes 0.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- D1 > D2.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- D1 > D2.

3 - 206
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Right shift of one hexadecimal FP0 C10, C14, C16,
F112 (WBSR) digit (4 bits) of 16-bit data range
5
C32, T32, SL1

Outline Shifts one hexadecimal digit (4 bits) of a specified 16-bit data range to
the right.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F112 (WBSR)
DT 0
R0
10 F112 WBSR , DT 0 , DT 9 DT 9

D1 D2

D1 Starting 16-bit area


D2 Ending 16-bit area

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D1 N/A A A A A A N/A N/A N/A N/A A
A: Available
D2 N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Shifts one hexadecimal digit (4 bits) of the data range (10 words) from DT0 through DT9 to the right when
execution condition (trigger) R0 turns on.

Specified data range (10 words = 40 digits)


DT9 DT0
15 · ·1211 · · 8 7 · · 4 3 · · 0 15 · · · · 0 15 · ·1211 · · 8 7 · · 4 3 · · 0
0 2 1 2 0 0 2 3 2

R0: on The data “2” in the lower


hexadecimal digit (bit positions 0
to 3) is shifted out.
DT9 DT0
15 · ·1211 · · 8 7 · · 4 3 · · 0 15 · · · · 0 15 · ·1211 · · 8 7 · · 4 3 · · 0
0 0 2 1 2 0 0 2 3

The higher hexdecimal digit


(bit position 12 to 15) becomes 0.

3 - 207
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Shifts one hexadecimal digit (4 bits) of the data range specified by D1 (starting) and D2 (ending) to the right (to
the lower digit position).
Specified data range

D2 D1
15· ·1211 · · 8 7 · · 4 3 · · 0 15· · · · 0 15· ·1211 · · 8 7 · · 4 3 · · 0

The data in the lower hexadecimal digit (bit


D2 D1 position 0 to 3) is shifted out.
15· ·1211 · · 8 7 · · 4 3 · · 0 15· · · · 0 15· ·1211 · · 8 7 · · 4 3 · · 0
0

The higher hexadecimal digit


(bit position 12 to 15) becomes 0.

Starting area D1 and ending area D2 should be:


- The same type of operand.
- D1 ≦ D2.
When the hexadecimal digit (4 bits) is shifted to the right,
- The data at the lower hexadecimal digit (bit positions 0 to 3) of the 16-bit data specified by D1 is
shifted out.
- The data at the higher hexadecimal digit (bit positions 12 to 15) in the 16-bit data specified by D2
becomes 0.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- D1 > D2.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- D1 > D2.

3 - 208
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Left shift of one hexadecimal FP0 C10, C14, C16,
F113 (WBSL) digit (4 bits) of 16-bit data range
5
C32, T32, SL1

Outline Shifts one hexadecimal digit (4 bits) of a specified 16-bit data range to
the left.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F113 (WBSL)
DT 0
R0
10 F113 WBSL , DT 0 , DT 9 DT 9

D1 D2

D1 Starting 16-bit area


D2 Ending 16-bit area

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D1 N/A A A A A A N/A N/A N/A N/A A
A: Available
D2 N/A A A A A A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Shifts one hexadecimal digit (4 bits) of the data range (10 words) from DT0 through DT9 to the left when
execution condition (trigger) R0 turns on.
Specified data range (10 words = 40 digits)
DT9 DT0
15 · ·1211 · · 8 7 · · 4 3 · · 0 15 · · · · 0 15 · ·1211 · · 8 7 · · 4 3 · · 0
0 2 1 2 1 0 2 3 2

R0: on
The data “0” in the
higher hexadecimal
digit (bit positions 12
DT9 DT0
to 15) is shifted out. 15 · ·1211 · · 8 7 · · 4 3 · · 0 15 · · · · 0 15 · 1211 · · 8 7 · · 4 3 · · 0
2 1 2 1 0 2 3 2 0

The lower hexadecimal digit


(bit position 0 to 3) becomes 0.

3 - 209
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Shifts one hexadecimal digit (4 bits) of the data range specified by D1 (starting) and D2 (ending) to the left (to
the higher digit position).

Specified data range

D2 D1
15· ·1211 · · 8 7 · · 4 3 · · 0 15· · · · 0 15· ·1211 · · 8 7 · · 4 3 · · 0

The data in the higher


hexadecimal digit (bit D2 D1
15· ·1211 · · 8 7 · · 4 3 · · 0 15· · · · 0 15· ·1211 · · 8 7 · · 4 3 · · 0
position 12 to 15) is 0
shifted out.

The lower hexadecimal digit


(bit positions 0 to 3) becomes 0.

Starting area D1 and ending area D2 should be:


- The same type of operand.
- D1 ≦ D2.
When the hexadecimal digit (4 bits) is shifted to the left,
- The data at the higher hexadecimal digit (bit positions 12 to 15) of the 16-bit data specified by D2 is
shifted out.
- The data at the lower hexadecimal digit (bit positions 0 to 3) in the 16-bit data specified by D1
becomes 0.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- D1 > D2.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- D1 > D2.

3 - 210
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F118 (UDC) UP/DOWN counter 5
C32, T32, SL1

Outline Sets the UP/DOWN counter. 17

Program example
Boolean
Ladder Diagram
Address Instruction

50 ST R 0
R0 UP/DOWN input F118 UDC
50 51 ST R 1

R1 Count input DT 10 52 ST R 2
S
51 53 F118 (UDC)
R2 Reset input DT 0 DT 10
D
52
DT 0
R900B R50
58 58 ST R 900B
59 OT R 50

S 16-bit equivalent constant or 16-bit area for counter preset


value
D 16-bit area for counter elapsed value

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D1 A A A A A A N/A N/A A A N/A
A: Available
D2 N/A A A A A A N/A N/A N/A N/A N/A N/A: Not Available

Explanation of example
The program shows an example in which initial values are set, and when the target value is 0, R50 goes on.
This can be used, for example, in programs such as those that cause a display lamp to light when the work
being added or subtracted has reached a certain quantity.
When the trailing edge of rest input R2 is detected (on → off), data in data register DT10 is transferred to DT0.
One is subtracted from value of DT0 when the count input R1 turns on while R0 is in the off state. (DOWN
counter operation)
One is added to DT0 when the count input R1 turns off while the R0 is in the on state. (Up counter operation)
If DT0 = K0, special internal relay R900B (= flag) turns on and then internal relay R50 turns on.

3 - 211
High - level Instructions FP0

3.3 Explanation of High - level Instructions

on
R2 off

on
R0 off

on
R1 off

on
R50 off

Value
of DT0

Time
Preset
Reset

Description
The counter is switched between an incremental count (addition) or decremental count (subtraction) by
turning the relay specified for up/down input on or off.
When the up/down input is on, the incremental counter (+1) is effective, and when it is off, the decremental
counter ( - 1) is effective. The elapsed value is stored in the area specified by the D.
The preset value in S is transferred to D when the trailing edge of the reset input is detected (on → off). Set
value range K-32768 to K32767 (H8000 to H7FFF)
When the count input is switched from off to on (the reset input is in “Off” state), the value specified for the D is
initialized, and the counting operation begins.
The elapsed value area of D is cleared when the reset input turns on.
The results of the counting operation can be determined by comparing the elapsed value of D with the
specified value, using the data comparison instruction.
The data comparison instruction should be executed immediately following execution of this instruction.
Flag conditions
S = flag (R900B): Turns on for an instant when the elapsed value area D is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when the elapsed value area D value is “K - 32768 to
K - 1”.
Precautions during programming
If the elapsed value area has been specified as a hold type memory area, the elapsed value acts in
accordance with the contents being retained.
Be aware that, when an operation is begun, the set values are not automatically preset to the elapsed value
area. To preset these values, the reset input must be switched from the “on” to the “off” state.
When combining the F118 (UDC) instruction with an AND stack instruction or POP stack instruction, be
careful that the programming is correct.
For detailed information section 4.6

3 - 212
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Cautions on count input detection


In a F118 (UDC) instruction, the increment or decrement takes place when the rise of the count input
from off to on is detected.
If the count input remains continuously on, since counting will only take place at the rise, no further counting
will take place.
In cases where the count input is initially on such as when the mode is changed to RUN or the power is turned
on with the mode set to RUN, increment or decrement operation will not take place at the first scan.
RUN
(Power: on)

Count intput

Operation of
instruction
No count done Count done

When you use the F118 (UDC) instruction with one of the following instructions that changes the order of the
execution of instructions, be aware that the operation of the instructions will differ depending on the timing of
their execution and their count input.
- MC to MCE instructions
- JP to LBL instructions
- LOOP to LBL instructions
- CNDE instruction
- Step ladder instructions
- Subroutine instruction
For detailed information section 4.5

3 - 213
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F119 (LRSR) Left/right shift register 5
C32, T32, SL1

Outline Shifts one bit of the 16-bit data range to the left or right. 18

Program example
Boolean
Ladder Diagram
Address Instruction

Left/right input 50 ST R 0
R0 (on: left, off: right) F119 LRSR 51 ST R 1
50
DT 0 52 ST R 2
R1 Data input D1
51 53 ST R 3

R2 DT 9 54 F119 (LRSR)
Shift input D2
52 DT 0
R3 DT 9
Reset input
53

D1 Starting 16-bit area whose one bit is shifted to the left or to the
right
D2 Ending 16-bit area whose one bit is shifted to the left or to the
right

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D1 N/A A A A A A N/A N/A N/A N/A N/A
A: Available
D2 N/A A A A A A N/A N/A N/A N/A N/A N/A: Not Available

3 - 214
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Explanation of example
Left shift operation
DT9 DT0
Bit position 15 . . 12 11 . . 8 7 . . 4 3 . . 0 15 . . 12 11 . . 8 7 . . 4 3 . . 0
Data 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0

R0: on
Shifted-out bit is transferred R2: off → on
to R9009 (carry flag).

Bit position 15 . . 1211 . . 8 7 . . 4 3 . . 0 15 . . 12 11 . . 8 7 . . 4 3 . . 0


Data 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0
DT9 DT0
When data input R1 turns on, “1” is shifted into bit position 0.
When data input R1 turns off, “0” is shifted into bit position 0.
Right shift operation
DT9 DT0
Bit position 15 . .12 11 . . 8 7 . . 4 3 . . 0 15 . .12 11 . . 8 7 . . 4 3 . . 0
Data 0001 0001 0001 0001 1000 1000 1000 1100

R0: off
R2: off → on

Bit position 15 . . 12 11 . . 8 7 . . 4 3 . . 0 15 . .12 11 . . 8 7 . . 4 3 . . 0


Data 1000 1000 1000 1000 0100 0100 0100 0110
DT9 DT0
When data input R1 turns on, “1” is shifted Shifted-out bit is
into bit position 15. transferred to
When data input R1 turns off, “0” is shifted R9009 (carry flag).
into bit position 15.

Description
This shift register changes direction, either left (direction of MSB) or right (direction of LSB), in which a shift of
one bit is made, based on the on/off status of the relay specified by the left/right shift input.
The shift operation is made to the left when the left/right shift input is on, and to the right when off.
Specify D1 and D2 so they are in the same type data area and be sure to set the data area addresses so that
D1 ≦ D2.
When the shift input changes from off to on (the reset input is off), the contents of the area specified by D1 and
D2 are shifted one bit to the left or right.
When the data is shifted, 1 will be set in the empty bit left by the shift (the uppermost or lowermost bit) if the
data input is on, and 0 if the data input is off. Also, the bit extracted by the shift (the uppermost bit for a shift to
the left, and the lowermost bit for a shift to the right) will be set in the special internal relay R9009 (carry flag).
If the reset input is on, the contents of the specified area are cleared to 0.

3 - 215
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the starting 16-bit area
(D1) is larger than the area specified by the ending 16-bit area (D2) (when D1
> D2).
S Error flag (R9008): Turns on for an instant when the area specified using the starting 16-bit area
(D1) is larger than the area specified by the ending 16-bit area (D2) (when D1
> D2).
S Carry flag (R9009): Turns on for an instant when the bit shifted-out is “1”.

Precautions on shift input detection


In a F119 (LRSR) instruction, shift takes place when the off - on rise of the shift input is detected.
If the shift input remains continuously on, a shift will only take place at the rise. No further shifts will take place.
In cases where the shift input is initially on such as when the mode is changed to RUN or when the power is
turned on with the mode set to RUN, a shift will not take place at the first scan.
RUN
(Power: on)

Shift input

Operation of
instruction
No shift made Shift made

When you use the F119 (LRSR) instruction with one of the following instructions that changes the order of the
execution of instructions, be aware that the operation of the instructions will differ depending on the timing of
their execution and their shift input.
- MC to MCE instructions
- JP to LBL instructions
- LOOP to LBL instructions
- CNDE instruction
- Step ladder instructions
- Subroutine instruction
For detailed information section 4.5

Precautions during programming


When combining the F119 (LRSR) instruction with an AND stack instruction or POP stack instruction, be
careful that the programming is correct.
For detailed information section 4.6

3 - 216
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F120 (ROR) 16-bit data right rotate 5
C32, T32, SL1

Outline Rotates a specified number of bits in specified 16-bit data to the right.

Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F120 (ROR)

R0 DT 0
10 F120 ROR , DT 0 , K 4 K 4

D n

D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify number of bits to be rotated

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D N/A A A A A A A A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Explanation of example
Rotates 4 bits in data register DT0 to the right when execution condition (trigger) R0 turns on.
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0

R0: on

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1

Special internal relay


R9009 (carry flag)
0
Data in bit position 3

3 - 217
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Rotates n bits of the 16-bit data specified by D to the right.
Example: Rotates 1 bit to the right
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


D 1 0 1 0 1 0 1 0 1 0 1 0 1 0 10

Data in bit position 0


Special internal relay
1
R9009 (carry flag)

When n bits are rotated to the right,


- The data in bit position n-1 (n th bit starting from bit position 0) is transferred to special internal relay
R9009 (carry flag).
- n bits starting from bit position 0 are shifted out to the right and then shifted into the higher bit positions
of the 16-bit data specified by D.
For n, only the lower 8 bits in the 16 bits data are valid.
15 0
n ———— ———— 0 0 0 00 0 0 0

Upper 8 bits Range of n: K0 to K255 (H00 to HFF)


are invalid

Precaution during programming


If the specified n is a multiple of 16 bits, the data will be the same as that before the operation.
e.g.,
n = K16: same operation as n = K0 (The carry flag does not change, either.)
n = K17: same operation as n = K1
 
n = K32: same operation as n = K0 (The carry flag does not change, either.)
n = K33: same operation as n = K1

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S Carry flag (R9009): Turns on for an instant when the data in bit position n-1 is recognized as 1.

3 - 218
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F121(ROL) 16-bit data left rotate 5
C32, T32, SL1

Outline Rotates a specified number of bits in specified 16-bit data to the left.

Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F121 (ROL)
R0 DT 0
10 F121 ROL , DT 0 , K 4 K 4

D n

D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify number of bits to be rotated

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D N/A A A A A A A A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Explanation of example
Rotates 4 bits in data register DT0 to the left when execution condition (trigger) R0 turns on.

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0

R0: on

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 0 0 1 0 0 0 1 1 0 1 0 0 0 0 0 1

Special internal relay


R9009 (carry flag) 1 Data in bit position 12

3 - 219
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Rotates n bits of the 16-bit data specified by D to the left.
Example: Rotates 1 bit to the left
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
D 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

Special internal relay Data in bit position 15


R9009 (carry flag) 0

When n bits are rotated to the left,


- The data in bit position 16-n (n th bit starting from bit position 15) is transferred to special internal relay
R9009 (carry flag).
- n bits starting from bit position 15 are shifted out to the left and then shifted into the lower bit positions
of the 16-bit data specified by D.
For n, only the lower 8 bits in the 16 bits data are valid.
15 0
n ———— ———— 0 0 0 00 0 0 0

Upper 8 bits Range of n: K0 to K255 (H00 to HFF)


are invalid

Precaution during programming


If the specified n is a multiple of 16 bits, the data will be the same as that before the operation.
e.g.,
n = K16: same operation as n = K0 (The carry flag does not change, either.)
n = K17: same operation as n = K1
 
n = K32: same operation as n = K0 (The carry flag does not change, either.)
n = K33: same operation as n = K1

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S Carry flag (R9009): Turns on for an instant when the data in bit position 16-n is recognized as 1.

3 - 220
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
16-bit data right rotate with carry FP0 C10, C14, C16,
F122 (RCR) flag data
5
C32, T32, SL1

Outline Rotates a specified number of bits in the specified 16-bit data to the right
together with carry flag data.

Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F122 (RCR)
R0 DT 0
10 F122 RCR , DT 0 , K 4 K 4

D n

D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify number of bits to be rotated

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D N/A A A A A A A A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Explanation of example
Rotates 4 bits in data register DT0 together with carry flag data “1” to the right when execution condition
(trigger) R0 turns on.
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
R0: on
n-1: 3 bits
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 1 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1

Carry flag data “1”

Special internal relay


R9009 (carry flag) 0
Data in bit position 3

3 - 221
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Rotates n bits of the 16-bit data specified by D, including carry flag data, to the right.
Example: Rotates 1 bit to the right
Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0
D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0


D 0 0 1 0 1 0 1 0 1 0 1 0 1 0 10

Carry flag data “0”

Special internal relay


R9009 (carry flag)
1

When n bits with carry flag data are rotated to the right,
- The data in bit position n-1 (n th bit starting from bit position 0) is transferred to special internal relay
R9009 (carry flag).
- n bits starting from bit position 0 are shifted out to the right and then carry flag data and the n-1 bits
starting from bit position 0 are shifted into the higher bit positions of the 16-bit data specified by D.
For n, only the lower 8 bits in the 16 bits data are valid.
15 0

n ———— ———— 0 0 0 00 0 0 0

Upper 8 bits Range of n: K0 to K255 (H00 to HFF)


are invalid

Precaution during programming


If the specified n is a multiple of 17 bits, the data will be the same as that before the operation.
e.g.,
n = K17: same operation as n = K0
n = K18: same operation as n = K1
 
n = K34: same operation as n = K0
n = K35: same operation as n = K1

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S Carry flag (R9009): Turns on for an instant when the data in bit position n-1 is recognized as 1.

3 - 222
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
16-bit data left rotate with carry FP0 C10, C14, C16,
F123 (RCL) flag data
5
C32, T32, SL1

Outline Rotates a specified number of bits in the specified 16-bit data to the left
together with carry flag data.

Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F123 (RCL)
R0 DT 0
10 F123 RCL , DT 0 , K 4 K 4

D n

D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify number of bits to be rotated

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D N/A A A A A A A A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Explanation of example
Rotates 4 bits in data register DT0 together with carry flag data “1” to the left when execution condition
(trigger) R0 turns on.
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0

R0: on

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
DT0 0 0 1 0 0 0 1 1 0 1 0 0 1 0 0 0

Carry flag data “1”


Special internal relay
R9009 (carry flag) 1
Data in bit position 12

3 - 223
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Rotates n bits of the 16-bit data specified by D, including carry flag data, to the left.
Example: Rotates 1 bit to the left
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
D 1 0 1 0 1 0 1 0 1 0 1 0 1 0 10

Carry flag data “0”


Special internal relay
R9009 (carry flag) 0

When n bits with carry flag data are rotated to the left,
- The data in bit position 16-n (n th bit starting from bit position 15) is transferred to special internal relay
R9009 (carry flag).
- n bits starting from bit position 15 are shifted out to the left and then carry flag data and the n-1 bits
starting from bit position 15 are shifted into the lower bit positions of the 16-bit data specified by D.
For n, only the lower 8 bits in the 16 bits data are valid.
15 0
n ———— ———— 0 0 0 00 0 0 0

Upper 8 bits Range of n: K0 to K255 (H00 to HFF)


are invalid

Precaution during programming


If the specified n is a multiple of 17 bits, the data will be the same as that before the operation.
e.g.,
n = K17: same operation as n = K0
n = K18: same operation as n = K1
 
n = K34: same operation as n = K0
n = K35: same operation as n = K1

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S Carry flag (R9009): Turns on for an instant when the data in bit position 16-n is recognized as 1.

3 - 224
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F130 (BTS) 16-bit data bit set 5
C32, T32, SL1

Outline Turns on a specified bit of 16-bit data.

Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F130 (BTS)
R0 DT 0
10 F130 BTS , DT 0 , DT 2 DT 2

D n

D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify bit position

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D N/A A A A A A A A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Explanation of example
Turns on bit position specified by DT2 in data register DT0 when execution condition (trigger) R0 turns on.
When the DT2 = K7, as shown below.
[n] DT2: K7
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1

R0: on

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 1

Bit position 7 is turned on (1) when R0 turns on.


(Bits other than the specified bit do not change.)

3 - 225
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Turns on the bit of 16-bit data specified by D and n.
Bits other than the specified bit do not change.
n is decimal data specifying the bit position to be turned on. Range of n: K0 to K15
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
n ———— ———— ————

The data in bit


positions 4 through 15 Range of n: K0 to K15 (H0 to HF)
are invalid.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 226
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F131(BTR) 16-bit data bit reset 5
C32, T32, SL1

Outline Turns off a specified bit of 16-bit data.

Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F131 (BTR)
R0 DT 0
10 F131 BTR , DT 0 , DT 2 DT 2

D n

D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify bit position

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D N/A A A A A A A A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Explanation of example
Turns off the bit specified by DT2 of data register DT0 when execution condition (trigger) R0 turns on.
When the DT2 = K7, as shown below.
[n] DT2: K7
Bit position 15
· · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT0 1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 0

R0: on

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT0 1 1 0· 1 1 1 0 0 0 0 1 1 1 0 1 0

Bit position 7 is turned off (0) when R0 turns on.


(Bits other than the specified bit do not change.)

3 - 227
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Turns off the bit of 16-bit data specified by D and n.
Bits other than the specified bit do not change.
n is decimal data specifying the bit position to be turned off. Range of n: K0 to K15
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
n ———— ———— ————

The data in bit


positions 4 through 15 Range of n: K0 to K15 (H0 to HF)
are invalid.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 228
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F132 (BTI) 16-bit data bit invert 5
C32, T32, SL1

Outline Inverts a specified bit in 16-bit data.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F132 (BTI)

R0 DT 0

10 F132 BTI , DT 0 , DT 10 DT 10

D n

D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify bit position

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D N/A A A A A A A A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Explanation of example
Inverts the state of bit specified by DT10 in data register DT0 when execution condition (trigger) R0 turns on.
When the DT10 = K7, as shown below.
[n] DT10: K7

Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0

R0: on
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 0

Condition of bit position 7 is inverted [off (0) → on (1)] when R0 turns on.
(Bits other than the specified bit are not changed.)

3 - 229
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Inverts [off (0) → on (1) or on (1) → off (1)] the state at bit position specified by n in the 16-bit area specified by
D.
Bits other than the specified bit are not inverted.
The n is decimal data specifying the bit position to be inverted. Range of n: K0 to K15
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
n ———— ———— ———— 0 0 0 0

The data in bit


positions 4 through 15 Range of n: K0 to K15 (H0 to HF)
are invalid.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 230
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F133 (BTT) 16-bit data bit test 5 FP0 C10, C14, C16,
C32, T32, SL1

Outline Checks the state [on (1) or off (0)] of the specified bit in 16-bit data.
Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 F133 (BTT)
D n
DT 0
R0
10 F133 BTT , DT 0 , DT 2 DT 2
16 ST R 0
R0 R900B R10
16 17 AN R 900B
18 OT R 10

D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify bit position

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D N/A A A A A A A A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Explanation of example
Checks the state [on (1) or off (0)] of bit specified by DT2 in data register DT0 when execution condition
(trigger) R0 turns on. If bit specified by DT2 is in the off (0) state, internal relay R10 goes on.
When the DT2 = K7, as shown below.
[n] DT2:K7
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
[D] DT0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1

The state of bit position 7 is checked.


If bit position 7 is in the off state (0), R900B turns on and internal relay R10 goes on.

3 - 231
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Checks the state [on (1) or off (0)] of bit position specified by n in the 16-bit data specified by D. The judgment
result is output to special internal relay R900B (=flag).
The specified bit is checked by special internal relay R900B.
- When the specified bit is on (1), special internal relay R900B (= flag) turns off.
- When the specified bit is off (0), special internal relay R900B (= flag) turns on.
n is decimal data specifying the bit position to be checked. Range of n: K0 to K15
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
n ———— ———— ———— 0 0 0 0

The data in bit positions


4 through 15 are invalid.
Range of n: K0 to K15 (H0 to HF)

Precaution when the judgement flag R900B is used two or more times
The judgment flag R900B is updated each time an operation instruction or comparison instruction is
executed.
If the judgment flag is used two or more times,
- the program in which the judgment flag is used should be input immediately following the instruction
which executes the judgment.
- the flag should be output to output relays or internal relays for each separate instruction.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the specified bit to be checked is in the off (0)
state.

3 - 232
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F135 (BCU) Number of on bits in 16-bit data 5 FP0 C10, C14, C16,
C32, T32, SL1

Outline Counts the number of bits in the on (1) state in the specified 16-bit data.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F135 (BCU)
R0 DT 10
10 F135 BCU , DT10 , DT 20
DT 20
S D

S 16-bit equivalent constant or 16-bit area (source)


D 16-bit area (destination) for storing the number of bits in the on (1) state

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A
A: Available
D N/A A A A A A A A N/A N/A A N/A: Not Available

Explanation of example
Counts the number of bits in the on (1) state in data register DT10 when execution condition (trigger) R0 turns
on. The number of on (1) bits is stored in data register DT20.
DT10
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0
Binary data 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 1

The number of on (1) bits is “5”.

The K5 is stored in data register DT20 when R0 turns on.

Description
Counts the number of bits in the on (1) state in the 16-bit data specified by S. The counted result (number of on
(1) bits) is stored in the 16-bit area specified by D.
The results are stored in decimal number.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 233
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F136 (DBCU) Number of on bits in 32-bit data 7 FP0 C10, C14, C16,
C32, T32, SL1

Outline Counts the number of bits in the on (1) state in specified 32-bit data.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F136 (DBCU)
R0 DT 10
10 F136 DBCU , DT10 , DT20
DT 20
S D

S 32-bit equivalent constant or lower 16-bit area of 32-bit data (source)


D 16-bit area (destination) for storing the number of bits in the on (1) state

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Explanation of example
Counts the number of bits in the on (1) state in data register DT11 and DT10 when execution condition
(trigger) R0 turns on. The number of on (1) bits is stored in data register DT20.
DT11 DT10
Bit position 15 · · 12 11 · · 8 7 · · 4 3 · · 0 15 · · 12 11 · · 8 7 · · 4 3 · · 0
Binary data 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0

The number of on (1) bits is “9”.

The K9 is stored in data register DT20 when R0 turns on.

Description
Counts the number of bits in the on (1) state in the 32-bit data specified by S. The counted result (number of on
(1) bits) is stored in the 16-bit area specified by D.
The results are stored in decimal number.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 234
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F137(STMR) 16-bit auxilialy timer 5 FP0 C10, C14, C16,


C32, T32, SL1

Outline Sets the 16 - bit on - delay timer for 0.01 s units (0.01 to 327.67 s)
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F137 (STMR)
R0 R5 DT 10
10 F137 STMR , DT10 , DT20
DT 20

S D 16 OT R 5

S 16-bit equivalent constant or 16-bit area for timer set value


D 16-bit area for timer elapsed value

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A N/A
A: Available
D N/A A A A A A N/A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the execution condition (trigger) has been fulfilled, the auxiliary timer is activated, and when the value
stored in DT10 x 0.01 seconds has elapsed, R5 goes on.
Description
This functions as a 0.01 - second unit on delay timer. When the execution condition (trigger) is on, subtraction
is carried out for the specified time, and when the elapsed value D reaches 0, relays which are being used are
turned on by the OT instruction which follows in the program.
When the execution condition (trigger) is off, the elapsed value area is cleared to 0, and relays being used are
turned off by the OT instruction.
When the time set for the special internal relay R900D has elapsed, the relay is turned on.
R900D can also be used as a timer contact. (The relay is off when the execution condition (trigger) is off, and
while subtraction is being carried out.)
R0
F137 STMR, DT10,DT20

R900D R5

Operation is the same as that in the program example.

3 - 235
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Timer set time


The timer setting is entered as a value of 0.01 x (timer set value).
The timer set value is specified as a K constant within the range of K1 to K32767.
The timer set time is set between 0.01 and 327.67 seconds, in units of 0.01 second.
If the set value is K500, the set time will be 0.01 x 500 = 5 seconds.
Precautions during programming
The area in which the set value is stored must be set so that the area specified for the elapsed value does not
overlap any areas reserved for other timer or counter instructions, or memory areas used for high - level
instruction operations.
Because subtraction is carried out when operations are carried out, the program should be set up so that
operations are carried out every scan.
(In cases such as programs where interrupt operation is carried out, or for jump or loop instructions, where
several operations are carried out during one scan, or where it was not possible to carry out any operation
during the scan, correct results cannot be obtained.)
Consecutive OT instructions may be used in the program.
How the auxiliary timer works
1 When the execution condition (trigger) changes from off to on, the set value specified by the S is sent
to the elapsed value area D.
R0 R5 DT10
F137 STMR, DT10, DT20 K500 S

1 Sent to D.
R900D
F0 MV, DT30, DT40 DT20
K500

2 If the execution condition (trigger) stays on, every scan, the value in the elapsed value area D is
subtracted.
R0 R5 DT20
F137 STMR, DT10, DT20
K500
2 Subtraction

R900D 499
F0 MV, DT30, DT40 498
497

3 If the value in the elapsed value area D reaches 0, relay being used is turned on by the OT instruction
which comes next in the program. The special internal relay R900D also goes on at this point.
R0 R5 DT20
F137 STMR, DT10, DT20
0

R900D
F0 MV, DT30, DT40

3 Subtraction completed

3 - 236
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Precautions when using R900D


If R900D is used and multiple auxiliary timers are being used, always use R900D in the line following the
auxiliary timer instruction.
R0
F137 STMR, DT10, DT20
Pair
R900D Y0

R1
F137 STMR, DT30, DT40
Pair
R900D Y1

When timer (a), which is activated by R0 turns on, expires, Y0 goes on. When timer (b), which is activated by
R1 turns on, expires, Y1 goes on.

Describe the program as shown below will result in incorrect operation.


R0
F137 STMR, DT10, DT20
R1
F137 STMR, DT30, DT40

R900D Y0

R900D Y1

3 - 237
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F140 (STC) Carry flag (R9009) set 1 FP0 C10, C14, C16,
C32, T32, SL1

Outline Turns on special internal relay R9009 (carry flag).


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F140 (STC)

R0
10 F140 STC

Description
Special internal relay R9009 (carry flag) goes on.

Flag condition
Carry flag (R9009): Turns on when this instruction is executed.

3 - 238
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F141(CLC) Carry flag (R9009) reset 1 FP0 C10, C14, C16,


C32, T32, SL1

Outline Turns off special internal relay R9009 (carry flag).


Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger 11 F141 (CLC)

R0
10 F141 CLC

Description
Special internal relay R9009 (carry flag) goes off.

Flag condition
Carry flag (R9009): Turns off when this instruction is executed.

3 - 239
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F143 (IORF) Partial I/O update 1


FP0 C10, C14, C16,
C32, T32, SL1

Outline Updates specified partial I/O points.


Program example
Boolean
Ladder Diagram
Address Instruction
Input update 10 ST R 10
Trigger
11 F143 (IORF)
D1 D2
R10 WX 0
10 F143 IORF , WX 0 , WX 0 WX 0

Output update 20 ST R 20
R20 21 F143 (IORF)
20 F143 IORF , WY 0 , WY 0
WY 0

D1 D2 WY 0

D1 Starting word address


D2 Ending word address

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
D1 A A N/A N/A N/A N/A N/A N/A N/A N/A A
A: Available
D2 A A N/A N/A N/A N/A N/A N/A N/A N/A A N/A: Not Available

Explanation of example
Updates external input relays WX0 (X0 to XF) immediately when execution condition (trigger) R10 turns on
and updates external output relays WY0 (Y0 to YF) immediately when execution condition (trigger) R20 turns
on.
Description
Updates the inputs and outputs specified by D1 and D2 immediately even in the program execution stage.
With the FP0, refreshing initiated by the F143 (IORF) instruction is done only for the control unit.
With input refreshing, WX0 should be specified for [D1] and [D2].
With output refreshing, WY0 should be specified for [D1] and [D2].
I/O refreshing is not possible with expansion units.

3 - 240
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
5 FP0 T32C/FP0 C10,
Serial data communication C14, C16, C32 CPU
F144 (TRNS) control for RS232C port Ver. 1.2 or later

Outline Communicates with an external device using the RS232C port.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 DF
R0
10 DF 12 F144 (TRNS)
1
DT 100
K 8
1 F144 TRNS, DT 100, K 8

S n
S Starting 16-bit area for storing data to be sent
n 16-bit equivalent constant or 16-bit area to specify number of bytes to be sent
- When the value is positive, an end code is added.
- When the value is negative, an end code is not added.
- When the value is H8000, the transmission mode of the RS232C port is
changed.

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S N/A N/A N/A N/A N/A A N/A N/A N/A N/A A
A: Available
n A A A A A A A A A A A N/A: Not Available

Description
Use this instruction for transmission and reception of command data when an external device (personal
computer, measuring instrument, bar code reader, etc.) is connected to the RS232C port.
Transmission page 3 - 243
The n bytes of the data stored in the data table with the starting area specified by S are transmitted from the
RS232C port to an external device by serial transmission.
A start code and end code can be automatically added before transmission.
There is no restriction on the number of bytes that can be transmitted. Transmission is possible within the
usage range of the data register.

Reception page 3 - 245


Reception is controlled by the reception completed flag (R9038) being turned on and off.
When reception completed flag (R9038) is off, the data sent to the RS232C port is stored in the reception
buffer selected in system registers 417 and 418. When an F144 (TRNS) instruction is executed, reception
completed flag (R9038) goes off.
For an overview of serial communications section 6.1

3 - 241
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Setting the use of the RS232C port


To switch between “computer link communication” and “serial data communication” (general purpose port),
execute an F144 (TRNS) instruction. (Example: This can be used to establish a computer link after complex
modem settings have been entered. Also, it is normally used with a computer link, but in an emergency it can
also be used for transmissions from the PLC to a higher - level computer.) Set n (the number of transmission
bytes) to H8000, and then execute the instruction.
When executed when “computer link” is selected, the setting will change to “general purpose port.”
R0 R9032
DF 1

1 F144 TRNS, DT100, H8000

In this case, the Set to H8000.


parameter is disabled
regardless of the number.
When executed when “general purpose port” is selected, the setting will change to “computer link.”
R0 R9032
DF 1

1 F144 TRNS, DT100, H8000

R9032: RS232C port selection flag


This flag turns on when “General purpose port” is selected.

Note
When the power is turned on, the port use will revert to the
setting of system register 412.

Flag conditions
S Error flag (R9007): Turns on and stays on when,
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by n exceeds the source data area range.
S Error flag (R9008): Turns on for an instant when
- The area specified using the index modifier exceeds the limit.
- The number of bytes specified by n exceeds the source data area range.

3 - 242
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Program and Operation during Transmission


To transmit, write the transmission data to the data table, select it with an F144 (TRNS) instruction, and
execute.
Data table for transmission
Data register areas beginning with the area selected by S are used as the data table for transmission.

[S] The number of bytes not yet transmitted is stored here.

[S+1] 2 1

[S+2] 4 3

Storage area for transmission data (the circled


numbers indicate the order of transmission).

[S+n] 2n 2n - 1

Write the transmission data to the transmission data storage area selected with S (from the second word on)
using an F0 (MV) or F95 (ASC) instruction.
- Do not include an end code in the transmission data as it will be added automatically.
- If the start code is set to “Yes” in system register 413, do not include a start code in the transmission
data as it will be added automatically.
- There is no restriction on the number of bytes [n] that can be transmitted. Following the initial area of
the data [S], transmission is possible up to the data range that can be used by the data register.
When the F144 (TRNS) instruction is executed, the number of data bytes not yet transmitted is stored in the
starting area of the data table.

Note
Take care that the transmission data table and reception buffer
areas (set in system registers 417 and 418) do not overlap.

Example: Transmitting the eight characters A, B, C , D, E, F, G and H (8 bytes


of data)
In this example, the data table is DT100 to DT104.

DT100 K8 The number of bytes not yet transmitted is


stored at each transmission.
DT101 H42 H41
(B) (A)

DT102 H44 H43


(D) (C) Data is transmitted
in order from the
DT103 H46 H45 lower byte.
(F) (E)

DT104 H48 H47


(H) (G)
Data table before transmission

3 - 243
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program
Select the starting address of the transmission data table with S and the number of transmission data bytes
with n.

R0
F1 DMV, H44434241, DT101 Write the transmission
F1 DMV, H48474645, DT103 data to the data table
R1
DF 1

Transmit the data in


1 F144 TRNS, DT100, K 8 the data table

Operation
If the execution condition (trigger) for the F144 (TRNS) instruction is on when sending completed flag
(R9039) goes on, operation will proceed as follows:
1) n is preset in S (the number of bytes not yet transmitted). Furthermore, reception completed flag
(R9038) is turned off and the reception data number is cleared to zero.
2) The data in the data table is transmitted in order from the lower byte in S+1.
As each byte is transmitted, the value in S (the number of bytes not yet transmitted) decrements by 1.
During transmission, the sending completed flag (R9039) goes off.
If the start code STX is set to “Yes” in system register 413, the start code will be automatically added to the
beginning of the data.
The end code selected in system register 413 is automatically added to the end of the data.
DT101 DT102 DT103 DT104
Sending
data A B C D E F G H (CR)
Number of bytes not 8 7 6 5 4 3 2 1 0
yet transmitted (DT100)
on
R9039 off
Execution condition
on
(trigger) R1 off

F144 (TRNS)
execution During transmission (F144 (TRNS) instruction cannot be executed.)

3) When the specified quantity of data has been transmitted, the value in S (the number of bytes not yet
transmitted) will be zero and the sending completed flag (R9039) will go on.
Transmission without an end code
Specify the number of transmission bytes with a negative number.
For transmission and reception without an end code, set the end code to “None” in system register 413.

Example:
Program for transmitting eight bytes of data without an end
code
R0
DF 1

1 F144 TRNS, DT100, K - 8

Set to K - 8.

3 - 244
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Program and Operation during Reception


Data sent from the external device connected to the RS232C port will be stored in the data register areas set
as the reception buffer.
Reception buffer
Word Area used for
(address) 0 number of bytes
received
1 2 1

2 4 3

Area used for storing received data


(the circled numbers indicate the
order of reception)
n 2n 2n - 1

Each time data is received, the amount of data received (number of bytes) is stored as a count in the leading
address of the reception buffer. The initial value is zero.
The data received is stored in order in the reception data storage area beginning from the lower byte of the
second word of the area.

Example:
Reception of the eight characters A, B, C, D, E, F, G, and H
(eight bytes of data) from an external device
The reception buffer is DT200 to DT204 in this example.
System register settings are as follows:
- System register 417: K200
- System register 418: K4
Each time data is received,
DT200 K8 the number of bytes received
is stored.
DT201 H42 H41
(B) (A)

DT202 H44 H43


(D) (C) The reception data is
H46 H45 stored in order from the
DT203
(F) (E) lower byte.

DT204 H48 H47


(H) (G)
Reception buffer when
reception is completed

3 - 245
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program
When reception of data from an external device has been completed, the reception completed flag (R9038)
goes on and further reception of data is not allowed.
To receive more data, an F144 (TRNS) instruction must be executed to turn off the reception completed flag
(R9038) and clear the byte number to zero.
R0
F144 TRNS, DT100, K 0

S To repeat reception only, set to K0.


S R9038 will also go off when the number of transmission bytes
is set and transmission is carried out.

Operation
When the reception completed flag (9038) is off and data is sent from an external device, operation will
proceed as follows. (After RUN, R9038 is off during the first scan.)
1) The data received is stored in order in the reception data storage area of reception buffer beginning
from the lower byte of the second word of the area.
Start and end codes will not be stored.
With each one byte received, the value in the leading address of the reception buffer is incremented by 1.
Reception operation
Reopening
start
Received data A B … T (CR) U V …

Number of bytes 0 1 2 … 20 0 1 2 …
received on
R9038 off

Execution condition on
off
(trigger) R0

F144 (TRNS) Reception: Reception: Reception:


execution possible impossibility possible
2) When an end code is received, the reception completed flag (R9038) goes on. After this, no further
reception of data is allowed.
3) When an F144 (TRNS) instruction is executed, the reception completed flag (R9038) goes off and
the number of received data bytes is cleared to zero. Further data received is stored in order in the
reception data storage area beginning from the lower byte of the second word of the area.

Note
For repeated reception of data, refer to the following procedure.
1. Receive data
2. Reception completed (R9038: on, reception not allowed)
3. Process received data
4. Execute F144 (TRNS) instruction (R9038: off, reception)
5. Receive further data

3 - 246
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F147 (PR) Parallel printout 5 FP0 C10, C14, C16,


C32, T32, SL1

Outline Outputs ASCII codes to the printer.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 DF
R0
10 (DF ) F147 PR , DT 0 , WY 0 12 OR R 9033
14 F147 (PR)
R9033
12 S D DT 0
Printout flag WY 0

S Starting 16-bit area for storing 12 bytes (6 words) of ASCII codes (source)
D Word external output relay used for output of ASCII codes (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A N/A N/A N/A N/A N/A
A: Available
D N/A A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A: Not Available

Explanation of example
The ASCII codes stored in data registers DT5 to DT0 are output through word external output relay WY0
when execution condition (trigger) R0 turns on.
Source: ASCII code for 12 character A, B, C, D, E, F, G, H, I and J
Data register DT5 DT4 DT3 DT2 DT1 DT0
ASCII HEX code 0A 0D 4A 49 48 47 46 45 44 43 42 41
ASCII character LF CR J I H G F E D C B A

Control data for printer ASCII codes


R0: on
Destination
YF YE YD YC YB YA Y9 Y8 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
WY0

Y0 to Y7: for data signals of printer


(Y0 to Y7 correspond to DATA1 to DATA8 of printer.)
Y8: for strobe signal of printer
Y9 to YF: not used

3 - 247
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Outputs the ASCII codes for 12 characters stored in the 6-word area specified by S through the word external
output relay WY specified by D.
15 0
S ! WY (DATA1 to DATA8, STROBE)
S+1
S+2
S+3
S+4
S+5

If the specified output is connected to a commercial printer, the characters corresponding to the output ASCII
code are printed.
Only bit positions 0 to 8 of WY are used in the actual printout.
YF YE YD YC YB YA Y9 Y8 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
WY0

Y0 to Y7: for data signals of printer


(Y0 to Y7 correspond to DATA1 to DATA8 of printer.)
Y8: for strobe signal of printer
Y9 to YF: not used

ASCII code is output in order starting from the lower byte of the starting area.
Be sure to set the control code (LF and CR) for the printer as the final word of the data.
Three scans are required for 1 character constant output. Therefore, 37 scans are required until 12 character
constants are output. (See “Time chart” on the next page.)
Precautions during programming
Multiple F147 (PR) instructions cannot be executed at the same time. The program should be set up so that
the printout flag (R9033) is used during execution of F147 (PR) instruction to inhibit simultaneous execution.
The ASCII code conversion instruction F95 (ASC) can be used to convert character constants (M) to ASCII
codes.
Character constants (M) can be input only with programming tool software.
When this instruction is executed, of the WY area specified by D, zero <off> is set for Y_9 to Y_F.
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The ending area for storing ASCII codes exceeds the limit.
- The trigger of another F147 (PR) instruction turns on while one F147 (PR)
instruction is being executed.
S Error flag (R9008): Turns on for an instant when:
- The ending area for storing ASCII codes exceeds the limit.
- The trigger of another F147 (PR) instruction turns on while one F147 (PR)
instruction is being executed.
S Printout flag (R9033):Turns on and stays on while a F147 (PR) instruction is being executed.

3 - 248
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Connection example
Printer
FP0 - C32T (centronics interface)
Y0 DATA1
Y1 DATA2
Y2 DATA3
Y3 DATA4
Y4 DATA5
Y5 DATA6
Y6 DATA7
Y7 DATA8
Y8 STROBE
:
COM GND

Data setting
Example: ASCII code for 10 character A, B, C, D, E, F, G, H, I and J
Data register DT5 DT4 DT3 DT2 DT1 DT0
ASCII HEX code 0A 0D 4A 49 48 47 46 45 44 43 42 41
ASCII character LF CR J I H G F E D C B A

Control data for printer ASCII codes

Time chart
A B C D E CR LF
ASCII HEX code (Y0 to Y7) H41 H42 H43 H44 H45 H0D H0A
Signal of
output unit on
Strobe signal (Y8)
off

R9033 on F147 (PR) instruction execution


off

Number of scans 0 1 2 3 4 5 6 7 8 9 10 11 121314 151617 3233 34353637

3 - 249
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Using printer output during 8 - point output


When only eight output points are being used, connections should be made as shown below, and the
program should be set up so that the strobe signal is output from Y7.
Connection example

Printer
FP0 - C16T/C32T (centronics interface)
Y0 DATA1
Y1 DATA2
Y2 DATA3
Y3 DATA4
Y4 DATA5
Y5 DATA6
Y6 DATA7
Y7 DATA8
STROBE

COM GND

Program example
R0
F147 PR, DT0, WY0
R9033

Y8 Y7
Strobe signal is output from Y7.

3 - 250
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F148 (ERR) Self-diagnostic error set 3 FP0 C10, C14, C16,


C32, T32, SL1

Outline Sets the specified condition as a self-diagnostic error.

Program example
Boolean
Ladder Diagram
Address Instruction
Self - diagnostic error set 10 ST R 0
Trigger
11 F148 (ERR)
n
R0 K 100
10 F148 ERR , K 100 ⋮
20 ST R 1

Self - diagnostic error clear 21 F148 (ERR)


R1 K 0
20 F148 ERR , K 0

n
Trigger
n Self-diagnostic error code number Range: 0 and 100 to 299

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
A: Available
n N/A N/A N/A N/A N/A N/A N/A N/A A A N/A N/A: Not Available

Explanation of example
The self - diagnosis error 100 is set when the execution condition (trigger) R0 turns on. The ERROR/ALARM
LED on the controller lights, and operation stops.
(If a situation occurs in which you wish to set the self - diagnosis error 100, set up the program so that input R0
turns on.)
When the execution condition (trigger) R1 turns on, self - diagnostic errors of error codes 43 and higher are
cleared.
Description
Along with self - diagnostic error codes specified by n being stored in the special data register DT9000, the
self - diagnostic error flag (R9000) is turned on. Also, the ERROR/ALARM LED on the controller is turned on.
The specified value “n” is what determines whether operation stops or continues when the instruction is
executed.
“n” setting Operation when error
occurs
K100 to K199 Operation stops
K200 to K299 Operation continues

3 - 251
High - level Instructions FP0

3.3 Explanation of High - level Instructions

If n is set to a value between K200 and K299, if several F148 (ERR) instructions are processed at one time,
codes are received in sequential order, starting with the lowest number.
If n is set to 0 and the F148 (ERR) instruction is executed, self - diagnostic errors with error codes of 43 and
higher are cleared.
- ERROR/ALARM LED: turned off
- R9000, R9005, R9006, R9007, R9008: Off
- DT9000, DT9017, DT9018: Cleared to 0
F148 (ERR) instructions which specify the same error code can be notated in duplicate in the program.

Confirmation of self - diagnostic error


Self - diagnostic errors are checked in the normal way (see section 8.7)

Flag conditions
S Error flag (R9007): Turns on and stays on when the value of n exceeds the limit of specified
range “K0, or K100 to K299.”
S Error flag (R9008): Turns on and stays on when the value of n exceeds the limit of specified
range “K0, or K100 to K299.”

3 - 252
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

5 Step Availability

F149 (MSG) Message display 13 FP0 C10, C14, C16,


C32, T32, SL1

Outline Displays the specified character constant on the screen of the FP


programmer II.

Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F149 (MSG)
R0 M TEST PROGRAM
10 F149 MSG , M TEST PROGRAM

S Character constant for message

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H M
S N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A A N/A
A: Available
N/A: Not Available
Explanation of example
Displays the message “TEST PROGRAM” on the screen of the FP programmer II when execution condition
(trigger) R0 turns on.
Description
This instruction is used for displaying message specified by S on the screen of the FP programmer II.
The character constants (M) can be input only with programming tool software.
When the F149 (MSG) instruction is executed, the message flag (R9026) turns on and the message
specified by S is set in special data registers DT9030 to DT9035.
Once the message is set in the special data registers, the message cannot be changed even if the F149
(MSG) instruction is executed again. To clear the message in the special data registers, press
(- )
ACLR
OP
1 1 1 ENT SHIFT
SC
WRT using the FP programmer II.

3 - 253
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
F0 (MV) High - speed counter control 5
C32, T32, SL1

Outline Controls the software reset, disabling of the counter and stops pulse
outputs.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 3
11 DF
R3 12 F0 (MV)
10 DF 1 H 1111
1 F0 MV , H 1111 , DT9052 DT 9052

D High speed counter


control register
S 16-bit equivalent constant or 16-bit area to specify high-speed counter operation

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A A A A A A: Available

Description
Controls the high - speed counter according to the control code specified at “S.”
This instruction is used when performing the following operations while using the high - speed counter.
S When performing a software reset.
S When disabling the count.
S When temporarily disabling the hard reset by the external inputs X2 and X5.
S When stopping the positioning and pulse outputs.
S When clearing the controls executed with the high - speed counter instructions F166, F167, F168, F169,
and F170.
S When setting the near home input during home return operations for decelerating the speed of
movement.
When a control code is programmed once, it is saved until the next time it is programmed.

3 - 254
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

High - speed counter control flag


The control code program area DT9052/DT90052 divides 4 bits to each channel of the high - speed counter.
The control code entered in the F0 (MV) instruction is stored in special data register DT9052/DT90052.
ch3 ch2 ch1 ch0
15 12 11 8 7 4 3 0
DT9052/
DT90052:

Control code
H0 to HF entered by F0 (MV) instruction.

For more details on how to use the high - speed counter mode setting Chapter 5

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The value of S exceeds the limit of specified range.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The value of S exceeds the limit of specified range.

Specifying the control code “S”


Specify the controls in the four bits and convert it to H notation.
Control code “S” = H V V V V (binary)

Clears high- speed counter instruction Software reset


0: Continuous 0: Does not perform software reset
1: Clear (pulse output stopped during 1: Does perform software reset
pulse output control)
Counting
Hardware reset 0: Enable
0: Enabled 1: Disable
1: Disabled (near home input
effective during pulse
output control)

Example:
Perform software reset . . . . . . . . . . . . . . . . . . . . . . . H1(0001)
Count disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H2(0010)
Stop pulse output . . . . . . . . . . . . . . . . . . . . . . . . . . . . H8(1000)
Turn off pulse output and reset elapsed value . H9(1001)
Enter the control code into the area DT9052/DT90052 of the corresponding channel.

3 - 255
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Programming example

Example 1: Soft reset the high - speed counter CH0.


R0
DF F0 MV, H1, DT9052

F0 MV, H0, DT9052

Example 2: Enable the near home inputting during pulse output control and
decelerate movement.
X3
DF F0 MV, H4, DT9052

F0 MV, H0, DT9052

Precautions during programming


The hard reset disable is only effective when using reset inputs X2 and X5.
Count disable and software reset during home return operations does not allow near home processing.
The near home bit is saved, however, to cause near home processing during home return operations, it is
necessary to enter 1 to the corresponding bit each cycle.

3 - 256
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Set and read of elapsed value of FP0 C10, C14, C16,
F1 (DMV) high - speed counter
7
C32, T32, SL1

Outline Sets or reads elapsed value of the high- speed counter.

Program example
Boolean
Ladder Diagram
Address Instruction
Setting 10 ST R 0
Trigger
11 DF
12 F1 (DMV)
R0 K 3000
10 DF F1 DMV , K 3000 , DT9044
DT 9044

S Elapsed value
area of
high- speed : :
Reading counter : :
Trigger
20 ST R 10
21 DF
R10
22 F1 (DMV)
20 DF F1 DMV , DT9044 , DT 6
DT 9044

Elapsed value area of D DT 6


high- speed counter

S 32-bit equivalent constant or lower 16-bit area of 32-bit data for storing a new
elapsed value of high-speed counter to be changed (source)
D Lower 16- bit area of 32- bit area (destination)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

3 - 257
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Setting the Elapsed Value


Simultaneously writes the 32 bits data specified in “S” to the elapsed value area corresponding to the channel
of the high - speed counter used and sets the elapsed value area of the high - speed counter used inside the
system.
Explanation of example
When execution condition (trigger) R0 turns on, K3000 is written into the high - speed counter elapsed value
area DT9044 and DT9045.
Set the value of the 32 bits data written into the elapsed value so that it falls within the following range.
Allowable range: K - 8,388,608 to K8,388,607 (H FF800000 to H 007FFFFF)
The writing is only possible with the F1 (DMV) instruction. Writing with other high - level instructions, such as
the transfer instruction F0 (MV), or arithmetic operation instructions is not possible.
Specify the memory area for “S” and the memory area for “D” during reading with the memory area number of
the lower 16 bits.
For more details on how to use the high - speed counter mode setting Chapter 5

Reading the Elapsed Value


The elapsed value of the high - speed counter is read from the special data registers DT9044, DT9045 and
the area specified in the “D.”
Explanation of example
When the execution condition (trigger) R10 turns on, the elapsed value of the high - speed counter is
transferred to data registers DT6 and DT7.
When using the high - speed counter, the elapsed value is read to elapsed value area when the ED instruction
is executed during each scan regardless of this instruction.
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- The value of S exceeds the limit of specified range.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- The value of S exceeds the limit of specified range.

3 - 258
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Application examples

Example 1: Set the set value of the data register DT4 for the high - speed
counter at the input of R0.
R0
DF F1 DMV, DT4, DT9044

Down input
X0

R0

Value in DT4

Time
0
Setting set value

Example 2: Store the elapsed value of the high - speed counter into data
register DT100 at the input of R1.
R1
DF F1 DMV, DT9044, DT100

Example 3: Internal relay R0 turns on when the elapsed value of the


high - speed counter exceeds K10000.
R9010
F1 DT9044, DT0

F61 DCMP, DT0, K10000


R900A R0

Channel number and elapsed value chart


High - speed counter channel no. Elapsed value area
ch0 DT9044 to DT9045/DT90044 to DT90045
ch1 DT9048 to DT9049/DT90048 to DT90049
ch2 DT9104 to DT9105/DT90104 to DT90105
ch3 DT9108 to DT9109/DT90108 to DT90109

3 - 259
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Target value match on Step Availability
instruction (with channel FP0 C10, C14, C16,
F166(HC1S) specification)
11
C32, T32, SL1

Outline When the elapsed value of the specified channel (HSC0 to HSC3)
matches the target value, this instruction turns the specified output on.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 DF
12 F166 (HC1S)
R0
10 F166 HC1S , K 0 , K10000 , Y0 K 0
DF
K 10000
n S D Y 0

The channel No. of the high- speed counter that corresponds to the matching
n
output (n: K0 to K3).
The high- speed counter target value data or the starting address of the area
S
that contains the data.
D The output coil that is turned on when the values match (Yn n: 0 to 7)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
n N/A N/A N/A N/A N/A N/A N/A N/A A A A
S A A A A A A A N/A A A A
A: Available
D N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A: Not Available

Explanation of example

Target value Elapsed value


10000

R0
Completion (clear) of
F166 (HC1S) instruction control
R903A

Y0

Turns on when target value is matched

The special internal relay varies within the range of R903A to R903D, depending on the channel being used.
For detailed information section 5.2

3 - 260
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Sets the numerical value specified by S as the target value for the high - speed counter. When the elapsed
value matches this target value, the specified output Yn turns on (executed as an interrupt process).
The control of the target value setting and target value match output is cleared when the target value is
matched.
Set the value of the 32 - bit specified by the target value S within the range given below.
K - 8388608 to K8388607 (H FF800000 to H 007FFFFF)
The value S is stored in the target value area (refer to section 5.2) at the time of execution of the instruction.
The range that can be specified by Yn is from Y0 to Y7.
Precautions during programming
After the execution condition (trigger) for the F166 (HC1S) instruction turns on and until the target value match
output turns on, the high - speed counter control flag for the corresponding channel (refer to section 5.2) is on.
When the high - speed counter control flag for the specified channel is on, other high - speed counter
instructions (F166 to F170) for the same channel cannot be executed.
Before the elapsed value matches the target value, the target value and target value match output settings
will not be cleared, even if a hard reset is performed (the elapsed value is cleared to 0).
For the output Y specified for the target value match output, there is no check whether the output is doubled
up with that of a OT instruction, KP instruction, or other such high - level instructions.
To turn off the target value match output turned on by this instruction, either execute a reset with the RST
instruction or F0 (MV) instruction, or use it together with the F167 (HC1R) instruction.
To execute this instruction, it is necessary to set the high - speed counter mode. For detailed information
section 5.3
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- n is number except 0 to 3.
- The value of S exceeds the limit of specified range.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- n is number except 0 to 3.
- The value of S exceeds the limit of specified range.

3 - 261
High - level Instructions FP0

3.3 Explanation of High - level Instructions


Target value match off Step Availability
instruction (with channel FP0 C10, C14, C16,
F167(HC1R) specification)
11
C32, T32, SL1

Outline When the elapsed value of the specified channel (HSC0 to HSC3)
matches the target value, this instruction turns the specified output off.

Program example
Boolean
Ladder Diagram
Address Instruction

10 ST R 0
Trigger
11 DF
12 F167 (HC1R)
R0
10 DF F167 HC1R , K0 , K - 200 , Y0 K 0
K - 200
n S D Y 0

The channel No. of the high- speed counter that corresponds to the matching
n
output (n: K0 to K3).
The high- speed counter target value data or the starting address of the area
S
that contains the data.
D The output coil that is turned off when the values match (Yn n: 0 to 7)

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
n N/A N/A N/A N/A N/A N/A N/A N/A A A A
S A A A A A A A N/A A A A
A: Available
D N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A: Not Available

Explanation of example
Elapsed value
0
Target value
- 200

R0
Completion (clear) of
F167 (HC1R) instruction control
R903A

Y0

Turns off when target value is matched

The special internal relay varies within the range of R903A to R903D, depending on the channel being used.
For detailed information section 5.2

3 - 262
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description
Sets the numerical value specified by S as the target value for the high - speed counter. When the elapsed
value matches this target value, the specified output Yn turns off (executed as an interrupt process).
The control of the target value setting and target value match output is cleared when the target value is
matched.
Set the value of the 32 - bit specified by the target value S within the range given below.
K - 8388608 to K8388607 (H FF800000 to H 007FFFF7)
The value S is stored in the target value area (refer to section 5.2) at the time of execution of the instruction.
The range that can be specified by Yn is from Y0 to Y7.
Precautions during programming
After the execution condition (trigger) for the F167 (HC1R) instruction turns on and until the target value
match output turns off, the high - speed counter control flag for the corresponding channel (refer to section
5.2) is on.
When the high - speed counter control flag for the specified channel is on, other high - speed counter
instructions (F166 to F170) for the same channel cannot be executed.
Before the elapsed value matches the target value, the target value and target value match output settings
will not be cleared, even if a hard reset is performed (the elapsed value is cleared to 0).
For the output Y specified for the target value match output, there is no check whether the output is doubled
up with that of a OT instruction, KP instruction, or other such high - level instructions.
To turn on the target value match output turned off by this instruction, either execute a reset with the SET
instruction or F0 (MV) instruction, or use it together with the F166 (HC1S) instruction.
To execute this instruction, it is necessary to set the high - speed counter mode. For detailed information
section 5.3

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- n is number except 0 to 3.
- The value of S exceeds the limit of specified range.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- n is number except 0 to 3.
- The value of S exceeds the limit of specified range.

3 - 263
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Positioning control (trapezoidal Step Availability

F168(SPD1) control/home return: with


channel specification)
5 FP0 C10, C14, C16,
C32, T32, SL1

Outline Outputs a pulse from the specified output (Y0 or Y1) according to the
specified parameter.
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 10
11 DF
R10 12 F168 (SPD1)
10 DF F168 SPD1 , DT100 , K 0
DT 100
S n K 0

S Starting address for the area that contains the data table.
n Output Yn that corresponds to the pulse output (n: K0 or K1).

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S N/A N/A N/A N/A N/A A N/A N/A N/A N/A A
A: Available
n N/A N/A N/A N/A N/A N/A N/A N/A A A N/A N/A: Not Available

Description
When the corresponding control flag is off and the execution condition (trigger) is in the on state, a pulse is
output from the specified output (Y0 or Y1).
The control code, initial speed, maximum speed, acceleration/deceleration time, and target value, are
specified by a user program with a data table as shown on the following page.
The frequency is switched by the acceleration/deceleration time specified for changing from the initial speed
to the maximum speed.
See below for the corresponding areas.
Channel Control Elapsed value Target value Directional
Near home Home input
no. flag area area output
DT9044, DT9045/ DT9046, DT9047/ DT9052/DT90052
ch0 R903A Y2 X0
DT90044, DT90045 DT90046, DT90047 <bit2>
DT9048, DT9049/ DT9050, DT9051/ DT9052/DT90052
ch1 R903B Y3 X1
DT90048, DT90049 DT90050, DT90051 <bit6>

Notes
• When this instruction is used, the setting for the channel
corresponding to system register 400 should be set to
“High - speed counter not used”. For detailed information
section 8.4
• By performing rewrite during RUN during pulse output, more
than the set number of pulses may be output.

3 - 264
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Description of operating mode


Incremental (relative value control)
Outputs the pulse set by the target value.
By setting H02 (incremental; forward: off; reverse: on) in the control code, when the target value is positive,
the directional output is turned off and the elapsed value of the high - speed counter increases. When the
target value is negative, the directional output turns on and the elapsed value of the high - speed counter
decreases. By setting H03 in the control code, the directional output is the reverse of that above.
Absolute (absolute value control)
Outputs the pulse set by the difference between the current value and the target value. (The difference
between the current value and the target value is the output pulse number.)
By setting H12 (absolute; forward: off; reverse: on) in the control code, when the current value is less than the
target value, the directional output is turned off and the elapsed value of the high - speed counter increases.
When the current value is greater than the target value, the directional output turns on and the elapsed value
of the high - speed counter decreases. By setting H13 in the control code, the directional output is the reverse
of that above.
Home return
Until the home input (X0 or X1) is entered, the pulse is continuously output. To decelerate the movement when
near the home, set the bit corresponding to DT9052/DT90052 to off → on → off → with the near home input.
To return to the home, refer to only the control code, initial speed, maximum speed, and
acceleration/deceleration time of the data table.
During operation, the elapsed value area and set value area will become insufficient. At the completion of
operations, the elapsed value will become 0.
Data table settings [S] through [S + 6]
S Control code *1
S+1 Initial speed Fmin (Hz) K40 to K5000 (Hz)
Maximum speed
S+2 Fmax (Hz) K40 to K9500 (Hz) *2

Acceleration/
S+3 deceleration time t (ms) K30 to K32767 (ms)
S+4 Target value K-8388608 to K8388607 *3
S+5 (pulse number)

S+6 K0 Specify “K0” *3

f
Fmax
Output pulse
number
Fmin
t
t t
Acceleration Deceleration
time time

3 - 265
High - level Instructions FP0

3.3 Explanation of High - level Instructions

*1: Specify the control code by setting the constant H.


Hjjj

Pulse width specification


0: Duty 50%
1: Fixed pulse width (approx. 80µs)

Operation mode and directional output theory


00: Does not use incremental directional output
02: Incremental forward off/reverse on
03: Incremental forward on/reverse off
10: Does not use absolute directional output
12: Absolute forward off/reverse on
13: Absolute forward on/reverse off
20: No home return directional output
22: Home return directional output off
23: Home return directional output on
24: No home return directional output
(Home input valid only after near home input.)
26: Home return output off
(Home input valid only after near home input.)
27: Home return output on
(Home input valid only after near home input.)
24, 26, and 27 are supported by CPU Ver. 2.1 or later.

*2: When the pulse width is set to duty 50%, the maximum is 6kHz. When the pulse width is set
to fixed pulse width (approx. 80µs), the maximum is 9.5kHz.
*3: The (S + 4) to (S + 6) specification is not necessary when an home return is carried out.

For details on troubleshooting procedures when no pulse is output when F168(SPD1) instruction is executed
page 5 - 32

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- n is number except 0 and 1.
- The value of S exceeds the limit of specified range.
- “S+1” is less than K40
- “S+1” > “S+2”
- The value of “S+5, S+4” exceeds the limit of specified range.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- n is number except 0 and 1.
- The value of S exceeds the limit of specified range.
- “S+1” is less than K40
- “S+1” > “S+2”
- The value of “S+5, S+4” exceeds the limit of specified range.

3 - 266
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Application example
R0
F0 MV, H 2, DT 0
F0 MV, K1000, DT 1
F0 MV, K7000, DT 2
F0 MV, K300, DT 3
F1 DMV, K100000, DT 4
F0 MV, K 0, DT 6
R1
F168 SPD1, DT 0, K 0

DT 0 2
DT 1 K 1000
DT 2 K 7000
DT 3 K 300
DT 4 K100000
DT 5
DT 6 0

7kHz
Number of
output pulse:
100,000
1kHz

300ms 300ms

f = (7000 - 1000) ÷ 30 steps = 200 (Hz)


t = 300ms ÷ 30 steps = 10ms
t

3 - 267
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Pulse output instruction Step Availability

F169(PLS) (JOG operation: with channel


specification)
5 FP0 C10, C14, C16,
C32, T32, SL1

Outline Outputs the pulse of the specified parameter from the specified output
(Y0 or Y1).
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 10
11 F169 (PLS)
R10
10 F169 PLS , DT10 , K 0 DT 10
K 0
S n
S Starting address for the area that contains the data table.
n Output Yn that corresponds to the pulse output (n: K0 or K1).

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S N/A N/A N/A N/A N/A A N/A N/A N/A N/A A
A: Available
n N/A N/A N/A N/A N/A N/A N/A N/A A A N/A N/A: Not Available

Description
When the corresponding control flag is off and the execution condition (trigger) is in the on state, a pulse is
output from the specified channel. The pulse is output while the execution condition (trigger) is in the on state.
By specifying either incremental counting or decremental counting in the control code, this instruction can be
used as an instruction for JOG operations. For that situation, set the control code with combinations such as
H12 (incremental, directional output off) and H22 (decremental, directional output on).
The frequency and duty can be changed each scan. (This becomes effective with the next pulse output after
this instruction is executed.)
See below for the corresponding areas.
Channel no. Control flag Data register for elapsed value
ch0 R903A DT9044, DT9045/DT90044, DT90045
ch1 R903B DT9048, DT9049/DT90048, DT90049

When using the incremental counting mode, the pulse stops when the elapsed value exceeds H7FFFFF.
When using the decremental counting mode, the pulse stops when the elapsed value exceeds HFF800000.

Notes
• When this instruction is used, the setting for the channel
corresponding to system register 400 should be set to
“High - speed counter not used”. For detailed information
section 8.4
• By performing a rewrite during RUN while operating, the pulse
output will stop during rewriting.

3 - 268
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Data table settings


S Control code *1
S+1 Frequency (Hz) K40 to K10,000 (Hz)

*1: Specify the control code by setting the constant H.


Hjjj
Pulse width specification
0: Fixed pulse width (approx. 80μs)
(CPU ver. 2.1 or later)
1 to 9: Duty ration approx. 10 to 90% (10% increments)

Operation mode and directional output


00: No counting mode
10: Incremental counting mode with no directional output
12: Incremental counting mode with directional output off
13: Incremental counting mode with directional output on
20: Decremental counting mode with no directional output
22: Decremental counting mode with directional output on
23: Decremental counting mode with directional output off

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- n is number except 0 and 1.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- n is number except 0 and 1.

3 - 269
High - level Instructions FP0

3.3 Explanation of High - level Instructions


5 Step Availability
PWM output instruction
F170(PWM) (with channel specification) 5 FP0 C10, C14, C16,
C32, T32, SL1

Outline Outputs the PWM of the specified parameter from the specified output
(Y0 or Y1).
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 10
11 F170 (PWM)
R10
10 F170 PWM , DT20 , K 1 DT 20
K 1
S n
S Starting address for the area that contains the data table.
n Output Yn that corresponds to the PWM output (n: K0 or K1).

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S N/A N/A N/A N/A N/A A N/A N/A N/A N/A A
A: Available
n N/A N/A N/A N/A N/A N/A N/A N/A A A N/A N/A: Not Available

Description
When the corresponding control flag is off and execution condition (trigger) is in the on state, a PWM is output
from the specified channel. The PWM is output while the execution condition (trigger) is in the on state.
The frequency and duty are specified with the data table on the right made by a user program.
Since the output is delayed near the maximum and minimum levels, the set duty ratio will differ.
The duty can be changed each scan. The frequency settings is only effective at the start of the execution of
the instruction (becomes effective after the next pulse output).
See below for the corresponding areas.
Channel no. Control flag
ch0 R903A
ch1 R903B

Notes
• When this instruction is used, the setting for the channel
corresponding to system register 400 should be set to
“High - speed counter not used”. For detailed information
section 8.4
• By performing a rewrite during RUN while operating, the pulse
output will stop during rewriting.

3 - 270
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Data table settings


K0 to K8 (*1)
S Control code

S+1 Duty (%) K1 to K999 (0.1% to 99.9%)

*1: Control code contents (frequency settings)


H11: Frequency 1kHz (Cycle 1.0ms)
H12: Frequency 714Hz (Cycle 1.25ms)
H13: Frequency 500Hz (Cycle 2.0ms)
H14: Frequency 400Hz (Cycle 2.5ms)
H15: Frequency 200Hz (Cycle 5.0ms)
H16: Frequency 100Hz (Cycle 10ms)
H0: Frequency 38Hz (Cycle 26ms)
H1: Frequency 19Hz (Cycle 52ms)
H2: Frequency 9.5Hz (Cycle 105ms)
H3: Frequency 4.8Hz (Cycle 210ms)
H4: Frequency 2.4Hz (Cycle 420ms)
H5: Frequency 1.2Hz (Cycle 840ms)
H6: Frequency 0.6Hz (Cycle 1.6s)
H7: Frequency 0.3Hz (Cycle 3.4s)
H8: Frequency 0.15Hz (Cycle 6.7s)
H11 to H16 are supported by CPU Ver. 2.1 or later.
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- n is number except 0 and 1.
- The frequency setting value set with S is outside the specification range.
- 100% or higher is set with “S + 1”
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- n is number except 0 and 1.
- The frequency setting value set with S is outside the specification range.
- 100% or higher is set with “S + 1”

3 - 271
High - level Instructions FP0

3.3 Explanation of High - level Instructions

5 Step Availability

F183 (DSTM) 32-bit auxilialy timer 7 FP0 C10, C14, C16,


C32, T32, SL1

Outline Sets the 32 - bit on - delay timer for 0.01s units (0.01 to 21474836.47s)
Program example
Boolean
Ladder Diagram
Address Instruction

Trigger 10 ST R 0
11 F183 (DSTM)
R0 R5 DT 10
10 F183 DSTM , DT10 , DT 5
DT 5
S D 16 OT R 5

S 32-bit equivalent constant or lower 16-bit area of 32-bit data for timer set value
D 16-bit area for timer elapsed value

Operands
Index
Relay Timer/Counter Register Constant Index
Operand register
modifier
WX WY WR SV EV DT IX IY K H
S A A A A A A A N/A A A N/A
A: Available
D N/A A A A A A N/A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the execution condition (trigger) has been satisfied, the auxiliary timer is activated, and the time equal
to the values stored in data registers DT10 and DT11 x 0.01 seconds has elapsed, R5 goes on.

Description
This functions as a 32 - bit addition - type on delay timer set in 0.01 - second units.
When the execution condition (trigger) is on, the elapsed time is added, and when the elapsed value “D + 1, D”
(32 bits) exceeds the set value, the relays being used are turned on by the OT instruction which comes next in
the program.
When the execution condition (trigger) is off, the elapsed value area is cleared to 0, and relays being used are
turned off by the OT instruction.
When the time set for the special internal relay R900D has elapsed, the relay is turned on.
R900D can also be used as a timer contact.(R900D is off when the execution condition (trigger) is off and
while addition is being carried out.)
R0
F183 DSTM, DT10, DT5

R900D R5

Operation is the same as that in the example shown above.

3 - 272
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Timer set time


The timer setting is entered as a value of 0.01 x (timer set value).
The timer set value is specified as a K constant within the range of K1 to K2147483647.
The F183 (DSTM) is set between 0.01 and 21,474,836.47 seconds, in units of 0.01 seconds.
If the set value is K500, the set time will be 0.01 x 500 = 5 seconds.

Precautions during programming


The area in which the set value is stored must be set so that the area specified for the elapsed value does not
overlap any areas reserved for other timer or counter instructions, or memory areas used for high - level
instruction operations.
Because addition is carried out when operations are carried out, the program should be set up so that
operations are carried out every scan.
(In cases such as programs where division is carried out, or for jump or loop instructions, where several
operations are carried out during one scan, or where it was not possible to carry out any operation during the
scan, correct results cannot be obtained.)
Consecutive OT instructions may be used in the program.

Precautions concerning programming tools


Reading and writing the F183 (DSTM) instruction (32 - bit auxiliary timer) requires NPST - GR Ver. 4.2 or a
subsequent version, or the FP Programmer II (AFP1114V2).

How the auxiliary timer works


1 When the execution condition (trigger) changes from off to on, values of 0 are sent to the elapsed
value area “D + 1, D”.
R0 R5
F183 DSTM, K500, DT5 0

1 Sent to “D + 1, D”
R900D
F0 MV, DT50, WR50 DT5, DT6
0

2 If the execution condition (trigger) stays on, the values in the elapsed value area “D + 1, D” are
added.
R0 R5 DT5, DT6
F183 DSTM, K500, DT5
K500
2 Addition
0
R900D
1
F0 MV, DT50, WR50
2

next page

3 - 273
High - level Instructions FP0

3.3 Explanation of High - level Instructions

3 If the values in the elapsed value area “D +1, D” reach “S + 1, S”, relays being used are turned on
by the OT instruction which comes next in the program. The special internal relay R900D also
goes on at this point.
R0 R5 DT5
F183 DSTM, K500, DT5
K500

R900D
F0 MV, DT50, WR50

3 Addition completed

Elapsed value
“D+1, D”

Set value
“S+1, S”

R0 on
off

R5 on
(R900D) off

Precautions when using R900D


If R900D is used and multiple auxiliary timers are being used, always use R900D in the line following the
auxiliary timer instruction.
R0
F183 DSTM, WR1, DT5
Pair
R900D Y0

R1
F183 DSTM, WR10, DT10
Pair
R900D Y1

When timer a , which is activated by R0: on, expires, Y0 goes on. When timer b , which is activated by R1: on,
expires, Y1 goes on.
If written as indicated below, R900D will not function correctly.
R0
F183 DSTM, DT0, DT5

R1
F183 DSTM, DT20, DT10

R900D Y0

R900D Y1

3 - 274
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
8 C32 CPU Ver. 2.1 or
F309 (FMV) Floating point type data move later/FP0 T32

Outline Copies floating point type data (32 bits) to the specified 32-bit area.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F309 (FMV)
R0
f 1.234
10 F309 FMV, f 1.234, DT10
DT 10

S D

S Floating point type data (32 bits) or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area for 32-bit area (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S N/A N/A N/A N/A N/A N/A N/A N/A N/A A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
The floating point type data “f 1.234” are copied to data registers DT11 and DT10 when trigger R0 turns on.
DT10:
(f1.234)
DT11:

3 - 275
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The floating point type data (32 bits) specified by S is copied to the 32-bit area specified by D when the trigger
turns on.
Floating point type
data

Real number data 15 0


D: Lower word
D+1: Higher word

Range of real number data which can be set are as follows:


Positive: f0.0000001 to f9999999
Negative: f - 9999999 to f - 0.000001

Precaution during programming


This instruction F309 (FMV) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.

3 - 276
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
14 C32 CPU Ver. 2.1 or
F310 (F+) Floating point type data addition later/FP0 T32

Outline Adds two real number data items and stores the result in the specified
area.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F310 (F+)
R0
DT 10
10 F310 F+, DT10, DT20, DT30
DT 20
DT 30
S1 S2 D

S1 Real number data (2 words) or lower 16-bit area of 32-bit data (for augend)
S2 Real number data (2 words) or lower 16-bit area of 32-bit data (for addend)
D Lower 16-bit area of 32-bit data (for result)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S1 A A A A A A A A A A A

S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The real number data (2 words) specified by S1 and S2 are added together when the trigger turns on. The
added result is stored in D+1 and D.
[S1+1, S1] + [S2+1, S2] → [D+1, D]

Specifying the integer device with [S1] and [S2], the integer data is internally converted to real numbers
before operations continue.
R0
F310 F+, % DT 0, % DT 2, DT 4

3 - 277
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F310 F+, DT 0, DT 2, % DT 4

When the constant K is specified in S1 and S2, the operations are the same as when a integer device is
specified.

For detailed information about the processing of specifying the integer device section 1.3

Program example
The “f4.554” is stored to DT30 and DT31 when the R0 turns on.
R0
F310 F+, f1.414, f3.14, DT30

The “f135.795” is stored to DT30 and DT31 when the R0 turns on.
R0
F309 FMV, f12.345 DT10
F309 FMV, f123.45, DT20
F310 F+, DT10, DT20, DT30

Precaution during programming


This instruction F310 (F+) cannot be used in the interrupt program.
Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S1+1 and S1” and “S2+1
and S2.”
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S1+1 and S1” and “S2+1
and S2.”
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 278
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
14 C32 CPU Ver. 2.1 or
Floating point type data
F311 (F - ) subtraction later/FP0 T32

Outline Subtracts real number data from the minuend and stores the result in
the specified area.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F311 (F-)
R0
DT 10
10 F311 F - , DT10, DT20, DT30
DT 20
DT 30
S1 S2 D
S1 Real number data (2 words) or lower 16-bit area of 32-bit data (for minuend)
S2 Real number data (2 words) or lower 16-bit area of 32-bit data (for subtrahend)
D Lower 16-bit area of 32-bit data (for result)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S1 A A A A A A A A A A A

S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
Subtracts the real number data (2 words) specified by S2 from the real number data (32-bit) specified by S1
when the trigger turns on. The subtracted result is stored in D+1 and D.
[S1+1, S1] - [S2+1, S2] → [D+1, D]

Specifying the integer device with [S1] and [S2], the integer data is internally converted to real numbers
before operations continue.
R0
F311 F - , % DT 0, % DT 2, DT 4

3 - 279
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F311 F - , DT 0, DT 2, % DT 4

When the constant K is specified in S1 and S2, the operations are the same as when a integer device is
specified.
For detailed information about the processing of specifying the integer device section 1.3

Program example
The “f0.445” is stored to DT30 and DT31 when the R0 turns on.
R0
F311 F - , f1, f0.555, DT30

The “f100.05” is stored to DT30 and DT31 when the R0 turns on.
R0
F309 FMV, f100.1, DT10
F309 FMV, f0.05, DT20
F311 F - , DT10, DT20, DT30

Precaution during programming


This instruction F311 (F–) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S1+1 and S1” and “S2+1
and S2.”
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S1+1 and S1” and “S2+1
and S2.”
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 280
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
14 C32 CPU Ver. 2.1 or
Floating point type data
F312 (F*) multiplication later/FP0 T32

Outline Multiplies two real number data items and stores the result in the
specified 32-bit area.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F312 (F*)
R0
DT 10
10 F312 F*, DT10, DT20, DT30
DT 20
DT 30
S1 S2 D
S1 Real number data (2 words) or lower 16-bit area of 32-bit data (for
multiplicand)
S2 Real number data (2 words) or lower 16-bit area of 32-bit data (for multiplier)
D Lower 16-bit area of 32-bit data (for result)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S1 A A A A A A A A A A A

S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
Multiplies the real number data (2 words) specified by S1 and the one specified by S2 when the trigger turns
on.
The multiplied result is stored in D+1 and D (32-bit area).
[S1+1, S1] × [S2+1, S2] → [D+1, D]

Specifying the integer device with [S1] and [S2], the integer data is internally converted to real numbers
before operations continue.
R0
F312 F*, % DT 0, % DT 2, DT 4

3 - 281
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F312 F*, DT 0, DT 2, % DT 4

When the constant K is specified in S1 and S2, the operations are the same as when a integer device is
specified.
For detailed information about the processing of specifying the integer device section 1.3

Program example
The “f123.4000” is stored to DT30 and DT31 when the R0 turns on.
R0
F312 F*, f1.234, f100, DT30

Precaution during programming


This instruction F312 (F*) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S1+1 and S1” and “S2+1
and S2.”
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S1+1 and S1” and “S2+1
and S2.”
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 282
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
14 C32 CPU Ver. 2.1 or
F313 (F%) Floating point type data division later/FP0 T32

Outline Divides real number data by the divisor and stores the divided result in
the specified 32-bit area.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F313 (F%)
R0
DT 10
10 F313 F%, DT10, DT20, DT30
DT 20
DT 30
S1 S2 D
S1 Real number data (2 words) or lower 16-bit area of 32-bit data (for dividend)
S2 Real number data (2 words) or lower 16-bit area of 32-bit data (for divisor)
D Lower 16-bit area of 32-bit data (for result)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S1 A A A A A A A A A A A

S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The real number data (2 words) specified by S1 is divided by the real number data (2 words) specified by S2
when the trigger turns on. The result is stored in D+1 and D.
[S1+1, S1] ÷ [S2+1, S2] → [D+1, D]

Specifying the integer device with [S1] and [S2], the integer data is internally converted to real numbers
before operations continue.
R0
F313 F%, % DT 0, % DT 2, DT4

3 - 283
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F313 F%, DT 0, DT 2, % DT 4

When the constant K is specified in S1 and S2, the operations are the same as when a integer device is
specified.
For detailed information about the processing of specifying the integer device section 1.3

Program example
The “f5.432100” is stored to DT30 and DT31 when the R0 turns on.
R0
F313 F%, f54.321, f10, DT30

Precaution during programming


This instruction F313 (F%) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S1+1 and S1” and “S2+1
and S2.”
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
- The real number data for the divisor specified by S2 is “0.0”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S1+1 and S1” and “S2+1
and S2.”
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
- The real number data for the divisor specified by S2 is “0.0”.
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 284
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
10 C32 CPU Ver. 2.1 or
Floating point type data
F314 (SIN) sine operation later/FP0 T32

Outline Triangle functions, This instruction calculates sine [SIN ( )].

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F314 (SIN)
R0
F314 SIN, DT10, DT20 DT 10
10
DT 20
S D
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data is
stored
D Lower 16-bit area of 32-bit data where calculated result is stored

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The SIN([S+1 and S]) of an angle data (units are radians) specified by S+1 and S is calculated and the result
stored in D+1 and D.
SIN ([S+1, S]) → [D+1, D]

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F314 SIN, % DT 0, DT 4

3 - 285
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F314 SIN, DT 0, % DT 4

When the constant K is specified in S, the operations are the same as when a integer device is specified.
For detailed information about the processing of specifying the integer device section 1.3

Program example
The “f0.4999999” is stored to DT20 and DT21 when the R0 turns on.
Radians of 30_
R0
F314 SIN, f0.5235987, DT20

Precautions during programming


The accuracy of the calculation decreases as the absolute value of the input value (angle data specified in
S+1 and S) increases. We recommend that angle data be set within the following range:
- 2π (radians) ≦ [S+1, S] ≦ 2π (radians)
This instruction F314 (SIN) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
- Absolute value of “S+1 and S” is 52707176 or greater.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
- Absolute value of “S+1 and S” is 52707176 or greater.
S Carry flag (R9009): Turns on for an instant when the result is overflowed.
S = flag (R900B): Turns on when result of processing is recognized as “0.”

3 - 286
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
10 C32 CPU Ver. 2.1 or
Floating point type data
F315 (COS) cosine operation later/FP0 T32

Outline Triangle functions, This instruction calculates cosine [COS ( )].

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F315 (COS)
R0
DT 10
10 F315 COS, DT10, DT20
DT 20

S D
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data is
stored
D Lower 16-bit area of 32-bit data where calculated result is stored

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The COS ([S+1 and S]) of an angle data (units are radians) specified by S+1 and S is calculated and the result
stored in D+1 and D.
COS ([S+1, S]) → [D+1, D]

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F315 COS, % DT 0, DT 4

3 - 287
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F315 COS, DT 0, % DT 4

When the constant K is specified in S, the operations are the same as when a integer device is specified.
For detailed information about the processing of specifying the integer device section 1.3

Program example
The “f0.7071068” is stored to DT20 and DT21 when the R0 turns on.
Radians of 45_
R0
F315 COS, f0.7853981, DT20

Precautions during programming


The accuracy of the calculation decreases as the absolute value of the input value (angle data specified in
S+1 and S) increases. We recommend that angle data be set within the following range:
- 2π (radians) ≦ [S+1, S] ≦ 2π (radians)
This instruction F315 (COS) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
- Absolute value of “S+1 and S” is 52707176 or greater.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
- Absolute value of “S+1 and S” is 52707176 or greater.
S Carry flag (R9009): Turns on for an instant when the result is overflowed.
S = flag (R900B): Turns on when result of processing is recognized as “0.”

3 - 288
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
10 C32 CPU Ver. 2.1 or
Floating point type data
F316 (TAN) tangent operation later/FP0 T32

Outline Triangle functions, This instruction calculates tangent [TAN ( )].

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F316 (TAN)
R0
DT 10
10 F316 TAN, DT10, DT20
DT 20

S D
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data is
stored
D Lower 16-bit area of 32-bit data where calculated result is stored

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The TAN([S+1 and S]) of an angle data (units are radians) specified by S+1 and S is calculated and the result
stored in D+1 and D.
TAN ([S+1, S]) → [D+1, D]

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F316 TAN, % DT 0, DT 4

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F316 TAN, DT 0, % DT 4

When the constant K is specified in S, the operations are the same as when a integer device is specified.
For detailed information about the processing of specifying the integer device section 1.3

3 - 289
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program example
The “f1.732048” is stored to DT20 and DT21 when the R0 turns on.
Radians of 60_
R0
F316 TAN, f1.047197, DT20

Precautions during programming


The accuracy of the calculation decreases as the absolute value of the input value (angle data specified in
S+1 and S) increases. We recommend that angle data be set within the following range:
- 2π (radians) ≦ [S+1, S] ≦ 2π (radians)
This instruction F316 (TAN) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
- Absolute value of “S+1 and S” is 52707176 or greater.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
- Absolute value of “S+1 and S” is 52707176 or greater.
S Carry flag (R9009): Turns on for an instant when the result is overflowed.
S = flag (R900B): Turns on when result of processing is recognized as “0.”

3 - 290
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
10 C32 CPU Ver. 2.1 or
Floating point type data
F317 (ASIN) arcsine operation later/FP0 T32

Outline Triangle functions, This instruction calculates arcsine [SIN - 1 ( )].

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F317 (ASIN)
R0
DT 10
10 F317 ASIN, DT10, DT20
DT 20

S D
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data is
stored
D Lower 16-bit area of 32-bit data where calculated result is stored

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
SIN of the value specified in S+1 and S is calculated, and the result [an angle (radians)] is stored in D+1 and
D.
SIN - 1 ([S+1, S]) → [D+1, D]

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F317 ASIN, % DT 0, DT 4

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F317 ASIN, DT 0, % DT 4

When the constant K is specified in S, the operations are the same as when a integer device is specified.
For detailed information about the processing of specifying the integer device section 1.3

3 - 291
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program example
The “f0.5235986 (30_ radians)” is stored to DT20 and DT21 when the R0 turns on.
R0
F317 ASIN, f0.4999999, DT20

Precautions during programming


D+1 and D is stored within the following range: - π/2 (radians) ≦ [D+1, D] ≦ π/2 (radians)
This instruction F317 (ASIN) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- “S+1 and S” is not within the range - 1.0 ≦ [S+1, S] ≦ 1.0
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- “S+1 and S” is not within the range - 1.0 ≦ [S+1, S] ≦ 1.0
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 292
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
10 C32 CPU Ver. 2.1 or
Floating point type data
F318 (ACOS) arccosine operation later/FP0 T32

Outline Triangle functions, This instruction calculates arccosine [COS - 1 ( )].

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F318 (ACOS)
R0
DT 10
10 F318 ACOS, DT10, DT20
DT 20

S D
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data is
stored
D Lower 16-bit area of 32-bit data where calculated result is stored

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
COS of the value specified in S+1 and S is calculated, and the result [an angle data (units and radians)] is
stored in D+1 and D.
COS - 1 ([S+1, S]) → [D+1, D]

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F318 ACOS, % DT 0, DT 4

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F318 ACOS, DT 0, % DT 4

When the constant K is specified in S, the operations are the same as when a integer device is specified.
For detailed information about the processing of specifying the integer device section 1.3

3 - 293
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program example
The “f0.7853980 (45_ radians)” is stored to DT20 and DT21 when the R0 turns on.
R0
F318 ACOS, f0.7071069, DT20

Precautions during programming


D+1 and D is stored within the following range: 0.0 (radians) ≦ [D+1, D] ≦ π (radians)
This instruction F318 (ACOS) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- “S+1 and S” is not within the range - 1.0 ≦ [S+1, S] ≦ 1.0
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- “S+1 and S” is not within the range - 1.0 ≦ [S+1, S] ≦ 1.0
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 294
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
10 C32 CPU Ver. 2.1 or
Floating point type data
F319 (ATAN) arctangent operation later/FP0 T32

Outline Triangle functions, This instruction calculates arctangent [TAN - 1 ( )].

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F319 (ATAN)
R0
F319 ATAN, DT10, DT20 DT 10
10
DT 20
S D

S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data is
stored
D Lower 16-bit area of 32-bit data where calculated result is stored

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
TAN - 1 (the arctangent) of the value specified in S+1 and S is calculated, and the result [an angle data (units
and radians)] is stored in D+1 and D.
TAN - 1 ([S+1, S]) → [D+1, D]

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F319 ATAN, % DT 0, DT 4

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F319 ATAN, DT 0, % DT 4

When the constant K is specified in S, the operations are the same as when a integer device is specified.
For detailed information about the processing of specifying the integer device section 1.3

3 - 295
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program example
The “f1.047197 (60_ radians)” is stored to DT20 and DT21 when the R0 turns on.
R0
F319 ATAN, f1.73205, DT20

Precautions during programming


D+1 and D is stored within the following range: - π/2 (radians) < [D+1, D] < π/2 (radians)
This instruction F319 (ATAN) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 296
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
10 C32 CPU Ver. 2.1 or
Floating point type data
F320 (LN) natural logarithm later/FP0 T32

Outline This instruction calculates a natural logarithm LN( ).

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F320 (LN)
R0
DT 10
10 F320 LN, DT10, DT20
DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data where real
number data is stored
D Lower 16-bit area of 32-bit data where calculated result is stored

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The natural logarithm LN(S+1 and S) is calculated of the data specified in S+1 and S, and the result is stored
in D+1 and D.
LN ([S+1, S]) → [D+1, D]

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F320 LN, % DT 0, DT 4

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F320 LN, DT 0, % DT 4

For detailed information about the processing of specifying the integer device section 1.3

3 - 297
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program example
The “f1.6094379” is stored to DT20 and DT21 when the R0 turns on.
R0
F320 LN, K 5, DT20

The “f - 0.3160815” is stored to DT30 and DT31 when the R0 turns on.
R0
F320 LN, f0.729, DT30

Precaution during programming


This instruction F320 (LN) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The “S+1 and S” is not greater than zero.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The “S+1 and S” is not greater than zero.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 298
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
10 C32 CPU Ver. 2.1 or
Floating point type data
F321 (EXP) exponent later/FP0 T32

Outline This instruction calculates the exponent of a floating point type real
number EXP( ).

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F321 (EXP)
R0
DT 10
10 F321 EXP, DT10, DT20
DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data where real
number data is stored
D Lower 16-bit area of 32-bit data where calculated result is stored

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The exponent EXP(S+1 and S) is calculated from the real number data specified in S+1 and S, and the result
is stored in D+1 and D.
EXP ([S+1, S]) → [D+1, D]
The calculation is performed with the exponent base (e) equal to 2.718282.

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F321 EXP, % DT 0, DT 4

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F321 EXP, DT 0, % DT 4

For detailed information about the processing of specifying the integer device section 1.3

3 - 299
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program example
The “f7.389056” is stored to DT20 and DT21 when the R0 turns on.
R0
F321 EXP, K 2, DT20

The “f221.406402” is stored to DT30 and DT31 when the R0 turns on.
R0
F321 EXP, f5.4, DT30

Precaution during programming


This instruction F321 (EXP) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 300
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
10 C32 CPU Ver. 2.1 or
Floating point type data
F322 (LOG) logarithm later/FP0 T32

Outline This instruction calculates the logarithm of a floating point type real
number LOG( ).

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F322 (LOG)
R0
DT 10
10 F322 LOG, DT10, DT20
DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data where real
number data is stored
D Lower 16-bit area of 32-bit data where calculated result is stored

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The logarithm LOG(S+1 and S) is calculated of the data specified in S+1 and S, and the result is stored in D+1
and D.
LOG ([S+1, S]) → [D+1, D]

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F322 LOG, % DT 0, DT 4

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F322 LOG, DT 0, % DT 4

When the constant K is specified in S, the operations are the same as when a integer device is specified.
For detailed information about the processing of specifying the integer device section 1.3

3 - 301
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program example
The “f1.30103” is stored to DT20 and DT21 when the R0 turns on.
R0
F322 LOG, K20, DT20

The “f0.0108932” is stored to DT30 and DT31 when the R0 turns on.
R0
F322 LOG, f1.0254, DT30

Precaution during programming


This instruction F322 (LOG) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The “S+1 and S” is not greater than zero.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The “S+1 and S” is not greater than zero.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 302
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
14 C32 CPU Ver. 2.1 or
Floating point type data
F323 (PWR) power later/FP0 T32

Outline This instruction raises a floating point type real number to the specified
power.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F323 (PWR)
R0
DT 10
10 F323 PWR, DT10, DT20, DT30
DT 20
DT 30
S1 S2 D
S1 Real number data (2 words) or lower 16-bit area of 32-bit data (for
multiplicand)
S2 Real number data (2 words) or lower 16-bit area of 32-bit data (for multiplier)
D Lower 16-bit area of 32-bit data (for result)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S1 A A A A A A A A A A A

S2 A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The real number data specified by S1+1 and S1 is raised to the power specified by the real number data of
S2+1 and S2, and the result is stored in D+1 and D.
[S1+1, S] ^ [S2+1, S2] → [D+1, D]

Specifying the integer device with [S1] and [S2], the integer data is internally converted to real numbers
before operations continue.
R0
F323 PWR, % DT 0, % DT 2, DT 4

3 - 303
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F323 PWR, DT 0, DT 2, % DT4

When the constant K is specified in S1 and S2, the operations are the same as when a integer device is
specified.
For detailed information about the processing of specifying the integer device section 1.3

Program example
The “f625.0” is stored to DT20 and DT21 when the R0 turns on.
R0
F323 PWR, K 5, K 4, DT20

The “f30.51758” is stored to DT30 and DT31 when the R0 turns on.
R0
F323 PWR, f3.125, K 3, DT30

Precaution during programming


This instruction F323 (PWR) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S1+1 and S1” and “S2+1
and S2.”
- The power of negative number data is not an integer
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S1+1 and S1” and “S2+1
and S2.”
- The power of negative number data is not an integer
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 304
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
10 C32 CPU Ver. 2.1 or
Floating point type data
F324 (FSQR) square root later/FP0 T32

Outline Takes the square root of the specified real number data and stores result
in the specified area.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F324 (FSQR)
R0
DT 10
10 F324 FSQR, DT10, DT20
DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit area for storing data
to be calculated
D Lower 16-bit area of 32-bit area for storing the calculated result

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The square root of real number data specified by S is calculated and stored in the 32-bit area specified by D.
√[S1+1, S] → [D+1, D]

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F324 FSQR, % DT 0, DT 4

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F324 FSQR, DT 0, % DT 4

When the constant K is specified in S, the operations are the same as when a integer device is specified.
For detailed information about the processing of specifying the integer device section 1.3

3 - 305
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program example
The “f1.41421” is stored to DT20 and DT21 when the R0 turns on.
R0
F324 FSQR, K 2, DT20

Precaution during programming


This instruction F324 (FSQR) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The “S+1 and S” is not greater than zero.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The “S+1 and S” is not greater than zero.
- If result of processing is outside integer range when integer device is
specified in “D+1 and D”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 306
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
6 C32 CPU Ver. 2.1 or
16 - bit integer data to Floating
F325 (FLT) point type data conversion later/FP0 T32

Outline Converts 16-bit integer data to real number data.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F325 (FLT)
R0
DT 10
10 F325 FLT, DT10, DT20
DT 20

S D
S 16-bit integer data or 16-bit area for storing integer data (source)
D Lower 16-bit area of floating point type real number data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A N/A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
Converts the 16-bit integer data with sign specified by S to real number data when the trigger turns on.
The converted data is stored in D.

16-bit integer 15 0
data with sign S:

15 0
Floating point
type real D: Lower word
number data Higher word
D+1:

Precaution during programming


This instruction F325 (FLT) cannot be used in the interrupt program.

3 - 307
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the converted data is recognized as “0”.

3 - 308
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
8 C32 CPU Ver. 2.1 or
32 - bit integer data to Floating
F326 (DFLT) point type data conversion later/FP0 T32

Outline Converts 32-bit integer data to real number data.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F326 (DFLT)
R0
DT 10
10 F326 DFLT, DT10, DT20
DT 20

S D
S 32-bit integer data or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area for 32-bit data floating point type real number (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A N/A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Description
Converts the 32-bit integer data with sign specified by S to real number data when the trigger turns on. The
converted data is stored in D+1 and D.
15 0
32-bit integer S: Lower word
data with sign S+1: Higher word

15 0
Floating point D: Lower word
type real
D+1: Higher word
number data

Precaution during programming


This instruction F326 (DFLT) cannot be used in the interrupt program.

3 - 309
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when the area specified using the index modifier
exceeds the limit.
S Error flag (R9008): Turns on for an instant when the area specified using the index modifier
exceeds the limit.
S = flag (R900B): Turns on for an instant when the converted data is recognized as “0”.
S Carry flag (R9009): Turns on for an instant when there are too many significant digits in mantissa
of converted real number data.

3 - 310
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Floating point type data to
16 - bit integer data conversion FP0 C10, C14, C16,
8 C32 CPU Ver. 2.1 or
(the largest integer not exceed-
F327 (INT) ing the floating point type data) later/FP0 T32

Outline Converts real number data to 16-bit integer data (the largest integer not
exceeding the floating point type data).

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F327 (INT)
R0
DT 10
10 F327 INT, DT10, DT20
DT 20

S D

S Real number data (2 words) or lower 16-bit area of 32-bit data (source)
D 16-bit area for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A N/A A A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the real number data “1.234” is in DT10 and DT11, as shown below.
DT10:
(f1.234)
DT11:

DT20: (K1)

When the real number data “ - 1.234” is in DT10 and DT11, as shown below.
DT10:
(f - 1.234)
DT11:

DT20: (K - 2)

3 - 311
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts real number data ( - 32767.99 to +32767.99) specified by S to the 16-bit integer data with sign (the
largest integer not exceeding the floating point type data) when the trigger turns on. The converted data is
stored in D.
15 0
Real number
data S: Lower word

S+1: Higher word

15 0
16-bit integer
D:
data with sign

For detailed information about the processing of specifying the integer device section 1.3
Precaution during programming
This instruction F327 (INT) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D” exceeds the range of 16-bit integer data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D” exceeds the range of 16-bit integer data.
S = flag (R900B): Turns on for an instant when the converted data is recognized as “0”.

3 - 312
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Floating point type data to
32 - bit integer data conversion FP0 C10, C14, C16,
8 C32 CPU Ver. 2.1 or
(the largest integer not exceed-
F328 (DINT) ing the floating point type data) later/FP0 T32

Outline Converts real number data to 32-bit integer data (the largest integer not
exceeding the floating point type data).

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F328 (DINT)
R0
DT 10
10 F328 DINT, DT10, DT20
DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area of 32-bit data for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A N/A A A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the real number data “12345.67” is in DT10 and DT11, as shown below.
DT10:
(f12345.67)
DT11:

DT20:
(K12345)
DT21:

When the real number data “ - 12345.67” is in DT10 and DT11, as shown below.
DT10:
(f - 12345.67)
DT11:

DT20:
(K - 12346)
DT21:

3 - 313
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts real number data ( - 2,147,483,000 to +2,147,483,000) specified by S+1 and S to the 32-bit integer
data with sign (the largest integer not exceeding the floating point type data) when the trigger turns on. The
converted data is stored in D+1 and D.
15 0
Real number
data S: Lower word

S+1: Higher word

15 0
32-bit integer Lower word
D:
data with sign
D+1: Higher word

For detailed information about the processing of specifying the integer device section 1.3
Precaution during programming
This instruction F328 (DINT) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D+1 and D” exceeds the range of 32-bit integer data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D+1 and D” exceeds the range of 32-bit integer data.
S = flag (R900B): Turns on for an instant when the converted data is recognized as “0”.

3 - 314
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Floating point type data to
16 - bit integer data conversion FP0 C10, C14, C16,
8 C32 CPU Ver. 2.1 or
(rounding the first decimal
F329 (FIX) point down to integer) later/FP0 T32

Outline Converts real number data to 16-bit integer data (rounding the first
decimal point down to integer).
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F329 (FIX)
R0
DT 10
10 F329 FIX, DT10, DT20
DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A N/A A A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the real number data “1.234567” is in DT10 and DT11, as shown below.
DT10:
(f1.234567)
DT11:

DT20: (K1)

When the real number data “ - 1.234567” is in DT10 and DT11, as shown below.
DT10:
(f - 1.234567)
DT11:

DT20: (K - 1)

3 - 315
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts real number data ( - 32767.99 to 32767.99) specified by S to the 16-bit integer data with sign
(rounding the first decimal point down to integer) when the trigger turns on. The converted data is stored in D.
15 0
Real number
data S: Lower word

S+1: Higher word

15 0
16-bit integer
data with sign D:

For detailed information about the processing of specifying the integer device section 1.3
Precaution during programming
This instruction F329 (FIX) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D+1 and D” exceeds the range of 16-bit integer data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D+1 and D” exceeds the range of 16-bit integer data.
S = flag (R900B): Turns on for an instant when the converted data is recognized as “0”.

3 - 316
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Floating point type data to
32 - bit integer conversion FP0 C10, C14, C16,
8 C32 CPU Ver. 2.1 or
(rounding the first decimal
F330 (DFIX) point down to integer) later/FP0 T32

Outline Converts real number data to 32-bit integer data (rounding the first
decimal point down to integer).
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F330 (DFIX)
R0 DT 10
10 F330 DFIX, DT10, DT20 DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area of 32-bit data for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A N/A A A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the real number data “123456.7” is in DT10 and DT11, as shown below.
DT10:
(f123456.7)
DT11:

DT20:
(K123456)
DT21:

When the real number data “ - 123456.7” is in DT10 and DT11, as shown below.
DT10:
(f - 123456.7)
DT11:

DT20:
(K - 123456)
DT21:

3 - 317
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts real number data ( - 2,147,483,000 to 2,147,483,000) specified by S+1 and S to 32-bit integer data
with sign (rounding the first decimal point down to integer) when the trigger turns on. The converted data is
stored in D+1 and D.
15 0
Real number
data S: Lower word

S+1: Higher word

15 0
32-bit integer Lower word
D:
data with sign
D+1: Higher word

For detailed information about the processing of specifying the integer device section 1.3
Precaution during programming
This instruction F330 (DFIX) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D+1 and D” exceeds the range of 32-bit integer data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D+1 and D” exceeds the range of 32-bit integer data.
S = flag (R900B): Turns on for an instant when the converted data is recognized as “0”.

3 - 318
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Floating point type data to
16 - bit integer conversion FP0 C10, C14, C16,
8 C32 CPU Ver. 2.1 or
(rounding the first decimal
F331 (ROFF) point off to integer) later/FP0 T32

Outline Converts real number data to 16-bit integer data (rounding the first
decimal point off to integer).
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F331 (ROFF)
R0 DT 10
10 F331 ROFF, DT10, DT20
DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data (source)
D 16-bit area for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A N/A A A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the real number data “1234.567” is in DT10 and DT11, as shown below.
DT10:
(f1234.567)
DT11:

DT20: (K1235)

When the real number data “ - 1234.567” is in DT10 and DT11, as shown below.
DT10:
(f - 1234.567)
DT11:

DT20: (K - 1235)

3 - 319
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts real number data ( - 32767.99 to +32767.99) specified by S+1 and S to 16-bit integer data with sign
(rounding the first decimal point off to integer) when the trigger turns on. The converted data is stored in D.
15 0
Real number
data S: Lower word

S+1: Higher word

15 0
16-bit integer
data with sign D:

For detailed information about the processing of specifying the integer device section 1.3
Precaution during programming
This instruction F331 (ROFF) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D” exceeds the range of 16-bit integer data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D” exceeds the range of 16-bit integer data.
S = flag (R900B): Turns on for an instant when the converted data is recognized as “0”.

3 - 320
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Floating point type data to
32 - bit integer conversion FP0 C10, C14, C16,
8 C32 CPU Ver. 2.1 or
(rounding the first decimal
F332 (DROFF) point off to integer) later/FP0 T32

Outline Converts real number data to 32-bit integer data (rounding the first
decimal point off to integer).
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F332 (DROFF)
R0 DT 10
10 F332 DROFF, DT10, DT20
DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area of 32-bit data for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A N/A A A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the real number data “45678.51” is in DT10 and DT11, as shown below.
DT10:
(f45678.51)
DT11:

DT20:
(K45679)
DT21:

When the real number data “ - 45678.51” is in DT10 and DT11, as shown below.
DT10:
(f - 45678.51)
DT11:

DT20:
(K - 45679)
DT21:

3 - 321
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Converts real number data ( - 2,147,483,000 to +2,147,483,000) specified by S+1 and S to 32-bit integer data
with sign (rounding the first decimal point off to integer) when the trigger turns on. The converted data is
stored in D+1 and D.
15 0
Real number
data S: Lower word

S+1: Higher word

15 0
32-bit integer Lower word
D:
data with sign
D+1: Higher word

For detailed information about the processing of specifying the integer device section 1.3
Precaution during programming
This instruction F332 (DROFF) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D+1 and D” exceeds the range of 32-bit integer data.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- The converted data “D+1 and D” exceeds the range of 32-bit integer data.
S = flag (R900B): Turns on for an instant when the converted data is recognized as “0”.

3 - 322
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Floating point type data FP0 C10, C14, C16,
rounding the first decimal 8 C32 CPU Ver. 2.1 or
F333 (FINT) point down later/FP0 T32

Outline This instruction rounds down the decimal part of real number data.
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F333 (FINT)
R0 DT 10
10 F333 FINT, DT10, DT20
DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area of 32-bit data for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A N/A A A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the real number data “1234.567” is in DT10 and DT11, as shown below.
DT10:
(f1234.567)
DT11:

DT20:
(f1234.000)
DT21:

When the real number data “ - 1234.567” is in DT10 and DT11, as shown below.
DT10:
(f - 1234.567)
DT11:

DT20:
(f - 1235.000)
DT21:

3 - 323
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The decimal part of the real number data specified in S+1 and S is rounded down, and the result is stored in
D+1 and D.
15 0
Real number
data S: Lower word

S+1: Higher word

15 0
Real number Lower word
D:
data
D+1: Higher word

Precaution during programming


This instruction F333 (FINT) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 324
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
Floating point type data FP0 C10, C14, C16,
rounding the first decimal 8 C32 CPU Ver. 2.1 or
F334 (FRINT) point off later/FP0 T32

Outline This instruction rounds off the decimal part of real number data.
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F334 (FRINT)
R0 DT 10
10 F334 FRINT, DT10, DT20 DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area of 32-bit data for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A N/A A A N/A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the real number data “1234.567” is in DT10 and DT11, as shown below.
DT10:
(f1234.567)
DT11:

DT20:
(f1235.000)
DT21:

When the real number data “ - 1234.567” is in DT10 and DT11, as shown below.
DT10:
(f - 1234.567)
DT11:

DT20:
(f - 1235.000)
DT21:

3 - 325
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The decimal part of the real number data stored in S+1 and S is rounded off, and the result is stored in D+1
and D.
15 0
Real number
data S: Lower word

S+1: Higher word

15 0
Real number Lower word
D:
data
D+1: Higher word

Precaution during programming


This instruction F334 (FRINT) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 326
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
Floating point type data 8 C32 CPU Ver. 2.1 or
F335 (F+/ - ) sign changes later/FP0 T32

Outline This instruction changes the sign of real number data.


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F335 (F+/-)
R0 DT 10
10 F335 F+/ - , DT10, DT20
DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area of 32-bit data for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the real number data “ - 60000.00” is in DT10 and DT11, as shown below.
DT10:
(f - 60000.00)
DT11:

DT20:
(f60000.00)
DT21:

When the real number data “ - 30000.00” is in DT10 and DT11, as shown below.
DT10:
(f - 30000.00)
DT11:

DT20:
(f30000.00)
DT21:

3 - 327
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
The real number data stored in S+1 and S is changed sign bit, and the result is stored in D+1 and D.
15 0
Real number
data S: Lower word

S+1: Higher word

15 0
Real number Lower word
D:
data
D+1: Higher word

Precaution during programming


This instruction F335 (F+/ - ) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 328
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
Floating point type data 8 C32 CPU Ver. 2.1 or
F336 (FABS) absolute later/FP0 T32

Outline Takes absolute value of real number data.


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F336 (FABS)
R0 DT 10
10 F336 FABS, DT10, DT20 DT 20

S D
S Real number data (2 words) or lower 16-bit area of 32-bit data (source)
D Lower 16-bit area of 32-bit data for storing converted data (destination)

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Explanation of example
When the real number data “1234.567” is in DT10 and DT11, as shown below.
DT10:
(f1234.567)
DT11:

DT20:
(f1234.567)
DT21:

When the real number data “ - 1234.567” is in DT10 and DT11, as shown below.
DT10:
(f - 1234.567)
DT11:

DT20:
(f1234.567)
DT21:

3 - 329
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Description
Takes the absolute value of real number data specified by S+1 and S when the trigger turns on. The result
(absolute value) is stored in D+1 and D.
15 0
Real number
data S: Lower word

S+1: Higher word

15 0
Real number Lower word
D:
data
D+1: Higher word

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
When the constant K is specified in [S], the operations are the same as when a integer device is specified.

For detailed information about the processing of specifying the integer device section 1.3

Precaution during programming


This instruction F336 (FABS) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 330
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
Floating point type data 8 C32 CPU Ver. 2.1 or
F337 (RAD) degrees → radians later/FP0 T32

Outline This instruction converts the units of an angle from degrees to radians.
Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F337 (RAD)
R0 DT 10
10 F337 RAD, DT10, DT20 DT 20

S D
S Angle data (degrees) (2 words) or lower 16-bit area of 32-bit data
D Lower 16-bit area of 32-bit data for storing converted data

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A N/A N/A: Not Available

Description
The data in degrees of an angle specified in S+1 and S is converted to radians (real number data) and the
result is stored in D+1 and D.
15 0
Angle data (degrees)
(Real number data) S: Lower word

S+1: Higher word

15 0
Angle data (radians) Lower word
D:
(Real number data)
D+1: Higher word

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.

When the constant K is specified in S, the operations are the same as when a integer device is specified.
For detailed information about the processing of specifying the integer device section 1.3

3 - 331
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Program example
The “f0.7853981” is stored to DT20 and DT21 when the R0 turns on.
R0
F337 RAD, f45, DT20

Precaution during programming


This instruction F337 (RAD) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 332
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
Floating point type data 8 C32 CPU Ver. 2.1 or
F338 (DEG) radians → degrees later/FP0 T32

Outline Converts the units of an angle from radians to degrees.


Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F338 (DEG)
R0 DT 10
10 F338 DEG, DT10, DT20 DT 20

S D
S Angle data (radians) (2 words) or lower 16-bit area of 32-bit data
D Lower 16-bit area of 32-bit data for storing converted data

Operands
Index
Relay Timer/Counter Register Constant Integer
Operand register
device
WX WY WR SV EV DT IX IY K H f

S A A A A A A A A A A A
A: Available
D N/A A A A A A A N/A N/A N/A A N/A: Not Available

Description
The angle data in radians (real number data) specified in S+1 and S is converted to angle data in degrees and
the result is stored in D+1 and D.
15 0
Angle data (radians)
(Real number data) S: Lower word

S+1: Higher word

15 0
Angle data (degrees) Lower word
D:
(Real number data)
D+1: Higher word

3 - 333
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Specifying the integer device with [S], the integer data is internally converted to real numbers before
operations continue.
R0
F338 DEG, % DT 0, DT 4

Specifying the integer device with [D], the real numbers are automatically converted into integer data.
R0
F338 DEG, DT 0, % DT 4

When the constant K is specified in S, the operations are the same as when a integer device is specified.
For detailed information about the processing of specifying the integer device section 1.3

Program example
The “f30.00000” is stored to DT20 and DT21 when the R0 turns on.
R0
F338 DEG, f0.5235987, DT20

Precautions during programming


When the constant or integer device is specified in S, the integer device cannot be set in D.
This instruction F338 (DEG) cannot be used in the interrupt program.

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device specified
in “D+1 and D”.
S Error flag (R9008): Turns on for an instant when:
- The area specified using the index modifier exceeds the limit.
- If data other than real number data is specified in “S+1 and S”.
- If result of processing is outside integer range when integer device specified
in “D+1 and D”.
S = flag (R900B): Turns on when result of processing is recognized as “0.”
S Carry flag (R9009): Turns on for an instant when the result is overflowed.

3 - 334
FP0 High- level Instructions

3.3 Explanation of High - level Instructions


Step Availability
FP0 C10, C14, C16,
4 C32 CPU Ver. 2.1 or
F355 (PID) PID processing later/FP0 T32

Outline This instruction carries out PID processing.

Program example
Boolean
Ladder Diagram
Address Instruction
Trigger 10 ST R 0
11 F355 (PID)
R0 DT 10
10 F355 PID, DT 10

S
S Starting number of PID parameter area (30 words)

Operands
Index
Relay Timer/Counter Register Constant
Operand register
WX WY WR SV EV DT IX IY K H f
A: Available
S N/A N/A N/A N/A N/A A N/A N/A N/A N/A N/A: Not Available

Description
PID processing is performed to hold the measured value specified by S+2 at the set value S+1, and the result
is output to S+3.
Derivative type or proportional - derivative type can be selected for the PID processing mode.
Set the PID processing coefficients (proportional gain, integral time and derivative time) and the processing
mode and cycle in the parameter table. PID processing will be performed based on these settings.

Types of PID Processing


Reverse operation and forward operation
When a process has been changed, the vertical direction of the output can be selected.
If the measured value drops, “Reverse operation” is specified to boost the output (heating, etc.).
If the measured value increases, “Forward operation” is specified to boost the output (cooling, etc.).

Derivative type (PI - D) / Proportional - delivative type (I - PD)


Generally, with “derivative type PID control”, when a set value is changed, there is increased fluctuation in the
output, but convergence is faster.
Generally, with “proportional - delivative type PID control”, when a set value is changed, there is less
fluctuation in the output, but convergence is slower.

3 - 335
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Flag conditions
S Error flag (R9007): Turns on and stays on when:
- The value set for the parameter is out of range.
- The area specified using the index modifier exceeds the limit.
S Error flag (R9008): Turns on for an instant when:
- The value set for the parameter is out of range.
- The parameter setting is outside allowed range.

Parameter Table Settings


[S] Control mode
[S+1] Set value (SP)
[S+2] Measured value (PV)
[S+3] Output value (MV)
[S+4] Output lower limit value
[S+5] Output upper limit value
[S+6] Proportional gain (Kp)
[S+7] Integral time (Ti)
[S+8] Derivative time (Td)
[S+9] Control cycle (Ts)
[S+10] Auto-tuning progress
[S+11]

PID processing work area


[S+29]

Explanation of Parameters
1 Control mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S]
Select the type of PID processing and auto-tuning with the H constants.
Control mode Value of [S]
Auto- tuning Auto- tuning
when not executed when executed
Derivative type Reverse operation H0 H8000
Forward operation H1 H8001
Proportional - Reverse operation H2 H8002
delivative type
Forward operation H3 H8003

Auto-tuning
The optimum values for the Kp, Ti, and Td of the PID parameters can be measured by measuring the process
response. When auto tuning is executed, the estimated results are reflected in the parameter area after auto
tuning has been completed. (There may be cases in which auto tuning cannot be executed, depending on the
process. If this happens, processing returns to the original parameter operation.)
For precautions concerning execution of auto tuning, refer to the following page.

3 - 336
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

Reverse operation and forward operation


These parameters determine whether the output will increase or decrease when a change occurs in the
process.
Reverse operation
If the measured process value decreases, the output will increase. (Example: Heating)
Forward operation
If the measured process value increases, the output will increase. (Example: Cooling)
Derivative type PID and proportional - derivative type PID
When the set value is changed, the output changes.
Derivative type
In general this produces a large change when a set value is changed, however, convergence is fast.
Proportional - derivative type
In general this produces a small change when a set value is changed, however, convergence is slow.

2 Set value (SP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+1]


Set the target value which determines the amount of process control within the following range.
K0 to K10000
3 Measured value (PV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+2]

Input the current process control value with the A/D converter or other device. Adjust so that it falls within the
following range.
K0 to K10000
4 Output value (MV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+3]

The result of PID processing is stored. Use the D/A converter or other device to output it to the process.
K0 to K10000
5 Output lower limit value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+4]

K0 to K9999 (< upper limit value)


6 Output upper limit value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+5]

K1 to K10000 (> lower limit value)


Specify the output value (MV) range. Values specified for the range are not output.
The limits should be as follows:
0 ≦ output lower limit value < output upper limit value ≦ 10000.
7 Proportional gain (Kp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+6]

Specify the coefficient used for PID processing.


The set value × 0.1 will be the actual proportional gain.
The setting range is K1 to K9999 (0.1 to 999.9, specify in increments of 0.1)
If auto-tuning is selected for the specified control mode, the set value will be automatically
adjusted and rewritten.
8 Integral time (Ti) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+7]

Specify the coefficient used for PID processing.


The set value × 0.1 will be the actual integral time.
The setting range is K1 to K30000 (0.1 to 3000 seconds, specify in increments of 0.1 seconds)
When the set value is 0, the integration is not executes.
If auto-tuning is selected for the specified control mode, the set value will be automatically
adjusted and rewritten.

3 - 337
High - level Instructions FP0

3.3 Explanation of High - level Instructions

9 Derivative time (Td) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+8]


Specify the coefficient used for PID processing.
The set value × 0.1 will be the actual derivative time.
The setting range is K1 to K10000 (0.1 to 1000 seconds, specify in increments of 0.1 seconds)
If auto-tuning is selected for the specified control mode, the set value will be automatically
adjusted and rewritten.
10 Control cycle (Ts) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+9]

Set the cycle for executing PID processing. The set value × 0.01 will be the actual control period.
The setting range is K1 to K6000 (0.01 to 60.0 seconds, specify in increments of 0.01 seconds).
11 Auto-tuning progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+10]

If auto - tuning is specified in the control mode, the degree to which auto - tuning has progressed
is indicated. The values for K1 to K5 are stored based on the progress from the default value of 0,
and the values return to the default values when auto - tuning has been completed.
12 PID processing work area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [S+11] to [S+29]

The system uses this work area to perform PID processing.


Precautions when executing auto - tuning
If “Execute auto - tuning” is specified using the parameter table (control mode [S]), attention should be paid to
the following points.
After auto - tuning has been completed, the control mode [S] area is automatically rewritten from H8000 to
H8003 to H0 to H3. Make sure the mode is not rewritten again in the program.
After auto - tuning has been completed, the optimum values are stored for the proportional gain (Kp), the
integration time (Ti) and delivative time (Td), but before executing auto - tuning, the appropriate values (for
example, the lower limit value) within the setting range must be set.
After auto - tuning has been completed, the optimum values are stored for the proportional gain (Kp), the
integration time (Ti) and delivative time (Td). Be careful that the stored values are not inadvertently rewritten.
Precautions during programming
A 30-word area is required for the parameter table, including the work area for processing. Take care that
other instructions do not overwrite the values in this area.
An error will not be detected if the parameter table exceeds its area. When specifying S, select a number at
least 30 words before the last number.
Take care that the area is not exceeded due to index modification. An error will not be detected if the area is
exceeded.
Use the A/D converter or other device to input the current measured value S+2.
Use the D/A converter or other device to output the result of PID processing S+3 to the process.
This instruction F355 (PID) cannot be used in the interrupt program.

3 - 338
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

PID processing equations


MVn = MVn- 1 + ΔMV
Calculation of ΔMV
1 Derivative type (PI - D) and reverse operation
[S] = H0

ΔMV = Kp × {(en - en- 1) + en × Ts/Ti + ΔDn}

en : SP - PVn
ΔDn : (ηβ - 1) Dn- 1 + β (PVn- 1 - PVn)
η: 1/8 (fixed)
β: Td/(Ts + ηTd)

2 Derivative type (PI - D) and forward operation


[S] = H1 (or H8001)

ΔMV = Kp × {(en - en- 1) + en × Ts/Ti + ΔDn}

en :PVn - SP
ΔDn : (ηβ - 1) Dn- 1 + β (PVn - PVn- 1)
η: 1/8 (fixed)
β: Td/(Ts + ηTd)

3 Propotional - derivative type (I - PD) and reverse operation


[S] = H2

ΔMV = Kp × {(PVn- 1 - PVn) + en × Ts/Ti + ΔDn}

en : SP - PVn
ΔDn : (η β - 1)Dn- 1 + β (PVn- 1 - PVn)
η: 1/8 (fixed)
β: Td/(Ts + ηTd)

4 Propotional - derivative type (I - PD) and forward operation


[S] = H3

ΔMV = Kp × {(PVn - PVn- 1) + en × Ts/Ti + ΔDn}

en : PVn - SP
ΔDn : (ηβ - 1) Dn- 1 + β (PVn - PVn- 1)
η: 1/8 (fixed)
β: Td/(Ts + ηTd)

3 - 339
High - level Instructions FP0

3.3 Explanation of High - level Instructions

Operation of PID control


PID control is a control method widely used in the instrumentation field involving feedback control of process
quantities such as temperature, pressure, flow, and fluid level.
1) Proportional operation
Proportional operation generates an output which is proportional to the input.
Setting
signal SV + Offset e
Kp Output MV
-

Measurement
signal PV
e Kp=2
MV 2

Kp=1
1 1
Kp=.5
.5

0 t 0 t

The amount of control is held constant.


An offset remains.
Proportional control grows stronger as Kp is increased.

2) Integral operation
Integral operation generates an output which is proportional to the integral time of the input.
Setting
signal SV + Offset e Integral
Output mi
- operation
Measurement
mi=1/Tiedt signal PV
e mi

In combination with proportional operation or proportional - derivative operation, integral operation removes
the offset produced by these methods.
Integral operation grows stronger as the integral time (Ti) is shortened.

3 - 340
FP0 High- level Instructions

3.3 Explanation of High - level Instructions

3) Derivative operation
Derivative operation generates an output which is proportional to the derivative time of the input.
Setting
signal SV + Offset e Derivative
Output mD
- operation
Measurement
de signal PV
mD=TD S
dt
e mD

The advancing characteristic of derivative control alleviates the adverse effect which the delaying
characteristic of the process exerts on control.
Derivative control grows stronger as the derivative time (Td) is increased.
In the case of pure derivative operation, control can temporarily become ineffective if noise is input, and this
can have an adverse effect on the process being controlled. For this reason, incomplete differential operation
is executed.

e mD

4) PID operation
PID operation is a combination of proportional, integral, and derivative operation.

Setting +
signal SV Offset e Output MV
+ Integral +
Kp
- operation +

Derivative
Measurement signal PV
operation

If the parameters are set to the optimum values, PID control can quickly bring the amount of control to the
target value and maintain it there.

3 - 341
High - level Instructions FP0

3.3 Explanation of High - level Instructions

3 - 342
Chapter 4
Precautions During Programming

4.1 Use of Duplicated Output . . . . . . . . . . . . . . . . . . . . . . . . 4 - 3


4.1.1 Duplicated Output . . . . . . . . . . . . . . . . . . . . . . 4 - 3
4.1.2 When Output is Repeated with an OT, KP,
SET, or RST Instruction . . . . . . . . . . . . . . . . . 4 - 4

4.2 Handling BCD Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 5


4.2.1 BCD Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 5
4.2.2 Handling BCD Data in the PLC . . . . . . . . . . . 4 - 5

4.3 Handling Index Registers . . . . . . . . . . . . . . . . . . . . . . . . 4 - 7


4.3.1 Index Registers . . . . . . . . . . . . . . . . . . . . . . . . 4 - 7
4.3.2 Memory Areas Which can be Modified
with Index Registers . . . . . . . . . . . . . . . . . . . . 4 - 7
4.3.3 Example of Using an Index Register . . . . . . 4 - 8

4.4 Operation Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 10


4.4.1 Outline of Operation Errors . . . . . . . . . . . . . 4 - 10
4.4.2 Operation Mode When an Operation
Error Occurs . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 10
4.4.3 Dealing with Operation Errors . . . . . . . . . . . . 4 - 11
4.4.4 Points to Check in Program . . . . . . . . . . . . . 4 - 12

next page
Precautions During Programming FP0

4.5 Instruction of Leading Edge Detection Method . . . . 4 - 13


4.5.1 Instructions of Leading Edge Detection
Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 13
4.5.2 Operation and Precautions at Run
Start Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 14
4.5.3 Precautions When Using a Control
Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 16

4.6 Precautions for Programming . . . . . . . . . . . . . . . . . . . 4 - 18

4.7 Rewrite Function During RUN . . . . . . . . . . . . . . . . . . . 4 - 19


4.7.1 Operation of Rewrite During RUN . . . . . . . . 4 - 19
4.7.2 Cases Where Rewriting During Run is not
Possible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 20
4.7.3 Procedures and Operation of Rewrite
During RUN . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 21
4.7.4 Changing Modes in FP Programmer II . . . . 4 - 22

4.8 Changing the Set Value of Timer/Counter


During RUN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 23
4.8.1 Method of Rewriting Constant in FP
Programmer II . . . . . . . . . . . . . . . . . . . . . . . . 4 - 23
4.8.2 Method of Rewriting a Value in the Set
Value Area . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 - 24

4.9 Processing During Forced Input and Output . . . . . . 4 - 27

4- 2
FP0 Precautions During Programming

4.1 Use of Duplicated Output

4.1 Use of Duplicated Output

4.1.1 Duplicated Output

Duplicated output refers to repeatedly specifying the same output in a program.


If the same output is specified for the “OT” and “KP” instructions, it is considered to be
duplicated output.
Even if the same output is used for multiple instructions, such as the SET or RST
instruction, or high- level instruction for data transfer, it is not regarded as duplicated
output.
If you enter RUN mode while the duplicated output condition exists, under normal
conditions, it will be flagged as an error, the ERROR/ALARM LED will light and the
self-diagnostic error flag R9000 will go on.

How to Check for Duplicated Use


You can check for duplicated outputs in the program using the programming tool, by the
following method:
Using FP Programmer II:
Operate the TOTAL CHECK function.
(- ) READ
Key operation: OP
9 ENT

If there are any duplicated outputs, an error message (DUP USE) and the address will
be displayed.
Using NPST-GR software:
Excute the “TOTALLY CHECK A PROGRAM” on “CHECK A PROGRAM.”
If there are any duplicated outputs, an error message (DUPLICATED OUTPUT
ERROR) and the address will be displayed. If you execute “SEARCH AN ERROR,” the
error message will be displayed, and the first address number will be displayed.
The above shows the operation menu for the “NPST - GR” tool software.
The “FPWIN GR” tool software has a similar operation menu.
For information on operating the menus, please check the “Help” menu.

Enabling Duplicated Output


If you need to use output repeatedly due to the content of the program, duplicated
output can be enabled.
In this case, change the setting of system register 20 to ”enable” (when using FP
Programmer II, set K1).
When this is done, an error will not occur when the program is executed.

4- 3
Precautions During Programming FP0

4.1 Use of Duplicated Output

4.1.2 When Output is Repeated with an OT, KP, SET, or RST Instruction

Condition of Internal and Output Relays During Operation


When instructions are repeatedly used which output to internal and output relays such
as transfer instructions and OT, KP, SET and RST instructions, the contents are
rewritten at each step during operation.

Example: Processing when SET, RST and OT instructions are used (X0 to
X2 are all on).
X0 R0
S

R0
This section of the program is
processed as if R0 were on.

X1 R0
R

This section of the program is


processed as if R0 were off.

X2 R0

This section of the program is


processed as if R0 were on.

The output is determined by the final operation results


If the same output is used by several instructions such as the OT, KP, SET, RST, or data
transfer instructions, the output obtained at the I/O update is determined by the results
of the operation at the greatest program address.

Example: Output to the same output relay Y0 with OT, SET and RST
instructions.
X0 Y0
Y0: on
X1 Y0
S Y0: on
X2 Y0
R Y0: off

When X0 to X2 are all on, Y0 is output as off at I/O update.


If you need to output a result while processing is still in progress, use a partial I/O update
instruction “F143 (IORF)”.

4- 4
FP0 Precautions During Programming

4.2 Handling BCD Data

4.2 Handling BCD Data

4.2.1 BCD Data

BCD is an acronym for binary - coded decimal, and means that each digit of a decimal
number is expressed as a binary number.

Example:
Expressing a decimal number in BCD:

Decimal number
Each digit is converted
to a binary number.

BCD 0110 0100 0101


(Binary - coded
decimal)

4.2.2 Handling BCD Data in the PLC

When inputting data from a digital switch to the PLC or outputting data to a 7 - segment
display (with a decoder), the data must be in BCD form. In this case, use a data
conversion instruction as shown in the examples at below.
BCD arithmetic instructions “F40 (B+) to F58 (DB - 1)” also exist which allow direct
operation on BCD data, however, it is normally most convenient to use BIN operation
instructions “F20 (+) to F38(D - 1)” as operation in the PLC takes place in binary.

Input From a Digital Switch


Use the BCD - to - BIN conversion instruction “F81 (BIN)”.
Digital 1 9 9 2 1 9 9 2
switch
Data inputted into 0 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0
the PLC (BCD data)

PLC BCD (Conversion


↓ using
BIN F81 (BIN) Data which can be 0 0 0 0 0 1 1 1 1 1 0 0 1 0 0 0
instruction) processed in the PLC
(BIN data) Converted to 1992 in decimal data.

4- 5
Precautions During Programming FP0

4.2 Handling BCD Data

Output to a 7 - segment Display (with Decoder)


Use the BIN - to - BCD conversion instruction “F80 (BCD)”.

BIN (Conversion Data processed in 0 0 0 0 0 1 1 1 1 1 0 0 1 0 0 0


PLC PLC (BIN data)
↓ using
BCD F80 (BCD)
instruction)
Data outputted from 0 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0
PLC (BCD data)
7-segment 1 9 9 2
display

4- 6
FP0 Precautions During Programming

4.3 Handling Index Registers

4.3 Handling Index Registers

4.3.1 Index Registers

Like other registers, index registers have two points, IX and IY, for reading and writing
16-bit data.
Use an index register to indirectly specify a memory area number. (This is also called
index modification.)

Example:
Transferring the contents of data register DT100 to the number
specified by the contents of an index register.
R0
F0 MV, DT100, IXDT0

Base memory area.

In this example, the number of the destination data register varies depending on the
contents of IX with DT0 acting as a base. For example, when IX contains K10 the
destination will be DT10, and when IX is K20, the destination will be DT20.
In this way, index registers allow the specification of multiple memory areas with a single
instruction, and thus index registers are very convenient when handling large amounts
of data.

4.3.2 Memory Areas Which can be Modified with Index Registers

Index registers can be used to modify other types of memory areas in addition to data
registers DT.
IXWX0, IXWY1, IXWR0, IXSV0, IXEV2, IXDT100
Constants can also be modified.
IXK10, IXH1001
An index register cannot modify another index register.
IXIX, IXIY
When using index modification with an instruction which handles 32-bit data, specify
with IX. In this case, IX and IY are handled together as 32-bit data.
Higher 16-bit area Lower 16-bit area

Contents of IY Contents of IX

4- 7
Precautions During Programming FP0

4.3 Handling Index Registers

4.3.3 Example of Using an Index Register

Repeatedly Reading in External Data

Example:
Writing the contents of word external input relay WX3 to a
sequence of data registers beginning from DT0.
R0
F0 MV, K0, IX 1

R1
DF F0 MV, WX3, IXDT0 2

F35 +1, IX 3

1 When R0 turns on, K0 is written to index register IX.


2 When the R1 turns on, the contents of WX3 is transferred to
the data register specified by IXDT0.
3 Add 1 to IX.
In this case, the contents of IX will change successively,
and the destination data register will be as follows.

Input times Contents of Destination


of R1 IX data register
1st 0 DT0
2nd 1 DT1
3rd 2 DT2
⋮ ⋮ ⋮

Inputting and Outputting Data Based on a Number Specified by an Input

Example 1: Setting a timer number specified by a digital switch

PLC

Timer 2 0 7 9 4 Timer set value


setting (timer time setting)
number
WX1 WX0
Digital
switches

4- 8
FP0 Precautions During Programming

4.3 Handling Index Registers

R0
DF F81 BIN, WX1, IX 1

F81 BIN, WX0, IXSV0 2

1 Convert the BCD timer number data in WX1 to binary and


set it in index register IX.
2 Convert the BCD timer set value in WX0 to binary and
stored in the timer set value area SV specified by contents
of IX.

Example 2: External output of the elapsed value in a timer number specified


by a digital switch
WY0

7-segmenet
Timer elapsed
indicator
value display

PLC

Timer
number 1 Digital
setting switches
WX1
R1
DF F81 BIN, WX1, IX 1

F80 BCD, IXEV0, WY0 2

1 Convert the BCD timer number data in WX1 to binary, and


set it in index register IX.
2 Convert the elapsed value data EV in the timer specified by
IX to BCD, and output it to word external output relay WY0.

4- 9
Precautions During Programming FP0

4.4 Operation Errors

4.4 Operation Errors

4.4.1 Outline of Operation Errors

An operation error is a condition in which operation is impossible when a high-level


instruction is executed.
When an operation error occurs, the ERROR/ALARM LED on the FP0 control unit will
blink and the operation error flags (R9007 and R9008) will turn on.
The operation error code “E45” is set at special data register DT9000.
The error address is stored in special data registers DT9017 and DT9018.
Types of Operation Error
Address error
The memory address (number) specified by index modification is outside the area which
can be used
BCD data error
Operation is attempted on non - BCD data when an instruction handling BCD is
executed, or BCD conversion is attempted on data which is not within the possible
conversion range.
Parameter error
In an instruction requiring the specification of control data, the specified data is outside
the possible range.
Over area error
The data manipulated by a block instruction exceeds the memory range.

4.4.2 Operation Mode When an Operation Error Occurs

Normally, the operation stops when an operation error occurs.


However, when you set system register 26 to “continuation” (KI), the FP0 control unit
operates even if an operation error occurs.
For detailed information section 8.4

4 - 10
FP0 Precautions During Programming

4.4 Operation Errors

4.4.3 Dealing with Operation Errors

Procedure:
1. Check the location of the error.
Check the address where the error occurred, which is stored in
DT9017 and DT9018, and make sure the high- level instruction for
that address is correct and appropriate.
2. Clear the error.
Use a programming tool to clear the error. (If the mode selector is set
to RUN, RUN will resume as soon as the error is cleared.)
In the “STATUS DISPLAY” menu of NPST - GR software, press the
Error clear “F3” key.
The above shows the menu for the “NPST - GR” tool software.
The “FPWIN GR” tool software has a similar menu.
For information on operating the menus, please check the “Help”
menu.
In FP Programmer II, press the following keys.
(- ) SHIFT (DELT)
ACLR 1 1 2 ENT
OP SC INST

An error can be cleared by turning the power off and on in PROG.


mode, however, the contents of the operation memory except the hold
type data will be cleared.
An error can also be cleared by executing a F148 (self-diagnostic
error set) instruction.

4 - 11
Precautions During Programming FP0

4.4 Operation Errors

4.4.4 Points to Check in Program

Check if an extraordinarily large value or negative value was stored in the index register.

Example: When a data register is modified using an index register


R0
F0 MV, DT0, IXDT0

In this case, index register (IX) modifies the address of data


register DT0. If data in IX is larger than the last address of the
data register, an operation error will occur. If the PLC you are
using is of the FP0 16-point type, the last address of the data
register is DT1659. If the data in IX exceeds the range of K0 to
K255, an operation error will occur. The same is true when the
contents of IX are negative.
Is there any data which cannot be converted using BCD ↔ BIN data conversion?

Example: When BCD - to - BIN conversion is attempted


R0
F81 BIN, DT0, DT100

In this case, if DT0 contains a hexadecimal number with one of


the digits A through F such as 12A4, conversion will be
impossible and an operation error will result.

Example: When BIN - to - BCD conversion is attempted


R0
F80 BCD, DT1, DT101

In this case, if DT1 contains a negative value or a value


greater than K9999, an operation error will occur.
Check if the divisor of a division instruction is K0.

Example:
R0
F32 %, DT0, DT100, DT200

In this case, if the content of DT100 is K0, an operation error


will occur.

4 - 12
FP0 Precautions During Programming

4.5 Instruction of Leading Edge Detection Method

4.5 Instruction of Leading Edge Detection Method

4.5.1 Instructions of Leading Edge Detection Method

Instructions Using the Leading Edge Detection Operation


DF (leading edge differential) instructions
Count input for CT instructions
Count input for F118 (UDC) instructions
Shift input for SR instructions
Shift input for F119 (LRSR) instructions
NSTP instructions

Leading Edge Detection Method


An instruction with a leading edge detection method operates only in the scan where
its trigger (execution condition) is detected switching from off to on.

Standard operation Leading edge differential operation


on on
Trigger off Trigger off

on on
off Operation of off
Operation of
instruction instruction
Executed only one time
Executed every scan

The condition of the previous execution and the condition of the current execution are
compared, and the instruction is executed only if the previous condition was off and the
current condition is on. In any other case, the instruction is not executed.

4 - 13
Precautions During Programming FP0

4.5 Instruction of Leading Edge Detection Method

Precautions When Using an Instruction Which Performs Leading Edge


Detection
When RUN begins, for example when the system is powered on, the off → on change
of the execution condition (trigger) is not detected. The instruction is not executed.
Execution of the instruction will take place as explained on section 4.5.2.
When used with one of the instructions indicated in instructions below which change
the order of execution of instructions, the operation of the instruction may change
depending on input timing. Take care regarding this point.
Be careful when using leading edge detection type instructions with control instructions,
such as:
MC and MCE instructions
JP and LBL instructions
LOOP and LBL instructions
CNDE instruction
Step ladder instructions
Subroutine instructions

4.5.2 Operation and Precautions at Run Start Time

Operation of first scan after RUN begins


The leading edge detection instruction is not executed when the mode has been
switched to the RUN mode, or when the power supply is booted in the RUN mode, if
the trigger (execution condition) is already on.
RUN
(Power on)

Trigger

Operation

Not executed Executed

If you need to execute an instruction when the trigger (execution condition) is on prior
to switching to RUN mode, use R9014 (initial pulse off relay) in your program on the
following page. (R9014 is a special internal relay which is off during the first scan and
turns on at the second scan.)

4 - 14
FP0 Precautions During Programming

4.5 Instruction of Leading Edge Detection Method

Example 1: DF (leading edge differential) instruction

X0 Y0
DF

Add R9014

X0 R9014 Y0
DF

RUN
(Power on)

X0

Y0

Even if X0 was initially on, the input condition (X0) for the DF
instruction is off - to - on at the second scan, therefore derivative output
is obtained.

Example 2: CT (counter) instruction

X0
CT 100

X1

Add R9014

X0 R9014
CT 100

X1

RUN
(Power on)

X0

CT100
counting
operation Even if X0 was initially on, the input condition (X0) for the counter
is off - to - on at the second scan, therefore the count is
incremented.

4 - 15
Precautions During Programming FP0

4.5 Instruction of Leading Edge Detection Method

4.5.3 Precautions When Using a Control Instruction

Instructions which leading edge detection compare the condition of the previous
execution and the condition of the current execution, and execute the instruction only
if the previous condition was off and the current condition is on. In any other case, the
instruction is not executed.
When a leading edge detection instruction is used with an instruction which changes
the order of instruction execution such as MC, MCE, JP or LBL, the operation of the
instruction may change as follows depending on input timing. Take care regarding this
point.

Example 1:
Using the DF instruction between MC and MCE instructions
X0
MC 0
X1 Y0
DF

MCE 0

Time chart 1

X0

X1

Y0

Previous
execution of DF The input condition (X1) for the DF instruction has
instruction not changed since the time of the previous
execution, thus derivative output is not obtained.

Time chart 2

X0

X1

Y0

Previous
execution of DF The input condition (X1) for the DF instruction has
instruction changed from off to on since the time of the previous
execution, thus derivative output is obtained.

4 - 16
FP0 Precautions During Programming

4.5 Instruction of Leading Edge Detection Method

Example 2:
Using the CT instruction between JP and LBL instructions
R0
JP 1
X0
CT 100
X1

LBL 1

Time chart 1

R0

X0

Counting
operation

Final timing at
which the The count is not incremented, because the final
previous JP timing at which the previous JP instruction was not
instruction was executed has not been changed, and the execution
not executed condition X0 for the counter input has not changed.

Time chart 2

R0

X0

Counting
operation

Final timing at
which the The count is incremented, because the count input
previous JP changed from off to on after the final timing at which
instruction the previous JP instruction was not executed.
was not
executed

4 - 17
Precautions During Programming FP0

4.6 Precautions for Programming

4.6 Precautions for Programming


Programs which do not execute correctly
Do not write the following programs as they will not execute correctly.
Program example 1:
Program in which the example 1 is rewritten
ANS
X0 X1 Y0 X0 X1 Y0
DF DF

X2 X0 X2

Program example 2:
Program in which the example 2 is rewritten
ANS
X0 X1 TMX5, K30 Y0 X0 X1 TMX 5, K 30 Y0

X2 X0 X2

Program example 3:
Program in which the example 3 is rewritten
PSHS
X0 X1 Y0 X0 X1 Y0

X2 Y1 X0 X2 Y1
DF DF

X3 X0 X3
RDS

POPS

When a combination of contacts are set as the trigger (execution condition) of a


differential instruction (DF) or timer instruction, do not use an AND stack (ANS)
instruction, read stack (RDS) instruction, or pop stack (POPS) instruction.

4 - 18
FP0 Precautions During Programming

4.7 Rewrite Function During RUN

4.7 Rewrite Function During RUN

4.7.1 Operation of Rewrite During RUN

How Operation of Rewrite During RUN


The FP0 allows program rewriting even in RUN mode. When a rewrite is attempted
during RUN, the tool service time is temporarily extended, program rewriting is
performed, and operation is resumed without the need to change the mode. For this
reason, the time of the scan during the RUN rewrite extends from several msec to
several hundreds of msec.

Operation During Rewrite


External output (Y) is held.
External output (X) is ignored.
The timer (T) stops the clock.
Rise and fall changes in the inputs of differential instructions (DF), counter instructions
(CT), and left/right shift registers [F119 (LRSR)] are ignored.
Interrupt functions are stopped.
Internal clock relays (special internal relays) are also stopped.
Pulse output is stopped during the rewrite.

Set Values for Timer/Counter Instructions


All set values specified with decimal constants (K) in timer and counter instructions are
preset in the corresponding set value areas (SV). Values in the elapsed value area (EV)
do not change.

Operation of Rewrite During RUN Completed Flag


The rewrite during RUN completed flag (R9034) is a special internal relay that goes on
for only the first scan following the completion of rewriting in the RUN mode. It can be
used instead of the initial pulse relay following a change in the program. (Supported in
CPU Ver. 2.0 and subsequent versions)

4 - 19
Precautions During Programming FP0

4.7 Rewrite Function During RUN

4.7.2 Cases Where Rewriting During Run is not Possible

Instructions which do not allow rewriting during RUN


Step ladder instructions (SSTP/STPE)
Subroutine instructions (SUB/RET)
Interrupt instructions (INT/IRET)
Control instructions (ED/LBL)
(LBL instructions allow insertion and writing, but not deletion and clearing.)
Instructions which do not allow rewriting to subprograms
The following instructions do not allow rewriting during subroutines or interrupt
programs.
Jump/label instructions (JP/LBL)
Loop/label instructions (LOOP/LBL)
Master control relay/master control relay end instructions (MC/MCE)
Cases where rewriting is not possible during RUN
When a syntax error has occurred.
During forced input/output operation

Interrupt Restrictions
When using interrupt, high-speed counter, pulse output or PWM output functions, do
not perform a rewrite during RUN.
If a rewrite during RUN is executed, the following problems may occur. Exercise caution.
Interrupt programs will be disabled. Enable by executing an ICTL instruction once
again.

Example: Using R9034 (rewrite during RUN completed flag)


R9013
ICTL, S1, S2
R9034

The high-speed counter will continue to count.


At 2.5 kHz or higher during one - phase, one channel counting or 1.25 Hz or higher
during one - phase, two channel counting, miscounts may occur.
Target value match on/off instructions (F166/F167) will continue.
Coincidence programs will be disabled.
Pulse output and PWM output will be stopped. The F168 instruction (positioning control)
will continue to operate.
However, when the maximum output frequency is higher than 2.5 kHz during
one - phase, one channel counting or 1.25 Hz during one - phase, two channel counting,
the output pulse number may differ from the set number.

4 - 20
FP0 Precautions During Programming

4.7 Rewrite Function During RUN

4.7.3 Procedures and Operation of Rewrite During RUN

Item NPST-GR NPST-GR FP Programmer II


Ladder symbol mode Boolean mode
Rewrite procedure Maximum of 128 steps. Rewriting performed by step.
Changes are performed by Caution is required as rewriting takes place simulta-
block. neously with the change.
When PG conversion is In the case of FP Programmer II, the mode must be
executed online, the pro- changed. (See section 4.7.4.)
gram will be rewritten.

Block a Block b

Operation of OT/KP If an instruction written in If an instruction written in block a is deleted in block


each block a is deleted in block b, b, the condition before the rewrite will be held.
instruction the condition before the re- Y contact relays which are on will be held in the on
write will be held. status. To turn them off in the RUN mode, use
forced output.
TM/CT If an instruction written in If an instruction written in block a is deleted in block
block a is deleted in block b, b, the condition before the rewrite will be held.
the condition before the re- Set values specified by K constants in TM/CT
write will be held. instructions are preset in all of the corresponding
Set values specified by K SV’s in the program. (Elapsed values EV do not
constants in TM/CT instruc- change.)
tions are preset in all of the In the case of FP Programmer II, set values can be
corresponding SV’s in the rewritten during operation without affecting the timer.
program. (Elapsed values For detailed information section 4.8
EV do not change.)
High-level If an instruction written in If deleted, the output memory area will be held.
instructions block a is deleted in block b,
the condition before the re-
write will be held.
MC/MCE When writing MC/MCE Writing or deleting a single instruction during RUN is
instructions, be sure to write not possible. Write or delete the instruction in NPST-
the instructions as a pair. GR ladder symbol mode.
CALL/SUB/ A subroutine is a program Write in the order: RET, SUB, CALL
RET appearing between SUBn Delete in the order: CALL, SUB, RET
and RET instructions. Be
sure to write it to an address
which follows the ED
instruction.
INT/IRET An interrupt program is a Write in the order: IRET, INT
program appearing between Delete in the order:INT, IRET
INTn and IRET instructions.
Be sure to write it to an ad-
dress which follows the ED
instruction.

next page

4 - 21
Precautions During Programming FP0

4.7 Rewrite Function During RUN

Item NPST-GR NPST-GR FP Programmer II


Ladder symbol mode Boolean mode
Operation of SSTP/STPE A distance with the same Writing and deletion of a single instruction is not
each instruc- number cannot be defined possible for a program with no step ladder area.
tion twice. Write or delete both instructions simultaneously in
An SSTP instruction cannot NPST-GR ladder symbol mode.
be written in a subprogram. In the case of an SSTP instruction only, writing and
deletion of a single instruction is possible for a pro-
gram with a step ladder area.
JP/LOOP/LBL Be sure to write the instruc- Write in the order: JP-LBL or LOOP-LBL.
tion for setting the loop num- Delete in the order: LBL-JP or LBL-LOOP.
ber before LBL-LOOP
instructions.

4.7.4 Changing Modes in FP Programmer II

Changing program modes


FP Programmer II is normally in PROG - EDIT mode which does not allow unintentional
rewriting of programs. To perform a rewrite during RUN, the mode must be changed to
RUN - EDIT mode.
Change the mode as shown below. After the rewrite, change back to PROG - EDIT
mode to prevent accidental rewriting.
Procedure for changing to RUN - EDIT mode
(- )
ACLR 1 4 ENT 1 WRT
OP

Procedure for changing to PROG - EDIT mode


(- )
ACLR 1 4 ENT 0 WRT
OP

4 - 22
FP0 Precautions During Programming

4.8 Changing the Set Value of Timer/Counter During RUN

4.8 Changing the Set Value of Timer/Counter During RUN

4.8.1 Method of Rewriting Constant in FP Programmer II

Timer set value This method rewrites the


value in the program.
X0 TMX 5,K 30

T5 Y0

Rewrite Method Using FP Programmer II


Example of changing the set value of timer 5 from K30 to K50
Procedure:
1. Read the address containing the timer instruction.
SHIFT TM ST SRC READ READ
5
SC T-SV X-WX

2. Clear the constant (K30).


(HELP)
CLR

3. Enter the new constant (K50).


(BIN)
5 0 WRT
K/H

Operation and Cautions After the Change


After the change, the timer or counter in operation will continue to run. Operation based
on the changed set value will be started the next time the execution condition changes
from off to on.
When this method is used, the program itself will change. Thus, when the mode is
changed and then set back to RUN or when the power is turned on, the changed set
value will be preset.

4 - 23
Precautions During Programming FP0

4.8 Changing the Set Value of Timer/Counter During RUN

4.8.2 Method of Rewriting a Value in the Set Value Area

Transfers to SV area when mode


changes to RUN mode.
Timer set value
SV5
X0 TMX5, K 30
30

T5 Y0
This method rewrites the value
in the set value area. The
program itself is not rewritten.

Changing values in the set value area SV


Values in the set value area SV can be changed with the following procedures.
- Method using the programming tool software (NPST - GR/FPWIN GR)
- Method using the FP Programmer II
- Method using the program (high-level instruction)
Operation and cautions after the change
After the change, the timer or counter in operation will continue to run. Operation based
on the changed set value will be started the next time the execution condition changes
from off to on.
With these methods, the value in the set value area SV will change, however, the
program itself will not change. Therefore, when the mode is changed and then set back
to RUN or when the power is turned on, operation will take place as follows:
When a set value in the program is specified by a constant K
The constant K is preset in the set value area SV. After the change, it will no longer be
effective.
When a set value in the program is specified by a set value area number
In the case of a non-hold type timer or counter, 0 is preset in the set value area SV. In the
case of a hold type timer or counter, the value changed by the method on the following
page is preset in the set value area SV.

4 - 24
FP0 Precautions During Programming

4.8 Changing the Set Value of Timer/Counter During RUN

Method 1: Method using the programming tool software (NPST-GR)


Select “MONITOR & TEST RUN” from the online menu, read the set value area SV of
the timer or counter using the data monitor, and change the value.
Register the area to be rewritten
Enter the numeric value

Procedure:
1. Move the cursor to the position to be registered.
2. Press the “F6 (ENTRY)” key.
3. Press the “F6” key and enter the timer number.
4. Press the “Esc” key to register.
5. Move the cursor to the position to be rewritten.
6. Press the “F4” key.
7. Press the “F7” key and enter the number.

The above shows the menu for the “NPST - GR” tool software.
The “FPWIN GR” tool software has a similar menu.
For information on operating the menus, please check the Help menu.

4 - 25
Precautions During Programming FP0

4.8 Changing the Set Value of Timer/Counter During RUN

Method 2: Method using the FP Programmer II


Use the word data monitor function to read the set value area SV of the timer or counter
to be changed, and rewrite the value.
Example of changing the value of SV0 from K30 to K50.
Procedure:
1. Execute word data monitor (OP8).
(- )
8 ENT
OP

2. Read SV0.
TM READ
0
T-SV

3. Clear SV0.
(HELP)
CLR

4. Write the new changing value.


(BIN)
5 0 WRT
K/H

Method 3: Method using the program (high-level instruction)


To change a set value of timer/counter based on an input condition, use a high-level
instruction as shown below to rewrite the value in the set value area SV of the desired
timer or counter.

Example: Changing the set value to K20 when input R0 turns on


R0
F0 MV, K20, SV3
R1 TMX 3, K50 When R0 turns on, the timer set value
changes from 5 seconds to 2 seconds.
T3 Y0

4 - 26
FP0 Precautions During Programming

4.9 Processing During Forced Input and Output

4.9 Processing During Forced Input and Output

Processing when forced input/output is initiated during RUN

Forced reset / reset processing

Input/output update

Forced set / reset processing

Operation

Forced set / reset processing

Peripheral service

Processing of external input (X)


Regardless of the state of the input from the input device, forced on/off operation will
take precedence at a contact specified for forced input/output. At this time, the input
LED will not blink, however, the area of input X in the operation memory will be rewritten.
Contacts not specified will read in the on/off state according to the condition of the input
from the input device.
Processing of external output (Y)
Regardless of the result of operation, forced on/off will take precedence at a contact
specified for forced input/output. At this time, the area of output Y in the operation
memory will be forcedly rewritten. External output will take place according to the
input/output update timing in the above diagram.
The on/off state of contacts not specified will be determined by the operation result.
Timer (T) and Counter (C)
Regardless of the timer/counter input condition, forced on/off operation will take
precedence at a contact specified for forced input/output. At this time, the contact of the
timer (T) or counter (C) in the operation memory will be rewritten. Timing and counting
will not take place during control.
The on/off state of contacts not specified will be determined by the operation result.

4 - 27
Precautions During Programming FP0

4.9 Processing During Forced Input and Output

4 - 28
Chapter 5
High - speed Counter/Pulse Output/
PWM Output

5.1 Outline of Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 3


5.1.1 Three Functions that Use Built- in High -
speed Counter . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 3
5.1.2 Performance of Built- in High - speed
Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 4

5.2 Specifications and Restricted Items . . . . . . . . . . . . . . . 5 - 5


5.2.1 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 5
5.2.2 Functions and Restrictions . . . . . . . . . . . . . . . 5 - 7

5.3 High - speed Counter Function . . . . . . . . . . . . . . . . . . . 5 - 9


5.3.1 Outline of High - speed Counter Function . . . 5 - 9
5.3.2 Types of Input Modes . . . . . . . . . . . . . . . . . . . 5 - 9
5.3.3 I/O Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 11
5.3.4 Instructions Used with High - speed
Counter Function . . . . . . . . . . . . . . . . . . . . . . 5 - 12
5.3.5 Sample Program . . . . . . . . . . . . . . . . . . . . . . 5 - 14

5.4 Pulse Output Function . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 18


5.4.1 Outline of Pulse Output Function . . . . . . . . 5 - 18
5.4.2 Control Mode . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 19
5.4.3 I/O Allocation and Wiring . . . . . . . . . . . . . . . 5 - 20
5.4.4 Instructions Used with Pulse Output
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 22
5.4.5 Sample Program for Positioning Control . . 5 - 25

next page
High - speed Counter/Pulse Output/ PWM Output FP0

5.5 PWM Output Function . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 33


5.5.1 Outline of PWM Output Function . . . . . . . . 5 - 33
5.5.2 Instruction Used with PWM Output
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 - 33

5- 2
FP0 High - speed Counter/Pulse Output/ PWM Output

5.1 Outline of Functions

5.1 Outline of Functions

5.1.1 Three Functions that Use Built - in High - speed Counter

Functions that use the built - in high - speed counter


There are three functions available when using the high- speed counter built into the
FP0.
High - speed counter function
The high- speed counter function counts external inputs such as those from sensors or
encoders. When the count reaches the target value, this function turns on/off the
desired output.

Roller Cutter

Lead wire, tape

Motor Inverter
START
Encoder STOP signal
Cutter blade
control signal
Encoder output is FP0
input to the high-
speed counter

Pulse output function


Combined with a commercially available motor driver, the pulse output function enables
positioning control. With the appropriate instruction, you can perform trapezoidal
control, home return, and JOG operation.
Stepping motor,
Servo motor
FP0 Pulse output
Y0 Motor
CW/CCW output driver
Y2
1

Pulse output
Y1 Motor
CW/CCW output driver
Y3
2
Stepping motor,
Servo motor

5- 3
High - speed Counter/Pulse Output/ PWM Output FP0

5.1 Outline of Functions

PWM output function


By using the appropriate instruction, the PWM output function enables a pulse output
of the desired duty ratio.
When you increase the pulse width...

heating
increases.
When you decrease it...

heating
decreases.

5.1.2 Performance of Built - in High - speed Counter

Channel number
There are four channels for the built - in high- speed counter.
The channel number allocated for the high- speed counter will change depending on
the function being used.

Counting range
K - 8388608 to K8388607
(HFF8000 to H7FFFFF)
(Coded 24 - bit binary)

5- 4
FP0 High - speed Counter/Pulse Output/ PWM Output

5.2 Specifications and Restricted Items

5.2 Specifications and Restricted Items

5.2.1 Specifications

Table of high - speed counter function specifications


Input/output contact number Built-in Memory area used Performance specifica- Related
being used high - tions instruc-
speed tions
On/off Count Input counter Control Elapsed Target Minimum Maximum
output mode contact channel flag value value input counting speed
number no. area area pulse
(value in width Using Using
parenthe- only 1 multi-
sis is re- chan- ple
set input) nel chan-
nels
Speci- Incre- X0 CH0 R903A DT9044, DT9046, 50 μs Max. Total of F0 (MV),
fy the mental (X2) DT9045/ DT9047/ 10 kHz 4 CH F1 (DMV),
de- input, DT90044, DT90046, with F166
sired Decre- DT90045 DT90047 max. (HC1S),
output mental 10 kHz F167
from input X1 CH1 R903B DT9048, DT9050, Max. (HC1R)
Y0 to (X2) DT9049/ DT9051/ 10 kHz
Y7 DT90048, DT90050,
DT90049 DT90051
X3 CH2 R903C DT9104, DT9106, 100 μs Max.
(X5) DT9105/ DT9107/ 5 kHz
DT90104, DT90106,
DT90105 DT90107
X4 CH3 R903D DT9108, DT9110, Max.
(X5) DT9109/ DT9111/ 5 kHz
DT90108, DT90110,
DT90109 DT90111
Speci- 2 - phas X0 CH0 R903A DT9044, DT9046, 250 μs Max. Total of
fy the e input, X1 DT9045/ DT9047/ 2 kHz 2 CH
de- Incre- (X2) DT90044, DT90046, with
sired mental/ DT90045 DT90047 max.
output decre- 2 kHz
from mental
Y0 to input, X3 CH2 R903C DT9104, DT9106, 500 μs Max.
Y7 Direc- X4 DT9105/ DT9107/ 1 kHz
tional (X5) DT90104, DT90106,
distinc- DT90105 DT90107
tion

Note
Reset input X2 can be set to either CH0 or CH1. Reset input X5
can be set to either CH2 or CH3.

5- 5
High - speed Counter/Pulse Output/ PWM Output FP0

5.2 Specifications and Restricted Items

Table of pulse output function specifications


Input/output contact number being used Built-in Memory area used Performance Related
high - specifications instruc
instruc-
Pulse Direction- Home Near speed Con- Elapsed Target for maximum tions
output al output input home counter trol value value output fre-
input channel flag area area quency
no.
Y0 Y2 X0 DT9052/ CH0 R903A DT9044, DT9046, Max. F0 (MV),
DT90052 DT9045/ DT9047/ 10 kHz for F1 (DMV),
<bit2> DT90044, DT90046, 1 - point output F168
DT90045 DT90047 Max. (SPD1),
5 kHz for F169 (PLS)
Y1 Y3 X1 DT9052/ CH1 R903B DT9048, DT9050, 2 - point output
DT90052 DT9049/ DT9051/
<bit6> DT90048, DT90050,
DT90049 DT90051

Note
The maximum 1-point output for instruction F168 (SPD1) is 9.5 kHz.

Table of PWM output specifications


Output number being used Built - in Memory area used Performance Related
high - speed specifications instructions
counter Control flag for output
channel no. frequency
Y0 CH0 R903A Frequency: F0 (MV),
0.15 Hz to 38 Hz F1 (DMV),
(CPU ver. 2.0 or lat- F170 (PWM)
er: 100 to 1 kHz)
Y1 CH1 R903B
Duty:
0.1 % to 99.9 %

5- 6
FP0 High - speed Counter/Pulse Output/ PWM Output

5.2 Specifications and Restricted Items

5.2.2 Functions and Restrictions

Channel
The same channel cannot be used by more than one function.
Example of prohibited application:
You cannot share CH0 with the high- speed counter and pulse output functions.

I/O number (input/output contact point)


The number allocated to each function cannot be used for normal input or outputs.
Example of prohibited application
When using CH0 for 2 - phase inputting with the high- speed counter function, you
cannot allot X0 and X1 to normal inputs.
When using Y0 for the pulse output function, you cannot allot origin input X0 to a normal
input.
When using Y0 for the pulse output (with directional output operating) function, you
cannot allot Y2 (directional output) to a normal input or output.
When using the high- speed counter with a mode that does not use the reset input, you
can allot the inputs listed in parenthesis in the specifications table to a normal input.
Example of allowable application
When using the high- speed counter with no reset input and 2 - phase input, you can
allot X2 to a normal input.

Restrictions on the execution of related instructions (F166 to F170)


When any of the instructions related to the high- speed counter (F166 to F170) are
executed, the control flag (special internal relay: R903A to R903D) corresponding to the
used channel turns on.
When the flag for a channel turns on, another instruction cannot be executed using that
same channel.
Example of prohibited application
While executing F166 (target value match on instruction) and flag R903A is in the on
state, F167 (target value match off instruction) cannot be executed with CH0.

5- 7
High - speed Counter/Pulse Output/ PWM Output FP0

5.2 Specifications and Restricted Items

Restrictions for maximum counting speed/pulse output frequency


The counting speed when using the high- speed counter function will differ depending
on the counting mode as shown in the table.

Example 1:
While in the incremental input mode and using the two
channels CH0 and CH1, if CH0 is being used at 8 kHz, then
CH1 can be used up to 2 kHz.

Example 2:
While in the 2 - phase input mode and using the two channels
CH0 and CH2, if CH0 is being used at 1 kHz, then CH2 can be
used up to 1 kHz.

The maximum output frequency when using the pulse output function will differ
depending on the output contact number as shown in the table.

Example 1:
When using either only Y0 or only Y1, the maximum output
frequency is 10 kHz.

Example 2:
When using the two contacts Y0 and Y1, the maximum output
frequency is 5 kHz.

When using the high- speed counter function and pulse output function, specifications
will differ depending on the conditions of use.

Example:
When using one pulse output contact with a maximum output
frequency of 5 kHz, the maximum counting speed of the
high - speed counter being used simultaneously is 5 kHz with
the incremental mode and 1 kHz with the 2 - phase mode.

5- 8
FP0 High - speed Counter/Pulse Output/ PWM Output

5.3 High - speed Counter Function

5.3 High - speed Counter Function

5.3.1 Outline of High - speed Counter Function

High - speed counter function


The high- speed counter function counts the input signals, and when the count reaches
the target value, turns on and off the desired output.
The high- speed counter function is able to count high- speed pulses of frequencies up
to 10 kHz.
To turn on an output when the target value is matched, use the target value match on
instruction (F166). To turn off an output, use the target value match off instruction
(F167).
Preset the output to be turned on and off with the SET/RET instruction.

Setting the system register


In order to use the high- speed counter function, it is necessary to set system registers
400 and 401. For detailed information section 8.4

5.3.2 Types of Input Modes

Incremental input mode


on
X0
off

Count 0 1 2 3 4 n-3 n-2 n-1 n

Decremental input mode


on
X0
off

Count n n-1 n-2 n-3 n-4 3 2 1 0

5- 9
High - speed Counter/Pulse Output/ PWM Output FP0

5.3 High - speed Counter Function

2 - phase input mode


(Incremental input: CW)
on
X0
off
on
X1
off

Count 0 1 2 n-1 n

(Decremental input: CCW)


on
X0
off
on
X1
off

Count n n-1 n-2 n-3 2 1

Incremental/decremental input mode (separate input mode)


on
X0
off
on
X1 off

Count 0 1 2 3 4 3 2 1 2 3 4 3

Increasing Decreasing Increasing Decreasing

Directional distinction mode


on
X0
off
on
X1 off

Count 0 1 2 3 4 3 2 1 0

Increasing Decreasing

5 - 10
FP0 High - speed Counter/Pulse Output/ PWM Output

5.3 High - speed Counter Function

5.3.3 I/O Allocation

The inputting, as shown in the table on section 5.2.1, will differ depending on the
channel number being used.
The output turned on and off can be specified from Y0 to Y7 as desired with instructions
F166 and F167.
When using CH0 with incremental input and reset input
Count input
X0

Reset input
X2

On and off output


Yn *

* The output turned on and off when values match can be specified from Y0 to Y7 as
desired.
When using CH0 with 2 - phase input and reset input
A phase input
X0
B phase input
X1
Reset input
X2

On and off output


Yn *

* The output turned on and off when values match can be specified from Y0 to Y7 as
desired.

5 - 11
High - speed Counter/Pulse Output/ PWM Output FP0

5.3 High - speed Counter Function

5.3.4 Instructions Used with High - speed Counter Function

High - speed counter control instruction (F0)


This instruction is used for counter operations such as software reset and count disable.
Specify this instruction together with the F0 (MV) instruction and the special data
register DT9052/DT90052.
Once this instruction is executed, the settings will remain until this instruction is
executed again.
Operations that can be performed with this instruction
Counter software reset.
Count enable/disable.
Hardware reset enable/disable.
Clear controls from high- speed counter instructions F166 to F170.
Clear target value match interrupt.

Example:
Performing a software reset
X7
DF F0 MV, H 1 , DT9052 ⋅⋅⋅⋅⋅⋅⋅ 1

F0 MV, H 0 , DT9052 ⋅⋅⋅⋅⋅⋅⋅ 2

In the above program, the reset is performed in step 1 and 0


is entered just after that in step 2 . The count is now ready for
operation. If it is only reset, counting will not be performed.
Elapsed value change and read instruction (F1)
This instruction changes or reads the elapsed value of the high- speed counter.
Specify this instruction together with the F1 (DMV) instruction and the special data
register DT9044/DT90044.
The elapsed value is stored as 32 - bit data in the combined area of special data
registers DT9044 and DT9045/DT90044 and DT90045.
Use this F1 (DMV) instruction to set the elapsed value.

Example 1:
Set the initial value of K3000 in the high - speed counter
(example of changing the elapsed value).
X7
DF F1 DMV, K3000, DT9044

5 - 12
FP0 High - speed Counter/Pulse Output/ PWM Output

5.3 High - speed Counter Function

Example 2:
Reads the elapsed value of the high - speed counter and
copies it to DT100.
X7
DF F1 DMV, DT9044, DT100

Each time the ED instruction is executed, the elapsed value is automatically transferred
from the elapsed value area to the special data registers DT9044 and DT9045/
DT90044 and DT90045.
Target value match on instruction (F166)
XA
DF F166 HC1S, K0, K10000, Y7

If the elapsed value (DT9044 and DT9045/DT90044 and DT90045) for channel 0
matches K10000, output Y7 turns on.

XB
DF F166 HC1S, K2, K20000, Y6

If the elapsed value (DT9104 and DT9105/DT90104 and DT90105) for channel 2
matches K20000, output Y6 turns on.
Target value match off instruction (F167)
XC
DF F167 HC1R, K1, K30000, Y4

If the elapsed value (DT9048 and DT9049/DT90048 and DT90049) for channel 1
matches K30000, output Y4 turns off.

XD
DF F167 HC1R, K3, K40000, Y5

If the elapsed value (DT9108 and DT9109/DT90108 and DT90109) for channel 3
matches K40000, output Y5 turns off.

5 - 13
High - speed Counter/Pulse Output/ PWM Output FP0

5.3 High - speed Counter Function

5.3.5 Sample Program

Wiring examples

FP0

Input terminal

X0
Operation
start X5

Encoder COM
input
Encoder
Motor

Output terminal Inverter

Operation Y0 Operation/Stop
+

- COM

Speed

0 5,000
Number of pulse

Y0

5 - 14
FP0 High - speed Counter/Pulse Output/ PWM Output

5.3 High - speed Counter Function

Positioning operations with a single speed inverter


When X5 is turned on, Y0 turns on and the conveyor begins moving. When the elapsed
value (DT9044 and DT9045) reaches K5000, Y0 turns off and the conveyor stops.

X5 R903A R102 R100


DF Positioning operations running

R100

R100 R101
DF Positioning operations start
R101
F1 DMV, K 0, DT 9044

F167 HC1R, K 0, K 5000, Y 0

R101 Y0
S Start signal to inverter
R903A R100 T0 R102
DF/ Completion pulse
(0.5 seconds)
R102 TMX 0, K 5

5 - 15
High - speed Counter/Pulse Output/ PWM Output FP0

5.3 High - speed Counter Function

Wiring example

FP0

Input terminal

Encoder
input X0
Operation X5
start
COM

Encoder
Motor

Output terminal
Inverter
High - speed Y0 Run/Stop
switching Y1 Fast/Slow
+
- COM

Speed

0 4,500 5,000
Number of pulse

Y0

Y1

5 - 16
FP0 High - speed Counter/Pulse Output/ PWM Output

5.3 High - speed Counter Function

Positioning operations with a double speed inverter


When X5 is turned on, Y0 and Y1 turn on and the conveyor begins moving. When the
elapsed value (DT9044 and DT9045) reaches K4500, Y1 turns off and the conveyor
begins decelerating. When the elapsed value reaches K5000, Y0 turns off and the
conveyor stops.

X5 R903A R103 R100


DF Positioning operations running

R100

R100 R101
DF Positioning operations start

R101
F1 DMV, K 0, DT 9044

F167 HC1R, K 0, K 5000, Y 0

R101 Y0
S Start signal to inverter

Y1
S High- speed signal to inverter

R100
F61 DCMP, K 4500, DT 9044

R100 R900C R102


Reaches deceleration point

R102 Y1
DF R Deceleration

R903A R100 T0 R103


DF/ Completion pulse (0.5 seconds)

R103 TMX 0, K 5

5 - 17
High - speed Counter/Pulse Output/ PWM Output FP0

5.4 Pulse Output Function

5.4 Pulse Output Function

5.4.1 Outline of Pulse Output Function

Instructions used and control settings


The pulse function enables positioning control by use in combination with a
commercially available pulse- string input type motor driver.
Provides trapezoidal control with the instruction F168 for automatically obtaining pulse
outputs by specifying the initial speed, maximum speed, acceleration/deceleration
time, and target value.
Instruction F168 also enables automatic home return.
JOG operation with the instruction F169 for pulse output while the execution condition
(trigger) is in the on state.

Setting the system register


When using the pulse output function, set the channels corresponding to system
registers 400 to “Do not use high- speed counter.”
For detailed information section 8.4

5 - 18
FP0 High - speed Counter/Pulse Output/ PWM Output

5.4 Pulse Output Function

5.4.2 Control Mode

Incremental <relative value control>


Outputs the pulse of the pulse number set by the target value.
By setting H02 (incremental; forward: off; reverse: on) in the control code with
instruction F168, when the target value is positive, the directional output is turned off
and the elapsed value of the high- speed counter increases. When the target value is
negative, the directional output turns on and the elapsed value of the high- speed
counter decreases. By setting H03 in the control code, the directional output is the
reverse of that above.
For detailed information F168 (SPD1) and section 5.4.5

Absolute <absolute value control>


Outputs the pulse set by the difference between the current value and the target value.
(The difference between the current value and the target value is the output pulse
number.)
By setting H12 (absolute; forward: off; reverse: on) in the control code with instruction
F168, when the current value is less than the target value, the directional output is
turned off and the elapsed value of the high- speed counter increases. When the current
value is greater than the target value, the directional output turns on and the elapsed
value of the high- speed counter decreases. By setting H13 in the control code, the
directional output is the reverse of that above.
For detailed information F168 (SPD1) and section 5.4.5

Home return
Until the home input (X0 or X1) is entered by executing instruction F168, the pulse is
continuously output.
To decelerate the movement when near the home, set the bit corresponding to DT9052/
DT90052 to off → on → off → with the near home input.
For detailed information F0 (MV), F168 (SPD1) and section 5.4.5

JOG operation
Pulses are output from the specified channel while the trigger for instruction F169 is in
the on state.
The directional output and output frequency are specified by instruction F169.
For detailed information F169 (PLS) and section 5.4.5

5 - 19
High - speed Counter/Pulse Output/ PWM Output FP0

5.4 Pulse Output Function

5.4.3 I/O Allocation and Wiring

Single pulse input driver (pulse input and directional switching input)
One output point is used as a pulse output and the other output is used as a directional
output.
The pulse output terminal, directional output terminal, and home input I/O allocation is
determined by the channel used. For detailed information section 5.2.1
Near home input is substituted by allocating the desired contact point and turning on
and off the specified bit of DT9052/DT90052.
For detailed information F0 (MV)
Up to two driver systems can be connected.
When using CH0
FP0
Home input
X0
*
X2
Near home
input Driver
Pulse output
Y0
Y2
Directional
switching output

* The near home input specifies the desired input, such as X2.
When using CH1
FP0
Home input
X1
*
X3
Near home
input Driver
Pulse output
Y1
Y3
Directional
switching output

* The near home input specifies the desired input, such as X3.

5 - 20
FP0 High - speed Counter/Pulse Output/ PWM Output

5.4 Pulse Output Function

Double pulse input driver (CW pulse input and CCW pulse input)
Since a double pulse input is used, switching must be performed by an external relay.
One output contact is used as a pulse output for relay switching.
The pulse output terminal and home input I/O allocation is determined by the channel
used. For detailed information section 5.2.1
Set the control code for instruction F168 to “No directional output.”
For detailed information F168 (SPFD1)

When using CH0


FP0
Home input
X0
*
X2
Near home
input CW Driver
Pulse input
Y0 output

** CCW
Y4 input

* X2 or other desired input can be specified for the near home input.
** Y4 or other desired output can be specified for the relay switching. At this time, the relay
must be switched earlier by the amount of its operation time.

Caution when using a double pulse input driver


When using the FP0 pulse outputs Y0 and Y1 for direct connection to the CW input and
CCW input of a driver, the counter elapsed values for the separate channels (ch0 and
ch1) increase and decrease in response to the individual outputs. The elapsed values
can thus be sent to the program as necessary.
FP0 Driver
CW input
Y0

CCW input
Y1

5 - 21
High - speed Counter/Pulse Output/ PWM Output FP0

5.4 Pulse Output Function

5.4.4 Instructions Used with Pulse Output Function

Positioning control instruction (F168)


Automatically performs trapezoidal control according to the specified data table.
X3
DF F0 MV, H102, DT100

F0 MV, K500, DT101

F0 MV, K5000, DT102

F0 MV, K200, DT103

F1 DMV, K10000, DT104

F0 MV, K0, DT106

F168 SPD1, DT100, H0

Generates a pulse from output Y0 at an initial speed of 500 Hz, a maximum speed of
5000 Hz, an acceleration/deceleration time of 200 msec, and a movement amount of
10000 pulses.
5000 Hz

10000 pulses

500 Hz
0 Hz

200 msec 200 msec

At this time the high- speed counter elapsed value (DT9044 and DT9045/DT90044 and
DT90045) will be increasing.

Notes
• For trapezoidal control, set the initial speed to no more than
5000 Hz.
• For details on troubleshooting procedures when no pulse is
output when instruction F168 (SPD1) is executed, refer to page
5 - 32.

5 - 22
FP0 High - speed Counter/Pulse Output/ PWM Output

5.4 Pulse Output Function

Pulse output instruction (F169)


This instruction is for JOG operation by obtaining a pulse from the desired output when
the execution condition (trigger) turns on.
X2
F0 MV, H112, DT200

F0 MV, K300, DT201

F169 PLS, DT200, H0

While X2 is in the on state, a pulse of 300 Hz with a duty ratio of 10% is output from Y0.
At this time, directional output (Y2) is off and the count of the elapsed value for the
high- speed counter CH0 (DT9044 and DT9045/DT90044 and DT90045) increases.

X6
F0 MV, H123, DT200

F0 MV, K700, DT201

F169 PLS, DT200, H1

While X6 is in the on state, a pulse of 700 Hz with a duty ratio of 10% is output from Y1.
At this time, directional output (Y3) is off and the count of the elapsed value for the
high- speed counter CH1 (DT9048 and DT9049/DT90048 and DT90049) decreases.

High - speed counter control instruction (F0)


This instruction is used for resetting the built - in high- speed counter, stopping the pulse
outputs, and setting and resetting the near home input.
Specify this instruction together with the F0 (MV) instruction and the special data
register DT9052/DT90052.
Once this instruction is executed, the settings will remain until this instruction is
executed again.
Operations that can be performed with this instruction
Clear controls (stopping the pulse outputs) from high- speed counter instructions F166
to F170.
Near home processing for home return operations.

5 - 23
High - speed Counter/Pulse Output/ PWM Output FP0

5.4 Pulse Output Function

Example 1: Enable the near home input during home return operations and
begin deceleration.
X3
DF F0 MV, H 4 , DT9052 ..... 1

F0 MV, H 0 , DT9052 ..... 2

In the above program, the near home input is enabled in step


1 and 0 is entered just after that in step 2 to perform the
preset operations.

Example 2: Performing a forced stop of the pulse output.


X7
DF F0 MV, H 8 , DT9052

F0 MV, H 0 , DT9052

Elapsed value write and read instruction (F1)


This instruction is used to read the pulse number counted by the built - in high- speed
counter.
Specify this instruction together with the F1 (DMV) instruction and the special data
register DT9044/DT90044.
The elapsed value is stored as 32 - bit data in the combined area of special data
registers DT9044 and DT9045/DT90044 and DT90045.
Use this F1 (DMV) instruction to set the elapsed value.

Example 1: Set the initial value of K3000 in the high - speed counter (example
of writing the elapsed value).
X7
DF F1 DMV, K3000, DT9044

Example 2: Reads the elapsed value of the high - speed counter to DT100.
X7
DF F1 DMV, DT9044, DT100

Each time the ED instruction is executed, the elapsed value is automatically transferred
from the elapsed value area to the special data registers DT9044 and DT9045/DT90044
and DT90045.

5 - 24
FP0 High - speed Counter/Pulse Output/ PWM Output

5.4 Pulse Output Function

5.4.5 Sample Program for Positioning Control

Wiring example
FP0
Input terminal
Home sensor X0

Positioning start X1

Positioning start X2

Home return start X3

Near home sensor X4

Forward JOG start X5

Reverse JOG start X6

Overrun X7

COM a contact

b contact a contact b contact


Stepping motor Moving table
(- side) (+ side)

Stepping motor driver


Output
terminal COM
Pulse output Y0 Pulse input
COM

Directional output Y2 Directional


input

+
See
note.
-
24 V DC
power supply

. Note
When the stepping motor input is a 5 V photo - coupler type,
connect a 2 KΩ 1/4 W resistor.

5 - 25
High - speed Counter/Pulse Output/ PWM Output FP0

5.4 Pulse Output Function

Relative value positioning operation (plus direction)


When X1 turns on, a pulse is output from Y0. At this time, directional output Y2 does
not turn on.
X1 R903A R12 R10
DF Positioning operations running
R10

R10 R11
DF Positioning operations start
R11
DT100 Control code: H102
F0 MV, H 102, DT 100
[refer to “instruction
F0 MV, K 500, DT 101 F168 (SPD1)”]
DT101 Initial speed: 500 Hz
F0 MV, K5000, DT 102
DT102 Maximum speed:
F0 MV, K 200, DT 103 5000 Hz
F1 DMV, K10000, DT 104 DT103 Acceleration/decelera-
tion time: 200 msec
F0 MV, K 0, DT 106 DT104 Movement amount:
DT105 10000 pls
F168 SPD1, DT 100, H 0
DT106 Pulse stop
R903A R10 T0 R12
DF/ Positioning completion pulse (1 sec)
R12 TMX 0, K10

5000 Hz
(- side) (+ side)
Motor 10000 pulses
10000
pulses

500 Hz
0 Hz

200 msec 200 msec

5 - 26
FP0 High - speed Counter/Pulse Output/ PWM Output

5.4 Pulse Output Function

Relative value positioning operation (minus direction)


When X2 turns on, a pulse is output from Y0. At this time, directional output Y2 turns
on.
X2 R903A R22 R20
DF Positioning operations running
R20

R20 R21
DF Positioning operations start
R21
DT100 Control code: H102
F0 MV, H 102, DT 100
[refer to “instruction
F0 MV, K1000, DT 101 F168 (SPD1)”]
DT101 Initial speed: 1000 Hz
F0 MV, K6000, DT 102
DT102 Maximum speed:
F0 MV, K 300, DT 103 6000 Hz
F1 DMV, K - 8000, DT 104 DT103 Acceleration/decelera-
tion time: 300 msec
F0 MV, K 0, DT 106 DT104 Movement amount:
DT105 - 8000 pls
F168 SPD1, DT 100, H 0
DT106 Pulse stop
R903A R20 T1 R22
DF/ Positioning completion pulse (1 sec)
R22 TMX 1, K10

6000 Hz
(- side) (+ side)
Motor 8000 pulses
8000
pulses

1000 Hz
0 Hz

300 msec 300 msec

5 - 27
High - speed Counter/Pulse Output/ PWM Output FP0

5.4 Pulse Output Function

Absolute value positioning operation


When X1 is turned on, pulses are output from Y0. If the current value at that point is
larger than ”22,000”, the direction output Y2 goes on, and if the value is smaller than
”22,000”, the direction output Y2 does not go on.
X1 R903A R32 R30
DF Positioning operations running
R30

R30 R31
DF Positioning operations start
R31
DT100 Control code: H112
F0 MV, H 112, DT 100
[refer to “instruction
F0 MV, K 200, DT 101 F168 (SPD1)”]
DT101 Initial speed: 200 Hz
F0 MV, K4000, DT 102
DT102 Maximum speed:
F0 MV, K 250, DT 103 4000 Hz
F1 DMV, K22000, DT 104 DT103 Acceleration/decelera-
tion time: 250 msec
F0 MV, K 0, DT 106 DT104
Target value: 22000
DT105
F168 SPD1, DT 100, H 0
DT106 Pulse stop
R903A R30 T2 R32
DF/ Positioning completion pulse (1 sec)
R32 TMX 2, K10

(- side) (+ side)

Motor

(10,000) 22,000 (30,000)

4000 Hz
Regardless of the current value, its movement
is towards position “22,000.”

200 Hz
0 Hz

250 msec 250 msec

5 - 28
FP0 High - speed Counter/Pulse Output/ PWM Output

5.4 Pulse Output Function

Home return operation (minus direction)


When X3 turns on, a pulse is output from Y0 and the return to home begins. At this time,
directional output Y2 turns on. Then, when X4 turns on, deceleration begins, and when
X0 turns on, home return is completed. After the return to home is completed, the
elapsed value (DT9044 and DT9045/DT90044 and DT90045) are cleared to 0.
X3 R903A R42 R40
DF Home return operations running
R40

R40 R41
DF Home return operation start
R41
DT200 Control code: H123
F0 MV, H 123, DT 200
[refer to “instruction
F0 MV, K 100, DT 201 F168 (SPD1)”]
DT201 Initial speed: 100 Hz
F0 MV, K2000, DT 202
DT202 Maximum speed:
F0 MV, K 150, DT 203 2000 Hz
F168 SPD1, DT 200, H 0
DT203 Acceleration/decelera-
tion time: 150 msec
R903A R40 T3 R42
DF/ Home return completion pulse
R42 TMX 3, K10

X4
DF F0 MV, H 4, DT9052 Near home deceleration start
F0 MV, H 0, DT9052

Near home
sensor Home sensor
(- side) (+ side) X3: on X4: on X0: on

Motor
2000 Hz

100 Hz
0 Hz
X0 X4
Home Near 150 msec 150 msec
sensor home
sensor

5 - 29
High - speed Counter/Pulse Output/ PWM Output FP0

5.4 Pulse Output Function

Home return operation (plus direction)


When X3 turns on, a pulse is output from Y0 and the return to home begins. At this time,
directional output Y2 does not turn on. Then, when X4 turns on, deceleration begins,
and when X0 turns on, home return is completed. After the return to home is completed,
the elapsed value (DT9044 and DT9045/DT90044 and DT90045) are cleared to 0.
X3 R903A R52 R50
DF Home return operations running
R50

R50 R51
DF Home return operation start
R51
DT200 Control code: H122
F0 MV, H 122, DT 200
[refer to “instruction
F0 MV, K 120, DT 201 F168 (SPD1)”]
DT201 Initial speed: 120 Hz
F0 MV, K2500, DT 202
DT202 Maximum speed:
F0 MV, K 100, DT 203 2500 Hz
F168 SPD1, DT 200, H 0 DT203 Acceleration/decelera-
tion time: 100 msec
R903A R50 T4 R52
DF/ Home return completion pulse
R52 TMX 4, K10

X4
DF F0 MV, H 4, DT9052 Near home deceleration start
F0 MV, H 0, DT9052

Near home
sensor Home sensor
(- side) (+ side) X3: on X4: on X0: on

Motor
2500 Hz

120 Hz
0 Hz
X4 X0
Near Home 100 msec 100 msec
home sensor
sensor

5 - 30
FP0 High - speed Counter/Pulse Output/ PWM Output

5.4 Pulse Output Function

JOG operation (plus direction)


While X5 is in the on state, a pulse is output from Y0. At this time, directional output Y2
does not turn on.
X5
F0 MV, H 112, DT 300
DT300 Control code: H112
F0 MV, K 300, DT 301
[refer to “instruction
F169 (PLS)”]
F169 PLS, DT 300, H 0 DT301 Speed: 300 Hz

(- side) (+ side) on
X5
off
Motor
300 Hz
Y0(Pulse)
0 Hz

JOG operation (minus direction)


While X6 is in the on state, a pulse is output from Y0. At this time, directional output Y2
turns on.
X6
F0 MV, H 122, DT 310
DT310 Control code: H122
F0 MV, K 300, DT 311
[refer to “instruction
F169 (PLS)”]
F169 PLS, DT 310, H 0 DT311 Speed: 300 Hz

(- side) (+ side) on
X6
off
Motor
300 Hz
Y0(Pulse)
0 Hz

Emergency stop (over limit)


If X7 turns off while a pulse is being output from Y0, the output of the pulse is stopped.
X7
DF/ F0 MV, H 8, DT9052
Pulse output control clear
F0 MV, H 0, DT9052

5 - 31
High - speed Counter/Pulse Output/ PWM Output FP0

5.4 Pulse Output Function

Troubleshooting flowchart if a pulse is not output when instruction F168


(SPD1) executed
Yes
Error occurs

No
[F168 SPD1, j, Kj]
Yes Remedy
Yes Special internal
Remedy relay R903A or R903B problem
problem is already on. Not set to K0 or K1.

No No

Control clear
Remedy Yes flag for special data regis- First word
problem ter DT9052/DT90052 of data table is not set Yes Remedy
is on. to incremental (0), absolute problem
(1), or home
No return (2).

No
Remedy Yes HSC CH0 or CH1
is set to system
problem register 400.
Second word of
No data table is set to 40 ≦ No Remedy
initial speed ≦ problem
maximum
Elapsed value speed.
Modify Yes tried to output pulse in
elapsed forward direction at Yes
value. H7FFFFF.

No
Fifth word of data
table is set to HFF8000
No Remedy
≦ target value ≦ problem
Modify Elapsed value
Yes H7FFFFF.
tried to output pulse in
elapsed reverse direction at
value. HFF8000. Yes

No
Please contact your dealer.

Set to home Yes


return mode

No Home input is
already used by
Yes Remedy
interrupt or HSC. problem

No
Please contact your dealer.
Set to absolute Yes
mode

No Absolute mode Yes Remedy


setting is target value
= elapsed problem
Please contact your dealer. value.

No
Please contact your dealer.

5 - 32
FP0 High - speed Counter/Pulse Output/ PWM Output

5.5 PWM Output Function

5.5 PWM Output Function

5.5.1 Outline of PWM Output Function

PWM output function


With the instruction F170 (PWM), the specified duty ratio and pulse width modulation
is obtained.
Applicable to analog controls such as temperature control and light modulation.
Setting the system register
When using the PWM output function, set the channels corresponding to system
registers 400 to “Do not use high- speed counter.” For detailed information section
8.4

5.5.2 Instruction Used with PWM Output Function

PWM output instruction (F170)


X6
F0 MV, H5, DT100

F0 MV, K500, DT101

F170 PWM, DT100, K0

While X6 is in the on state, a pulse with a period of 840 msec and duty ratio of 50% is
output from Y0.

X7
F0 MV, H6, DT100

F0 MV, K300, DT101

F170 PWM, DT100, K1

While X7 is in the on state, a pulse with a period of 1.6 sec and duty ratio of 30% is output
from Y1.

5 - 33
High - speed Counter/Pulse Output/ PWM Output FP0

5.5 PWM Output Function

5 - 34
Chapter 6
General - use Serial Communications

6.1 General - use Serial Communications Function . . . . . 6 - 3


6.1.1 General - use Serial Communications . . . . . . 6 - 3
6.1.2 Data Transmission . . . . . . . . . . . . . . . . . . . . . . 6 - 3
6.1.3 Data Reception . . . . . . . . . . . . . . . . . . . . . . . . 6 - 4

6.2 System Register Settings . . . . . . . . . . . . . . . . . . . . . . . 6 - 5

6.3 Explanation of Operations When Using General - use


Serial Communication . . . . . . . . . . . . . . . . . . . . . . . . . . 6 - 8
6.3.1 If “None” is Set for Start and Terminal Codes 6 - 8
6.3.2 If “Yes” has been Set for the Start and
Terminal Codes
(Start Code: STX, Terminal Code: ETX) . . . 6 - 9
General - use Serial Communications FP0

6- 2
FP0 General - use Serial Communications

6.1 General - use Serial Communications Function

6.1 General - use Serial Communications Function

6.1.1 General - use Serial Communications

Using the RS232C port, data and commands can be sent to and received from an
external device such as a bar code reader. This is done by executing the F144 (TRNS)
instruction.
Transmission and reception are not enabled in the default settings, so system register
412 must be changed to a general- use port (K2).
The transmission speed (baud rate) and transmission format are set using system
register 413 and 414.

6.1.2 Data Transmission

Any desired data register can be prepared as the transmission table, and the data
stored in that table transmitted.
Start and terminal codes are automatically added to the data being transmitted, and the
data is sent. (For details, see “F144 (TRNS)” instruction.)
The data register to be used as the transmission table is specified using the F144
(TRNS) instruction.
Data transmission is executed using the F144 (TRNS) instruction.
There is no restriction on the number of bytes that can be transmitted. Any number of
bytes may be sent, as long as it does not exceed the range that can be used by the data
register.

Table for transmission

Transmission

Transmitteddata
storage area

External device
(PC, etc.)

6- 3
General - use Serial Communications FP0

6.1 General - use Serial Communications Function

6.1.3 Data Reception

Data sent from an external device is received at the RS232C port.


The received data is automatically stored in the data register specified as the reception
buffer. (For details see “F144 (TRNS)” instruction.)
Data registers used as reception buffers are specified by system register 417 and 418.
Data reception is enabled by the F144 (TRNS) instruction.

Reception buffer

Reception
Received data
storage area

External device
(bar code reader, etc.)

6- 4
FP0 General - use Serial Communications

6.2 System Register Settings

6.2 System Register Settings

Preparation for Sending and Receiving Data (System Register Settings)


Communication is not enabled in the default settings for the RS232C port. To enable
communication, the items outlined below must be specified, using the system registers.
- Usage purpose of the RS232C port
- RS232C transmission format
- Baud rate
- Reception buffer

Setting the Usage Purpose of the RS232C Port (System Register 412)
Specify “General - use port” (this is K2 for the FP Programmer II). This is the setting
which enables serial communication.

Setting the RS232C Transmission Format (System Register 413)


The transmission format is as follows in the default settings. (With the FP Programmer
II, this is H3.)
Data length: 8 bits
Parity check: Yes/odd
Stop bit: 1 bit
Terminal code: CR
Start code: STX None

Set these items to match the external device connected to the RS232C port, and if
changing the transmission format, enter settings for the pertinent individual items.
With the FP Programmer II, the various items should be selected in bit units, as shown
below, and settings entered using H constants.
15 6 5 4 3 2 1 0

Start code 0:STX None


1:STX Yes

Terminal code 00:CR 01:CR and LF


10: None 11:ETX

Stop bit 0:1 bit


1:2 bits

Parity 00: None 01: Yes (odd)


11:Yes (even)

Data length 0:7 bits 1:8 bits

next page

6- 5
General - use Serial Communications FP0

6.2 System Register Settings

Start codes (STX) and terminal codes (EXT)


When data is transmitted, the specified code is added automatically to the data being
sent. When receiving data, if ”Yes” has been specified for the start code parameter, data
following the start code is stored in the reception buffer. Also, at the point at which the
terminal code is received, the reception completed flag (R9038) goes on. The start and
terminal codes themselves are not stored in the reception buffer, however. For details,
see section 6.3.2.

Note
If no terminal codes are specified for either transmission or
reception, the reception completed flag will not go on. In this
case, watch the number of bytes received to determine whether
the reception has been completed.

Example: Changing the terminal code to [CR and LF]


Data length
Parity check
Stop bit
Terminal code
Start code

0 0 0 1 0 0 1 1

H1 H3
b
Change H3 (default value) to H13.

6- 6
FP0 General - use Serial Communications

6.2 System Register Settings

Setting the Baud Rate (System Register 414)


The baud rate (transmission speed) for general- use serial communication is set to
“9600 bit/s” (H1) in the default settings.
To change this setting to match the external device connected to the RS232C port,
select one of the values listed below.
H 0 0

Tool port RS232C port


H0: 9600 bit/s H0: 19200 bit/s
H1: 19200 bit/s H1: 9600 bit/s
H2: 4800 bit/s
If anything other than H0 or H3: 2400 bit/s
H1 is set for the baud rate of H4: 1200 bit/s
tool port, the baud rate will H5: 600 bit/s
be 9600 bit/s. H6: 300 bit/s

Example: Setting 19,200 bit/s for both the tool port and RS232C port
' Write H100.

Setting the Reception Buffer (System Registers 417 and 418)


In the default settings, all areas of the data registers are set to be used as reception
buffers. To change the area of the data register used as the reception buffer, specify the
initial number in system register 417, and the volume (number of words) in system
register 418.
The reception buffer is configured as shown below.

Initial area specified with Number of


system register 417 reception bytes

Received data Number of words specified


storage area by system register 418

6- 7
General - use Serial Communications FP0

6.3 Explanation of Operations When Using General - use Serial Communication

6.3 Explanation of Operations When Using General - use


Serial Communication

6.3.1 If “None” is Set for Start and Terminal Codes

Relationship between the flags (reception completed flag and


transmission completed flag) and the F144 (TRNS) instruction
External received A B C CR D E F G
data
Cannot be stored when
reception completed
flag is on
on
R9038
Reception
completed flag off

F144 (TRNS) on
Duplex transmission dis-
instruction abled while F144 (TRNS) in-
execution off struction is being executed
on
R9039
Transmission
completed flag off

Transmitted data 1 2 3 CR

Stored

Reception A A A A E E E
buffer B B B B F B
C C C C G

Number of recep- <1> <2> <3> <0> <1> <2> <3>


tion bytes
Write pointer Number of bytes received is
cleared when F144 (TRNS)
instruction is executed

Half - duplex transmission should be used for general- use serial communication.
Reception is disabled when the reception completed flag (R9038) is on.
Be aware that the reception completed flag (R9038) changes even while a scan is in
progress. (Example: If the reception completed flag is used multiple times as an input
condition, there is a possibility of different statuses existing within the same scan.)
When the F144 (TRNS) instruction is executed, the error flag (R9037), reception
completed flag (R9038) and transmission completed flag (R9039) go off.
Duplex transmission is disabled while the F144 (TRNS) instruction is being executed.
Check the transmission completed flag (R9039) to determine whether duplex
transmission is possible.

6- 8
FP0 General - use Serial Communications

6.3 Explanation of Operations When Using General - use Serial Communication

When the F144 (TRNS) instruction is executed, the number of bytes received is cleared,
and the address (write pointer) returns to the initial address in the reception buffer.
Reception stops if the error flag (R9037) goes on. To resume reception, execute the
F144 (TRNS) instruction. This turns off the error flag, and transmits both actual and
empty data.

6.3.2 If “Yes” has been Set for the Start and Terminal Codes
(Start Code: STX, Terminal Code: ETX)

When receiving data


External
received A B C STX D E ETX F G STX H ETX
data
Cannot be The reception
code is deleted by
stored when
the F144 (TRNS)
on reception instruction.
completed
R9038 flag is on
Reception com-
off
pleted flag
on The reception com-
F144 (TRNS) pleted flag is turned off
by executing the F144
instruction (TRNS) instruction.
execution off

Stored

Reception A A A A D D D D G G H H
buffer B B B B E E E E E E E
C C C C C C C C C C

Number of recep- <1> <2> <3> <0> <1> <2> <2> <0> <1> <0> <1> <1>
tion bytes Number of Number of bytes Number of
Write pointer
bytes received received is cleared bytes received
is cleared when when F144 (TRNS) is cleared when
start code is instruction is exe- start code is
received. cuted. received.

The data is stored in the reception buffer in sequential order, but at the point at which
the start code is received, the number of bytes received is cleared, and the address
(write pointer) is returned to the initial address in the reception buffer.
When the F144 (TRNS) instruction is executed, the number of bytes received is cleared,
and the address (write pointer) is returned to the initial address in the reception buffer.
If there are two start codes, data following the later start code is overwritten and stored
in the reception buffer.
Reception is disabled while the reception completed flag (R9038) is on.
The reception completed flag (R9038) is turned off by the F144 (TRNS) instruction.
Because of this, if the F144 (TRNS) instruction is executed at the same time that the
terminal code is received, the reception completed flag will not be detected.

6- 9
General - use Serial Communications FP0

6.3 Explanation of Operations When Using General - use Serial Communication

When sending data


Transmitted data STX a b ETX STX c d e ETX

Transmission Transmission

on
R9039
Transmission
completed flag
off

on Duplex transmission
disabled while F144
F144 (TRNS) in- (TRNS) instruction is
struction execution off being executed

Send buffer a a a a c c c c c
b b b b d d d d d
e e e e e

Number of bytes not yet sent <2> <1> <0> <0> <3> <2> <1> <0> <0>

Transmission point

Start codes (STX) and terminal codes (ETX) are automatically added to the data being
transmitted, and the data is transmitted to an external device. (For information on start
and terminal code settings, see section 6.2.)
Executing the F144 (TRNS) instruction turns off the transmission completed flag
(R9039).
Duplex transmission is disabled while the F144 (TRNS) instruction is being executed.
Check the transmission completed flag (R9039) to determine whether duplex
transmission is possible.

6 - 10
Chapter 7
Programming for FP0 Analog I/O Unit

7.1 Analog I/O Unit Programs . . . . . . . . . . . . . . . . . . . . . . . 7 - 3


Programming for FP0 Analog I/O Unit FP0

7- 2
FP0 Programming for FP0 Analog I/O Unit

7.1 Analog I/O Unit Programs

7.1 Analog I/O Unit Programs


The data transmission instruction F0 (MV) is used to read data from the analog I/O unit,
and to write it to the unit.

Analog input
Program example
Digital values which have been converted in the analog I/O unit are stored in any desired
data register.

R9010
F0 MV , WX2 , DT0

Area where converted data is stored

I/O no. for analog I/O unit input section


(Refer to section 8.2.)

Data transmission instruction

If “0 to 20 mA DC input” has been specified for the input range in the above program,
the values of K0 to 4000 are stored in DT0.

Configuration diagram
Analog
CPU I/O unit

A/D Input (analog value) from


conver- external device to analog
sion I/O unit (WX2)

7- 3
Programming for FP0 Analog I/O Unit FP0

7.1 Analog I/O Unit Programs

Analog output
Program example
Digital values which have been stored in any desired data register are transferred to the
analog output area.
R9010
F0 MV , DT10 , WY2

I/O no. for analog I/O unit output section


(Refer to section 8.2.)

Register where input


data is stored

Data transmission instruction

If “0 to 20 mA DC output” has been specified for the output range in the above program,
writing data of range of K0 to 4000 to DT10 causes 0 to 20 mA DC to be output from
the analog I/O unit.

Configuration diagram
Analog
CPU I/O unit

Output (analog value) to


D/A external device from
conver- analog I/O unit (WY2)
sion

Precautions during programming


The I/O numbers for the specified analog I/O unit input and output sections vary
depending on the installed position of the analog I/O unit. Refer to the section 8.2 for
the I/O numbers.
Data values undergoing A/D and D/A conversion vary depending on the range used.
Refer to the “FP0 Hardware manual” for the range.

7- 4
Chapter 8
Appendix

8.1 Performance Specifications . . . . . . . . . . . . . . . . . . . . . . 8 - 3

8.2 I/O Allocation Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 7

8.3 Relays, Memory Areas and Constants . . . . . . . . . . . . 8 - 9

8.4 Table of System Registers . . . . . . . . . . . . . . . . . . . . . . . 8 - 11


8.4.1 System Registers . . . . . . . . . . . . . . . . . . . . . . . 8 - 11
8.4.2 Content of System Register Settings . . . . . 8 - 13
8.4.3 Table of System Registers . . . . . . . . . . . . . . 8 - 15

8.5 Table of Special Internal Relays . . . . . . . . . . . . . . . . . 8 - 26

8.6 Table of Special Data Registers . . . . . . . . . . . . . . . . . 8 - 29

8.7 Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 39


8.7.1 Error Confirmation When “ERROR/ALARM
LED” Turns ON . . . . . . . . . . . . . . . . . . . . . . . . 8 - 39
8.7.1.1 Error Confirmation Method . . . 8 - 39
8.7.1.2 Syntax Check Error . . . . . . . . . . 8 - 39
8.7.1.3 Self - diagnostic Error . . . . . . . . 8 - 40
8.7.2 Table of Syntax Check Error . . . . . . . . . . . . 8 - 41
8.7.3 Table of Self - diagnostic Error . . . . . . . . . . . 8 - 42

8.8 FP0 - SL1 S - LINK Address . . . . . . . . . . . . . . . . . . . . . 8 - 43

8.9 Binary/Hexadecimal/BCD Expressions . . . . . . . . . . . 8 - 44

8.10 ASCII Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 - 45


Appendix FP0

8- 2
FP0 Appendix

8.1 Performance Specifications

8.1 Performance Specifications


Item Relay output type Transistor output type S - LINK
type
C10RS/ C14RS/ C16T/ C32T/ T32C SL1
C10RM/ C14RM/ C16P/ C32P/
C10CRS/ C14CRS/ C16CT/ C32CT/
C10CRM C14CRM C16CP C32CP
Programming method/Control method Relay symbol/Cyclic operation
Controllable I/O Basic unit Total: 10 Total: 14 Total: 16 Total: 32 Total: 32 Max. 128
points Input: 6 Input: 8 Input: 8 Input: 16 Input: 16 Input: 64
Output: 4 Output: 6 Output: 8 Output: 16 Output: 16 Output: 64
at S - LINK
block
With expansion Max. 58 Max. 62 Max. 112 Max. 128 Max. 128 Max. 96
unit 1 at
When config- expansion
ured with same block
output type as
control unit
With expansion Max. 106 Max. 110 Max. 112 Max. 128 Max. 128
unit 2
When relays
and transistors
are mixed
Program memory Built - in memory Built in EEPROM (without battery)
Program capacity 2,720 steps 5,000 steps 10,000 5,000 steps
steps
Numbers of Basic 83
i t
instruction
ti High-level 115
Operation speed 0.9μs/step (by basic instruction)
I/O refresh and base time With no expansion board: 0.3ms
With expansion board(s): 0.3ms and (1 x number of expansion boards) ms
Operation Relay Internal relay (R) 1,008 points (R0 to R62F) 1,008 1,008
memory points (R0 points (R0
points to R62F) to R62F)
(* Note 1)
Special internal 64 points (R9000 to R903F)
relay (R)
Timer/Counter 144 points (initial setting is 100 timer points, T0 to T99 / 44 counter
(T/C) points, C100 to C143 (* Note 2))
Timer range: 1ms, 10ms, 100ms, 1s; selected by instruction
Memory Data register 1,660 words (DT0 to DT1659) 6,144 16,384 6,144
area (DT) words words words
(DT0 to (DT0 to (DT0 to
DT6143) DT16383) DT6143)
(* Note 1)
Special data 112 words (DT9000 to DT9111) 112 words 112 words
register (DT) (DT90000 (DT9000
to to
DT90111) DT9111)
Index register 2 words
(IX, IY)
Differential points (DF, DF/) Unlimited of points
Master control relay points (MCR) 32 points
Number of labels (JP and LOOP) 64 labels 255 labels 64 labels

next page

8- 3
Appendix FP0

8.1 Performance Specifications

Item Relay output type Transistor output type S - LINK


type
C10RS/ C14RS/ C16T/ C32T/ T32C SL1
C10RM/ C14RM/ C16P/ C32P/
C10CRS/ C14CRS/ C16CT/ C32CT/
C10CRM C14CRM C16CP C32CP
Number of step ladders 128 stages 704 stages 128
(* Note 1) stages
Number of subroutines 16 subroutines 100 sub- 16 sub-
routines routines
Number of interrupt programs 7 programs (external 6 points, internal 1 point) 1 program
(internal 1
point)
Self-diagnosis function Such as watchdog timer, program syntax check
Clock/calender function Not available Available Not
(* Note 3) available
Special Pulse catch input Total 6 points Not
functions X0 to X1: 50μsec available
Interrupt input
X2 to X5: 100μsec
RS232C port Transmission speeds: 300/600/1200/2400/4800/9600/19200bit/s
(* Note 4) Transmission distance: 3m/9.84ft.
(Only units with an Terminal block: 3 - pin, made by phoenix Contact Co.
RS232C port) (products number: MKDS1/3 - 3.5)
Communication method: Half - duplex
Periodical interrupt 0.5ms to 30s interval
Constant scan Available
High- speed counter Counter mode: Not
function available
Addition/subtraction (one phase) (* Note 7)
(* Note 5, 6)
- Input point number:
Four channels maximum
- Maximum counting speed:
10kHz maximum for all 4 channels
- Input contacts used:
X0: count input (ch 0) X3: count input (ch 2)
X1: count input (ch 1) X4: count input (ch 3)
X2: reset input (*Note 8) X5: reset input (*Note 8)
- Minimum input pulse width:
X0, X1 50μs, <10kHz>
X3, X4 100μs, <5kHz>
Counter mode: Not
Two- phase/individual/direction decision (two- phase) available

- Input point number:


Two channels maximum
- Maximum counting speed:
2kHz maximum for all 2 channels
- Input contacts used:
X0: count input (ch 0) X3: count input (ch 2)
X1: count input (ch 0) X4: count input (ch 2)
X2: reset input X5: reset input
- Minimum input pulse width:
X0, X1 50μs, <10kHz>
X3, X4 100μs, <5kHz>

8- 4
FP0 Appendix

8.1 Performance Specifications

Item Relay output type Transistor output type S - LINK


type
C10RS/ C14RS/ C16T/ C32T/ T32C SL1
C10RM/ C14RM/ C16P/ C32P/
C10CRS/ C14CRS/ C16CT/ C32CT/
C10CRM C14CRM C16CP C32CP
Special Pulse Output point Not available Two independent points (Y0 and Not
functions p
output number Y1)(no interpolation function) available
f
func- Output Not available 40Hz to 10kHz (Y0/Y1: one- point Not
tion frequency output) available
(* Note 40Hz to 5kHz (Y0/Y1: two - point
6,10) output)
PWM Output point Not available Two points (Y0 and Y1) Not
p
output number available
f
func- Output Not available Frequency: 0.15Hz to Frequen- Not
tion frequency 38Hz, cy: available
(* Note (* Note 9) 0.15Hz to
6) 1KHz
Duty: 0.1% to 99.9%
Duty:
0.1% to
99.9%
Memory Program and system EEPROM
backup register
Operation memory Areas which are held if the power Areas The op- Areas
supply fails are fixed, and are which are eration which are
retained by the EEPROM. held if the memory is held if the
power backed up power
- Number of points/words of the supply using supply
fixed hold areas in the various fails are built - in fails are
memories fixed, and charge- fixed, and
Counters: 4 points are able (sec- are
Internal relays: 32 points retained ondary ) retained
Date registers: 8 words by the battery, so by the
EEPROM. the hold EEROM.
- Number type - Number
of points/ memory of points/
words of areas can words of
the fixed be speci- the fixed
hold areas fied using hold areas
in the the pro- in the
various gramming various
memories tools. memories
Counters: (* Note Counters:
16 points 11) 16 points

Internal - Memory Internal


relays: areas relays:
128 points which can 128 points
be speci-
Date fied: Date
registers: Timers, registers:
32 words Counters, 32 words
Internal
relays,
Data reg-
isters

next page

8- 5
Appendix FP0

8.1 Performance Specifications

Notes

1) Hold or non - hold type can be set using the system registers.
2) The proportion of timer points to counter points can be
changed using a system register 5.
3) Precision of calender timer:
At 0_C/32_F, less than 139 second error per month.
At 25_C/77_F, less than 72 seconds error per month.
At 55_C/131_F, less than 169 seconds error per month.
This accuracy is considered to be the worst fluctuation
coefficient value based on fluctuations in the normal voltage of
5V and the battery backup voltage of 3V. Also, F157 and F158
(time/date addition and subtraction instructions) cannot be
used.
4) When using the RS232C port for communication, we
recommend using resend processing. The driver IC for the
RS232C is in full conformance with EIA/TIA - 232E and CCITT
V.28 standards.
5) The combinations 1 phase × 2 channels and 2 phases × 1
channel are also possible for the high - speed counter.
6) For details and limitations on the high speed counter, pulse
output, and PWM output function, see sections 5.3 to 5.5.
7) The max. counting speed (10kHz) is the counting speed with a
rated input voltage of 24V DC and an ambient temperature of
25°C. The counting speed (frequency) will decrease depending
on the voltage and temperature.
8) If both reset inputs X0 and X1 are reset, X2 will be the reset
input of X1. In the same way, for X3 and X4, X5 acts as the
reset input of X4.
9) With a CPU of Ver. 1.2 or a subsequent version, the frequency
will be 0.15Hz to 1kHz.
10) The maximum is 9.5kHz when the positioning control
instruction (F168) is executed.
11) Precautions when using the battery backup function
Secondary (chargeable) battery is used as backup battery in
the FP0 T32C control unit. The battery is not charged before
the unit is shipped, so please make sure that the built - in
backup battery have been charged before using the unit. For
detailed information, refer to “FP0 Hardware manual.”

8- 6
FP0 Appendix

8.2 I/O Allocation Table

8.2 I/O Allocation Table

FP0 Control Units


The I/O allocation of the FP0 control unit is fixed.
Type of Control Unit I/O number
C10 series Input: 6 points X0 to X5
Output: 4 points Y0 to Y3
C14 series Input: 8 points X0 to X7
Output: 6 points Y0 to Y5
C16 series Input: 8 points X0 to X7
Output: 8 points Y0 to Y7
C32/T32
/ series Input: 16 points X0 to XF
Output: 16 points Y0 to YF

S - LINK Control Units


The I/O allocation of the S - LINK control unit is fixed.
Unit FP0 I/O S - LINK address
Input:
p 64 p
points X80 to X8F 0 to 15
X90 to X9F 16 to 31
X100 to X10F 32 to 47
X110 to X11F 48 to 63
Output:
p 64 p
points Y80 to Y8F 64 to 79
Y90 to Y9F 80 to 95
Y100 to Y10F 96 to 111
Y110 to Y11F 112 to 127

FP0 Expansion Units


The I/O allocation of the FP0 expansion unit is determined by order of connection.
Type
yp of Expansion
p Unit I/O number
First expansion Second Third expansion
expansion
E8X Input: 8 points X20 to X27 X40 to X47 X60 to X67
E8R Input: 4 points X20 to X23 X40 to X43 X60 to X63
Output: 4 points Y20 to Y23 Y40 to Y43 Y60 to Y63
E8YR/E8YT/E8YP Output: 8 points Y20 to Y27 Y40 to Y47 Y60 to Y67
E16X Input: 16 points X20 to X2F X40 to X4F X60 to X6F
E16R/E16T/E16P
/ / Input: 8 points X20 to X27 X40 to X47 X60 to X67
Output: 8 points Y20 to Y27 Y40 to Y47 Y60 to Y67
E16YT/E16YP Output: 16 points Y20 to Y2F Y40 to Y4F Y60 to Y6F
E32T/E32P
/ Input: 16 points X20 to X2F X40 to X4F X60 to X6F
Output: 16 points Y20 to Y2F Y40 to Y4F Y60 to Y6F

8- 7
Appendix FP0

8.2 I/O Allocation Table

Analog I/O Unit


The I/O allocations of the analog I/O unit are determined by the position at which the unit
is installed.
Type First expansion Second Third expansion
expansion
A21 Input: CH0 16 points WX2 WX4 WX6
(X20 to X2F) (X40 to X4F) (X60 to X6F)
Input: CH1 16 points WX3 WX5 WX7
(X30 to X3F) (X50 to X5F) (X70 to X7F)
Output: 16 points WY2 WY4 WY6
(Y20 to Y2F) (Y40 to Y4F) (Y60 to Y6F)

I/O Link Unit


The I/O allocation of the I/O link unit is determined by order of connection.
Type First expansion Second Third expansion
expansion
IOL Input: 32 points X20 to X3F X40 to X5F X60 to X7F
output: 32 points Y20 to Y3F Y40 to Y5F Y60 to Y7F

Expression of numbers for input/output relays


Since input/output relays X and Y are handled in units of 16 points, they are expressed
as a combination of decimal and hexadecimal numbers as shown below.

Example: External input relay “X”

Decimal
1, 2, 3 . . . . . 12

Hexadecimal
0, 1, 2, 3 . . . 9 A,B . . . F

X 0, X 1 ..................... X F
X 10, X 11 . . . . . . . . . . . . . . . . . . . . . X 1F
X 20, X 21 . . . . . . . . . . . . . . . . . . . . . X 2F
to to to
X 70, X 71 . . . . . . . . . . . . . . . . . . . . . X 7F

8- 8
FP0 Appendix

8.3 Relays, Memory Areas and Constants

8.3 Relays, Memory Areas and Constants


Item Numbering Function
C10/C14/ C32/SL1 T32
C16
Relays External input X 208 points (X0 to X12F) Turns on or off based on exter-
relay nal input.
External out- Y 208 points (Y0 to Y12F) Externally outputs on or off state.
put relay
Internal relay R 1,008 points Relay which turns on or off only
(* Note 1) (R0 to R62F) within program.
Timer T 144 points If a TM instruction has timed out,
(* Note 1) (T0 to T99/C100 to C143) the contact with the same num-
(* Note 2) ber turns on.
Counter C If a CT instruction has counted
(* Note 1) up, the contact with the same
number turns on.
Special internal R 64 points Relay which turns on or off
relay (R9000 to R903F) based on specific conditions and
is used as a flag.
Memory External input WX 13 words Code for specifying 16 external
Areas relay (WX0 to WX12) input points as one word (16 bits)
of data.
External output WY 13 words Code for specifying 16 external
relay (WY0 to WY12) output points as one word
(16 bits) of data.
Internal relay WR 63 words Code for specifying 16 internal
(* Note 1) (WR0 to WR62) relay points as one word (16 bits)
of data.
Data register DT 1,660 words 6,144 words 16,384 words Data memory used in program.
(* Note 1) (DT0 to (DT0 to (DT0 to Data is handled in 16- bit units
DT1659) DT6143) DT16383) (one word).
Timer/Counter SV 144 words Data memory for storing a
set value area (SV0 to SV143) target value of a timer and an
(* Note 1) initial value of a counter. Stores
by timer/counter number.
Timer/Counter EV 144 words Data memory for storing the
elapsed value area (EV0 to EV143) elapsed value during operation
(* Note 1) of a timer/counter. Stores by
timer/counter number.
Special data DT 112 words 112 words Data memory for storing
register (DT9000 to DT9111) (DT90000 specific data. Various settings
to DT90111) and error codes are stored.
Index register IX 2 words (IX, IY) Register can be used as an ad-
IY dress of memory area and
constants modifier.
Constant Decimal K K - 32768 to K32767 (for 16-bit operation)
constants
t t
K - 2147483648 to K2147483647 (for 32-bit operation)
Hexadecimal H H0 to HFFFF (for 16-bit operation)
constants
t t
H0 to HFFFFFFFF (for 32-bit operation)

next page

8- 9
Appendix FP0

8.3 Relays, Memory Areas and Constants

Notes

1) There are two unit types, the hold type that saves the
conditions that exist just before turning the power off or
changing from the RUN mode to PROG. mode, and the
non - hold type that resets them. These areas can be specified
as hold type or non - hold type by setting system register.
For the FP0 T32, the selection of hold type and non - hold type
can be changed by the setting of system register. For details
about the setting of system registers, refer to section 8.4. For
the FP0 C10/C14/C16/C32/SL1, that area is fixed and allotted
the numbers as shown below.

Hold type and non - hold type areas


Item C10/C14/C16 C32/SL1
Timer Non- hold type: All points
Counter Non-hold type From the set value to C139 From the set value to C127
Hold type 4 points (elapsed values) 16 points (elapsed values)
(C140 to C143) C128 to C143
Internal Non-hold type 976 points 880 points
relay (R0 to R60F) (R0 to R54F)
61 words 55 words
(WR0 to WR60) (WR0 to WR54)
Hold type 32 points (R610 to R62F) 128 points (R550 to R62F)
2 words (WR61 to WR62) 8 words (WR55 to WR62)
Data Non-hold type 1652 words 6112 words
register
g (DT0 to DT1651) (DT0 to DT6111)
Hold type 8 words 32 words (DT6112 to
(DT1652 to DT1659) DT6143)

2) The points for the timer and counter can be changed by the
setting of system register 5. The number given in the table are
the numbers when system register 5 is at its default setting.
For detailed about the system registers section 8.4

8 - 10
FP0 Appendix

8.4 Table of System Registers

8.4 Table of System Registers

8.4.1 System Registers

System register area


System registers are used to set values (parameters) which determine operation ranges
and functions used. Set values based on the use and specifications of your program.
There is no need to set system registers for functions which will not be used.

Types of system register


Allocation of timers and counters (System register 5)
The number of timers and counters is set by specifying the leading counter number.
Hold types and non - hold type settings (System register 6 to 8 and 14)
With the FP0, the areas held in the event of a power supply interruption are fixed, and
the settings for system register 6 to 8, and 14, will be invalid.
Operation mode settings for errors (System register 20, 23 ,26 and 27)
Set the operation mode effective when errors such as doplicated use of output,
operation, and I/O verification errors occur.
Time settings (System register 31 and 34)
Set the time - out error detection time and the constant scan time.
Input settings (System register 400 to 403)
When using the high- speed counter function, pulse catch function or interrupt function,
set the operation mode and the input number to be used as a special input.
Tool port settings (System register 410, 411 and 414)
Set the tool port parameters when computer link will be used.
RS232C port settings (System register 412 to 418)
Only applicable for unit with RS232C port.
Modem connection setting (System register 411)
Set to ”Modem connection” when the tool port will be used for modem communication.

8 - 11
Appendix FP0

8.4 Table of System Registers

Checking and changing system register settings


System register values (parameters) can be set with K or H constants.
If you are going to use a value which is already set (the value which appears when read),
there is no need to write it again.

Using programming tool software


Procedure:
1. Set the mode of the FP0 control unit to PROG.
2. Select the “SYSTEM REGISTER” in “PLC
CONFIGURATION” option from the NPST menu.
3. Select the function to be set in the “SYSTEM REGISTER”
in “PLC CONFIGURATION” screen. The value set in the
selected system register will appear.
4. To change a set value, write the new value as indicated
in the system register table.
5. Execute [Register] (f1) to write the data to the PLC.
The above shows the menu for the “NPST - GR” tool software.
The “FPWIN GR” tool software has a similar menu.
For information on operating the menus, please check the Help menu.

Using FP programmer II
Procedure:
1. Set the mode of the FP0 control unit to PROG.
2. Press the keys on the FP programmer II, as shown below.
(- )
ACLR 5 0 ENT
OP

3. Specify the register number (e.g. No.20) for the


parameter to be set and read the parameter.
The value set in the selected register will be displayed.
READ
2 0

4. To change the set value, press the <CLR (clear)> key and
write the new value as indicated in the system register
table.

8 - 12
FP0 Appendix

8.4 Table of System Registers

Precautions when setting system registers


System register settings are effective from the time they are set.
However, input, tool port, RS232C port, and modem connection settings become
effective when the mode is changed from PROG. to RUN. With regard to the modem
connection setting, when the power is turned off and on or when the mode is changed
from PROG. to RUN, the controller sends a command to the modem which enables it
for reception.
When the initialized operation is performed, all set system resister values (parameters)
will be initialized.

8.4.2 Content of System Register Settings

Setting the timers and counters (System register 5)


By indicating the counter start number, the timer and counter are split into two areas. The
timer and counter together total 144 points, and the default value for the split is 100. Thus
the point allotment is as shown in the table below.
Timer 100 points (No. 0 to No. 99)
Counter 44 points (No. 100 to No. 143)

Setting example
To increase the number of timers to 120, change the value of system register 5 to K120.
MIN (0): All counter
0

Timer Set value < n


Counter size increases
Set
value: n
Set value > n
Counter Timer size increases

144 MAX (144): All timer

For FP0 T32, set the system registers 5 and 6 to the same value. This sets the timer to
a non-hold type and counter to a hold type.
By setting system register 5 to “0”, the whole area becomes the counter. Also, by setting
it to the value “144”, the whole area becomes the timer.

8 - 13
Appendix FP0

8.4 Table of System Registers

Hold types and non - hold type settings (System registers 6 to 8 and 14)
With the FP0 C10/C14/C16/C32/SL1, the areas held in the event of a power supply
interruption are fixed at the areas shown in the table below, and the settings for system
registers 6 to 8 and 14, will be invalid.
C10/C14/C16
Timer Non-hold type: All points
Counter Non-hold type: From the set value to C139
Hold type: 4 points (elapsed values) C140 to C143
Internal relay Non-hold type: 976 points (R0 to R60F)
61 words (WR0 to WR60)
Hold type: 32 points (R610 to R62F)
2 words (WR61 to WR62)
Data register
g Non-hold type: 1652 words (DT0 to DT1651)
Hold type: 8 words (DT1652 to DT1659)

C32/SL1
Timer Non-hold type: All points
Counter Non-hold type: From the set value to C127
Hold type: 16 points (elapsed values) C128 to C143
Internal relay Non-hold type: 880 points (R0 to R54F)
55 words (WR0 to WR54)
Hold type: 128 points (R550 to R62F)
8 words (WR55 to WR62)
Data register
g Non-hold type: 6112 words (DT0 to DT6111)
Hold type: 32 words (DT6112 to DT6143)

With the FP0 T32, set each relay and register to a hold type or non-hold type.

Non-hold Setting value < n


type Hold type size increases
Setting
Setting value > n
value: n
Hold type Non-hold type size increases

For normal situations, set the system registers 5 and 6 to the same value. This sets the
timer to a non-hold type and counter to a hold type.
By setting this value to “0”, the whole area becomes hold type. Also, by setting it to the
value 1 higher than the last number, the whole area becomes non-hold type.
Default value
Type FP0 T32
Area
Timer All non- hold type
Counter All hold type
Internal Non - hold Non- hold type: 10 words (WR0 to WR9)
relay type
Hold type Hold type: 53 words (WR10 to WR62)
Data register All hold type

8 - 14
FP0 Appendix

8.4 Table of System Registers

8.4.3 Table of System Registers

C10, C14, C16, C32, T32 and SL1 in the table respectively indicate 10-point, 14-point,
16-point, 32-point type and S - LINK type FP0 control units.
Item Address Name Default Description
value
Allocation 0 Sequence program area The set values are fixed and cannot be
of user capacity changed.
memory The stored values vary depending on the
type.
K3: 3K words (FP0 C10, C14, C16)
K5: 5K words (FP0 C32, SL1)
K10: 10K words (FP0 T32)
1 to 3 Not used
Hold/ 5 Timer and counter division K100 K0 to K144
Non- hold (setting of starting counter
number)
6 to 8 Not used With the FP0 C10/C14/C16/C32/SL1, values
(Available type: C10, C14, set with the programming tool become invalid.
C16, C32, SL1)
6 Hold type area starting K100 K0 to K144 Set the system regis-
number setting for timer and ters 5 and 6 to the
counter same value.
(Available type: T32)
7 Hold type area starting K10 K0 to K63
number setting for internal
relays (in word units)
(Available type: T32)
8 Hold type area starting K0 K0 to K16384
number setting for data
registers
(Available type: T32)
9 to 13 Not used
14 Not used With the FP0 C10/C14/C16/C32/SL1, values
(Available type: C10, C14, set with the programming tool become invalid.
C16, C32, SL1)
Hold or non - hold setting K1 K0: Hold
for step ladder process
K1: Non- hold
(Available type: T32)
15 Not used
Action on 20 Disable or enable setting for K0 K0: Disable (will be syntax error)
error duplicated output K1: Enable (will not be syntax error)
21, 22 Not used
23 Operation setting when an K0 K0: Stop
I/O verification error occurs K1: Continuation
24, 25 Not used
26 Operation setting when an K0 K0: Stop
operation error occurs K1: Continuation
27 Operation settings when K1 K0: Stop
communication error occurs K1: Continuation
in the remote I/O (S - LINK)
system

8 - 15
Appendix FP0

8.4 Table of System Registers

Item Address Name Default Description


value
Action on 28, 29 Not used
error
4 Not used With the FP0, values set with the program-
ming tool become invalid.
Time 30 Unused
setting
tti
31 Wait time setting for K2600 K4 to K32760: 10 ms to 81900 ms
multi-frame communication (6500 ms) Used of default setting (K2600/ 6500 ms) is
recommended.
set value × 2.5 ms = Wait time setting for
multi - frame commu-
nication (ms)

In programming tool software,


enter the time (a number divisible
by 2.5).
In FP Programmer II, enter the set
value (equal to the time divided by
2.5).
32, 33 Unused With the FP0, values set with the program-
ming tool become invalid.
34 Constant value settings for K0 K1 to K64 (2.5 ms to 160 ms): Scans once
scan time each specified time interval.
K0: Normal scan
set value × 2.5 ms = Constant value setting
for scan time (ms)

In programming tool software,


enter the time (a number divisible
by 2.5).
In FP Programmer II, enter the set
value (equal to the time divided by
2.5).

8 - 16
FP0 Appendix

8.4 Table of System Registers

Item Ad- Name Default Description


dress value
Input 400 High-speed Setting by H0 CH0 0: Do not set input X0 as high-speed
setting counter mode programming counter.
settings (X0 to tool software 1: 2-phase input (X0, X1)
x2)
2: 2-phase input (X0, X1),
Reset input (X2)
3: Incremental input (X0)
4: Incremental input (X0),
Reset input (X2)
5: Decremental input (X0)
6: Decremental input (X0),
Reset input (X2)
7: Individual input (X0, X1)
8: Individual input (X0, X1),
Reset input (X2)
9: Direction decision (X0, X1)
10:Direction decision (X0, X1),
Reset input (X2)
CH1 0: Do not set input X1 as high-speed
counter.
3: Incremental input (X1)
4: Incremental input (X1),
Reset input (X2)
5: Decremental input (X1)
6: Decremental input (X1),
Reset input (X2)

Notes
• If the operation mode is set to 2 - phase, individual, or direction
differentiation, the setting for CH1 is invalid.
• If reset input settings overlap, the setting of CH1 takes
precedence.
• If system register 400 to 403 have been set simultaneously for
the same input relay, the following precedence order is
effective: [High - speed counter] ' [Pulse catch] ' [Interrupt
input].
• If the NPST - GR software is used, Ver. 4.0 or a subsequent
version is required for the settings of system register 400 to
403.

8 - 17
Appendix FP0

8.4 Table of System Registers

Item Ad- Name Default Description


dress value
Input 400 High-speed Setting by H0 CH0/ 0: Do not use high-
setting counter mode FP program- CH1 H 0 0 speed counter.
settings (X0 to mer II 1: 2-phase input (X0,
x2) X1)
2: 2-phase input (X0,
X1), Reset input
(X2)
3: Incremental input
(X0)
4: Incremental input
(X0), Reset input
(X2)
5: Decremental input
(X0)
6: Decremental input
(X0), Reset input
(X2)
7: Individual input (X0,
X1)
8: Individual input (X0,
X1), Reset input
(X2)
9: Direction dicision
(X0, X1)
A: Direction dicision
(X0, X1), Reset
input (X2)
0: Do not use high-
speed counter.
3: Incremental input
(X1)
4: Incremental input
(X1), Reset input
(X2)
5: Decremental input
(X1)
6: Decremental input
(X1), Reset input
(X2)

Notes
• If the operation mode is set to 2 - phase, individual, or direction
differentiation, the setting for CH1 is invalid.
• If reset input settings overlap, the setting of CH1 takes
precedence.
• If system register 400 to 403 have been set simultaneously for
the same input relay, the following precedence order is
effective: [High - speed counter] ' [Pulse catch] ' [Interrupt
input].
• If the NPST - GR software is used, Ver. 4.0 or a subsequent
version is required for the settings of system register 400 to
403.
8.4 Table of System Registers

8 - 18
FP0 Appendix

Item Ad- Name Default Description


dress value
Input 401 High-speed Setting by H0 CH2 0: Do not set input X3 as high-speed
setting counter mode programming counter.
settings (X3 to tool software 1: 2-phase input (X3, X4)
X5) 2: 2-phase input (X3, X4), Reset input
(X5)
3: Incremental input (X3)
4: Incremental input (X3), Reset input
(X5)
5: Decremental input (X3)
6: Decremental input (X3), Reset input
(X5)
7: Individual input (X3, X4)
8: Individual input (X3, X4), Reset input
(X5)
9: Direction decision (X3, X4)
10:Direction decision (X3, X4), Reset input
(X5)
CH3 0: Do not set input X4 as high-speed
counter.
3: Incremental input (X4)
4: Incremental input (X4), Reset input
(X5)
5: Decremental input (X4)
6: Decremental input (X4), Reset input
(X5)

Notes
• If the operation mode is set to 2 - phase, individual, or direction
differentiation, the setting for CH3 is invalid.
• If reset input settings overlap, the setting of CH3 takes
precedence.
• If system register 400 to 403 have been set simultaneously for
the same input relay, the following precedence order is
effective: [High - speed counter] ' [Pulse catch] ' [Interrupt
input].
• If the NPST - GR software is used, Ver. 4.0 or a subsequent
version is required for the settings of system register 400 to
403.

8 - 19
Appendix FP0

8.4 Table of System Registers

Item Ad- Name Default Description


dress value
Input 401 High-speed Setting by H0 CH2/ 0: Do not use
setting counter mode FP program- CH3 H 0 0 high-speed
settings (X3 to mer II counter.
X5) 1: 2-phase input (X3,
X4)
2: 2-phase input (X3,
X4),
Reset input (X5)
3: Incremental input
(X3)
4: Incremental input
(X3),
Reset input (X5)
5: Decremental input
(X3)
6: Decremental input
(X3),
Reset input (X5)
7: Individual input
(X3, X4)
8: Individual input
(X3, X4),
Reset input (X5)
9: Direction dicision
(X3, X4)
A: Direction dicision
(X3, X4),
Reset input (X5)
0: Do not use
high-speed
counter.
3: Incremental input
(X4)
4: Incremental input
(X4),
Reset input (X5)
5: Decremental input
(X4)
6: Decremental input
(X4),
Reset input (X5)

Notes
• If the operation mode is set to 2 - phase, individual, or direction
differentiation, the setting for CH3 is invalid.
• If reset input settings overlap, the setting of CH3 takes
precedence.
• If system register 400 to 403 have been set simultaneously for
the same input relay, the following precedence order is
effective: [High - speed counter] ' [Pulse catch] ' [Interrupt
input].
• If the NPST - GR software is used, Ver. 4.0 or a subsequent
version is required for the settings of system register 400 to
403.

8 - 20
FP0 Appendix

8.4 Table of System Registers

Item Address Name Default Description


value
Input 402 Pulse catch input function H0 X5 X4 X3 X2 X1 X0
setting settings 0: Standard input
0 0 0 0 0 0 1: Pulse catch input

In FP Programmer II, enter the above set-


tings in hexadecimal.
When X3 and X4 are set to pulse catch input
15 0
402: 00011000
X5 X4 X3 X2 X1 X0

H1 H8

Input H18
With the FP0, settings X6 and X7 are invalid.
403 Interrupt input settings H0 Using programming tool software
X5 X4 X3 X2 X1 X0 Specify the input con-
tacts used as inter-
rupt inputs in the up-
per byte.
(0: Standard input/1: Interrupt input)

X5 X4 X3 X2 X1 X0 Specify the effective


interrupt edge in the
lower byte.
(When 0: on/When 1: off)

Using FP programmer II
When setting inputs X0, X1, X2, and X3 as
interrupts, and X0 and X1 are set as interrupt
inputs when going from on to off.
Specify Specify
edge interrupt

15 0
403: 000011 001111
X5 X4 X3 X2 X1 X0 X5 X4 X3 X2 X1 X0

H0 H3 H0 HF

Input H30F
404 to 407 Unused With the FP0, values set with the program-
ming tool become invalid.

next page

8 - 21
Appendix FP0

8.4 Table of System Registers

Notes
• With the NPST - GR software, “0” or “1” is set for each bit on
the screen in the setting for system register 403.
• If system register 400 to 403 are set simultaneously for the
same input relay, the following precedence order is effective:
[High - speed counter] ' [Pulse catch] ' [Interrupt input].
When the high - speed counter is being used in the incremental
input mode, even if input X0 is specified as an interrupt input
and as pulse catch input, those settings are invalid, and input
X0 functions as counter input for the high - speed counter.
No. 400: H1 a This setting will be valid.
No. 402: H1
No. 403: H1

8 - 22
FP0 Appendix

8.4 Table of System Registers

Item Address Name Default Description


value
Tool port 410 Unit number setting for tool K1 K1 to K32 (Unit No. 1 to 32)
setting port (when connecting
C- NET)
411 Communication format H0 Using programming tool software
setting for tool port Select items from the menu.
Using FP programmer II
Setting item Specify the setting contents using H
S Default setting value constants.

S Modem communication: 15 6 0
Disabled
S Data length (character bits):
8 bits

Modem communication
0: Disabled
1: Enabled
Data length
(character bits)
0: 8 bits
1: 7 bits
When connecting a modem, set the unit
number to 1 with system resister 410.
414 Baud rate Setting by H0 0: 9600 bit/s
setting for programming 1: 19200 bit/s
tool port tool software
Tool port/ 414 Baud rate Setting by H1
RS232C setting for FP program- H 0 0
port set- tool port and mer II
ting RS232C port
RS232C port
Tool port
H0: 19200 bit/s
H0: 9600 bit/s
H1: 9600 bit/s
H1: 19200 bit/s
H2: 4800 bit/s
If anything other
H3: 2400 bit/s
than H0 or H1 is set
for the tool port H4: 1200 bit/s
baud rate, the baud H5: 600 bit/s
rate will be 9600
bit/s. H6: 300 bit/s

If 19,200 bit/s is set for both the tool port


and RS232C port
' H100 should be written.

Note
NPST - GR software Ver. 4 or later must be used to set system
register 414.

8 - 23
Appendix FP0

8.4 Table of System Registers

Item Address Name Default Description


value
RS232C 412 Communication method K0 Using programming tool software
port setting for RS232C port Select items from the menu.
setting
Using FP programmer II
K0: RS232C port is not used.
K1: Computer link mode (when connecting
C- NET)
K2: Serial data communication mode (gen-
eral port)
413 Communication format H3 Using programming tool software
setting for RS232C port Select items from the menu.
Setting item/Default setting Using FP programmer II
value
Specify the setting contents using H
- Start code: None constants.
- Terminal code: CR 15 6 0
- Stop bit: 1 bit
- Parity check: With odd
- Data length: 8 bits Start code 0: No STX 1: STX

Terminal code 00: CR 01: CR+LF


10: None 11: ETX

Stop bit 0: 1 bit 1: 2 bits

Parity check 00: None 01: With odd


11: With even

Data length 0: 7 bits 1: 8 bits

414 Baud rate Setting by H1 0: 19200 bit/s


setting for programming 1: 9600 bit/s
RS232C port tool software 2: 4800 bit/s
3: 2400 bit/s
4: 1200 bit/s
5: 600 bit/s
6: 300 bit/s
415 Unit number setting for K1 K1 to K32 (unit No. 1 to 32)
RS232C port (when
connecting C- NET)
416 Modem compatibility setting H0 Using programming tool software
for RS232C port Select items from the menu.
Using FP programmer II
H0: Modem disabled
H8000: Modem enabled
417 Starting address setting for K0 C10C/C14C/C16C: K0 to K1659
reception buffer C32C/SL1: K0 to K6143
T32C: K0 to K16383

Note
NPST - GR software Ver. 4 or later must be used to set system
register 414.

8 - 24
FP0 Appendix

8.4 Table of System Registers

Item Address Name Default Description


value
RS232C 418 Capacity C10C/ C14C/ K1660 K0 to K1660
port
p setting
g for C16C
setting
tti reception
ti
buffer C32C/SL1 K6144 K0 to K6144
T32C K16384 K0 to K16384

8 - 25
Appendix FP0

8.5 Table of Special Internal Relays

8.5 Table of Special Internal Relays


The special internal relays turn on and off under special conditions. The on and off states
are not output externally. Writing is not possible with a programming tool or an instruction.
Address Name Description
R9000 Self - diagnostic Turns on when a self - diagnostic error occurs.
error flag The self - diagnostic error code is stored in DT9000.
R9001 to Not used
R9003
R9004 I/O verification error Turns on when an I/O verification error occurs.
flag The position number of the I/O where the verification error was occured is
stored in DT9010.
R9005, Not used
R9006
R9007 Operation error flag Turns on and keeps the on state when an operation error occurs. The ad-
(hold) dress where the error occurred is stored in DT9017 (indicates the first opera-
tion error which occurred).
R9008 Operation error flag Turns on for an instant when an operation error occurs.
(non-hold) The address where the operation error occurred is stored in DT9018. The
contents change each time a new error occurs.
R9009 Carry flag Turns on for an instant,
- when an overflow or underflow occurs.
- when “1” is set by one of the shift instructions.
R900A > flag Turns on for an instant when the compared results become larger in the “F60
(CMP) to F63 (DWIN) comparison instructions.”
R900B = flag Turns on for an instant,
- when the compared results are equal in the comparison instructions (F60
to F63).
- when the calculated results become 0 in the arithmetic instructions.
R900C < flag Turns on for an instant when the compared results become smaller in the
“F60 (CMP) to F63 (DWIN) comparison instructions.”
R900D Auxiliary timer Turns on when the set time elapses (set value reaches 0) in the timing opera-
contact tion of the F137 (STMR)/F183 (DSTM) auxiliary timer instruction.
It turns off when the trigger for auxiliary timer instruction turns off.
R900E Tool port error flag This turns on when an error occurs during communication with a program-
ming tool.
R900F Constant scan error Turns on when scan time exceeds the time specified in system register 34
flag during constant scan execution.
R9010 Always on relay Always on.
R9011 Always off relay Always off.
R9012 Scan pulse relay Turns on and off alternately at each scan.

8 - 26
FP0 Appendix

8.5 Table of Special Internal Relays

Address Name Description


R9013 Initial on pulse relay Turns on only at the first scan in the operation.
Turns off from the second scan and maintains the off state.
R9014 Initial off pulse Turns off only at the first scan in the operation.
relay Turns on from the second scan and maintains the on state.
R9015 Step ladder initial Turns on for an instant only in the first scan of the
on pulse relay process the moment step ladder process is opened.
R9016, Not used
R9017
R9018 0.01 s clock pulse Repeats on/off operations in 0.01 s cycles.
relay
0.01 s
R9019 0.02 s clock pulse Repeats on/off operations in 0.02 s cycles.
relay
0.02 s
R901A 0.1 s clock pulse Repeats on/off operations in 0.1 s cycles.
relay
0.1s
R901B 0.2 s clock pulse Repeats on/off operations in 0.2 s. cycles
relay
0.2 s
R901C 1 s clock pulse Repeats on/off operations in 1 s cycles.
relay
1s
R901D 2 s clock pulse Repeats on/off operations in 2 s cycles.
relay
2s
R901E 1 min clock pulse Repeats on/off operations in 1 min cycles.
relay
1 min.
R901F Not used
R9020 RUN mode flag Turns off while the mode selector is set to PROG.
Turns on while the mode selector is set to RUN.
R9021 to Not used
R9025
R9026 Message flag Turns on while the F149 (MSG) instruction is executed.
(* Note)
R9027 Remote mode flag Turns on while the mode selector is set to REMOTE.
(* Note)
R9028 Not used

Note
Used by the system.

8 - 27
Appendix FP0

8.5 Table of Special Internal Relays

Address Name Description


R9029 Forcing flag Turns on during forced on/off operation for I/O relay and timer/counter con-
(* Note) tacts.
R902A External interrupt Turns on while the external interrupt trigger is enabled by the ICTL instruc-
(* Note) enable flag tion.
R902B Interrupt error flag Turns on when an interrupt error occurs.
(* Note)
R902C to Not used
R902F
R9030, Not used
R9031
R9032 RS232C port mode When “General - use port” is selected, ”K2” goes on.
flag
R9033 Printout instruction Turns on while a F147 (PR) instruction is executed.
flag Turns off when a F147 (PR) instruction is not executed.
R9034 Rewrite during RUN This is a special internal relay that goes on for only the first scan following
flag the completion of rewriting in the RUN mode.
(CPU Ver. 2.1 or later available)
R9035 S - LINK I/O commu- Turns on when the S - LINK error (ERR 1, 3 or 4) occurs using S - LINK sys-
nication error flag tem.
R9036 S - LINK commu- Turns on when communication is taking place with an S - LINK input/output
nication status flag unit.
R9037 RS232C commu- Turns on when the serial data communication error occurs.
nication error flag
R9038 RS232C reception Turns on when a terminator is received during the serial data communicating.
completed flag
R9039 RS232C transmis- Turns on while data is not send during the serial data communicating.
sion completed flag Turns off while data is being sent during the serial data communicating.
R903A High-speed counter Turns on while the high-speed counter instruction “F166 (HC1S) to F170
control flag for ch0 (PWM)” is executed.
R903B High-speed counter Turns on while the high-speed counter instruction “F166 (HC1S) to F170
control flag for ch1 (PWM)” is executed.
R903C High-speed counter Turns on while the high-speed counter instruction “F166 (HC1S) to F170
control flag for ch2 (PWM)” is executed.
R903D High-speed counter Turns on while the high-speed counter instruction “F166 (HC1S) to F170
control flag for ch3 (PWM)” is executed.
R903E, Not used
R903F

Note
Used by the system.

8 - 28
FP0 Appendix

8.6 Table of Special Data Registers

8.6 Table of Special Data Registers


The special data registers are one word (16-bit) memory areas which store specific
information. With the exception of registers for which “Writing is possible” is indicated in
the “Description” column, these registers cannot be written to.
Address Name Description
p
FP0 T32 FP0 C10, C14,
C16, C32, SL1
DT90000 DT9000 Self - diagnostic error The self-diagnostic error code is stored here when
code a self-diagnostic error occurs. Monitor the error
code using decimal display.
DT90010 DT9010 I/O verify error unit The position of the I/O for which an error occurred
is stored in bits 0 to 3.
DT90014 DT9014 Auxiliary register for One shift-out hexadecimal digit is stored in bit
operation positions 0 to 3 when F105 (BSR) or F106 (BSL)
instruction is executed.
DT90015 DT9015 Auxiliary register for The divided remainder (16-bit) is stored in
operation DT9015/DT90015 when F32 (%) or F52 (B%)
instruction is executed.
DT90016 DT9016 The divided remainder (32-bit) is stored DT9015
and DT9016/DT90015 and DT90016 when F33
(D%) or F53 (DB%) instruction is executed.
DT90017 DT9017 Operation error After commencing operation, the address where
address (hold) the first operation error occurred is stored. Monitor
the address using decimal display.
DT90018 DT9018 Operation error The address where a operation error occurred is
address (non-hold) stored. Each time an error occurs, the new ad-
dress overwrites the previous address. At the be-
ginning of scan, the address is 0. Monitor the ad-
dress using decimal display.
DT90019 DT9019 2.5ms ring counter The data stored here is increased by one every
2.5ms. (H0 to HFFFF)
Difference between the values of the two points
(absolute value) × 2.5ms = Elapsed time between
the two points.

8 - 29
Appendix FP0

8.6 Table of Special Data Registers

Address Name Description


p
FP0 T32 FP0 C10, C14,
C16, C32, SL1
DT9020 S - LINK status flag / 15 5 4 3 2 1 0
(Available type: error flag
SL1) DT9020 Not used

S - LINK communication status


(1: Communication in progress)
ERR4
(1: Disconnected wire, or S - LINK
input/output unit error)
ERR3
(1: Problem with voltage level
between D and G)
Not used
ERR1
(1: Short - circuit between D and G)

Notes
S ERR1 and ERR3 occur even if the power supply
on the S - LINK side is interrupted, but are can-
celed when the power supply is turned on again.
S ERR4 is held. To cancel it, repair the disconnected
wire in the S - LINK system, or whatever is causing
the problem, and then either turn the power to the
FP0 on again, press the SET switch to reset it, or
turn the power supply on again on the S - LINK unit
side.

8 - 30
FP0 Appendix

8.6 Table of Special Data Registers

Address Name Description


p
FP0 T32 FP0 C10, C14,
C16, C32, SL1
DT9021 No. of units connected
(Available type: to S - LINK / error (When normal)
SL1) address
15 8 7 6 5 4 3 2 1 0

DT9021

No. of units connected:


0 to 128 (0 to H80)
Note
S When the SET switch is pressed, the number
of input/output units connected to the S - LINK
system is set.
(If the same address has been specified for
multiple units, the units are counted as a
single unit. This is invalid, however, if an
ERR4 error is in progress.)

(If ERR4 occurs)

15 8 7 6 5 4 3 2 1 0
DT9021

Multiple errors
(0: Single, 1: Multiple)
Error address 0 to 127
(0 to H7F)
(Initial address if there are multiple errors)
DT90022 DT9022 Scan time (current The current scan time is stored here. Scan time is
value) calculated using the formula:
(* Note) Scan time (ms) = stored data (decimal) × 0.1
K50 indicates 5ms.

Note
Scan time display is only possible in RUN mode, and shows the
operation cycle time. The maximum and minimum values are
cleared when each the mode is switched between RUN mode and
PROG. mode.

8 - 31
Appendix FP0

8.6 Table of Special Data Registers

Address Name Description


p
FP0 T32 FP0 C10, C14,
C16, C32, SL1
DT90023 DT9023 Scan time (minimum The minimum scan time is stored here. Scan time
value) is calculated using the formula:
(* Note 1) Scan time (ms) = stored data (decimal) × 0.1
K50 indicates 5ms.
DT90024 DT9024 Scan time (maximum The maximum scan time is stored here. Scan time
value) is calculated using the formula:
(* Note 1) Scan time (ms) = stored data (decimal) × 0.1
K125 indicates 12.5ms.
DT90025 DT9025 Mask condition The mask conditions of interrupts using ICTL
(* Note 2) (* Note 2) monitoring register instruction can be monitored here. Monitor using
for interrupts binary display.
(INT 0 to 5)
15 11 7 3 0 (Bit No.)

23 19 16 (INT No.)
0: interrupt disabled (masked)
1: interrupt enabled (unmasked)
DT90026 DT9026 Not used
DT90027 DT9027 Periodical interrupt The value set by ICTL instruction is stored.
(* Note 2) (* Note 2) interval (INT 24) - K0: periodical interrupt is not used
- K1 to K3000: 10ms to 30s
DT90028 DT9028 Not used
DT90029 DT9029 Not used
DT90030 DT9030 Message 0 The contents of the specified message are stored
(* Note 2) (* Note 2) in these special
p data registers
g when F149 (MSG)
( )
i t ti is
instruction i executed.
t d
DT90031 DT9031 Message 1
(* Note 2) (* Note 2)
DT90032 DT9032 Message 2
(* Note 2) (* Note 2)
DT90033 DT9033 Message 3
(* Note 2) (* Note 2)
DT90034 DT9034 Message 4
(* Note 2) (* Note 2)
DT90035 DT9035 Message 5
(* Note 2) (* Note 2)
DT90036 DT9036 Not used
DT90037 DT9037 Work 1 for F96 (SRC) The number of data that match the searched data
instruction is stored here when F96 (SRC) instruction is
executed.

Notes

1) Scan time display is only possible in RUN mode, and shows


the operation cycle time. The maximum and minimum values
are cleared when each the mode is switched between RUN
mode and PROG. mode.
2) Used by the system.

8 - 32
FP0 Appendix

8.6 Table of Special Data Registers

Address Name Description


p
FP0 T32 FP0 C10, C14,
C16, C32, SL1
DT90038 DT9038 Work 2 for F96 (SRC) The position of the first matching data, counting
instruction from the starting 16-bit area, is stored here when
an F96 (SRC) instruction is executed.
DT90039 to DT9039 to Not used
DT90043 DT9043
DT90044 DT9044 High-speed counter The elapsed value (24- bit data) for the high- speed
elapsed value for ch0 counter is stored here. Each time the ED instruc-
tion is executed, the elapsed value for the high-
speed
p counter is automaticallyy transferred to the
special
i l registers
i DT9044
DT90 and d DT9045/DT90044
DT90 /DT900
DT90045 DT9045
and DT90045.
The value can be written by executing F1 (DMV)
instruction.
DT90046 DT9046 High-speed counter The target value (24- bit data) of the high- speed
target value for ch0 counter specified by the high- speed counter in-
struction is stored here.
Target values have been preset for the various
DT90047 DT9047 instructions, to be used when the high- speed
counter related instruction F166 to F170 is execut-
ed. These preset values can only be read, and
cannot be written.
DT90048 DT9048 High-speed counter The elapsed value (24- bit data) for the high- speed
elapsed value area for counter is stored here. Each time the ED instruc-
ch1 tion is executed, the elapsed value for the high-
speed
p counter is automaticallyy transferred to the
special
i l registers
i DT9048
DT90 8 and
d DT9049/DT90048
DT90 9/DT900 8
DT90049 DT9049
and DT90049.
The value can be written by executing F1 (DMV)
instruction.
DT90050 DT9050 High-speed counter The target value (24- bit data) of the high- speed
target value area for counter specified by the high- speed counter in-
ch1 struction is stored here.
Target values have been preset for the various
DT90051 DT9051 instructions, to be used when the high- speed
counter related instruction F166 to F170 is execut-
ed. These preset values can only be read, and
cannot be written.

8 - 33
Appendix FP0

8.6 Table of Special Data Registers

Address Name Description


p
FP0 T32 FP0 C10, C14,
C16, C32, SL1
DT90052 DT9052 High-speed A value can be written with F0 (MV) instruction to reset the
counter control high-speed counter, disable counting, stop high-speed
flag counter instruction (F168), and clear the high-speed
counter.
Control code setting
Control code = j j j j (Binary)

Software reset
0: Yes / 1: No
Count
0: Enable / 1: Disable
Hardware reset
0: Enable / 1: Disable
High- speed counter clear
0: Continue / 1: Clear
Software is not reset: H0 (0000)
Perform software reset: H1 (0001)
Disable count: H2 (0010)
Disable hardware reset: H4 (0100)
Stop pulse output (clear instruction): H8 (1000)
Perform software reset and stop pulse output: H9 (1001)

The 16 bits of DT9052/DT90052 are allocated in groups of


four to high-speed channels 0 to 3 as shown below.

bit 15 12 11 8 7 4 3 0
DT9052/
DT90052

for ch3 for ch2 for ch1 for ch0


A hardware reset disable is only effective when using the
reset inputs (X2 and X5). In all other cases it is ignored.
When using pulse output, a hardware reset input is equiv-
alent to an home point proximate input.
DT90053 Clock/calendar Hour and minute data of the clock/calendar are stored here.
monitor This data is read-only data; it cannot be overwritten.
(hour/minute)
Higher 8 bits Lower 8 bits

Hour data Minute data


H00 to H23 (BCD) H00 to H59 (BCD)

8 - 34
FP0 Appendix

8.6 Table of Special Data Registers

Address Name Description


p
FP0 T32 FP0 C10, C14,
C16, C32, SL1
DT90054 Clock/calendar The year, month, day, hour, minute, second, and day-of-the-
monitor and week data for the calendar timer is stored. The built-in calen-
setting dar timer will operate correctly through the year 2099 and
(minute/second) supports leap years. The calendar timer can be set (the time
set) by writing a value using a programming tool software or
a program that uses the F0 (MV) instruction.
instruction
DT90055 Clock/calendar
monitor and Higher 8 bits Lower 8 bits
setting
(day/hour)
DT90054 Minute data Second data
DT90056 Clock/calendar H00 to H59 (BCD) H00 to H59 (BCD)
monitor and
setting DT90055 Day data Hour data
(year/month) H01 to H31 (BCD) H00 to H23 (BCD)
DT90056 Year data Month data
H00 to H99 (BCD) H01 to H12 (BCD)
DT90057 Clock/calendar
monitor and DT90057 Day-of-the-week
setting data
(day-of-the-week) H00 to H06 (BCD)

8 - 35
Appendix FP0

8.6 Table of Special Data Registers

Address Name Description


p
FP0 T32 FP0 C10, C14,
C16, C32, SL1
DT90058 Clock/calendar The clock/calendar is adjusted as follows.
time setting and
30 seconds When setting the clock/calendar by program
correction By setting the the highest bit of DT90058 to 1, the time be-
comes that written to DT90054 to DT90057 by F0 (MV) in-
struction. After the time is set, DT90058 is cleared to 0. (Can-
not be performed with any instruction other than F0 (MV)
instruction.)
Example:
Set the time to 12:00:00 on the 5th day when the X0 turns on.
X0
( DF ) 1

1 [ F0 MV, H 0, DT90054 ] . . Inputs 0


minutes and
0 seconds
[ F0 MV, H 512, DT90055 ] . . Inputs 12th
hour 5th day
[ F0 MV, H8000, DT90058 ] . . Sets the time

If you changed the values of DT90054 to DT90057 with the


data monitor functions of programming tool software, the time
will be set when the new values are written. Therefore, it is
unnecessary to write to DT90058.
When the correcting times less than 30 seconds
By setting the lowest bit of DT90058 to 1, the value will be
moved up or down and become exactly 0 seconds. After the
correction is completed, DT90058 is cleared to 0.
Example:
Correct to 0 seconds with X0 turns on
X0
( DF ) 1
Correct to 0
1 [ F0 MV, H 1, DT90058 ] second.

At the time of correction, if between 0 and 29 seconds, it will


be moved down, and if the between 30 and 59 seconds, it will
be moved up. In the example above, if the time was 5 minutes
29 seconds, it will become 5 minutes 0 second; and, if the time
was 5 minutes 35 seconds, it will become 6 minutes 0 second.

Note
After discharging the battery (including when the power is turned
on for the first time), the values of DT90053 to DT90058 change at
random. Once the time and date have been set, these values will
function normally.

8 - 36
FP0 Appendix

8.6 Table of Special Data Registers

Address Name Description


p
FP0 T32 FP0 C10, C14,
C16, C32, SL1
DT90059 DT9059 Serial communication bit 15 12 11 8 7 4 3 0
error code
DT9059/
DT90059

Error flag of Error flag of


RS232C port tool port
S Tool port bit 0 = 1: Over run error
bit 1 = 1: Framing error
bit 2 = 1: Parity error
S RS232C port bit 8 = 1: Over run error
bit 9 = 1: Framing error
bit 10 = 1: Parity error
DT90060 DT9060 Step ladder Process Indicates the startup condition of the step ladder pro-
process number: cess. When the proccess starts up, the bit correspond-
0 to 15 g to the process
ing p number turns on “1”.
DT90061 DT9061 Process Monitor using binary display.
number:
16 to 31 15 11 7 3 0 (Bit No.)
DT90062 DT9062 Process DT9060/
number: DT90060 15 11 7 3 0 (Process No.)
32 to 47
0:
DT90063 DT9063 Process not - executing
number:
48 to 63 1: executing
DT90064 DT9064 Process A programming tool software can be used to write data.
number:
64 to 79
DT90065 DT9065 Process
number:
80 to 95
DT90066 DT9066 Process
number:
96 to 111
DT90067 DT9067 Process
number:
112 to 127
DT90104 DT9104 High-speed counter The elapsed value (24- bit data) for the high- speed
elapsed value area for counter is stored here. Each time the ED instruction is
ch2 executed, the elapsed value for the high- speed counter
is automatically transferred to the special registers
DT90105 DT9105 DT9104 and DT9105/DT90104 and DT90105.
The value can be written by executing a DMV (F1)
instruction.
DT90106 DT9106 High-speed counter The target value (24- bit data) of the high- speed counter
target value area for specified by the high- speed counter instruction is stored
ch2 here.
Targett values
T l have
h been
b presett ffor th
the various
i instruc-
i t
DT90107 DT9107
tions, to be used when the high- speed counter related
instruction F166 to F170 is executed. These preset val-
ues can only be read, and cannot be written.

8 - 37
Appendix FP0

8.6 Table of Special Data Registers

Address Name Description


p
FP0 T32 FP0 C10, C14,
C16, C32, SL1
DT90108 DT9108 High-speed counter The elapsed value (24- bit data) for the high- speed
elapsed value area for counter is stored here. Each time the ED instruction is
ch3 executed, the elapsed value for the high- speed counter
is automatically transferred to the special registers
DT90109 DT9109 DT9108 and DT9109/DT90108 and DT90109.
The value can be written by executing a DMV (F1)
instruction.
DT90110 DT9110 High-speed counter The target value (24- bit data) of the high- speed counter
target value area for specified by the high- speed counter instruction is stored
ch3 here.
Targett values
T l have
h been
b presett ffor th
the various
i instruc-
i t
DT90111 DT9111
tions, to be used when the high- speed counter related
instruction F166 to F170 is executed. These preset val-
ues can only be read, and cannot be written.

8 - 38
FP0 Appendix

8.7 Error Codes

8.7 Error Codes

8.7.1 Error Confirmation When “ERROR/ALARM LED” Turns ON

When the “ERROR/ALARM LED” on the control unit is flashing, a self - diagnostic error
or syntax check error has occurred. Confirm the contents of the error and take the
appropriate steps.

8.7.1.1 Error Confirmation Method

Procedure:
1. Use the programming tool to call up the error code.
Using NPST-GR software:
By executing the “STATUS DISPLAY”, the error code and content of
error are displayed.
Using FP programmer II:
With the syntax check error, the error code and message is displayed
by simply connecting the unit.
With the self - diagnostic error, press the following keys.
(- ) READ
ACLR 1 1 0 ENT
OP

Then the self - diagnostic error code will be displayed.


2. Check the error contents in the table of error codes
using the error code ascertained above.

8.7.1.2 Syntax Check Error

This is an error detected by the total check function when there is a syntax error or
incorrect setting written in the program. When the mode selector of controller is switched
to the RUN mode, the total check function automatically activates and eliminates the
possibility of incorrect operation from syntax errors in the program.
When a syntax check error is detected
ERROR/ALARM LED begins flashing.
Operation will not begin even after switching to the RUN mode.
Remote operation cannot be used to change to RUN mode.
Clearing a syntax check error
By changing to the PROG. mode, the error will clear and the ERROR/ALARM LED will
turn off.

8 - 39
Appendix FP0

8.7 Error Codes

Steps to take for syntax error


Change to the PROG. mode, and then execute the total check function while online
mode with the programming tool connected. This will call up the content of error and the
address where the error occurred.
Correct the program while referring to the content of error.

8.7.1.3 Self - diagnostic Error

This error occurs when the controller’s self - diagnostic function detects the occurrence
of an abnormality in the system. The self - diagnostic function monitors the memory
abnormal detection, I/O abnormal detection, and other devices.
When a self - diagnostic error occurs
The controller’s ERROR/ALARM LED begins flashing.
The operation of the controller might stop depending on the content of error and the
system resister setting.
The error codes will be stored in the special data resister DT9000 or DT90000.
In the case of operation error, the error address will be stored in the DT9017 and
DT9018/DT90017 and DT90018.
Clearing the self - diagnostic error
Using NPST-GR software:
At the “STATUS DISPLAY”, press the <F3> (error clear) key. Error codes 43 and higher
can be cleared.
Using FP programmer II
Press the keys as shown below. Error codes 43 and higher can be cleared.
(- ) SHIFT
ACLR 1 1 2 ENT WRT
OP SC

Errors can also be cleared by turning off and on the power while in the PROG. mode.
However, the contents of operation memory, not stored with the hold type data, will also
be cleared.
The error can also be cleared depending on the self-diagnostic error set instruction F148
(ERR).
Steps to take for self - diagnostic error
The steps to be taken will differ depending on the error contents. For more details, use
the error code obtained above and consult the table of self-diagnostic error codes.
For detailed information about the self - diagnostic error of the S - LINK control unit
FP0 S - LINK Unit Hardware Manual

8 - 40
FP0 Appendix

8.7 Error Codes

8.7.2 Table of Syntax Check Error

Error Name Operation Description and steps to take


code status
E1 Syntax error Stops A program with a syntax error has been written.
Change to PROG. mode and correct the error.
E2 Duplicated Stops Two or move OT (Out) instructions and KP (Keep) instructions are
output error programmed using same relay.
Change to PROG. mode and correct the program so that one relay
is not used for two or more OT instructions and KP instructions. Or,
set the duplicated output to “enable (K1)” in system register 20.
E3 Not paired error Stops For instructions which must be used in a pair such as jump (JP and
LBL), one instruction is either missing or in an incorrect position.
Change to PROG. mode and enter the two instructions which
must be used in a pair in the correct positions.
E4 Parameter Stops An instruction has been written which does not agree with system
mismatch error register settings. For example, the number setting in a program does
not agree with the timer/counter range setting.
Change to PROG. mode, check the system register settings, and
change so that the settings and the instruction agree.
E5 Program area Stops An instruction which must be written to a specific area (main program
error area or subprogram area) has been written to a different area (for
example, a subroutine SUB to RET is placed before an ED instruc-
tion).
Change to PROG. mode and enter the instruction in the correct
area.
E8 High - level Stops There is an incorrect operand in an instruction which requires a spe-
instruction cific combination of operands (for example, the operands must all be
operand error of a certain type).
Enter the correct combination of operands.

8 - 41
Appendix FP0

8.7 Error Codes

8.7.3 Table of Self - diagnostic Error

Error Name Operation Description and steps to take


code status
E31 Interrupt error 1 Stops An interrupt occurred without an interrupt request.
A hardware problem or error due to noise is possible.
Turn off the power and check noise conditions.
E32 Interrupt error 2 Stops An interrupt occurred without an interrupt request.
A hardware problem or error due to noise is possible.
Turn off the power and check noise conditions.
There is no interrupt program for an interrupt which occurred.
Check the number of the interrupt program and change it to
agree with the interrupt request.
E45 Operation error Selectable Operation became impossible when a high level instruction was exe-
cuted. The cause of the operation error varies depending on the
instruction.
Selection of operation status using system register 26:
- to continue operation, set K1 (CONT)
- to stop operation, set K0 (STOP)
E46 Remote I/O Selectable If an S - LINK error (ERR1, 3, or 4) is detected in the S - LINK system
(S - LINK) error as the result of a self - diagnosis, error code E46 (remote I/O (S - LINK)
communication error) is stored.
Selection of operation status using system register 27:
- to continue operation, set K1 (CONT)
- to stop operation, set K0 (STOP)
The default value is K1.
E100 Self - diagnostic Stops The self-diagnostic error specified by the F148 (ERR) instruction is
to error set by occurred.
E199 (
F148 (ERR) ) Take steps to clear the error condition according to the
i t
instruction
ti specification you chose.
E200 Continues
to
E299

8 - 42
FP0 Appendix

8.8 FP0 - SL1 S - LINK Address

8.8 FP0 - SL1 S - LINK Address

I/O ad- S - LINK address I/O ad- S - LINK address I/O ad- S - LINK address I/O ad- S - LINK address
dress dress dress dress
input Deci- Hexa- input Deci- Hexa- input Deci- Hexa- input Deci- Hexa-
(X) mal decimal (X) mal decimal (X) mal decimal (X) mal decimal
X80 0 0 X90 16 10 X100 32 20 X110 48 30
X81 1 1 X91 17 11 X101 33 21 X111 49 31
X82 2 2 X92 18 12 X102 34 22 X112 50 32
X83 3 3 X93 19 13 X103 35 23 X113 51 33
X84 4 4 X94 20 14 X104 36 24 X114 52 34
X85 5 5 X95 21 15 X105 37 25 X115 53 35
X86 6 6 X96 22 16 X106 38 26 X116 54 36
X87 7 7 X97 23 17 X107 39 27 X117 55 37
X88 8 8 X98 24 18 X108 40 28 X118 56 38
X89 9 9 X99 25 19 X109 41 29 X119 57 39
X8A 10 A X9A 26 1A X10A 42 2A X11A 58 3A
X8B 11 B X9B 27 1B X10B 43 2B X11B 59 3B
X8C 12 C X9C 28 1C X10C 44 2C X11C 60 3C
X8D 13 D X9D 29 1D X10D 45 2D X11D 61 3D
X8E 14 E X9E 30 1E X10E 46 2E X11E 62 3E
X8F 15 F X9F 31 1F X10F 47 2F X11F 63 3F

I/O ad- S - LINK address I/O ad- S - LINK address I/O ad- S - LINK address I/O ad- S - LINK address
dress dress dress dress
input Deci- Hexa- input Deci- Hexa- input Deci- Hexa- input Deci- Hexa-
(Y) mal decimal (Y) mal decimal (Y) mal decimal (Y) mal decimal
Y80 64 40 Y90 80 50 Y100 96 60 Y110 112 70
Y81 65 41 Y91 81 51 Y101 97 61 Y111 113 71
Y82 66 42 Y92 82 52 Y102 98 62 Y112 114 72
Y83 67 43 Y93 83 53 Y103 99 63 Y113 115 73
Y84 68 44 Y94 84 54 Y104 100 64 Y114 116 74
Y85 69 45 Y95 85 55 Y105 101 65 Y115 117 75
Y86 70 46 Y96 86 56 Y106 102 66 Y116 118 76
Y87 71 47 Y97 87 57 Y107 103 67 Y117 119 77
Y88 72 48 Y98 88 58 Y108 104 68 Y118 120 78
Y89 73 49 Y99 89 59 Y109 105 69 Y119 121 79
Y8A 74 4A Y9A 90 5A Y10A 106 6A Y11A 122 7A
Y8B 75 4B Y9B 91 5B Y10B 107 6B Y11B 123 7B
Y8C 76 4C Y9C 92 5C Y10C 108 6C Y11C 124 7C
Y8D 77 4D Y9D 93 5D Y10D 109 6D Y11D 125 7D
Y8E 78 4E Y9E 94 5E Y10E 110 6E Y11E 126 7E
Y8F 79 4F Y9F 95 5F Y10F 111 6F Y11F 127 7F

8 - 43
Appendix FP0

8.9 Binary/Hexadecimal/BCD Expressions

8.9 Binary/Hexadecimal/BCD Expressions

Decimal Hexadecimal Binary BCD code

0 0000 00000000 00000000 0000 0000 0000 0000


1 0001 00000000 00000001 0000 0000 0000 0001
2 0002 00000000 00000010 0000 0000 0000 0010
3 0003 00000000 00000011 0000 0000 0000 0011
4 0004 00000000 00000100 0000 0000 0000 0100
5 0005 00000000 00000101 0000 0000 0000 0101
6 0006 00000000 00000110 0000 0000 0000 0110
7 0007 00000000 00000111 0000 0000 0000 0111

8 0008 00000000 00001000 0000 0000 0000 1000


9 0009 00000000 00001001 0000 0000 0000 1001
10 000A 00000000 00001010 0000 0000 0001 0000
11 000B 00000000 00001011 0000 0000 0001 0001
12 000C 00000000 00001100 0000 0000 0001 0010
13 000D 00000000 00001101 0000 0000 0001 0011
14 000E 00000000 00001110 0000 0000 0001 0100
15 000F 00000000 00001111 0000 0000 0001 0101

16 0010 00000000 00010000 0000 0000 0001 0110


17 0011 00000000 00010001 0000 0000 0001 0111
18 0012 00000000 00010010 0000 0000 0001 1000
19 0013 00000000 00010011 0000 0000 0001 1001
20 0014 00000000 00010100 0000 0000 0010 0000
21 0015 00000000 00010101 0000 0000 0010 0001
22 0016 00000000 00010110 0000 0000 0010 0010
23 0017 00000000 00010111 0000 0000 0010 0011

24 0018 00000000 00011000 0000 0000 0010 0100


25 0019 00000000 00011001 0000 0000 0010 0101
26 001A 00000000 00011010 0000 0000 0010 0110
27 001B 00000000 00011011 0000 0000 0010 0111
28 001C 00000000 00011100 0000 0000 0010 1000
29 001D 00000000 00011101 0000 0000 0010 1001
30 001E 00000000 00011110 0000 0000 0011 0000
31 001F 00000000 00011111 0000 0000 0011 0001

⋮ ⋮ ⋮ ⋮
63 003F 00000000 00111111 0000 0000 0110 0011
⋮ ⋮ ⋮ ⋮
255 00FF 00000000 11111111 0000 0010 0101 0101
⋮ ⋮ ⋮ ⋮
9999 270F 00100111 00001111 1001 1001 1001 1001

8 - 44
FP0 Appendix

8.10 ASCII Codes

8.10 ASCII Codes

b7

b6 0 0 0 0 1 1 1 1

b5 0 0 1 1 0 0 1 1

b4 0 1 0 1 0 1 0 1

Most significant digit


ASCII HEX
b7 b6 b5 b4 b3 b2 b1 b0 code
0 1 2 3 4 5 6 7

SPA
0 0 0 0 0 NUL DEL 0 @ P ‘ p
CE

0 0 0 1 1 SOH DC1 ! 1 A Q a q

0 0 1 0 2 STX DC2 ” 2 B R b r

0 0 1 1 3 ETX DC3 # 3 C S c s

0 1 0 0 4 EOT DC4 $ 4 D T d t

0 1 0 1 5 ENQ NAK % 5 E U e u
digit

0 1 1 0 6 ACK SYN & 6 F V f v


nificant d

0 1 1 1 7 BEL ETB ’ 7 G W g w
ast signi

1 0 0 0 8 BS CAN ( 8 H X h x
Leas

1 0 0 1 9 HT EM ) 9 I Y i y

1 0 1 0 A LF SUB * : J Z j z

1 0 1 1 B VT ESC + ; K [ k {

1 1 0 0 C FF FS , < L ¥ l |

1 1 0 1 D CR GS - = M ] m }

1 1 1 0 E SO RS . > N ^ n ~

1 1 1 1 F SI US / ? O _ o DEL

8 - 45
Appendix FP0

8.10 ASCII Codes

8 - 46
FP0 Index

Index
A Decimal constants (K), 1 - 21
Duplicated output, 4 - 3
ASCII codes, 8 - 45
Duplicated output error, 8 - 41

B E
Basic function instructions, 2 - 4
Elapsed value area for timer/counter
Basic instructions, 2 - 3, 2 - 7 (EV), 1 - 18
Baud rate, 6 - 7, 8 - 23, 8 - 24 Error codes, 8 - 39
BCD, 8 - 44 Execution condition, 3 - 4
BCD arithmetic instructions, 3 - 7 External input relays (X), 1 - 6
BCD data, 4 - 5 External output relays (Y), 1 - 6
BIN arithmetic instructions, 3 - 6
Binary, 8 - 44 F
Bit manipulation instructions, 3 - 10
Forced input and output, 4 - 27

C
G
Carry flag, 8 - 26
General - use serial communications, 6 - 3
Character constants (M), 1 - 23
Clock pulse relay, 8 - 27
Communication format setting, 8 - 23, H
8 - 24
Hexadecimal constants (H), 1 - 22
Constants, 1 - 21, 8 - 9
Hexadecimal, 8 - 44
Control instructions, 2 - 5
High- level instruction number, 3 - 3
Counter (C), 1 - 10
High- level instructions, 3 - 3, 3 - 11
High- speed counter function, 5 - 3, 5 - 9
D High- speed counter function specifica-
tions, 5 - 5
Data compare instructions, 2 - 6
Hold types, 8 - 11
Data comparison instructions, 3 - 7
Hold types and non - hold type settings,
Data conversion instructions, 3 - 8 8 - 14
Data reception, 6 - 4
Data register (DT), 1 - 13
I
Data rotate instructions, 3 - 9
Data shift instructions, 3 - 9 I/O allocation, 8 - 7

Data transfer instructions, 3 - 6 Index modification, 4 - 7

Data transmission, 6 - 3 Index registers (IX, IY), 1 - 19, 4 - 7

I- 1
Index FP0

Internal relays (R), 1 - 7 S


Interrupt input settings, 8 - 21
S - LINK address, 8 - 43
Self - diagnostic error, 8 - 40, 8 - 42
L
Self - diagnostic error code, 8 - 29
Leading edge detection method, 4 - 13 Self - diagnostic error flag, 8 - 26
Logic operation instructions, 3 - 8 Sequence basic instructions, 2 - 3
Set value area for timer/counter (SV),
1 - 17
M
Setting the timers and counters, 8 - 13
Memory areas, 1 - 12, 8 - 9 Special data registers, 1 - 15, 8 - 29
Modem compatibility setting, 8 - 24 Special instructions, 3 - 10
Modem connection setting, 8 - 11 Special internal relays, 1 - 9, 8 - 26
Start codes (STX), 6 - 6
N Syntax check error, 8 - 39, 8 - 41
Syntax error, 8 - 41
Non - hold type, 8 - 11
System registers, 8 - 11, 8 - 15

O
T
Operand, 3 - 3
Terminal codes (EXT), 6 - 6
Operation errors, 4 - 10
Timer (T), 1 - 10
Overflow, 1 - 27
Tool port setting, 8 - 11, 8 - 23
Trigger, 3 - 4
P
Performance specifications, 8 - 3 U
Pulse catch input function settings, 8 - 21
Underflow, 1 - 27
Pulse output function, 5 - 3, 5 - 18
Pulse output function specifications, 5 - 6
PWM output function, 5 - 4, 5 - 33
PWM output specifications, 5 - 6

R
Reception buffer, 6 - 7
Relays, 1 - 3, 8 - 9
Rewrite function during RUN, 4 - 19
RS232C port setting, 8 - 11, 8 - 23 to
8 - 25
RS232C transmission format, 6 - 5

I- 2
FP0 Record of changes

Record of changes
Manual No. Date Description of Changes
ACG - M0091- 1 JUL.1997 First edition
ACG - M0091- 2 JUN.1998 2nd edition
ACG - M0091- 3 OCT.1999 3rd edition
ARCT1F309E/ NOV.1999 4th edition
ACG - M309E S Additional high- level instructions
“F12 (ICRD) Data read from EEPROM”
“P13 (PICWT) Data write to EEPROM”
“F144 (TRNS) Serial data communication control for RS232C port”
“F355 (PID) PID processing”
S Additional chapters and section
“Chapter 7 General - use Serial Communications”
“Chapter 8 Programming for FP0 Analog I/O Unit”
“Section 9.9 ASCII Codes”
ARCT1F309E - 1/ JUN.2000 5th edition
ACG - M309E - 1 S Additional high- level instructions
“Floating point type real number operation instructions”
[“F309 (FMV) to F338 (DEG)”]

R- 1
Record of changes FP0

R- 2

Você também pode gostar