programmable controller fp0 · 2005-08-12 · programmable controller programming this manual was...
TRANSCRIPT
FP0PROGRAMMABLE CONTROLLER
Programming
This manual was created using Adobe Acrobat.Adobe, the Adobe logo, and Acrobat are trademarksof Adobe Systems Incorporated.
BEFORE BEGINNING
This manual and everything described in it are copyrighted. You may not copy thismanual, in whole or part, without written consent of Matsushita Electric Works, Ltd.
Matsushita Electric Works, Ltd. pursues a policy of continuous improvement of thedesign and performance of its products, therefore, we reserve the right to change themanual/product without notice. In no event will Matsushita Electric Works, Ltd. beliable for direct, special, incidental, or consequential damage resulting from anydefect in the product or its documentation, even if advised of the possibility of suchdamages.
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 theproduct other than described in the manual.
D When physical defects are due to defective equipment other than thedistributed product.
D When physical defects are due to modifications/repairs by someoneother 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 BusinessMachines Corporation.
i
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. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents FP0
ii
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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of ContentsFP0
iii
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 SerialCommunication 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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents FP0
iv
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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of ContentsFP0
v
Basic Instructions
Sequence basic instructions
ST Start 2 - 14. . . . . . . . . . . . . . . . . .
ST/ Start Not 2 - 14. . . . . . . . . . . . . .
OT Out 2 - 14. . . . . . . . . . . . . . . . . . .
/ Not 2 - 16. . . . . . . . . . . . . . . . . . .
AN AND 2 - 17. . . . . . . . . . . . . . . . . .
AN/ AND Not 2 - 17. . . . . . . . . . . . . .
OR OR 2 - 18. . . . . . . . . . . . . . . . . . .
OR/ OR Not 2 - 18. . . . . . . . . . . . . . . .
ANS AND stack 2 - 19. . . . . . . . . . . . .
ORS OR stack 2 - 21. . . . . . . . . . . . . .
PSHS Push stack 2 - 23. . . . . . . . . . . .
RDS Read stack 2 - 23. . . . . . . . . . . .
POPS Pop stack 2 - 23. . . . . . . . . . . . .
DF Leading edge differential 2 - 26.
DF/ Trailing edge differential 2 - 26.
SET Set 2 - 30. . . . . . . . . . . . . . . . . . .
RST Reset 2 - 30. . . . . . . . . . . . . . . . .
KP Keep 2 - 32. . . . . . . . . . . . . . . . . .
NOP No operation 2 - 34. . . . . . . . . . .
Basic function instructions
TML On-delay timer TML 2 - 35. . . .
TMR On-delay timer TMR 2 - 35. . . .
TMX On-delay timer TMX 2 - 35. . . .
TMY On-delay timer TMY 2 - 35. . . .
CT Counter 2 - 42. . . . . . . . . . . . . . .
SR Shift register 2 - 49. . . . . . . . . . .
Control instructions
MC Master control relay 2 - 52. . . . .
MCE Master control relay end 2 - 52.
JP Jump 2 - 56. . . . . . . . . . . . . . . . .
LBL Label 2 - 56, 2 - 59. . . . . . . . . . .
LOOP Loop 2 - 59. . . . . . . . . . . . . . . . . .
ED End 2 - 63. . . . . . . . . . . . . . . . . . .
CNDE Conditional end 2 - 64. . . . . . . .
Step ladder instructions
SSTP Start step 2 - 66. . . . . . . . . . . . . .
NSTL Next step 2 - 66. . . . . . . . . . . . . .
NSTP Next step 2 - 66. . . . . . . . . . . . . .
CSTP Clear step 2 - 66. . . . . . . . . . . . .
STPE Step end 2 - 66. . . . . . . . . . . . . .
Subroutine instructions
CALL Subroutine call 2 - 76. . . . . . . . .
SUB Subroutine entry 2 - 76. . . . . . . .
RET Subroutine return 2 - 76. . . . . . .
Interrupt instructions
INT Interrupt 2 - 79. . . . . . . . . . . . . . .
IRET Interrupt return 2 - 79. . . . . . . . .
ICTL Interrupt control 2 - 84. . . . . . . .
Data compare instructions
ST= 16-bit data compare(Start) 2 - 90. . . . . . . . . . . . . . . . .
ST<> 16-bit data compare(Start) 2 - 90. . . . . . . . . . . . . . . . .
ST> 16-bit data compare(Start) 2 - 90. . . . . . . . . . . . . . . . .
ST>= 16-bit data compare(Start) 2 - 90. . . . . . . . . . . . . . . . .
ST< 16-bit data compare(Start) 2 - 90. . . . . . . . . . . . . . . . .
ST<= 16-bit data compare(Start) 2 - 90. . . . . . . . . . . . . . . . .
STD= 32-bit data compare(Start) 2 - 92. . . . . . . . . . . . . . . . .
STD<> 32-bit data compare(Start) 2 - 92. . . . . . . . . . . . . . . . .
Table of Contents FP0
vi
STD> 32-bit data compare(Start) 2 - 92. . . . . . . . . . . . . . . . .
STD>= 32-bit data compare(Start) 2 - 92. . . . . . . . . . . . . . . . .
STD< 32-bit data compare(Start) 2 - 92. . . . . . . . . . . . . . . . .
STD<= 32-bit data compare(Start) 2 - 92. . . . . . . . . . . . . . . . .
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. . . . . . . . . . . . . . . . .
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. . . . . . . . . . . . . . . . .
ORD<> 32-bit data compare(OR) 2 - 100. . . . . . . . . . . . . . . . .
ORD> 32-bit data compare(OR) 2 - 100. . . . . . . . . . . . . . . . .
ORD>= 32-bit data compare(OR) 2 - 100. . . . . . . . . . . . . . . . .
ORD< 32-bit data compare(OR) 2 - 100. . . . . . . . . . . . . . . . .
ORD<= 32-bit data compare(OR) 2 - 100. . . . . . . . . . . . . . . . .
Table of ContentsFP0
vii
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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents FP0
viii
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. . . . . . . . . . . . . . . . . . . . . . . . .
Table of ContentsFP0
ix
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. . . . . . . . . .
Table of Contents FP0
x
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. . . . . . . . . . . . . . . . . . . . . . . . . .
Table of ContentsFP0
xi
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 typedata) 3 - 311. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F328 DINT Floating point type data to 32-bit integer conversion(the largest integer not exceeding the floating point typedata) 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 decimalpoint down 3 - 323. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F334 FRINT Floating point type data rounding the first decimalpoint 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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
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 Handledin the PLC 1 - 24. . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4.2 Overflow and Underflow 1 - 27. . . . . . . . . . . . . . . .
FP0Relays, Memory Areas and Constants
1 - 2
Relays, Memory Areas and ConstantsFP0
1 - 3
1.1 Type and Function of Relays
1.1 Type and Function of Relays
Item Numbering Function
C10/C14/C16/C32/T32/SL1Relays External input
relayX 208 points (X0 to X12F)
(* Note 1)Turns on or off based on external input.
External outputrelay
Y 208 points (Y0 to Y12F)(* Note 1)
Externally outputs on or off state.
Internal relay(* Note 2)
R 1,008 points (R0 to R62F) Relay which turns on or off only withinprogram.
Timer(* Note 2)
T 144 points (* Note 3)
(T0 to T99/C100 to C143)If a TM instruction has timed out, the con-tact with the same number turns on.
Counter(* Note 2)
C(T0 to T99/C100 to C143)
If a CT instruction has counted up, thecontact with the same number turns on.
Special internalrelay
R 64 points (R9000 to R903F) Relay which turns on or off based on spe-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 thesystem has. For the actual number of points, refer to the tableof I/O allocations in section 8.2.
2) There are two unit types, the hold type that saves theconditions that exist just before turning the power off orchanging from the RUN mode to PROG. mode, and thenon-hold type that resets them. For the FP0 T32, the selectionof hold type and non-hold type can be changed by the settingof system register ( section 8.4).For the FP0 C10/C14/C16/C32/SL1, that area is fixed andallotted the numbers as shown below.Hold type and Non-hold type areas
Item C10/C14/C16 C32/SL1Timer 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)61 words (WR0 to WR60)
880 points (R0 to R54F)55 words (WR0 to WR54)
Hold type 32 points (R610 to R62F)2 words (WR61 to WR62)
128 points (R550 to R62F)8 words (WR55 to WR62)
3) The points for the timer and counter can be changed by thesetting of system register 5. The numbers given in the tableare the numbers when system register 5 is at its defaultsetting. For more detailed information section 8.4
FP0Relays, Memory Areas and Constants
1 - 4
1.1 Type and Function of Relays
How to Specify Relay NumbersExternal input relays (X), External output relays (Y), and Internal relays (R)Since external input relays (X), external output relays (Y) and internal relays (R) arehandled in units of 16 points, they are expressed as a combination of decimal andhexadecimal numbers as shown below.
Example: External input relay (X)
Decimal number1, 2, 3⋅⋅⋅⋅⋅⋅⋅⋅12
Hexadecimal number0, 1, 2, 3,⋅⋅⋅⋅⋅ 9, A, B⋅⋅⋅⋅⋅F
X
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 thetimer and counter instruction numbers and expressed in decimals as shown below.
Example: Timer contact
Decimal number0, 1, 2,⋅⋅⋅⋅⋅⋅⋅99
T0, T1 T99. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .C100, C101 C143. . . . . . . . . . . . . . . . . . . . . . . . . . . .
T
NoteCounters and timers share the same area. The division of thearea can be changed with system register 5. (The table andexample are when settings are the default values.)
Relays, Memory Areas and ConstantsFP0
1 - 5
1.1 Type and Function of Relays
Relay Number of External I/O RelaysOnly relays with numbers actually allocated to input contacts can be used as externalinput relay (X).
Only relays with numbers actually allocated to output contacts can output as externaloutput relay (Y). The external output relays (Y) which are not allocated can be used asinternal relays.
Allocation of numbers is determined by the combination of units used. For detailedinformation section 8.2
Number of Points for Timer and CounterIf you do not have enough timer or counter points, you can change the number of pointsby setting system register 5. However, the overall number of counter and timer pointscannot be changed.For detailed information about the system register setting section 8.4
Relation of WX, WY and WR to X, Y and RWX, 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 asshown below.
XFXE XDXCXBXAX9 X8 X7 X6 X5 X4 X3 X2 X1 X0
WX0
X1F X1E X1D X12 X11 X10
WX1
X12FX12EX12D X122X121X120
WX12
When the state of an external input relay (X) changes, thecontent of WX also changes.
FP0Relays, Memory Areas and Constants
1 - 6
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 suchas a limit switch or a photoelectric sensor and the intelligent units.
Input: onOperation
controlsection
Inputinter-face
X Y
Input
X contact: on
Program
Usage restrictionsThe 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 isprogrammed.
External Output Relays (Y)Function of external output relays (Y)This relay outputs the program operation result at operation control section andactivates 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.
Outputinter-face
Load: onOperation
controlsection output
Program
X Y
R
R
Operation
Output relay
Output
Usage restrictionsExternal output relays which are not actually allocated can be used in the same way asinternal relays. However, they cannot be specified as hold types.When used as contacts, there are no restrictions on the number of times that can beused.As a rule, when specified as the output destination for operation results of OT and KPinstructions, use is limited to once in a program (to inhibit double output).
Relays, Memory Areas and ConstantsFP0
1 - 7
1.1 Type and Function of Relays
NoteYou can permit duplicated use of an output by changing thesystem register 20 setting. Even if the same relay is used as anoperand for instructions such as SET and RST, it is not regardedas 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 anexternal output. When the coil of the relay is energized, its contacts turn on.
Internalrelay
R0
R0F0 MV
Usage restrictionsWhen used as contacts, there are no restrictions on the number of times that can beused.As a rule, when specified as the output destination for operation results of OT and KPinstructions, use is limited to once in a program (to inhibit double output).
NoteYou can permit duplicated use of an output by changing thesystem register 20 setting. Even if the same relay is used as anoperand for instructions such as SET and RST, it is not regardedas duplicated use of outputs.
FP0Relays, Memory Areas and Constants
1 - 8
1.1 Type and Function of Relays
Non-hold type relay and hold type relayThere are two types of internal relays: hold type relays and non-hold type relays. Whenthe 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 thesystem is restarted.
Non-hold type relays reset.
For the FP0 C10/C14/C16/C32/SL1, non-hold type and hold type relay numbers areas follows:
Item C10/C14/C16 C32/SL1Internalrelay
Non-holdtype
976 points (R0 to R60F)61 words (WR0 to WR60)
880 points (R0 to R54F)55 words (WR0 to WR54)y
Hold type 32 points (R610 to R62F)2 words (WR61 to WR62)
128 points (R550 to R62F)8 words (WR55 to WR62)
For FP0 T32, system register 7 can be used to specify whether a hold type or a non-holdtype 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 holdtypes.
Value of system register 7(initial number of hold type)
Non-holdtype
Hold type
Default settings for hold types and non-hold types
Item T32Internalrelay
Non-holdtype
160 points (R0 to R9F)10 words (WR0 to WR9)y
Hold type 848 points (R100 to R62F)53 words (WR10 to WR62)
Relays, Memory Areas and ConstantsFP0
1 - 9
1.1 Type and Function of Relays
Special Internal Relays (from R9000)Function of special internal relaysThe special internal relays turn on or off under specific conditions. The on or off stateis 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 usedaccordingly.
- Always on relay (R9010)
- Clock pulse relay (R9018 to R901E)
REFERENCE
For detailed information about the content of special internal relaysection 8.5
FP0Relays, Memory Areas and Constants
1 - 10
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 samenumber as the timer turns on.When the timer is in the time-up state and the timer execution condition (trigger) turnsoff, the timer contact turns off.
TM n
Tn
Timer number
Timer contact: on
Tn: on
n: Timer number
Time-up
Usage restrictionsWhen used as contacts, there are no restrictions on the number of times that can beused.
Counter (C)Function of counters (C)When the decrement- type preset counter is activated and the elapsed value reacheszero, 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.
CT
Cn
Cn:on
Reset input
Count input Counter number
Counter contact: on n: Counter number
Count -up
n
Usage restrictionsWhen used as contacts, there are no resrictions on the number of times that can beused.
Relays, Memory Areas and ConstantsFP0
1 - 11
1.1 Type and Function of Relays
Items Shared by the Timer and CounterTimer and counter partitioningTimers and counters share the same area. The partitioning of the area can be changedto obtain the number of timers or counters needed.Partition the area by setting system register 5.
Timers
Counters
0
to
99
100
to
143
(T0 to T99)
(C100 to C143)
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 partitioningThe contents of timer contacts, counter contacts, set value areas and elapsed valueareas can be held when the power is turned off or the mode switched from RUN toPROG., and operation later resumed based on those contents.
In the case of the FP0 C10/C14/C16/C32/SL1, the areas which hold their contentswhen the power is turned off are fixed as shown below. System register settings 6 to8 as well as 14 become invalid.
Timer Non-hold type: all points
Counter Non-hold type C10, C14, C16: From set value to C139C32, SL1: From set value to C127
Hold type C10, C14, C16: C140 to C143C32, SL1: C128 to C143
For the FP0 T32, system register 6 can be used to specify whether a hold type or anon-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, andsubsequent the contents of timer/counter contacts will be hold types.
Default settings for hold types and non-hold types
Non-hold type Hold typeT0 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, andcounters are hold types. Normally, the same value should be set for both systemregisters.
FP0Relays, Memory Areas and Constants
1 - 12
1.2 Type and Function of Memory Areas
1.2 Type and Function of Memory Areas
Item Numbering FunctionC10/C14/C16
C32/SL1 T32
MemoryAreas
External inputrelay
WX 13 words (WX0 to WX12)(* Note 1)
Code for specifying 16 external inputpoints as one word (16 bits) of data.
External outputrelay
WY 13 words (WY0 to WY12)(* Note 1)
Code for specifying 16 external outputpoints as one word (16 bits) of data.
Internal relay WR 63 words (WR0 to WR62) Code for specifying 16 internal relaypoints as one word (16 bits) of data.
Data register(* Note 2)
DT 1,660words(DT0 toDT1659)
6,144words(DT0 toDT6143)
16,384words(DT0 toDT16383)
Data memory used in program. Datais handled in 16-bit units (one word).
Timer/Counterset value area(* Note 3)
SV 144 words (SV0 to SV143) Data memory for storing a target valueof a timer and an initial value of acounter. Stores by timer/counter num-ber.
Timer/Counterelapsed valuearea(* Note 3)
EV 144 words (EV0 to EV143) Data memory for storing the elapsedvalue during operation of a timer/counter. Stores by timer/counter num-ber.
Special dataregister
DT 112 words(DT9000 to DT9111)
112 words(DT90000toDT90111)
Data memory for storing specific data.Various settings and error codes arestored. ( section 8.6)
Index register IXIY
2 words (IX, IY) Register can be used as an address ofmemory area and constants modifier.
Notes
1) The number of points noted is the number of points which thesystem has. For the actual number of points, refer to the tableof I/O allocations in section 8.2.
2) There are two unit types, the hold type that saves theconditions that exist just before turning the power off orchanging from the RUN mode to PROG. mode, and non-holdtype that resets them. For the FP0 T32, the selection of holdtype and non-hold type can be changed by the setting ofsystem register. ( section 8.4)For the FP0 C10/C14/C16/C32/SL1, that area is fixed andallotted the numbers as shown below.
Hold type and Non-hold type areas
Item C10/C14/C16 C32/SL1Data 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)
Relays, Memory Areas and ConstantsFP0
1 - 13
1.2 Type and Function of Memory Areas
3) The points for the timer and counter can be changed by thesetting of system register 5. The numbers given in the tableare the numbers when system register 5 is at its defaultsetting.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 usedto store data such as numerical data configured of 16 bits.
DTnBit position 15
0 0 01211
080
70 0
4 30
0· ·· · · · · · ·1 1 1 1 1 1 0 0
Example of a program which writes a numeric value to DTn.
F0, MV, ffff, DT n
Decimal constant (K) orhexadecimal constant (H)
When 32-bit (double word) data is handled in data registers, use two data registers asa set. The number of the data register for the lower 16 bits is specified.
higher 16-bit area lower 16-bit area
DTn+1 DTn0 10 0 0 0 0 0 0 1 0 0 0 0 0 0 01 1 1 1 1 1 1 1 1 10 0 0 0 0
FP0Relays, Memory Areas and Constants
1 - 14
1.2 Type and Function of Memory Areas
Non-hold type data and hold type dataThere are two types of data registers which handle data differently when the power isturned off or the mode is changed from RUN to PROG.:
Hold type data registers hold their contents while operation stops and allow operationto 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 registernumbers 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 ornon-hold types are to be used. If the beginning of a hold type data register is specifiedusing a word number, data registers before that point will be non-hold types, andsubsequent data registers will be hold types.
Value of system register 8(initial number of hold type)
Non-holdtype
Hold type
For the default value, all data registers are hold types (set value: 0).
Relays, Memory Areas and ConstantsFP0
1 - 15
1.2 Type and Function of Memory Areas
Special Data Registers (from DT9000/DT90000)Function of the special data registersThese 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 statusesThe operation statuses of the PLC (programmable controller) specified with the systemregisters and the various types of instructions are stored.
- High-speed counter control register (DT9052/DT90052) etc.
Error contentsThe 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 counterThese registers are used for reading and writing the target value and elapsed value ofthe high-speed counters.
- High-speed counter elapsed/target value area(DT9044 to DT9051/DT9104 to DT9111, DT90044 to DT90051/DT90104 toDT90111)
Clock/calendar timers (can be used with FP0 T32C only)The year, month, day, hour, minute, second, and day of the week tracked by thecalendar timer are stored here (DT90054 to DT90057).
NoteThe values stored for the clock/calendar timer can be overwritten(to calibrate the date and time). Values should be written toDT90054 to DT90057 either using the F0 (MV) instruction ordirectly, using programming tools.
FP0Relays, Memory Areas and Constants
1 - 16
1.2 Type and Function of Memory Areas
WX, WY and WRFunction of WX, WY and WRRelays (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
WR1
WR2
RF RE RD RC RB RA R9 R8 R7 R6 R5 R4 R3 R2 R1 R0
R1F R1E · R12 R11 R10· · · · · · · · · ·
R2F R2E · R22 R21 R20· · · · · · · · · ·
Examples of using WX, WY and WRWX can be used to read in digital switch and keyboard inputs, and WY can be used foroutput 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 usageIf an on or off status of one of the relays composing the memory area changes, thememory area value will also change.
00 0 0 1 1 0 0 0 1 0 0 1 0 0 1
WR0
0 0 0 0 1 1 0 0 0 1 0 0 1 0 1 1
WR0
When R1 is turned on
Relays, Memory Areas and ConstantsFP0
1 - 17
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 samenumber as the timer or counter.
TM n, K30
Set value
SVnK30
(Decimal number)
A decimal number or SV area number is specified for the set value when the TM or CTinstruction is entered in the program.An SV is a one-word, 16-bit memory area which stores a decimal number from K0 toK32767.
Using set value area (SV)During RUN mode, a set value for a timer or counter can be changed by rewriting thecorresponding set value area.
The value in a set value area can be read and changed from the program by specifyingthe 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”/“MonitoringRegisters” and specify the set value area.
- Using FP Programmer IIExecute “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/Counternumber
Set value area(SV)
Elapsed valuearea (EV)
T0T1⋮T99
SV0SV1⋮SV99
EV0EV1⋮EV99
C100⋮
SV100⋮
EV100⋮
FP0Relays, Memory Areas and Constants
1 - 18
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 valuearea (EV) with the same number as the timer or counter.When the EV reaches zero, the timer or counter contact with the same number turnson.An EV is a one-word, 16-bit memory area which stores a decimal number from K0 toK32767.
TM n, K
Tn
Value of SVnSVnK3030
0
Value of EVn
EVnK30
29
28
1
EVn0
Decrements
Tn turns on when decrement operation ends
Using elapsed value area (EV)The elapsed value of a timer or counter in operation can be changed to prolong orshorten the operation.
The value in elapsed value area can be read and changed from the program byspecifying 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”/“MonitoringRegisters” and specify the elapsed value area.
- Using FP Programmer IIExecute “OP8” and specify the elapsed value area.
For detailed information section 4.8
Relays, Memory Areas and ConstantsFP0
1 - 19
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 inhigh- level instructions. Two 16-bit registers are available, IX and IY. Changingaddresses and constants using a value in an index register is called “indexmodification”.
Modifying an addressAddress = Base address + Value in IX or IY (K constant)
Example: Modifying DT11
IXDT11
Base address IX value Target address11 + K0 = DT1111 + K10 = DT2111 + K-10 = DT1
Modifying a constantConstant = Base value + Value in IX or IY
Example 1: Modifying K100
IXK100
Base value IX value ConstantK100 + K0 = K100K100 + K10 = K110K100 + K-10 = K90
Example 2: Modifying H10
IXH10
Base value IX value ConstantH10 + HA = H1AH10 + H10 = H20
For detailed information about the index register section 4.3
FP0Relays, Memory Areas and Constants
1 - 20
1.2 Type and Function of Memory Areas
Index modification method
Example 1: Modifying a destination address
F0 MV, DT 0, IXX0
F0 MV, K100, IXWR0
IX setting
The value of DT0 determines the WR address where K100 iswritten.
When the DT0 value is K10, K100 is written to WR10.IX WR0 → WR10↓
K10↓10 + 0 = 10
Example 2: Modifying a source address
F0 MV, DT 1, IXX0
F0 MV, IXWR0, DT 0
IX setting
The value of DT1 determines the WR address for transferring avalue to DT0.
When the DT1 value is K9, the value in WR9 is transferred toDT0.IX WR0 → WR9↓
K9↓
9 + 0 = 9
Cautions when using index registersAn 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 willresult.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 combinationare handled as 32-bit data.
Lower 16-bit areaHigher 16-bit area
Contents of IXContents of IY
The modification result is 32-bit data.
Relays, Memory Areas and ConstantsFP0
1 - 21
1.3 Type and Function of Constants
1.3 Type and Function of Constants
Item Numbering FunctionC10/C14/C16
C32/SL1 T32
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” atthe beginning.Decimal constants are primarily used to specify data sizes and quantities such as setvalues 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 (MostSignificant Bit) is called the “sign bit”.
Example: Decimal number “+32” (K32)
“+”
Bit position 150 0 0
12110
80
70 1
4 30
0· ·· · · · · · ·0 0 0 0 0 0 0 0Binary data
Example: Decimal number “-32” (K-32)
“ - ”
Bit position 151 1 1
12111
81
71 1
4 30
0· ·· · · · · · ·1 1 1 1 0 0 0 0Binary data
Data is normally handled in units of one word (16 bits), however, it is also occasionallyhandled in units of two words (32 bits). In this case, as well, the MSB serves as the signbit.The available range of a decimal constant is:For 16-bit operation: K-32768 to K32767For 32-bit operation: K-2147483648 to K2147483647
FP0Relays, Memory Areas and Constants
1 - 22
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 intohexadecimal. When entering and reading a hexadecimal constant, specify the value byentering an “H” at the beginning.Hexadecimal constants are primarily used to specify an ordering of 1’s and 0’s in 16-bitdata, such as system register settings and specification of control data for high- levelinstructions. Hexadecimal constants are also used to specify BCD data.In the PLC, the hexadecimal constant (H) is processed as binary (BIN) data in units of16 bits, as shown below.
Example: Hexadecimal number “2A” (H2A)
Binary data
· ·· ·HexadecimalBit position · · · · ·
00 0 0 0
00 0 0 0 0 0 0
A1 0 1 0
15 1211 8 7 4 3 0
21
Data is normally handled in units of one word (16 bits), however, it is also occasionallyhandled in units of two words (32 bits).The available range of a hexadecimal constant is:For 16-bit operation: H0 to HFFFFFor 32-bit operation: H0 to HFFFFFFFF
Relays, Memory Areas and ConstantsFP0
1 - 23
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 theprogramming 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
54 45
One word
4E 57 45 4D
T E N W E M Character constant
One word One word
ASCII Hex code
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.
FP0Relays, Memory Areas and Constants
1 - 24
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 dataData which can be handled in the PLC
(16-bit binary data)Decimal
constantsHexadecimal
constants
0 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 01 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 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 1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
···
K 32767···
K 1K 0K -1
···
K -32768
H7FFF···
H0001H0000HFFFF
···
H8000
32-bit dataData which can be handled in the PLC
(32-bit binary data)Decimal
constantsHexadecimal
constants
0 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 01 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 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
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
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 01 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 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 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
K 2147483647···
K 1K 0K -1
···
K-2147483648
H7FFFFFFF···
H00000001H00000000HFFFFFFFF
···
H80000000
Relays, Memory Areas and ConstantsFP0
1 - 25
1.4 Data Ranges Which can be Handled in the PLC
Expression of decimal numbers in PLCDecimal number is basically processed in 16-bit or 32-bit binary.The most significant bit (MSB) expresses negative or positive sign of the data. Whenthe MSB is “0”, data is regarded as having a zero or positive value and when the MSBis “1”, data is regarded as having a negative value.In the case of positive numbers, the bits following the most significant bit express thesize of the data.
Example 1: Expressing the decimal number “1868”
0 1 1 1 1 1 10 0 0 0 0 0 0 0 0
16,3
848,
192
4,09
62,
048
1,02
451
225
612
8 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 binarydata 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
1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0
Binary expression ofdecimal number “4”
Invert each bit
Add 1
Most significant bit: 1 (negative value)
Binary expression ofdecimal number “-4”
FP0Relays, Memory Areas and Constants
1 - 26
1.4 Data Ranges Which can be Handled in the PLC
Data ranges which can be handled in the PLCData which can be handled by binary operation are:For 16-bit operation: K-32768 to K32767For 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 H9999For 32-bit (8-digit BCD H code) operation: H0 to H99999999If 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 adecimal number by four binary digits.
When the decimal number is expressed in BCD
Decimal number
BCD code 0110
Each digit is converted to binary
0100 0101 → H645
6 4 5
(Binary codeddecimal)
Relays, Memory Areas and ConstantsFP0
1 - 27
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 allowedrange. 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, thecarry flag R9009 turns on.
Overflow and underflow during binary operationIf any of the following values are exceeded, overflow or underflow will result.
K-2147483648
32-bit binary operation(Overflow results if over
the maximum value.)
16-bit binary operation(Overflow results if over
the maximum value.)K 32767 H 7FFF
K 1K 0K -1
H 0001H 0000H FFFF
K-32768 H 8000
K 2147483647 H 7FFFFFFF
K 1K 0K -1
H 00000001H 00000000H FFFFFFFF
H 80000000
Max. value
Min. value
(Underflow results if underthe minimum value.)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
(Underflow results if underthe minimum value.)
Max. value
Min. value
Overflow and underflow during BCD operationIf any of the following values are exceeded, overflow or underflow will result.Only positive values can be handled.
Max. value H 99999999
H 0
4-digit BCD code operation(Overflow results if over the
maximum value.)
8-digit BCD code operation(Overflow results if over the
maximum value.)H 9999
H 0Min. value
.
.
.
.
.
.
.
.
.
.
.
.
(Underflow results if underthe minimum value.)
(Underflow results if underthe minimum value.)
Max. value
Min. value
FP0Relays, Memory Areas and Constants
1 - 28
1.4 Data Ranges Which can be Handled in the PLC
Values when overflow or underflow occursNumerical value handled by the FP0 all form a loop joined at the maximum value andthe minimum value as shown below.
K 32767 H 7FFF
K-32768 H 8000
K 1 H 0001K 0 H 0000K -1 H FFFF
Overflow
Underflow
...
...
...
...
Max. value
Min. value
16-bit binary operation
The max. valuelinks with the min.value.
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.
H 9999
H 0
Overflow
Underflow
Max. value
Min. value
4-digit BCD code operation
.....
The max. valuelinks with the min.value.
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.
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. . . . . . . . . . . . . . . .
FP0Basic Instructions
2 - 2
Basic InstructionsFP0
2 - 3
2.1 Composition of Basic Instructions
2.1 Composition of Basic Instructions
Sequence Basic InstructionsThese basic instructions perform bit unit logic operations and are the basis of the relaysequence circuit.As shown in the illustration below, this is expressed by the combination of the relay coiland contact.
Example:
R0
R0X0
ST
X1
OR
0
1
Y10R04
OT
OTST
AN
Internal relay coil
Output coil
Input contacts
Address
Internalrelaycontacts
Bus line
There are several relay types which are explained in section 1.1, and the relay whichcan be specified depends on the instruction. Refer to the explanation of eachinstruction.
Example:
Start (ST) instructionRead the on or off status of the specified contact.
Read the status ofexternal input (X0).
Out (OT) instructionOutput the operation result to the specified coil.
Output the operated result (on and off)to the external output (Y0).
FP0Basic Instructions
2 - 4
2.1 Composition of Basic Instructions
Basic Function InstructionsThese are the timer, counter and shift register instructions.
To specify set values, the instructions are composed of several steps.
Example:
X0
Y0T5
Set value0.1s units timer (Timer 5)
TMX 5, K 30
Constant oftimer 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.0seconds elapses.
Basic InstructionsFP0
2 - 5
2.1 Composition of Basic Instructions
Control InstructionsThese instructions determine the order and flow of program execution.It is possible to change the sections to be executed, or to execute only the necessarysegments, depending on the conditions.
Specify the section which will execute. This is composed of several steps.
Master control relayA certain part of the program (specified with MC or MCE) is only executed when theappropriate condition is met.
JumpSkips execution of part of the program (specified with JP or LBL) when the appropriatecondition is met. This shortens program execution time.
Step ladder controlPart of the program (specified with SSTP or STPE) is treated as an independent“process”, and sequential and branch execution is carried out.
Subroutine programA program which is repeatedly executed for a particular operation is called as asubroutine (specified with SUB or RET) and executed when needed.
Interrupt programIn addition to the normal program, enter an interrupt program (specified with INT orIRET) if you need a program which will execute immediately when a certain conditionis met. When an interrupt is received, the normal program is interrupted and the interruptprogram is executed.
FP0Basic Instructions
2 - 6
2.1 Composition of Basic Instructions
Data Compare InstructionsThis is a group of instructions which compare two data. A contact is turned on or offbased on the result of the comparison. Each comparison instruction is composed ofseveral steps.
Example:
Y0<=, DT 10, K100
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.
Basic InstructionsFP0
2 - 7
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 (normallyopen) contact.
1 2 - 14
Start Not ST/ X,Y,R,T,C Begins a logic operation with a Form B (normallyclosed) contact.
1 2 - 14
Out OT Y,R Outputs the operated result to the specified out-put.
1 2 - 14
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-rially.
1 2 - 17
AND Not AN/ X,Y,R,T,C Connects a Form B (normally closed) contactserially.
1 2 - 17
OR ORX,Y,R,T,C
Connects a Form A (normally open) contact inparallel.
1 2 - 18
OR Not OR/X,Y,R,T,C
Connects a Form B (normally closed) contact inparallel.
1 2 - 18
AND stack ANS Connects the multiple instruction blocks serially. 1 2 - 19
OR stack ORS Connects the multiple instruction blocks in paral-lel.
1 2 - 21
Push stack PSHS Stores the operated result up to this instruction. 1 2 - 23
Read stack RDS Reads the operated result stored by the PSHSinstruction.
1 2 - 23
Pop stack POPS Reads and clears the operated result stored bythe PSHS instruction.
1 2 - 23
Leading edgedifferential
DF(DF )
Turns on the contact for only one scan when theleading edge of the trigger is detected.
1 2 - 26
Trailing edgedifferential
DF/(DF/ )
Turns on the contact for only one scan when thetrailing edge of the trigger is detected.
1 2 - 26
Set SET< S >Y,R Output is set to and held at on. 3 2 - 30
Reset RST< R >Y,R Output is set to and held at off. 3 2 - 30
Keep KP Set
ResetKP Outputs at set trigger and holds until reset trig-
ger turns on.1 2 - 32
No operation NOP No operation. 1 2 - 34
FP0Basic Instructions
2 - 8
2.2 Table of Basic Instructions
Name Boolean Symbol Description Steps Page
Basic function instructions
Timer TML(*Note)
After set value “n” × 0.001 second, timercontact is set to on.
3 2 - 35
TMR TM n After set value “n” × 0.01 second, timercontact is set to on.
3 2 - 35
TMX After set value “n” × 0.1 second, timercontact is set to on.
3 2 - 35
TMY After set value “n” × 1 second, timer con-tact is set to on.
4 2 - 35
Auxiliary timer(16-bit)
F137(STMR)
Y,RF137 STMR, S, D
After set value “S” × 0.01 second, thespecified output and R900D are set to on.
5 3 - 235
Auxiliary timer(32-bit)
F183(DSTM)(*Note)
Y,RF183 DSTM, S, D
After set value “S” × 0.01 second, thespecified output and R900D are set to on.
5 3 - 272
Counter CT Count
Reset
CT
n
Decrements from the preset value “n”. 3 2 - 42
UP/DOWNcounter
F118(UDC)
UP/DOWN
Count
F118 UDC
ResetS
D
Increments or decrements from the presetvalue “S” based on up/down input.
5 3 - 211
Shift register SR Data
Shift
SR WR n
Reset
Shifts one bit of 16-bit data [word internalrelay (WR)] to the left.
1 2 - 49
Left/right shiftregister
F119(LRSR)
Data
Shift
Reset
L/RF119 LRSR
D1
D2
Shifts one bit of the 16-bit data range spe-cified by “D1” and “D2” to the left or to theright.
5 3 - 214
Control instructions
Master controlrelay
MC (MC n)
Master control area
Starts the master control program. 2 2 - 52
Master controlrelay end
MCE(MCE n)
Master control area
Ends the master control program. 2 2 - 52
NoteNPST-GR Ver. 4.2 or later or FP Programmer II (AFP1114V2) isneeded to enter the TML and F183 (DSTM) instruction.
Basic InstructionsFP0
2 - 9
2.2 Table of Basic Instructions
Name Boolean Symbol Description Steps Page
JumpLabel
JPLBL
(JP n)
(LBL n)
The program jumps to the label instructionand continues from there.
21
2 - 56
LoopLabel
LOOPLBL
(LBL n)
LOOP n, S
The program jumps to the label instructionand continues from there (the number ofjumps is set in “S”).
41
2 - 59
End ED(ED )
The operation of program is ended. Indi-cates the end of a main program.
1 2 - 63
Conditional end CNDE (CNDE ) The operation of program is ended whenthe trigger turns on.
1 2 - 64
Step ladder instructions
Start step SSTP(SSTP n)
The start of program “n” for process con-trol
3 2 - 66
Next step NSTL(NSTL n)
Start the specified process “n” and clearthe process currently started. (Scanexecution type)
3 2 - 66
NSTP(NSTP n)
Start the specified process “n” and clearthe process currently started. (Pulseexecution type)
3 2 - 66
Clear step CSTP (CSTP n) Resets the specified process “n”. 3 2 - 66
Step end STPE(STPE )
End of step ladder area 1 2 - 66
Subroutine instructions
Subroutine call CALL (CALL n) Executes the specified subroutine pro-gram.
2 2 - 76
Subroutine entry SUB(SUB n)
Indicates the start of the subroutine pro-gram “n”.
1 2 - 76
Subroutinereturn
RET(RET )
Ends the subroutine program. 1 2 - 76
Interrupt instructions
Interrupt INT(INT n)
Indicates the start of the interrupt program“n”.
1 2 - 79
Interrupt return IRET(IRET )
Ends the interrupt program. 1 2 - 79
Interrupt control ICTLICTL S1, S2(DF)
Select interrupt enable/disable or clear in“S1” and “S2” and execute.
5 2 - 84
FP0Basic Instructions
2 - 10
2.2 Table of Basic Instructions
Name Boolean Symbol Description Steps Page
Data compare instructions
16-bit datacompare(Start)
ST == S1, S2
Begins a logic operation by comparing two16-bit data in the comparative condition“S1 = S2.”
5 2 - 90
( )
ST <>< > S1, S2
Begins a logic operation by comparing two16-bit data in the comparative condition“S1 ≠ S2.”
5 2 - 90
ST >> S1, S2
Begins a logic operation by comparing two16-bit data in the comparative condition“S1 > S2.”
5 2 - 90
ST >=> = S1, S2
Begins a logic operation by comparing two16-bit data in the comparative condition“S1 ≧ S2.”
5 2 - 90
ST << S1, S2
Begins a logic operation by comparing two16-bit data in the comparative condition“S1 < S2.”
5 2 - 90
ST <=< = S1, S2
Begins a logic operation by comparing two16-bit data in the comparative condition“S1 ≦ S2.”
5 2 - 90
32-bit datacompare(Start)
STD =D= S1, S2
Begins a logic operation by comparing two32-bit data in the comparative condition“(S1+1, S1) = (S2+1, S2).”
9 2 - 92
( )
STD <>D< > S1, S2
Begins a logic operation by comparing two32-bit data in the comparative condition“(S1+1, S1) ≠ (S2+1, S2).”
9 2 - 92
STD >D> S1, S2
Begins a logic operation by comparing two32-bit data in the comparative condition“(S1+1, S1) > (S2+1, S2).”
9 2 - 92
STD >=D> = S1, S2
Begins a logic operation by comparing two32-bit data in the comparative condition“(S1+1, S1)≧ (S2+1, S2).”
9 2 - 92
STD <D< S1, S2
Begins a logic operation by comparing two32-bit data in the comparative condition“(S1+1, S1) < (S2+1, S2).”
9 2 - 92
STD <=D< = S1, S2
Begins a logic operation by comparing two32-bit data in the comparative condition“(S1+1, S1)≦ (S2+1, S2).”
9 2 - 92
Basic InstructionsFP0
2 - 11
2.2 Table of Basic Instructions
Name Boolean Symbol Description Steps Page
16-bit datacompare(AND)
AN == S1, S2
Connects a Form A (normally open) contactserially by comparing two 16-bit data in thecomparative condition “S1 = S2.”
5 2 - 94
(AND)AN <>
< > S1, S2Connects a Form A (normally open) contactserially by comparing two 16-bit data in thecomparative condition “S1 ≠ S2.”
5 2 - 94
AN >> S1, S2
Connects a Form A (normally open) contactserially by comparing two 16-bit data in thecomparative condition “S1 > S2.”
5 2 - 94
AN >=> = S1, S2
Connects a Form A (normally open) contactserially by comparing two 16-bit data in thecomparative condition “S1 ≧ S2.”
5 2 - 94
AN << S1, S2
Connects a Form A (normally open) contactserially by comparing two 16-bit data in thecomparative condition “S1 < S2.”
5 2 - 94
AN <=< = S1, S2
Connects a Form A (normally open) contactserially by comparing two 16-bit data in thecomparative condition “S1 ≦ S2.”
5 2 - 94
32-bit datacompare(AND)
AND =D= S1, S2
Connects a Form A (normally open) contactserially by comparing two 32-bit data in thecomparative condition“(S1+1, S1) = (S2+1, S2).”
9 2 - 96
AND <>D< > S1, S2
Connects a Form A (normally open) contactserially by comparing two 32-bit data in thecomparative condition“(S1+1, S1) ≠ (S2+1, S2).”
9 2 - 96
AND >D> S1, S2
Connects a Form A (normally open) contactserially by comparing two 32-bit data in thecomparative condition“(S1+1, S1) > (S2+1, S2).”
9 2 - 96
AND >=D> = S1, S2
Connects a Form A (normally open) contactserially by comparing two 32-bit data in thecomparative condition“(S1+1, S1) ≧ (S2+1, S2).”
9 2 - 96
AND <D< S1, S2
Connects a Form A (normally open) contactserially by comparing two 32-bit data in thecomparative condition“(S1+1, S1) < (S2+1, S2).”
9 2 - 96
AND <=D< = S1, S2
Connects a Form A (normally open) contactserially by comparing two 32-bit data in thecomparative condition“(S1+1, S1) ≦ (S2+1, S2).”
9 2 - 96
FP0Basic Instructions
2 - 12
2.2 Table of Basic Instructions
Name Boolean Symbol Description Steps Page
16-bit datacompare(OR)
OR == S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 16-bit data inthe comparative condition “S1 = S2.”
5 2 - 98
( )
OR <>< > S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 16-bit data in thecomparative condition “S1 ≠ S2.”
5 2 - 98
OR >> S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 16-bit data inthe comparative condition “S1 > S2.”
5 2 - 98
OR >=> = S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 16-bit data in thecomparative condition “S1 ≧ S2.”
5 2 - 98
OR << S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 16-bit data inthe comparative condition “S1 < S2.”
5 2 - 98
OR <=< = S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 16-bit data in thecomparative condition “S1 ≦ S2.”
5 2 - 98
32-bit datacompare(OR)
ORD =
D= S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 32-bit data inthe comparative condition“(S1+1, S1) = (S2+1, S2).”
9 2 - 100
ORD <>
D< > S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 32-bit data inthe comparative condition“(S1+1, S1) ≠ (S2+1, S2).”
9 2 - 100
ORD >
D> S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 32-bit data inthe comparative condition“(S1+1, S1) > (S2+1, S2).”
9 2 - 100
ORD >=
D> = S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 32-bit data inthe comparative condition“(S1+1, S1) ≧ (S2+1, S2).”
9 2 - 100
ORD <
D< S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 32-bit data inthe comparative condition“(S1+1, S1) < (S2+1, S2).”
9 2 - 100
ORD <=
D< = S1, S2
Connects a Form A (normally open) contactin parallel by comparing two 32-bit data inthe comparative condition“(S1+1, S1) ≦ (S2+1, S2).”
9 2 - 100
Basic InstructionsFP0
2 - 13
2.3 Explanation of Basic Instructions
2.3 Explanation of Basic Instructions
Layout of instruction explanations
This is the number of stepsused with this instruction.
Number of steps
Boolean
Ladder diagramThis indicates theladder diagramscreen displayedwhen data is enteredusing the program-ming tool software(NPST-GR/FPWINGR).On the programmingtool software(NPST-GR/FPWINGR) screen, coils aredisplayed using the[ ] symbol.
Explanation ofprogramexample andflag conditions
This indicateshow codes areused when datais entered usingboolean entrywith the pro-gramming toolsoftware (NPST-GR/FPWIN GR).Data is alsoentered in thisformat whenusing the FPProgrammer II.
Using the programgiven in the aboveladder diagram asan example, theoperation and relaymovements areshown, as well astypes of flags andthe conditions underwhich they go onand off.
AvailableoperandsThis indicates typesof relays which canbe used with theinstruction, types ofregisters andconstants whichcan be used asoperands.For information ontypes of relays,refer to section 1.1.For information ontypes of memoryareas, refer tosection 1.2.
Basic Instructions FP0
2 - 14
2.3 Explanation of Basic Instructions
Outline ST, ST/: Begins a logic operation.OT: Outputs the operation result. 1
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
X0 Y00
Start OutX0 Y12
OutStart Not
0
1
2
3
ST X 0
OT Y 0
ST/ X 0
OT Y 1
Operands
InstructionRelay Timer/Counter
ContactInstructionX Y R T C
ST, ST/ A A A A A
OT N/A A A N/A N/A
Explanation of exampleY0 goes on when X0 turns on.
Y1 goes on when X0 turns off.onoffX0
onoff
onoff
Y0
Y1
DescriptionThe 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.
STST/
Step Availability
OT
FP0 C10, C14, C16,C32, T32, SL1
Start
Start Not
Out
1
1
1
A: AvailableN/A: Not Available
Basic InstructionsFP0
2 - 15
2.3 Explanation of Basic Instructions
Precautions during programmingThe ST and ST/ instructions start from the bus line.
Y0X0
The OT instruction cannot start directly from the bus line.Y0
The OT instruction can be used consecutively.Y0X0
Y1
Y2
When an external switch, such as emergency stop switch with a Form B (normally closed) contact isprogrammed, be sure to use the ST instruction.
Basic Instructions FP0
2 - 16
2.3 Explanation of Basic Instructions
Outline Inverts the operation result up to this instruction. 2
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
0X0 Y0
Y1
Not
0
1
2
3
ST X 0
OT Y 0
/
OT Y 1
Explanation of exampleY0 goes on and Y1 goes off when X0 turns on.
Y0 goes off and Y1 goes on when X0 turns off.
X0
Y0
Y1
onoff
onoff
onoff
DescriptionThe / (Not) instruction inverts the operation result up to this instruction.
/Step Availability
FP0 C10, C14, C16,C32, T32, SL1
Not 1
Basic InstructionsFP0
2 - 17
2.3 Explanation of Basic Instructions
Outline AN: Connects Form A (normally open) contacts in series.AN/: Connects Form B (normally closed) contacts in series. 3
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
X0 Y00
AND
X2
AND Not
X10
1
2
3
ST X 0
AN X 1
AN/ X 2
OT Y 0
Operands
InstructionRelay Timer/Counter
ContactInstructionX Y R T C
AN, AN/ A A A A A
Explanation of exampleY0 goes on when both X0 and X1 turn on and also X2 turns off.
X0
X1
X2
Y0
onoff
onoff
onoff
onoff
DescriptionPerforms a logical AND operation with the results of the immediately precedingserially connectedoperation.
Precautions during programmingUse 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 Y0
Y1
X1
X2 X3
The AN and AN/ instructions can be used consecutively.
X0 X1 X2 X3
ANAN/
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
AND
AND Not
1
1
A: Available
Basic Instructions FP0
2 - 18
2.3 Explanation of Basic Instructions
Outline OR: Connects Form A (normally open) contacts in parallel.OR/: Connects Form B (normally closed) contacts in parallel. 4
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
X0 Y00
ORX2
OR Not
X10 0
1
2
3
ST X 0
OR X 1
OR/ X 2
OT Y 0
Operands
InstructionRelay Timer/Counter
ContactInstructionX Y R T C
OR, OR/ A A A A A
Explanation of exampleY0 goes on when either X0 or X1 turns on or X2 turns off.
X0
X1
X2
Y0
onoff
onoff
onoff
onoff
DescriptionPerforms a logical OR operation with the results of the immediately preceding operation connected inparallel.
Precautions during programmingUse 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.
X2
Y0X0
X1
X3
OROR/
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
OR
OR Not
1
1
A: Available
Basic InstructionsFP0
2 - 19
2.3 Explanation of Basic Instructions
Outline Multiple blocks are connected in series.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
X0 Y00
X1Block 2
X2
X3
Block 1
0
1
2
3
4
5
ST X 0
OR X 1
ST X 2
OR X 3
ANS
OT Y 0
Explanation of exampleY0 goes on when X0 or X1 and X2 or X3 turn on.
Block 1 Block 2
(X0 OR X1) AND (X2 OR X3) → Y0
X0
X1
X2
X3
Y0
onoff
onoff
onoff
onoff
onoff
DescriptionBlocks connected in parallel are connected in series.
+
A block begins with the ST instruction.
ANSStep Availability
FP0 C10, C14, C16,C32, T32, SL1
AND stack 1
Basic Instructions FP0
2 - 20
2.3 Explanation of Basic Instructions
When blocks are consecutiveWhen blocks are consecutive, a division of the blocks should be considered, such as that shown below.
X0 Y0
X1
X2
X3
X4
X5
Block5
Block4
Block1
Block2
Block3
ST X 0
OR X 1
ST X 2
OR X 3
ANS 1. . . . . . . . . .
ST X 4
OR X 5
ANS 2. . . . . . . . . .
OUT Y 0
Block1
Block2
Block3
Block4
Block5
1 2
When entered using FP Programmer II
ANS: ANY-WY WRTSTK
IX/IY
Key operation
Basic InstructionsFP0
2 - 21
2.3 Explanation of Basic Instructions
Outline Multiple blocks are connected in parallel. 5
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
X0 Y00
X2 Block 2
X1
X3
Block 1
0
1
2
3
4
5
ST X 0
AN X 1
ST X 2
AN X 3
ORS
OT Y 0
Explanation of exampleY0 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
X0
X1
X2
X3
Y0
onoff
onoff
onoff
onoff
onoff
DescriptionBlocks connected in series are connected in parallel.
+ A block begins with the ST instruction.
ORSStep Availability
FP0 C10, C14, C16,C32, T32, SL1
OR stack 1
Basic Instructions FP0
2 - 22
2.3 Explanation of Basic Instructions
When blocks are consecutiveWhen blocks are consecutive, a division of the blocks should be considered, such as that shown below.
X0 Y0
X2
X1
X3
Block 5
Block 4
Block1
ST X 0
AN X 1
ST X 2
AN X 3
ORS 1. . . . . . . . .
ST X 4
AN X 5
ORS 2. . . . . . . . .
OUT Y 0
Block1
Block2
Block3
Block4
Block5
X4 X5
Block2
Block3
1
2
When entered using FP Programmer II
ORS: WRTSTKIX/IY
ORR-WR
Key operation
Basic InstructionsFP0
2 - 23
2.3 Explanation of Basic Instructions
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
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
Read Stack
X2
X10
X0 Y0
Push Stack Y1
X3 Y2
Pop Stack
0
1
2
3
4
5
6
7
8
9
ST X 0
PSHS
AN X 1
OT Y 0
RDS
AN X 2
OT Y 1
POPS
AN/ X 3
OT Y 2
Explanation of exampleWhen 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 resultstored by the PSHS instruction.
X0
X1
X2
X3
Y0
Y1
Y2
onoff
onoff
onoff
onoff
onoff
onoff
onoff
PSHSRDS
Step Availability
POPSFP0 C10, C14, C16,
C32, T32, SL1
Push stack
Read stack
Pop stack
1
1
1
Basic Instructions FP0
2 - 24
2.3 Explanation of Basic Instructions
DescriptionOne 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 fromthe next step.
POPS (resets operation contents):Reads the operation result stored using the PSHS instruction and, using this result, continues operation fromthe 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 orcontacts.
Precautions during programmingYou 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.
Y0X0 X1
Y1X2
Y2X3 X4
PSHS
RDS
POPS
An RDS instruction can be used repeatedly any number of times.
Y1X1
Y2X2
Y3X4 X5
RDSX3
Y0X0
Y4X6 X7
Basic InstructionsFP0
2 - 25
2.3 Explanation of Basic Instructions
Caution regarding repeated use of a PSHS instructionA PSHS instruction can be used up to eight times before the next POPS instruction is entered. If used ninetimes, caution is required as correct operation cannot be guaranteed.
1
Y0X0 X1 X2 X3 X4 X5 X6 ST X 0PSHS . . . .AN X 1PSHS . . . .AN X 2PSHS . . . .AN X 3PSHS . . . .AN X 4PSHS . . . .AN X 5PSHS . . . .AN X 6PSHS . . . .AN X 7PSHS . . . .AN X 8OT Y 0
Max. 8 times
X7 X81
2
3
4
5
6
7
8
2 3 4 5 6 7 8
If a POPS instruction is used during repeated use of a PSHS instruction, reading will take place in orderbeginning from the last data stored by the PSHS instruction.
Y0X0 X1 X2 X3 X4 X5 POPS Reading. . . . .AN X 6OT Y 1POPS Reading. . . . .AN X 7OT Y 2POPS Reading. . . . .AN X 8OT Y 3
Y1X6
Y2X7
Y3X8
Y4X9
Y5XA
5
4
3
4321
5
Basic Instructions FP0
2 - 26
2.3 Explanation of Basic Instructions
Outline DF: Turns on the contact for only one scan when the leading edge ofthe trigger is detected.
DF/: Turns on the contact for only one scan when the trailing edge ofthe trigger is detected. 7
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
Leading edge differential
X0 Y00
X1 Y13
(DF)
(DF/)
Trailing edge differential
0
1
2
3
4
5
ST X 0
DF
OT Y 0
ST X 1
DF/
OT Y 1
Explanation of exampleY0 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.
X0
X1
1 scan
Y0
Y1
Leadingedge
Trailingedge
1 scan
1 scan1 scan
↔ ↔
↔↔
onoff
onoff
onoff
onoff
DFDF/
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
Leading edge differential
Trailing edge differential
1
1
Basic InstructionsFP0
2 - 27
2.3 Explanation of Basic Instructions
DescriptionThe DF instruction executes and turns on output for only one scan duration when the trigger changes from anoff to an on state.
The DF/ instructionexecutesand turnson output for onlyone scandurationwhen the triggerchanges fromanon 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 turnedon in RUN mode, output will not be obtained.
Example: Leading edge differential (DF) instruction
X0
Y0
RUNLeadingedge
DF instructionnot executed.
onoff
onoff
For detailed information section 4.5
Precautions during programmingWith a program such as the one in the figure below, operation will be as follows.
(DF)X0 Y0X1
1 2
X0
X1
3
Y0
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.
Basic Instructions FP0
2 - 28
2.3 Explanation of Basic Instructions
In the following program the execution condition (trigger) is initially on, therefore output is not obtained.R9013
R9013 only turns on during the first scan afterRUN begins.
DFY0
R9010R9010 is always on.DF
Y0
With the following program, output is obtained.R9014
R9014 turns on from the second scan afterRUN begins.
DFY0
Exercise caution when used in combination with instructions which change the order of instruction executionsuch 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
Whencombiningadifferential instructionwith anANDstackorpopstack instruction, takecare that thesyntaxis correct. For detailed information section 4.6
Basic InstructionsFP0
2 - 29
2.3 Explanation of Basic Instructions
Example of a differential instruction applicationUsing a differential instruction makes it easier to adjust a program.Application to a self -hold circuitUsing a differential instruction makes it possible to handle long input signals.
With no differential instruction
X0DF
Y0R0
Y0
X1DF
R0
X0
X1
R0
Y0
Y0
Application to an alternating circuitA differential instruction can also be applied to an alternating circuit to hold and release the circuit using asingle signal.
Example 1:
R0 Y0
R0
Y0
X0 R0
Y0
DF
Example 2:
R0 Y0
Y0Y0
R0
X0 R0DF
Basic Instructions FP0
2 - 30
2.3 Explanation of Basic Instructions
Outline SET: When the execution conditions have been satisfied, the output isturned on, and the on status is retained.
RST: When the execution conditions have been satisfied, the output isturned off, and the off status is retained.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
X0 Y020
X124
Output destination
S
RY0
⟨ ⟨
⟨ ⟨
Reset
Set 20
21
24
25
ST X 0
SET Y 0
ST X 1
RST Y 0
Operands
InstructionRelay Timer/Counter
ContactInstructionX Y R T C
SET, RST N/A A A N/A N/A
Explanation of exampleWhen X0 turns on, Y0 goes on and holds on.
When X1 turns on, Y0 goes off and stays off.
X0
X1
Y0
onoff
onoff
onoff
DescriptionThe SET instruction executes when the trigger is turned on. Output turns on and holds on even if the trigger’sstate changes.
The RST instruction executes when the trigger is turned on. Output turns off and stays off even if the trigger’sstate 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.)
SETRST
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
Set
Reset
3
3
A: AvailableN/A: Not Available
Basic InstructionsFP0
2 - 31
2.3 Explanation of Basic Instructions
When SET and RST instructions are usedWhen the SET and RST instructions are used, the output changes with each step during processing of theoperation.
Example: When X0, X1, and X2 are turned onX0 Y0
X1 Y0
X2 Y0
Y0This portion of the program is processed as if Y0 were on.
This portion is processed as if Y0 were off.
This portion is processed as if Y0 were on.
S
R
⟨ ⟨
⟨ ⟨
S⟨ ⟨
I/O update is performed when an ED instruction is executed, therefore the data actually output is determinedby 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 programmingThe 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 whenthe power is turned off, except when a hold type internal relay is specified as the output destination.
SET and RST instructions and differential instructionsBe sure to place a differential instruction before the SETand RST instructions to make program developmentand refinement easier.
This is particularly effective when the same output destination is used in several places in the program.
X0 Y0
X1 Y0
(DF)
(DF) R⟨ ⟨
S⟨ ⟨
Basic Instructions FP0
2 - 32
2.3 Explanation of Basic Instructions
Outline This is output which is accompanied by set or reset input, and which isretained. 4
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
Output destination
X0KP R 300
Set input
X11
Reset input
0
1
2
ST X 0
ST X 1
KP R 30
Operands
InstructionRelay Timer/Counter
ContactInstructionX Y R T C
KP N/A A A N/A N/A
Explanation of exampleWhen X0 turns on, output relay R30 goes on and stays on.
R30 goes off when X1 turns on.
X0
X1
R30
Set Reset Reset takesprecedence
onoff
onoff
onoff
DescriptionWhen 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 turnson, regardlessof the on oroff statesof the setinput.
If the set input and reset input turn on simultaneously, the reset input has priority.
KPStep Availability
FP0 C10, C14, C16,C32, T32, SL1
Keep 1
A: AvailableN/A: Not Available
Basic InstructionsFP0
2 - 33
2.3 Explanation of Basic Instructions
Precautions during programmingWhen the KP instruction is programmed between the MC and MCE instructions, the status of outputdestination 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 RUNto 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.
Basic Instructions FP0
2 - 34
2.3 Explanation of Basic Instructions
Outline No operation 5
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
X00
Y0X2X1S
NOP
0
1
2
3
4
ST X 0
AN X 1
NOP
AN/ X 2
OT Y 0
DescriptionThis 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 theprevious instruction).
When you want to move the addresses of one part of a program without changing the program, insert a NOPinstruction.
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 39to address 40, insert a NOP instruction at address 39.Address
36 ST X0S OR X1S OT Y1
39 ST X240 AN X3S OT R20S ST R2S DF
44 ST X3
Address36 ST X0S OR X1S OT Y1
39 NOP40 ST X241 AN X3S OT R20S ST R2S DF
45 ST X3
Insert a NOPinstruction.
This moves thestarting point toaddress 40.
Deleting a NOP instructionTo 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, andexecute the instruction.
Using the FP programmer II: Enter the following series of key operations.Key operation: ENT
(- )OP 1ACLR
SHIFTSC
(DELT)INST
NOPStep Availability
FP0 C10, C14, C16,C32, T32, SL1
No operation 1
Basic InstructionsFP0
2 - 35
2.3 Explanation of Basic Instructions
Outline TML: Sets the on-delay timer for 0.001s unitsTMR: Sets the on-delay timer for 0.01s unitsTMX: Sets the on-delay timer for 0.1s unitsTMY: Sets the on-delay timer for 1.0s units 6
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
T5
Set value
X0 TMX 5 K 300
4Y0
Trigger
Timer contact of timer No.5
Timer numberUnit of timer
Elapsed value
0
1
4
5
ST X 0
TMX 5
K 30
ST T 5
OT Y 0
Operands
InstructionRelay Timer/
Counter Register Indexregister Constant Index
modifierInstructionWX WY WR SV EV DT IX IY K H
modifier
Set value N/A N/A N/A A N/A N/A N/A N/A A N/A N/A
TMLTMR
Step Availability
TMXTMY
3
3
3
4
FP0 C10, C14, C16,C32, T32, SL1
0.001s units timer
0.01s units timer
0.1s units timer
1s units timer
A: AvailableN/A: Not Available
Basic Instructions FP0
2 - 36
2.3 Explanation of Basic Instructions
DescriptionThe 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 ofsystem 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 datawhen the power is turned off or the mode is changed from the RUN to the PROG mode. (If you need to retainthe operating state, set system register 6.)
When the execution condition (trigger) is on, the set time [n] decrements, and when the elapsed valuereaches 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 toolsThe programming tool software (NPST-GR Ver. 4.2 or later) or FP Programmer II (AFP1114V2) isnecessary to read or write a TML instruction (0.001 sec increment timer).
Timer set timeThe 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.3seconds.
When K500 is set in TMR, the set time is 0.01 × 500 = 5seconds.
Precautions during programmingThe timer value decrements during processing, therefore, create the program so that one decrement occursduring one scan. (A correct result will not be obtained if no processing operations or multiple processingoperations 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 stackinstruction. For detailed information section 4.6
Basic InstructionsFP0
2 - 37
2.3 Explanation of Basic Instructions
Timer operationThe following is an example of setting the set value with a K constant. For an explanation of operation when aset 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, thetimer set value is transferred to the set value area (SV) with the same number.
TMX 5, K
T5
1 Transfers to SV area
SV53030
Y0
X0
Set value
2 When the timer trigger rises from off to on, the setting is transferred from the set value area (SV) to theelapsed value area (EV) with the same number. (The same operation takes place if the mode ischanged to RUN when the trigger is on.)
3 The value in the elapsed value area (EV) decrements every scan if the trigger stays on.
TMX 5, K
T5
2 Transfers to EV area
SV53030
EV530292827
3 Decrements
Y0
X0
4 When the value in the elapsed value area (EV) reaches zero, the timer contact (T) with same numberturns on.
TMX 5, K 30
T5
SV530
EV50
4 Decrement operation endsY0
X0
See section 1.2 for an explanation of the set value area (SV) and the elapsed value area (EV).
Basic Instructions FP0
2 - 38
2.3 Explanation of Basic Instructions
Examples of timer instruction applications
Serial connection of timer
Ladder diagram Boolean Time chart
T0
X0 TMX 1, K 20
Y0
T1 Y1
ST X 0TMX 0
K 30TMX 1
K 20ST T 0OT Y 0ST T 1OT Y 1
X0
T0
T1 3s
2sY0
Y1
TMX 0, K 30
onoff
onoff
onoff
onoff
onoff
Parallel connection of timer
Ladder diagram Boolean Time chart
Y0
Y1
T0
X0 TMX 0, K 30
Y0
T1 Y1
ST X 0PSHSTMX 0
K 30POPSTMX 1
K 20ST T 0OT Y 0ST T 1OT Y 1
X0
T0
T1TMX 1, K 20 3s
2s
onoff
onoff
onoff
onoff
onoff
Changing a timer setting time while in operationA timer setting time can be changed during RUN. For detailed information section 4.8
Related instructionsThere are also auxiliary timer instructions (F137, F183) for timers.
Basic InstructionsFP0
2 - 39
2.3 Explanation of Basic Instructions
Directly specifying a set value area number as a timer setting value
F0 MV, K30, SV5
X1
X0
T5 Y0
1. . . . . . . . . . . . .
TMX 5, SV5 2. . . . . . . . . . . . .
The above program operates as follows:
1 When execution condition (trigger) X0 is on the data transfer instruction [F0 (MV)] is executed, set theK30 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: 5 5ENTTM
T-SVST
X-WXTM
T-SV
TMX 5
Set value area number (n)
These must be the same.
Display:
SV 5
Timer number
Even if the value of the set value area (SV) is changed during decrement operation, the decrement operationwill continue from the value before the change. Timer operation from the new value will not begin untildecrementoperationhasendedor is interruptedand the execution condition (trigger) subsequently changesfrom 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 ischanged from RUN to PROG.
Basic Instructions FP0
2 - 40
2.3 Explanation of Basic Instructions
Timer operation when a set value area number is directly specified1 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).
F0 MV, K30, SV5
X1
X0
T5 Y0
TMX 5, SV 51 Transfers to SV area
SV530
Set value
2 When the timer execution condition (trigger) rises from off to on, the setting is transferred from the setvalue area (SV) to the elapsed value area (EV) with the same number. (The same operation takesplace 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 onevery scan.
F0 MV, K30, SV5
X1
X0
T5 Y0
TMX 5, SV 5
SV530
2 Transfers to EV area
EV5302928273 Decrement
operation
4 When the value in the elapsed value area (EV) reaches zero, the timer contact (T) with same numberturns on.
EV50
4 Decrement operation ends
X1
T5 Y0
SV530
TMX 5, SV 5
See section 1.2 for an explanation of the set value area (SV) and the elapsed value area (EV).
Basic InstructionsFP0
2 - 41
2.3 Explanation of Basic Instructions
Examples of applying direct specification of set value area numbers
Example 1: Changing set values based on specified conditionsThe set value is K50 when X0 is on and K30 when X1 is on.
T5
X2 TMX 5, SV 5
Y0
ST/ X 1AN X 0F0 (MV)
K 50SV 5
ST/ X 0AN X 1F0 (MV)
K 30SV 5
ST X 2TMX 5
SV 5ST T 5OT Y 0
X0 X1F0 MV, K 30, SV 5
X1 X0F0 MV, K 50, SV 5
BooleanLadder diagram
X0
X1
X2
5sT5
3sSV5 K0 K50 K30 K50
onoff
onoff
onoff
onoff
Time chart
Example 2: Example of setting a set value from external digital switchesThe BCD data of the digital switches connected to X0 through XFis converted and becomes the set value
T5
R11 TMX 5, SV 5
Y0
ST R 10F81 (BIN)
WX 0SV 5
ST R 11TMX 5
SV 5ST T 5OT Y 0
R10
F81 BIN, WX 0, SV 5
FP0 control unit
0 7 9 4
WX0 Digital switch
Set valueof timer
Connection example
Ladder diagram Boolean
Basic Instructions FP0
2 - 42
2.3 Explanation of Basic Instructions
Outline Decrements a preset counter. 5
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
X1
C 100 Set value
X0 CT 100
K 100
5
Reset input
Y0
Count input
1
Counter contact for counter no. 100(example showing a case where100 and subsequent numbers arespecified for counters)
Elapsed value
Count number0
1
2
5
6
ST X 0
ST X 1
CT 100
K 10
ST C 100
OT Y 0
Operands
InstructionRelay Timer/Counter Register Index
register Constant IndexmodifierInstruction
WX WY WR SV EV DT IX IY K Hmodifier
Set value N/A N/A N/A A N/A N/A N/A N/A A N/A N/A
Explanation of exampleWhen 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.
C100
onoffX0
X1 10 times
....
Y0
onoff
onoff
onoff
CTStep Availability
FP0 C10, C14, C16,C32, T32, SL1
Counter 3
A: AvailableN/A: Not Available
Basic InstructionsFP0
2 - 43
2.3 Explanation of Basic Instructions
DescriptionThe 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 powersupply is turned off, or if the mode is switched from RUN to PROG, and a non-hold type, in which the counteris 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. Fordetailed 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 theelapsed 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 valuereaches 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 isexecuted.
An OT instruction can be entered immediately after a counter instruction.
Setting the counting valueThe counting value can be set to a decimal constant (K constant) from K0 to K32767.
Basic Instructions FP0
2 - 44
2.3 Explanation of Basic Instructions
Counter operationThe following are examples of specifying a K constant as the set value. For an explanation of operation whena 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 counterset 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).
X1
X0
C100 Y0
CT 100
K 10
SV10010
2 PresetEV100
10
1 Transfer
3 Each time the count input X0 turns on, the value in the elapsed value area (EV) decrements.
X1
X0
C100 Y0
CT 100
K 10
SV10010
EV10010
987
3 Decrements
4 When the value in the elapsed value area (EV) reaches zero, the counter contact (C) with the samenumber turns on.
X1
X0
C100 Y0
CT 100
K 10
SV10010
EV1000
4 Decrement operation ends
For information on the set value area (SV) and the elapsed value area (EV), see section 1.2.
Basic InstructionsFP0
2 - 45
2.3 Explanation of Basic Instructions
Changing counter set value during RUNThe counter set value can be changed during RUN. For the procedure, see section 4.8.
Precautions of counting input detectionIn a counter instruction, the decrement takes place when the rise of the count input from off to on isdetected.
If the count input remains continuously on, since a decrement will only take place at the rise, no furthersubtraction 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 turnedon with the mode set to RUN, decrement operation will not take place at the first scan.
Counter input
Operation ofinstruction
RUN(Power: on)
CountingNot counting
When used in combination with instructions which change the order of instruction execution such as MC andMCE or JP and LBL (see below), the operation of the instruction may change depending on the timing ofinstruction 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 thatthe syntax is correct. For detailed information section 4.6
Related instructionsCounter instructions also include an up/down counter instruction (F118).
An increment instruction (F35) can be used to provide the same type of function.
Basic Instructions FP0
2 - 46
2.3 Explanation of Basic Instructions
Directly specifying a set value area number as a counter set value
F0 MV, K30, SV100
X1
X0
C100 Y0
1. . . . . . . . . . .
CT 100
SV 1002. . . . . . . . . . .
X2
The above program operates as follows:
1 When execution condition (trigger) X0 is on the data transfer instruction [F0 (MV)] is executed, set theK30 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.
Key input of FP Programmer II: ENT0CTC-EV 1 0 01 0TM
T-SV
Set value area number [n]
Counter numberDisplay:
CT 100
SV 100
These mustbe the same.
Even if the value in the set value area (SV) is changed during decrement operation, the decrement operationwill continue from the value before the change. Counter operation from the new value will not begin until thecounter 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 modechanged from RUN to PROG. If the SV value is changedduring RUN, the set value will be preset the next timethe power is turned on or the mode is changed from PROG. to RUN.
Basic InstructionsFP0
2 - 47
2.3 Explanation of Basic Instructions
Counter operation when a set value area number is directly specified1 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).
F0 MV, K30, SV100
X1
X0
C100 Y0
CT
SV 100
100
X2
SV10030
1 Transfers to SV area
2 When the reset input is off, the value in the set value area (SV) is preset in the elapsed value area(EV).
X1
C100 Y0
CT
SV 100
100
X22 Presetting
SV10030
EV10030
3 Each time the count input X1 turns on, the value in the elapsed value area (EV) decrements.
X1
C100 Y0
CT
SV 100
100
X2
SV10030
EV10030
292827
3 Decrements
4 When the elapsed value area (EV) reaches zero, the counter contact C with the same number turnson.
X1
C100 Y0
CT
SV 100
100
X2
SV10030
EV1000
4 Decrement operation ends
See section 1.2 for an explanation of the set value area (SV) and the elapsed value area (EV).
Basic Instructions FP0
2 - 48
2.3 Explanation of Basic Instructions
Examples of applying direct specification of set value area numbers
Example 1: Changing set values based on specified conditionsThe set value is K50 when X0 is on and K30 when X1 is on.
C100
X2
ST/ X 1AN X 0F0 (MV)
K 50SV 100
ST/ X 0AN X 1F0 (MV)
K 30SV 100
ST X 2ST X 3CT 100
SV 100ST C 100OT Y 0on
offX0onoffX1
X2onoff
onoffX3
X0 X1F0 MV, K 30, SV 100
X1 X0F0 MV, K 50, SV 100
X3
onoff
50 times
K0 K50
CT 100
SV 100
Y0
C100
SV100
......
Example when X0 turns onTime chart
BooleanLadder diagram
Example 2: Example of setting a set value from external digital switchesThe BCD data of the digital switches connected to X0 through XFis converted and becomes the set value.
C100
R11 CT 100
SV 100
Y0
ST R 10F81 (BIN)
WX 0SV 100
ST R 11ST R 12CT 100
SV 100ST C 100OT Y 0
R10F81 BIN, WX 0, SV 100
FP0 control unit
0 7 9 4
Digital switch: WX0
Set valueof counter
R12
Boolean
Connection diagram
Ladder diagram
Basic InstructionsFP0
2 - 49
2.3 Explanation of Basic Instructions
Outline One bit shift of 16-bit [word internal relay (WR)] data to the left. 5
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
X1
SR WR 3X00
Data input
1X2 Reset input
2
Shift inputD
0
1
2
3
ST X 0
ST X 1
ST X 2
SR WR 3
Operands
InstructionRelay Timer/Counter Register Index
register Constant IndexmodifierInstruction
WX WY WR SV EV DT IX IY K Hmodifier
D: Data area N/A N/A A N/A N/A N/A N/A N/A N/A N/A N/A
Explanation of exampleIf the X1 turns on when X2 is in the off state, the contents of the internal relay WR3(internal relaysR30 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.
X0
X1
X2onoffR30onoffR31onoffR32onoffR33onoffR34
onoff
onoff
onoff
SR Shift registerStep Availability
FP0 C10, C14, C16,C32, T32, SL1
1
A: AvailableN/A: Not Available
Basic Instructions FP0
2 - 50
2.3 Explanation of Basic Instructions
DescriptionShifts 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.
WR3
Bit position
Binary data
3F 30. . . . . . . . . . . . . . . .
15 . . 12 11 . . 8 7 . . 4 3 . . 0
0 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0
Binary data 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0
When shift input is turned on:
Data input (X0) on: set bit to 1.Data input (X0) off: set bit to 0.
Shifts one bitto the left.
When the reset input turns on, the contents of WR are cleared.
WR (Binary data) 0 0 1 1 0 1 0 0 0 0 0 1 1 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
When reset input is turned on:
Contents of WR3 arecleared to 0.
WR (Binary data)
Precautions during programmingThe 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.
Reset input
Data area (Rn)
Reset input is given priority
Shift input
If the internal relay area is specified as a hold type, take care that the data in the area is not reset to “0” whenthe power turns on.
When combining a shift register instruction with an AND stack instruction or pop stack instruction, take carethat the syntax is correct. For details, refer to section 4.6.
Basic InstructionsFP0
2 - 51
2.3 Explanation of Basic Instructions
Cautions on shift input detectionWith 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 shiftswill takeplace.
In cases where the shift input is initially on such as when the mode is changed to RUN or when the power isturned on with the mode set to RUN, a shift operation will not take place at the first scan.
Shift input
Opration ofinstruction
RUN(Power: on)
ShiftsDoes not shift
When used in combination with instructions which change the order of instruction execution such as MC andMCE or JP and LBL (see below), the operation of the instruction may change depending on the timing ofinstruction 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 instructionsIn 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 datarotate instructions (F120 to F123).
Basic Instructions FP0
2 - 52
2.3 Explanation of Basic Instructions
Outline Executes the program between the MC and MCE when the executioncondition (trigger) turns on. 6
When the execution condition (trigger) is off, output between the MCand MCE is turned off.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
(MC 1 )X1 Y1
3
Master control relay number
X2 Y26
X00
Execution condition(trigger)
(MCE 1 )9
Y1
Y2
Mastercontrolarea
Master control relay number
0
1
3
4
5
6
7
8
9
ST/ X 0
MC 1
ST X 1
OR Y 1
OT Y 1
ST X 2
OR Y 2
OT Y 2
MCE 1
Explanation of exampleExecutes 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 theMC1 and MCE1 instructions.
X1
onoffX2
onoff
onoff
onoff
onoffY1
Y2
X0Executioncondition(trigger)
onoff
Master control relayMCMCE
Step Availability
Master control relay end
2
2
FP0 C10, C14, C16,C32, T32, SL1
Basic InstructionsFP0
2 - 53
2.3 Explanation of Basic Instructions
DescriptionExecutes 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 outputOT 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 leadingedge 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)
Basic Instructions FP0
2 - 54
2.3 Explanation of Basic Instructions
Operation of differential instructions between MC and MCEIf a differential instruction is used between MC and MCE, the output will vary as follows depending on thetiming of the MC execution condition (trigger) and the input of differential instruction.
X1DF
Y0
MCE 0
X0MC 0
Time chart 1 Time chart 2
X0
X1
Y0
Execution of previousdifferential instruction
The input X1 of the differential instruction has notchanged with respect to the previous execution,therefore differential output is not obtained.
X0
X1
Y0
The input X1 of the differential instruction haschanged from off to on with respect to theprevious execution, therefore differential outputis obtained.
Execution of previousdifferential instruction
onoffonoff
onoff
onoff
onoff
onoff
Output will not be obtained if the same execution condition (trigger) is specified for an MC instruction and adifferential instruction. If output is needed, enter the differential instruction outside of the MC to MCEinstruction sequence.
X0DF
Y0
MCE 0
X0MC 0
R0DF
Y0
MCE 0
X0MC 0
X0 R0
Basic InstructionsFP0
2 - 55
2.3 Explanation of Basic Instructions
Precautions during programmingA 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.)
X3 Y1
MCE 2
X2MC 1
X0MC 0
MCE 1
MCE 0
X1 Y0
X5 Y2
X4MC 2
The program cannot be executed if:
If either MC or MCE is missing
The order of the MC and MCE instructions is reversed.
X1 Y0
MC 0X0
MCE 0
There are two or more master control instruction sets with the same number.
X2 Y0
MCE 0
X1MC 0
X0MC 0
MCE 0
Duplicated use
Basic Instructions FP0
2 - 56
2.3 Explanation of Basic Instructions
Outline Skips to the LBL instruction with the same number as the JP instruction.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
(JP 1 )
(LBL 1 )
X110
Label number
20
10
11
20
....
ST X 1
JP 1
LBL 1
....
Explanation of exampleWhen the execution condition (trigger) X1 turns on, the program skips from JP1 to LBL1.
(JP 1 )
(LBL 1 )
X1 Program
Program
Program
X1: on
Noexecution
DescriptionWhen the execution condition (trigger) turns on, the program jumps to the label (LBL) instruction that has thesame number as the specified jump number.
The program then continues with the instructions starting from the address of the label that is the jumpdestination.
The same label is used for the JP and LOOP instructions. Any of these instructions can be used as thestarting 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.
(LBL 1 )
(JP 1 )
(JP 1 )
R20
X0
X20LOOP 1, DT0
JPLBL
Step Availability
Jump
Label
2
1
FP0 C10, C14, C16,C32, T32, SL1
(JP 1 )
(LBL 1 )
X1
The program jumps whenthe execution condition(trigger) turns on.
(JP 1 )
(LBL 1 )
X1
The program is repeatedwhen the execution condi-tion (trigger) turns on.
Basic InstructionsFP0
2 - 57
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 aexecution 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 programmingIf the address of the LBL instruction precedes the address of the JP instruction, the scan will not terminateand an operation bottleneck error may occur.
The JP instruction and LBL instruction cannot be used in the step ladder area (the area between SSTP andSTPE).
You cannotperform a jump froma main program to a subprogram (asubroutine program or interruptprogramafter the ED instruction), from a sub program to a main program, or from a sub program to another subprogram.
TM, CT, and SR instruction operation between JP and LBL instructionsWhen the LBL instruction is located after the JP instruction:- TM instruction: The TM instruction is not executed.
If it is not executed once during a single scanthe correct time cannot be guaranteed.
- CT instruction: Even if the count input is on, counting is notperformed. The elapsed value is preserved.
- SR instruction: Even if the shift input is on, no shift isperformed. The contents of the specifiedregister are preserved.
When the LBL instruction is located before the JP instruction:- TM instruction: Because the TM will run several times during a
single scan, the correct time cannot beguaranteed.
- CT instruction: If the state of the count input does not changeduring the scan, it will operate in the usual way.
- SR instruction: If the state of the shift input does not changeduring the scan, it will operate in the usual way.
Basic Instructions FP0
2 - 58
2.3 Explanation of Basic Instructions
Differential instruction operation between JP and LBL instructionsIf a differential instruction is used in the area between a JP and LBL instruction, be aware that the output willdiffer as shown below depending on the execution condition (trigger) of the JP and the input timing ofdifferential instruction.
X1DF
Y0
LBL 1
X0JP 1
Time chart 1 Time chart 2
X0
X1
Y0
Previousexecution ofdifferentialinstruction
Since the executioncondition (trigger) X1 forthe differential instructiondid not change from theprevious execution, thedifferential output cannotbe obtained.
X0
X1
Y0
Since the executioncondition (trigger) X1 forthe differential instructionchanged from on to offfrom the previousexecution, the differentialoutput can be obtained.
Previousexecution ofdifferentialinstruction
onoffonoff
onoff
onoff
onoff
onoff
When the execution condition (trigger) for the JP instruction equals the execution condition (trigger) for thedifferential instruction, the leading edge (or trailing edge) of the execution condition for the differentialinstruction will not be detected.If the differential output is required, do not write the differential instruction between the JP and LBLinstructions.
X1DF/
Y1
LBL 1
X1JP 1
Not executed.
X1DF/
Y1
LBL 1
X1JP 1
Placed outside of the areabetween JP and LBL.
Basic InstructionsFP0
2 - 59
2.3 Explanation of Basic Instructions
Outline Skips to the LBL instruction that has the same number as the LOOPinstruction and executes what follows, repeatedly, until the data of aspecified operand becomes “0”. 7
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
(LBL 1 )
X1 Number of timers for loop
Label number
LOOP 1 , DT 0S
16
30
Label number
F0 MV, K5, DT 010X1
10
11
16
30
31
ST X 1
F0 (MV)
K 5
DT 0
LBL 1
ST X 1
LOOP 1
DT 0
....
S 16-bit area for setting number of times for loop operation
Operands
InstructionRelay Timer/Counter Register Index
register Constant IndexmodifierInstruction
WX WY WR SV EV DT IX IY K Hmodifier
S N/A A A A A A A A N/A N/A A
LBL
Step Availability
LOOP Loop
Label
4
1
FP0 C10, C14, C16,C32, T32, SL1
A: AvailableN/A: Not Available
Basic Instructions FP0
2 - 60
2.3 Explanation of Basic Instructions
DescriptionWhen the execution condition (trigger) turns on, 1 is subtracted from the contents of S and if the result is otherthan 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 loopdestination.
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.
(LBL 1 )
X1LOOP 1 , DT 0
If the value of DT0 is K5, then after performing the jump 5 times,even if X1 is set to on, the jump operation is not executed.
X0F0 MV, K5 , DT 0
If the contents of memory area specified by S is 0 from the beginning, the jump operation is not executed (it isignored).
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 allinstructions as many times as required.
X20LOOP 1, DT0
R20JP 1
X0JP 1
LBL 1
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 conditionsS 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 thespecified data area becomes “1”).
S Error flag (R9008): Turns on for an instant when the specified value in the data area becomesless than “0” (when the most significant bit (bit position 15) of the specifieddata area becomes “1”).
(LBL 1 )
X0LOOP 1, DT 0
The program is repeatedwhen the executioncondition (trigger) turns on(DT0=1).
(LBL 1 )
X0LOOP 1, DT 0
The program jumps whenthe execution condition(trigger) turns on (DT0=1).
Basic InstructionsFP0
2 - 61
2.3 Explanation of Basic Instructions
TM, CT, and SR instruction operation between the LOOP and LBL instructionsWhen the LBL instruction is located before the LOOP instruction:- TM instruction: Because the timer will run several times during
a single scan, the correct time cannot beguaranteed.
- CT instruction: If the state of the count input does not changeduring the scan, it will operate in the usual way.
- SR instruction: If the state of the shift input does not changeduring the scan, it will operate in the usual way.
When the LBL instruction is located after the LOOP instruction:- 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 notperformed. The elapsed value is preserved.
- SR instruction: Even if the shift input is on, no shift isperformed.The contents of the specified register arepreserved.
Precautions during programmingWhen 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.
F0 MV, WR 0, DT 10F0 MV, WR 1, DT 20LOOP 10, DT 0
X5LBL 10
X5F0 MV, K 5, DT 0
Example 2: Send the value of DT100 to DT200 through DT219.
F0 MV, DT100, IXDT200R0
LBL 10
R0F0 MV, K 20, DT 0
F35 +1, IXLOOP 10, DT 0
F0 MV, K 0, IX
Basic Instructions FP0
2 - 62
2.3 Explanation of Basic Instructions
The LOOP instruction and LBL instruction cannot be used in the step ladder area (the area between SSTPand STPE).
You cannot perform a jump from a main program to a sub-program (a subroutine program or interruptprogram after the ED instruction), from a sub-program to a main program, or from a sub-program to anothersub-program.
You must be careful when using one of the instructions below, which are executed by detecting the leadingedge 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)
Basic InstructionsFP0
2 - 63
2.3 Explanation of Basic Instructions
Outline Indicates the end of the ordinary program. 8
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
0X0
R0
R0X1
R0 Y096
X2
( ED )99
0
1
2
3
96
97
98
99
....ST X 0
OR R 0
AN/ X 1
OT R 0
ST R 0
AN X 2
OT Y 0
ED
....
DescriptionIndicates the end of the ordinary program.
0Address
( ED )
Ordinary program
Subroutine program
Interrupt program
Program area
Program areas are divided into an ordinary program area (main program) and “subroutine” and “interruptprogram” areas (sub-programs) using this instruction.
Enter subroutine programs and interrupt programs after the ED instruction.
EDStep Availability
FP0 C10, C14, C16,C32, T32, SL1
End 1
Basic Instructions FP0
2 - 64
2.3 Explanation of Basic Instructions
Outline Ends one scan of the program when the execution condition (trigger)turns on. 9
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
0X0
Y0
Y0X1
R0 Y1
96X2
( CNDE )
98
X3 Execution condition (Trigger)
0
1
2
3
96
97
98
99
100
....ST X 0
OR Y 0
AN/ X 1
OT Y 0
ST X 3
CNDE
ST R 0
AN/ X 2
OT Y 1
....
DescriptionThe 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 suchoperations are performed. When the operations are completed, the program then returns to the startingaddress.
You can adjust the timing that operations are performed by performing the operations only after a requirednumber of program scans are completed.
The CNDE instruction cannot be performed in sub-programs such as subroutine programs or interruptprograms. 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 leadingedge of a execution condition (trigger) such as the differential instruction. For more details, refer to section4.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)
CNDEStep Availability
FP0 C10, C14, C16,C32, T32, SL1Conditional end 1
Basic InstructionsFP0
2 - 65
2.3 Explanation of Basic Instructions
Y0
X0
ED
X1 Y0
X3CNDE Program execution
during normal scanning.
Program execution when the CNDEinstruction is executed (when X3 turns on).
This part of the program isnot executed when the CNDEinstruction is executed.
Basic Instructions FP0
2 - 66
2.3 Explanation of Basic Instructions
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
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
(NSTP 1 )
(SSTP 1 )
(NSTL 2 )
(SSTP 2 )
(CSTP 50 )
(STPE )
Y017
X010
14
X118
22
X3100
104
10
11
14
17
18
19
22
100
101
104
....
ST X 0
NSTP 1
SSTP 1
OT Y 0
ST X 1
NSTL 2
SSTP 2
ST X 3
CSTP 50
STPE
....
Next step (pulse execution type)
SSTPNSTP
Step Availability
NSTLCSTPSTPE
Start step
Next step (scan execution type)
Clear step
Step end
FP0 C10, C14, C16,C32, T32, SL13
3
3
3
1
Basic InstructionsFP0
2 - 67
2.3 Explanation of Basic Instructions
DescriptionWhen the NSTL instruction or the NSTP instruction is executed, the process starting with the SSTPinstruction 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 orSTPE 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)
Example: (SSTP 1 )
Y0
(SSTP 2 )
X1F0 MV, DT 0, DT 100
X0
Process 1
Operations such as the sequence control, selection branch control, parallel branch control are easilyexecuted.
Sequence controlOnly the necessary processes are switched and executed in order.
Process 1 Process 2 Process 3 Process 4
Selection branch controlThe processes are selected and executed according to conditions.
Process 1
Process 2
Process 3
Process 4
Parallel branch merge controlMultiple processes are executed simultaneously.
After each process is completed, the next process is executed.
Process 1
Process 2
Process 3
Process 4
NoteThe step ladder of FP0 is not held, so be sure to take thenecessary precautions.
Basic Instructions FP0
2 - 68
2.3 Explanation of Basic Instructions
Syntax of step ladder instructionSSTP (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 numberfrom 0 to 127).
SSTP 1
SSTP 2
SSTP 5
Program
Program
Program
Process 1
Process 2
In a step ladder program, a process n is identified as being from one SSTPn instruction to the next SSTP orSTPE 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 ladderareas.
SSTP 1
SSTP n
STPE
Ordinary ladder area
Ordinary ladder area
Step 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 counterreset 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 theNSTP or NSTL instruction is opened.
The execution condition (trigger) for the next step instruction means the execution condition (trigger) to startthe process.
SSTP 1
NSTL 2
SSTP 2
R0
NSTP 1X0
X0: off → on↓
SSTP1: Starts
R0: on↓
SSTP1: ClearedSSTP2: Starts
Basic InstructionsFP0
2 - 69
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 isoperating 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 nextscan.
The NSTP instruction is a differential (pulse) execution type instruction, so it is executed for only one timewhen 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 onwhile in the RUN mode and the execution condition (trigger) is already on, the instruction is not executed.
Shift input
Operationswith NSTP
RUN(Power: on)
ExecutedNotexecuted
Operationswith NSTL
ExecutedExecuted
When you use the NSTP instruction with one of the following instructions that changes the order of theexecution of instructions, be aware that the operation of the instructions will differ depending on the timing oftheir 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 thatthe programming is correct. For more details, refer to section 4.6.
Basic Instructions FP0
2 - 70
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. Thisinstruction can be used to clear the final process or to clear the processes when the parallel branch mergecontrol is executed.
CSTP 50
SSTP 50
SSTP 51
NSTP 50X0
X1: on↓
Process 50: clearedX1
Process 50Program
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 ofthe last process. Thus, the final process of the step ladder is from SSTP to STPE.
Process n
Ordinary ladder area
Ordinary ladder area
Step ladder area
SSTP 1
SSTP n
STPE
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 insub-program such as a subroutine program or interrupt program.)
Precautions during programmingYou 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.
Basic InstructionsFP0
2 - 71
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
SSTP 1
SSTP 2
SSTP 3
MC 0
STPE
MCE 0
ED
Stepladderarea
Master controlinstructions
It is not necessary to execute processes in order of process numbers. You can execute two or moreprocesses at the same time.
Once you force on or off an output that is programmed in a process not yet executed, the output condition ismaintained until the process starts even if the forced on and off operation is canceled.
Step ladder operationsWhen the step ladder processes are programmed, program execution proceeds in the ordinary ladder areaand in the processes triggered by the next step instructions (NSTL or NSTP). Processes that have not beentriggered are ignored.
SSTP 1
SSTP 2
SSTP 9
STPE
ED
Not executing process 1
Executing process 2
Ordinary ladder area Executing
Not executing
Not executing process 9
Ordinary ladder area
Executing
Not executing
Executing
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 instantonly in the first scan of the process. You can use R9015 to reset a counter or shift register used in the openedprocess.
Basic Instructions FP0
2 - 72
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
DT9061
Bit positionProcess number . . . . . . . .
. . . . . . . .
When bit position 8 of DT9061 is “1”, the process no. 24 is starting.
24 23 2019 1628 27318 7 4 3 012 1115
1 000000000000000
For the relationship between the register number and process number, refer to section 8.6.
Notes on process clearIf 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 processtransition, there will be two simultaneously active processes. If you do not want them to be on at the sametime, program with an interlock circuit. If there is a possibility of processes being simultaneously on becauseof hardware response delays, adapt hardware processing to take the response delay into account.
Example:
Y1SSTP 0
SSTP 1
Y0
NSTP 1X0
Y0 Y1
If the process is cleared, the instructions in that process operate as follows.
Instruction Operation statusOT 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 theexplanation of the MC and MCE instructions.
Basic InstructionsFP0
2 - 73
2.3 Explanation of Basic Instructions
You must be careful when using one of the instructions below, which are executed by detecting the leadingedge 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 processThis program repeats the same process until the work in a particular process is completed, thenswitches 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 instructionis 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 instructionto trigger a previous process in response to current conditions.
Program example1) When the X0 turns on, process 10 is executed.
2) When X1 turns on, process 10 is cleared andprocess 11 is executed.
3) When X2 turns on, process 11 is cleared andprocess 12 is executed.
4) When X4 turns on, process 12 is cleared andstep ladder operation finishes.
onoff
onoff
onoff
onoff
Process 10
Process 11
Process 12
Time chart
ExecutingCleared
ExecutingCleared
ExecutingCleared
X0
X1
X2
X4
R0
R1
R2
(CSTP 12 )
(NSTP 10 )
Process 10
(SSTP 10 )
Process 12
X0
R0
(NSTL 11 )
(SSTP 11 )
X1
R1
(NSTL 12 )
(SSTP 12 )
X2
R2
(STPE )
X4
Process 11
Program
Process 10
X0: on
R0 turns on
Process 11
X1: on
R1 turns on
Process 12
X2: on
R2 turns on
X4: on
END
Process flowchart
Basic Instructions FP0
2 - 74
2.3 Explanation of Basic Instructions
2 Selection branch control of a processThis program selects and switches to the next process according to the actions and results of aparticular 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 theexecution conditions, the next process is selected, triggered and program execution is transferred.
Program example1) When X0 turns on, process 50 is executed.2) When X1 turns on in process 50, process 51 is
executed. Or when X2 turns on in process 50,process 52 is executed.
3) When X3 turns on in process 51, process 51 iscleared and process 60 is executed.When X4 turns on in process 52, process 52 iscleared and process 60 is executed.
4) When X5 turns on, process 60 is cleared andstep ladder operation finishes.
onoff
onoff
onoff
onoff
Process 50
Process 51
Time chart
onoff
onoff
Process 60
ExecutingCleared
ExecutingCleared
ExecutingCleared
ExecutingCleared
X0
X1
X2
X3
X4
X5
R0
R1
R2
R3
When X1 turns on
(NSTP 50 )
Process 50
(SSTP 50 )
X0
R0
(NSTL 51 )
(SSTP 51 )
X1
Program
(NSTL 52 )X2
Process 51
(NSTL 60 )
(SSTP 52 )
X3
R1
(NSTL 60 )
(SSTP 60 )
X4
R2
(CSTP 60 )
(STPE )
X5
R3
Process 52
Process 60
Process 50
X0: on
R0 turns on.
X2: on
R2 turnson.
Process 60
X4: on
R3 turns on.
X5: on
END
Process flowchart
Process 51
X1: on
R1 turnson.
X3: on
Process 52
onoff
onoff
onoff
Process 10Process 20
Time chart
onoff
Process 30
onoff
Process 0
Process 11
Process 0ExecutingCleared
ExecutingCleared
ExecutingCleared
ExecutingCleared
ExecutingCleared
X0
X1
X2
X3
X4
R0
R1
R2
R3
R4
(NSTL 30 )(CSTP 20 )
X3
(NSTP 0 )
Process 0
(SSTP 0 )
X0
R0
(NSTL 10 )
(SSTP 10 )
X1
Program
(NSTL 20 )
Process 10
(NSTL 11 )
(SSTP 20 )
X2
R1
R2
(SSTP 30 )
R100
(SSTP 11 )R3
(NSTL 0 )
(STPE )
X4
R4
R100
Process 20
Process 11
Process 30
Basic InstructionsFP0
2 - 75
2.3 Explanation of Basic Instructions
3 Parallel branch merge control of a processThis program triggers multiple processes simultaneously. After each of the branch processes hascompleted 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 conditionfor the next process.When they merge and execute the next process, clear all uncleared processes at the same time.
Program example1) When X0 turns on, process 0 is executed.2) When X1 turns on, process 0 is cleared and
process 10 and process 20 are executedsimultaneously (Parallel branch control).
3) When X2 turns on, process 10 is cleared andprocess 11 is executed.
4) When X3 turns on, process 11 and process 20are cleared and process 30 is activated. (Mergecontrol)Clear process 20 with the clear instruction.Clear process 11 and execute process 30.
5) When X4 turns on, process 30 is cleared andinitial process 0 is executed again.
Process 0
X0: on
R0 turns on.
Process 20R2turnson.
Process 30 R4 turns on.
X4: on
Process flowchart
Process 10R1turns on.
X2: on
Process 11 R3turns on.
X3: on
X1: on
Basic Instructions FP0
2 - 76
2.3 Explanation of Basic Instructions
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
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
(CALL 1 )
(ED )
(SUB 1 )
(RET )
21
Subroutine program number
X010
20
30Subroutine
10
11
20
21
30
........
ST X 0
CALL 1
ED
SUB 1
RET
........
DescriptionWhen the execution condition (trigger) turns on, the CALL instruction is executed and the subroutineprogram 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 CALLinstruction of the main program and the execution of the main program resumes.
ED
SUB n
RET
CALL nX0 Main program
Main program
Subroutine program
1
2
3
When CALLn is executed, the program is executed in the order 1 , 2 , 3 shown above.
CALLSUB
Step Availability
RET
Subroutine call
Subroutine entry
Subroutine return
FP0 C10, C14, C16,C32, T32, SL1
1
2
1
Basic InstructionsFP0
2 - 77
2.3 Explanation of Basic Instructions
Subroutine Program SyntaxThe numbers of points noted below can be used with the subroutines.
Type Number of points
FP0 all types 16 subroutines (SUB0 to SUB15)
The subroutineprogram n (n: 0 to 15) is the program from the SUBn instruction to the RET instruction.Alwaysplace the address (subroutine) after the ED instruction.
The CALL instruction can be programmed in the main program area, interrupt program area, or subroutineprogram 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 0CALL1RET
(Stage 2)SUB 1CALL2RET
Called up from inside of the subroutine.
5th nesting example
(Stage 3)SUB 2CALL3RET
(Stage 4)SUB 3CALL4RET
(Stage 5)SUB 4
RET
Flag conditionsS 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 programmingIn the interrupt program, a subroutine program cannot be used.
SUB 11
RET
IRET
INT 1
Subroutine
In the subroutine program, an interrupt program cannot be used.
Interrupt program
INT 0
IRET
RET
SUB 11
Subroutine
Basic Instructions FP0
2 - 78
2.3 Explanation of Basic Instructions
A subroutine program cannot be written inside another subroutine program.
SUB 2
RET
SUB 0
Subroutine programSubroutineprogram
When the CALL instruction execution condition (trigger) is offWhen the execution condition (trigger) of a subroutine turns off, the operations of that subroutine are notcarried 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 notexecuted. When the execution condition (trigger) for the CALL instruction is in the off state, the instructions inthe subroutine operate as follows.
Instruction Operation statusOT 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 correcttime 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 asubroutine, one of the instructions below that is executed by detectingthe leading of execution condition (trigger) such as the differential instruction. For more details, refer tosection 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)
Basic InstructionsFP0
2 - 79
2.3 Explanation of Basic Instructions
Outline INT: Indicates the start of the interrupt program.IRET: Indicates the end of the interrupt program.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
Interrupt program number
20
21
26
(INT 0 )
(ED )
(IRET )
20
21
26
....
ED
INT 0
IRET
....
DescriptionWhen an interrupt is input, the interrupt program of the number specified is executed starting from the INTinstruction.
When the interrupt program reaches the IRET instruction, the program returns to the address where theinterrupt occurred and the main program resumes.
ED
INT n
IRET
DFX0
Interruptprogram n
ICTL, S1, S2
Main program
Interrupting1
2
3
When the interrupt occurs, the program is executed in the order 1 - 2 - 3 shown above.
Syntax of interrupt programAn interrupt program n is the program between the INTn instruction and the IRET instruction. The interruptprogram must always be placed after the ED instruction.
The number of the interrupt program is decided by the type of the interrupt.
Interrupt programnumber
Interrupt input (trigger) setting High-speed counter setting<when using F166/F167instructions>
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
INTIRET
Interrupt
Interrupt return
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
1
1
Basic Instructions FP0
2 - 80
2.3 Explanation of Basic Instructions
Before inputting an interrupt program1 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 indicateit at system register 403. For more details, refer to section 8.4.
Notes
• If the high-speed counter/pulse catch is set, that contactcannot be used as the interrupt input (trigger).
• For the high speed counter- initiated interrupts and periodicalinterrupts, 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 interruptprograms with the ICTL instruction. Refer to the explanation of the ICTL instruction.
Precaution when rewriting in RUN modeIf the program is rewritten in the RUN mode, execution will be inhibited for all interrupt programs,and will haveto be enabled again after the rewriting has been completed in the RUN mode. For details, refer to theexplanation of the ICTL instruction.
Interrupt program executionThere 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-speedcounter elapsed value equals the set target value. Refer to the explanations of the F166 instructionand 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
INT program
Interrupt inputonoff
Execution Execution
Execution
If interrupts are disabled, an interrupt will occur only at the point when interrupts are enabled with the ICTLinstruction.
Main program
INT program
Execution
Interrupt input
Enabled
onoff
Execution
Basic InstructionsFP0
2 - 81
2.3 Explanation of Basic Instructions
When another interrupt program is being executed, an interrupt will occur after the current program iscompleted.
Main program
INT1 program
Execution
INT2 inputonoff
INT2 program
Execution
Execution
Precautions during programmingIf 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 notundergo I/O refreshing. Therefore, contacts other than the interrupt input contact, such as the constantly -onrelay R9010, should be specified by the input conditions in the interrupt program.
INT 5
IRET
X5F0 MV, K10, DT100
Specify R9010 or othercontact instead of X5.
A subroutine program cannot be used in an interrupt program.
SUB 11
RET
IRET
INT 1
Subroutine
An interrupt program cannot be used in a subroutine program.
Interrupt program
INT 0
IRET
RET
SUB 11
Subroutine
Basic Instructions FP0
2 - 82
2.3 Explanation of Basic Instructions
An interrupt program cannot be programmed into another interrupt program.
INT 1
IRET
INT 0
Control when more than one interrupt occurs simultaneously.When more than one interrupt occurs simultaneously, the interrupt program with the smaller number isexecuted first. The other interrupt programs are then placed in the execution waiting state. After the firstinterrupt program is completed, the other programs will be executed in order from the smallest number to thegreatest.
Example:
INT1 input
Main program
INT1 program
onoff
INT2 input
INT2 program
onoff
INT3 input
INT3 program
onoff
When more than one interrupt occurs while a interrupt program is being executed, the other programs will beexecuted in order from the smallest number to the greatest after the program currently being executed isfinished.
Example:
INT2 input
Main program
INT1 program
onoff
INT3 input
INT2 program
onoff
INT4 input
INT3 program
onoff
INT1 inputonoff
INT4 program
During execution of the INT3 program in the example above,the INT2 input occured before INT1. But, after INT3 program isdone, the INT1 program is executed first and then INT2 isexecuted.
Basic InstructionsFP0
2 - 83
2.3 Explanation of Basic Instructions
Interrupt program execution waiting state and clearingWhen multiple interrupt programs occur simultaneously or new interrupt programs occur during theexecution of another interrupt program, the interrupt programs of lower preference are placed in theexecution waiting state. They are then executed in order of preference when the other interrupt programs arecompleted.
Example: Main program
INT1 program
INT1 inputonoff
INT2 program
Execution waiting state
INT2 inputonoff
If placed in the execution waiting state, there is a time difference between the time of when the interruptoccurs and when the interrupt program is actually executed. If you do not want to execute the interruptprogram placed in the execution waiting state because of this, it can be cleared with the ICTL instruction. Aninterrupt program that is cleared will not be executed.
Example: Main program
INT1 program
INT1 inputonoff
INT2 program
INT2 inputonoff
Clear
ICTL (INT2 clear) execution
When the execution of interrupt programs is disabled with the ICTL instruction, interrupts that occur are stillplaced in the execution waiting state. When the execution is enabled with the ICTL instruction, the waitinginterrupt programs will then be executed. Programs in the execution waiting state can be cleared with theICTL instruction.
Basic Instructions FP0
2 - 84
2.3 Explanation of Basic Instructions
Outline Performs the interrupt enable or disable and the interrupt clear.Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
X00 ( DF ) ICTL, H 0, H 1
S1 S2
0
1
2
ST X 0
DF
ICTL
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
DescriptionWhen the ICTL instruction is executed, the interrupt program enable/disable and interrupt clear are setaccording to the settings in S1 and S2.
Besure to use ICTL instructionsso that theyare executedonce at the leadingedge of the executioncondition(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 theexecution of the interrupt program.
NoteIf rewriting is done in the RUN mode while the interrupt functionis being used, the interrupt function will be disabled.The ICTL instruction must be used to enable execution of theinterrupt program before it can be resumed.Example of setting a periodical interrupt every 10ms from thestart of operations (enables the interrupt function to be resumedfor rewriting in the RUN mode)
ICTL, H2, K1R9013
Executes INT24 every 10ms
R9034
FP0 C10, C14, C16,C32, T32, SL1
5ICTLStep Availability
Interrupt control
A: Available
Basic InstructionsFP0
2 - 85
2.3 Explanation of Basic Instructions
Input examples
Example 1: Setting a periodical interrupt every 10ms from the start ofoperations
ICTL, H2, K1R9013
Executes INT24 every 10ms
The R9013 (initial pulse relay) turns on only for the first scan afteroperations begin.
Example 2: Enable INT0 to INT3 when X0 rises.
ICTL, H0, HFX0
DF X0: Enables INT0 to INT3 when on
Example 3: Clear interrupts other than INT0 after the INT0 program iscompleted.
INT 0
ICTL, H100, H1R0
IRET
Interrupts other than INT0 arecleared when the program ofINT0 is finished
Specifying control data
8 7 4 3 012 1115
S1
. . . . . . . .Bit position
Selection of control functionH00: Interrupt execution “enabled/disabled”H01: Interrupt clear
Interrupt type selectionH00: INT 0 to INT5H02: INT24 (10ms units)H03: INT24 (0.5ms units)
S1: Specifying the control functions and interrupt types
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.
Basic Instructions FP0
2 - 86
2.3 Explanation of Basic Instructions
S2: Specifying the control of interrupts1 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 disablinginterrupt programs INT3 through INT5.Bit position 8 7 4 3 012 1115 . . . . . . . .
INT programnumber 5 4 3 2 1 0
0: INT program disabled1: INT program enabled
S2 (Enabled/disabled) 0 1 1 00 0 0 00 0 0 00 0 0 0
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 interruptprograms INT3 through INT5.Bit position 8 7 4 3 012 1115 . . . . . . . .
INT programnumber 5 4 3 2 1 0
0: INT program disabled1: INT program enabled
S2 (Enabled/disabled) 1 0 0 00 0 1 10 0 0 00 0 0 0
3 Specifying periodical interrupt (when S1 = H2)
Specify the setting with decimal number. The time interval = value of S2 × 10 (ms).
Bit position 8 7 4 3 012 1115 . . . . . . . .
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 8 7 4 3 012 1115 . . . . . . . .
S2
K0 to K3000
Time interval setting: K1 to K3000 (0.5ms to 1.5s)
INT24 disabled: K0
Basic InstructionsFP0
2 - 87
2.3 Explanation of Basic Instructions
Example of enabling the execution of interrupt programs
Example:
ICTL, H0, H21DF
S1S2
S1: H0000Specifies enabling or disabling of interrupt programs thatcorrespond to interrupts at specified input (trigger) contact orto target value match interrupts.
S2: H0021Enable INT0 and INT5 (set bits 0 and 5 to “1”) and disable allothers.
S2
Bit position 8 7 4 3 012 1115 . . . . . . . .
0 0 0 10 0 1 00 0 0 00 0 0 0
INT No. 5 4 3 2 1 0
X0 (INT0)X1 (INT1)X2 (INT2)
X3 (INT3)X4 (INT4)X5 (INT5)
Input contact
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 theircorresponding interrupt inputs occur.
Main program
INT0 program
INT0 inputonoff
INT5 program
Execution
Disabled Enabled
ICTL instruction
INT5 inputonoff
Condition
ExecutionExecution
Execution
Basic Instructions FP0
2 - 88
2.3 Explanation of Basic Instructions
Example for clearing interrupt programs
Example:
ICTL, H100, HFEDF
S1S2
S1: H0100Clears interrupts from specified input (trigger) contact ortarget value match interrupts.
S2: HFEClears interrupt INT0 (bit 0 is “0”) and does not clear the otherinterrupts.
For the relationship between the set value and the interruptinput (trigger) contact, refer to page 2 - 87 “Example ofenabling the execution of interrupt programs.”
Even though the INT0 interrupt input occured, when the interrupt program is disabled, the ICTL instructioncan still be used to clear the INT0 interrupt.
Main program
INT0 program
INT0 inputonoff
INT1 program
Disabled Enabled
INT1 inputonoff
Condition
Execution
ICTL instruction
Clear
Execution
Execution
NoteSince INT0 is cleared, the INT0 program will not be executedeven after execution is enabled. Since INT1 is not cleared, theINT1 program will be executed after execution is enabled.
Basic InstructionsFP0
2 - 89
2.3 Explanation of Basic Instructions
Example for setting periodical interrupt
Example:
ICTL, H2, K1500DF
S1S2
S1: H0002Specifies periodical interrupt
S2: K1500Specifies the time interval for the periodical interrupt.With K1500, the time interval is K1500 x 10ms = 15000ms (15sec)
After this ICTL instruction is executed, the periodical interruptwill occurevery15 seconds.At these times, theINT24 interrupt program will be executed.
INT24 program
Main program
15s 15s
Execution
ICTL instruction
Execution
Execution
To stop the periodical interrupt program (INT24), execute the following program.
ICTL, H2, K0DF
Basic Instructions FP0
2 - 90
2.3 Explanation of Basic Instructions
Outline Performs start operation by comparing two word data items with thecomparison condition. The contact goes on or off depending on theresult of the comparison.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
Y00 =, DT 0, K 50
S1 S2
Y16 > =, DT 0, K 60
S1 S2
0
5
6
11
ST =
DT 0
K 50
OT Y 0
ST > =
DT 0
K 60
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
5
5
5
5
5
ST =ST <>
Step Availability
ST >ST >=ST <ST <=
FP0 C10, C14, C16,C32, T32, SL1
Word compare: Start equal
Word compare: Start equal not
Word compare: Start larger
Word compare: Start equalor larger
Word compare: Start smaller
Word compare: Start equalor smaller
5
A: Available
Basic InstructionsFP0
2 - 91
2.3 Explanation of Basic Instructions
Explanation of exampleCompares the contents of data register DT0 with the constant K50 and K60. If DT0 = K50, the external outputrelay Y0 goes on and if DT0 ≧ K60, the external output relay Y1 turns on.
6050
10
Y0
Y1
DT0
onoff
onoff
DescriptionCompares the word data specified by S1 with the word data specified by S2 according to the comparisoncondition.
The ST instruction initiatesa logical operationas the liaisoncontactwhen the comparison result is aspecifiedstatus (=, <, >, etc.).
The result of the comparison operation is as follows:
Comparisoninstruction
Conditioninstruction
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
ST< = on on off
Precautions concerning usageThe start comparison instructions ST =, ST<>, ST >, ST >=, ST <, and ST <= are programmed from the busline.
Ifmixed with BCDorother typeof data, the valuewill be regardedas negativewhen the most significantbit is1and a correct comparison may not be obtained. In this case, use an F81 or similar instruction to change thedata to binary data before making the comparison.
Flag conditionsS 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.
< > indicates ≠>= indicates ≧<= indicates ≦
Basic Instructions FP0
2 - 92
2.3 Explanation of Basic Instructions
Outline Performs start operation by comparing two double word data items withthe comparison condition. The contact goes on or off depending on theresult of the comparison.12
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
D =, DT 0, DT 100 Y00
S1 S2
Y110
S1 S2
D >, DT 0, DT 100
0
9
10
19
STD =
DT 0
DT 100
OT Y 0
STD >
DT 0
DT 100
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
STD =STD <>
Step Availability
STD >STD >=STD <STD <=
Double word compare:Start equal
Double word compare:Start equal not
Double word compare:Start larger
Double word compare:Start equal or larger
Double word compare:Start smaller
Double word compare:Start equal or smaller
9
9
9
9
9
9
FP0 C10, C14, C16,C32, T32, SL1
A: AvailableN/A: Not Available
Basic InstructionsFP0
2 - 93
2.3 Explanation of Basic Instructions
Explanation of exampleCompares 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.
DescriptionCompares the double word data specified by S1 and S1+1 with the double word data specified by S2 andS2+1 according to the comparison condition.
The STD instruction initiates a logical operation as the liaison contact when the comparison result is aspecified status (=, <, >, etc.).
The result of the comparison operation is as follows:
Comparisoninstruction
Conditioninstruction
(S1+1, S1) <(S2+2, S2)
(S1+1, S1) =(S2+2, S2)
(S1+1, S1) >(S2+2, S2)
STD= off on off
STD< > on off on
STD> off off on
STD> = off on on
STD< on off off
STD< = on on off
When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1) are automatically determined once thelower 16-bit areas (S1, S2) are specified.
S1S1+1
S2S2+1
The specified data area and thefollowing data area are handledtogether as 32-bit data.
Comparison
Precautions concerning usageThe start comparison instructions STD =, STD<>, STD>, STD>=, STD<, and STD <=are programmed fromthe bus line.
Ifmixed with BCDorother typeof data, the valuewill be regardedas negativewhen the most significantbit is1and a correct comparison may not be obtained. In this case, use an F83 or similar instruction to change thedata to binary data before making the comparison.
Flag conditionsS 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.
< > indicates ≠>= indicates ≧<= indicates ≦
Basic Instructions FP0
2 - 94
2.3 Explanation of Basic Instructions
Outline Performs AND operation by comparing two word data items with thecomparison condition. The contact goes on or off depending on theresult of the comparison. The contacts are connected in series.13
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
Y00 > =, DT 0, K 60
S1 S2
X0
0
1
6
ST X 0
AN > =
DT 0
K 60
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
55 AN =AN <>
Step Availability
AN >AN >=AN <AN <=
Word compare: AND equal
Word compare: AND equal not
Word compare: AND larger
Word compare: AND equalor larger
Word compare: AND smaller
Word compare: AND equalor smaller
5
5
5
5
5
FP0 C10, C14, C16,C32, T32, SL1
A: Available
Basic InstructionsFP0
2 - 95
2.3 Explanation of Basic Instructions
Explanation of exampleCompares the contents of data register DT0 with the constant K60 when X0 turns on. If DT0≧K60 in the X0on state, external output relay Y0goes on. If DT0< K60 or if X0 is in the off state,external output relay Y0goesoff.
60
10
X0
Y0
DT0
onoff
onoff
DescriptionCompares the word data specified by S1 with the word data specified by S2 according to the comparisoncondition.
The AN instruction results in serial connection as the liaison contact when the comparison result is aspecified status (=, <, >, etc.).
The result of the comparison operation is as follows:
Comparisoninstruction
Conditioninstruction
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
AN< = on on off
Precautions concerning usageMultiple AND comparison instructions AN =, AN <>, AN >, AN >=, AN <, and AN <= can be usedconsecutively.
Ifmixed with BCDorother typeof data, the valuewill be regardedas negativewhen the most significantbit is1and a correct comparison may not be obtained. In this case, use an F81 or similar instruction to change thedata to binary data before making the comparison.
Flag conditionsS 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.
< > indicates ≠>= indicates ≧<= indicates ≦
Basic Instructions FP0
2 - 96
2.3 Explanation of Basic Instructions
Outline Performs AND operation by comparing two double word data items withthe comparison condition. The contact goes on or off depending on theresult of the comparison. The contacts are connected in series.14
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
Y00 D> =, DT 0, DT100
S1 S2
X0
0
1
10
ST X 0
AND >=
DT 0
DT 100
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
Explanation of exampleCompares the contents of data registers (DT1, DT0) with the data registers (DT101, DT100) when X0 turnson. 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.
AND =AND <>
Step Availability
AND >AND >=AND <AND <=
Double word compare:AND equal
Double word compare:AND equal not
Double word compare:AND larger
Double word compare:AND equal or larger
Double word compare:AND smaller
Double word compare:AND equal or smaller
9
9
9
9
9
9
FP0 C10, C14, C16,C32, T32, SL1
A: AvailableN/A: Not Available
Basic InstructionsFP0
2 - 97
2.3 Explanation of Basic Instructions
DescriptionCompares the double word data specified by S1 and S1+1 with the double word data specified by S2 andS2+1 according to the comparison condition.
The AND instruction results in serial connection as the liaison contact when the comparison result is aspecified status (=, <, >, etc.).
The result of the comparison operation is as follows:
Comparisoninstruction
Conditioninstruction
(S1+1, S1) <(S2+1, S2)
(S1+1, S1) =(S2+1, S2)
(S1+1, S1) >(S2+1, S2)
AND= off on off
AND< > on off on
AND> off off on
AND> = off on on
AND< on off off
AND< = on on off
When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1) are automatically determined once thelower 16-bit areas (S1, S2) are specified.
S1S1+1
S2S2+1
Comparison
The specified data area and thefollowing data area are handledtogether as 32-bit data.
Precautions concerning usageMultiple AND comparisons instructions AND =, AND <>, AND >, AND >=, AND <, and AND <= can be usedconsecutively.
Ifmixed with BCDorother typeof data, the valuewill be regardedas negativewhen the most significantbit is1and a correct comparison may not be obtained. In this case, use an F83 or similar instruction to change thedata to binary data before making the comparison.
Flag conditionsS 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.
< > indicates ≠>= indicates ≧<= indicates ≦
Basic Instructions FP0
2 - 98
2.3 Explanation of Basic Instructions
Outline Performs OR operation by comparing two word data items with thecomparison condition. The contact goes on or off depending on theresult of the comparison. The contacts are connected in parallel.15
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
Y00
> =, DT 0, K 60
S1 S2
X00
1
6
ST X 0
OR > =
DT 0
K 60
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
OR =OR <>
Step Availability
OR >OR >=OR <OR <=
Word compare: OR equal
Word compare: OR equal not
Word compare: OR larger
Word compare: OR equalor larger
Word compare: OR smaller
Word compare: OR equalor smaller
5
5
5
5
5
5
FP0 C10, C14, C16,C32, T32, SL1
A: Available
Basic InstructionsFP0
2 - 99
2.3 Explanation of Basic Instructions
Explanation of exampleY0 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 Y0goes off.
60
10
X0
Y0
DT0
onoff
onoff
DescriptionCompares the word data specified by S1 with the word data specified by S2 according to the comparisoncondition.
The OR instruction results in parallel connection as the liaison contact when the comparison result is aspecified status (=, <, >, etc.).
The result of the comparison operation is as follows:
Comparisoninstruction
Conditioninstruction
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
OR< = on on off
Precautions concerning usageThe OR comparison instructions OR =, OR <>, OR >, OR >=, OR <, and OR<= are programmed from the busline.
Multiple OR comparison instructions OR =, OR <>, OR >, OR >=, OR <, and OR <= can be usedconsecutively.
Ifmixed with BCDorother typeof data, the valuewill be regardedas negativewhen the most significantbit is1and a correct comparison may not be obtained. In this case, use an F81 or similar instruction to change thedata to binary data before making the comparison.
Flag conditionsS 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.
< > indicates ≠>= indicates ≧<= indicates ≦
Basic Instructions FP0
2 - 100
2.3 Explanation of Basic Instructions
Outline Performs OR operation by comparing two double word data items withthe comparison condition. The contact goes on or off depending on theresult of the comparison. The contacts are connected in parallel.16
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
Y00
D> =, DT 0, DT100
S1 S2
X0
1
0
1
10
ST X 0
ORD> =
DT 0
DT 100
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
Explanation of exampleCompares the contents of data registers (DT1, DT0) with the data registers (DT101, DT100). When X0 turnson 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.
ORD =ORD <>
Step Availability
ORD >ORD >=ORD <ORD <=
Double word compare:OR equal
Double word compare:OR equal not
Double word compare:OR larger
Double word compare:OR equal or larger
Double word compare:OR smaller
Double word compare:OR equal or smaller
9
9
9
9
9
9
FP0 C10, C14, C16,C32, T32, SL1
A: AvailableN/A: Not Available
Basic InstructionsFP0
2 - 101
2.3 Explanation of Basic Instructions
DescriptionCompares the double word data specified by S1 and S1+1 with the double word data specified by S2 andS2+1 according to the comparison condition.
The ORD instruction results in parallel connection as the liaison contact when the comparison result is aspecified status (=, >, <, etc.).
The result of the comparison operation is as follows:
Comparisoninstruction
Conditioninstruction
(S1+1, S1)<(S2+1, S2)
(S1+1, S1) =(S2+1, S2)
(S1+1, S1) >(S2+1, S2)
ORD= off on off
ORD< > on off on
ORD> off off on
ORD> = off on on
ORD< on off off
ORD< = on on off
When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1) are automatically determined once thelower 16-bit areas (S1, S2) are specified.
S1S1+1
S2S2+1
Comparison
The specified data area and thefollowing data area are handledtogether as 32-bit data.
Precautions concerning usageThe OR comparison instructions ORD =, ORD <>, ORD >, ORD >=, ORD <, and ORD <= are programmedfrom the bus line.
Multiple OR comparison instructions ORD =, ORD <>, ORD >, ORD >=, ORD<, and ORD <= can be usedconsecutively.
Ifmixed with BCDorother typeof data, the valuewill be regardedas negativewhen the most significantbit is1and a correct comparison may not be obtained. In this case, use an F83 or similar instruction to change thedata to binary data before making the comparison.
Flag conditionsS 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.
< > indicates ≠>= indicates ≧<= indicates ≦
Basic Instructions FP0
2 - 102
2.3 Explanation of Basic Instructions
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 andProgram Input 3 - 4. . . . . . . . . . . . . . . . . . . . . . . . . .
3.1.3 High-level Instructions and ExecutionCondition (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. . . . . . . . . . . .
FP0High-level Instructions
3 - 2
High-level InstructionsFP0
3 - 3
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) instructionThe K0 (S) is copied to DT0 (D)
0
Address
F0 MV , K0 , DT 0R0
Execution condition(Trigger)
D
Operand
BooleanF type high- level instruction number: “0”
S
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 forprocessed 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
(Source): Data which is to be processed or data which sets the processing method.
(Destination): Location where result of processing is stored.
(number): Numeric data which is to be processed or which sets the processing method.
SDn
Operands are specified using constants or memory areas (registers) as explained insection 1.2.Refer to the explanations of the instructions as only certain memory areas (registers)and constants can be used with each instruction.
FP0High-level Instructions
3 - 4
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, thenumber 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
F0 MV , K 0 , DT 0R0
F0
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 executioncondition (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.
F0 MV, K0, DT0R0
Execution condition(Trigger)
Execution of high-level instructionsThe high-level instruction of FP0 is executed once every scan (F type). While theexecution condition (trigger) is on, the instruction is executed at each scan repeatedly.
F- type High-levelinstruction[ex. F0 (MV)]
Execution condition(trigger) (R0)
1 scan
onoff
Execution
High-level InstructionsFP0
3 - 5
3.1 Composition of High-level Instructions
There is no need to program the same execution condition (trigger) many times whentwo or more high-level instructions are programmed consecutively with the sameexecution condition (trigger).
Example:
F81 BIN, WX3, DT3R0
This execution condition (trigger) is not required.
F60 CMP, DT3, K50R0
F81 BIN, WX3, DT3R0
F60 CMP, DT3, K50
FP0High-level Instructions
3 - 6
3.1 Composition of High-level Instructions
3.1.4 Types of High-level Instructions
Data transfer instructionsThese 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
F0 MV, K50, DT1R0
An example of transferring K50 to DT1. The value of DT1 willbe K50.
BIN arithmetic instructionsThese 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
F22 +, DT0, DT10, DT20R0
An example of adding the contents of DT0 and DT10.The result is stored in DT20.When DT0 = K12 and DT10 = K13, DT20 = K25.
High-level InstructionsFP0
3 - 7
3.1 Composition of High-level Instructions
BCD arithmetic instructionsThese 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
F42 B+, DT0, DT10, DT20R0
An example of adding the contents of DT0 and DT10 as BCDdata. The result is stored in DT20.When DT0 = H12 and DT10 = H23, DT20 = H35.
Data comparison instructionsThese instructions compare two data.
Example:
16-bit data compare: [F60 (CMP)]
32-bit data compare: [F61 (DCMP)]
Program Example
F60 CMP, DT0, K100R0
R0 R900B R1
This program compares the value in DT0 and K100, and turnsR1 on if they are equal.R900B is a flag which turns on when the result of acomparison is “equal” (=).
FP0High-level Instructions
3 - 8
3.1 Composition of High-level Instructions
Logic operation instructionsThese 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
0 ··· 0 0 0 1
F65 WAN, H1, H3, DT20R0
H1 :
0 ··· 0 0 1 1H3 :
0 ··· 0 0 0 1DT20 : (Operation result)
Logic operation (1 when both are 1)
Data conversion instructionsThese 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
K-110
F75 BINA, DT0, H4, DT10R0
DT0 :
H31 2DDT10 :H20 31DT11 :
Binary data-
(minus sign)1
0 1ASCII code
conversion
High-level InstructionsFP0
3 - 9
3.1 Composition of High-level Instructions
Data shift instructionsThese instructions shift data.
Example:
Right shift of n bits: [F100 (SHR)]
Right shift of one hexadecimal digit: [F105 (BSR)]
Program Example
F100 SHR, DT0, K4R0
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.
Shift 4 bits
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0DT0:
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1DT0:
R9009 (Carry flag) : 0
Data rotate instructionsThese 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
F120 ROR, DT0, K4R0
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.
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0DT0:
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1DT0:
FP0High-level Instructions
3 - 10
3.1 Composition of High-level Instructions
Bit manipulation instructionsThese are instructions for operating on individual bits of 16-bit data such as dataregisters.
Example:
Bit set: [F130 (BTS)]
Bit invert: [F132 (BTI)]
Number of on bits: [F135 (BCU)]
Program Example
F130 BTS, DT0, K15R0
Example of a program which sets bit position 15 of DT0 to 1.
0 0 0 0DT0:
DT0:
15 0
15 0
Bit position 15 is turned on (1).
0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
12 11 8 7 4 3
12 11 4 3
Special instructionsThese consist of a special instruction for use of the high-speed counter or otherfunctions 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
F166, FC1S, K1, K10000, Y5R0
Example of a program which turns output relay Y5 on when the elapsedvalue of channel 0 of the built - in high-speed counter reaches the targetvalue (K10000).
onoff
Value ofDT0
Elapsedvalue
TimeY5
High-level InstructionsFP0
3 - 11
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 andmove
MV/ S, D (S) → (D) 5 3 - 25
F3 32-bit data invert andmove
DMV/ S, D (S+1, S) → (D+1, D) 7 3 - 27
F5 Bit data move BTM S, n, D The specified one bit in “S” istransferred to the specified one bitin “D”. The bit is specified by “n”.
7 3 - 29
F6 Hexadecimal digit(4-bit) data move
DGT S, n, D The specified one digit in “S” istransferred to the specified one digitin “D”. The digit is specified by “n”.
7 3 - 31
F10 Block move BKMV S1, S2, D The data between “S1” and “S2” istransferred to the area starting at“D”.
7 3 - 34
F11 Block copy COPY S, D1, D2 The data of “S” is transferred to theall area between “D1” and “D2”.
7 3 - 36
F12
(* Note)
Data read fromEEPROM
ICRD S1, S2, D The data stored in the EEPROMspecified by “S1” and “S2” aretransferred to the area starting at“D.”
11 3 - 38
P13
(* Note)
Data write toEEPROM
PICWT S1, S2, D The data specified by “S1” and “S2”are transferred to the EEPROMarea starting at “D.”
11 3 - 40
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)(D2+1, D2) → (D1+1, D1)
5 3 - 44
F17 Higher/lower byte in16-bit data exchange
SWAP D The higher byte and lower byte of“D” are exchanged.
3 3 - 46
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) →(D+1, D)
11 3 - 53
NoteThe 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).
FP0High-level Instructions
3 - 12
3.2 Table of High-level Instructions
Number Name Boolean Operand Description Steps Page
F25 16-bit datasubtraction
- S, D (D) - (S) → (D) 5 3 - 55
F26 32-bit datasubtraction
D- S, D (D+1, D) - (S+1, S) → (D+1, D) 7 3 - 57
F27 16-bit datasutraction
- S1, S2, D (S1) - (S2) → (D) 7 3 - 59
F28 32-bit datasubtraction
D- S1, S2, D (S1+1, S1) - (S2+1, S2) →(D+1, D)
11 3 - 61
F30 16-bit datamultiplication
* S1, S2, D (S1) × (S2) → (D+1, D) 7 3 - 63
F31 32-bit datamultiplication
D* S1, S2, D (S1+1, S1) × (S2+1, S2) →(D+3, D+2, D+1, D)
11 3 - 65
F32 16-bit data division % S1, S2, D (S1) ÷ (S2) → quotient (D)remainder (DT9015)
7 3 - 67
F33 32-bit data division D% S1, S2, D (S1+1, S1) ÷ (S2+1, S2) →quotient (D+1, D)remainder (DT9016, DT9015)
11 3 - 69
F35 16-bit dataincrement
+1 D (D) + 1 → (D) 3 3 - 71
F36 32-bit data increment D+1 D (D+1, D) +1 → (D+1, D) 3 3 - 73
F37 16-bit datadecrement
-1 D (D) - 1 → (D) 3 3 - 75
F38 32-bit datadecrement
D-1 D (D+1, D) - 1 → (D+1, D) 3 3 - 77
BCD arithmetic instructions
F40 4-digit BCD dataaddition
B+ S, D (D) + (S) → (D) 5 3 - 79
F41 8-digit BCD dataaddition
DB+ S, D (D+1, D) + (S+1, S) → (D+1, D) 7 3 - 81
F42 4-digit BCD dataaddition
B+ S1, S2, D (S1) + (S2) → (D) 7 3 - 83
F43 8-digit BCD dataaddition
DB+ S1, S2, D (S1+1, S1) + (S2+1, S2) →(D+1, D)
11 3 - 85
F45 4-digit BCD datasubtraction
B- S, D (D) - (S) → (D) 5 3 - 87
F46 8-digit BCD datasubtraction
DB- S, D (D+1, D) - (S+1, S) → (D+1, D) 7 3 - 89
F47 4-digit BCD datasubtraction
B- S1, S2, D (S1) - (S2) → (D) 7 3 - 91
F48 8-digit BCD datasubtraction
DB- S1, S2, D (S1+1, S1) - (S2+1, S2) →(D+1, D)
11 3 - 93
F50 4-digit BCD datamultiplication
B* S1, S2, D (S1) × (S2) → (D+1, D) 7 3 - 95
F51 8-digit BCD datamultiplication
DB* S1, S2, D (S1+1, S1) × (S2+1, S2) →(D+3, D+2, D+1, D)
11 3 - 97
F52 4-digit BCD datadivision
B% S1, S2, D (S1) ÷ (S2) → quotient (D)remainder (DT9015)
7 3 - 99
High-level InstructionsFP0
3 - 13
3.2 Table of High-level Instructions
Number Name Boolean Operand Description Steps Page
F53 8-digit BCD datadivision
DB% S1, S2, D (S1+1, S1) ÷ (S2+1, S2) →quotient (D+1, D)remainder (DT9015, DT9016)
11 3 - 101
F55 4-digit BCD dataincrement
B+1 D (D) + 1 → (D) 3 3 - 103
F56 8-digit BCD dataincrement
DB+1 D (D+1, D) + 1 → (D+1, D) 3 3 - 105
F57 4-digit BCD datadecrement
B-1 D (D) - 1 → (D) 3 3 - 107
F58 8-digit BCD datadecrement
DB-1 D (D+1, D) - 1 → (D+1, D) 3 3 - 109
Data comparison instructions
F60 16-bit data compare CMP S1, S2 (S1) > (S2) → R900A:on(S1) = (S2) → R900B:on(S1) < (S2) → R900C:on
5 3 - 111
F61 32-bit data compare DCMP S1, S2 (S1+1, S1) > (S2+1, S2)→R900A:on(S1+1, S1) = (S2+1, S2)→R900B:on(S1+1, S1) < (S2+1, S2)→R900C:on
9 3 - 115
F62 16-bit data bandcompare
WIN S1, S2, S3 (S1) > (S3) → R900A:on(S2) ≦ (S1) ≦ (S3)→ R900B:on(S1) < (S2) → R900C:on
7 3 - 119
F63 32-bit data bandcompare
DWIN S1, S2, S3 (S1+1, S1) > (S3+1, S3) →R900A:on(S2+1, S2) ≦ (S1+1, S1) ≦ (S3+1,S3) → R900B:on(S1+1, S1) < (S2+1, S2) →R900C:on
13 3 - 121
F64 Block data compare BCMP S1, S2, S3 Compares the two blocks beginningwith “S2” and “S3” to see if they areequal.
7 3 - 123
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 exclusiveOR
XOR S1, S2, D (S1) ∧ (S2) ∨ (S1) ∧ (S2) →(D)
7 3 - 130
F68 16-bit data exclusiveNOR
XNR S1, S2, D (S1) ∧ (S2) ∨ (S1) ∧ (S2) →(D)
7 3 - 132
Data conversion instructions
F70 Block check codecalculation
BCC S1, S2,S3, D
Creates the code for checking thedata specified by “S2” and “S3”and stores it in “D”. The operationmethod is specified by “S1”.
9 3 - 134
F71 Hexadecimal data→ASCII code
HEXA S1, S2, D Converts the hexadecimal dataspecified by “S1” and “S2” toASCII code and stores it in “D”.
Example:HABCD → H 42 41 44 43
B A D C
7 3 - 137
FP0High-level Instructions
3 - 14
3.2 Table of High-level Instructions
Number Name Boolean Operand Description Steps Page
F72 ASCII code →Hexadecimal data
AHEX S1, S2, D Converts the ASCII code specifiedby “S1” and “S2” to hexadecimaldata and stores it in “D”.
Example:H 44 43 42 41 → HCDAB
D C B A
7 3 - 140
F73 4-digit BCD data →ASCII code
BCDA S1, S2, D Converts the four digits of BCDdata specified by “S1” and “S2” toASCII code and stores it in “D”.Example:H1234 → H 32 31 34 33
2 1 4 3
7 3 - 144
F74 ASCII code →4-digit BCD data
ABCD S1, S2, D Converts the ASCII code specifiedby “S1” and “S2” to four digits ofBCD data and stores it in “D”.Example:H 34 33 32 31 → H3412
4 3 2 1
9 3 - 148
F75 16-bit binary data →ASCII code
BINA S1, S2, D Converts the 16 bits of binary dataspecified by “S1” to ASCII code andstores it in “D” (area of “S2” bytes).Example:K-100 → H 30 30 31 2D 20 20
0 0 1 -
7 3 - 152
F76 ASCII code → 16-bitbinary data
ABIN S1, S2, D Converts the ASCII code specifiedby “S1” and “S2” to 16 bits of binarydata and stores it in “D”.Example:H 30 30 31 2D 20 20 → K-100
0 0 1 -
7 3 - 155
F77 32-bit binary data →ASCII code
DBIA S1, S2, D Converts the 32 bits of binary dataof (S1+1, S1) to ASCII code andstores it in (D+1, D).
11 3 - 158
F78 ASCII code → 32-bitbinary data
DABI S1, S2, D Converts the ASCII code specifiedby “S1” and “S2” to 32 bits ofbinary data and stores it in (D+1,D).
11 3 - 161
F80 16-bit binary data →4-digit BCD data
BCD S, D Converts the 16 bits of binary dataspecified by “S” to four digits ofBCD data and stores it in “D”.Example: K100 → H100
5 3 - 165
F81 4-digit BCD data →16-bit binary data
BIN S, D Converts the four digits of BCDdata specified by “S” to 16 bits ofbinary data and stores it in “D”.Example: H100 → K100
5 3 - 167
F82 32-bit binary data →8-digit BCD data
DBCD S, D Converts the 32 bits of binary dataspecified by (S+1, S) to eight digitsof BCD data and stores it in (D+1,D).
7 3 - 169
F83 8-digit BCD data →32-bit binary data
DBIN S, D Converts the eight digits of BCDdata specified by (S+1, S) to 32bits of binary data and stores it in(D+1, D).
7 3 - 170
F84 16-bit data invert INV D Inverts each bit of data of “D”. 3 3 - 171
F85 16-bit data comple-ment of 2
NEG D Inverts each bit of data of “D” andadds 1 (inverts the sign).
3 3 - 172
High-level InstructionsFP0
3 - 15
3.2 Table of High-level Instructions
Number Name Boolean Operand Description Steps Page
F86 32-bit data comple-ment of 2
DNEG D Inverts each bit of data of (D+1, D)and adds 1 (inverts the sign).
3 3 - 173
F87 16-bit data absolute ABS D Gives the absolute value of thedata of “D”.
3 3 - 174
F88 32-bit data absolute DABS D Gives the absolute value of thedata of (D+1, D).
3 3 - 175
F89 16-bit data signextension
EXT D Extends the 16 bits of data in “D”to 32 bits in (D+1, D).
3 3 - 176
F90 Decode DECO S, n, D Decodes part of the data of S andstores it in “D”. The part is speci-fied by “n”.
7 3 - 178
F91 7-segment decode SEGT S, D Converts the data of “S” for use ina 7-segment display and stores itin (D+1, D).
5 3 - 181
F92 Encode ENCO S, n, D Encodes part of the data of “S” andstores it in “D”. The part is speci-fied by “n”.
7 3 - 183
F93 16-bit data combine UNIT S, n, D The least significant digit of each ofthe “n” words of data beginning at“S” are stored (united) in order in“D”.
7 3 - 186
F94 16-bit data distrib-ute
DIST S, n, D Each of the digits of the data of “S”are stored in (distributed to) theleast significant digits of the areasbeginning at “D”.
7 3 - 188
F95 Character → ASCIIcode
ASC S, D Twelve characters of the characterconstants of “S” are converted toASCII code and stored in “D” to“D+5”.
15 3 - 190
F96 16-bit table datasearch
SRC S1, S2, S3 The data of “S1” is searched for inthe areas in the range “S2” to “S3”and the result is stored in DT9037and DT9038.
7 3 - 193
Data shift instructions
F100 Right shift ofmultiple bits (n bits)in a 16-bit data
SHR D, n Shifts the “n” bits of “D” to the right. 5 3 - 195
F101 Left shift of multiplebits (n bits) in a16-bit data
SHL D, n Shifts the “n” bits of “D” to the left. 5 3 - 197
F105 Right shift of onehexadecimal digit(4-bit)
BSR D Shifts the one digit of data of “D” tothe right.
3 3 - 199
F106 Left shift of onehexadecimal digit(4-bit)
BSL D Shifts the one digit of data of “D” tothe left.
3 3 - 201
F110 Right shift of oneword (16-bit)
WSHR D1, D2 Shifts the one word of the areas by“D1” and “D2” to the right.
5 3 - 203
F111 Left shift of oneword (16-bit)
WSHL D1, D2 Shifts the one word of the areas by“D1” and “D2” to the left.
5 3 - 205
F112 Right shift of onehexadecimal digit(4-bit)
WBSR D1, D2 Shifts the one digit of the areas by“D1” and “D2” to the right.
5 3 - 207
FP0High-level Instructions
3 - 16
3.2 Table of High-level Instructions
Number Name Boolean Operand Description Steps Page
F113 Left shift of onehexadecimal digit(4-bit)
WBSL D1, D2 Shifts the one digit of the areas by“D1” and “D2” to the left.
5 3 - 209
Basic function instructions
F118 UP/DOWN counter UDC S, D Counts up or down from the valuepreset in “S” and stores theelapsed value in “D”.
5 3 - 211
F119 Left/right shiftregister
LRSR D1, D2 Shifts one bit to the left or right withthe area between “D1” and “D2” asthe register.
5 3 - 214
Data rotate instructions
F120 16-bit data rightrotate
ROR D, n Rotate the “n” bits in data of “D” tothe right.
5 3 - 217
F121 16-bit data leftrotate
ROL D, n Rotate the “n” bits in data of “D” tothe left.
5 3 - 219
F122 16-bit data rightrotate with carryflag (R9009) data
RCR D, n Rotate the “n” bits in 17-bit areaconsisting of “D” plus the carry flag(R9009) data to the right.
5 3 - 221
F123 16-bit data leftrotate with carryflag (R9009) data
RCL D, n Rotate the “n” bits in 17-bit areaconsisting of “D” plus the carry flag(R9009) data to the left.
5 3 - 223
Bit manipulation instructions
F130 16-bit data bit set BTS D, n Set the value of bit position “n” ofthe data of “D” to 1.
5 3 - 225
F131 16-bit data bit reset BTR D, n Set the value of bit position “n” ofthe data of “D” to 0.
5 3 - 227
F132 16-bit data bit invert BTI D, n Invert the value of bit position “n” ofthe data of “D”.
5 3 - 229
F133 16-bit data bit test BTT D, n Test the value of bit position “n” ofthe data of “D” and output the re-sult to R900B.
5 3 - 231
F135 Number of on (1)bits in 16-bit data
BCU S, D Store the number of on bits in thedata of “S” in ”D”.
5 3 - 233
F136 Number of on (1)bits in 32-bit data
DBCU S, D Store the number of on bits in thedata of (S+1, S) in ”D”.
7 3 - 234
Basic function instruction
F137 Auxiliary timer(16-bit)
STMR S, D Turn on the specified output andR900D after 0.01 sec. × set value.
5 3 - 235
Special instructions
F140 Carry flag (R9009)set
STC Turns on the carry flag (R9009). 1 3 - 238
F141 Carry flag (R9009)reset
CLC Turns off the carry flag (R9009). 1 3 - 239
F143 Partial I/O update IORF D1, D2 Updates the I/O from the numberspecified by “D1” to the numberspecified by “D2”. Only possible forI/O numbers X0 to XF and Y0 toYF.
5 3 - 240
High-level InstructionsFP0
3 - 17
3.2 Table of High-level Instructions
Number Name Boolean Operand Description Steps Page
F144
(* Note 1)
Serial data commu-nication control forRS232C port
TRNS S, n The reception flag (R9038) is set tooff to enable reception.Beginning at “S”, “n” bytes of thedata registers are sent from theRS232C port.
5 3 - 241
F147 Printout PR S, D Converts the ASCII code data inthe area starting with “S” for print-ing, and outputs it to the word ex-ternal output relay WY specified by“D”.
5 3 - 247
F148 Self-diagnosticerror set
ERR n(n: K100to K299)
Stores the self -diagnostic errornumber “n” in DT9000, turns R9000on, and turns on the ERROR/ALARM LED.
3 3 - 251
F149 Message display MSG S Displays the character constant of“S” in the connected programmingtool.
13 3 - 253
Special instructions (High-speed counter instructions)
F0 High-speed countercontrol
MV S, DT9052 Performs high-speed counter con-trol according to the control codespecified by “S”. The control codeis stored in DT9052.
5 3 - 254
F1 Change and read ofthe elapsed value ofhigh speed counter
DMV S, DT9044(* Note 2)
Transfers (S+1, S) to high-speedcounter elapsed value area.
7 3 - 257p
high-speed counterDT9044,D(* Note 2)
Transfers value in high-speedcounter elapsed value area to(D+1, D).
7 3 - 257
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 areadepending on the channel used.ch0...DT9044, ch1...DT9048, ch2...DT9104, ch3...DT9108
FP0High-level Instructions
3 - 18
3.2 Table of High-level Instructions
Number Name Boolean Operand Description Steps Page
F166
(* Note )
Target value matchon instruction(with channelspecification)
HC1S n, S, Yn Turns output Yn on when theelapsed value of the built - in high-speed counter reaches the targetvalue of (S+1,S).
11 3 - 260
F167
(* Note )
Target value matchoff instruction(with channelspecification)
HC1R n, S, Yn Turns output Yn off when theelapsed value of the built - in high-speed counter reaches the targetvalue of (S+1,S).
11 3 - 262
F168
(* Note )
Positioning control(with channelspecification)
SPD1 n, S, Yn Outputs a positioning pulse fromthe specified output (Y0 or Y1) ac-cording to the contents of the datatable beginning at “S”.
5 3 - 264
F169
(* Note )
Pulse outputinstruction(with channelspecification)
PLS S, n Outputs a pulse from the specifiedoutput (Y0 or Y1) according to thecontents of the data table begin-ning at “S”.
5 3 - 268
F170
(* Note )
PWM outputinstruction(with channelspecification)
PWM S, n Performs PWM output from thespecified output (Y0 or Y1) accord-ing to the contents of the data tablebeginning at “S”.
5 3 - 270
Basic function instruction
F183 Auxiliary timer(32-bit)(* Note)
DSTM S, D Turn on the specified output andR900D after 0.01 sec. × set value.
7 3 - 272
NoteTo input instructions F166 to F170 and F183, NPST-GR Ver. 4.2 orlater or FP Programmer II (AFP1114V2) is necessary.
High-level InstructionsFP0
3 - 19
3.2 Table of High-level Instructions
Number Name Boolean Operand Description Steps Page
Floating point type real number operation instructions
F309
(* Note )
Floating point typedata move
FMV S, D (S+1, S) → (D+1, D) 8 3 - 275
F310
(* Note )
Floating point typedata addition
F+ S1, S2, D ( S1+1, S1) + (S2+1, S2)→(D+1, D) 14 3 - 277
F311
(* Note )
Floating point typedata subtraction
F- S1, S2, D ( S1+1, S1) - (S2+1, S2)→ (D+1,D) 14 3 - 279
F312
(* Note )
Floating point typedata multiplication
F* S1, S2, D ( S1+1, S1)×(S2+1, S2)→(D+1, D) 14 3 - 281
F313
(* Note )
Floating point typedata division
F% S1, S2, D ( S1+1, S1)÷(S2+1, S2)→(D+1, D) 14 3 - 283
F314
(* Note )
Floating point typedata sine operation
SIN S, D SIN (S+1, S) → (D+1, D) 10 3 - 285
F315
(* Note )
Floating point typedata cosine opera-tion
COS S, D COS (S+1, S) → (D+1, D) 10 3 - 287
F316
(* Note )
Floating point typedata tangentoperation
TAN S, D TAN (S+1, S) → (D+1, D) 10 3 - 289
F317
(* Note )
Floating point typedata arcsineoperation
ASIN S, D SIN-1 (S+1, S) → (D+1, D) 10 3 - 291
F318
(* Note )
Floating point typedata arccosineoperation
ACOS S, D COS-1 (S+1, S) → (D+1, D) 10 3 - 293
F319
(* Note )
Floating point typedata arctangentoperation
ATAN S, D TAN-1 (S+1, S) → (D+1, D) 10 3 - 295
F320
(* Note )
Floating point typedata naturallogarithm
LN S, D LN (S+1, S) → (D+1, D) 10 3 - 297
F321
(* Note )
Floating point typedata exponent
EXP S, D EXP (S+1, S) → (D+1, D) 10 3 - 299
F322
(* Note )
Floating point typedata logarithm
LOG S, D LOG (S+1, S) → (D+1, D) 10 3 - 301
F323
(* Note )
Floating point typedata power
PWR S1, S2, D (S1+1, S1) ^ (S2+1, S2)→ (D+1, D) 14 3 - 303
F324
(* Note )
Floating point typedata square root
FSQR S, D (S+1, S) → (D+1, D) 10 3 - 305
F325
(* Note )
16-bit integer data tofloating point typedata conversion
FLT S, D Converts the 16-bit integer data-with sign specified by “S” to realnumber data, and the converteddata is stored in “D.”
6 3 - 307
NoteThe instruction is available for FP0 T32 and FP0 C10/C14/C16/C32CPU Ver. 2.1 or later.
FP0High-level Instructions
3 - 20
3.2 Table of High-level Instructions
Number Name Boolean Operand Description Steps Page
F326
(* Note )
32-bit integer data tofloating point typedata conversion
DFLT S, D Converts the 32-bit integer datawith sign specified by (S+1, S) toreal number data, and the con-verted data is stored in (D+1, D).
8 3 - 309
F327
(* Note )
Floating point typedata to 16-bitinteger conversion(the largest integernot exceeding thefloating point typedata)
INT S, D Converts real number data speci-fied by (S+1, S) to the 16-bit inte-ger data with sign (the largest inte-ger not exceeding the floating pointdata), and the converted data isstored in “D.”
8 3 - 311
F328
(* Note )
Floating point typedata to 32-bitinteger conversion(the largest integernot exceeding thefloating point typedata)
DINT S, D Converts real number data speci-fied by (S+1, S) to the 32-bit inte-ger data with sign (the largest inte-ger not exceeding the floating pointdata), and the converted data isstored in (D+1, D).
8 3 - 313
F329
(* Note )
Floating point typedata to 16-bitinteger conversion(rounding the firstdecimal point downto integer)
FIX S, D Converts real number data speci-fied by (S+1, S) to the 16-bit inte-ger data with sign (rounding thefirst decimal point down), and theconverted data is stored in “D.”
8 3 - 315
F330
(* Note )
Floating point typedata to 32-bitinteger conversion(rounding the firstdecimal point downto integer)
DFIX S, D Converts real number data speci-fied by (S+1, S) to the 32-bit inte-ger data with sign (rounding thefirst decimal point down), and theconverted data is stored in (D+1,D).
8 3 - 317
F331
(* Note )
Floating point typedata to 16-bitinteger conversion(rounding the firstdecimal point off tointeger)
ROFF S, D Converts real number data speci-fied by (S+1, S) to the 16-bit inte-ger data with sign (rounding thefirst decimal point off), and the con-verted data is stored in “D.”
8 3 - 319
F332
(* Note )
Floating point typedata to 32-bitinteger conversion(rounding the firstdecimal point off tointeger)
DROFF S, D Converts real number data speci-fied by (S+1, S) to the 32-bit inte-ger data with sign(rounding the firstdecimal point off), and the con-verted data is stored in (D+1, D).
8 3 - 321
F333
(* Note )
Floating point typedata rounding thefirst decimal pointdown
FINT S, D The decimal part of the real num-ber data specified in (S+1, S) isrounded down, and the result isstored in (D+1, D).
8 3 - 323
F334
(* Note )
Floating point typedata rounding thefirst decimal pointoff
FRINT S, D The decimal part of the real num-ber data stored in (S+1, S) isrounded off, and the result isstored in (D+1, D).
8 3 - 325
NoteThe instruction is available for FP0 T32 and FP0 C10/C14/C16/C32CPU Ver. 2.1 or later.
High-level InstructionsFP0
3 - 21
3.2 Table of High-level Instructions
Number Name Boolean Operand Description Steps Page
F335
(* Note )
Floating point typedata sign changes
F+/- S, D The real number data stored in(S+1, S) is changed the sign, andthe result is stored in (D+1, D).
8 3 - 327
F336
(* Note )
Floating point typedata absolute
FABS S, D Takes the absolute value of realnumber data specified by (S+1, S),and the result (absolute value) isstored in (D+1, D).
8 3 - 329
F337
(* Note )
Floating point typedata degrees →radians
RAD S, D The data in degrees of an anglespecified in (S+1, S) is convertedto radians (real number data), andthe result is stored in (D+1, D).
8 3 - 331
F338
(* Note )
Floating point typedata radians →degrees
DEG S, D The angle data in radians (realnumber data) specified in (S+1, S)is converted to angle data in de-grees, and the result is stored in(D+1, D).
8 3 - 333
Time series processing instruction
F355
(* Note )
PID processing PID S PID processing is performed de-pending on the control value(mode and parameter) specified by(S to S+2) and (S+4 to S+10), andthe result is stored in the (S+3).
4 3 - 335
NoteThe instruction is available for FP0 T32 and FP0 C10/C14/C16/C32CPU Ver. 2.1 or later.
FP0High- level Instructions
3 - 22
3.3 Explanation of High- level Instructions
3.3 Explanation of High- level Instructions
Layout of instruction explanations
Number of stepsThis is the number ofsteps used with thisinstruction.
BooleanThis indicates howcodes are usedwhen data is en-tered using bool-ean entry with theprogramming toolsoftware (NPST-GR/FPWIN GR).
Data is also en-tered in this formatwhen using the FPProgrammer II.
Ladder diagramThis indicates theladder diagramscreen displayedwhen data is en-tered using the pro-gramming tool soft-ware (NPST-GR/FPWIN GR).
Explanation ofprogramexample andflagconditionsUsing the pro-gram shown inthe above ladderdiagram as anexample,changes inmovements andstored values areshown, as well astypes of flags andthe conditions un-der which they goon and off.
AvailableoperandsThis indicatestypes of registersand constantswhich can beused as operands.
For information ontypes of memoryareas, refer tosection 1.2.
FP0 High- level Instructions
3 - 23
3.3 Explanation of High- level Instructions
Outline Copies 16-bit data to the specified 16-bit area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F0 MV , DT 0 , DT 1
S D
Trigger
R0
10
11
ST R 0
F 0 (MV)
DT 0
DT 1
S 16-bit equivalent constant or 16-bit area (source)
D 16-bit area (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleThe contents of data register DT0 are copied to data registerDT1 when execution condition (trigger) R0 turnson.
DescriptionThe 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.
F0 MV, K 30, SV 0R1
Example 2: Transfer the timer elapsed value EV0 to data register DT0 whenR2 turns on.
F0 MV, EV 0, DT 0R2
Flag conditionsS 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.
16-bit data moveF0Step Availability
FP0 C10, C14, C16,C32, T32, SL1(MV) 5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 24
3.3 Explanation of High- level Instructions
Outline Copies 32-bit data to the specified 32-bit area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F1 DMV , DT 0 , DT100
S D
Trigger
R0
10
11
ST R 0
F 1 (DMV)
DT 0
DT 100
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleThe contents of data registers DT1 and DT0 are copied to data registers DT101 and DT100 when executioncondition (trigger) R0 turns on.
Content forDT1
To DT100To DT101
.... The content (16 bits) of DT0 and the content (16 bits) of DT1 are joined andtreated as 32-bit data.
Higher16-bit area
Lower16-bit area
Content forDT0
.... 32-bit data is separated into the higher 16-bit data and the lower 16-bit data,and stored in DT101 and DT100.
DescriptionThe 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 thelower 16-bit areas (S, D) are specified.
Flag conditionsS 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.
32-bit data moveF1 (DMV)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 25
3.3 Explanation of High- level Instructions
Outline Inverts 16-bit data and transfers it to the specified 16-bit area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F2 MV/ , DT 1 , DT 0
S D
R0
Trigger10
11
ST R 0
F 2 (MV/)
DT 1
DT 0
S 16-bit equivalent constant or 16-bit area to be inverted (source)
D 16-bit area (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleThe contents of data register DT1 are inverted and transferred to data register DT0when executioncondition(trigger) R0 turns on.
· ·· ·Bit position · · · · ·DT1
150 1 0
121
110 1 0
81
70 1 0
41
30 1 0
01
Source [S]: H5555
· ·· ·Bit position · · · · ·DT0
151 0 1
120
111 0 1
80
71 0 1
40
31 0 1
00
Destination [D]: HAAAA
H 23AH 5555
H 3F
H 1234
[S]
H 1111
H FFFF
[D]
H 23AH 5555
H 3F
H 1234[S]
H AAAA
H FFFF
[D]
Invert andtransfer
R0: on “F2 (MV/)” executionInvert and transfer
012
012
012
012
DT DT
DTDT
16-bit data invert and moveF2Step Availability
FP0 C10, C14, C16,C32, T32, SL1(MV/) 5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 26
3.3 Explanation of High- level Instructions
DescriptionThe 16-bit data or 16-bit equivalent constant specified by S is inverted and transferred to the 16-bit areaspecified by D.
· ·· ·Bit position · · · · ·Binary data
150 0 0
120
110 1 0
80
71 1 0
41
30 0
00
· ·· ·Bit position · · · · ·151 1 1
121
111 0 1
81
70 0 1
40
31 1 0
01
1
Binary data
Flag conditionsS 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.
FP0 High- level Instructions
3 - 27
3.3 Explanation of High- level Instructions
Outline Inverts 32-bit data and transfers it to the specified 32-bit area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F3 DMV/ , DT100 , DT 0
S D
Trigger
R0
10
11
ST R 0
F 3 (DMV/)
DT 100
DT 0
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleThe contents of data registers DT101 and DT100 are inverted and transferred to data registers DT1 and DT0when execution condition (trigger) R0 turns on.
Invert andtransfer
99
100
101
0
1
2
H 34AH 2
H 25AC
H FFFF
[S]H 1111
H FFFF
[D]
H 0H 2
H 25AC
H FFFF
99
100
101[S]
H FFFD
H FFFF
0
1
2
[D]
R0: on “F3 (DMV/)” execution
DT DT
DTDT
32-bit data invert and move5
F3Step Availability
(DMV/) FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 28
3.3 Explanation of High- level Instructions
DescriptionThe 32-bit data or 32-bit equivalent constant specified by S is inverted and transferred to the 32-bit areaspecified by D.
1 1 0 0 1 1 0 1 0 0 0 1 0 1 0 1SS+1
0 0 1 1 0 0 1 0 1 1 1 0 1 0 1 0DD+1
0 0 0 0 0 1 1 1 0 1 0 1 1 0 1 1
1 1 1 1 1 0 0 0 1 0 1 0 0 1 0 0
Flag conditionsS 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.
FP0 High- level Instructions
3 - 29
3.3 Explanation of High- level Instructions
Outline Copies bit data of one 16-bit area to the specified bit of another 16-bitarea
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F5 BTM , DT 1 , H C04 , DT 0R0
S D
Trigger
n
10
11
ST R 0
F 5 (BTM)
DT 1
H C04
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 bitpositions)
D 16-bit area (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
n A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleThe data at bit position 4 in data register DT1 is copied to bit position 12 in data register DT0 when executioncondition (trigger) R0 turns on.
Bit position
DT0
120
· ·· ·Bit position · · · · ·DT1
151 1 0
120
111 1 0
81
70 0 0
41
30 1 0
01
Source [S]
R0: on
·· · · · · · ·150 0 0
110 1 0
80
71 1 0
41
30 0 1
00
Destination [D]
·· ·Bit position · · · · ·DT0
150 0 0
121
110 1 0
80
71 1 0
41
30 0 1
00
Destination [D]“F5 (BTM)”execution
Bit data moveF5Step Availability
(BTM) FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 30
3.3 Explanation of High- level Instructions
DescriptionA 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 areaspecified by D, as specified by n.
How to specify nThe “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 DBit 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 conditionsS 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.
FP0 High- level Instructions
3 - 31
3.3 Explanation of High- level Instructions
Outline Copies hexadecimal digits at one 16-bit area to the specified digitposition in another 16-bit area
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F6 DGT , DT 100 , H 0 , DT 0
S D
Trigger
n
R0
10
11
ST R 0
F 6 (DGT)
DT 100
H 0
DT 0
S 16-bit equivalent constant or 16-bit area (source)
n 16-bit equivalent constant or 16-bit area (specifies source and destinationhexadecimal digit position and number of hexadecimal digits)
D 16-bit area (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
n A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleHexadecimaldigit position
· ·· ·Bit position · · · · ·DT100
150 0 0
120
110 0 0
81
70 1 0
40
31 0 0
01
3 2 1 0
· ·· ·Bit position · · · · ·DT0
150 0 0
120
111 0 0
80
71 0 1
40
31 0 0
01
Hexadecimaldigit position 3 2 1 0
In this example, the upper 12 bits of DT0 do not change.
The lower four bits in the data registerDT100 is copied.
Hexadecimal digit moveF6 (DGT)Step Availability
FP0 C10, C14, C16,C32, T32, SL17
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 32
3.3 Explanation of High- level Instructions
DescriptionThe hexadecimal digits in the 16-bit data or in the 16-bit equivalent constant specified by S are copied to the16-bit area specified by D, as specified by n.
DigitsDigits are units of 4 bits used when handling data.
With this instruction,16-bitdata isseparated into four digits.The digitsare called in orderhexadecimaldigit0,digit 1, digit 2 and digit 3, beginning from the least significant four bits
· ·· · · · · · ·150 0 0
120
110 0 0
81
70 1 0
40
31 0 0
01
16-bit data
Hexadecimaldigit 3
Hexadecimaldigit 2
Hexadecimaldigit 1
Hexadecimaldigit 0
Flag conditionsS 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 nThe n specifies the 3 source hexadecimal digit position, the 2 number of digits and the 1 destinationhexadecimal digit position to be copied using hexadecimal data as follows:
n : H j j j
3 Source: Starting hexadecimal digit positionH0: Hexadecimal digit 0H1: Hexadecimal digit 1H2: Hexadecimal digit 2H3: Hexadecimal digit 3
2 Number of hexadecimal digits to be copiedH0: 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 positionH0: Hexadecimal digit 0H1: Hexadecimal digit 1H2: Hexadecimal digit 2H3: 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 shortform, “H0.”
FP0 High- level Instructions
3 - 33
3.3 Explanation of High- level Instructions
Examples of hexadecimal digit copyThe following patterns of digit transfer are possible based on the specification of n.
S
D
(1) When hexadecimal digit 1 of the source is copied to hexadecimal digit 1 of the destination:
Specify n: H 0 0 3 (Short form: H3)
(2) When hexadecimal digit 3 of the source is copied to hexadecimal digit 0 of the destination:
(3) When multiple hexadecimal digits (hexadecimal digits 2 and 3) of the source are copied to multiplehexadecimal digits (hexadecimal digits 2 and 3) of the destination:
(4) When multiple hexadecimal digits (hexadecimal digits 0 and 1) of the source are copied to multiplehexadecimal digits (hexadecimal digits 2 and 3) of the destination:
(5) When 4 hexadecimal digits (hexadecimal digits 0 to 3) of the source are copied to 4 hexadecimaldigits (hexadecimal digits 0 to 3) of the destination:
S
D
S
D
S
D
S
D
3 2 1 0
3 2 1 0
3 2 1 0
3 2 1 0
3 2 1 0
3 2 1 0digit
3 2 1 0digit
3 2 1 0digit
3 2 1 0digit
3 2 1 0digit
digit
digit
digit
digit
digit
Specify n: H 1 0 1
Specify n: H 2 1 2
Specify n: H 2 1 0
Specify n: H 1 3 0
FP0High- level Instructions
3 - 34
3.3 Explanation of High- level Instructions
Outline Copies block data to the specified area. 4
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F10 BKMV , DT 0 , DT 3 , DT 11
S1 D
Trigger
S2
R0
10
11
ST R 0
F 10 (BKMV)
DT 0
DT 3
DT 11
S1 Starting 16-bit area (source)
S2 Ending 16-bit area (source)
D Starting 16-bit area (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleThe data of data register “DT0 to DT3” is copied to the data registers “DT11 to DT14” when executioncondition (trigger) R0 turns on.
K 13
K 0K 11
K 10
K 12
[S1] 012
[S2] 34
Source
K 0
K 0
1011121314
R0: on “F10 (BKMV)” execution
K 0K 13K 14 K 0
K 10K 11
K 10
K 12
[S1] 012
[S2] 34
K 0
K 11K 12K 13
K 14
[D]
1011121314
DT DT
DTDT
Block moveF10Step Availability
(BKMV) FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 35
3.3 Explanation of High- level Instructions
DescriptionThe data block specified by S1 and S2 is copied to the block starting from the 16-bit area specified by D.
Precautions during programmingThe 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 bespecified by S2. If S1 is specified as higher than S2 and the instruction is executed, an operation error willoccur.
Flag conditionsS 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 DThe 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).
K 10K 11
K 10
K 12
[S1] 012
[S2] 34
K 10
K 11K 12K 13
K 14 K 13
[D]
01234
DT DT
If S1 > D, the source data is copied starting from the lower address to the higher address in order (DT0→DT1→ DT2).
K 14
K 12K 10
K 13
K 12
K 11 K 1301
[S1] 23
[S2] 4
K 14
01234
K 13K 14
[D]DT DT
FP0High- level Instructions
3 - 36
3.3 Explanation of High- level Instructions
Outline Copies the specified 16-bit data to a block with one or more 16-bitareas.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F11 COPY , DT 1 , DT10 , DT14
S D2
Trigger
D1
R0
10
11
ST R 0
F 11 (COPY)
DT 1
DT 10
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D2 N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleThe contents of data register DT1 are copied to the block ranging from data register DT10 to DT14 whenexecution condition (trigger) R0 turns on.
K 0K 11K 10
K 12
0[S] 1
234
K 0
K 0
1011121314
R0: on “F11 (COPY)” execution
K 0K 13
K 14 K 0
K 11K 11K 10
K 12
0[S] 1
234
K 11
K 11K 11K 13
K 14 K 11
[D1]
[D2]
[D1]
[D2]
1011121314
DT DT
DTDT
Block copyF11 (COPY)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 37
3.3 Explanation of High- level Instructions
DescriptionThe 16-bit equivalent constant or 16-bit area specified by S is copied to all 16-bit areas of the block specifiedby D1 and D2.
Precautions during programmingThe 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 addressshould be specified by D2. If D1 is specified as higher than D2 and the instruction is executed, an operationerror 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 thatnumber.
Flag conditionsS 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.
FP0High- level Instructions
3 - 38
3.3 Explanation of High- level Instructions
Outline Reads data from the EEPROM area.
Program example
Ladder DiagramBoolean Non-ladder
Ladder DiagramAddress Instruction
10 F12 ICRD , K 0 , K10 , DT0
S1 D
Trigger
S2
R0
10
11
ST R 0
F 12 (ICRD)
K 0
K 10
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 specifyingnumber of words to be read
D Starting 16-bit area for storing data read from EEPROM (for destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR WL SV EV DT LD FL IX IY K Hmodifier
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
Explanation of example10 blocks of data stored in blocks 0 to 9 of the EEPROM are transferred to data registers DT0 to DT639 whenexecution condition (trigger) R0 turns on.
0
64
128
576
[S1] 0
EEPROM area[D]
Address(Block)
1
2
9
Data register DT
[S2]
64 words
64 words
64 words
64 words
Data read from EEPROM
Step Availability
11F12 (ICRD)FP0 C10, C14, C16,
C32, SL1 CPU ver. 2.1or later/FP0 T32
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 39
3.3 Explanation of High- level Instructions
DescriptionS2 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 programmingValues that can be specified by S1, S2 and D
Type Memory areayp
S1 S2 DFP0 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 readFP0 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 beenwritten to the EEPROM.
Flag conditionsS 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.
FP0High- level Instructions
3 - 40
3.3 Explanation of High- level Instructions
Outline Writes data to the EEPROM area.
Program example
Ladder DiagramBoolean Non-ladder
Ladder DiagramAddress Instruction
10 P13 PICWT , DT 0 , K10 , K0
S1 D
Trigger
S2
R0
This instruction is a differential executiontype of instruction, and should be specifiedwith a “P” in front of the instruction number.
10
11
ST R 0
P 13 (PICWT)
DT 0
K 10
K 0
S1 Starting 16-bit area for storing source data
S2 32-bit equivalent constant or lower 16-bit area of 32-bit data for specifyingnumber of words to be write
D Starting address (constant) of EEPROM area for storing received data (fordestination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR WL SV EV DT LD FL IX IY K Hmodifier
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
Explanation of example10 blocks (640 words) of data stored in data registers DT0 to DT576 are transferred to blocks 0 to 9 in theEEPROM area when execution condition (trigger) R0 turns on.
0
1
2
9
[S1] 0
EEPROM area
[D]
Address(Block)
64
128
576
Data register DT
[S2]
64 words
64 words
64 words
64 words
Data write to EEPROM
Step Availability
11P13(PICWT)FP0 C10, C14, C16,
C32, SL1 CPU ver. 2.1or later/FP0 T32
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 41
3.3 Explanation of High- level Instructions
DescriptionS2 blocks of data stored in the data register starting from S1 are transferred into the EEPROM area specifiedby D. At this time, the transferred data is handled in units of 1 block/64 words.
Precautions during programmingValues that can be specified by S1, S2 and D
Type Memory areayp
S1 S2 DFP0 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 readFP0 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 erroneousprogramming, it has been set up as a differential execution type of instruction (P13). When setting up theprogram, 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 eachblock (64 words).
This instruction should not be used in interrupt programs.
Flag conditionsS 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.
FP0High- level Instructions
3 - 42
3.3 Explanation of High- level Instructions
Outline Exchanges two 16-bit data items.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F15 XCH , DT 0 , DT 12
D1 D2
Trigger
R0
10
11
ST R 0
F 15 (XCH)
DT 0
DT 12
D1 16-bit area to be exchanged
D2 16-bit area to be exchanged
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D1 N/A A A A A A A A N/A N/A A
D2 N/A A A A A A A A N/A N/A A
Explanation of exampleThe contents of data register DT0 and data register DT12 are exchanged when execution condition (trigger)R0 turns on.
1011121314
K 21K 11
K 10
K 12
[D1] 01234
K 20
K 22
1011121314
R0: on “F15 (XCH)” execution
K 23K 13
K 14 K 24
K 21K 11K 22
K 12
[D1] 01234
K 20
K 10K 23K 13
K 14 K 24
[D2]
[D2]
DT DT
DTDT
16-bit data exchangeF15(XCH)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 43
3.3 Explanation of High- level Instructions
DescriptionThe contents in the 16-bit areas specified by D1 and D2 are exchanged.
Flag conditionsS 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.
FP0High- level Instructions
3 - 44
3.3 Explanation of High- level Instructions
Outline Exchanges two 32-bit data items.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F16 DXCH , DT 0 , DT12
D1 D2
Trigger
R0
10
11
ST R 0
F 16 (DXCH)
DT 0
DT 12
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D1 N/A A A A A A A N/A N/A N/A A
D2 N/A A A A A A A N/A N/A N/A A
Explanation of exampleThe contents of data registers DT1 and DT0 and data registers DT13 and DT12 are exchanged whenexecution condition (trigger) R0 turns on.
FFFD
DEF1
5678
2
25AC
[D1] 0123
1234
9ABC
10111213
R0: on “F16 (DXCH)” execution
DEF1F23
5678
9ABC
25AC
[D1] 0123
1234
2
10111213 FFFDF23
[D2]
[D2]
H
H
HH
H
HHH
HH
HH
HHH
H
DT DT
DTDT
32-bit data exchange5
F16 (DXCH)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 45
3.3 Explanation of High- level Instructions
DescriptionThe contents in the 32-bit areas specified by D1 and D2 are exchanged.
Flag conditionsS 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.
FP0High- level Instructions
3 - 46
3.3 Explanation of High- level Instructions
Outline Exchanges higher and lower order bytes of the specified 16-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F17 SWAP , DT 0
D
Trigger
R0
10
11
ST R 0
F 17 (SWAP)
DT 0
D 16-bit area to be exchanged higher and lower bytes
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR EV DT IX IY K Hmodifier
D N/A A A A A A A N/A N/A A
Explanation of exampleThe higher and lower bytes of data register DT0 are exchanged when execution condition (trigger) R0 turnson.
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 1 0
80
71 1 0
41
30 0 1
00
R0: on
Higher byte (8-bit)
Hexadecimal 0 4 D 2
Lower byte (8-bit)
· ·· ·Bit position · · · · ·DT0
151 1 0
121
110 0 1
80
70 0 0
40
30 1 0
00
Hexadecimal D 2 0 4
“F17 (SWAP)” execution
DescriptionThe higher order byte (higher 8-bit) and lower order byte (lower 8-bit) of the 16-bit area specified by D areexchanged.
Flag conditionsS 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.
Higher/lower byte in16-bit data exchange
5
F17(SWAP)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 47
3.3 Explanation of High- level Instructions
Outline Adds two 16-bit data items.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F20 +, DT 0 , DT 2
S D
Trigger
R0
10
11
ST R 0
F 20 (+ )
DT 0
DT 2
S 16-bit equivalent constant or 16-bit area (for addend)
D 16-bit area (for augend and result)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleThe 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.
· ·· ·Bit position · · · · ·DT2
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
00
Augend [D]: K8
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
30 1 0
00
Addend [S]: K4
· ·· ·Bit position · · · · ·DT2
150 0 0
120
110 0 0
80
70 0 0
40
31 1 0
00
Result [D]: K12
+
DescriptionThe 16-bit equivalent constant or 16-bit area specified by S and the 16-bit area specified by D are addedtogether.
Augend data Trigger turns on Result(D) (D)+ (S)
Addend data
16-bit data addition[D + S → D]
5
F20 (+)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 48
3.3 Explanation of High- level Instructions
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 dataaddition) is recommended.
When you use the F21 (D+) instruction instead of F20 (+), be sure to convert the 16-bit addend and augendinto 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 conditionsS 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).
FP0 High- level Instructions
3 - 49
3.3 Explanation of High- level Instructions
Outline Adds two 32-bit data items.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F21 D+ , DT 0 , DT 2
S D
Trigger
R0
10
11
ST R 0
F 21 (D+)
DT 0
DT 2
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleThe contents (32 bits) of data registers DT3 and DT2 and the contents (32 bits) of data registersDT1 and DT0are added together when execution condition (trigger) R0 turns on.
Contents ofDT3
Contentsof DT0
Contentsof DT1
The specified data area and thefollowing data area are handledtogether as 32-bit data.
Higher 16 bits Lower 16 bits
Contents ofDT2
← The lower 16 bits of added result isstored in DT2 and the higher 16bits of the result is stored in DT3.
(Addition)
(Result is stored.)
Store to DT3 Store to DT2
32-bit data addition[(D+1, D) + (S+1, S) → (D+1, D)]
5
F21(D+)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 50
3.3 Explanation of High- level Instructions
DescriptionThe 32-bit equivalent constant or the 32-bit area specified by S and the 32-bit data specified by D are addedtogether.
Augend data Result(D+1, D) (D+1, D)+ (S+1, S)
Addend data
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 conditionsS 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).
FP0 High- level Instructions
3 - 51
3.3 Explanation of High- level Instructions
Outline Adds two 16-bit data items and stores the result in the specified area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F22+, DT 0 , DT 1 , DT 100
S1 D
Trigger
S2
R0
10
11
ST R 0
F 22 (+ )
DT 0
DT 1
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleThe contents of data registers DT0 and DT1 are added when execution condition (trigger) R0 turns on. Theadded 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.
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
00
Augend [S1]: K8
· ·· ·Bit position · · · · ·DT1
150 0 0
120
110 0 0
80
70 0 0
40
30 1 0
00
Addend [S2]: K4
· ·· ·Bit position · · · · ·DT100
150 0 0
120
110 0 0
80
70 0 0
40
31 1 0
00
Result [D]: K12
+(Addition)
16-bit data addition[S1 + S2 → D]F22 (+)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 52
3.3 Explanation of High- level Instructions
DescriptionThe 16-bit data or 16-bit equivalent constant specified by S1 and S2 are added together. The added result isstored in D.
Augend data Result(S1) (D)+ (S2)
Addend data
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 dataaddition) is recommended.
When you use the F23 (D+) instruction instead of F22 (+), be sure to convert the 16-bit addend and augendinto 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 conditionsS 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).
FP0 High- level Instructions
3 - 53
3.3 Explanation of High- level Instructions
Outline Adds two 32-bit data items and stores the result in the specified area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F23 D+ , DT 0 , DT 100 , DT 200
S1 D
Trigger
S2
R0
10
11
ST R 0
F 23 (D+)
DT 0
DT 100
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleThe contents of data registers DT1 and DT0 and the contents of data registers DT101 and DT100 are addedwhen execution condition (trigger) R0 turns on. The added result is stored in data registers DT201 andDT200.
Contents ofDT1
Contents ofDT100
Contents ofDT101
The specified data area and thefollowing data area are handledtogether as 32-bit data.
Higher 16 bits Lower 16 bits
Contents ofDT0
← The lower 16 bits of added result isstored in DT200 and the higher 16 bitsof the result is stored in DT201.
(Addition)
(Result is stored.)
Store to DT201 Store to DT200
32-bit data addition[(S1+1, S1) + (S2+1, S2)→ (D+1, D)]F23 (D+)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 54
3.3 Explanation of High- level Instructions
DescriptionThe 32-bit data or 32-bit equivalent constant specified by S1 and S2 are added together. The added result isstored in D+1 and D.
Augend data Result(S1+1, S1) (D+1, D)+ (S2+1, S2)
Addend data
When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1, D+1) are automatically determined oncethe lower 16-bit areas (S1, S2, D) are specified.
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 conditionsS 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).
FP0 High- level Instructions
3 - 55
3.3 Explanation of High- level Instructions
Outline Subtracts 16-bit data from the minuend.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F25 - , DT 0 , DT 2
S D
Trigger
R0
10
11
ST R 0
F 25 (- )
DT 0
DT 2
S 16-bit equivalent constant or 16-bit area (for subtrahend)
D 16-bit area (for minuend and result)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleSubtracts 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 number4 is in DT0.
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0DT2
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0DT0
D: K16
S:
-
K4
=
0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0DT2D: K12
(Subtraction)
Example 2: When the decimal number 3 is in DT2 and the decimal number 5is in DT0.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1DT2
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1DT0
D: K3
S:
-
K5
=
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0DT2D: K-2
(Subtraction)
16-bit data subtraction[D - S → D]
5
F25 (-)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 56
3.3 Explanation of High- level Instructions
DescriptionSubtracts the 16-bit equivalent constant or 16-bit area specified by S from the 16-bit area specified by D.
Minuend data Result(D) (D)- (S)
Subtrahend data
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 datasubtraction) is recommended.
When you use the F26 (D- ) instruction instead of F25 (- ), be sure to convert the 16-bit subtrahend andminuend 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 conditionsS 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).
FP0 High- level Instructions
3 - 57
3.3 Explanation of High- level Instructions
Outline Subtracts 32-bit data from the minuend.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F26 D- , DT 0 , DT 2
S D
Trigger
R0
10
11
ST R 0
F 26 (D-)
DT 0
DT 2
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleSubtracts the contents (32 bits) of data registers DT1 and DT0 from the contents (32 bits) of data registersDT3 and DT2 when execution condition (trigger) R0 turns on.
Contents ofDT3
Contents ofDT0
Contents ofDT1
The specified data area and thefollowing data area are handledtogether as 32-bit data.
Higher 16 bits Lower 16 bits
Contents ofDT2
← The lower 16 bits of subtracted resultis stored in DT2 and the higher 16 bitsof the result is stored in DT3.
(Subtraction)
(Result is stored.)
Store to DT3 Store to DT2
32-bit data Subtraction[(D+1, D) - (S+1, S) → (D+1, D)]F26 (D-)
Step AvailabilityFP0 C10, C14, C16,
C32, T32, SL17
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 58
3.3 Explanation of High- level Instructions
DescriptionSubtracts the 32-bit equivalent constant or the 32-bit data specified by S from the 32-bit data specified by D.
Minuend data Result(D+1, D) (D+1, D)— (S+1, S)
Subtrahend data
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 conditionsS 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).
FP0 High- level Instructions
3 - 59
3.3 Explanation of High- level Instructions
Outline Subtracts 16-bit data from the minuend and stores the result in thespecified area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F27 - , DT 0 , DT 1 , DT 100
S1 DS2
R0
Trigger 10
11
ST R 0
F 27 (- )
DT 0
DT 1
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleSubtracts 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 4is in DT1.
·
Bit positionDT0
150 0 0
120
110 0 0
80
70 0 0
41
30 0 0
00
Minuend [S1]: K16
Bit positionDT1
150 0 0
120
110 0 0
80
70 0 0
40
30 1 0
00
Subtrahend [S2]: K4
Bit position
DT100150 0 0
120
110 0 0
80
70 0 0
40
31 1 0
00
Result [D]: K12
-· · · · · · · ·
· · · · · · · ·
· · · · · · ·
(Subtraction)
16-bit data subtraction[S1 - S2 → D]F27 (-)
Step Availability
FP0 C10, C14, C16,C32, T32, SL17
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 60
3.3 Explanation of High- level Instructions
Example 2: When the decimal nmber 3 is in DT0 and the decimal number 5is in DT1.
·
-
Bit position
DT10015 1211 8 7 4 3 0
Bit positionDT1
15 1211 8 7 4 3 0
Bit positionDT0
15 1211 8 7 4 3 0
Minuend [S1]: K3
Subtrahend [S2]: K5
Result [D]: K-2
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 1 10
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
· · · · · · · ·
· · · · · · · ·
· · · · · · ·
(Subtraction)
DescriptionSubtracts the 16-bitdataor16-bit equivalentconstant specifiedby S2fromthe16-bit dataor16-bitequivalentconstant specified by S1. The subtracted result is stored in D.
Minuend data Result(S1) (D)- (S2)
Subtrahend data
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 datasubtraction) is recommended.
When you use the F28 (D- ) instruction instead of F27 (- ) be sure to convert the 16-bit subtrahend andminuend 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 conditionsS 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).
FP0 High- level Instructions
3 - 61
3.3 Explanation of High- level Instructions
Outline Subtracts 32-bit data from the minuend and stores the result in thespecified area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F28 D- , DT 100 , DT 200 , DT 0
S1 DS2
R0
Trigger 10
11
ST R 0
F 28 (D-)
DT 100
DT 200
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleSubtracts the contents of data registers DT201 and DT200 from the contents of data registers DT101 andDT100 when execution condition (trigger) R0 turns on. The subtracted result is stored in data registers DT1and DT0.
Contents ofDT101
Contents ofDT200
Contents ofDT201
Higher 16 bits Lower 16 bits
Contents ofDT100
(Subtraction)
(Result is stored.)
Store to DT1 Store to DT0
The specified data area and thefollowing data area are handledtogether as 32-bit data.
← The lower 16 bits of subtracted resultis stored in DT0 and the higher 16 bitsof the result is stored in DT1.
32-bit data subtraction[(S1+1, S1) - (S2+1, S2)→ (D+1, D)]F28 (D-)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 62
3.3 Explanation of High- level Instructions
DescriptionSubtracts the 32-bitdataor32-bit equivalentconstant specifiedby S2fromthe32-bit dataor32-bitequivalentconstant specified by S1. The subtracted result is stored in D+1 and D.
Minuend data Result(S1+1, S1) (D+1, D)— (S2+1, S2)
Subtrahend data
When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1 D+1) are automatically determined oncethe lower 16-bit areas (S1, S2, D) are specified.
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 conditionsS 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).
FP0 High- level Instructions
3 - 63
3.3 Explanation of High- level Instructions
Outline Multiplies two 16-bit data items.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F30 *, DT 0 , DT 10 , DT 100
S1 D
Trigger
S2
R0
10
11
ST R 0
F 30 (*)
DT 0
DT 10
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleMultiplies 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.
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
00
Multiplicand [S1]: K8
· ·· ·Bit position · · · · ·DT10
150 0 0
120
110 0 0
80
70 0 0
40
30 0 1
00
Multiplier [S2]: K2
· ·· ·Bit position · · · · ·DT101
150 0 0
120
110 0 0
80
70 0 0
40
30 0 0
00
Result [D+1, D]: K16
Higher 16-bit area Lower 16-bit area
· ·· ·Bit position · · · · ·DT100
150 0 0
120
110 0 0
80
70 0 0
41
30 0 0
00
The lower 16 bits of the 32-bit multiplication result are stored in the specified memory area (DT100), and thehigher16 bits are stored in the area following the specified area (DT101).
16-bit data multiplication[S1 × S2 → (D+1, D)]F30(*)
Step Availability
FP0 C10, C14, C16,C32, T32, SL17
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 64
3.3 Explanation of High- level Instructions
DescriptionMultiplies the 16-bit data or 16-bit equivalent constant specified by S1 and the 16-bit data or 16-bit equivalentconstant specified by S2. The multiplied result is stored in D+1 and D (32-bit area).
Multiplicand data Result(S1) (D+1, D)× (S2)
Multiplier data
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 conditionsS 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”.
FP0 High- level Instructions
3 - 65
3.3 Explanation of High- level Instructions
Outline Multiplies two 32-bit data items.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F31 D* , DT 0 , DT 100 , DT 200
S1 S2
R0
Trigger
D
10
11
ST R 0
F 31 (D*)
DT 0
DT 100
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of example
Contents ofDT1
Contents ofDT100
Contents ofDT101
16 bits 16 bits
Contents ofDT0
Store toDT201
Store toDT200
16 bits 16 bits
16 bits 16 bits
Store toDT203
Store toDT202
16 bits 16 bits
The specified data area and the following dataarea are handled together as 32-bit data.
← The 64 bits of multiplication result are stored inorder in DT200 to DT203 beginning from thelowest 16 bits.
32-bit data multiplication[(S1+1, S1) ¢ (S2+1, S2)→ (D+3, D+2, D+1, D)]F31(D*)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 66
3.3 Explanation of High- level Instructions
DescriptionMultiplies 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 Result(S1+1, S1) (D+3, D+2, D+1, D)× (S2+1, S2)
Multiplier data
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 thelower 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 thelowest 16-bit area is specified.
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 67
3.3 Explanation of High- level Instructions
Outline Divides 16-bit data by the divisor.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F32 % , DT 100 , DT10 , DT 0R0
S1 DS2
Trigger 10
11
ST R 0
F 32 (% )
DT 100
DT 10
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleDivides the contents of data register DT100 by decimal constant DT10 when execution condition (trigger) R0turns on. The quotient is stored in data register DT0 and the remainder is stored in special data registerDT9015.When the decimal number 15 is in DT100 and the decimal number 4 is in DT10, as shown below.
· ·· ·Bit position · · · · ·DT100
150 0 0
120
110 0 0
80
70 0 0
40
31 1 1
01
Dividend [S1]: K15
· ·· ·Bit position · · · · ·DT10
150 0 0
120
110 0 0
80
70 0 0
40
30 1 0
00
Divisor [S2]: K4
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
30 0 1
01
Quotient [D]: K3 Remainder: K3
. . .· ·· ·Bit position · · · · ·
DT9015150 0 0
120
110 0 0
80
70 0 0
40
30 0 1
01
16-bit data division[S1/S2 → D… (DT9015)]F32 (%)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 68
3.3 Explanation of High- level Instructions
DescriptionThe 16-bit data or 16-bit equivalent constant specified by S1 is divided by the 16-bit data or 16-bit equivalentconstant specified by S2.The quotient is stored in D and the remainder is stored in the special data register DT9015.
Dividend data Quotient
(S1) (D)÷ (S2)
Divisor Remainder(DT9015). . . .
Precautions during programmingThe operation error occurs and the error flag (special internal relay R9007 or R9008) turns on when thedivisor (specified by S2) is “0”.
Flag conditionsS 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).
FP0 High- level Instructions
3 - 69
3.3 Explanation of High- level Instructions
Outline Divides 32-bit data by the divisor.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F33 D% , DT 200 , DT 100 , DT 0
S1 DS2
R0
Trigger 10
11
ST R 0
F 33 (D%)
DT 200
DT 100
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 inspecial data registers DT9016 and DT9015.)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A A N/A N/A N/A A
Explanation of example
Contents ofDT201
Contents ofDT100
Contents ofDT101
Higher 16 bits Lower 16 bits
Contents of DT200
← Quotient is stored in DT1 and DT0.
(Division)
To DT1 To DT0
← The lower 16 bits of the remainder is stored in DT9015 and the higher16 bits of the remainder is stored in DT9016.
To DT9016 To DT9015
÷
32-bit data division[(S1+1, S1)/(S2+1, S2)→ (D+1, D)…(DT9016, DT9015)]F33 (D%)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 70
3.3 Explanation of High- level Instructions
DescriptionThe 32-bit data or 32-bit equivalent constant specified by S1 is divided by the 32-bit data or 32-bit equivalentconstant specified by S2. The quotient is stored in D+1 and D and the remainder is stored in the special dataregisters DT9016 and DT9015.
Dividend data QuotientS1: lower 16-bitS1+1: higher 16-bit
D: lower 16-bitD+1: higher 16-bit
÷ S2: lower 16-bitS2+1: higher 16-bit
Divisor RemainderDT9015DT9016
When processing 32-bit data, the higher 16-bit areas (S1+1, S2+1, D+1) are automatically determined oncethe lower 16-bit areas (S1, S2, D) are specified.
Precautions during programmingThe operation error occurs and the error flag (special internal relay R9007 or R9008) turns on when thedivisor (specified by S2) is “0”.
Flag conditionsS 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).
FP0 High- level Instructions
3 - 71
3.3 Explanation of High- level Instructions
Outline Adds 1 to 16-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F35 +1 , DT 0
Trigger
R0
D
10
11
ST R 0
F 35 (+1)
DT 0
D 16-bit area to be increased by 1
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
Explanation of exampleAdds 1 to the contents of data register DT0 when execution condition (trigger) R0 turns on.
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
01
Original data [D]: K9
+1
· · ·Bit position · · · · ·DT0
15 1211 8 7 4 3 0Result [D]: K10
DescriptionAdds 1 to the 16-bit data specified by D. The result is stored in D.
Original data Result
(D) (D)+ 1
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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) isrecommended.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.For detailed information section 1.4.2
16-bit data increment[D + 1 → D]F35 (+1)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 72
3.3 Explanation of High- level Instructions
Flag conditionsS 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).
FP0 High- level Instructions
3 - 73
3.3 Explanation of High- level Instructions
Outline Adds 1 to 32-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F36 D+1 , DT 0
D
Trigger
R0
10
11
ST R 0
F 36 (D+1)
DT 0
D Lower 16-bit area of 32-bit data to be increased by 1
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleAdds 1 to the content of data registers DT1 and DT0 when execution condition (trigger) R0 turns on.
Contents ofDT1
Higher 16 bits Lower 16 bits
Contents ofDT0
+1
Store to DT1 Store to DT0
The specified data area and thefollowing data area are handledtogether as 32-bit data.
DescriptionAdds 1 to the 32-bit data specified by D. The result is stored in D+1 and D.
Original data Result
(D+1, D) (D+1, D)+ 1
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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
32-bit data increment[(D + 1, D) + 1 → (D + 1, D)]F36 (D+1)
Step Availability
FP0 C10, C14, C16,C32, T32, SL13
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 74
3.3 Explanation of High- level Instructions
Flag conditionsS 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).
FP0 High- level Instructions
3 - 75
3.3 Explanation of High- level Instructions
Outline Subtracts 1 from 16-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F37 -1 , DT 0R0
Trigger
D
10
11
ST R 0
F 37 (-1 )
DT 0
D 16-bit area to be decreased by 1
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
Explanation of exampleSubtracts 1 from the contents of data register DT0 when execution condition (trigger) R0 turns on.
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
31 0 1
00
Original data [D]: K10
-1
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
01
Result [D]: K9
DescriptionSubtracts 1 from the 16-bit data specified by D. The result is stored in D.
Original data Result
(D) (D)- 1
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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) isrecommended.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.For detailed information section 1.4.2
16-bit data decrement[D - 1 → D]F37 (-1)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 76
3.3 Explanation of High- level Instructions
Flag conditionsS 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).
FP0 High- level Instructions
3 - 77
3.3 Explanation of High- level Instructions
Outline Subtracts 1 from 32-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F38 D-1 , DT 0R0
D
Trigger10
11
ST R 0
F 38 (D-1)
DT 0
D Lower 16-bit area of 32-bit data to be decreased by 1
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleSubtracts 1 from the content of data registers DT1 and DT0 when execution condition (trigger) R0 turns on.
Higher 16 bits Lower 16 bits
-1
Contents ofDT1
Contents ofDT0
Store to DT1 Store to DT0
The specified data area and thefollowing data area are handledtogether as 32-bit data.
DescriptionSubtracts 1 from the 32-bit data specified by D. The result is stored in D+1 and D.
Original data Result
(D+1, D) (D+1, D)- 1
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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
32-bit data decrement[(D+1, D) - 1 → (D+1, D)]F38 (D-1)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 78
3.3 Explanation of High- level Instructions
Flag conditionsS 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).
FP0 High- level Instructions
3 - 79
3.3 Explanation of High- level Instructions
Outline Adds two BCD data items that express 4-digit decimal numbers (4-digitBCD H codes).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F40 B+, DT 0 , DT 2
S D
Trigger
R0
10
11
ST R 0
F 40 (B+ )
DT 0
DT 2
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleThe 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.
· ·· ·Bit position · · · · ·DT2
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
00
Augend [D]: H8 (BCD)
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
30 1 0
00
Addend [S]: H4 (BCD)
· ·· ·Bit position · · · · ·DT2
150 0 0
120
110 0 0
80
70 0 0
41
30 0 1
00
Result [D]: H12 (BCD)
+BCD H code 0 0 0 8
BCD H code 0 0 0 4
BCD H code 0 0 1 2
(Addition)
4-digit BCD data addition[D + S → D]
5
F40 (B+)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 80
3.3 Explanation of High- level Instructions
DescriptionThe 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data specified by S and the 16-bit area for4-digit BCD data specified by D are added together.
Augend data Result(D) (D)+ (S)
Addend data
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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) isrecommended.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.For detailed information section 1.4.2
Flag conditionsS 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).
FP0 High- level Instructions
3 - 81
3.3 Explanation of High- level Instructions
Outline Adds two BCD data items that express 8-digit decimal numbers (8-digitBCD H codes).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F41 DB+ , DT 0 , DT 2
S D
Trigger
R0
10
11
ST R 0
F 41 (DB+)
DT 0
DT 2
S 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (foraddend)
D Lower 16-bit area for 8-digit BCD data (for augend and result)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleThe contents of data registers DT3 and DT2 and the contents of data registers DT1 and DT0 are addedtogether when execution condition (trigger) R0 turns on.
Contents ofDT3
Contentsof DT0
Contentsof DT1
The specified data area and thefollowing data area are handledtogether as 32-bit data.
Higher 16 bits Lower 16 bits
Contents ofDT2
← The lower 16 bits of added result isstored in DT2 and the higher 16bits of the result is stored in DT3.
(Addition)
(Result is stored.)
Store to DT3 Store to DT2
8-digit BCD data Addition[(D+1, D) + (S+1, S) → (D+1, D)]
5
F41(DB+)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 82
3.3 Explanation of High- level Instructions
DescriptionThe 8-digit BCD equivalent constant or 8-digit BCD data specified by S and the 8-digit BCD data specified byD are added together.
Augend data ResultD: lower 4-digitD+1: higher 4-digit
+S: lower 4-digitS+1: higher 4-digit
D: lower 4-digitD+1: higher 4-digit
Addend data
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 conditionsS 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).
FP0 High- level Instructions
3 - 83
3.3 Explanation of High- level Instructions
Outline Adds two BCD data items that express 4-digit decimal numbers (4-digitBCD H codes) and stores the result in the specified area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F42 B+, DT 0 , DT 1 , DT100
S1 D
Trigger
S2
R0
10
11
ST R 0
F 42 (B+)
DT 0
DT 1
DT 100
S1 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data(for augend)
S2 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 result)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleThe 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.
7
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
00
Augend [S1]: H8 (BCD)
· ·· ·Bit position · · · · ·DT1
150 0 0
120
110 0 0
80
70 0 0
40
30 1 0
00
Addend [S2]: H4 (BCD)
· ·· ·Bit position · · · · ·DT100
150 0 0
120
110 0 0
80 0 0 0
41
30 0 1
00
Result [D]: H12 (BCD)
+BCD H code 0 0 0 8
BCD H code 0 0 0 4
BCD H code 0 0 1 2
(Addition)
4-digit BCD data Addition[S1 + S2 → D]F42 (B+)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 84
3.3 Explanation of High- level Instructions
DescriptionThe 4-digit BCD equivalent constants or 16-bit areas for 4-digit BCD data specified by S1 and S2 are addedtogether. The added result is stored in D.
Augend data Result(S1) (D)+ (S2)
Addend data
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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) isrecommended.
If an overflow occurs, the carry flag (special internal relay R9009) will turn on.For detailed information section 1.4.2
Flag conditionsS 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).
FP0 High- level Instructions
3 - 85
3.3 Explanation of High- level Instructions
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
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F43 DB+ , DT 0 , DT 2 , DT100
S1 S2 D
Trigger
R0
10
11
ST R 0
F 43 (DB+)
DT 0
DT 2
DT 100
S1 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (foraugend)
S2 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (foraddend)
D Lower 16-bit area for 8-digit BCD data (for result)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleThe contents of data registers DT1 and DT0 and the contents of data registers DT3 and DT2 are addedtogether when execution condition (trigger) R0 turns on. The added result is stored in data registers DT101and DT100.
Contents ofDT1
Contents ofDT2
Contents ofDT3
The specified data area and thefollowing data area are handledtogether as 32-bit data.
Higher 16 bits Lower 16 bits
Contents ofDT0
← The lower 16 bits of added result isstored in DT100 and the higher 16 bitsof the result is stored in DT101.
(Addition)
(Result is stored.)
Store to DT101 Store to DT100
8-digit BCD data Addition[(S1+1, S1) + (S2+1, S2) →(D+1, D)]F43 (DB+)
Step AvailabilityFP0 C10, C14, C16,
C32, T32, SL111
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 86
3.3 Explanation of High- level Instructions
DescriptionThe 8-digit BCD equivalent constants or 8-digit BCD data specified by S1 and S2 are added together. Theadded result is stored in D+1 and D.
Augend data ResultS1: lower 4-digitS1+1: higher 4-digit
+ S2: lower 4-digitS2+1: higher 4-digit
D: lower 4-digitD+1: higher 4-digit
Addend data
When processing 8-digit BCD data, the higher 16-bit areas for 8-digit BCD data (S+1, D+1) are automaticallydetermined once the lower 16-bit areas (S, D) are specified.
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 conditionsS 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).
FP0 High- level Instructions
3 - 87
3.3 Explanation of High- level Instructions
Outline Subtracts one BCD data item that expresses a 4-digit decimal number(4-digit BCD H codes) from another (minuend).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F45 B- , DT 0 , DT 2
S D
Trigger
R0
10
11
ST R 0
F 45 (B-)
DT 0
DT 2
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleSubtracts 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.
· ·· ·Bit position · · · · ·DT2
150 0 0
120
110 0 0
80
70 0 0
41
30 1 1
00
Minuend [D]: H16 (BCD)
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
30 1 0
00
Subtrahend [S]: H4 (BCD)
· ·· ·Bit position · · · · ·DT2
150 0 0
120
110 0 0
80
70 0 0
41
30 0 1
00
Result [D]: H12 (BCD)
BCD H code 0 0 1 6
BCD H code 0 0 0 4
BCD H code 0 0 1 2
- (Subtraction)
DescriptionSubtracts the 4-digitBCDequivalent constantor16-bitarea for4-digitBCDdataspecifiedby Sfromthe16-bitarea for 4-digit BCD data specified by D.
Minuend data Result(D) (D)- (S)
Subtrahend data
4-digit BCD data Subtraction[D - S → D]F45 (B-)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 88
3.3 Explanation of High- level Instructions
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 datasubtraction) is recommended.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.For detailed information section 1.4.2
Flag conditionsS 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).
FP0 High- level Instructions
3 - 89
3.3 Explanation of High- level Instructions
Outline Subtracts one BCD data item that expresses an 8-digit decimal number(8-digit BCD H code) from another (minuend).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F46 DB- , DT 0 , DT 2
S D
Trigger
R0
10
11
ST R 0
F 46 (DB-)
DT 0
DT 2
S 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (forsubtrahend)
D Lower 16-bit area for 8-digit BCD data (for minuend and result)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleSubtracts the contents of data registers DT1 and DT0 from the contents of data registers DT3 and DT2 whenexecution condition (trigger) R0 turns on.
Contents ofDT3
Contents ofDT0
Contents ofDT1
The specified data area and thefollowing data area are handledtogether as 32-bit data.
Higher 16 bits Lower 16 bits
Contents ofDT2
← The lower 16 bits of subtracted resultis stored in DT2 and the higher 16 bitsof the result is stored in DT3.
(Subtraction)
(Result is stored.)
Store to DT3 Store to DT2
8-digit BCD data Subtraction[(D+1, D) - (S+1, S) → (D+1, D)]F46(DB-)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 90
3.3 Explanation of High- level Instructions
DescriptionSubtracts the 8-digit BCD equivalent constant or 8-digit BCD data specified by S from the 8-digit BCD dataspecified by D.
Augend data ResultD: lower 4-digitD+1: higher 4-digit -
S: lower 4-digitS+1: higher 4-digit
D: lower 4-digitD+1: higher 4-digit
Addend data
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 conditionsS 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).
FP0 High- level Instructions
3 - 91
3.3 Explanation of High- level Instructions
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 inthe specified area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F47 B- , DT 0 , DT 2 , DT100
S1 D
Trigger
S2
R0
10
11
ST R 0
F 47 (B-)
DT 0
DT 2
DT 100
S1 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data (for minuend)
S2 4-digit BCDequivalent constant or 16-bit area for4-digit BCDdata (for subtrahend)
D 16-bit area for 4-digit BCD data (for result)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleSubtracts 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.
7
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
41
30 1 1
00
Minuend [S1]: H16 (BCD)
· ·· ·Bit position · · · · ·DT2
150 0 0
120
110 0 0
80
70 0 0
40
30 1 0
00
Subtrahend [S2]: H4 (BCD)
· ·· ·Bit position · · · · ·DT100
150 0 0
120
110 0 0
80 0 0 0
41
30 0 1
00
Result [D]: H12 (BCD)
BCD H code 0 0 1 6
BCD H code 0 0 0 4
BCD H code 0 0 1 2
- (Subtraction)
4-digit BCD data Subtraction[S1 - S2 → D]
5
F47 (B-)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 92
3.3 Explanation of High- level Instructions
DescriptionSubtracts the 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data specified by S2 from the4-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 Result(S1) (D)- (S2)
Subtrahend data
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 datasubtraction) is recommended.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.For detailed information section 1.4.2
Flag conditionsS 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).
FP0 High- level Instructions
3 - 93
3.3 Explanation of High- level Instructions
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 inthe specified area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F48 DB- , DT 0 , DT 2 , DT100
S1 S2 D
Trigger
R0
10
11
ST R 0
F 48 (DB-)
DT 0
DT 2
DT 100
S1 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (forminuend)
S2 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (forsubtrahend)
D Lower 16-bit area for 8-digit BCD data (for result)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleSubtracts the contents of data registers DT3 and DT2 from the contents of data registers DT1 and DT0 whenexecution condition (trigger) R0 turns on. The subtracted result is stored in data registers DT101 and DT100.
Contents ofDT1
Contents ofDT2
Contents ofDT3
Higher 16 bits Lower 16 bits
Contents ofDT0
(Subtraction)
(Result is stored.)
Store toDT101
Store to DT100
The specified data area and thefollowing data area are handledtogether as 32-bit data.
← The lower 16 bits of subtracted resultis stored in DT100 and the higher 16bits of the result is stored in DT101.
8-digit BCD data Subtraction[(S1+1, S1) - (S2+1, S2) →(D+1, D)]
5
F48(DB-)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 94
3.3 Explanation of High- level Instructions
DescriptionSubtracts the 8-digit BCD equivalent constant or 8-digit BCD data specified by S2 from the 8-digit BCDequivalent constant or the 8-digit BCD data specified by S1. The subtracted result is stored in D+1 and D.
Minuend data ResultS1: lower 4-digitS1+1: higher 4-digit -
S2: lower 4-digitS2+1: higher 4-digit
D: lower 4-digitD+1: higher 4-digit
Subtrahend data
When processing 8-digit BCD data, the higher 16-bit areas for 8-digit BCD data (S+1, D+1) are automaticallydetermined once the lower 16-bit areas (S, D) are specified.
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 conditionsS 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).
FP0 High- level Instructions
3 - 95
3.3 Explanation of High- level Instructions
Outline Multiplies two BCD data items that express 4-digit decimal numbers(4-digit BCD H codes).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F50 B*, DT 0 , DT 2, DT 100
S1 D
Trigger
S2
R0
10
11
ST R 0
F 50 (B*)
DT 0
DT 2
DT 100
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleWhen H (BCD) 8 is in DT0 and H (BCD) 2 is in DT2, as shown below.
BCD H code
· · ·Bit position · · · · ·
DT100
150 0 0
120
110 0 0
80
70 0 0
41
30 1 1
00
0 0 1 6
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
R0: on
BCD H code
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
00
0 0 0 8
BCD H code
· · ·Bit position · · · · ·DT2
15 1211 8 7 4 3 0
0 0 0 2
BCD H code
· · ·Bit position · · · · ·DT101
150 0 0
120
110 0 0
80
70 0 0
40
30 0 0
00
0 0 0 0
Higher 4-digit area Lower 4-digit area
Result [D+1, D]: H16 (BCD)
Multiplicand [S1]: H8 (BCD)
Multiplier [S2]: H2 (BCD)
The lower 16 bits of the 32-bit multiplication result are stored in the specified memory area (DT100), and thehigher16 bits are stored in the area following the specified area (DT101).
4-digit BCD data Multiplication[S1 × S2 → (D+1, D)]F50(B*)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 96
3.3 Explanation of High- level Instructions
DescriptionMultiplies the 4-digit BCD equivalent constant or 16-bit area for 4-digit BCD data specified by S1 and S2. Themultiplied result is stored in D+1 and D.
×Multiplicanddata
(S1)Multiplier data
(S2)Multiplied result
(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 conditionsS 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”.
FP0 High- level Instructions
3 - 97
3.3 Explanation of High- level Instructions
Outline Multiplies two BCD data items that express 8-digit decimal numbers(8-digit BCD H codes).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F51 DB* , DT 0 , DT 2 , DT 100
S1 D
Trigger
S2
R0
10
11
ST R 0
F 51 (DB*)
DT 0
DT 2
DT 100
S1 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (formultiplicand)
S2 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (formultiplier)
D Lowest 16-bit area for 16-digit BCD data (for result)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of example
Contents ofDT1
Contents ofDT2
Contents ofDT3
16 bits 16 bits
Contents ofDT0
Store toDT101
Store toDT100
16 bits 16 bits
16 bits 16 bits
Store toDT103
Store toDT102
16 bits 16 bits
The specified data area and the following dataarea are handled together as 32-bit data.
← The 64 bits of multiplication result are stored inorder in DT100 to DT103 beginning from thelowest 16 bits.
8-digit BCD data Multiplication[(S1+1, S1) ¢ (S2+1, S2)→ (D+3, D+2, D+1, D)]F51(DB*)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 98
3.3 Explanation of High- level Instructions
DescriptionMultiplies the 8-digit BCD equivalent constant or 8-digit BCD data specified by S1 and the one specified byS2. The multiplied result is stored in D+3, D+2, D+1, and D.
Multiplicand data Result(S1+1, S1) (D+3, D+2, D+1, D)× (S2+1, S2)
Multiplier data
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 oncethe 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 conditionsS 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”.
FP0 High- level Instructions
3 - 99
3.3 Explanation of High- level Instructions
Outline Divides one BCD data item that expresses a 4-digit decimal number(4-digit BCD H code) by another (divisor).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F52 B% , DT 0 , DT 2 , DT 100
S1 D
Trigger
S2
R0
10
11
ST R 0
F 52 (B%)
DT 0
DT 2
DT 100
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
4-digit BCD data Division[S1/S2 → D… (DT9015)]F52 (B%)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 100
3.3 Explanation of High- level Instructions
Explanation of exampleDivides 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 dataregister DT9015.When H (BCD) 15 is in DT0 and H (BCD) 4 is in DT2, as shown below.Dividiend [S1]: H15 (BCD)
R0: on
Remainder: H3 (BCD)
BCD H code
· ·· ·Bit position · · · · ·
DT0
15
0 0 0
12
0
11
0 0 0
8
0
7
0 0 0
4
1
3
0 1 0
0
1
0 0 1 5
BCD H code
· ·· ·Bit position · · · · ·
DT2
15
0 0 0
12
0
11
0 0 0
8
0
7
0 0 0
4
0
3
0 1 0
0
0
0 0 0 4
BCD H code
· ·· ·Bit position · · · · ·15
0 0 0
12
0
11
0 0 0
8
0
7
0 0 0
4
0
3
0 0 1
0
1
0 0 0 3
BCD H code
· ·· ·Bit position · · · · ·
DT100
15
0 0 0
12
0
11
0 0 0
8
0
7
0 0 0
4
0
3
0 0 1
0
1
0 0 0 3
Divisor [S2]: H4 (BCD)
Quotient [D]: H3 (BCD)
DT9015
DescriptionThe 4-digit BCD equivalent constant or the 16-bit area for 4-digit BCD data specified by S1 is divided by the4-digit BCD equivalent constant or the 16-bit area for 4-digit BCD data specified by S2. The quotient is storedin the area specified by D and the remainder is stored in a special data register DT9015.
Dividend data Quotient(S1) (D)÷ (S2)
Divisor Remainder(DT9015)....
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 101
3.3 Explanation of High- level Instructions
Outline Divides one BCD data item that expresses an 8-digit decimal number(8-digit BCD H code) by another (divisor).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F53 DB% , DT 0 , DT 2 , DT100
S1 D
Trigger
S2
R0
10
11
ST R 0
F 53 (DB%)
DT 0
DT 2
DT 100
S1 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (fordividend)
S2 8-digit BCD equivalent constant or lower 16-bit area for 8-digit BCD data (fordivisor)
D Lower 16-bit area for 8-digit BCD data (for quotient)(Remainder is stored in special data registers DT9016 and DT9015)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A A N/A N/A N/A A
8-digit BCD data Division[(S1+1, S1)/(S2+1, S2) →(D+1, D)… (DT9016, DT9015)]F53(DB%)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 102
3.3 Explanation of High- level Instructions
Explanation of example
Contents ofDT1
Contents ofDT2
Contents ofDT3
Higher 16 bits Lower 16 bits
Contents of DT0
← Quotient is stored in DT101 and DT100.
÷(Division)
To DT101 To DT100
← The lower 16 bits of the remainder is stored in DT9015 and the higher16 bits of the remainder is stored in DT9016.
To DT9016 To DT9015
DescriptionThe 8-digit BCD equivalent constant or the 8-digit BCD data specified by S1 is divided by the 8-digit BCDequivalent constant or the 8-digit BCD data specified by S2. The quotient is stored in the areas specified byD+1 and D, and the remainder is stored in special data registers DT9016 and DT9015.
Dividend data QuotientS1: lower 4-digitS1+1: higher 4-digit
D: lower 4-digitD+1: higher 4-digit÷
S2: lower 4-digitS2+1: higher 4-digit
Divisor RemainderDT9015DT9016
....
When processing 8-digit BCD data, the higher 16-bit areas (S1+1, S2+1, D+1) are automatically determinedonce the lower 16-bit areas (S1, S2, D) are specified.
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 103
3.3 Explanation of High- level Instructions
Outline Adds 1 to BCD data that expresses a 4-digit decimal number (4-digitBCD H code).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F55 B+1 , DT 0
D
Trigger
R0
10
11
ST R 0
F 55 (B+1)
DT 0
D 16-bit area for 4-digit BCD data to be increased by 1
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
Explanation of exampleAdds 1 to the contents of data register DT0 when execution condition (trigger) R0 turns on.
Original data [D]: H9 (BCD)
+1
Result [D]: H10 (BCD)
BCD H code
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
01
0 0 0 9
BCD H code
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
41
30 0 0
00
0 0 1 0
DescriptionAdds 1 to the 4-digit BCD data specified by D. The result is stored in D.
Original data Result
(D) (D)+ 1
4-digit BCD data increment[D + 1 → D]F55(B+1)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 104
3.3 Explanation of High- level Instructions
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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-digitBCD 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 conditionsS 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).
FP0 High- level Instructions
3 - 105
3.3 Explanation of High- level Instructions
Outline Adds 1 to BCD data that expresses an 8-digit decimal number (8-digitBCD H code).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F56 DB+1 , DT 0
D
Trigger
R0
10
11
ST R 0
F 56 (DB+1)
DT 0
D Lower 16-bit area for 8-digit BCD data to be increased by 1
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleAdds 1 to the contents (8-digit BCD data) of data registers DT1 and DT0 when execution condition (trigger)R0 turns on.
Contents ofDT1
Higher 16 bits Lower 16 bits
Contents ofDT0
+1
Store to DT1 Store to DT0
The specified data area and thefollowing data area are handledtogether as 32-bit data.
DescriptionAdds 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) (D+1, D)+ 1
8-digit BCD data increment[(D+1, D) + 1 → (D+1, D)]F56(DB+1)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 106
3.3 Explanation of High- level Instructions
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 conditionsS 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).
FP0 High- level Instructions
3 - 107
3.3 Explanation of High- level Instructions
Outline Subtracts 1 from BCD data that expresses a 4-digit decimal number(4-digit BCD H code).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F57 B-1 , DT 0
D
Trigger
R0
10
11
ST R 0
F 57 (B-1)
DT 0
D 16-bit area for BCD data to be decreased by 1
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
Explanation of exampleSubtracts 1 from the contents of data register DT0 when execution condition (trigger) R0 turns on.
Original data [D]: H10 (BCD)
-1
Result [D]: H9 (BCD)
BCD H code
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
41
30 0 0
00
0 0 1 0
BCD H code
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
01
0 0 0 9
DescriptionSubtracts 1 from the 4-digit BCD data specified by D. The result is stored in D.
Original data Result
(D) (D)- 1
4-digit BCD data decrement[D - 1 → D]F57(B-1)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 108
3.3 Explanation of High- level Instructions
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, an underflow will result.
Under normal circumstances, do not allow an underflow to occur.
If thecalculatedresultaccidentallyunderflow,useof the F58(DB-1) instruction (8-digitBCDdatadecrement)is recommended.
If an underflow occurs, the carry flag (special internal relay R9009) will turn on.For detailed information section 1.4.2
Flag conditionsS 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).
FP0 High- level Instructions
3 - 109
3.3 Explanation of High- level Instructions
Outline Subtracts 1 from BCD data that expresses an 8-digit decimal number(8-digit BCD H code).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F58 DB-1 , DT 0
D
Trigger
R0
10
11
ST R 0
F 58 (DB-1)
DT 0
D Lower 16-bit area for 8-digit BCD data to be decreased by 1
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleSubtracts 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
-1
Contents ofDT1
Contents ofDT0
Store to DT1 Store to DT0
The specified data area and thefollowing data area are handledtogether as 32-bit data.
DescriptionSubtracts 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) (D+1, D)- 1
8-digit BCD data decrement[(D+1, D) - 1 → (D+1, D)]F58(DB-1)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 110
3.3 Explanation of High- level Instructions
Precautions during programmingIf the result of an arithmetic operation instruction does not fall within the range of values which can behandled, 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 conditionsS 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).
FP0 High- level Instructions
3 - 111
3.3 Explanation of High- level Instructions
Outline The two specified 16-bit data are compared and the result is output tothe special internal relay.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
40 F60 CMP , DT 0 , K 100
46
49
52
R900A
R900B
R900C
TriggerS1 S2
Y0
Y1
Y2
R0
R0
R0
R0
40
41
46
47
48
49
50
51
52
53
54
ST R 0
F 60 (CMP)
DT 0
K 100
ST R 0
AN R 900A
OT Y 0
ST R 0
AN R 900B
OT Y 1
ST R 0
AN R 900C
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
Explanation of exampleCompares 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.
16-bit data compareF60 (CMP)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: Available
FP0High- level Instructions
3 - 112
3.3 Explanation of High- level Instructions
DescriptionCompares the 16-bit data specified by S1 with that specified by S2. The comparison result is output to thespecial 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.
Comparison betweenFlag
Comparison betweenS1 and S2 R900A
(> flag)R900B(= flag)
R900C(< flag)
R9009(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 executionconditions (trigger).
R9010 can be eliminated in this case.
Y0
Y1
Y2
R9010
R9010
R9010
R9010
F60 CMP, DT 0, K 100R900A
R900B
R900C
Always on relay.
You can also program the above using the PSHS, RDS, and POPS instructions.
RDS
Y0
POPS
Y1
Y2
R0
F60 CMP, DT 0, K 100R900A
R900B
R900C
PSHS
This is a program in which operation is the same as the program example on page 3-111.
FP0 High- level Instructions
3 - 113
3.3 Explanation of High- level Instructions
Precautions when using two or more comparison instructionsThe comparison instruction flags R900A to R900C are updated with each execution of the comparisoninstruction.
If you use two or more comparison instructions in your program, be sure to use the flags immediately aftereach comparison instruction, by employing output relays or internal relays.
Example: Compares DT0 with K100, and DT1 with K200.
4
Y0
Y1
Y2
R0
R0
R0
R0
F60 CMP, DT 0, K 100R900A
R900B
R900C
Y3
Y4
Y5
R1
R1
R1
R1
F60 CMP, DT 1, K 200R900A
R900B
R900C
1
2
3
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 dataWhen comparing special data, such as BCD or unsigned binary (0 to FFFF), construct your program asshown in the program example below, using special internal relays R900B and R9009.
Example: Compares BCD data in DT0 and DT1.
R2
R3
R4
R1
R1
R1
R1
F60 CMP, DT 0, DT 1R9009
R900B
R9009R900B
1 ....When DT0 < DT1,internal relay R2 turns on
2 ....When DT0 = DT1,internal relay R3 turns on
3 ....When DT0 > DT1,internal relay R4 turns on
FP0High- level Instructions
3 - 114
3.3 Explanation of High- level Instructions
Flag operation when comparing BCD data or unsigned 16-bit data (0 to FFFF)
Comparison betweenFlag
Comparison betweenS1 and S2 R900A
(> flag)R900B(= flag)
R900C(< flag)
R9009(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 00 0 0 0 0 0 0 0
BCD 8 0 00
S2 0 0 0 0 0 0 0 01 0 0 0 0 0 0 0
BCD 1 0 00
Flag conditionsS 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.
FP0 High- level Instructions
3 - 115
3.3 Explanation of High- level Instructions
Outline The two specified 32-bit data are compared and the result is output tothe special internal relay.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
50 F61 DCMP , DT 0 , DT 100
56
59
62
R900A
R900B
R900C
TriggerS1 S2
Y0
Y1
Y2
R0
R0
R0
R0
50
51
56
57
58
59
60
61
62
63
64
ST R 0
F 61(DCMP)
DT 0
DT 100
ST R 0
AN R 900A
OT Y 0
ST R 0
AN R 900B
OT Y 1
ST R 0
AN R 900C
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
Explanation of exampleCompares the content (32-bit data) of data registers DT101 and DT100 with the content (32-bit data) of dataregisters 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.
32-bit data compareF61(DCMP)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
9
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 116
3.3 Explanation of High- level Instructions
DescriptionCompares the 32-bit data or 32-bit equivalent constant specified by S1 with that specified by S2. Thecomparison 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).
Comparison betweenFlag
Comparison between(S1+1, S1) and (S2+1, S2) R900A
(> flag)R900B(= flag)
R900C(< flag)
R9009(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 thelower 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 executionconditions.
R9010 can be eliminated in this case.
Y0
Y1
Y2
R9010
R9010
R9010
R9010
F61 CMP, DT 0, K100R900A
R900B
R900C
Always on relay.You can also program the above using the PSHS, RDS, and POPS instructions.
RDS
Y0
POPS
Y1
Y2
R0
F61 DCMP, DT 0, DT100R900A
R900B
R900C
PSHS
This is a program in which operation is the same as the program example on page 3 - 115.
FP0 High- level Instructions
3 - 117
3.3 Explanation of High- level Instructions
Precautions when using two or more comparison instructionsThe comparison instruction flags R900A to R900C are updated with each execution of the comparisoninstruction.
If you use two or more comparison instructions in your program, be sure to use the flags immediately aftereach comparison instruction, by employing output relays or internal relays.
Example: Compares DT1 and DT0 with DT101 and DT100, and DT3 and DT2with DT201 and DT200.
Y1
Y2
R0
R0
R0
R0
F61 DCMP, DT 0, DT 100R900A
R900B
R900C
Y4
Y5
R1
R1
R1
R1
F61 DCMP, DT 2, DT 200R900A
R900B
R900C
1
2
3
4
Y3
Y0
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 dataWhen 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 theprogram example below, using special internal relays R900B and R9009.
Example: Compares BCD data in (DT1, DT0) and (DT3, DT2).
1 ....When (DT1, DT0) < (DT3, DT2),internal relay R2 turns on
2 ....When (DT1, DT0) = (DT3, DT2),internal relay R3 turns on
3 ....When (DT1, DT0) > (DT3, DT2),internal relay R4 turns on
R2
R3
R4
R1
R1
R1
R1
F61 DCMP, DT 0, DT 2R9009
R900B
R9009R900B
FP0High- level Instructions
3 - 118
3.3 Explanation of High- level Instructions
Flag operation when comparing BCD data or unsigned 32-bit data (0 to FFFFFFFF)
Comparison betweenFlag
Comparison between(S1+1, S1) and (S2+1, S2) R900A
(> flag)R900B(= flag)
R900C(< flag)
R9009(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 aprogram which uses R900A and R900C, the correct comparison result will not be obtained.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 119
3.3 Explanation of High- level Instructions
Outline Compares one 16-bit data item with the data band specified by twoother 16-bit data items and the comparison result is output to thespecial internal relay.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
50 F62 WIN , DT 0 , DT 2 , DT 3
Trigger
58
61
64
R900A
R900B
R900C
S1
Y0
Y1
Y2
R0
R0
R0
R0
S2 S3
Lower limit valueUpper limit value
50
51
58
59
60
61
62
63
64
65
66
ST R 0
F 62 (WIN)
DT 0
DT 2
DT 3
ST R 0
AN R 900A
OT Y 0
ST R 0
AN R 900B
OT Y 1
ST R 0
AN R 900C
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
16-bit data band compareF62 (WIN)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: Available
FP0High- level Instructions
3 - 120
3.3 Explanation of High- level Instructions
Explanation of exampleCompares the contents of data register DT0 with the contents of data register DT2 (lower limit of the databand) 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
R900B : on
R900C : on
+500
-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.
DescriptionCompares the 16-bit equivalent constant or 16-bit data specified by S1 with the data band specified by S2and 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.
Comparison betweenFlag
Comparison betweenS1, S2 and S3 R900A
(> flag)R900B(= flag)
R900C(< flag)
R9009(carry flag)
S1 < S2 off off on ———
S2≦S1≦S3 off on off ———
S3 < S1 on off off ———
Precautions during programmingSet it so that the value of the lower limit is less than the value of the upper limit (S2 ≦ S3).
Flag conditionsS 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.
FP0 High- level Instructions
3 - 121
3.3 Explanation of High- level Instructions
Outline Compares one 32-bit data item with the data band specified by twoother 32-bit data items and the comparison result is output to thespecial internal relay.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
50 F63 DWIN , DT 0 , DT 2 , DT 4
Trigger
64
67
70
R900A
R900B
R900C
S1
Y0
Y1
Y2
R0
R0
R0
R0
S2 S3
Lower limit valueUpper limit value
50
51
64
65
66
67
68
69
70
71
72
ST R 0
F 63 (DWIN)
DT 0
DT 2
DT 4
ST R 0
AN R 900A
OT Y 0
ST R 0
AN R 900B
OT Y 1
ST R 0
AN R 900C
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
S3 A A A A A A A N/A A A A
32-bit data band compareF63 (DWIN)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
13
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 122
3.3 Explanation of High- level Instructions
Explanation of exampleCompares the contentsof data registersDT1and DT0with the contentsof data registers DT3and DT2(lowerlimit of the data band) and data registers DT5 and DT4 (upper limit of the data band), when executioncondition (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
R900B : on
R900C : on
+50000
-50000
When (DT1, DT0) is K-68000, R900C turns on and external output relayY2 goes on.When (DT1, DT0) is K-50000, R900B turns on and external output relayY1 goes on.When (DT1, DT0) is K25600, R900B turns on and external output relayY1 goes on.When (DT1, DT0) is K68000, R900A turns on and external output relayY0 goes on.
DescriptionCompares the 32-bit equivalent constant or 32-bit data specified by S1 with the data band specified by S2and 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 FlagComparison between(S1+1, S1), (S2+1, S2)and (S3+1, S3)
R900A(> flag)
R900B(= flag)
R900C(< flag)
R9009(carry flag)
(S1+1, S1) < (S2+1, S2) off off on ———
(S2+1, S2)≦(S1+1, S1)≦(S3+1, S3) off on off ———
(S3+1, S3) < (S1+1, S1) on off off ———
Precautions during programmingSet 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 conditionsS 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).
FP0 High- level Instructions
3 - 123
3.3 Explanation of High- level Instructions
Outline Compares one specified data block with another in byte units.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F64 BCMP , DT 0 , DT 10 , DT 20
Trigger
18R900B
S1
R1
R0
R0
S2 S310
11
18
19
20
ST R 0
F 64 (BCMP)
DT 0
DT 10
DT 20
ST R 0
AN R 900B
OT R 1
S1 16-bit equivalent constant or 16-bit area (specifies starting byte positions andnumber of bytes to be compared)
S2 Starting 16-bit area to be compared
S3 Starting 16-bit area to be compared
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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 N/A N/A N/A N/A A
Block data compareF64 (BCMP)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 124
3.3 Explanation of High- level Instructions
Explanation of exampleCompares 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 whenexecution condition (trigger) R0 turns on. When the contents of the two data blocks are the same, internalrelay R1 turns on.
If H1004 is entered in DT0, the two blocks are as follows.
·
2 1
4 3
13 2
4
DT20
DT21
DT22
Comparation
DT10
DT11Data blockspecified byS2
Data blockspecified byS3
Higherbyte
Lowerbyte
Area compared
DescriptionCompares the contents of the data block specified by S2 with the contents of the data block specified by S3according 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 asfollows:
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 bytesbeginning with the upper byte of the data block specified by S3, set S1 to H1004.
FP0 High- level Instructions
3 - 125
3.3 Explanation of High- level Instructions
Flag conditionsS 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 programmingThe 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.
F64 BCMP, DT 0, DT 1, WR 5R0
Y0R0 R900B
Result of F64
F60 CMP, DT 2, K 100R1
R2R1 R900B
Result of F60
NoteAs shown in the above program, be sure to have the trigger (R0or R1) before flag R900B. However, if you are using R9010 (on allthe time), then it is unnecessary to have the trigger beforeR900B.
FP0High- level Instructions
3 - 126
3.3 Explanation of High- level Instructions
Outline Performs bit-wise AND operation on two 16-bit data items.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F65 WAN , DT 0 , DT 2 , DT 1
S1 D
Trigger
S2
R0
10
11
ST R 0
F 65 (WAN)
DT 0
DT 2
DT 1
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of examplePerforms 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.
[S1]
[S2]
[D]
· ·· ·Bit position · · · · ·
DT0
15
0 1 0
12
0
11
1 1 0
8
1
7
1 0 1
4
1
3
1 0 0
0
1
R0: on
· ·· ·Bit position · · · · ·
DT2
15
0 0 0
12
0
11
0 0 0
8
0
7
1 1 1
4
1
3
1 1 1
0
1
· ·· ·Bit position · · · · ·
DT1
15
0 0 0
12
0
11
0 0 0
8
0
7
1 0 1
4
1
3
1 0 0
0
1
16-bit data ANDF65 (WAN)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 127
3.3 Explanation of High- level Instructions
DescriptionPerforms 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 operationThe AND operation is shown below.
S1 S2 D
0 0 0
0 1 0
1 0 0
1 1 1
Flag conditionsS 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”.
FP0High- level Instructions
3 - 128
3.3 Explanation of High- level Instructions
Outline Performs bit-wise OR operation on two 16-bit data items.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F66 WOR , DT 0 , DT 2 , DT 1
S1 D
Trigger
S2
R0
10
11
ST R 0
F 66 (WOR)
DT 0
DT 2
DT 1
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of examplePerforms ORoperationon eachbit in data registersDT0and DT2when executioncondition (trigger) R0 turnson.The OR operation result is stored in data register DT1.
[S1]
[S2]
[D]
· ·· ·Bit position · · · · ·
DT0
15
0 1 0
12
0
11
1 1 0
8
1
7
1 0 1
4
1
3
1 0 0
0
1
R0: on
· ·· ·Bit position · · · · ·
DT2
15
0 0 0
12
0
11
0 0 0
8
0
7
1 1 1
4
1
3
1 1 1
0
1
· ·· ·Bit position · · · · ·
DT1
15
0 1 0
12
0
11
1 1 0
8
1
7
1 1 1
4
1
3
1 1 1
0
1
16-bit data ORF66 (WOR)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 129
3.3 Explanation of High- level Instructions
DescriptionPerforms 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 operationThe OR operation is shown below.
S1 S2 D
0 0 0
0 1 1
1 0 1
1 1 1
Flag conditionsS 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”.
FP0High- level Instructions
3 - 130
3.3 Explanation of High- level Instructions
Outline Performs bit-wise exclusive OR operation on two 16-bit data items.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F67 XOR , DT 0 , DT 2 , DT 1
S1 D
Trigger
S2
R0
10
11
ST R 0
F 67 (XOR)
DT 0
DT 2
DT 1
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of examplePerforms 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.
[S1]
[S2]
[D]
· ·· ·Bit position · · · · ·
DT0
15
0 1 0
12
0
11
1 1 0
8
1
7
1 0 1
4
1
3
1 0 0
0
1
R0: on
· ·· ·Bit position · · · · ·
DT2
15
0 0 0
12
0
11
0 0 0
8
0
7
1 1 1
4
1
3
1 1 1
0
1
· ·· ·Bit position · · · · ·
DT1
15
0 1 0
12
0
11
1 1 0
8
1
7
0 1 0
4
0
3
0 1 1
0
0
16-bit data exclusive ORF67 (XOR)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 131
3.3 Explanation of High- level Instructions
DescriptionPerforms exclusive OR operation on each bit in the 16-bit equivalent constant or 16-bit data specified by S1and 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 operationThe exclusive OR operation is shown below.
S1 S2 D
0 0 0
0 1 1
1 0 1
1 1 0
Flag conditionsS 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”.
FP0High- level Instructions
3 - 132
3.3 Explanation of High- level Instructions
Outline Performs bit-wise exclusive NOR operation on two 16-bit data items.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F68 XNR , DT 0 , DT 2 , DT 1
S1 D
Trigger
S2
R0
10
11
ST R 0
F 68 (XNR)
DT 0
DT 2
DT 1
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleWhen the execution condition (trigger) R0 is on, if the values of the bits for the same positions with regard tothe contents of data registers DT0 and DT2 are equal, the bit for that position is turned on (1) for data registerDT1. If the values are not equal, the bit is turned off (0).
[S1]
[S2]
[D]
· ·· ·Bit position · · · · ·
DT0
15
0 1 0
12
0
11
1 1 0
8
1
7
1 0 1
4
1
3
1 0 0
0
1
R0: on
· ·· ·Bit position · · · · ·
DT2
15
0 0 0
12
0
11
0 0 0
8
0
7
1 1 1
4
1
3
1 1 1
0
1
· ·· ·Bit position · · · · ·
DT1
15
1 0 1
12
1
11
0 0 1
8
0
7
1 0 1
4
1
3
1 0 0
0
1
16-bit data exclusive NORF68 (XNR)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 133
3.3 Explanation of High- level Instructions
DescriptionPerforms exclusive NORoperation on each bit in the 16-bit equivalent constant or 16-bit data specified by S1and 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 operationThe exclusive NOR operation is shown below.
0 0
S1 S2 D
0 0 1
0 1 0
1
1 1 1
Flag conditionsS 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”.
FP0High- level Instructions
3 - 134
3.3 Explanation of High- level Instructions
Outline Calculates Block Check Code (BCC).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F70 BCC , K 2 , DT 0 , K 12 , DT 6
S1 S3
Trigger
S2
R0
D
10
11
ST R 0
F 70 (BCC)
K 2
DT 0
K 12
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 BCCcalculation)
D 16-bit area for storing BCC
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleCalculates the Block Check Code (BCC) of 12 bytes of ASCII data starting from data register DT0, via anexclusive OR operation, when execution condition (trigger) R0 turns on. The Block Check Code (BCC) isstored in the lower byte of data register DT6.
Block check code calculationF70 (BCC)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
9
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 135
3.3 Explanation of High- level Instructions
DescriptionCalculates the Block Check Code (BCC) of S3 bytes of ASCII data starting from the 16-bit area specified byS2, according to the calculation method specified by S1. The Block Check Code (BCC) is stored in the lowerbyte 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 methodK0: Addition
K1: Subtraction
K2: Exclusive OR operation
S2 and S3: Specifying the target dataFor instance, if 12 bytes of data from DT0 are to be targeted, the following applies:S2: DT0S3: K12 (specified as a decimal number)
Flag conditionsS 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 exampleIn this example, the block check code of the message being sent, ”%01#RCSX0000”, is calculated and isadded 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.
ASCII HEX code
Data register
ASCII character
DT6 DT5
0 0
DT4
0 0
DT3
X S3 0 3 0 3 0 3 0 5 8 5 3
DT2
C R
DT1
# 1
DT0
0 %4 3 5 2 2 3 3 1 3 0 2 5
Block Check Code (BCC)12 bytes
The F70 (BCC) instruction is as shown below.
10 F70 BCC, K 2 , DT 0 , K 12 , DT 6R0
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.
FP0High- level Instructions
3 - 136
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
ASCII BIN code 0 0 12
0 0 1 05
1
ASCII HEX code
ASCII BIN code 0 0 01
1 1 1 0D
1
%ASCII HEX code
ASCII BIN code 0 0 13
1 0 0 00
00ASCII HEX code
ASCII BIN code 0 0 13
1 0 0 01
11ASCII HEX code
ASCII BIN code 0 0 12
0 0 0 13
1#ASCII HEX code
ASCII BIN code 0 1 05
1 0 0 12
0RASCII HEX code
ASCII BIN code 0 1 04
0 0 0 13
1CASCII HEX code
ASCII BIN code 0 1 05
1 0 0 13
1SASCII HEX code
ASCII BIN code 0 1 05
1 1 0 08
0XASCII HEX code
ASCII BIN code 0 0 13
1 0 0 00
00ASCII HEX code
ASCII BIN code 0 0 13
1 0 0 00
00ASCII HEX code
ASCII BIN code 0 0 13
1 0 0 00
00ASCII HEX code
ASCII BIN code 0 0 13
1 0 0 00
00
Exclusive ORing
Exclusive ORing
Exclusive ORing
Exclusive ORing
Exclusive ORing
Exclusive ORing
Exclusive ORing
Exclusive ORing
Exclusive ORing
Exclusive ORing
Exclusive ORing
Block Check Code (BCC)
calculation
This calculation result (H1D) is stored in the lower byte of DT6.
FP0 High- level Instructions
3 - 137
3.3 Explanation of High- level Instructions
Outline Converts 16-bit data to ASCII code that expresses the equivalenthexadecimals.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F71 HEXA , DT 0 , K 2 , DT 10
S1 D
Trigger
S2
R0
10
11
ST R 0
F 71 (HEXA)
DT 0
K 2
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 databytes to be converted
D Starting 16-bit area for storing ASCII code (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleConverts 2 bytes of data stored in data register DT0 to ASCII codes that express the equivalenthexadecimals when execution condition (trigger) R0 turns on. The converted data is stored in data registersDT11 and DT10.
· ·· ·
Hexadecimal
Bit position · · · · ·Binary data
A1 0 1 0
B1 0 1 1
C1 1 0 0
D1 1 0 1
15 1211 8 7 4 3 0DT0
ASCII HEX code
ASCII character
4B
2 4A
1 4D
4 4C
3
DT11 DT10
Hexadecimal data →ASCII code
5
F71 (HEXA)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 138
3.3 Explanation of High- level Instructions
DescriptionConverts the data starting from the 16-bit area specified by S1 to ASCII codes that express the equivalenthexadecimals. 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 whenconverted to ASCII code becomes double the source data.
Precautions during programmingThe two characters that make up one byte are interchanged when stored.
Two bytes are converted as one segment of data.
4 2 4 1
A B C D
4 4 4 3
B A D C
Hexadecimal data
Convertedresult
S1
S1+1
D+1 D
D+2D+3
Hexadecimaldata
Converted result
1 2 3 4
5 6 7 8
2 1 4 3
6 5 8 7
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 139
3.3 Explanation of High- level Instructions
Conversion exampleThe following shows conversion of hexadecimal data to ASCII codes.Conversion of four bytes of data (S2 = K4)
46 45
EF 12 AB CD
S1+1 S1Hexadecimal data
4 bytes
32 31 42 41
D+1 DConvertedresult
Result of S1 + 1conversion
F71 (HEXA) instruction execution
Result of S1 conversion
D+3 D+2
44 43
2 1F E D CB A
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 ifdesired.
12 AB CD
S1+1 S1Hexadecimal data
3 bytes
32 31 42 41
D+1 DConverted result D+2
44 43
2 1 D CB A
F71 (HEXA) instruction execution
Hexadecimal number to express ASCII codeHexadecimalnumber
ASCII code
0123456789ABCDEF
H30H31H32H33H34H35H36H37H38H39H41H42H43H44H45H46
FP0High- level Instructions
3 - 140
3.3 Explanation of High- level Instructions
Outline Converts ASCII code that expresses hexadecimal characters tohexadecimal data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F72 AHEX , DT 0 , K 4 , DT 40
S1 D
Trigger
S2
R0
10
11
ST R 0
F 72 (AHEX)
DT 0
K 4
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 databytes to be converted
D Starting 16-bit area for storing converted data (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleConverts 4 ASCII codes stored in data registers DT0 and DT1 to hexadecimal numbers when executioncondition (trigger) R0 turns on. The converted data is stored in data register DT40.
· ·· ·
Hexadecimal
Bit position · · · · ·Binary data
C1 1 0 0
D1 1 0 1
A1 0 1 0
B1 0 1 1
15 1211 8 7 4 3 0DT40
ASCII HEX code
ASCII character
4D
4 4C
3 4B
2 4A
1DT1 DT0
ASCII code →Hexadecimal data
5
F72 (AHEX)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 141
3.3 Explanation of High- level Instructions
DescriptionConvertsASCII code that expresseshexadecimal characters,starting fromthe 16-bitarea specifiedby S1, tohexadecimal numbers as specified by S2. The converted result is stored in the area starting from the 16-bitarea specified by D.
The volume of the results (hexadecimal numeric data) is half that of the converted ASCII code.
Precautions during programmingThe data for two ASCII code characters is converted to two numeric digits for one word. When this takesplace, the characters of the upper and lower bytes are interchanged.
Four characters are converted as one segment of data.
ASCII code character
A BC D
4 2 4 14 4 4 3
Convertedresult
Flag conditionsS 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 ExampleThe following shows conversion of ASCII codes to hexadecimal data.
Conversion of eight characters (S2 = K8)
31 46 45 44 43 42 41
S1+3 S1+2 S1+1 S1
32
2 1 F E D C B A
ASCII code
8 characters (8 bytes)
12 EF CD AB
D+1 DConverted result
Result of S1 + 3,S1 + 2 conversion
Result of S1 + 1, S1conversion
F72 (AHEX) instruction execution
FP0High- level Instructions
3 - 142
3.3 Explanation of High- level Instructions
Conversion of 7 characters (S2 = K7)
S1+3 S1+2 S1+1 S1ASCII code
7 characters (7 bytes)
D+1 DConverted result
31 46 45 44 43 42 41
1 F E D C B A
10 EF CD AB
This position isfilled with “0”.
F72 (AHEX) instruction execution
Conversion of 6 characters (S2 = K6)
S1+2 S1+1 S1ASCII code
6 characters (6 bytes)
D+1 DConverted result
46 45 44 43 42 41
F E D C B A
EF CD AB
Result of S1+1,S1 conversion
Result ofS1+2conversion
F72 (AHEX) instruction execution
NoteIn the conversion results, only the data for the lower byte isstored in D + 1 word. The data for the higher byte is left as it is,and does not change.
FP0 High- level Instructions
3 - 143
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.
44 n n-1 n-2
n 0 n-1 n-2
n = S2, (odd number)
ASCII code Converted result
This position isfilled with “0”.
Convertedresult
ASCII code to express hexadecimal numberASCII code Hexadecimal
number
H30H31H32H33H34H35H36H37H38H39H41H42H43H44H45H46
0123456789ABCDEF
FP0High- level Instructions
3 - 144
3.3 Explanation of High- level Instructions
Outline Converts 4-digit BCD code to ASCII code that expresses theequivalent decimals.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F73 BCDA , DT 0 , H4 , DT 10
S1 D
Trigger
S2
R0
10
11
ST R 0
F 73 (BCDA)
DT 0
H 4
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 databytes to be converted and direction of the converted data
D Starting 16-bit area for storing conversion result (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleConverts BCDcode that express a4-digit decimalnumber (4-digitBCD Hcode) stored in data register DT0 toASCII code when execution condition (trigger) R0 turns on. The converted data is stored in data registersDT10 and DT11.
When S2 = H2 (normal direction, 2 bytes convertion)
DT0
BCDH code
DT11
ASCIIHEX code
1 2 3 4
3 2 3 1
ASCIIcharacter
2 1
DT10
3 4 3 3
4 3
BCD data → ASCII code5
F73 (BCDA)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 145
3.3 Explanation of High- level Instructions
When S2 = H1002 (reverse direction, 2 bytes convertion)
DT0
BCDdata
DT11
ASCIIHEX code
1 2 3 4
3 4 3 3
ASCIIcharacter
4 3
DT10
3 2 3 1
2 1
DescriptionConverts the BCD code starting from the 16-bit area specified by S1 to ASCII code that expresses theequivalentdecimalsas specifiedby S2. The converted result is stored in the area starting fromthe 16-bit areaspecified 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 dataH1: 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 dataH0: Normal directionH1: Reverse direction
Since you can specify source data in byte units, it is possible to convert only the lower byte of S1 to ASCIIcode.
For information on the direction of conversion, refer to ”Explanation of example”.
FP0High- level Instructions
3 - 146
3.3 Explanation of High- level Instructions
Precautions during programmingThe two characters that make up one byte are interchanged when stored.
Two bytes are converted as one segment of data.
1 2 3 41 2 3 4
S1
D+1 D
S1
D+1 D
Normal direction Reverse direction
2 1 4 3 4 3 2 1Convertedresult
Flag conditionsS 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 ExampleThe following shows conversion from BCD data to ASCII codes.
Normal direction convertion of 4 bytes (S2 = H0004)
ASCII HEXcode
12 34 56 78
S1+1 S1BCD data
4 bytes
34 33 36 35
D+1 DConverted result
Result of S1 + 1conversion
Result of S1conversion
D+3 D+2
38 3732 31
4 3 6 5 8 72 1
BCD H code
ASCIIcharacter
F73 (BCDA) instruction execution
FP0 High- level Instructions
3 - 147
3.3 Explanation of High- level Instructions
Reverse direction convertion of 4 bytes (S2 = H1004)
Result of S1 + 1conversion
Result of S1conversion
ASCII HEXcode
BCD data
4 bytes
D+1Converted result D+3 D+2
BCD H code
ASCIIcharacter
12 34 56 78
S1+1 S1
34 3336 3538 37 32 31
4 36 58 7 2 1
D
F73 (BCDA) instruction execution
BCD code to express ASCII codeBCD code ASCII code
0123456789
H30H31H32H33H34H35H36H37H38H39
FP0High- level Instructions
3 - 148
3.3 Explanation of High- level Instructions
Outline Converts ASCII code that expresses decimal characters to BCD code.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F74 ABCD , DT 0 , H8 , DT 40
S1 D
Trigger
S2
R0
10
11
ST R 0
F 74 (ABCD)
DT 0
H 8
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 databytes to be converted and to arrange converted data
D Starting 16-bit area for storing converted data (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleConverts 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)
DT40
BCDH code
DT1
ASCIIHEX code
3 4 1 2
3 4 3 3
ASCIIcharacter
4 3
DT0
3 2 3 1
2 1
ASCII code → BCD data5
F74 (ABCD)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
9
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 149
3.3 Explanation of High- level Instructions
When S2 = H1004 (reverse direction, 4 bytes):
DT40
BCDH code
DT1
ASCIIHEX code
1 2 3 4
3 4 3 3
ASCIIcharacter
4 3
DT0
3 2 3 1
2 1
DescriptionConverts ASCII codes that express decimal characters, starting from the 16-bit area specified by S1, to BCDdata 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 S2S2 = H j 0 0 j
Number of bytes for ASCII characterH1: 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 dataH0: Normal directionH1: Reverse direction
FP0High- level Instructions
3 - 150
3.3 Explanation of High- level Instructions
Precautions during programmingThe data for twoASCII codecharacters is converted to twonumericdigits for one byte.When this takesplace,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 bitposition 4 to 7 if data is being sequenced in the reverse direction.
Normal direction Reverse direction
2 1 4 3 4 3 2 1
BCD data
ASCIIcode
1 2 3 43 41 2
Conversion ExampleThe following shows conversion from ASCII codes to BCD data.
8 ASCII characters convertion (S2=H0008)
ASCIIcharacter
ASCII HEXcode 37 36 35 34 33 32 31
S1+3 S1+2 S1+1 S1
38
8 7 6 5 4 3 2 1
ASCII code
8 ASCII characters (8 bytes)
78 56 34 12
D+1 DConverted result
BCD H code
F74 (ABCD) instruction execution
7 ASCII characters (S2=H1007)
ASCII character
ASCII HEXcode
S1+3 S1+2 S1+1 S1ASCII code
7 ASCII characters (7 bytes)
D+1 DConverted result
BCD H code
37 36 35 34 33 32 317 6 5 4 3 2 1
01 23 45 67
This position isfilled with “0”.
F74 (ABCD) instruction execution
FP0 High- level Instructions
3 - 151
3.3 Explanation of High- level Instructions
ASCII code to express BCD codeASCII code BCD code
H30H31H32H33H34H35H36H37H38H39
0123456789
Flag conditionsS 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.
FP0High- level Instructions
3 - 152
3.3 Explanation of High- level Instructions
Outline Converts 16-bit data to ASCII code that expresses the equivalentdecimals.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F75 BINA , DT 0 , K 6 , DT 50
S1 D
Trigger
S2
R0
10
11
ST R 0
F 75 (BINA)
DT 0
K 6
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 toexpress destination data (ASCII codes)
D Starting 16-bit area for storing ASCII codes (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleConverts the 16-bit data stored in data register DT0 to ASCII codes that express the equivalent decimalswhen execution condition (trigger) R0 turns on. The converted data is stored in data registers DT52 to DT50.
· ·· ·Decimal data
Bit position · · · · ·K - 100
15 1211 8 7 4 3 0DT0Source
Destination
SPACE
ASCII HEX codeASCII character
30
0 30
0 31
1 2-
DDT52 DT51
6 bytes
DT502 0 2 0
16-bit data → ASCII code5
F75 (BINA)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 153
3.3 Explanation of High- level Instructions
DescriptionConverts the 16-bit data specified by S1 to ASCII codes that express the equivalent decimals. The convertedresult 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 programmingIf 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.
2D313030 2020 2020
D+2 D+1 D
1 -
When S2=K8 (8 bytes)
ASCII code
0 0
Extra bytes
Range specified by S2
D+3
(Space) (Space) (Space) (Space)
If the number of bytes of ASCII codes following conversion (including the minus sign) is larger than thenumber of bytesspecifiedby the S2, an operation error occurs. Make sure the sign is taken intoconsiderationwhen specifying the object of conversion for the S2.
Conversion ExampleThe following shows conversion from 16-bit decimal data to ASCII codes.
When a negative number is converted
Convertedresult
2D
D+2 D+1 D
31
1 -
ASCII code
3030
0 0
2020
Extra bytes
Range specified by S2 (6 bytes)
S1
K-100
9CFF
16-bit data
(Space) (Space)
F75 (BINA) instruction execution
FP0High- level Instructions
3 - 154
3.3 Explanation of High- level Instructions
When a positive number is converted
Convertedresult D+2 D+1 D
ASCII code Extra bytes
Range specified by S2 (6 bytes)
S116-bit data
(Space) (Space)
2132
2 1
3334
4 3
2020
K1234
D204
F75 (BINA) instruction execution
Decimal characters to express ASCII HEX codeDecimalcharacters
ASCII HEXcode
SPACE-0123456789
H20H2DH30H31H32H33H34H35H36H37H38H39
Flag conditionsS 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.
FP0 High- level Instructions
3 - 155
3.3 Explanation of High- level Instructions
Outline Converts ASCII code that expresses decimal digits to 16-bit data thatexpresses the equivalent number.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F76 ABIN , DT 0 , K 6 , DT 50
S1 D
Trigger
S2
R0
10
11
ST R 0
F 76 (ABIN)
DT 0
K 6
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 bytesto be converted
D 16-bit area for storing converted data (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleConverts ASCII codes (6 bytes) that express decimal digits in data registers DT2 to DT0 to 16-bit data whenexecution condition (trigger) R0 turns on. The converted data is stored in data register DT50.
ASCII HEX codeASCII character
30
0 30
0 31
1 2 DDT2 DT1
6 bytes
Source DT0
In this case, this position shouldbe set to “SPACE” or “0”.
· · ·
Decimal data
Bit position · · · · ·
K - 100
15 1211 8 7 4 3 0
DT50Destination
3 0 3 0—
ASCII code → 16-bit dataF76 (ABIN)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 156
3.3 Explanation of High- level Instructions
DescriptionConverts the ASCII codes that express the decimal digits, starting from the 16-bit area specified by S1 to16-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 specificationcannot be made with BCD data.)
Precautions during programmingThe 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” (ASCIIHEX 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 conditionsS 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 ExampleThe following shows conversion from ASCII codes to decimal data in a 16-bit configuration.
Example of converting an ASCII code indicating a negative number
Converted result
2D
S1+2 S1+1 S1
31
1 -
ASCII code
3030
0 0
3030
Extra bytes
Range specified by S2
D
K-100
9CFF
ASCII code
(0) (0)
F76 (ABIN) instruction execution
FP0 High- level Instructions
3 - 157
3.3 Explanation of High- level Instructions
Example of converting an ASCII code indicating a positive number
Example 1:
ASCII code Extra bytes
Range specified by S2
(Space) (Space)
2B
S1+2 S1+1 S1
31
1 +
3030
0 0
2020
ASCII code
Example 2:
ASCII code Extra bytes
Range specified by S2
(Space) (Space)
S1+2 S1+1 S1ASCII code
Converted resultof example 1 or 2
2031
1
3030
0 0
2020
D
K100
6400
(Space)
F76 (ABIN) instruction execution
ASCII code to express decimal charactersASCII code Decimal
characters
H20H2BH2DH30H31H32H33H34H35H36H37H38H39
SPACE+-0123456789
FP0High- level Instructions
3 - 158
3.3 Explanation of High- level Instructions
Outline Converts 32-bit data to ASCII code that expresses the equivalentdecimals.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F77 DBIA , DT 0 , K 10 , DT 50
S1 D
Trigger
S2
R0
10
11
ST R 0
F 77 (DBIA)
DT 0
K 10
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 toexpress destination data (ASCII codes)
D Starting 16-bit area for storing ASCII codes (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleConverts the 32-bit data stored in data registers DT1 and DT0 to ASCII code that expresses the equivalentdecimals when execution condition (trigger) R0 turns on. The converted data is stored in data registers DT54to DT50 (10 bytes).
· ·· ·
Decimal
Bit position · · · · ·15 1211 8 7 4 3 0
DT1
ASCII HEX code
ASCII character
38
8 37
7 36
6 35
5DT54 DT53
Number of bytes specified by S2 (10 bytes)
Source
Destination
· ·· · · · · · ·15 1211 8 7 4 3 0
DT0
34
4 33
3 32
2 31
1DT52 DT51
2 2 0DT50
SPACE
0
K12345678
32-bit data → ASCII code5
F77 (DBIA)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 159
3.3 Explanation of High- level Instructions
DescriptionConverts the 32-bit data specified by S1 to ASCII code that expresses the equivalent decimals. Theconverted 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 programmingWhen 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 onthe size of the data storage area.
If the number of bytes of ASCII codes following conversion (including the minus sign) is larger than thenumber of bytesspecifiedby the S2, an operation error occurs. Make sure the sign is taken intoconsiderationwhen specifying the object of conversion for the S2.
Flag conditionsS 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.
FP0High- level Instructions
3 - 160
3.3 Explanation of High- level Instructions
Conversion ExampleThe following shows conversion from 32-bit decimal format data to ASCII codes.
Example of converting a negative number
2D
D+2 D+1 D
31
1 -
ASCII code
3233
3 2
20
Extra byte
Range specified by S2 (10 bytes)
S1
K-12345678
B29E
32-bit data S1+1
D+3
3435
5 4
D+4
3637
7 6
38
8
43FF
Convertedresult
(Space)
F77 (DBIA) instruction execution
Example of converting a positive number
D+2 D+1 D
ASCII code
Range specified by S2 (8 bytes)
S132-bit data S1+1
D+3Convertedresult
3334
2 1
3536
4 3
4E61
K12345678
3738
6 58 7
3132
BC00
F77 (DBIA) instruction execution
Decimal characters to express ASCII codeDecimalcharacters
ASCII code
SPACE+-0123456789
H20H2BH2DH30H31H32H33H34H35H36H37H38H39
FP0 High- level Instructions
3 - 161
3.3 Explanation of High- level Instructions
Outline Converts ASCII code that expresses decimal digits to 32-bit data thatexpresses the equivalent number.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F78 DABI , DT 0 , K 10 , DT 50
S1 D
Trigger
S2
R0
10
11
ST R 0
F 78 (DABI)
DT 0
K 10
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 bytesto be converted
D Lower 16-bit area of 32-bit data for storing converted data (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleConverts ASCII codes (10 bytes) that express decimal digits in data registers DT4, DT3, DT2, DT1 and DT0to 32-bit data when execution condition (trigger) R0 turns on. The converted data is stored in data registersDT51 and DT50.
·· ·Decimal
Bit position · · · · ·K 1 2 3 4 5 6 7 8
15 12 11 8 7 4 3 0DT51
Source
Destination
· ·· · · · · · ·15 12 11 8 7 4 3 0DT50
ASCII HEX code
ASCII character
38
8 37
7 36
6 35
5DT4 DT3
ASCII codes (10 bytes) specified by S2
34
4 33
3 32
2 31
1DT2 DT1
2 2 0DT0
SPACE
0
ASCII code → 32-bit data5
F78 (DABI)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 162
3.3 Explanation of High- level Instructions
DescriptionConverts ASCII code that expresses the decimal digits, starting from the 16-bit area specified by S1 to 32-bitdata 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 programmingThe 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” (ASCIIHEX 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 conditionsS 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.
FP0 High- level Instructions
3 - 163
3.3 Explanation of High- level Instructions
Conversion ExampleThe following shows conversion from ASCII codes to decimal data in a 32-bit configuration.
Example of converting an ASCII code indicating a negative number
35 2D
S1+2 S1+1 S1
31
1 -
ASCII code
3233
3 2
20
Extra byte
Range specified by S2 (10 bytes)
S1+3
34
5 4
S1+4
3637
7 6
38
8
Converted result D
K-12345678
B29E
ASCII code
D+1
43FF
(Space)
F78 (DABI) instruction execution
Example of converting an ASCII code indicating a positive number
Example 1:
S1+2 S1+1 S1
ASCII code
Range specified by S2 (8 bytes)
S1+3ASCII code
32333435363738 31
13 25 47 68
Example 2:
S1+2 S1+1 S1
ASCII code Extra byte
Range specified by S2 (10 bytes)
S1+3S1+4
Converted result ofexample 1 or 2 D
ASCII code
D+1
(Space)
2B313233 203435363738
1 +3 25 47 68
K12345678
4E61BC00
F78 (DABI) instruction execution
FP0High- level Instructions
3 - 164
3.3 Explanation of High- level Instructions
ASCII code to express decimal charactersASCII code Decimal
characters
H20H2BH2DH30H31H32H33H34H35H36H37H38H39
SPACE+-0123456789
FP0 High- level Instructions
3 - 165
3.3 Explanation of High- level Instructions
Outline Converts 16-bit binary data to BCD code the expresses a 4-digitdecimal.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F80 BCD , DT10 , DT20
S D
Trigger
R0
10
11
ST R 0
F 80 (BCD)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleConverts the contents of data register DT10 to BCD code that expresses a 4-digit decimal when executioncondition (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.
· ·· ·Bit position · · · · ·DT10
150 0 0
120
110 0 0
80
70 0 0
41
30 0 0
00
Source [S]: K16
Conversion (to BCD code)
Destination [D]: H16 (BCD)
Decimal K16
· ·· ·Bit position · · · · ·DT20
150 0 0
120
110 0 0
80
70 0 0
41
30 1 1
00
BCD H code 0 0 1 6
16-bit data → 4-digit BCD dataF80 (BCD)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 166
3.3 Explanation of High- level Instructions
DescriptionConverts the 16-bit binary data specified by S to BCD code that expresses a 4-digit decimal. The converteddata is stored in D.
Precautions during programmingThe 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 conditionsS 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.
FP0 High- level Instructions
3 - 167
3.3 Explanation of High- level Instructions
Outline Converts BCD code that expresses a 4-digit decimal to 16-bit binarydata.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F81 BIN , DT10 , DT0
S D
Trigger
R0
10
11
ST R 0
F 81 (BIN)
DT 10
DT 0
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleConverts the contents of data register DT10 to 16-bit binary data when execution condition (trigger) R0 turnson. The converted data is stored in data register DT0.
If DT10 is BCD data consisting of H15, the following will be stored in DT0.
· ·· ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
80
70 0 0
40
31 1 1
01
Source [S]: H15 (BCD)
Conversion (to binary data)Destination [D]: K15
Decimal K15
· ·· ·Bit position · · · · ·DT10
150 0 0
120
110 0 0
80
70 0 0
41
30 1 0
01
BCD H code 0 0 1 5
DescriptionConverts BCD code that expresses a 4-digit decimal specified by S to 16-bit binary data. The converted datais stored in D.
For detailed information about the BCD data section 4.2.
4-digit BCD data → 16-bit dataF81(BIN)Step Availability
FP0 C10, C14, C16,C32, T32, SL15
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 168
3.3 Explanation of High- level Instructions
Flag conditionsS 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.
FP0 High- level Instructions
3 - 169
3.3 Explanation of High- level Instructions
Outline Converts 32-bit binary data to BCD code that expresses an 8-digitdecimal.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F82 DBCD, DT 0 , DT 2
S D
Trigger
R20
10
11
ST R 20
F 82 (DBCD)
DT 0
DT 2
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleConverts the contents of data registers DT1 and DT0 to BCD code that expresses an 8-digit decimal whenexecution condition (trigger) R20 turns on. The converted data is stored in data registers DT3 and DT2.
DescriptionConverts the 32-bit data specified by S to BCD code that expresses an 8-digit decimal. The converted data isstored in D+1 and D.
Precautions during programmingThe 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 conditionsS 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.
32-bit data → 8-digit BCD data5
F82(DBCD)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 170
3.3 Explanation of High- level Instructions
Outline Converts BCD code that expresses an 8-digit decimal to 32-bit binarydata.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F83 DBIN, DT 0 , DT 2
S D
Trigger
R10
10
11
ST R 10
F 83 (DBIN)
DT 0
DT 2
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleConverts BCD code that expresses an 8-digit decimal of data registers DT1 and DT0 to 32-bit binary datawhen execution condition (trigger) R10 turns on. The converted data is stored in data registers DT3 and DT2.
DescriptionConverts BCD code that expresses an 8-digit decimal specified by S to 32-bit binary data. The converteddata is stored in D+1 and D.For detailed information about the BCD data section 4.2.
Flag conditionsS 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.
8-digit BCD data → 32-bit data5
F83(DBIN)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 171
3.3 Explanation of High- level Instructions
Outline Inverts all bits in the 16-bit area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F84 INV , DT 0
D
Trigger
R20
10
11
ST R 20
F 84 (INV)
DT 0
D 16-bit area to be inverted
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
Explanation of exampleInverts the contents of data register DT0 when execution condition (trigger) R20 turns on.
· ·· ·Bit position · · · · ·DT0
150 1 0
121
111 1 1
80
71 0 1
41
31 1 0
01
Destination
R20: on (inversion)
· ·· ·Bit position · · · · ·DT0
151 0 1
120
110 0 0
81
70 1 0
40
30 0 1
00
Destination
DescriptionInverts 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 logicoperation.
Flag conditionsS 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.
16-bit data invert5
F84 (INV)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 172
3.3 Explanation of High- level Instructions
Outline Takes two’s complement of 16-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F85 NEG , DT 0
D
Trigger
R20
10
11
ST R 20
F 85 (NEG)
DT 0
D 16-bit area for storing original data and its two’s complement
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
Explanation of exampleTakes two’s complement of data register DT0 when execution condition (trigger) R20 turns on.
· ·· ·Bit position · · · · ·
DT0
151 1
121
111
8 71
4 301
01
Destination
R20: onDestination
Decimal data
· ·· ·Bit position · · · · ·DT0
150 0
120
110
8 70
4 30
01
Decimal data
100000000
K3
1 1 1 1 1 1 1 1
K-3
DescriptionTakes 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 topositive.
Flag conditionsS 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.
16-bit data two’s complement5
F85 (NEG)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 173
3.3 Explanation of High- level Instructions
Outline Takes two’s complement of 32-bit data
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F86 DNEG , DT 0
D
Trigger
R20
10
11
ST R 20
F 86 (DNEG)
DT 0
D Lower 16-bit area of 32-bit data for storing original data and its two’scomplement
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleTakes two’s complement of data registers DT1 and DT0 when execution condition (trigger) R20 turns on.
· ·· ·Bit position · · · · ·Binary data
150
12110 0
80
70 0
40
30
0
R20: on
Destination
Decimal data
· ·· · · · · · ·150
120
110
80
70
40
30 1
01
Higher 16-bit area Lower 16-bit area
DT1 DT0
· ·· ·Bit position · · · · ·Binary data
151
12111 1
81
71 1
41
31
0Destination
Decimal data
· ·· · · · · · ·151
121
111
8 71
41
31 0
01
Higher 16-bit area Lower 16-bit area
DT1 DT0
1111111111111111
K-3
000000000000000
K3
DescriptionTakes 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 topositive.
Flag conditionsS 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.
32-bit data two’s complement5
F86 (DNEG)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 174
3.3 Explanation of High- level Instructions
Outline Takes absolute value of signed 16-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F87 ABS , DT 0
D
Trigger
R20
10
11
ST R 20
F 87 (ABS)
DT 0
D 16-bit area for storing original data and its absolute value
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
Explanation of exampleTakes 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 isexecuted.
DescriptionTakes absolute value of signed 16-bit data specified by D. The absolute value of the signed 16-bit data isstored in D.
This is effective for processing data in which the polarity (+ or - ) changes.
Flag conditionsS 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 toK-32767 (HFFFF to H8001).”
16-bit data absolute5
F87(ABS)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 175
3.3 Explanation of High- level Instructions
Outline Takes absolute value of signed 32-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F88 DABS , DT 0
D
Trigger
R20
10
11
ST R 20
F 88 (DABS)
DT 0
D Lower 16-bit area of 32-bit data for storing original data and its absolute value
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleTakes absolute value of data registers DT1 and DT0 when execution condition (trigger) R20 turns on. Theabsolute value of DT1 and DT0 is stored in data registers DT1 and DT0.
DescriptionTakes the absolute value of signed 32-bit data specified by D. The absolute value of the 32-bit data is storedin D+1 and D.
This is effective for processing data in which the polarity (+ or - ) changes.
Flag conditionsS 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).”
32-bit data absolute5
F88(DABS)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 176
3.3 Explanation of High- level Instructions
Outline Copies the sign bit of the specified 16-bit data to all the bits of the higher16-bit area (extended 16-bit area).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F89 EXT , DT 0
D
Trigger
R20
10
11
ST R 20
F 89 (EXT)
DT 0
D 16-bit area for storing original 16-bit binary data
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleCopies the sign bit (bit position 15) of data register DT0 to all the bits of data register DT1 when executioncondition (trigger) R20 turns on.
If K-2 is stored in DT0, the data will be as follows.
· ·· ·Bit position · · · · ·Binary data
15 1211 8 7 4 3 0
R20: on
Decimal data
· ·· · · · · · ·151
12111 1
81
71 1
41
31 0
0
Higher 16-bit area(extended 16-bit area)
Lower 16-bit area
DT1 DT0
· ·· ·Bit position · · · · ·Binary data
151
12111 1
81
71 1
41
31 0
0
Decimal data
DT0
Sign bit (0: positive, 1: negative)
1 1 1 1 1 1 1
K-2
1 1 1 1 1 1 11 1 1 1 1 1 1 11 1 1 1 1 1 1 1
K-2
16-bit data
32-bit data
16-bit data sign extension5
F89 (EXT)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 177
3.3 Explanation of High- level Instructions
Description16-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 to0. 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 instructionsfollowing execution of the F89 (EXT) instruction.
Flag conditionsS 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.
FP0High- level Instructions
3 - 178
3.3 Explanation of High- level Instructions
Outline Decodes the specified data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F90 DECO, DT10, H404, DT20
S D
Trigger
R20
n
10
11
ST R 20
F 90 (DECO)
DT 10
H 404
DT 20
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 positionand number of bits to be decoded
D Starting 16-bit area for storing decoded data (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
n A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleDecodes data register DT10 according to the contents of n “H404” when execution condition (trigger) R20turns on. The decoded result is stored in data register DT20.
When n: H404
DT20
· ·· ·Bit position · · · · ·
DT10
150 1 0
120
110 1 1
80
70 1 1
41
31 0 0
01
R20: on
· ·· ·Bit position · · · · ·150 0 0
120
110 0 0
80
71 0 0
40
30 0 0
00
Destination
Source
4 bits from bit position 4 to 7 of DT10 are decoded.[Binary: 0111 (decimal: K7)]
The decoded data “1 (on)” is stored in bit position 7 ofDT20.The bits except bit position 7 become 0.
Bit position 4
4 bits
DescriptionDecodes the contents of 16-bit data specified by S according to the contents of n. The decoded result isstored 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 beingdecoded.
DecodeF90 (DECO)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 179
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.
Number of bits to be decoded(set range: H1 to H8)Starting bit position to be decoded
(set range: H0 to HF) Set value Number ofbits
H1 1
H2 2
H3 3
H4 4
H5 5
H6 6
H7 7
H8 8
Set value Starting bitposition
H0 0
H1 1
H2 2
H3 3
H4 4
H5 5
H6 6
H7 7
H8 8
H9 9
HA 10
HB 11
HC 12
HD 13
HE 14
HF 15
n
· ·· · · · · · ·15 12 11
0 1 0
8
0
7 4 3
0 1 0
0
0
16-bit data
Bit position
The bits of “ - ” mark are invalid.— — — — — — — —
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 theresult
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”.
FP0High- level Instructions
3 - 180
3.3 Explanation of High- level Instructions
Decoded exampleWhen 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 resultData to be decoded[Binary (decimal)] 15 S S 12 11 S S 8 7 S S 4 3 S S 0
0000 (K0)0001 (K1)0010 (K2)0011 (K3)0100 (K4)0101 (K5)0110 (K6)0111 (K7)1000 (K8)1001 (K9)1010 (K10)1011 (K11)1100 (K12)1101 (K13)1110 (K14)1111 (K15)
0 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 10 0 1 00 1 0 01 0 0 0
0 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 10 0 1 00 1 0 01 0 0 00 0 0 00 0 0 00 0 0 00 0 0 0
0 0 0 00 0 0 00 0 0 00 0 0 00 0 0 10 0 1 00 1 0 01 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 0
0 0 0 10 0 1 00 1 0 01 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 0
Flag conditionsS 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.
FP0 High- level Instructions
3 - 181
3.3 Explanation of High- level Instructions
Outline Converts 16-bit data to 4-digit data for 7-segment indication.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F91 SEGT , DT 0 , DT10
S D
Trigger
R0
10
11
ST R 0
F 91 (SEGT)
DT 0
DT 10
S 16-bit equivalent constant or 16-bit area to be converted to the 7-segmentindication (source)
D Starting 16-bit area for storing 4-digit data for 7-segment indication(destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleConverts 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.
0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 0 0 0 1 1 1 0 0 1 0 1 0 1 1 1 1 0
15 · · ·Bit position · · · · ·DT10
15 1211 8 7 4 3 0
7-segmentindication
C D
Destination
· · ·Bit position · · · · ·DT11
1211 8 7 4 3 0
7-segmentindication
A B
Source
· ·· ·Bit position · · · · ·DT0
15
1 0 1
12
0
11
1 0 1
8
1
7
1 1 0
4
0
3
1 1 0
0
1
Hexadecimal A B C D
16-bit data 7-segment decodeF91(SEGT)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 182
3.3 Explanation of High- level Instructions
DescriptionConverts 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 the7-segment display is shown below.
One digit data to beconverted
8-bit data for7-segment indication 7-segment
indicationOrganization of7 segment indication
Hexadecimal Binary g f e d c b aindication 7-segment indication
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 ca
H6 0 1 1 0 0 1 1 1 1 1 0 1 da
bfH7 0 1 1 1 0 0 1 0 0 1 1 1 e
bf g
H8 1 0 0 0 0 1 1 1 1 1 1 1 f ceH9 1 0 0 1 0 1 1 0 1 1 1 1 g
c
d
e
HA 1 0 1 0 0 1 1 1 0 1 1 1d
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 conditionsS 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.
FP0 High- level Instructions
3 - 183
3.3 Explanation of High- level Instructions
Outline Encodes the specified data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F92 ENCO, DT10, DT 0 , DT 1
S D
Trigger
R0
n
10
11
ST R 0
F 92 (ENCO)
DT 10
DT 0
DT 1
S Starting 16-bit area to be encoded (source)
n 16-bit equivalent constant or 16-bit area to specify starting bit position andnumber of bits to be encoded
D 16-bit area for storing encoded data (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A A A N/A N/A A
Explanation of exampleEncodes contens of data register DT11and DT10 according to the contentsof DT0when executioncondition(trigger) R0 turns on. The encoded result is stored in 8 bits of data register DT1 starting from bit position 0.
EncodeF92 (ENCO)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
0 0 0 0 0 0 0 0
· ·· ·Bit position · · · · ·DT11
150 0 0
120
110 0 0
80
70 0 0
40
30 0 0
00
· · ·Bit position · · · · ·DT1
150
120
110
80
70
40
31
00
Destination
Source
[S]
[D]
When DT0: H0005
Number of bits to be encoded: 25 = 32 bitsStarting bit position to be encoded for destination data: bit position 0
· ·· ·Bit position · · · · ·DT10
150 0 0
120
110 0 0
81
70 0 0
40
30 0 0
00
Decimal K8
The 8th bit of 32-bitdata is in the on state.32 bits specified by H5
The encoded result K8(decimal) is stored in DT1.
Bit position 8 to 15are filled with 0.
Encoded result:K8
Starting bit position
FP0High- level Instructions
3 - 184
3.3 Explanation of High- level Instructions
DescriptionEncodes the contentsof dataspecifiedby Saccording to the contentsof n. The encoded result is stored in the16-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 encodedresults 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 usinghexadecimal data.
Number of bits to be encoded(set range: H1 to H8)
Starting bit position of destina-tion data to be encoded(set range: H0 to HF)
Set value Number ofbits
2H1
4H2
8 (1 byte)H3
16 (1 word)H4
32 (2 words)H5
64 (4 words)H6
128 (8 words)H7
256 (16 words)H8
Set value Starting bitposition
H0 0
H1 1
H2 2
H3 3
H4 4
H5 5
H6 6
H7 7
H8 8
H9 9
HA 10
HB 11
HC 12
HD 13
HE 14
HF 15
The bits of “ - ” mark are invalid.
16-bit data
· ·· · · · · · ·15 12 11
0 0 0
8
0
7 4 3
0 1 0
0
1
Bit position
n — — — — — — — —
FP0 High- level Instructions
3 - 185
3.3 Explanation of High- level Instructions
Encoded exampleWhen encoding 16-bit data (nL=4), the encoded results are shown below.
Data to be encoded Encoded result15 S S 12 11 S S 8 7 S S 4 3 S S 0
Encoded result[Binary (decimal)]
0 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 10 0 1 00 1 0 01 0 0 0
0 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 10 0 1 00 1 0 01 0 0 00 0 0 00 0 0 00 0 0 00 0 0 0
0 0 0 00 0 0 00 0 0 00 0 0 00 0 0 10 0 1 00 1 0 01 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 0
0 0 0 10 0 1 00 1 0 01 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 00 0 0 0
0 0 0 0 (K0)0 0 0 1 (K1)0 0 1 0 (K2)0 0 1 1 (K3)0 1 0 0 (K4)0 1 0 1 (K5)0 1 1 0 (K6)0 1 1 1 (K7)1 0 0 0 (K8)1 0 0 1 (K9)1 0 1 0 (K10)1 0 1 1 (K11)1 1 0 0 (K12)1 1 0 1 (K13)1 1 1 0 (K14)1 1 1 1 (K15)
Flag conditionsS 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.
FP0High- level Instructions
3 - 186
3.3 Explanation of High- level Instructions
Outline Extracts the lower 4 bits (bit positions 0 to 3) of the specified 16-bit areasand combines them into one word.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F93 UNIT, DT 0, K 3 , DT 100
S D
Trigger
R0
n
10
11
ST R 0
F 93 (UNIT)
DT 0
K 3
DT 100
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A A A A A A A A N/A N/A A
Explanation of exampleExtracts lower 4 bits of data registers DT2 to DT0, combines the extracted data, and stores it in data registerDT100 when execution condition (trigger) R0 turns on.
· ·· ·Bit position · · · · ·
DT0
15
0 0 0
12
0
11
0 0 0
8
0
7
0 0 0
4
0
3
0 0 0
0
1
DT1
DT2 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
· ·· ·Bit position · · · · ·
DT100
15
0 0 0
12
0
11
0 1 0
8
0
7
0 0 1
4
0
3
0 0 0
0
1
When the n < K4, “0” is set to bit position 12 to 15.
16-bit data combineF93 (UNIT)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 187
3.3 Explanation of High- level Instructions
DescriptionExtracts the lower 4 bits (bit positions 0 to 3) of each specified area, starting from the 16-bit area specified byS 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 notexist.
· ·· ·Bit position · · · · ·S
15 1211 8 7 4 3 0
Bit positions 4 to 15 of eachdata area are invalid.
Destination
Source
S + 1S + 2
· ·· ·Bit position · · · · ·D
15 1211 8 7 4 3 0Digit 4 Digit 3 Digit 2 Digit 1
Digit 4Digit 3Digit 2Digit 1
S + 3
n
Flag conditionsS 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.
FP0High- level Instructions
3 - 188
3.3 Explanation of High- level Instructions
Outline Divides the specified 16-bit data into four 4-bit units and distributes thedivided data into the lower 4 bits of the specified 16-bit areas.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F94 DIST, DT100, K 4 , DT 0
S D
Trigger
R0
n
10
11
ST R 0
F 94 (DIST)
DT 100
K 4
DT 0
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
n A A A A A A A A A A A
D N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleDivides 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.
DT1
· ·· ·Bit position · · · · ·
DT0
15
0 0 0
12
0
11
0 0 0
8
0
7
0 0 0
4
0
3
0 0 0
0
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
· ·· ·Bit position · · · · ·
DT100
15
0 1 1
12
1
11
0 0 1
8
1
7
0 0 0
4
1
3
0 0 0
0
0
DT2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
DT3 0 0 0 0 0 0 0 0 0 0 0 0 0 1
1
11
16-bit data distributeF94 (DIST)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 189
3.3 Explanation of High- level Instructions
DescriptionDivides the 16-bit data specified by S into 4-bit units and distributes the divided data into the lower 4 bits (bitpositions 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.
· ·· ·Bit position · · · · ·
D
15 12 11 8 7 4 3 0
Bit positions 4 to 15 are filled with 0s.
Destination
Source
D + 1
D + 2
· ·· ·Bit position · · · · ·
S
15 12 11 8 7 4 3 0
Digit 4 Digit 3 Digit 2 Digit 1
Digit 4
Digit 3
Digit 2
Digit 1
D + 3
n
Flag conditionsS 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.
FP0High- level Instructions
3 - 190
3.3 Explanation of High- level Instructions
Outline Converts character constants to ASCII code. 4
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F95 ASC, M ABC1230_DEF, DT 2
S D
Trigger
R20
“_” indicates a space. In actuality, this will be blank.
10
11
ST R 20
F 95 (ASC)
MABC1230_DEF
DT 2
S Character constants (max. 12 letters) (source)
D Starting 16-bit area for storing 6-word ASCII code (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K H Mmodifier
S N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A A N/A
D N/A A A A A A A N/A N/A N/A N/A N/A
Explanation of exampleConverts the character constants “ABC1230_DEF” to ASCII code when execution condition (trigger) R20turns on. The ASCII code is stored in data registers DT7 to DT2.
ASCII HEX code
Data register
ASCII character
DT7
F
DT6
E D
DT5
0
DT4
3 2
2 0 4 6 4 5 4 4 2 0 3 0 3 3 3 2
DT3
1 C
DT2
B A
3 1 4 3 4 2 4 1
[S]
[D]
R20: on
Character constants M A B C 1 2 3 0 D E F
SPACE
Character constant
When the number of character constants specified by S is less than 12, the ASCII code H20 (SPACE) isstored in the extra destination area.
DescriptionConverts the character constants specified by S to ASCII code. The converted ASCII code is stored in 6words starting from the 16-bit area specified by D.
Character → ASCII codeF95 (ASC)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
15
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 191
3.3 Explanation of High- level Instructions
Precautions during programmingThe character constant M can be input with the programming tool software.
Convertion example of one character constant “A”
F95 ASC, MA , DT 2R20
H20DT2: ( )[ H41 (A)
H20DT3: ( )[ H20 ( )[
H20DT5: ( )[ H20 ( )[
H20DT4: ( )[ H20 ( )[
H20DT6: ( )[ H20 ( )[
H20DT7: ( )[ H20 ( )[
Higher byte Lower byte
S: MA ]]]]]]]]]]]
11 spaces
R20: on
F95 ASC, M A , DT 2R20
H20DT2: ( )[
H41 (A)
H20DT3: ( )[ H20 ( )[
H20DT5: ( )[ H20 ( )[
H20DT4: ( )[ H20 ( )[
H20DT6: ( )[ H20 ( )[
H20
DT7:
( )[
H20 ( )[
Higher byte Lower byte
S: M ]]]]]]]]]]]
11 spaces
R20: on
A
F95 ASC, M A , DT 2R20
H20DT2: ( )[
H41 (A)
H20DT3: ( )[ H20 ( )[
H20DT5: ( )[
H20 ( )[
H20DT4: ( )[ H20 ( )[
H20DT6: ( )[ H20 ( )[H20
DT7:
( )[
H20 ( )[
Higher byte Lower byte
S: M ]]]]]]
6 spaces
R20: on
A
5 spaces
]]]]]
FP0High- level Instructions
3 - 192
3.3 Explanation of High- level Instructions
Flag conditionsS 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
HT
BS
BEL
ACK
ENQ
EOT
ETX
STX
SOH
DLENUL0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
b3 b2 b1 b0b6 b5 b4
0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1
0 1 2 3 4 5 6 7
Leas
tsig
nific
antd
igit
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
ASCIIHEX code
b4
b5
b6
Most significant digit
SPACE
DEL
LF
VT
FF
CR
SO
SI
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US
~
!
”
#
$
%
&
’
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]
^
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
b7
b7
FP0 High- level Instructions
3 - 193
3.3 Explanation of High- level Instructions
Outline Searches for a specified value in a block of 16-bit areas.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F96 SRC , DT100 , DT 0 , DT 20
S1 S3
Trigger
S2
R10
10
11
ST R 10
F 96 (SRC)
DT 100
DT 0
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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 N/A A A A A A N/A N/A N/A N/A A
Table data searchF96 (SRC)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 194
3.3 Explanation of High- level Instructions
Explanation of exampleSearches for the value given in data register DT100 in the block of data register DT0 through DT20 whenexecution condition (trigger) R10 turns on.For example, to search the area of the value called H1234, “H1234” would be written to DT100.
Searching
1 2
1 2 3 4
3 4
1 2
DT20:
1 2DT100: 3 4
[S1]
Searched data
0 [S2]
Block of 16-bit areas
DT0:
1 2 1DT1:
1 2 2DT2:
7 F 3DT3:
19DT19:
20 [S3]
1 1
F F
3 4
F F
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.
DescriptionSearches 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 conditionsS 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.
FP0 High- level Instructions
3 - 195
3.3 Explanation of High- level Instructions
Outline Shifts a specified number of bits to the right in bit units.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F100 SHR , DT 0 , K 4
D n
Trigger
R0
10
11
ST R 0
F100 (SHR)
DT 0
K 4
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
n A A A A A A A A A A A
Explanation of exampleShifts 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).
0 0 0 1 1 1 1 0
· ·· ·Bit position · · · · ·DT0
151 0 1
120
110 1 1
80
71 1 0
40
31 0 1
01
R0: on
··· ·Bit position · · · · ·
DT0
150
120
111
80
70
40
31
00
In this case, the higher 4 bitsof DT0 are filled with 0s.
The data in bit position 3 istransferred to R9009 (carry flag).
Right shift of 16-bit data in bitunitsF100 (SHR)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 196
3.3 Explanation of High- level Instructions
DescriptionShifts n bits of the 16-bit data area specified by D to the right (to the lower bit position).
0 0
· · ·Bit position · · · · ·D
15 1211 8 7 4 3 0
· · ·Bit position · · · · ·D
150
120
11 8 7 4 3 0
The higher n bits of D are filled with 0s.
The data in the n th bit is transferred to R9009 (carry flag).
n
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 arange of 1 bit to 255 bits.
— — — —n
Upper 8 bitsare invalid
K0 to K255(H00 to HFF)
0 00 00 00 0
· · · · · · · ·15 1211 8 7 4 3 0
— — — —
Flag conditionsS 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.
FP0 High- level Instructions
3 - 197
3.3 Explanation of High- level Instructions
Outline Shifts a specified number of bits to the left in bit units.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F101 SHL , DT 0 , K 4
nD
Trigger
R0
10
11
ST R 0
F101 (SHL)
DT 0
K 4
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
n A A A A A A A A A A A
Explanation of exampleShifts 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).
1 1 1 0 0 1 0 0
· ·· ·Bit position · · · · ·DT0
151 0 1
120
110 1 1
80
71 1 0
40
31 0 1
01
··· ·Bit position · · · · ·
DT0150
120
111
80
71
41
30
00
In this case, the lower4 bits of DT0 are filled with 0s.
The data in bit position 12is transferred to R9009(carry flag).
Left shift of 16-bit data in bitunitsF101(SHL)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 198
3.3 Explanation of High- level Instructions
DescriptionShifts n bits of the 16-bit area specified by D to the left (to the higher bit position).
0 0
· ·· ·Bit position · · · · ·D
15 1211 8 7 4 3 0
· · ·Bit position · · · · ·D
15 1211 8 7 4 30
00
n bits starting from bit position 0 are filled with 0s.
The data in the n th bit istransferred to R9009(carry flag).
n
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 arange of 1 bit to 255 bits.
n
Upper 8 bitsare invalid
K0 to K255(H00 to HFF)
0 00 00 00 0
· · · · · · · ·15 1211 8 7 4 3 0
— — — — — — — —
Flag conditionsS 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.
FP0 High- level Instructions
3 - 199
3.3 Explanation of High- level Instructions
Outline Shifts one hexadecimal digit (4 bits) of the specified 16-bit data to theright.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F105 BSR , DT 0
D
Trigger
R0
10
11
ST R 0
F105 (BSR)
DT 0
D 16-bit area to be shifted to the right
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
Explanation of exampleShifts one hexadecimal digit (4 bits) in data register DT0 to the right when execution condition (trigger) R0turns on.
The data in hexadecimal digit position 1 (bit positions 0 to 3) is shifted out and transferred to the lower digitposition (bit positions 0 to 3) of special data register DT9014.
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 9
1 0 0 19
· ·· ·Bit position · · · · ·Binary
151
121
111
81
71
41
31 0 0
01
R0: on
9 9 9 9HexadecimalDT0
· · ·Bit position · · · · ·Binary
150
120
111
81
71
41
3 0
0 9 9HexadecimalDT0
· · ·Bit position · · · · ·Binary
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
01
HexadecimalDT9014
(H9999)
(H999)
(H9)
Right shift of one hexadecimaldigit (4 bits) of 16-bit dataF105(BSR)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 200
3.3 Explanation of High- level Instructions
DescriptionShifts one hexadecimal digit (4 bits) of the 16-bit area specified by D to the right (to the lower digit position).
0 0 0
0
· ·· ·Bit position · · · · ·15 1211 8 7 4 3 0
This hexadecimal digit position becomes 0.
HexadecimalD
· · ·Bit position · · · · ·15 1211 8 7 4 3 0
HexadecimalD
· · ·Bit position · · · · ·15 1211 8 7 4 3 0
Hexadecimal
Digit 4 Digit 3 Digit 2 Digit 1
Digit 4 Digit 3 Digit 2
Digit 1DT9014
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 conditionsS 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.
FP0 High- level Instructions
3 - 201
3.3 Explanation of High- level Instructions
Outline Shifts one hexadecimal digit (4 bits) of the specified 16-bit data to theleft.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F106 BSL, DT 0
D
Trigger
R0
10
11
ST R 0
F106 (BSL)
DT 0
D 16-bit area to be shifted to the left
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
Explanation of exampleShiftsone hexadecimaldigit (4bits) in data registerDT0 to the left when executioncondition (trigger)R0 turnson.The data in hexadecimal digit position 4 (bit positions 12 to 15) is shifted out and transferred to the lowerdigit position (bit positions 0 to 3) of special data register DT9014.
0 0 0 0 0 0
0 0 0 8
0 0 0 00
· ·· ·Bit position · · · · ·Binary
151 0 0
120
110 0 0
81
70 0 0
40
30 0 0
00
R0: on
8 1 0 0HexadecimalDT0
· · ·Bit position · · · · ·Binary
150
121
110
80
70
40
3 0
1 0 0HexadecimalDT0
· · ·Bit position · · · · ·Binary
150 0 0
120
110 0 0
80
70 0 0
40
31 0 0
00
HexadecimalDT9014
(H8100)
(H1000)
(H8)
Left shift of one hexadecimaldigit (4 bits) of 16-bit dataF106(BSL)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 202
3.3 Explanation of High- level Instructions
DescriptionShifts 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
This hexadecimal digitposition becomes 0.
HexadecimalD
· · ·Bit position · · · · ·15 1211 8 7 4 3 00HexadecimalD
· ·· ·Bit position · · · · ·15 1211 8 7 4 3 0
0 0 0Hexadecimal
Digit 4 Digit 3 Digit 2 Digit 1
Digit 3 Digit 2 Digit 1
Digit 4DT9014
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 conditionsS 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.
FP0 High- level Instructions
3 - 203
3.3 Explanation of High- level Instructions
Outline Shifts one word (16 bits) of a specified 16-bit data range to the right.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F110 WSHR , DT 0 , DT 2
D1
Trigger
R0
D2
10
11
ST R 0
F110 (WSHR)
DT 0
DT 2
D1 Starting 16-bit area
D2 Ending 16-bit area
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D1 N/A A A A A A N/A N/A N/A N/A A
D2 N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleShifts one word (16 bits) of the data range (3 words) from DT0 through DT2 to the right when executioncondition (trigger) R0 turns on.
Data registerHexadecimal
DT20 2 1 2 0 0 3
DT10 0 2 3
DT02
Data registerHexadecimal
DT20 0 0 0 0 2 1
DT12 0 0 3
DT00
The data in DT0 is shifted out.
Specified data range (3 words)
Right shift of one word (16 bits)of 16-bit data rangeF110 (WSHR)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 204
3.3 Explanation of High- level Instructions
DescriptionShifts one word (16 bits) of the data range specified by D1 (starting) and D2 (ending) to the right (to the lowerword address).
D2
0
The data in the endingword becomes 0.
The starting word is shifted out.
Specified data range
D1
D2 D1
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 conditionsS 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.
FP0 High- level Instructions
3 - 205
3.3 Explanation of High- level Instructions
Outline Shifts one word (16 bits) of a specified 16-bit data range to the left.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F111 WSHL , DT 0 , DT 2
D1
Trigger
R0
D2
10
11
ST R 0
F111 (WSHL)
DT 0
DT 2
D1 Starting 16-bit area
D2 Ending 16-bit area
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D1 N/A A A A A A N/A N/A N/A N/A A
D2 N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleShifts one word (16 bits) of the data range (3 words) from DT0 through DT2 to the left when executioncondition (trigger) R0 turns on.
The data inDT2 is shifted out.
Data register
Hexadecimal
Hexadecimal
DT20 2 1 2 0 0 3
DT10 0 2 3
DT02
DT20 0 3 0 0 2 3
DT12 0 0 0
DT00
Specified data range (3 words)
Data register
Left shift of one word (16 bits)of 16-bit data rangeF111(WSHL)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 206
3.3 Explanation of High- level Instructions
DescriptionShifts one word (16 bits) of the data range specified by D1 (starting) and D2 (ending) to the left (to the higherword address).
Specified data range
D2
0
D1
D2 D1
The data in the startingword becomes 0.
The endingword is shifted out.
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 conditionsS 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.
FP0 High- level Instructions
3 - 207
3.3 Explanation of High- level Instructions
Outline Shifts one hexadecimal digit (4 bits) of a specified 16-bit data range tothe right.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F112 WBSR , DT 0 , DT 9
D1
Trigger
R0
D2
10
11
ST R 0
F112 (WBSR)
DT 0
DT 9
D1 Starting 16-bit area
D2 Ending 16-bit area
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D1 N/A A A A A A N/A N/A N/A N/A A
D2 N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleShifts one hexadecimal digit (4 bits) of the data range (10 words) from DT0 through DT9 to the right whenexecution condition (trigger) R0 turns on.
0 2
R0: on The data “2” in the lowerhexadecimal digit (bit positions 0to 3) is shifted out.
Specified data range (10 words = 40 digits)
1 2 0 0 2 3 2· · · · · · · ·15 1211 8 7 4 3 0
DT9· · · · · · · ·15 1211 8 7 4 3 0
DT0
0 2 1 2 0 0 2 3· · · · · · · ·15 1211 8 7 4 3 0
DT9· · · · · · · ·15 1211 8 7 4 3 0
DT0
· ·15
· ·15
· ·0
· ·00
The higher hexdecimal digit(bit position 12 to 15) becomes 0.
Right shift of one hexadecimaldigit (4 bits) of 16-bit data rangeF112(WBSR)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 208
3.3 Explanation of High- level Instructions
DescriptionShiftsone hexadecimaldigit (4bits)of the data rangespecifiedby D1(starting)and D2(ending) to the right (tothe lower digit position).
The data in the lower hexadecimal digit (bitposition 0 to 3) is shifted out.
Specified data range
· · · · · · · ·15 1211 8 7 4 3 0D2
· · · · · · · ·15 1211 8 7 4 3 0D1
0· · · · · · · ·15 1211 8 7 4 3 0
D2· · · · · · · ·15 1211 8 7 4 3 0
D1
· ·15
· ·15
· · 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 conditionsS 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.
FP0 High- level Instructions
3 - 209
3.3 Explanation of High- level Instructions
Outline Shifts one hexadecimal digit (4 bits) of a specified 16-bit data range tothe left.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F113 WBSL , DT 0 , DT 9
D1
Trigger
R0
D2
10
11
ST R 0
F113 (WBSL)
DT 0
DT 9
D1 Starting 16-bit area
D2 Ending 16-bit area
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D1 N/A A A A A A N/A N/A N/A N/A A
D2 N/A A A A A A N/A N/A N/A N/A A
Explanation of exampleShifts one hexadecimal digit (4 bits) of the data range (10 words) from DT0 through DT9 to the left whenexecution condition (trigger) R0 turns on.
0 2
R0: onThe data “0” in thehigher hexadecimaldigit (bit positions 12to 15) is shifted out.
Specified data range (10 words = 40 digits)
1 2 1 0 2 3 2· · · · · · · ·15 1211 8 7 4 3 0
DT9· · · · · · · ·15 1211 8 7 4 3 0
DT0
2 2 1 0 2 3 2 0· · · · · · · ·15 1211 8 7 4 3 0
DT9· · · · · · ·15 1211 8 7 4 3 0
DT0
· ·15
· ·15
· ·0
· ·01
The lower hexadecimal digit(bit position 0 to 3) becomes 0.
Left shift of one hexadecimaldigit (4 bits) of 16-bit data rangeF113(WBSL)
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 210
3.3 Explanation of High- level Instructions
DescriptionShifts one hexadecimal digit (4 bits) of the data range specified by D1 (starting) and D2 (ending) to the left (tothe higher digit position).
The lower hexadecimal digit(bit positions 0 to 3) becomes 0.
Specified data range
· · · · · · · ·15 1211 8 7 4 3 0D2
· · · · · · · ·15 1211 8 7 4 3 0D1
0· · · · · · · ·15 1211 8 7 4 3 0
D2· · · · · · · ·15 1211 8 7 4 3 0
D1
· ·15
· ·15
· · 0
· · 0
The data in the higherhexadecimal digit (bitposition 12 to 15) isshifted out.
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 conditionsS 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.
FP0 High- level Instructions
3 - 211
3.3 Explanation of High- level Instructions
Outline Sets the UP/DOWN counter.17
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
R1
F118 UDC
R900B
R050
R50
UP/DOWN input
51
58
R2 Reset input52
DT 10
DT 0
Count input S
D
50
51
52
53
58
59
ST R 0
ST R 1
ST R 2
F118 (UDC)
DT 10
DT 0
ST R 900B
OT R 50
S 16-bit equivalent constant or 16-bit area for counter presetvalue
D 16-bit area for counter elapsed value
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D1 A A A A A A N/A N/A A A N/A
D2 N/A A A A A A N/A N/A N/A N/A N/A
Explanation of exampleThe 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 workbeing 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. (DOWNcounter 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.
UP/DOWN counterF118Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5(UDC)
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 212
3.3 Explanation of High- level Instructions
R2
R0
R1
R50onoff
TimePreset
Reset
onoff
onoff
onoff
Valueof DT0
DescriptionThe counter is switched between an incremental count (addition) or decremental count (subtraction) byturning 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 decrementalcounter ( -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). Setvalue 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 isinitialized, 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 thespecified value, using the data comparison instruction.
The data comparison instruction should be executed immediately following execution of this instruction.
Flag conditionsS = 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 programmingIf the elapsed value area has been specified as a hold type memory area, the elapsed value acts inaccordance with the contents being retained.
Be aware that, when an operation is begun, the set values are not automatically preset to the elapsed valuearea. 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, becareful that the programming is correct.For detailed information section 4.6
FP0 High- level Instructions
3 - 213
3.3 Explanation of High- level Instructions
Cautions on count input detectionIn a F118 (UDC) instruction, the increment or decrement takes place when the rise of the count inputfrom off to on is detected.
If the count input remains continuously on, since counting will only take place at the rise, no further countingwill take place.
In cases where the count input is initially on such as when the mode is changed to RUN or the power is turnedon with the mode set to RUN, increment or decrement operation will not take place at the first scan.
Count intput
Operation ofinstruction
No count done Count done
RUN(Power: on)
When you use the F118 (UDC) instruction with one of the following instructions that changes the order of theexecution of instructions, be aware that the operation of the instructions will differ depending on the timing oftheir 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
FP0High- level Instructions
3 - 214
3.3 Explanation of High- level Instructions
Outline Shifts one bit of the 16-bit data range to the left or right.18
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
R1
F119 LRSRR050
Left/right input(on: left, off: right)
51
R2 Shift input52
DT 0
DT 9
Data input D1
D2
Reset input53R3
50
51
52
53
54
ST R 0
ST R 1
ST R 2
ST R 3
F119 (LRSR)
DT 0
DT 9
D1 Starting 16-bit area whose one bit is shifted to the left or to theright
D2 Ending 16-bit area whose one bit is shifted to the left or to theright
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D1 N/A A A A A A N/A N/A N/A N/A N/A
D2 N/A A A A A A N/A N/A N/A N/A N/A
F119(LRSR) Left/right shift register
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 215
3.3 Explanation of High- level Instructions
Explanation of exampleLeft shift operation
Bit positionData
15 . .1211 . . 8 7 . . 4 3 . . 00 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
15 . .12 11 . . 8 7 . . 4 3 . . 01 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0
Bit positionData
15 . .1211 . . 8 7 . . 4 3 . . 00 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0
15 . .12 11 . . 8 7 . . 4 3 . . 00 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0
Shifted-out bit is transferredto R9009 (carry flag).
R0: onR2: off → on
DT9 DT0
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
Bit positionData
15 . .12 11 . . 8 7 . . 4 3 . . 00 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
15 . .12 11 . . 8 7 . . 4 3 . . 01 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0
Bit positionData
15 . .12 11 . . 8 7 . . 4 3 . . 01 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
15 . .12 11 . . 8 7 . . 4 3 . . 00 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0
Shifted-out bit istransferred toR9009 (carry flag).
R0: offR2: off → on
DT9 DT0
DT9 DT0
When data input R1 turns on, “1” is shiftedinto bit position 15.When data input R1 turns off, “0” is shiftedinto bit position 15.
DescriptionThis shift register changes direction, either left (direction of MSB) or right (direction of LSB), in which a shift ofone 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 thatD1 ≦ D2.
When the shift input changes from off to on (the reset input is off), the contents of the area specified by D1 andD2 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 thedata input is on, and 0 if the data input is off. Also, the bit extracted by the shift (the uppermost bit for a shift tothe 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.
FP0High- level Instructions
3 - 216
3.3 Explanation of High- level Instructions
Flag conditionsS 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 detectionIn 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 shiftswill takeplace.
In cases where the shift input is initially on such as when the mode is changed to RUN or when the power isturned on with the mode set to RUN, a shift will not take place at the first scan.
Shift input
Operation ofinstruction
No shift made Shift made
RUN(Power: on)
When you use the F119 (LRSR) instruction with one of the following instructions that changes the order of theexecution of instructions, be aware that the operation of the instructions will differ depending on the timing oftheir 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 programmingWhen combining the F119 (LRSR) instruction with an AND stack instruction or POP stack instruction, becareful that the programming is correct.For detailed information section 4.6
FP0 High- level Instructions
3 - 217
3.3 Explanation of High- level Instructions
Outline Rotates a specified number of bits in specified 16-bit data to the right.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F120 ROR , DT 0 , K 4
D n
Trigger
R0
10
11
ST R 0
F120 (ROR)
DT 0
K 4
D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify number of bits to be rotated
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
n A A A A A A A A A A A
Explanation of exampleRotates 4 bits in data register DT0 to the right when execution condition (trigger) R0 turns on.
1 0 0 0 0 1 0 1
· · ·Bit position · · · · ·DT0
150 0 0
121
110 0 1
80
70 0 1
41
30 1 0
00
R0: on
Bit positionDT0
150
120
110
81
70
40
30
01
0Special internal relayR9009 (carry flag)
Data in bit position 3
· · · · · · · ·
16-bit data right rotateF120(ROR)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 218
3.3 Explanation of High- level Instructions
DescriptionRotates n bits of the 16-bit data specified by D to the right.
Example: Rotates 1 bit to the right
· ·· ·Bit position · · · · ·D
15 1211 8 7 4 3 0
· · ·Bit position · · · · ·D
15 1211 8 7 4 3 0
Special internal relayR9009 (carry flag)
Data in bit position 01
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
01 0 1 0 1 0 1 0 1 0 1 0 1 0 1
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
Range of n: K0 to K255 (H00 to HFF)Upper 8 bitsare invalid
0 00 00 00 0— — — —
Precaution during programmingIf 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 conditionsS 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.
FP0 High- level Instructions
3 - 219
3.3 Explanation of High- level Instructions
Outline Rotates a specified number of bits in specified 16-bit data to the left.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F121 ROL , DT 0 , K 4
D n
Trigger
R0
10
11
ST R 0
F121 (ROL)
DT 0
K 4
D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify number of bits to be rotated
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
n A A A A A A A A A A A
Explanation of exampleRotates 4 bits in data register DT0 to the left when execution condition (trigger) R0 turns on.
0 1 0 1 1 0 0 0
· ·· ·Bit position · · · · ·DT0
150 0 0
121
110 0 1
80
70 0 1
41
30 1 0
00
R0: on
· · ·Bit position · · · · ·DT0
150
120
110
81
70
40
30
01
1Special internal relayR9009 (carry flag) Data in bit position 12
16-bit data left rotateF121(ROL)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 220
3.3 Explanation of High- level Instructions
DescriptionRotates n bits of the 16-bit data specified by D to the left.
Example: Rotates 1 bit to the left
· ·· ·Bit position · · · · ·D
15 1211 8 7 4 3 0
· ·· ·Bit position · · · · ·D
15 1211 8 7 4 3 0
Special internal relayR9009 (carry flag) Data in bit position 150
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
01 0 1 0 1 0 1 0 1 0 1 0 1 0 1
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
Range of n: K0 to K255 (H00 to HFF)Upper 8 bitsare invalid
0 00 00 00 0— — — — — — — —
Precaution during programmingIf 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 conditionsS 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.
FP0 High- level Instructions
3 - 221
3.3 Explanation of High- level Instructions
Outline Rotates a specified number of bits in the specified 16-bit data to the righttogether with carry flag data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F122 RCR , DT 0 , K 4
D n
Trigger
R0
10
11
ST R 0
F122 (RCR)
DT 0
K 4
D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify number of bits to be rotated
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
n A A A A A A A A A A A
Explanation of exampleRotates 4 bits in data register DT0 together with carry flag data “1” to the right when execution condition(trigger) R0 turns on.
0 0 0 0 0 1 0 1
· ·· ·Bit position · · · · ·DT0
150 0 0
121
110 0 1
80
70 0 1
41
30 1 0
00
R0: on
· · ·Bit position · · · · ·DT0
151
121
110
81
70
40
30
01
0Special internal relayR9009 (carry flag)
Data in bit position 3
n-1: 3 bits
Carry flag data “1”
16-bit data right rotate with carryflag dataF122 (RCR)
Step AvailabilityFP0 C10, C14, C16,
C32, T32, SL15
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 222
3.3 Explanation of High- level Instructions
DescriptionRotates 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 · · · · ·D
15 1211 8 7 4 3 0
· ·· ·Bit position · · · · ·D
15 1211 8 7 4 3 0
Special internal relayR9009 (carry flag)
Carry flag data “0”
1
00 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 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
Range of n: K0 to K255 (H00 to HFF)Upper 8 bitsare invalid
0 00 00 00 0— — — — — — — —
Precaution during programmingIf 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 = K0n = K18: same operation as n = K1
n = K34: same operation as n = K0n = K35: same operation as n = K1
Flag conditionsS 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.
FP0 High- level Instructions
3 - 223
3.3 Explanation of High- level Instructions
Outline Rotates a specified number of bits in the specified 16-bit data to the lefttogether with carry flag data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F123 RCL , DT 0 , K 4
D n
Trigger
R0
10
11
ST R 0
F123 (RCL)
DT 0
K 4
D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify number of bits to be rotated
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
n A A A A A A A A A A A
Explanation of exampleRotates 4 bits in data register DT0 together with carry flag data “1” to the left when execution condition(trigger) R0 turns on.
0 1 0 1 1 0 0 0
R0: on
· · ·Bit position · · · · ·DT0
150
120
110
81
70
40
31
00
Data in bit position 12
Carry flag data “1”
1Special internal relayR9009 (carry flag)
· ·· ·Bit position · · · · ·DT0
150 0 0
121
110 0 1
80
70 0 1
41
30 1 0
00
16-bit data left rotate with carryflag dataF123 (RCL)
Step AvailabilityFP0 C10, C14, C16,
C32, T32, SL15
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 224
3.3 Explanation of High- level Instructions
DescriptionRotates 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 · · · · ·D
15 1211 8 7 4 3 0
· · ·Bit position · · · · ·D
15 1211 8 7 4 3 0
Special internal relayR9009 (carry flag)
Carry flag data “0”
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
01 0 1 0 1 0 1 0 1 0 1 0 1 0 1
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
Range of n: K0 to K255 (H00 to HFF)Upper 8 bitsare invalid
0 00 00 00 0— — — — — — — —
Precaution during programmingIf 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 = K0n = K18: same operation as n = K1
n = K34: same operation as n = K0n = K35: same operation as n = K1
Flag conditionsS 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.
FP0 High- level Instructions
3 - 225
3.3 Explanation of High- level Instructions
Outline Turns on a specified bit of 16-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F130 BTS , DT 0 , DT 2
D n
Trigger
R0
10
11
ST R 0
F130 (BTS)
DT 0
DT 2
D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify bit position
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
n A A A A A A A A A A A
Explanation of exampleTurns on bit position specified by DT2 in data register DT0 when execution condition (trigger) R0 turns on.
When the DT2 = K7, as shown below.
1 0 0 1 0 1 0 0
· ·· ·Bit position · · · · ·DT0
150 1 0
120
110 0 1
81
70 0 1
40
30 0 0
01
R0: on
· · ·Bit position · · · · ·DT0
150
120
110
81
71
40
30
01
Bit position 7 is turned on (1) when R0 turns on.(Bits other than the specified bit do not change.)
[D]
[D]
[n] DT2: K7
16-bit data bit setF130 (BTS)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 226
3.3 Explanation of High- level Instructions
DescriptionTurns 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
n· ·· ·Bit position · · · · ·15 1211 8 7 4 3 0
The data in bitpositions 4 through 15are invalid.
Range of n: K0 to K15 (H0 to HF)
— — — — — — — — — — — —
Flag conditionsS 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.
FP0 High- level Instructions
3 - 227
3.3 Explanation of High- level Instructions
Outline Turns off a specified bit of 16-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F131 BTR , DT 0 , DT 2
D n
Trigger
R0
10
11
ST R 0
F131 (BTR)
DT 0
DT 2
D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify bit position
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
n A A A A A A A A A A A
Explanation of exampleTurns off the bit specified by DT2 of data register DT0 when execution condition (trigger) R0 turns on.
When the DT2 = K7, as shown below.
1 0 1 0 0 1 0 1
· ·· ·Bit position · · · · ·DT0
151 1 0
121
111 1 0
80
71 0 1
41
31 0 1
00
R0: on
··· ·Bit position · · · · ·
DT0
151
121
111
80
70
41
31
00
[D]
[D]
[n] DT2: K7
Bit position 7 is turned off (0) when R0 turns on.(Bits other than the specified bit do not change.)
16-bit data bit resetF131(BTR)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 228
3.3 Explanation of High- level Instructions
DescriptionTurns 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
n· ·· ·Bit position · · · · ·15 1211 8 7 4 3 0
The data in bitpositions 4 through 15are invalid.
Range of n: K0 to K15 (H0 to HF)
— — — — — — — — — — — —
Flag conditionsS 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.
FP0 High- level Instructions
3 - 229
3.3 Explanation of High- level Instructions
Outline Inverts a specified bit in 16-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F132 BTI , DT 0 , DT 10
D n
Trigger
R0
10
11
ST R 0
F132 (BTI)
DT 0
DT 10
D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify bit position
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
n A A A A A A A A A A A
Explanation of exampleInverts 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.
0 0 0 0 0 1 0 1
· · ·Bit position · · · · ·DT0
150 0 0
120
110 0 0
81
70 0 1
41
30 0 1
00
R0: on
· · ·Bit position · · · · ·DT0
150
120
110
81
71
41
30
00
Condition of bit position 7 is inverted [off (0) → on (1)] when R0 turns on.(Bits other than the specified bit are not changed.)
[D]
[D]
[n] DT10: K7
16-bit data bit invertF132(BTI)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 230
3.3 Explanation of High- level Instructions
DescriptionInverts [off (0) → on (1) or on (1) → off (1)] the state at bit position specified by n in the 16-bit area specified byD.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
n· ·· ·Bit position · · · · ·15 1211 8 7 4 3 0
The data in bitpositions 4 through 15are invalid.
Range of n: K0 to K15 (H0 to HF)
— — — — — — — — — — — — 0 0 0 0
Flag conditionsS 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.
FP0 High- level Instructions
3 - 231
3.3 Explanation of High- level Instructions
Outline Checks the state [on (1) or off (0)] of the specified bit in 16-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F133 BTT , DT 0 , DT 2
D n
16
Trigger
R0
R0 R900B R10
10
11
16
17
18
ST R 0
F133 (BTT)
DT 0
DT 2
ST R 0
AN R 900B
OT R 10
D 16-bit area
n 16-bit equivalent constant or 16-bit area to specify bit position
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D N/A A A A A A A A N/A N/A A
n A A A A A A A A A A A
Explanation of exampleChecks 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.
The state of bit position 7 is checked.
· ·· ·Bit position · · · · ·DT0
150 1 0
120
110 0 1
81
70 0 1
40
30 0 0
01[D]
[n] DT2:K7
If bit position 7 is in the off state (0), R900B turns on and internal relay R10 goes on.
16-bit data bit test5
F133 (BTT)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 232
3.3 Explanation of High- level Instructions
DescriptionChecks the state [on (1) or off (0)] of bit position specified by n in the 16-bit data specified by D. The judgmentresult 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
n· ·· ·Bit position · · · · ·15 12 11 8 7 4 3 0
The data in bit positions4 through 15 are invalid.
Range of n: K0 to K15 (H0 to HF)
— — — — — — — — — — — — 0 0 0 0
Precaution when the judgement flag R900B is used two or more timesThe judgment flag R900B is updated each time an operation instruction or comparison instruction isexecuted.
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 conditionsS 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.
FP0 High- level Instructions
3 - 233
3.3 Explanation of High- level Instructions
Outline Counts the number of bits in the on (1) state in the specified 16-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F135 BCU , DT10 , DT 20
S D
Trigger
R0
10
11
ST R 0
F135 (BCU)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
D N/A A A A A A A A N/A N/A A
Explanation of exampleCounts the number of bits in the on (1) state in data register DT10 when execution condition (trigger) R0 turnson. The number of on (1) bits is stored in data register DT20.
· ·· ·Bit position · · · · ·Binary data
150 0 0
120
110 0 0
81
70 0 1
41
30 1 0
01
DT10
The number of on (1) bits is “5”.
The K5 is stored in data register DT20 when R0 turns on.
DescriptionCounts the number of bits in the on (1) state in the 16-bit dataspecified 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 conditionsS 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.
Number of on bits in 16-bit data5
F135 (BCU)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 234
3.3 Explanation of High- level Instructions
Outline Counts the number of bits in the on (1) state in specified 32-bit data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F136 DBCU , DT10 , DT20
S D
Trigger
R0
10
11
ST R 0
F136 (DBCU)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A A
D N/A A A A A A A N/A N/A N/A A
Explanation of exampleCounts 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.
· ·· ·Bit position · · · · ·Binary data
150 0 1
121
110 0 1
80
70 0 0
40
30 0 0
01
· ·· · · · · · ·150 0 0
120
110 0 0
81
70 0 1
41
30 1 1
00
DT11 DT10
The number of on (1) bits is “9”.
The K9 is stored in data register DT20 when R0 turns on.
DescriptionCounts the number of bits in the on (1) state in the 32-bit dataspecified 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 conditionsS 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.
Number of on bits in 32-bit data5
F136 (DBCU)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 235
3.3 Explanation of High- level Instructions
Outline Sets the 16-bit on-delay timer for 0.01 s units (0.01 to 327.67 s)
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F137 STMR , DT10 , DT20
S D
Trigger
R0 R5
10
11
16
ST R 0
F137 (STMR)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A N/A
D N/A A A A A A N/A N/A N/A N/A N/A
Explanation of exampleWhen the execution condition (trigger) has been fulfilled, the auxiliary timer is activated, and when the valuestored in DT10 x 0.01 seconds has elapsed, R5 goes on.
DescriptionThis functions as a 0.01-second unit on delay timer. When the execution condition (trigger) is on, subtractionis carried out for the specified time, and when the elapsed value D reaches 0, relays which are being used areturned on by the OT instruction which follows in the program.
When the execution condition (trigger) is off, the elapsedvalue area is cleared to 0, and relaysbeing usedareturned 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, andwhile subtraction is being carried out.)
R0
R900D R5
F137 STMR, DT10,DT20
Operation is the same as that in the program example.
16-bit auxilialy timer5
F137Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5(STMR)
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 236
3.3 Explanation of High- level Instructions
Timer set timeThe 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 programmingThe area in which the set value is stored must be set so that the area specified for the elapsed value does notoverlap any areas reserved for other timer or counter instructions, or memory areas used for high- levelinstruction operations.
Because subtraction is carried out when operations are carried out, the program should be set up so thatoperations are carried out every scan.(In cases such as programs where interrupt operation is carried out, or for jump or loop instructions, whereseveral operations are carried out during one scan, or where it was not possible to carry out any operationduring the scan, correct results cannot be obtained.)
Consecutive OT instructions may be used in the program.
How the auxiliary timer works1 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
R900D
R5F137 STMR, DT10, DT20
F0 MV, DT30, DT40 DT20K500
S
1 Sent to D.
DT10K500
2 If the execution condition (trigger) stays on, every scan, the value in the elapsed value area D issubtracted.
R0
R900D
R5F137 STMR, DT10, DT20
F0 MV, DT30, DT40
2 Subtraction499498497
DT20K500
3 If the value in the elapsed value area D reaches 0, relay being used is turned on by the OT instructionwhich comes next in the program. The special internal relay R900D also goes on at this point.
R0
R900D
R5F137 STMR, DT10, DT20
F0 MV, DT30, DT40
3 Subtraction completed
DT200
FP0 High- level Instructions
3 - 237
3.3 Explanation of High- level Instructions
Precautions when using R900DIf R900D is used and multiple auxiliary timers are being used, always use R900D in the line following theauxiliary timer instruction.
R0
R900D Y0
F137 STMR, DT10, DT20
R1
R900D Y1
F137 STMR, DT30, DT40
Pair
Pair
When timer (a), which is activated by R0 turns on, expires, Y0 goes on. When timer (b), which is activated byR1 turns on, expires, Y1 goes on.
Describe the program as shown below will result in incorrect operation.
R1
R0
R900D Y0
R900D Y1
F137 STMR, DT10, DT20
F137 STMR, DT30, DT40
FP0High- level Instructions
3 - 238
3.3 Explanation of High- level Instructions
Outline Turns on special internal relay R9009 (carry flag).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F140 STC
Trigger
R0
10
11
ST R 0
F140 (STC)
DescriptionSpecial internal relay R9009 (carry flag) goes on.
Flag conditionCarry flag (R9009): Turns on when this instruction is executed.
Carry flag (R9009) set5
F140 (STC)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
1
FP0 High- level Instructions
3 - 239
3.3 Explanation of High- level Instructions
Outline Turns off special internal relay R9009 (carry flag).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F141 CLC
Trigger
R0
10
11
ST R 0
F141 (CLC)
DescriptionSpecial internal relay R9009 (carry flag) goes off.
Flag conditionCarry flag (R9009): Turns off when this instruction is executed.
Carry flag (R9009) reset5
F141(CLC)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
1
FP0High- level Instructions
3 - 240
3.3 Explanation of High- level Instructions
Outline Updates specified partial I/O points.Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F143 IORF , WX 0 , WX 0
D1 D2Trigger
R10
Input update
20 F143 IORF , WY 0 , WY 0
D1 D2
R20Output update
10
11
20
21
ST R 10
F143 (IORF)
WX 0
WX 0⋮
ST R 20
F143 (IORF)
WY 0
WY 0
D1 Starting word address
D2 Ending word address
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
D1 A A N/A N/A N/A N/A N/A N/A N/A N/A A
D2 A A N/A N/A N/A N/A N/A N/A N/A N/A A
Explanation of exampleUpdates external input relays WX0 (X0 to XF) immediately when execution condition (trigger) R10 turns onand updatesexternaloutput relaysWY0 (Y0 to YF) immediately when execution condition (trigger) R20 turnson.
DescriptionUpdates 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.
Partial I/O update5
F143(IORF)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
1
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 241
3.3 Explanation of High- level Instructions
Outline Communicates with an external device using the RS232C port.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
Trigger
S n
10R0
F144 TRNS, DT 100, K 8
1
1
DF
10
11
12
ST R 0
DF
F144 (TRNS)
DT 100
K 8
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S N/A N/A N/A N/A N/A A N/A N/A N/A N/A A
n A A A A A A A A A A A
DescriptionUse this instruction for transmission and reception of command data when an external device (personalcomputer, measuring instrument, bar code reader, etc.) is connected to the RS232C port.
Transmission page 3 - 243The n bytes of the data stored in the data table with the starting area specified by S are transmitted from theRS232C 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 theusage range of the data register.
Reception page 3 - 245Reception 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 receptionbuffer selected in system registers 417 and 418. When an F144 (TRNS) instruction is executed, receptioncompleted flag (R9038) goes off.
For an overview of serial communications section 6.1
F144 Serial data communicationcontrol for RS232C port
Step Availability
FP0 T32C/FP0 C10,C14, C16, C32 CPU
Ver. 1.2 or later
5(TRNS)
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 242
3.3 Explanation of High- level Instructions
Setting the use of the RS232C portTo 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 complexmodem settings have been entered. Also, it is normally used with a computer link, but in an emergency it canalso be used for transmissions from the PLC to a higher- level computer.) Set n (the number of transmissionbytes) to H8000, and then execute the instruction.
When executed when “computer link” is selected, the setting will change to “general purpose port.”
F144 TRNS, DT100, H8000
Set to H8000.In this case, theparameter is disabledregardless of the number.
R0 R9032DF 1
1
When executed when “general purpose port” is selected, the setting will change to “computer link.”
F144 TRNS, DT100, H8000
R0 R9032DF 1
1
R9032: RS232C port selection flagThis flag turns on when “General purpose port” is selected.
NoteWhen the power is turned on, the port use will revert to thesetting of system register 412.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 243
3.3 Explanation of High- level Instructions
Program and Operation during TransmissionTo transmit, write the transmission data to the data table, select it with an F144 (TRNS) instruction, andexecute.
Data table for transmissionData 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]
[S+2]
[S+n]
12
34
2n 2n-1
Storage area for transmission data (the circlednumbers indicate the order of transmission).
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 thestarting area of the data table.
NoteTake care that the transmission data table and reception bufferareas (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 bytesof data)In this example, the data table is DT100 to DT104.
DT100 The number of bytes not yet transmitted isstored at each transmission.
DT101
DT102
DT104
H42(B)
H41(A)
H44(D)
H43(C)
H48(H)
H47(G)
Data is transmittedin order from thelower byte.DT103 H46
(F)H45(E)
K8
Data table before transmission
FP0High- level Instructions
3 - 244
3.3 Explanation of High- level Instructions
ProgramSelect the starting address of the transmission data table with S and the number of transmission data byteswith n.
R0F1 DMV, H44434241, DT101
F1 DMV, H48474645, DT103
F144 TRNS, DT100, K 8
Write the transmissiondata to the data table
Transmit the data inthe data table
R1DF 1
1
OperationIf 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 thebeginning of the data.
The end code selected in system register 413 is automatically added to the end of the data.
A B C D E F G H (CR)
DT101 DT102 DT103 DT104Sendingdata
Number of bytes notyet transmitted (DT100)
7 6 5 4 3 2 1 08
R9039
Execution condition(trigger) R1
During transmission (F144 (TRNS) instruction cannot be executed.)F144 (TRNS)execution
onoff
onoff
3) When the specified quantity of data has been transmitted, the value in S (the number of bytes not yettransmitted) will be zero and the sending completed flag (R9039) will go on.
Transmission without an end codeSpecify 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 endcode
R0DF 1
1 F144 TRNS, DT100, K-8
Set to K-8.
FP0 High- level Instructions
3 - 245
3.3 Explanation of High- level Instructions
Program and Operation during ReceptionData sent from the external device connected to the RS232C port will be stored in the data register areas setas the reception buffer.
Word(address) 0
Area used fornumber of bytesreceived
1
2
n
12
2n 2n-1
Area used for storing received data(the circled numbers indicate theorder of reception)
Reception buffer
34
Each time data is received, the amount of data received (number of bytes) is stored as a count in the leadingaddress 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 thesecond 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 deviceThe reception buffer is DT200 to DT204 in this example.System register settings are as follows:- System register 417: K200- System register 418: K4
DT200Each time data is received,the number of bytes receivedis stored.
DT201
DT202
DT204
H42(B)
H41(A)
H44(D)
H43(C)
H48(H)
H47(G)
The reception data isstored in order from thelower byte.
DT203 H46(F)
H45(E)
K8
Reception buffer whenreception is completed
FP0High- level Instructions
3 - 246
3.3 Explanation of High- level Instructions
ProgramWhen 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.
R0F144 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.
OperationWhen the reception completed flag (9038) is off and data is sent from an external device, operation willproceed 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.
A B … T U V(CR)
Reception operationstart
Received data
Number of bytesreceived
1 2 20 0 1 20
R9038
Execution condition(trigger) R0
Reception:possible
…
…
…
Reception:possible
Reception:impossibility
Reopening
onoff
onoff
F144 (TRNS)execution
2) When an end code is received, the reception completed flag (R9038) goes on. After this, no furtherreception of data is allowed.
3) When an F144 (TRNS) instruction is executed, the reception completed flag (R9038) goes off andthe number of received data bytes is cleared to zero. Further data received is stored in order in thereception data storage area beginning from the lower byte of the second word of the area.
NoteFor repeated reception of data, refer to the following procedure.1. Receive data2. Reception completed (R9038: on, reception not allowed)3. Process received data4. Execute F144 (TRNS) instruction (R9038: off, reception)5. Receive further data
FP0 High- level Instructions
3 - 247
3.3 Explanation of High- level Instructions
Outline Outputs ASCII codes to the printer.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10
12
(DF ) F147 PR , DT 0 , WY 0
Trigger
R0
R9033S D
Printout flag
10
11
12
14
ST R 0
DF
OR R 9033
F147 (PR)
DT 0
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A N/A N/A N/A N/A N/A
D N/A A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Explanation of exampleThe ASCII codes stored in data registers DT5 to DT0 are output through word external output relay WY0when execution condition (trigger) R0 turns on.
ASCII HEX code
Data register
ASCII character
DT5
LF
DT4
J I
DT3
G
DT2
F E0D0A 4A 49 48 47 46 45
DT1
D C
DT0
B A44 43 42 41
Destination
Source: ASCII code for 12 character A, B, C, D, E, F, G, H, I and J
R0: on
WY0
ASCII codes
Y9 to YF: not used
Control data for printer
YF YE YD YC YB YA Y9 Y8 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
Y0 to Y7: for data signals of printer(Y0 to Y7 correspond to DATA1 to DATA8 of printer.)
Y8: for strobe signal of printer
CR H
5
F147(PR) Parallel printout
Step AvailabilityFP0 C10, C14, C16,
C32, T32, SL15
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 248
3.3 Explanation of High- level Instructions
DescriptionOutputs the ASCII codes for 12 characters stored in the 6-word area specified by S through the word externaloutput relay WY specified by D.
S !WY (DATA1 to DATA8, STROBE)
S+1
S+2
S+3
S+4
S+5
15 0
If the specified output is connected to a commercial printer, the characters corresponding to the output ASCIIcode are printed.
Only bit positions 0 to 8 of WY are used in the actual printout.
WY0
Y9 to YF: not used
YF YE YD YC YB YA Y9 Y8 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
Y0 to Y7: for data signals of printer(Y0 to Y7 correspond to DATA1 to DATA8 of printer.)
Y8: for strobe signal of printer
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.
Threescansare required for 1character constant output.Therefore, 37 scans are required until 12 characterconstants are output. (See “Time chart” on the next page.)
Precautions during programmingMultiple F147 (PR) instructions cannot be executed at the same time. The program should be set up so thatthe 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 ASCIIcodes.
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 conditionsS 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.
FP0 High- level Instructions
3 - 249
3.3 Explanation of High- level Instructions
Connection example
Y0Y1Y2Y3Y4Y5Y6Y7Y8
:COM
DATA1DATA2DATA3DATA4DATA5DATA6DATA7DATA8STROBE
GND
Printer(centronics interface)FP0-C32T
Data setting
ASCII HEX code
Data register
ASCII character
DT5
LF
DT4
J I
DT3
G
DT2
F E0D0A 4A 49 48 47 46 45
DT1
D C
DT0
B A44 43 42 41
Example: ASCII code for 10 character A, B, C, D, E, F, G, H, I and J
ASCII codesControl data for printer
CR H
Time chart
H41 H42 H43 H44 H45 H0D H0A
A B C D E CR LF
onoff
ASCII HEX code (Y0 to Y7)
Strobe signal (Y8)
R9033
0 1 2 3 4 5 6 7 8 9 1011 121314151617 323334353637Number of scans
F147 (PR) instruction execution
Signal ofoutput unit
onoff
FP0High- level Instructions
3 - 250
3.3 Explanation of High- level Instructions
Using printer output during 8-point outputWhen only eight output points are being used, connections should be made as shown below, and theprogram should be set up so that the strobe signal is output from Y7.
Y0Y1Y2Y3Y4Y5Y6Y7
COM
DATA1DATA2DATA3DATA4DATA5DATA6DATA7DATA8STROBE
GND
Printer(centronics interface)
Connection example
FP0-C16T/C32T
R0F147 PR, DT0, WY0
R9033
Y8 Y7Strobe signal is output from Y7.
Program example
FP0 High- level Instructions
3 - 251
3.3 Explanation of High- level Instructions
Outline Sets the specified condition as a self-diagnostic error.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F148 ERR , K 100
nTrigger
R0
Self-diagnostic error set
20 F148 ERR , K 0
n
R1Self-diagnostic error clear
Trigger
10
11
20
21
ST R 0
F148 (ERR)
K 100⋮
ST R 1
F148 (ERR)
K 0
n Self-diagnostic error code number Range: 0 and 100 to 299
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
n N/A N/A N/A N/A N/A N/A N/A N/A A A N/A
Explanation of exampleThe self -diagnosis error 100 is set when the execution condition (trigger) R0 turns on. The ERROR/ALARMLED 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 R0turns on.)
When the execution condition (trigger) R1 turns on, self -diagnostic errors of error codes 43 and higher arecleared.
DescriptionAlong with self -diagnostic error codes specified by n being stored in the special data register DT9000, theself -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 isexecuted.
“n” setting Operation when erroroccurs
K100 to K199 Operation stops
K200 to K299 Operation continues
Self-diagnostic error set5
F148 (ERR)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
3
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 252
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 andhigher 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 errorSelf -diagnostic errors are checked in the normal way (see section 8.7)
Flag conditionsS 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.”
FP0 High- level Instructions
3 - 253
3.3 Explanation of High- level Instructions
Outline Displays the specified character constant on the screen of the FPprogrammer II.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F149 MSG , M TEST PROGRAM
S
Trigger
R0
10
11
ST R 0
F149 (MSG)
M TEST PROGRAM
S Character constant for message
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K H Mmodifier
S N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A A N/A
Explanation of exampleDisplays the message “TEST PROGRAM” on the screen of the FP programmer II when execution condition(trigger) R0 turns on.
DescriptionThis 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 messagespecified 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
WRTACLROP(- ) 1 1 1 ENT
SCSHIFT using the FP programmer II.
Message display5
F149(MSG)Step Availability
FP0 C10, C14, C16,C32, T32, SL1
13
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 254
3.3 Explanation of High- level Instructions
Outline Controls the software reset, disabling of the counter and stops pulseoutputs.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10
F0 MV , H 1111 , DT9052
D High speed countercontrol register
Trigger
R3
1
DF 1
10
11
12
ST R 3
DF
F0 (MV)
H 1111
DT 9052
S 16-bit equivalent constant or 16-bit area to specify high-speed counter operation
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A A A A A
DescriptionControls 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.
High-speed counter controlF0Step Availability
FP0 C10, C14, C16,C32, T32, SL1
5(MV)
A: Available
FP0 High- level Instructions
3 - 255
3.3 Explanation of High- level Instructions
High-speed counter control flagThe 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.
DT9052/DT90052:
15 12 11 8 7 4 3 0
ch3 ch2 ch1 ch0
Control codeH0 to HF entered by F0 (MV) instruction.
For more details on how to use the high-speed counter mode setting Chapter 5
Flag conditionsS 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.
Clears high-speed counter instruction0: Continuous1: Clear (pulse output stopped during
pulse output control)
Hardware reset0: Enabled1: Disabled (near home input
effective during pulseoutput control)
Control code “S” = H V V V V (binary)
Software reset0: Does not perform software reset1: Does perform software reset
Counting0: Enable1: Disable
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.
FP0High- level Instructions
3 - 256
3.3 Explanation of High- level Instructions
Programming example
Example 1: Soft reset the high-speed counter CH0.
R0DF F0 MV, H1, DT9052
F0 MV, H0, DT9052
Example 2: Enable the near home inputting during pulse output control anddecelerate movement.
X3DF F0 MV, H4, DT9052
F0 MV, H0, DT9052
Precautions during programmingThe 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 isnecessary to enter 1 to the corresponding bit each cycle.
FP0 High- level Instructions
3 - 257
3.3 Explanation of High- level Instructions
Outline Sets or reads elapsed value of the high-speed counter.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F1 DMV , K 3000 , DT9044
S Elapsed valuearea of
high-speedcounter
Trigger
R0DF
20 F1 DMV , DT9044 , DT 6
Trigger
R10DF
DElapsed value area ofhigh-speed counter
Setting
Reading
10
11
12
::
20
21
22
ST R 0
DF
F1 (DMV)
K 3000
DT 9044
::
ST R 10
DF
F1 (DMV)
DT 9044
DT 6
S 32-bit equivalent constant or lower 16-bit area of 32-bit data for storing a newelapsed value of high-speed counter to be changed (source)
D Lower 16-bit area of 32-bit area (destination)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A A
D N/A A A A A A A N/A N/A N/A A
Set and read of elapsed value ofhigh-speed counterF1
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7(DMV)
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 258
3.3 Explanation of High- level Instructions
Setting the Elapsed ValueSimultaneouslywrites the 32 bitsdataspecified in “S” to the elapsed valuearea corresponding to the channelof the high-speed counter used and sets the elapsed value area of the high-speed counter used inside thesystem.
Explanation of exampleWhen execution condition (trigger) R0 turns on, K3000 is written into the high-speed counter elapsed valuearea 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 asthe 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 ofthe lower 16 bits.
For more details on how to use the high-speed counter mode setting Chapter 5
Reading the Elapsed ValueThe elapsed value of the high-speed counter is read from the special data registers DT9044, DT9045 andthe area specified in the “D.”
Explanation of exampleWhen the execution condition (trigger) R10 turns on, the elapsed value of the high-speed counter istransferred to data registers DT6 and DT7.
Whenusing the high-speed counter, the elapsedvalue is read to elapsed valuearea when the ED instructionis executed during each scan regardless of this instruction.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 259
3.3 Explanation of High- level Instructions
Application examples
Example 1: Set the set value of the data register DT4 for the high-speedcounter at the input of R0.
R0DF F1 DMV, DT4, DT9044
Down inputX0
0Setting set value
R0
Value in DT4
Time
Example 2: Store the elapsed value of the high-speed counter into dataregister DT100 at the input of R1.
R1DF F1 DMV, DT9044, DT100
Example 3: Internal relay R0 turns on when the elapsed value of thehigh-speed counter exceeds K10000.
R9010
R900A R0
F1 DT9044, DT0
F61 DCMP, DT0, K10000
Channel number and elapsed value chartHigh-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
FP0High- level Instructions
3 - 260
3.3 Explanation of High- level Instructions
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
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
DF10 F166 HC1S , K 0 , K10000 , Y0
Dn
Trigger
R0
S
10
11
12
ST R 0
DF
F166 (HC1S)
K 0
K 10000
Y 0
n The channel No. of the high-speed counter that corresponds to the matchingoutput (n: K0 to K3).
S The high-speed counter target value data or the starting address of the areathat contains the data.
D The output coil that is turned on when the values match (Yn n: 0 to 7)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Explanation of example
Target value10000
0
R0
R903A
Y0
Elapsed value
Completion (clear) ofF166 (HC1S) instruction control
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
Target value match oninstruction (with channelspecification)F166
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11(HC1S)
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 261
3.3 Explanation of High- level Instructions
DescriptionSets the numerical value specified by S as the target value for the high-speed counter. When the elapsedvalue 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 ismatched.
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 programmingAfter theexecutioncondition (trigger) for the F166(HC1S) instruction turnson anduntil the target valuematchoutput turns on, the high-speed counter control flag for the correspondingchannel (refer to section5.2) is on.
When the high-speed counter control flag for the specified channel is on, other high-speed counterinstructions (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 settingswill 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 doubledup 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 RSTinstruction 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 informationsection 5.3
Flag conditionsS 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.
FP0High- level Instructions
3 - 262
3.3 Explanation of High- level Instructions
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
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F167 HC1R , K0 , K -200 , Y0
Dn
Trigger
R0
S
DF
10
11
12
ST R 0
DF
F167 (HC1R)
K 0
K - 200
Y 0
n The channel No. of the high-speed counter that corresponds to the matchingoutput (n: K0 to K3).
S The high-speed counter target value data or the starting address of the areathat contains the data.
D The output coil that is turned off when the values match (Yn n: 0 to 7)
Operands
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
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
D N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Explanation of example
Target value-200
0
R0
R903A
Y0
Elapsed value
Completion (clear) ofF167 (HC1R) instruction control
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
Target value match offinstruction (with channelspecification)F167
Step Availability
FP0 C10, C14, C16,C32, T32, SL1
11(HC1R)
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 263
3.3 Explanation of High- level Instructions
DescriptionSets the numerical value specified by S as the target value for the high-speed counter. When the elapsedvalue 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 ismatched.
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 programmingAfter the execution condition (trigger) for the F167 (HC1R) instruction turns on and until the target valuematch output turns off, the high-speed counter control flag for the corresponding channel (refer to section5.2) is on.
When the high-speed counter control flag for the specified channel is on, other high-speed counterinstructions (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 settingswill 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 doubledup 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 SETinstruction 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 informationsection 5.3
Flag conditionsS 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.
FP0High- level Instructions
3 - 264
3.3 Explanation of High- level Instructions
Outline Outputs a pulse from the specified output (Y0 or Y1) according to thespecified parameter.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F168 SPD1 , DT100 , K 0
S n
Trigger
R10DF
10
11
12
ST R 10
DF
F168 (SPD1)
DT 100
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S N/A N/A N/A N/A N/A A N/A N/A N/A N/A A
n N/A N/A N/A N/A N/A N/A N/A N/A A A N/A
DescriptionWhen the corresponding control flag is off and the execution condition (trigger) is in the on state, a pulse isoutput from the specified output (Y0 or Y1).
The control code, initial speed, maximum speed, acceleration/deceleration time, and target value, arespecified 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 speedto the maximum speed.
See below for the corresponding areas.
Channelno.
Controlflag
Elapsed valuearea
Target valuearea
Directionaloutput Near home Home input
ch0 R903A DT9044, DT9045/DT90044, DT90045
DT9046, DT9047/DT90046, DT90047 Y2 DT9052/DT90052
<bit2> X0
ch1 R903B DT9048, DT9049/DT90048, DT90049
DT9050, DT9051/DT90050, DT90051 Y3 DT9052/DT90052
<bit6> X1
Notes
• When this instruction is used, the setting for the channelcorresponding 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.
Positioning control (trapezoidalcontrol/home return: withchannel specification)
5
F168Step Availability
5(SPD1) FP0 C10, C14, C16,C32, T32, SL1
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 265
3.3 Explanation of High- level Instructions
Description of operating modeIncremental (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 thetarget value is negative, the directional output turns on and the elapsed value of the high-speed counterdecreases. 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 differencebetween 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 thetarget 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 valueof the high-speed counter decreases. By setting H13 in the control code, the directional output is the reverseof that above.
Home returnUntil the home input (X0 or X1) is entered, the pulse is continuously output. To decelerate the movement whennear 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, andacceleration/deceleration time of the data table.During operation, the elapsed value area and set value area will become insufficient. At the completion ofoperations, 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)
S+2 Maximum speedFmax (Hz) K40 to K9500 (Hz) *2
S+3 Acceleration/deceleration time t (ms) K30 to K32767 (ms)
S+4 Target value K-8388608 to K8388607 *3
S+5Target value(pulse number)
S+6 K0 Specify “K0” *3
f
t
Output pulsenumber
tAccelerationtime
Fmax
Fmin
tDecelerationtime
FP0High- level Instructions
3 - 266
3.3 Explanation of High- level Instructions
*1: Specify the control code by setting the constant H.
Operation mode and directional output theory00: Does not use incremental directional output02: Incremental forward off/reverse on03: Incremental forward on/reverse off10: Does not use absolute directional output12: Absolute forward off/reverse on13: Absolute forward on/reverse off20: No home return directional output22: Home return directional output off23: Home return directional output on24: 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.
H j j j
Pulse width specification0: Duty 50%1: Fixed pulse width (approx. 80µs)
*2: When the pulse width is set to duty 50%, the maximum is 6kHz. When the pulse width is setto 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 detailson troubleshootingprocedures when no pulse is outputwhen F168(SPD1) instruction is executedpage 5 - 32
Flag conditionsS 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.
FP0 High- level Instructions
3 - 267
3.3 Explanation of High- level Instructions
Application exampleR0
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
R1F168 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
Number ofoutput pulse:100,000
300ms 300ms
7kHz
1kHz
f = (7000 - 1000) ÷ 30 steps = 200 (Hz)t = 300ms ÷ 30 steps = 10ms
t
f
FP0High- level Instructions
3 - 268
3.3 Explanation of High- level Instructions
Outline Outputs the pulse of the specified parameter from the specified output(Y0 or Y1).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F169 PLS , DT10 , K 0
S n
Trigger
R10
10
11
ST R 10
F169 (PLS)
DT 10
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S N/A N/A N/A N/A N/A A N/A N/A N/A N/A A
n N/A N/A N/A N/A N/A N/A N/A N/A A A N/A
DescriptionWhen the corresponding control flag is off and the execution condition (trigger) is in the on state, a pulse isoutput from the specifiedchannel. The pulse is output while the executioncondition (trigger) is in the on state.
By specifying either incremental counting or decremental counting in the control code, this instruction can beused as an instruction for JOG operations. For that situation, set the control code with combinations such asH12 (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 afterthis 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 channelcorresponding 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.
Step Availability
5
Pulse output instruction(JOG operation: with channelspecification)
5
F169(PLS) FP0 C10, C14, C16,C32, T32, SL1
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 269
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.
Operation mode and directional output00: No counting mode10: Incremental counting mode with no directional output12: Incremental counting mode with directional output off13: Incremental counting mode with directional output on20: Decremental counting mode with no directional output22: Decremental counting mode with directional output on23: Decremental counting mode with directional output off
H j j j
Pulse width specification0: Fixed pulse width (approx. 80μs)
(CPU ver. 2.1 or later)1 to 9: Duty ration approx. 10 to 90% (10% increments)
Flag conditionsS 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.
FP0High- level Instructions
3 - 270
3.3 Explanation of High- level Instructions
Outline Outputs the PWM of the specified parameter from the specified output(Y0 or Y1).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F170 PWM , DT20 , K 1
S n
Trigger
R10
10
11
ST R 10
F170 (PWM)
DT 20
K 1
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S N/A N/A N/A N/A N/A A N/A N/A N/A N/A A
n N/A N/A N/A N/A N/A N/A N/A N/A A A N/A
DescriptionWhen the corresponding control flag is off and execution condition (trigger) is in the on state, a PWM is outputfrom 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 ofthe 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 channelcorresponding 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.
Step Availability
5PWM output instruction(with channel specification)
5
F170(PWM) FP0 C10, C14, C16,C32, T32, SL1
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 271
3.3 Explanation of High- level Instructions
Data table settings
S Control code K0 to K8 (*1)
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 conditionsS 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”
FP0High- level Instructions
3 - 272
3.3 Explanation of High- level Instructions
Outline Sets the 32-bit on-delay timer for 0.01s units (0.01 to 21474836.47s)
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
10 F183 DSTM , DT10 , DT 5
S D
Trigger
R0 R5
10
11
16
ST R 0
F183 (DSTM)
DT 10
DT 5
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
OperandRelay Timer/Counter Register Index
register Constant IndexmodifierOperand
WX WY WR SV EV DT IX IY K Hmodifier
S A A A A A A A N/A A A N/A
D N/A A A A A A N/A N/A N/A N/A N/A
Explanation of exampleWhen the execution condition (trigger) has been satisfied, the auxiliary timer is activated, and the time equalto the values stored in data registers DT10 and DT11 x 0.01 seconds has elapsed, R5 goes on.
DescriptionThis functions as a 32-bit addition- type on delay timer set in 0.01-second units.When the executioncondition (trigger) is on, the elapsed time is added,and when the elapsedvalue “D+1,D”(32 bits) exceeds the set value, the relays being used are turned on by the OT instruction whichcomes next inthe program.
When the execution condition (trigger) is off, the elapsedvalue area is cleared to 0, and relaysbeing usedareturned 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 andwhile addition is being carried out.)
R0
R900D R5
F183 DSTM, DT10, DT5
Operation is the same as that in the example shown above.
32-bit auxilialy timer5
F183Step Availability
FP0 C10, C14, C16,C32, T32, SL1
7(DSTM)
A: AvailableN/A: Not Available
FP0 High- level Instructions
3 - 273
3.3 Explanation of High- level Instructions
Timer set timeThe 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 programmingThe area in which the set value is stored must be set so that the area specified for the elapsed value does notoverlap any areas reserved for other timer or counter instructions, or memory areas used for high- levelinstruction operations.
Because addition is carried out when operations are carried out, the program should be set up so thatoperations are carried out every scan.(In cases such as programs where division is carried out, or for jump or loop instructions, where severaloperations are carried out during one scan, or where it was not possible to carry out any operation during thescan, correct results cannot be obtained.)
Consecutive OT instructions may be used in the program.
Precautions concerning programming toolsReading and writing the F183 (DSTM) instruction (32-bit auxiliary timer) requires NPST-GR Ver. 4.2 or asubsequent version, or the FP Programmer II (AFP1114V2).
How the auxiliary timer works1 When the execution condition (trigger) changes from off to on, values of 0 are sent to the elapsed
value area “D + 1, D”.
0R0
R900D
R5F183 DSTM, K500, DT5
F0 MV, DT50, WR50
1 Sent to “D + 1, D”
DT5, DT60
2 If the execution condition (trigger) stays on, the values in the elapsed value area “D + 1, D” areadded.
R0
R900D
R5F183 DSTM, K500, DT5
F0 MV, DT50, WR50
2 Addition012
DT5, DT6K500
next page
FP0High- level Instructions
3 - 274
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 onby the OT instruction which comes next in the program. The special internal relay R900D alsogoes on at this point.
R0
R900D
R5F183 DSTM, K500, DT5
F0 MV, DT50, WR50
DT5K500
3 Addition completed
R0
Elapsed value“D+1, D”
Set value“S+1, S”
onoff
R5(R900D)
onoff
Precautions when using R900DIf R900D is used and multiple auxiliary timers are being used, always use R900D in the line following theauxiliary timer instruction.
R0
R900D Y0
F183 DSTM, WR1, DT5
R1
R900D Y1
F183 DSTM, WR10, DT10
Pair
Pair
When timer a , which is activated by R0: on, expires, Y0goes on. When timer b , which is activatedby R1:on,expires, Y1 goes on.
If written as indicated below, R900D will not function correctly.
R1F183 DSTM, DT20, DT10
R0
R900D Y0
F183 DSTM, DT0, DT5
R900D Y1
FP0 High- level Instructions
3 - 275
3.3 Explanation of High- level Instructions
Outline Copies floating point type data (32 bits) to the specified 32-bit area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
F309 FMV, f 1.234, DT1010R0
S
Trigger
D
10
11
ST R 0
F309 (FMV)
f 1.234
DT 10
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S N/A N/A N/A N/A N/A N/A N/A N/A N/A A N/A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of exampleThe floating point type data “f 1.234” are copied to data registers DT11 and DT10 when trigger R0 turns on.
DT10:
DT11:(f1.234)
F309
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(FMV) Floating point type data move
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 276
3.3 Explanation of High- level Instructions
DescriptionThe floating point type data (32 bits) specified by S is copied to the 32-bit area specified by D when the triggerturns on.
Floating point typedata
Real number dataLower wordD:
D+1:
15
Higher word
0
Range of real number data which can be set are as follows:Positive: f0.0000001 to f9999999Negative: f -9999999 to f -0.000001
Precaution during programmingThis instruction F309 (FMV) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 277
3.3 Explanation of High- level Instructions
Outline Adds two real number data items and stores the result in the specifiedarea.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S1
Trigger
S2 D
F310 F+, DT10, DT20, DT3010R0
10
11
ST R 0
F310 (F+)
DT 10
DT 20
DT 30
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe real number data (2 words) specified by S1 and S2 are added together when the trigger turns on. Theadded 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 numbersbefore operations continue.
F310 F+, % DT 0, % DT 2, DT 4R0
F310
Step Availability
14FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(F+) Floating point type data addition
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 278
3.3 Explanation of High- level Instructions
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F310 F+, DT 0, DT 2, % DT 4R0
When the constant K is specified in S1 and S2, the operations are the same as when a integer device isspecified.
For detailed information about the processing of specifying the integer device section 1.3
Program exampleThe “f4.554” is stored to DT30 and DT31 when the R0 turns on.
F310 F+, f1.414, f3.14, DT30R0
The “f135.795” is stored to DT30 and DT31 when the R0 turns on.
F309 FMV, f12.345 DT10R0
F310 F+, DT10, DT20, DT30F309 FMV, f123.45, DT20
Precaution during programmingThis instruction F310 (F+) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 279
3.3 Explanation of High- level Instructions
Outline Subtracts real number data from the minuend and stores the result inthe specified area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S1
Trigger
S2 D
F311 F- , DT10, DT20, DT3010R0
10
11
ST R 0
F311 (F-)
DT 10
DT 20
DT 30
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionSubtracts the real number data (2 words) specified by S2 from the real number data (32-bit) specified by S1when 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 numbersbefore operations continue.
F311 F- , % DT 0, % DT 2, DT 4R0
F311
Step Availability
14FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(F- ) Floating point type datasubtraction
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 280
3.3 Explanation of High- level Instructions
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F311 F- , DT 0, DT 2, % DT 4
R0
When the constant K is specified in S1 and S2, the operations are the same as when a integer device isspecified.
For detailed information about the processing of specifying the integer device section 1.3
Program exampleThe “f0.445” is stored to DT30 and DT31 when the R0 turns on.
F311 F- , f1, f0.555, DT30R0
The “f100.05” is stored to DT30 and DT31 when the R0 turns on.
R0F309 FMV, f100.1, DT10
F309 FMV, f0.05, DT20F311 F- , DT10, DT20, DT30
Precaution during programmingThis instruction F311 (F–) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 281
3.3 Explanation of High- level Instructions
Outline Multiplies two real number data items and stores the result in thespecified 32-bit area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S1
Trigger
S2 D
F312 F*, DT10, DT20, DT3010R0
10
11
ST R 0
F312 (F*)
DT 10
DT 20
DT 30
S1 Real number data (2 words) or lower 16-bit area of 32-bit data (formultiplicand)
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionMultiplies the real number data (2 words) specified by S1 and the one specified by S2 when the trigger turnson.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 numbersbefore operations continue.
F312 F*, % DT 0, % DT 2, DT 4R0
F312
Step Availability
14FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(F*) Floating point type datamultiplication
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 282
3.3 Explanation of High- level Instructions
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F312 F*, DT 0, DT 2, % DT 4
R0
When the constant K is specified in S1 and S2, the operations are the same as when a integer device isspecified.
For detailed information about the processing of specifying the integer device section 1.3
Program exampleThe “f123.4000” is stored to DT30 and DT31 when the R0 turns on.
F312 F*, f1.234, f100, DT30R0
Precaution during programmingThis instruction F312 (F*) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 283
3.3 Explanation of High- level Instructions
Outline Divides real number data by the divisor and stores the divided result inthe specified 32-bit area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S1
Trigger
S2 D
F313 F%, DT10, DT20, DT3010R0
10
11
ST R 0
F313 (F%)
DT 10
DT 20
DT 30
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe real number data (2 words) specified by S1 is divided by the real number data (2 words) specified by S2when 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 numbersbefore operations continue.
F313 F%, % DT 0, % DT 2, DT4R0
F313
Step Availability
14FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(F%) Floating point type data division
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 284
3.3 Explanation of High- level Instructions
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F313 F%, DT 0, DT 2, % DT 4R0
When the constant K is specified in S1 and S2, the operations are the same as when a integer device isspecified.
For detailed information about the processing of specifying the integer device section 1.3
Program exampleThe “f5.432100” is stored to DT30 and DT31 when the R0 turns on.
F313 F%, f54.321, f10, DT30R0
Precaution during programmingThis instruction F313 (F%) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 285
3.3 Explanation of High- level Instructions
Outline Triangle functions, This instruction calculates sine [SIN ( )].
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F314 SIN, DT10, DT2010
R0
10
11
ST R 0
F314 (SIN)
DT 10
DT 20
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data isstored
D Lower 16-bit area of 32-bit data where calculated result is stored
Operands
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe SIN([S+1 and S]) of an angle data (units are radians) specified by S+1 and S is calculated and the resultstored 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 beforeoperations continue.
F314 SIN, % DT 0, DT 4R0
F314
Step Availability
10FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(SIN) Floating point type datasine operation
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 286
3.3 Explanation of High- level Instructions
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F314 SIN, DT 0, % DT 4R0
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 exampleThe “f0.4999999” is stored to DT20 and DT21 when the R0 turns on.
F314 SIN, f0.5235987, DT20R0
Radians of 30_
Precautions during programmingThe accuracy of the calculation decreases as the absolute value of the input value (angle data specified inS+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 conditionsS 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.”
FP0 High- level Instructions
3 - 287
3.3 Explanation of High- level Instructions
Outline Triangle functions, This instruction calculates cosine [COS ( )].
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F315 COS, DT10, DT2010R0
10
11
ST R 0
F315 (COS)
DT 10
DT 20
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data isstored
D Lower 16-bit area of 32-bit data where calculated result is stored
Operands
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe COS ([S+1 and S]) of an angle data (units are radians) specified by S+1 and S is calculatedand the resultstored 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 beforeoperations continue.
F315 COS, % DT 0, DT 4R0
F315
Step Availability
10FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(COS) Floating point type datacosine operation
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 288
3.3 Explanation of High- level Instructions
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F315 COS, DT 0, % DT 4R0
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 exampleThe “f0.7071068” is stored to DT20 and DT21 when the R0 turns on.
F315 COS, f0.7853981, DT20R0
Radians of 45_
Precautions during programmingThe accuracy of the calculation decreases as the absolute value of the input value (angle data specified inS+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 conditionsS 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.”
FP0 High- level Instructions
3 - 289
3.3 Explanation of High- level Instructions
Outline Triangle functions, This instruction calculates tangent [TAN ( )].
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F316 TAN, DT10, DT2010R0
10
11
ST R 0
F316 (TAN)
DT 10
DT 20
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data isstored
D Lower 16-bit area of 32-bit data where calculated result is stored
Operands
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe TAN([S+1 and S]) of an angle data (units are radians) specified by S+1 and S is calculated and the resultstored 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 beforeoperations continue.
F316 TAN, % DT 0, DT 4
R0
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F316 TAN, DT 0, % DT 4R0
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
F316
Step Availability
10FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(TAN) Floating point type datatangent operation
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 290
3.3 Explanation of High- level Instructions
Program exampleThe “f1.732048” is stored to DT20 and DT21 when the R0 turns on.
F316 TAN, f1.047197, DT20
R0
Radians of 60_
Precautions during programmingThe accuracy of the calculation decreases as the absolute value of the input value (angle data specified inS+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 conditionsS 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.”
FP0 High- level Instructions
3 - 291
3.3 Explanation of High- level Instructions
Outline Triangle functions, This instruction calculates arcsine [SIN-1 ( )].
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F317 ASIN, DT10, DT2010R0
10
11
ST R 0
F317 (ASIN)
DT 10
DT 20
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data isstored
D Lower 16-bit area of 32-bit data where calculated result is stored
Operands
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionSIN of the value specified in S+1 and S is calculated, and the result [an angle (radians)] is stored in D+1 andD.
SIN-1 ([S+1, S]) → [D+1, D]
Specifying the integer device with [S], the integer data is internally converted to real numbers beforeoperations continue.
F317 ASIN, % DT 0, DT 4R0
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F317 ASIN, DT 0, % DT 4R0
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
F317
Step Availability
10FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(ASIN) Floating point type dataarcsine operation
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 292
3.3 Explanation of High- level Instructions
Program exampleThe “f0.5235986 (30_ radians)” is stored to DT20 and DT21 when the R0 turns on.
F317 ASIN, f0.4999999, DT20R0
Precautions during programmingD+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 conditionsS 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.
FP0 High- level Instructions
3 - 293
3.3 Explanation of High- level Instructions
Outline Triangle functions, This instruction calculates arccosine [COS-1 ( )].
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F318 ACOS, DT10, DT2010R0
10
11
ST R 0
F318 (ACOS)
DT 10
DT 20
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data isstored
D Lower 16-bit area of 32-bit data where calculated result is stored
Operands
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionCOS of the value specified in S+1 and S is calculated, and the result [an angle data (units and radians)] isstored 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 beforeoperations continue.
F318 ACOS, % DT 0, DT 4R0
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F318 ACOS, DT 0, % DT 4
R0
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
F318
Step Availability
10FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(ACOS) Floating point type dataarccosine operation
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 294
3.3 Explanation of High- level Instructions
Program exampleThe “f0.7853980 (45_ radians)” is stored to DT20 and DT21 when the R0 turns on.
F318 ACOS, f0.7071069, DT20R0
Precautions during programmingD+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 conditionsS 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.
FP0 High- level Instructions
3 - 295
3.3 Explanation of High- level Instructions
Outline Triangle functions, This instruction calculates arctangent [TAN-1 ( )].
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F319 ATAN, DT10, DT2010
R0
10
11
ST R 0
F319 (ATAN)
DT 10
DT 20
S Angle data (2 words) or lower 16-bit area of 32-bit data where angle data isstored
D Lower 16-bit area of 32-bit data where calculated result is stored
Operands
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionTAN-1 (the arctangent) of the value specified in S+1 and S is calculated, and the result [an angle data (unitsand 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 beforeoperations continue.
F319 ATAN, % DT 0, DT 4R0
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F319 ATAN, DT 0, % DT 4R0
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
F319
Step Availability
10FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(ATAN) Floating point type dataarctangent operation
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 296
3.3 Explanation of High- level Instructions
Program exampleThe “f1.047197 (60_ radians)” is stored to DT20 and DT21 when the R0 turns on.
F319 ATAN, f1.73205, DT20R0
Precautions during programmingD+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 conditionsS 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.
FP0 High- level Instructions
3 - 297
3.3 Explanation of High- level Instructions
Outline This instruction calculates a natural logarithm LN( ).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F320 LN, DT10, DT2010R0
10
11
ST R 0
F320 (LN)
DT 10
DT 20
S Real number data (2 words) or lower 16-bit area of 32-bit data where realnumber data is stored
D Lower 16-bit area of 32-bit data where calculated result is stored
Operands
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe natural logarithm LN(S+1 and S) is calculated of the data specified in S+1 and S, and the result is storedin 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 beforeoperations continue.
F320 LN, % DT 0, DT 4R0
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F320 LN, DT 0, % DT 4R0
For detailed information about the processing of specifying the integer device section 1.3
F320
Step Availability
10FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(LN) Floating point type datanatural logarithm
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 298
3.3 Explanation of High- level Instructions
Program exampleThe “f1.6094379” is stored to DT20 and DT21 when the R0 turns on.
F320 LN, K 5, DT20R0
The “f -0.3160815” is stored to DT30 and DT31 when the R0 turns on.
F320 LN, f0.729, DT30R0
Precaution during programmingThis instruction F320 (LN) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 299
3.3 Explanation of High- level Instructions
Outline This instruction calculates the exponent of a floating point type realnumber EXP( ).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F321 EXP, DT10, DT2010R0
10
11
ST R 0
F321 (EXP)
DT 10
DT 20
S Real number data (2 words) or lower 16-bit area of 32-bit data where realnumber data is stored
D Lower 16-bit area of 32-bit data where calculated result is stored
Operands
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe exponent EXP(S+1 and S) is calculated from the real number data specified in S+1 and S, and the resultis 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 beforeoperations continue.
F321 EXP, % DT 0, DT 4R0
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F321 EXP, DT 0, % DT 4R0
For detailed information about the processing of specifying the integer device section 1.3
F321
Step Availability
10FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(EXP) Floating point type dataexponent
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 300
3.3 Explanation of High- level Instructions
Program exampleThe “f7.389056” is stored to DT20 and DT21 when the R0 turns on.
F321 EXP, K 2, DT20R0
The “f221.406402” is stored to DT30 and DT31 when the R0 turns on.
F321 EXP, f5.4, DT30R0
Precaution during programmingThis instruction F321 (EXP) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 301
3.3 Explanation of High- level Instructions
Outline This instruction calculates the logarithm of a floating point type realnumber LOG( ).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F322 LOG, DT10, DT2010R0
10
11
ST R 0
F322 (LOG)
DT 10
DT 20
S Real number data (2 words) or lower 16-bit area of 32-bit data where realnumber data is stored
D Lower 16-bit area of 32-bit data where calculated result is stored
Operands
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe logarithm LOG(S+1 and S) is calculated of the data specified in S+1 and S, and the result is stored in D+1and D.
LOG ([S+1, S]) → [D+1, D]
Specifying the integer device with [S], the integer data is internally converted to real numbers beforeoperations continue.
F322 LOG, % DT 0, DT 4R0
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F322 LOG, DT 0, % DT 4R0
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
F322
Step Availability
10FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(LOG) Floating point type datalogarithm
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 302
3.3 Explanation of High- level Instructions
Program exampleThe “f1.30103” is stored to DT20 and DT21 when the R0 turns on.
F322 LOG, K20, DT20R0
The “f0.0108932” is stored to DT30 and DT31 when the R0 turns on.
F322 LOG, f1.0254, DT30R0
Precaution during programmingThis instruction F322 (LOG) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 303
3.3 Explanation of High- level Instructions
Outline This instruction raises a floating point type real number to the specifiedpower.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S1
Trigger
S2 D
F323 PWR, DT10, DT20, DT3010R0
10
11
ST R 0
F323 (PWR)
DT 10
DT 20
DT 30
S1 Real number data (2 words) or lower 16-bit area of 32-bit data (formultiplicand)
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S1 A A A A A A A A A A A
S2 A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe real number data specified by S1+1 and S1 is raised to the power specified by the real number data ofS2+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 numbersbefore operations continue.
F323 PWR, % DT 0, % DT 2, DT 4R0
F323
Step Availability
14FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(PWR) Floating point type datapower
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 304
3.3 Explanation of High- level Instructions
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F323 PWR, DT 0, DT 2, % DT4R0
When the constant K is specified in S1 and S2, the operations are the same as when a integer device isspecified.
For detailed information about the processing of specifying the integer device section 1.3
Program exampleThe “f625.0” is stored to DT20 and DT21 when the R0 turns on.
F323 PWR, K 5, K 4, DT20
R0
The “f30.51758” is stored to DT30 and DT31 when the R0 turns on.
F323 PWR, f3.125, K 3, DT30R0
Precaution during programmingThis instruction F323 (PWR) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 305
3.3 Explanation of High- level Instructions
Outline Takes the square root of the specified real number data and stores resultin the specified area.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F324 FSQR, DT10, DT2010R0
10
11
ST R 0
F324 (FSQR)
DT 10
DT 20
S Real number data (2 words) or lower 16-bit area of 32-bit area for storing datato be calculated
D Lower 16-bit area of 32-bit area for storing the calculated result
Operands
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe 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 beforeoperations continue.
F324 FSQR, % DT 0, DT 4
R0
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F324 FSQR, DT 0, % DT 4R0
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
F324
Step Availability
10FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(FSQR) Floating point type datasquare root
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 306
3.3 Explanation of High- level Instructions
Program exampleThe “f1.41421” is stored to DT20 and DT21 when the R0 turns on.
F324 FSQR, K 2, DT20R0
Precaution during programmingThis instruction F324 (FSQR) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 307
3.3 Explanation of High- level Instructions
Outline Converts 16-bit integer data to real number data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F325 FLT, DT10, DT2010R0
10
11
ST R 0
F325 (FLT)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A N/A A
D N/A A A A A A A N/A N/A N/A A
DescriptionConverts 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.
15 0
S:16-bit integerdata with sign
15 0
D:Floating pointtype realnumber data
Lower word
D+1: Higher word
Precaution during programmingThis instruction F325 (FLT) cannot be used in the interrupt program.
F325
Step Availability
6FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(FLT) 16-bit integer data to Floatingpoint type data conversion
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 308
3.3 Explanation of High- level Instructions
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 309
3.3 Explanation of High- level Instructions
Outline Converts 32-bit integer data to real number data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F326 DFLT, DT10, DT2010R0
10
11
ST R 0
F326 (DFLT)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A N/A N/A
D N/A A A A A A A N/A N/A N/A N/A
DescriptionConverts the 32-bit integer data with sign specified by S to real number data when the trigger turns on. Theconverted data is stored in D+1 and D.
32-bit integerdata with sign
15 0D:Floating point
type realnumber data
Lower wordD+1: Higher word
15 0S: Lower word
S+1: Higher word
Precaution during programmingThis instruction F326 (DFLT) cannot be used in the interrupt program.
F326
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(DFLT) 32-bit integer data to Floatingpoint type data conversion
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 310
3.3 Explanation of High- level Instructions
Flag conditionsS 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.
FP0 High- level Instructions
3 - 311
3.3 Explanation of High- level Instructions
Outline Converts real number data to 16-bit integer data (the largest integer notexceeding the floating point type data).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F327 INT, DT10, DT2010R0
10
11
ST R 0
F327 (INT)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A N/A A A N/A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of exampleWhen the real number data “1.234” is in DT10 and DT11, as shown below.
DT20:
DT10:
DT11:(f1.234)
(K1)
When the real number data “-1.234” is in DT10 and DT11, as shown below.
DT20:
DT10:
DT11:(f -1.234)
(K-2)
F327
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(INT)
Floating point type data to16-bit integer data conversion(the largest integer not exceed-ing the floating point type data)
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 312
3.3 Explanation of High- level Instructions
DescriptionConverts real number data (-32767.99 to +32767.99) specified by S to the 16-bit integer data with sign (thelargest integer not exceeding the floating point type data) when the trigger turns on. The converted data isstored in D.
16-bit integerdata with sign
15 0
D:
Real numberdata
15 0
S: Lower word
S+1: Higher word
For detailed information about the processing of specifying the integer device section 1.3
Precaution during programmingThis instruction F327 (INT) cannot be used in the interrupt program.
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 313
3.3 Explanation of High- level Instructions
Outline Converts real number data to 32-bit integer data (the largest integer notexceeding the floating point type data).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F328 DINT, DT10, DT2010R0
10
11
ST R 0
F328 (DINT)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A N/A A A N/A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of exampleWhen the real number data “12345.67” is in DT10 and DT11, as shown below.
DT10:
DT11:(f12345.67)
When the real number data “-12345.67” is in DT10 and DT11, as shown below.
DT10:
DT11:(f -12345.67)
DT20:
DT21:(K12345)
DT20:
DT21:(K-12346)
F328
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(DINT)
Floating point type data to32-bit integer data conversion(the largest integer not exceed-ing the floating point type data)
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 314
3.3 Explanation of High- level Instructions
DescriptionConverts real number data (-2,147,483,000 to +2,147,483,000) specified by S+1 and S to the 32-bit integerdata with sign (the largest integer not exceeding the floating point type data) when the trigger turns on. Theconverted data is stored in D+1 and D.
32-bit integerdata with sign
15 0
D:
Real numberdata
Lower word
D+1: Higher word
15 0
S: Lower word
S+1: Higher word
For detailed information about the processing of specifying the integer device section 1.3
Precaution during programmingThis instruction F328 (DINT) cannot be used in the interrupt program.
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 315
3.3 Explanation of High- level Instructions
Outline Converts real number data to 16-bit integer data (rounding the firstdecimal point down to integer).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F329 FIX, DT10, DT2010R0
10
11
ST R 0
F329 (FIX)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A N/A A A N/A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of example
DT20:
DT10:
DT11:(f1.234567)
When the real number data “1.234567” is in DT10 and DT11, as shown below.
When the real number data “-1.234567” is in DT10 and DT11, as shown below.
(K1)
DT20:
DT10:
DT11:(f -1.234567)
(K-1)
F329
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(FIX)
Floating point type data to16-bit integer data conversion(rounding the first decimalpoint down to integer)
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 316
3.3 Explanation of High- level Instructions
DescriptionConverts 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
D:
15 0
S:
S+1:
16-bit integerdata with sign
Real numberdata Lower word
Higher word
For detailed information about the processing of specifying the integer device section 1.3
Precaution during programmingThis instruction F329 (FIX) cannot be used in the interrupt program.
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 317
3.3 Explanation of High- level Instructions
Outline Converts real number data to 32-bit integer data (rounding the firstdecimal point down to integer).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F330 DFIX, DT10, DT2010R0
10
11
ST R 0
F330 (DFIX)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A N/A A A N/A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of example
DT10:
DT11:(f123456.7)
When the real number data “123456.7” is in DT10 and DT11, as shown below.
When the real number data “-123456.7” is in DT10 and DT11, as shown below.
DT10:
DT11:(f -123456.7)
DT20:
DT21:(K123456)
DT20:
DT21:(K-123456)
F330
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(DFIX)
Floating point type data to32-bit integer conversion(rounding the first decimalpoint down to integer)
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 318
3.3 Explanation of High- level Instructions
DescriptionConverts real number data (-2,147,483,000 to 2,147,483,000) specified by S+1 and S to 32-bit integer datawith sign (rounding the first decimal point down to integer) when the trigger turns on. The converted data isstored in D+1 and D.
32-bit integerdata with sign
15 0
D:
Real numberdata
Lower word
D+1: Higher word
15 0
S: Lower word
S+1: Higher word
For detailed information about the processing of specifying the integer device section 1.3
Precaution during programmingThis instruction F330 (DFIX) cannot be used in the interrupt program.
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 319
3.3 Explanation of High- level Instructions
Outline Converts real number data to 16-bit integer data (rounding the firstdecimal point off to integer).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F331 ROFF, DT10, DT2010R0
10
11
ST R 0
F331 (ROFF)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A N/A A A N/A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of example
DT20:
DT10:
DT11:(f1234.567)
When the real number data “1234.567” is in DT10 and DT11, as shown below.
When the real number data “-1234.567” is in DT10 and DT11, as shown below.
(K1235)
DT20:
DT10:
DT11:(f -1234.567)
(K-1235)
F331
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(ROFF)
Floating point type data to16-bit integer conversion(rounding the first decimalpoint off to integer)
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 320
3.3 Explanation of High- level Instructions
DescriptionConverts 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
D:
15 0
S:
S+1:
16-bit integerdata with sign
Real numberdata Lower word
Higher word
For detailed information about the processing of specifying the integer device section 1.3
Precaution during programmingThis instruction F331 (ROFF) cannot be used in the interrupt program.
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 321
3.3 Explanation of High- level Instructions
Outline Converts real number data to 32-bit integer data (rounding the firstdecimal point off to integer).
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F332 DROFF, DT10, DT2010R0
10
11
ST R 0
F332 (DROFF)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A N/A A A N/A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of exampleWhen the real number data “45678.51” is in DT10 and DT11, as shown below.
DT10:
DT11:(f45678.51)
DT20:
DT21:(K45679)
When the real number data “-45678.51” is in DT10 and DT11, as shown below.
DT10:
DT11:(f -45678.51)
DT20:
DT21:(K-45679)
F332
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(DROFF)
Floating point type data to32-bit integer conversion(rounding the first decimalpoint off to integer)
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 322
3.3 Explanation of High- level Instructions
DescriptionConverts real number data (-2,147,483,000 to +2,147,483,000)specified by S+1 and S to 32-bit integerdatawith sign (rounding the first decimal point off to integer) when the trigger turns on. The converted data isstored in D+1 and D.
32-bit integerdata with sign
15 0
D:
Real numberdata
Lower word
D+1: Higher word
15 0
S: Lower word
S+1: Higher word
For detailed information about the processing of specifying the integer device section 1.3
Precaution during programmingThis instruction F332 (DROFF) cannot be used in the interrupt program.
Flag conditionsS 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”.
FP0 High- level Instructions
3 - 323
3.3 Explanation of High- level Instructions
Outline This instruction rounds down the decimal part of real number data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F333 FINT, DT10, DT2010R0
10
11
ST R 0
F333 (FINT)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A N/A A A N/A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of exampleWhen the real number data “1234.567” is in DT10 and DT11, as shown below.
DT10:
DT11:(f1234.567)
DT20:
DT21:(f1234.000)
When the real number data “-1234.567” is in DT10 and DT11, as shown below.
DT10:
DT11:(f -1234.567)
DT20:
DT21:(f -1235.000)
F333
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(FINT)Floating point type datarounding the first decimalpoint down
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 324
3.3 Explanation of High- level Instructions
DescriptionThe decimal part of the real number data specified in S+1 and S is rounded down, and the result is stored inD+1 and D.
Real numberdata
15 0
D:
Real numberdata
Lower word
D+1: Higher word
15 0
S: Lower word
S+1: Higher word
Precaution during programmingThis instruction F333 (FINT) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 325
3.3 Explanation of High- level Instructions
Outline This instruction rounds off the decimal part of real number data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F334 FRINT, DT10, DT2010R0
10
11
ST R 0
F334 (FRINT)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A N/A A A N/A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of exampleWhen the real number data “1234.567” is in DT10 and DT11, as shown below.
DT10:
DT11:(f1234.567)
DT20:
DT21:(f1235.000)
When the real number data “-1234.567” is in DT10 and DT11, as shown below.
DT10:
DT11:(f -1234.567)
DT20:
DT21:(f -1235.000)
F334
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(FRINT)Floating point type datarounding the first decimalpoint off
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 326
3.3 Explanation of High- level Instructions
DescriptionThe decimal part of the real number data stored in S+1 and S is rounded off, and the result is stored in D+1and D.
Real numberdata
15 0
D:
Real numberdata
Lower word
D+1: Higher word
15 0
S: Lower word
S+1: Higher word
Precaution during programmingThis instruction F334 (FRINT) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 327
3.3 Explanation of High- level Instructions
Outline This instruction changes the sign of real number data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F335 F+/- , DT10, DT2010R0
10
11
ST R 0
F335 (F+/-)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of exampleWhen the real number data “-60000.00” is in DT10 and DT11, as shown below.
DT10:
DT11:(f -60000.00)
DT20:
DT21:(f60000.00)
When the real number data “-30000.00” is in DT10 and DT11, as shown below.
DT10:
DT11:(f -30000.00)
DT20:
DT21:(f30000.00)
F335
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(F+/- ) Floating point type datasign changes
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 328
3.3 Explanation of High- level Instructions
DescriptionThe real number data stored in S+1 and S is changed sign bit, and the result is stored in D+1 and D.
Real numberdata
15 0
D:
Real numberdata
Lower word
D+1: Higher word
15 0
S: Lower word
S+1: Higher word
Precaution during programmingThis instruction F335 (F+/ - ) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 329
3.3 Explanation of High- level Instructions
Outline Takes absolute value of real number data.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F336 FABS, DT10, DT2010R0
10
11
ST R 0
F336 (FABS)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A N/A
Explanation of exampleWhen the real number data “1234.567” is in DT10 and DT11, as shown below.
DT10:
DT11:(f1234.567)
DT20:
DT21:(f1234.567)
When the real number data “-1234.567” is in DT10 and DT11, as shown below.
DT10:
DT11:(f -1234.567)
DT20:
DT21:(f1234.567)
F336
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(FABS) Floating point type dataabsolute
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 330
3.3 Explanation of High- level Instructions
DescriptionTakes 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.
Real numberdata
15 0
D:
Real numberdata
Lower word
D+1: Higher word
15 0
S: Lower word
S+1: Higher word
Specifying the integer device with [S], the integer data is internally converted to real numbers beforeoperations 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 programmingThis instruction F336 (FABS) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 331
3.3 Explanation of High- level Instructions
Outline This instruction converts the units of an angle from degrees to radians.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F337 RAD, DT10, DT2010R0
10
11
ST R 0
F337 (RAD)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A N/A
DescriptionThe data in degrees of an angle specified in S+1 and S is converted to radians (real number data) and theresult is stored in D+1 and D.
Angle data (radians)(Real number data)
15 0
D:
Angle data (degrees)(Real number data)
Lower word
D+1: Higher word
15 0
S: Lower word
S+1: Higher word
Specifying the integer device with [S], the integer data is internally converted to real numbers beforeoperations 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
F337
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(RAD) Floating point type datadegrees → radians
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 332
3.3 Explanation of High- level Instructions
Program exampleThe “f0.7853981” is stored to DT20 and DT21 when the R0 turns on.
F337 RAD, f45, DT20R0
Precaution during programmingThis instruction F337 (RAD) cannot be used in the interrupt program.
Flag conditionsS 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.
FP0 High- level Instructions
3 - 333
3.3 Explanation of High- level Instructions
Outline Converts the units of an angle from radians to degrees.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
D
F338 DEG, DT10, DT2010R0
10
11
ST R 0
F338 (DEG)
DT 10
DT 20
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
OperandRelay Timer/Counter Register Index
register Constant IntegerdeviceOperand
WX WY WR SV EV DT IX IY K H fdevice
S A A A A A A A A A A A
D N/A A A A A A A N/A N/A N/A A
DescriptionThe angle data in radians (real number data) specified in S+1 and S is converted to angle data in degreesandthe result is stored in D+1 and D.
Angle data (degrees)(Real number data)
15 0
D:
Angle data (radians)(Real number data)
Lower word
D+1: Higher word
15 0
S: Lower word
S+1: Higher word
F338
Step Availability
8FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(DEG) Floating point type dataradians → degrees
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 334
3.3 Explanation of High- level Instructions
Specifying the integer device with [S], the integer data is internally converted to real numbers beforeoperations continue.
F338 DEG, % DT 0, DT 4R0
Specifying the integer device with [D], the real numbers are automatically converted into integer data.
F338 DEG, DT 0, % DT 4R0
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 exampleThe “f30.00000” is stored to DT20 and DT21 when the R0 turns on.
F338 DEG, f0.5235987, DT20R0
Precautions during programmingWhen 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 conditionsS 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.
FP0 High- level Instructions
3 - 335
3.3 Explanation of High- level Instructions
Outline This instruction carries out PID processing.
Program example
Ladder DiagramBoolean
Ladder DiagramAddress Instruction
S
Trigger
F355 PID, DT 1010R0
10
11
ST R 0
F355 (PID)
DT 10
S Starting number of PID parameter area (30 words)
Operands
OperandRelay Timer/Counter Register Index
register ConstantOperand
WX WY WR SV EV DT IX IY K H f
S N/A N/A N/A N/A N/A A N/A N/A N/A N/A
DescriptionPID processing is performed to hold the measured value specified by S+2 at the set value S+1, and the resultis 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 processingmode and cycle in the parameter table. PID processing will be performed based on these settings.
Types of PID ProcessingReverse operation and forward operationWhen 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 typePIDcontrol”, when a set value is changed, there is increased fluctuation in theoutput, but convergence is faster.
Generally, with “proportional -delivative type PID control”, when a set value is changed, there is lessfluctuation in the output, but convergence is slower.
F355
Step Availability
4FP0 C10, C14, C16,C32 CPU Ver. 2.1 or
later/FP0 T32(PID) PID processing
A: AvailableN/A: Not Available
FP0High- level Instructions
3 - 336
3.3 Explanation of High- level Instructions
Flag conditionsS 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+29]
[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
Explanation of Parameters1 Control mode [S]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Select the type of PID processing and auto-tuning with the H constants.
Control mode Value of [S]
Auto-tuningwhen not executed
Auto-tuningwhen executed
Derivative type Reverse operation H0 H8000
Forward operation H1 H8001
Proportional-delivative type
Reverse operation H2 H8002delivative type Forward operation H3 H8003
Auto-tuningThe optimum values for the Kp, Ti, and Td of the PID parameters can be measured by measuring the processresponse. When auto tuning is executed, the estimated results are reflected in the parameter area after autotuninghasbeencompleted. (Theremaybe cases in which auto tuning cannotbe executed,depending on theprocess. If this happens, processing returns to the original parameter operation.)For precautions concerning execution of auto tuning, refer to the following page.
FP0 High- level Instructions
3 - 337
3.3 Explanation of High- level Instructions
Reverse operation and forward operationThese parameters determine whether the output will increase or decrease when a change occurs in theprocess.
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 PIDWhen 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 K100003 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 thefollowing range.
K0 to K100004 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 K100005 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 automaticallyadjusted 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 automaticallyadjusted and rewritten.
FP0High- level Instructions
3 - 338
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 automaticallyadjusted 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 progressedis 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-tuningIf “Execute auto- tuning” is specified using the parameter table (control mode [S]), attention should be paid tothe following points.
After auto- tuning has been completed, the control mode [S] area is automatically rewritten from H8000 toH8003 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), theintegration time (Ti) and delivative time (Td), but before executing auto- tuning, the appropriate values (forexample, 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), theintegration time (Ti) and delivative time (Td). Be careful that the stored values are not inadvertently rewritten.
Precautions during programmingA 30-word area is required for the parameter table, including the work area for processing. Take care thatother 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 atleast 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 isexceeded.
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.
FP0 High- level Instructions
3 - 339
3.3 Explanation of High- level Instructions
PID processing equations
MVn = MVn-1 + ΔMV
Calculation of ΔMV1 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)
FP0High- level Instructions
3 - 340
3.3 Explanation of High- level Instructions
Operation of PID controlPID control is a control method widely used in the instrumentation field involving feedback control of processquantities such as temperature, pressure, flow, and fluid level.
1) Proportional operationProportional operation generates an output which is proportional to the input.
Kp Output MVOffset e
Settingsignal SV
Measurementsignal PV
+
-
1
e
0 t
1
MV
0 t
2
.5
Kp=2
Kp=1
Kp=.5
The amount of control is held constant.
An offset remains.
Proportional control grows stronger as Kp is increased.
2) Integral operationIntegral operation generates an output which is proportional to the integral time of the input.
Output miOffset e
Settingsignal SV
Measurementsignal PV
+
-
e mi
mi=1/Tiedt
Integraloperation
In combination with proportional operation or proportional -derivative operation, integral operation removesthe offset produced by these methods.
Integral operation grows stronger as the integral time (Ti) is shortened.
FP0 High- level Instructions
3 - 341
3.3 Explanation of High- level Instructions
3) Derivative operationDerivative operation generates an output which is proportional to the derivative time of the input.
Output mDOffset e
Settingsignal SV
Measurementsignal PV
+
-
e mD
mD=TD Sdedt
Derivativeoperation
The advancing characteristic of derivative control alleviates the adverse effect which the delayingcharacteristic 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 thiscanhavean adverseeffecton the processbeingcontrolled.For this reason, incompletedifferential operationis executed.
e mD
4) PID operationPID operation is a combination of proportional, integral, and derivative operation.
KpOutput MVOffset e
Settingsignal SV
Measurement signal PV
+
-
++
+Integraloperation
Derivativeoperation
If the parameters are set to the optimum values, PID control can quickly bring the amount of control to thetarget value and maintain it there.
FP0High- level Instructions
3 - 342
3.3 Explanation of High- level Instructions
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 Modifiedwith 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 OperationError Occurs 4 - 10. . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.3 Dealing with Operation Errors 4 - 11. . . . . . . . . . . .
4.4.4 Points to Check in Program 4 - 12. . . . . . . . . . . . .
next page
FP0Precautions During Programming
4 - 2
4.5 Instruction of Leading Edge Detection Method 4 - 13. . . .
4.5.1 Instructions of Leading Edge DetectionMethod 4 - 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5.2 Operation and Precautions at RunStart Time 4 - 14. . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5.3 Precautions When Using a ControlInstruction 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 notPossible 4 - 20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.7.3 Procedures and Operation of RewriteDuring RUN 4 - 21. . . . . . . . . . . . . . . . . . . . . . . . . .
4.7.4 Changing Modes in FP Programmer II 4 - 22. . . .
4.8 Changing the Set Value of Timer/CounterDuring RUN 4 - 23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.8.1 Method of Rewriting Constant in FPProgrammer II 4 - 23. . . . . . . . . . . . . . . . . . . . . . . .
4.8.2 Method of Rewriting a Value in the SetValue Area 4 - 24. . . . . . . . . . . . . . . . . . . . . . . . . . .
4.9 Processing During Forced Input and Output 4 - 27. . . . . .
Precautions During ProgrammingFP0
4 - 3
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 beduplicated output.Even if the same output is used for multiple instructions, such as the SET or RSTinstruction, or high- level instruction for data transfer, it is not regarded as duplicatedoutput.
If you enter RUN mode while the duplicated output condition exists, under normalconditions, it will be flagged as an error, the ERROR/ALARM LED will light and theself-diagnostic error flag R9000 will go on.
How to Check for Duplicated UseYou can check for duplicated outputs in the program using the programming tool, by thefollowing method:
Using FP Programmer II:Operate the TOTAL CHECK function.
Key operation: ENT(- )OP 9
READ
If there are any duplicated outputs, an error message (DUP USE) and the address willbe 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 OUTPUTERROR) and the address will be displayed. If you execute “SEARCH AN ERROR,” theerror 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 OutputIf you need to use output repeatedly due to the content of the program, duplicatedoutput can be enabled.
In this case, change the setting of system register 20 to ”enable” (when using FPProgrammer II, set K1).
When this is done, an error will not occur when the program is executed.
FP0Precautions During Programming
4 - 4
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 OperationWhen instructions are repeatedly used which output to internal and output relays suchas transfer instructions and OT, KP, SET and RST instructions, the contents arerewritten at each step during operation.
Example: Processing when SET, RST and OT instructions are used (X0 toX2 are all on).
R0X0
R0
S
R0X1R
R0X2
This section of the program isprocessed as if R0 were on.
This section of the program isprocessed as if R0 were off.
This section of the program isprocessed as if R0 were on.
The output is determined by the final operation resultsIf the same output is used by several instructions such as the OT, KP, SET, RST, or datatransfer instructions, the output obtained at the I/O update is determined by the resultsof the operation at the greatest program address.
Example: Output to the same output relay Y0 with OT, SET and RSTinstructions.
X0 Y0
X1 Y0S
X2 Y0R
Y0: on
Y0: on
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 updateinstruction “F143 (IORF)”.
Precautions During ProgrammingFP0
4 - 5
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 decimalnumber is expressed as a binary number.
Example:
Expressing a decimal number in BCD:
Decimal number
BCD(Binary-codeddecimal)
0110 0100 0101
Each digit is convertedto a binary number.
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-segmentdisplay (with a decoder), the data must be in BCD form. In this case, use a dataconversion instruction as shown in the examples at below.
BCD arithmetic instructions “F40 (B+) to F58 (DB-1)” also exist which allow directoperation on BCD data, however, it is normally most convenient to use BIN operationinstructions “F20 (+) to F38(D-1)” as operation in the PLC takes place in binary.
Input From a Digital SwitchUse the BCD-to-BIN conversion instruction “F81 (BIN)”.
1 9 9 2
PLC BCD↓
BIN
(ConversionusingF81 (BIN)instruction)
Digitalswitch
0 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0Data inputted intothe PLC (BCD data)
1 9 9 2
0 0 0 0 0 1 1 1 1 1 0 0 1 0 0 0Data which can beprocessed in the PLC(BIN data) Converted to 1992 in decimal data.
FP0Precautions During Programming
4 - 6
4.2 Handling BCD Data
Output to a 7-segment Display (with Decoder)Use the BIN- to-BCD conversion instruction “F80 (BCD)”.
PLC BIN↓
BCD
(ConversionusingF80 (BCD)instruction)
7-segmentdisplay
0 0 0 1 1 0 0 1 1 0 0 1 0 0 1 0
1 9 9 2
0 0 0 0 0 1 1 1 1 1 0 0 1 0 0 0Data processed inPLC (BIN data)
Data outputted fromPLC (BCD data)
Precautions During ProgrammingFP0
4 - 7
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 writing16-bit data.
Use an index register to indirectly specify a memory area number. (This is also calledindex modification.)
Example:
Transferring the contents of data register DT100 to the numberspecified by the contents of an index register.
R0F0 MV, DT100, IXDT0
Base memory area.
In this example, the number of the destination data register varies depending on thecontents of IX with DT0 acting as a base. For example, when IX contains K10 thedestination 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 singleinstruction, and thus index registers are very convenient when handling large amountsof 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 dataregisters 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, specifywith IX. In this case, IX and IY are handled together as 32-bit data.
Lower 16-bit areaHigher 16-bit area
Contents of IXContents of IY
FP0Precautions During Programming
4 - 8
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 asequence of data registers beginning from DT0.
R0F0 MV, K0, IX
R1DF F0 MV, WX3, IXDT0
F35 +1, IX
1
2
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 tothe 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 timesof R1
Contents ofIX
Destinationdata register
1st
2nd
3rd
⋮
0
1
2
⋮
DT0
DT1
DT2
⋮
Inputting and Outputting Data Based on a Number Specified by an Input
Example 1: Setting a timer number specified by a digital switch
0 7 9 4
PLC
Timer set value(timer time setting)
WX0
2
Digitalswitches
WX1
Timersettingnumber
Precautions During ProgrammingFP0
4 - 9
4.3 Handling Index Registers
R0DF F81 BIN, WX1, IX 1
2F81 BIN, WX0, IXSV0
1 Convert the BCD timer number data in WX1 to binary andset it in index register IX.
2 Convert the BCD timer set value in WX0 to binary andstored in the timer set value area SV specified by contentsof IX.
Example 2: External output of the elapsed value in a timer number specifiedby a digital switch
1
PLC
WX1
7-segmenetindicator
WY0
R1DF F81 BIN, WX1, IX 1
2F80 BCD, IXEV0, WY0
Timer elapsedvalue display
Digitalswitches
Timernumbersetting
1 Convert the BCD timer number data in WX1 to binary, andset it in index register IX.
2 Convert the elapsed value data EV in the timer specified byIX to BCD, and output it to word external output relay WY0.
FP0Precautions During Programming
4 - 10
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-levelinstruction is executed.
When an operation error occurs, the ERROR/ALARM LED on the FP0 control unit willblink 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 ErrorAddress errorThe memory address (number) specified by index modification is outside the area whichcan be used
BCD data errorOperation is attempted on non-BCD data when an instruction handling BCD isexecuted, or BCD conversion is attempted on data which is not within the possibleconversion range.
Parameter errorIn an instruction requiring the specification of control data, the specified data is outsidethe possible range.
Over area errorThe 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 unitoperates even if an operation error occurs.
For detailed information section 8.4
Precautions During ProgrammingFP0
4 - 11
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 inDT9017 and DT9018, and make sure the high- level instruction forthat address is correct and appropriate.
2. Clear the error.Use a programming tool to clear the error. (If the mode selector is setto RUN, RUN will resume as soon as the error is cleared.)In the “STATUS DISPLAY” menu of NPST-GR software, press theError 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.
ACLR(- )OP 1 1 2 ENT
SHIFTSC
(DELT)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 holdtype data will be cleared.An error can also be cleared by executing a F148 (self-diagnosticerror set) instruction.
FP0Precautions During Programming
4 - 12
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
R0F0 MV, DT0, IXDT0
In this case, index register (IX) modifies the address of dataregister DT0. If data in IX is larger than the last address of thedata register, an operation error will occur. If the PLC you areusing is of the FP0 16-point type, the last address of the dataregister is DT1659. If the data in IX exceeds the range of K0 toK255, an operation error will occur. The same is true when thecontents 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
R0F81 BIN, DT0, DT100
In this case, if DT0 contains a hexadecimal number with one ofthe digits A through F such as 12A4, conversion will beimpossible and an operation error will result.
Example: When BIN-to-BCD conversion is attempted
R0F80 BCD, DT1, DT101
In this case, if DT1 contains a negative value or a valuegreater than K9999, an operation error will occur.
Check if the divisor of a division instruction is K0.
Example:
R0F32 %, DT0, DT100, DT200
In this case, if the content of DT100 is K0, an operation errorwill occur.
Precautions During ProgrammingFP0
4 - 13
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 OperationDF (leading edge differential) instructionsCount input for CT instructionsCount input for F118 (UDC) instructionsShift input for SR instructionsShift input for F119 (LRSR) instructionsNSTP instructions
Leading Edge Detection MethodAn instruction with a leading edge detection method operates only in the scan whereits trigger (execution condition) is detected switching from off to on.
onoffTrigger
Executed every scan
onoffTrigger
Executed only one time
Standard operation Leading edge differential operation
Operation ofinstruction
Operation ofinstruction
onoff
onoff
The condition of the previous execution and the condition of the current execution arecompared, and the instruction is executed only if the previous condition was off and thecurrent condition is on. In any other case, the instruction is not executed.
FP0Precautions During Programming
4 - 14
4.5 Instruction of Leading Edge Detection Method
Precautions When Using an Instruction Which Performs Leading EdgeDetectionWhen RUN begins, for example when the system is powered on, the off → on changeof 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 changethe order of execution of instructions, the operation of the instruction may changedepending 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 instructionsJP and LBL instructionsLOOP and LBL instructionsCNDE instructionStep ladder instructionsSubroutine instructions
4.5.2 Operation and Precautions at Run Start Time
Operation of first scan after RUN beginsThe leading edge detection instruction is not executed when the mode has beenswitched to the RUN mode, or when the power supply is booted in the RUN mode, ifthe trigger (execution condition) is already on.
RUN(Power on)
Trigger
Operation
ExecutedNot executed
If you need to execute an instruction when the trigger (execution condition) is on priorto switching to RUN mode, use R9014 (initial pulse off relay) in your program on thefollowing page. (R9014 is a special internal relay which is off during the first scan andturns on at the second scan.)
Precautions During ProgrammingFP0
4 - 15
4.5 Instruction of Leading Edge Detection Method
Example 1: DF (leading edge differential) instruction
RUN(Power on)
X0DF
Y0
X0DF
Y0R9014
Add R9014
X0
Y0
Even if X0 was initially on, the input condition (X0) for the DFinstruction is off - to-on at the second scan, therefore derivative outputis obtained.
Example 2: CT (counter) instruction
X0
Add R9014
X1
100CT
X0 R9014
X1
100CT
X0
CT100countingoperation
RUN(Power on)
Even if X0 was initially on, the input condition (X0) for the counteris off - to-on at the second scan, therefore the count isincremented.
FP0Precautions During Programming
4 - 16
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 previousexecution and the condition of the current execution, and execute the instruction onlyif the previous condition was off and the current condition is on. In any other case, theinstruction is not executed.
When a leading edge detection instruction is used with an instruction which changesthe order of instruction execution such as MC, MCE, JP or LBL, the operation of theinstruction may change as follows depending on input timing. Take care regarding thispoint.
Example 1:
Using the DF instruction between MC and MCE instructions
X1DF
Y0
MCE 0
X0MC 0
Previousexecution of DFinstruction
Previousexecution of DFinstruction
Time chart 2
Time chart 1
X0
X1
Y0
The input condition (X1) for the DF instruction hasnot changed since the time of the previousexecution, thus derivative output is not obtained.
X0
X1
Y0
The input condition (X1) for the DF instruction haschanged from off to on since the time of the previousexecution, thus derivative output is obtained.
Precautions During ProgrammingFP0
4 - 17
4.5 Instruction of Leading Edge Detection Method
Example 2:
Using the CT instruction between JP and LBL instructions
LBL 1
R0JP 1
X0
X1
100CT
R0
X0
R0
X0
Countingoperation
Time chart 2
Countingoperation
Time chart 1
Final timing atwhich theprevious JPinstruction wasnot executed
The count is not incremented, because the finaltiming at which the previous JP instruction was notexecuted has not been changed, and the executioncondition X0 for the counter input has not changed.
Final timing atwhich theprevious JPinstructionwas notexecuted
The count is incremented, because the count inputchanged from off to on after the final timing at whichthe previous JP instruction was not executed.
FP0Precautions During Programming
4 - 18
4.6 Precautions for Programming
4.6 Precautions for Programming
Programs which do not execute correctlyDo not write the following programs as they will not execute correctly.
Program example 1:
X0DF
Y0X1
X2
ANSX0
DFY0X1
X2X0
Program in which the example 1 is rewritten
Program example 2:
X0 Y0X1
X2
TMX5, K30ANS
X0 Y0X1
X2
TMX 5, K 30
X0
Program in which the example 2 is rewritten
Program example 3:
DFY1X2
X3
X0 Y0X1PSHS
POPS
RDS
DFY1X2
X3
X0 Y0X1
Program in which the example 3 is rewritten
X0
X0
When a combination of contacts are set as the trigger (execution condition) of adifferential instruction (DF) or timer instruction, do not use an AND stack (ANS)instruction, read stack (RDS) instruction, or pop stack (POPS) instruction.
Precautions During ProgrammingFP0
4 - 19
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 RUNThe FP0 allows program rewriting even in RUN mode. When a rewrite is attemptedduring RUN, the tool service time is temporarily extended, program rewriting isperformed, and operation is resumed without the need to change the mode. For thisreason, the time of the scan during the RUN rewrite extends from several msec toseveral hundreds of msec.
Operation During RewriteExternal 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 InstructionsAll set values specified with decimal constants (K) in timer and counter instructions arepreset in the corresponding set value areas (SV). Values in the elapsed value area (EV)do not change.
Operation of Rewrite During RUN Completed FlagThe rewrite during RUN completed flag (R9034) is a special internal relay that goes onfor only the first scan following the completion of rewriting in the RUN mode. It can beused instead of the initial pulse relay following a change in the program. (Supported inCPU Ver. 2.0 and subsequent versions)
FP0Precautions During Programming
4 - 20
4.7 Rewrite Function During RUN
4.7.2 Cases Where Rewriting During Run is not Possible
Instructions which do not allow rewriting during RUNStep 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 subprogramsThe following instructions do not allow rewriting during subroutines or interruptprograms.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 RUNWhen a syntax error has occurred.During forced input/output operation
Interrupt RestrictionsWhen using interrupt, high-speed counter, pulse output or PWM output functions, donot 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 onceagain.
Example: Using R9034 (rewrite during RUN completed flag)
R9013ICTL, 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 higherduring 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 duringone-phase, one channel counting or 1.25 Hz during one-phase, two channel counting,the output pulse number may differ from the set number.
Precautions During ProgrammingFP0
4 - 21
4.7 Rewrite Function During RUN
4.7.3 Procedures and Operation of Rewrite During RUN
Item NPST-GRLadder symbol mode
NPST-GRBoolean mode
FP Programmer II
Rewrite procedure Maximum of 128 steps.
Changes are performed byblock.
When PG conversion isexecuted online, the pro-gram will be rewritten.
Block a Block b
Rewriting performed by step.
Caution is required as rewriting takes place simulta-neously with the change.In the case of FP Programmer II, the mode must bechanged. (See section 4.7.4.)
Operation ofeachinstruction
OT/KP If an instruction written inblock a is deleted in block b,the condition before the re-write will be held.
If an instruction written in block a is deleted in blockb, the condition before the rewrite will be held.
Y contact relays which are on will be held in the onstatus. To turn them off in the RUN mode, useforced output.
TM/CT If an instruction written inblock a is deleted in block b,the condition before the re-write will be held.
Set values specified by Kconstants in TM/CT instruc-tions are preset in all of thecorresponding SV’s in theprogram. (Elapsed valuesEV do not change.)
If an instruction written in block a is deleted in blockb, the condition before the rewrite will be held.
Set values specified by K constants in TM/CTinstructions are preset in all of the correspondingSV’s in the program. (Elapsed values EV do notchange.)
In the case of FP Programmer II, set values can berewritten during operation without affecting the timer.For detailed information section 4.8
High-levelinstructions
If an instruction written inblock a is deleted in block b,the condition before the re-write will be held.
If deleted, the output memory area will be held.
MC/MCE When writing MC/MCEinstructions, be sure to writethe instructions as a pair.
Writing or deleting a single instruction during RUN isnot possible. Write or delete the instruction in NPST-GR ladder symbol mode.
CALL/SUB/RET
A subroutine is a programappearing between SUBnand RET instructions. Besure to write it to an addresswhich follows the EDinstruction.
Write in the order: RET, SUB, CALL
Delete in the order: CALL, SUB, RET
INT/IRET An interrupt program is aprogram appearing betweenINTn and IRET instructions.Be sure to write it to an ad-dress which follows the EDinstruction.
Write in the order: IRET, INT
Delete in the order:INT, IRET
next page
FP0Precautions During Programming
4 - 22
4.7 Rewrite Function During RUN
Item NPST-GRLadder symbol mode
NPST-GRBoolean mode
FP Programmer II
Operation ofeach instruc-tion
SSTP/STPE A distance with the samenumber cannot be definedtwice.
An SSTP instruction cannotbe written in a subprogram.
Writing and deletion of a single instruction is notpossible for a program with no step ladder area.
Write or delete both instructions simultaneously inNPST-GR ladder symbol mode.
In the case of an SSTP instruction only, writing anddeletion of a single instruction is possible for a pro-gram with a step ladder area.
JP/LOOP/LBL Be sure to write the instruc-tion for setting the loop num-ber before LBL-LOOPinstructions.
Write in the order: JP-LBL or LOOP-LBL.
Delete in the order: LBL-JP or LBL-LOOP.
4.7.4 Changing Modes in FP Programmer II
Changing program modesFP Programmer II is normally in PROG-EDIT mode which does not allow unintentionalrewriting of programs. To perform a rewrite during RUN, the mode must be changed toRUN-EDIT mode.
Change the mode as shown below. After the rewrite, change back to PROG-EDITmode to prevent accidental rewriting.
Procedure for changing to RUN-EDIT mode
ACLR(- )OP 1 ENT WRT4 1
Procedure for changing to PROG-EDIT mode
ACLR(- )OP 1 ENT WRT4 0
Precautions During ProgrammingFP0
4 - 23
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
TMX 5,K
T5
30
Y0
X0
This method rewrites thevalue in the program.
Rewrite Method Using FP Programmer IIExample of changing the set value of timer 5 from K30 to K50
Procedure:
1. Read the address containing the timer instruction.SHIFT
SC 5READTM
T-SVST
X-WXREADSRC
2. Clear the constant (K30).(HELP)
CLR
3. Enter the new constant (K50).
WRT(BIN)K/H 5 0
Operation and Cautions After the ChangeAfter the change, the timer or counter in operation will continue to run. Operation basedon the changed set value will be started the next time the execution condition changesfrom off to on.
When this method is used, the program itself will change. Thus, when the mode ischanged and then set back to RUN or when the power is turned on, the changed setvalue will be preset.
FP0Precautions During Programming
4 - 24
4.8 Changing the Set Value of Timer/Counter During RUN
4.8.2 Method of Rewriting a Value in the Set Value Area
TMX5, K
T5
SV53030
Y0
X0
This method rewrites the valuein the set value area. Theprogram itself is not rewritten.
Transfers to SV area when modechanges to RUN mode.
Timer set value
Changing values in the set value area SVValues 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 changeAfter the change, the timer or counter in operation will continue to run. Operation basedon the changed set value will be started the next time the execution condition changesfrom off to on.
With these methods, the value in the set value area SV will change, however, theprogram itself will not change. Therefore, when the mode is changed and then set backto 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 KThe constant K is preset in the set value area SV. After the change, it will no longer beeffective.
When a set value in the program is specified by a set value area numberIn the case of a non-hold type timer or counter, 0 is preset in the set value area SV. In thecase of a hold type timer or counter, the value changed by the method on the followingpage is preset in the set value area SV.
Precautions During ProgrammingFP0
4 - 25
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 ofthe timer or counter using the data monitor, and change the value.
Register the area to be rewrittenEnter 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.
FP0Precautions During Programming
4 - 26
4.8 Changing the Set Value of Timer/Counter During RUN
Method 2: Method using the FP Programmer IIUse the word data monitor function to read the set value area SV of the timer or counterto be changed, and rewrite the value.
Example of changing the value of SV0 from K30 to K50.
Procedure:
1. Execute word data monitor (OP8).
ENT(- )OP 8
2. Read SV0.READTM
T-SV 0
3. Clear SV0.(HELP)
CLR
4. Write the new changing value.
WRT(BIN)K/H 5 0
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-levelinstruction as shown below to rewrite the value in the set value area SV of the desiredtimer or counter.
Example: Changing the set value to K20 when input R0 turns on
F0 MV, K20, SV3
R1
R0
T3 Y0
TMX 3, K50 When R0 turns on, the timer set valuechanges from 5 seconds to 2 seconds.
Precautions During ProgrammingFP0
4 - 27
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 willtake precedence at a contact specified for forced input/output. At this time, the inputLED 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 inputfrom the input device.
Processing of external output (Y)Regardless of the result of operation, forced on/off will take precedence at a contactspecified for forced input/output. At this time, the area of output Y in the operationmemory will be forcedly rewritten. External output will take place according to theinput/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 takeprecedence at a contact specified for forced input/output. At this time, the contact of thetimer (T) or counter (C) in the operation memory will be rewritten. Timing and countingwill not take place during control.The on/off state of contacts not specified will be determined by the operation result.
FP0Precautions During Programming
4 - 28
4.9 Processing During Forced Input and Output
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-speedCounter 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-speedCounter 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 OutputFunction 5 - 22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.5 Sample Program for Positioning Control 5 - 25. .
next page
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 2
5.5 PWM Output Function 5 - 33. . . . . . . . . . . . . . . . . . . . . . . . .
5.5.1 Outline of PWM Output Function 5 - 33. . . . . . . .
5.5.2 Instruction Used with PWM OutputFunction 5 - 33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 3
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 counterThere are three functions available when using the high-speed counter built into theFP0.
High-speed counter functionThe high-speed counter function counts external inputs such as those from sensors orencoders. When the count reaches the target value, this function turns on/off thedesired output.
InverterMotor
EncoderSTARTSTOP signal
Lead wire, tape
Roller Cutter
Encoder output isinput to the high-speed counter
Cutter bladecontrol signal
FP0
Pulse output functionCombined with a commercially available motor driver, the pulse output function enablespositioning control. With the appropriate instruction, you can perform trapezoidalcontrol, home return, and JOG operation.
Stepping motor,Servo motor
Motordriver
1
Motordriver
2
Y0Pulse output
CW/CCW output
Pulse output
CW/CCW output
Y2
Y1Y3
FP0
Stepping motor,Servo motor
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 4
5.1 Outline of Functions
PWM output functionBy using the appropriate instruction, the PWM output function enables a pulse outputof the desired duty ratio.
When you increase the pulse width...
heatingincreases.
When you decrease it...
heatingdecreases.
5.1.2 Performance of Built - in High-speed Counter
Channel numberThere are four channels for the built - in high-speed counter.
The channel number allocated for the high-speed counter will change depending onthe function being used.
Counting rangeK-8388608 to K8388607(HFF8000 to H7FFFFF)(Coded 24-bit binary)
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 5
5.2 Specifications and Restricted Items
5.2 Specifications and Restricted Items
5.2.1 Specifications
Table of high-speed counter function specificationsInput/output contact numberbeing used
Built-inhigh-speed
Memory area used Performance specifica-tions
Relatedinstruc-tions
On/offoutput
Countmode
Inputcontactnumber
speedcounterchannel
Controlflag
Elapsedvaluearea
Targetvaluearea
Minimuminputpulse
Maximumcounting speed
tions
number(value inparenthe-sis is re-set input)
channelno. area area pulse
width Usingonly 1chan-nel
Usingmulti-plechan-nels
Speci-fy thede-siredoutput
Incre-mentalinput,Decre-mental
X0(X2)
CH0 R903A DT9044,DT9045/DT90044,DT90045
DT9046,DT9047/DT90046,DT90047
50 μs Max.10 kHz
Total of4 CHwithmax.10 kHz
F0 (MV),F1 (DMV),F166(HC1S),F167output
fromY0 toY7
mentalinput X1
(X2)CH1 R903B DT9048,
DT9049/DT90048,DT90049
DT9050,DT9051/DT90050,DT90051
Max.10 kHz
10 kHz F167(HC1R)
X3(X5)
CH2 R903C DT9104,DT9105/DT90104,DT90105
DT9106,DT9107/DT90106,DT90107
100 μs Max.5 kHz
X4(X5)
CH3 R903D DT9108,DT9109/DT90108,DT90109
DT9110,DT9111/
DT90110,DT90111
Max.5 kHz
Speci-fy thede-siredoutputfrom
2-phase input,Incre-mental/decre-mental
X0X1
(X2)
CH0 R903A DT9044,DT9045/DT90044,DT90045
DT9046,DT9047/DT90046,DT90047
250 μs Max.2 kHz
Total of2 CHwithmax.2 kHz
fromY0 toY7
mentalinput,Direc-tionaldistinc-tion
X3X4
(X5)
CH2 R903C DT9104,DT9105/DT90104,DT90105
DT9106,DT9107/DT90106,DT90107
500 μs Max.1 kHz
NoteReset input X2 can be set to either CH0 or CH1. Reset input X5can be set to either CH2 or CH3.
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 6
5.2 Specifications and Restricted Items
Table of pulse output function specificationsInput/output contact number being used Built-in
high-Memory area used Performance
specificationsRelatedinstruc-
Pulseoutput
Direction-al output
Homeinput
Nearhomeinput
highspeedcounterchannelno.
Con-trolflag
Elapsedvaluearea
Targetvaluearea
specificationsfor maximumoutput fre-quency
instructions
Y0 Y2 X0 DT9052/DT90052<bit2>
CH0 R903A DT9044,DT9045/DT90044,DT90045
DT9046,DT9047/DT90046,DT90047
Max.10 kHz for1-point outputMax.5 kHz for
F0 (MV),F1 (DMV),F168(SPD1),F169 (PLS)
Y1 Y3 X1 DT9052/DT90052<bit6>
CH1 R903B DT9048,DT9049/DT90048,DT90049
DT9050,DT9051/DT90050,DT90051
5 kHz for2-point output
F169 (PLS)
NoteThe maximum 1-point output for instruction F168 (SPD1) is 9.5 kHz.
Table of PWM output specificationsOutput number being used Built - in
high-speedMemory area used Performance
specificationsRelatedinstructionshigh speed
counterchannel no.
Control flagspecificationsfor outputfrequency
instructions
Y0 CH0 R903A Frequency:0.15 Hz to 38 Hz(CPU ver. 2.0 or lat-er: 100 to 1 kHz)
F0 (MV),F1 (DMV),F170 (PWM)
Y1 CH1 R903Ber: 100 to 1 kHz)
Duty:0.1 % to 99.9 %
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 7
5.2 Specifications and Restricted Items
5.2.2 Functions and Restrictions
ChannelThe 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 applicationWhen using CH0 for 2-phase inputting with the high-speed counter function, youcannot allot X0 and X1 to normal inputs.
When using Y0 for the pulse output function, you cannot allot origin input X0 to a normalinput.
When using Y0 for the pulse output (with directional output operating) function, youcannot 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, youcan allot the inputs listed in parenthesis in the specifications table to a normal input.
Example of allowable applicationWhen using the high-speed counter with no reset input and 2-phase input, you canallot 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) areexecuted, the control flag (special internal relay: R903A to R903D) corresponding to theused channel turns on.
When the flag for a channel turns on, another instruction cannot be executed using thatsame channel.
Example of prohibited applicationWhile executing F166 (target value match on instruction) and flag R903A is in the onstate, F167 (target value match off instruction) cannot be executed with CH0.
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 8
5.2 Specifications and Restricted Items
Restrictions for maximum counting speed/pulse output frequencyThe counting speed when using the high-speed counter function will differ dependingon the counting mode as shown in the table.
Example 1:
While in the incremental input mode and using the twochannels CH0 and CH1, if CH0 is being used at 8 kHz, thenCH1 can be used up to 2 kHz.
Example 2:
While in the 2-phase input mode and using the two channelsCH0 and CH2, if CH0 is being used at 1 kHz, then CH2 can beused up to 1 kHz.
The maximum output frequency when using the pulse output function will differdepending on the output contact number as shown in the table.
Example 1:
When using either only Y0 or only Y1, the maximum outputfrequency is 10 kHz.
Example 2:
When using the two contacts Y0 and Y1, the maximum outputfrequency is 5 kHz.
When using the high-speed counter function and pulse output function, specificationswill differ depending on the conditions of use.
Example:
When using one pulse output contact with a maximum outputfrequency of 5 kHz, the maximum counting speed of thehigh-speed counter being used simultaneously is 5 kHz withthe incremental mode and 1 kHz with the 2-phase mode.
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 9
5.3 High-speed Counter Function
5.3 High-speed Counter Function
5.3.1 Outline of High-speed Counter Function
High-speed counter functionThe high-speed counter function counts the input signals, and when the count reachesthe target value, turns on and off the desired output.
The high-speed counter function is able to count high-speed pulses of frequencies upto 10 kHz.
To turn on an output when the target value is matched, use the target value match oninstruction (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 registerIn order to use the high-speed counter function, it is necessary to set system registers400 and 401. For detailed information section 8.4
5.3.2 Types of Input Modes
Incremental input mode
X0onoff
1 2 3 4 n-3 n-2 n-1 n0Count
Decremental input mode
X0onoff
n-1 n-2 n-3 n-4 3 2 1 0nCount
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 10
5.3 High-speed Counter Function
2-phase input mode
X0
X1
onoff
onoff
n-1
(Incremental input: CW)
0 1 2 nCount
X0
X1
onoff
onoff
n-3
(Decremental input: CCW)
n-1n n-2 2 1Count
Incremental/decremental input mode (separate input mode)
X0onoff
1 2 3 2 3 4 30 3 24 1
onoffX1
Increasing Decreasing Increasing Decreasing
Count
Directional distinction mode
3210
X0onoff
2 04 3
onoffX1
Increasing Decreasing
1Count
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 11
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 thechannel number being used.
The output turned on and off can be specified from Y0 to Y7 as desired with instructionsF166 and F167.
When using CH0 with incremental input and reset input
X0
X2
Yn*
Count input
Reset input
On and off output
* The output turned on and off when values match can be specified from Y0 to Y7 asdesired.
When using CH0 with 2-phase input and reset input
X0
X2
A phase input
Reset input
Yn* On and off output
X1B phase input
* The output turned on and off when values match can be specified from Y0 to Y7 asdesired.
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 12
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 dataregister DT9052/DT90052.
Once this instruction is executed, the settings will remain until this instruction isexecuted again.
Operations that can be performed with this instructionCounter 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
X7DF F0 MV, H 1 , DT9052 ⋅⋅⋅⋅⋅⋅⋅ 1
⋅⋅⋅⋅⋅⋅⋅ 2F0 MV, H 0 , DT9052
In the above program, the reset is performed in step 1 and 0is entered just after that in step 2 . The count is now ready foroperation. 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 dataregister DT9044/DT90044.
The elapsed value is stored as 32-bit data in the combined area of special dataregisters 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).
X7DF F1 DMV, K3000, DT9044
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 13
5.3 High-speed Counter Function
Example 2:
Reads the elapsed value of the high-speed counter andcopies it to DT100.
X7DF F1 DMV, DT9044, DT100
Each time the ED instruction is executed, the elapsed value is automatically transferredfrom 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 0matches K10000, output Y7 turns on.
XBDF F166 HC1S, K2, K20000, Y6
If the elapsed value (DT9104 and DT9105/DT90104 and DT90105) for channel 2matches 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 1matches K30000, output Y4 turns off.
XDDF F167 HC1R, K3, K40000, Y5
If the elapsed value (DT9108 and DT9109/DT90108 and DT90109) for channel 3matches K40000, output Y5 turns off.
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 14
5.3 High-speed Counter Function
5.3.5 Sample Program
Wiring examples
Encoderinput
Input terminal
X0
Operation
FP0
Operation/Stop
Inverter
MotorEncoder
X5
COM
Output terminal
Y0
+
- COM
Operationstart
Y0
Speed
Number of pulse5,0000
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 15
5.3 High-speed Counter Function
Positioning operations with a single speed inverterWhen X5 is turned on, Y0 turns on and the conveyor begins moving. When the elapsedvalue (DT9044 and DT9045) reaches K5000, Y0 turns off and the conveyor stops.
R101
DF
X5 R100
R100
R903A R102
DF
R100 R101
DF/
R903A R102
R102
R100 T0
TMX 0, K 5
R101 Y0S
F1 DMV, K 0, DT 9044
F167 HC1R, K 0, K 5000, Y 0
Positioning operations running
Positioning operations start
Start signal to inverter
Completion pulse(0.5 seconds)
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 16
5.3 High-speed Counter Function
Wiring example
FP0
Run/StopFast/Slow
High-speedswitching
Encoderinput
Input terminal
X0
Inverter
MotorEncoder
X5
COM
Output terminal
Y0
+
- COM
Operationstart
Y1
Number of pulse
Y0
5,0004,500
Y1
0
Speed
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 17
5.3 High-speed Counter Function
Positioning operations with a double speed inverterWhen X5 is turned on, Y0 and Y1 turn on and the conveyor begins moving. When theelapsed value (DT9044 and DT9045) reaches K4500, Y1 turns off and the conveyorbegins decelerating. When the elapsed value reaches K5000, Y0 turns off and theconveyor stops.
R101
DF
X5 R100
R100
R903A R103
DF
R100 R101
DF/
R903A R103
R103
R100 T0
TMX 0, K 5
R101 Y0S
Y1S
F61 DCMP, K 4500, DT 9044
R100
DF
R102 Y1
R
R100 R102R900C
F1 DMV, K 0, DT 9044
F167 HC1R, K 0, K 5000, Y 0
High-speed signal to inverter
Reaches deceleration point
Deceleration
Completion pulse (0.5 seconds)
Positioning operations running
Positioning operations start
Start signal to inverter
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 18
5.4 Pulse Output Function
5.4 Pulse Output Function
5.4.1 Outline of Pulse Output Function
Instructions used and control settingsThe pulse function enables positioning control by use in combination with acommercially available pulse-string input type motor driver.
Provides trapezoidal control with the instruction F168 for automatically obtaining pulseoutputs by specifying the initial speed, maximum speed, acceleration/decelerationtime, 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 registerWhen using the pulse output function, set the channels corresponding to systemregisters 400 to “Do not use high-speed counter.”For detailed information section 8.4
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 19
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 withinstruction F168, when the target value is positive, the directional output is turned offand the elapsed value of the high-speed counter increases. When the target value isnegative, the directional output turns on and the elapsed value of the high-speedcounter decreases. By setting H03 in the control code, the directional output is thereverse 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 pulsenumber.)
By setting H12 (absolute; forward: off; reverse: on) in the control code with instructionF168, when the current value is less than the target value, the directional output isturned off and the elapsed value of the high-speed counter increases. When the currentvalue is greater than the target value, the directional output turns on and the elapsedvalue of the high-speed counter decreases. By setting H13 in the control code, thedirectional output is the reverse of that above.For detailed information F168 (SPD1) and section 5.4.5
Home returnUntil the home input (X0 or X1) is entered by executing instruction F168, the pulse iscontinuously 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 operationPulses are output from the specified channel while the trigger for instruction F169 is inthe on state.
The directional output and output frequency are specified by instruction F169.For detailed information F169 (PLS) and section 5.4.5
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 20
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 directionaloutput.
The pulse output terminal, directional output terminal, and home input I/O allocation isdetermined by the channel used. For detailed information section 5.2.1
Near home input is substituted by allocating the desired contact point and turning onand off the specified bit of DT9052/DT90052.For detailed information F0 (MV)
Up to two driver systems can be connected.
When using CH0
X0
X2
Y0
Home input
Near homeinput
Pulse output
*
Y2Directionalswitching output
FP0
Driver
* The near home input specifies the desired input, such as X2.
When using CH1
Home input
Near homeinput
Pulse output
Directionalswitching output
Driver
X1
X3
Y1
*
Y3
FP0
* The near home input specifies the desired input, such as X3.
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 21
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 channelused. 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
Home input
Near homeinput
Pulseoutput
Driver
X0
X2
Y0
*
Y4
FP0
**
CWinput
CCWinput
* 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 relaymust be switched earlier by the amount of its operation time.
Caution when using a double pulse input driverWhen using the FP0 pulse outputs Y0 and Y1 for direct connection to the CW input andCCW input of a driver, the counter elapsed values for the separate channels (ch0 andch1) increase and decrease in response to the individual outputs. The elapsed valuescan thus be sent to the program as necessary.
Y0
Y1
CW input
CCW input
FP0 Driver
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 22
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.
X3DF 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 of5000 Hz, an acceleration/deceleration time of 200 msec, and a movement amount of10000 pulses.
200 msec 200 msec
5000 Hz
500 Hz
10000 pulses
0 Hz
At this time the high-speed counter elapsed value (DT9044 and DT9045/DT90044 andDT90045) will be increasing.
Notes
• For trapezoidal control, set the initial speed to no more than5000 Hz.
• For details on troubleshooting procedures when no pulse isoutput when instruction F168 (SPD1) is executed, refer to page5 - 32.
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 23
5.4 Pulse Output Function
Pulse output instruction (F169)This instruction is for JOG operation by obtaining a pulse from the desired output whenthe execution condition (trigger) turns on.
X2F0 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 thehigh-speed counter CH0 (DT9044 and DT9045/DT90044 and DT90045) increases.
X6F0 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 thehigh-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 pulseoutputs, and setting and resetting the near home input.
Specify this instruction together with the F0 (MV) instruction and the special dataregister DT9052/DT90052.
Once this instruction is executed, the settings will remain until this instruction isexecuted again.
Operations that can be performed with this instructionClear controls (stopping the pulse outputs) from high-speed counter instructions F166to F170.
Near home processing for home return operations.
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 24
5.4 Pulse Output Function
Example 1: Enable the near home input during home return operations andbegin deceleration.
F0 MV, H 0 , DT9052
F0 MV, H 4 , DT9052X3
DF ..... 1
..... 2
In the above program, the near home input is enabled in step1 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.
X7DF 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-speedcounter.
Specify this instruction together with the F1 (DMV) instruction and the special dataregister DT9044/DT90044.
The elapsed value is stored as 32-bit data in the combined area of special dataregisters 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 (exampleof writing the elapsed value).
X7DF F1 DMV, K3000, DT9044
Example 2: Reads the elapsed value of the high-speed counter to DT100.
X7DF F1 DMV, DT9044, DT100
Each time the ED instruction is executed, the elapsed value is automatically transferredfrom the elapsed value area to the special data registers DT9044 and DT9045/DT90044and DT90045.
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 25
5.4 Pulse Output Function
5.4.5 Sample Program for Positioning Control
Wiring example
X0
X1
X2
X3
X4
X5
X6
X7
COM
Stepping motor(- side) (+ side)
Moving table
Input terminal
Y0
Y2
+
-
Pulse output
Directional output
Outputterminal
Home sensor
Positioning start
Positioning start
Home return start
Near home sensor
Forward JOG start
Reverse JOG start
Overrun
FP0
COM
24 V DCpower supply
Stepping motor driver
Seenote.
b contact a contact
a contact
b contact
Pulse input
COM
Directionalinput
. Note
When the stepping motor input is a 5 V photo-coupler type,connect a 2 KΩ 1/4 W resistor.
F0 MV, H 102, DT 100
R11
DF
X1 R10
R10
F0 MV, K 500, DT 101
F0 MV, K5000, DT 102
F0 MV, K 200, DT 103
F1 DMV, K10000, DT 104
F0 MV, K 0, DT 106
R903A R12
DF
R10 R11
F168 SPD1, DT 100, H 0
DF/
R903A R12
R12
R10 T0
Positioning operations running
Positioning operations start
Positioning completion pulse (1 sec)TMX 0, K10
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 26
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 doesnot turn on.
DT100 Control code: H102[refer to “instructionF168 (SPD1)”]
DT101 Initial speed: 500 Hz
DT102 Maximum speed:5000 Hz
DT103 Acceleration/decelera-tion time: 200 msec
DT104DT105
Movement amount:10000 pls
DT106 Pulse stop
Motor
(- side) (+ side)
200 msec 200 msec
5000 Hz
500 Hz0 Hz
10000 pulses10000pulses
F0 MV, H 102, DT 100
R21
DF
X2 R20
R20
F0 MV, K1000, DT 101
F0 MV, K6000, DT 102
F0 MV, K 300, DT 103
F1 DMV, K-8000, DT 104
F0 MV, K 0, DT 106
R903A R22
DF
R20 R21
F168 SPD1, DT 100, H 0
DF/
R903A R22
R22
R20 T1
Positioning operations running
Positioning operations start
Positioning completion pulse (1 sec)TMX 1, K10
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 27
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 turnson.
DT100 Control code: H102[refer to “instructionF168 (SPD1)”]
DT101 Initial speed: 1000 Hz
DT102 Maximum speed:6000 Hz
DT103 Acceleration/decelera-tion time: 300 msec
DT104DT105
Movement amount:-8000 pls
DT106 Pulse stop
Motor
(- side) (+ side)
300 msec 300 msec
6000 Hz
1000 Hz0 Hz
8000 pulses8000
pulses
F0 MV, H 112, DT 100
R31
DF
X1 R30
R30
F0 MV, K 200, DT 101
F0 MV, K4000, DT 102
F0 MV, K 250, DT 103
F1 DMV, K22000, DT 104
F0 MV, K 0, DT 106
R903A R32
DF
R30 R31
F168 SPD1, DT 100, H 0
DF/
R903A R32
R32
R30 T2
Positioning operations running
Positioning operations start
Positioning completion pulse (1 sec)TMX 2, K10
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 28
5.4 Pulse Output Function
Absolute value positioning operationWhen X1 is turned on, pulses are output from Y0. If the current value at that point islarger 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.
DT100 Control code: H112[refer to “instructionF168 (SPD1)”]
DT101 Initial speed: 200 Hz
DT102 Maximum speed:4000 Hz
DT103 Acceleration/decelera-tion time: 250 msec
DT104DT105 Target value: 22000
DT106 Pulse stop
(- side) (+ side)
(10,000) 22,000 (30,000)
Motor
250 msec 250 msec
4000 Hz
200 Hz0 Hz
Regardless of the current value, its movementis towards position “22,000.”
F0 MV, H 123, DT 200R41
DF
X3 R40
R40
F0 MV, K 100, DT 201
F0 MV, K2000, DT 202
F0 MV, K 150, DT 203
F168 SPD1, DT 200, H 0
R903A R42
DFR40 R41
DF/
R903A R42
R42
R40 T3
Home return operations running
Home return operation start
Home return completion pulse
DF
X4F0 MV, H 4, DT9052
F0 MV, H 0, DT9052
TMX 3, K10
Near home deceleration start
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 29
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 whenX0 turns on, home return is completed. After the return to home is completed, theelapsed value (DT9044 and DT9045/DT90044 and DT90045) are cleared to 0.
DT200 Control code: H123[refer to “instructionF168 (SPD1)”]
DT201 Initial speed: 100 Hz
DT202 Maximum speed:2000 Hz
DT203 Acceleration/decelera-tion time: 150 msec
Motor
X0Homesensor
(- side) (+ side)
150 msec 150 msec
2000 Hz
100 Hz0 Hz
Near homesensorX4: on
Home sensorX0: on
X4Nearhomesensor
X3: on
F0 MV, H 122, DT 200R51
DF
X3 R50
R50
F0 MV, K 120, DT 201
F0 MV, K2500, DT 202
F0 MV, K 100, DT 203
F168 SPD1, DT 200, H 0
R903A R52
DFR50 R51
DF/
R903A R52
R52
R50 T4
Home return operations running
Home return operation start
Home return completion pulse
DF
X4F0 MV, H 4, DT9052
F0 MV, H 0, DT9052
TMX 4, K10
Near home deceleration start
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 30
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.
DT200 Control code: H122[refer to “instructionF168 (SPD1)”]
DT201 Initial speed: 120 Hz
DT202 Maximum speed:2500 Hz
DT203 Acceleration/decelera-tion time: 100 msec
Motor
X0Homesensor
(- side) (+ side)
100 msec 100 msec
2500 Hz
120 Hz0 Hz
Near homesensorX4: on
Home sensorX0: on
X4Nearhomesensor
X3: on
F0 MV, H 112, DT 300X5
F0 MV, K 300, DT 301
F169 PLS, DT 300, H 0
F0 MV, H 122, DT 310X6
F0 MV, K 300, DT 311
F169 PLS, DT 310, H 0
Pulse output control clearDF/
X7
F0 MV, H 8, DT9052
F0 MV, H 0, DT9052
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 31
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 Y2does not turn on.
DT300 Control code: H112[refer to “instructionF169 (PLS)”]
DT301 Speed: 300 Hz
Motor
(- side) (+ side) onoff
X5
300 Hz
0 HzY0(Pulse)
JOG operation (minus direction)While X6 is in the on state, a pulse is output from Y0. At this time, directional output Y2turns on.
DT310 Control code: H122[refer to “instructionF169 (PLS)”]
DT311 Speed: 300 Hz
Motor
(- side) (+ side) onoff
X6
300 Hz
0 HzY0(Pulse)
Emergency stop (over limit)If X7 turns off while a pulse is being output from Y0, the output of the pulse is stopped.
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 32
5.4 Pulse Output Function
Troubleshooting flowchart if a pulse is not output when instruction F168(SPD1) executed
No
Yes
No
YesRemedyproblem
No
YesRemedyproblem
No
YesRemedyproblem
No
YesModifyelapsedvalue.
No
Yes
No
Yes
No
Remedyproblem
No
Yes
Remedyproblem
No
Yes
Remedyproblem
Yes
No
Remedyproblem
Yes
No
Remedyproblem
Yes
Error occurs
Special internalrelay R903A or R903B
is already on. Not set to K0 or K1.
[F168 SPD1, j, Kj]
Control clearflag for special data regis-
ter DT9052/DT90052is on.
First wordof data table is not set
to incremental (0), absolute(1), or home
return (2).
HSC CH0 or CH1is set to system
register 400.
Second word ofdata table is set to 40 ≦
initial speed ≦maximum
speed.
Modifyelapsedvalue.
Elapsed valuetried to output pulse in
forward direction atH7FFFFF.
Fifth word of datatable is set to HFF8000
≦ target value ≦H7FFFFF.Elapsed value
tried to output pulse inreverse direction at
HFF8000.
Please contact your dealer.
Set to homereturn mode
Home input isalready used byinterrupt or HSC.
Set to absolutemode
Please contact your dealer.
Please contact your dealer.Yes
Remedyproblem
No
Yes
Please contact your dealer.
Absolute modesetting is target value
= elapsedvalue.
No
High-speed Counter/Pulse Output/ PWM OutputFP0
5 - 33
5.5 PWM Output Function
5.5 PWM Output Function
5.5.1 Outline of PWM Output Function
PWM output functionWith the instruction F170 (PWM), the specified duty ratio and pulse width modulationis obtained.
Applicable to analog controls such as temperature control and light modulation.
Setting the system registerWhen using the PWM output function, set the channels corresponding to systemregisters 400 to “Do not use high-speed counter.” For detailed information section8.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% isoutput from Y0.
X7F0 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 outputfrom Y1.
FP0High-speed Counter/Pulse Output/ PWM Output
5 - 34
5.5 PWM Output Function
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 -useSerial 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 andTerminal Codes(Start Code: STX, Terminal Code: ETX) 6 - 9. . .
FP0General -use Serial Communications
6 - 2
General -use Serial CommunicationsFP0
6 - 3
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 anexternal 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 register412 must be changed to a general-use port (K2).
The transmission speed (baud rate) and transmission format are set using systemregister 413 and 414.
6.1.2 Data Transmission
Any desired data register can be prepared as the transmission table, and the datastored in that table transmitted.
Start and terminal codes are automatically added to the data being transmitted, and thedata 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 ofbytes may be sent, as long as it does not exceed the range that can be used by the dataregister.
External device(PC, etc.)
Transmission
Table for transmission
Transmitteddatastorage area
FP0General -use Serial Communications
6 - 4
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 receptionbuffer. (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.
External device(bar code reader, etc.)
Reception
Reception buffer
Received datastorage area
General -use Serial CommunicationsFP0
6 - 5
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 enablecommunication, 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 settingwhich enables serial communication.
Setting the RS232C Transmission Format (System Register 413)The transmission format is as follows in the default settings. (With the FP ProgrammerII, this is H3.)Data length: 8 bitsParity check: Yes/oddStop bit: 1 bitTerminal code: CRStart code: STX None
Set these items to match the external device connected to the RS232C port, and ifchanging 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 shownbelow, and settings entered using H constants.
15 6 5 4 3 2 1 0
Data length 0:7 bits 1:8 bits
Start code 0:STX None1:STX Yes
Terminal code 00:CR 01:CR and LF10: None 11:ETX
Stop bit 0:1 bit1:2 bits
Parity 00: None 01: Yes (odd)11:Yes (even)
next page
FP0General -use Serial Communications
6 - 6
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 beingsent. When receiving data, if ”Yes” has been specified for the start code parameter, datafollowing the start code is stored in the reception buffer. Also, at the point at which theterminal code is received, the reception completed flag (R9038) goes on. The start andterminal codes themselves are not stored in the reception buffer, however. For details,see section 6.3.2.
NoteIf no terminal codes are specified for either transmission orreception, the reception completed flag will not go on. In thiscase, watch the number of bytes received to determine whetherthe reception has been completed.
Example: Changing the terminal code to [CR and LF]
H3
0 0 0 1 0 0 1 1
H1
bChange H3 (default value) to H13.
Data length
Parity check
Stop bit
Terminal code
Start code
General -use Serial CommunicationsFP0
6 - 7
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
RS232C port
H0: 19200 bit/sH1: 9600 bit/sH2: 4800 bit/sH3: 2400 bit/sH4: 1200 bit/sH5: 600 bit/sH6: 300 bit/s
Tool port
H0: 9600 bit/sH1: 19200 bit/s
If anything other than H0 orH1 is set for the baud rate oftool port, the baud rate willbe 9600 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 receptionbuffers. To change the area of the data register used as the reception buffer, specify theinitial number in system register 417, and the volume (number of words) in systemregister 418.The reception buffer is configured as shown below.
Number ofreception bytes
Initial area specified withsystem register 417
Number of words specifiedby system register 418
Received datastorage area
FP0General -use Serial Communications
6 - 8
6.3 Explanation of Operations When Using General -use Serial Communication
6.3 Explanation of Operations When Using General -useSerial Communication
6.3.1 If “None” is Set for Start and Terminal Codes
Relationship between the flags (reception completed flag andtransmission completed flag) and the F144 (TRNS) instructionExternal receiveddata
R9038Receptioncompleted flag
F144 (TRNS)instructionexecution
A B C CR D E F G
R9039Transmissioncompleted flag
Transmitted data 1 2 3 CR
Duplex transmission dis-abled while F144 (TRNS) in-struction is being executed
Cannot be stored whenreception completedflag is on
A AB B
C
ABC
A
BC
EFC
EB
G
E
<1> <2> <3> <0> <1> <2> <3>
Receptionbuffer
Number of recep-tion bytes
Stored
Number of bytes received iscleared when F144 (TRNS)instruction is executed
on
off
on
off
on
off
Write pointer
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 inprogress. (Example: If the reception completed flag is used multiple times as an inputcondition, there is a possibility of different statuses existing within the same scan.)
When the F144 (TRNS) instruction is executed, the error flag (R9037), receptioncompleted 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 duplextransmission is possible.
General -use Serial CommunicationsFP0
6 - 9
6.3Explanation 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 theF144 (TRNS) instruction. This turns off the error flag, and transmits both actual andempty data.
6.3.2 If “Yes” has been Set for the Start and Terminal Codes(Start Code: STX, Terminal Code: ETX)
When receiving data
Number of bytesreceived is clearedwhen F144 (TRNS)instruction is exe-cuted.
A B C STX D H ETX
A AB B
C
ABC
AEC
GEC
HEC
H
<1> <2> <3> <0> <0> <1> <1>
E ETX F G STX
The reception com-pleted flag is turned offby executing the F144(TRNS) instruction.
The receptioncode is deleted bythe F144 (TRNS)instruction.
BC
D
<1>
EC
D
<2>
EC
D
<2>
EC
D
<0>
EC
G
<1>
Number ofbytes receivedis cleared whenstart code isreceived.
on
off
on
off
Externalreceiveddata
R9038Reception com-pleted flag
F144 (TRNS)instructionexecution
Receptionbuffer
Number of recep-tion bytes
Stored
Write pointer
Cannot bestored whenreceptioncompletedflag is on
Number ofbytes receivedis cleared whenstart code isreceived.
The data is stored in the reception buffer in sequential order, but at the point at whichthe 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 storedin 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 theterminal code is received, the reception completed flag will not be detected.
FP0General -use Serial Communications
6 - 10
6.3 Explanation of Operations When Using General -use Serial Communication
When sending data
ba
b
a
<2> <1> <2> <1> <0>
ba
<0>
ba
<0>
de
c
<3>
STX ETXETX STXa b c d e
<0>
on
off
on
off
d
e
cd
e
c
d
e
c
d
e
c
Transmission Transmission
F144 (TRNS) in-struction execution
R9039Transmissioncompleted flag
Send buffer
Number of bytes not yet sent
Duplex transmissiondisabled while F144(TRNS) instruction isbeing executed
Transmitted data
Transmission point
Start codes (STX) and terminal codes (ETX) are automatically added to the data beingtransmitted, and the data is transmitted to an external device. (For information on startand 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 duplextransmission is possible.
Chapter 7
Programming for FP0 Analog I/O Unit
7.1 Analog I/O Unit Programs 7 - 3. . . . . . . . . . . . . . . . . . . . . . .
FP0Programming for FP0 Analog I/O Unit
7 - 2
Programming for FP0 Analog I/O UnitFP0
7 - 3
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 inputProgram exampleDigital values which have been converted in the analog I/O unit are stored in any desireddata register.
R9010F0 MV , WX2 , DT0
Area where converted data is stored
Data transmission instruction
I/O no. for analog I/O unit input section(Refer to section 8.2.)
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
CPUAnalogI/O unit
A/Dconver-sion
Input (analog value) fromexternal device to analogI/O unit (WX2)
FP0Programming for FP0 Analog I/O Unit
7 - 4
7.1 Analog I/O Unit Programs
Analog outputProgram exampleDigital values which have been stored in any desired data register are transferred to theanalog output area.
R9010F0 MV , DT10 , WY2
I/O no. for analog I/O unit output section(Refer to section 8.2.)
Data transmission instruction
Register where inputdata is stored
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 fromthe analog I/O unit.
Configuration diagram
CPUAnalogI/O unit
D/Aconver-sion
Output (analog value) toexternal device fromanalog I/O unit (WY2)
Precautions during programmingThe I/O numbers for the specified analog I/O unit input and output sections varydepending on the installed position of the analog I/O unit. Refer to the section 8.2 forthe 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.
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/ALARMLED” 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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
FP0Appendix
8 - 2
AppendixFP0
8 - 3
8.1 Performance Specifications
8.1 Performance Specifications
Item Relay output type Transistor output type S-LINKtype
C10RS/C10RM/C10CRS/C10CRM
C14RS/C14RM/C14CRS/C14CRM
C16T/C16P/C16CT/C16CP
C32T/C32P/C32CT/C32CP
T32C SL1
Programming method/Control method Relay symbol/Cyclic operationControllable I/Opoints
Basic unit Total: 10Input: 6Output: 4
Total: 14Input: 8Output: 6
Total: 16Input: 8Output: 8
Total: 32Input: 16Output: 16
Total: 32Input: 16Output: 16
Max. 128Input: 64Output: 64at S-LINKblock
With expansionunit 1When config-ured with sameoutput type ascontrol unit
Max. 58 Max. 62 Max. 112 Max. 128 Max. 128 Max. 96atexpansionblock
With expansionunit 2When relaysand transistorsare mixed
Max. 106 Max. 110 Max. 112 Max. 128 Max. 128
Program memory Built - in memory Built in EEPROM (without battery)Program capacity 2,720 steps 5,000steps 10,000
steps5,000 steps
Numbers ofi t ti
Basic 83instruction High-level 115Operation 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) msOperationmemorypoints
Relay Internal relay (R) 1,008 points (R0 to R62F) 1,008points (R0to R62F)(* Note 1)
1,008points (R0to R62F)
Special internalrelay (R)
64 points (R9000 to R903F)
Timer/Counter(T/C)
144 points (initial setting is 100 timer points, T0 to T99 / 44 counterpoints, C100 to C143 (* Note 2))Timer range: 1ms, 10ms, 100ms, 1s; selected by instruction
Memoryarea
Data register(DT)
1,660 words (DT0 to DT1659) 6,144words(DT0 toDT6143)
16,384words(DT0 toDT16383)(* Note 1)
6,144words(DT0 toDT6143)
Special dataregister (DT)
112 words (DT9000 to DT9111) 112 words(DT90000toDT90111)
112 words(DT9000toDT9111)
Index register(IX, IY)
2 words
Differential points (DF, DF/) Unlimited of pointsMaster control relay points (MCR) 32 pointsNumber of labels (JP and LOOP) 64 labels 255 labels 64 labels
next page
FP0Appendix
8 - 4
8.1 Performance Specifications
Item Relay output type Transistor output type S-LINKtype
C10RS/C10RM/C10CRS/C10CRM
C14RS/C14RM/C14CRS/C14CRM
C16T/C16P/C16CT/C16CP
C32T/C32P/C32CT/C32CP
T32C SL1
Number of step ladders 128 stages 704 stages(* Note 1)
128stages
Number of subroutines 16 subroutines 100 sub-routines
16 sub-routines
Number of interrupt programs 7 programs (external 6 points, internal 1 point) 1 program(internal 1point)
Self-diagnosis function Such as watchdog timer, program syntax checkClock/calender function Not available Available
(* Note 3)Notavailable
Specialfunctions
Pulse catch input Total 6 points
X0 to X1: 50μsec
Notavailablefunctions
Interrupt inputX0 to X1: 50μsecX2 to X5: 100μsec
available
RS232C port(* Note 4)
(Only units with anRS232C port)
Transmission speeds: 300/600/1200/2400/4800/9600/19200bit/sTransmission distance: 3m/9.84ft.Terminal block: 3-pin, made by phoenix Contact Co.(products number: MKDS1/3-3.5)Communication method: Half -duplex
Periodical interrupt 0.5ms to 30s intervalConstant scan AvailableHigh- speed counterfunction(* Note 5, 6)
Counter mode:
Addition/subtraction (one phase) (* Note 7)
- Input point number:
Four channels maximum
- Maximum counting speed:
10kHz maximum for all 4 channels
- Input contacts used:
X0, X1 50μs, <10kHz>
X3, X4 100μs, <5kHz>
X0: count input (ch 0)X1: count input (ch 1)X2: reset input (*Note 8)
X3: count input (ch 2)X4: count input (ch 3)X5: reset input (*Note 8)
- Minimum input pulse width:
Notavailable
Counter mode:
Two-phase/individual/direction decision (two-phase)
- Input point number:
Two channels maximum
- Maximum counting speed:
2kHz maximum for all 2 channels
- Input contacts used:
X0, X1 50μs, <10kHz>
X3, X4 100μs, <5kHz>
X0: count input (ch 0)X1: count input (ch 0)X2: reset input
X3: count input (ch 2)X4: count input (ch 2)X5: reset input
- Minimum input pulse width:
Notavailable
AppendixFP0
8 - 5
8.1 Performance Specifications
Item Relay output type Transistor output type S-LINKtype
C10RS/C10RM/C10CRS/C10CRM
C14RS/C14RM/C14CRS/C14CRM
C16T/C16P/C16CT/C16CP
C32T/C32P/C32CT/C32CP
T32C SL1
Specialfunctions
Pulseoutputf
Output pointnumber
Not available Two independent points (Y0 andY1)(no interpolation function)
Notavailablep
func-tion(* Note6,10)
Outputfrequency
Not available 40Hz to 10kHz (Y0/Y1: one-pointoutput)40Hz to 5kHz (Y0/Y1: two-pointoutput)
Notavailable
PWMoutputf
Output pointnumber
Not available Two points (Y0 and Y1) Notavailablep
func-tion(* Note6)
Outputfrequency
Not available Frequency: 0.15Hz to38Hz,(* Note 9)
Duty: 0.1% to 99.9%
Frequen-cy:0.15Hz to1KHz
Duty:0.1% to99.9%
Notavailable
Memorybackup
Program and systemregister
EEPROM
Operation memory Areas which are held if the powersupply fails are fixed, and areretained by the EEPROM.
- Number of points/words of thefixed hold areas in the variousmemories
Counters: 4 pointsInternal relays: 32 pointsDate registers: 8 words
Areaswhich areheld if thepowersupplyfails arefixed, andareretainedby theEEPROM.- Numberof points/words ofthe fixedhold areasin thevariousmemories
Counters:16 points
Internalrelays:128 points
Dateregisters:32 words
The op-erationmemory isbacked upusingbuilt - incharge-able (sec-ondary )battery, sothe holdtypememoryareas canbe speci-fied usingthe pro-grammingtools.(* Note11)
- Memoryareaswhich canbe speci-fied:Timers,Counters,Internalrelays,Data reg-isters
Areaswhich areheld if thepowersupplyfails arefixed, andareretainedby theEEROM.- Numberof points/words ofthe fixedhold areasin thevariousmemories
Counters:16 points
Internalrelays:128 points
Dateregisters:32 words
next page
FP0Appendix
8 - 6
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 bechanged 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 fluctuationcoefficient value based on fluctuations in the normal voltage of5V and the battery backup voltage of 3V. Also, F157 and F158(time/date addition and subtraction instructions) cannot beused.
4) When using the RS232C port for communication, werecommend using resend processing. The driver IC for theRS232C is in full conformance with EIA/TIA-232E and CCITTV.28 standards.
5) The combinations 1 phase × 2 channels and 2 phases × 1channel are also possible for the high-speed counter.
6) For details and limitations on the high speed counter, pulseoutput, and PWM output function, see sections 5.3 to 5.5.
7) The max. counting speed (10kHz) is the counting speed with arated input voltage of 24V DC and an ambient temperature of25°C. The counting speed (frequency) will decrease dependingon the voltage and temperature.
8) If both reset inputs X0 and X1 are reset, X2 will be the resetinput of X1. In the same way, for X3 and X4, X5 acts as thereset input of X4.
9) With a CPU of Ver. 1.2 or a subsequent version, the frequencywill be 0.15Hz to 1kHz.
10) The maximum is 9.5kHz when the positioning controlinstruction (F168) is executed.
11) Precautions when using the battery backup functionSecondary (chargeable) battery is used as backup battery inthe FP0 T32C control unit. The battery is not charged beforethe unit is shipped, so please make sure that the built - inbackup battery have been charged before using the unit. Fordetailed information, refer to “FP0 Hardware manual.”
AppendixFP0
8 - 7
8.2 I/O Allocation Table
8.2 I/O Allocation Table
FP0 Control UnitsThe I/O allocation of the FP0 control unit is fixed.
Type of Control Unit I/O numberC10 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 UnitsThe I/O allocation of the S-LINK control unit is fixed.
Unit FP0 I/O S-LINK addressInput: 64 points X80 to X8F 0 to 15p p
X90 to X9F 16 to 31
X100 to X10F 32 to 47
X110 to X11F 48 to 63
Output: 64 points Y80 to Y8F 64 to 79p p
Y90 to Y9F 80 to 95
Y100 to Y10F 96 to 111
Y110 to Y11F 112 to 127
FP0 Expansion UnitsThe I/O allocation of the FP0 expansion unit is determined by order of connection.
Type of Expansion Unit I/O numberyp p
First expansion Secondexpansion
Third 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
FP0Appendix
8 - 8
8.2 I/O Allocation Table
Analog I/O UnitThe I/O allocations of the analog I/O unit are determined by the position at which the unitis installed.
Type First expansion Secondexpansion
Third expansion
A21 Input: CH0 16 points WX2(X20 to X2F)
WX4(X40 to X4F)
WX6(X60 to X6F)
Input: CH1 16 points WX3(X30 to X3F)
WX5(X50 to X5F)
WX7(X70 to X7F)
Output: 16 points WY2(Y20 to Y2F)
WY4(Y40 to Y4F)
WY6(Y60 to Y6F)
I/O Link UnitThe I/O allocation of the I/O link unit is determined by order of connection.
Type First expansion Secondexpansion
Third expansion
IOL Input: 32 points X20 to X3F X40 to X5F X60 to X7FIOL Input: 32 points X20 to X3F X40 to X5F X60 to X7F
output: 32 points Y20 to Y3F Y40 to Y5F Y60 to Y7Foutput: 32 points Y20 to Y3F Y40 to Y5F Y60 to Y7F
Expression of numbers for input/output relaysSince input/output relays X and Y are handled in units of 16 points, they are expressedas a combination of decimal and hexadecimal numbers as shown below.
Example: External input relay “X”
Decimal1, 2, 3 12. . . . .
Hexadecimal0, 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 toX 70, X 71 X 7F. . . . . . . . . . . . . . . . . . . . .
×
AppendixFP0
8 - 9
8.3 Relays, Memory Areas and Constants
8.3 Relays, Memory Areas and Constants
Item Numbering Function
C10/C14/C16
C32/SL1 T32
Relays External inputrelay
X 208 points (X0 to X12F) Turns on or off based on exter-nal input.
External out-put relay
Y 208 points (Y0 to Y12F) Externally outputs on or off state.
Internal relay(* Note 1)
R 1,008 points(R0 to R62F)
Relay which turns on or off onlywithin program.
Timer(* Note 1)
T 144 points
(T0 to T99/C100 to C143)(* Note 2)
If a TM instruction has timed out,the contact with the same num-ber turns on.
Counter(* Note 1)
C(* Note 2)
If a CT instruction has countedup, the contact with the samenumber turns on.
Special internalrelay
R 64 points(R9000 to R903F)
Relay which turns on or offbased on specific conditions andis used as a flag.
MemoryAreas
External inputrelay
WX 13 words(WX0 to WX12)
Code for specifying 16 externalinput points as one word (16 bits)of data.
External outputrelay
WY 13 words(WY0 to WY12)
Code for specifying 16 externaloutput points as one word(16 bits) of data.
Internal relay(* Note 1)
WR 63 words(WR0 to WR62)
Code for specifying 16 internalrelay points as one word (16 bits)of data.
Data register(* Note 1)
DT 1,660 words(DT0 toDT1659)
6,144 words(DT0 toDT6143)
16,384 words(DT0 toDT16383)
Data memory used in program.Data is handled in 16-bit units(one word).
Timer/Counter SVset value area(* Note 1)
144 words(SV0 to SV143)
Data memory for storing atarget value of a timer and aninitial value of a counter. Storesby timer/counter number.
Timer/Counter EVelapsed value area(* Note 1)
144 words(EV0 to EV143)
Data memory for storing theelapsed value during operationof a timer/counter. Stores bytimer/counter number.
Special dataregister
DT 112 words(DT9000 to DT9111)
112 words(DT90000to DT90111)
Data memory for storingspecific data. Various settingsand error codes are stored.
Index register IXIY
2 words (IX, IY) Register can be used as an ad-dress of memory area andconstants modifier.
Constant Decimalt t
K K-32768 to K32767 (for 16-bit operation)constants K-2147483648 to K2147483647 (for 32-bit operation)
Hexadecimalt t
H H0 to HFFFF (for 16-bit operation)constants H0 to HFFFFFFFF (for 32-bit operation)
next page
FP0Appendix
8 - 10
8.3 Relays, Memory Areas and Constants
Notes
1) There are two unit types, the hold type that saves theconditions that exist just before turning the power off orchanging from the RUN mode to PROG. mode, and thenon-hold type that resets them. These areas can be specifiedas hold type or non-hold type by setting system register.For the FP0 T32, the selection of hold type and non-hold typecan be changed by the setting of system register. For detailsabout the setting of system registers, refer to section 8.4. Forthe FP0 C10/C14/C16/C32/SL1, that area is fixed and allottedthe numbers as shown below.
Hold type and non-hold type areas
Item C10/C14/C16 C32/SL1Timer 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)(C140 to C143)
16 points (elapsed values)C128 to C143
Internalrelay
Non-hold type 976 points(R0 to R60F)
61 words(WR0 to WR60)
880 points(R0 to R54F)
55 words(WR0 to WR54)
Hold type 32 points (R610 to R62F)2 words (WR61 to WR62)
128 points (R550 to R62F)8 words (WR55 to WR62)
Dataregister
Non-hold type 1652 words(DT0 to DT1651)
6112 words(DT0 to DT6111)g
Hold type 8 words(DT1652 to DT1659)
32 words (DT6112 toDT6143)
2) The points for the timer and counter can be changed by thesetting of system register 5. The number given in the table arethe numbers when system register 5 is at its default setting.For detailed about the system registers section 8.4
AppendixFP0
8 - 11
8.4 Table of System Registers
8.4 Table of System Registers
8.4.1 System Registers
System register areaSystem registers are used to set values (parameters) which determine operation rangesand 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 registerAllocation 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, andthe 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.
FP0Appendix
8 - 12
8.4 Table of System Registers
Checking and changing system register settingsSystem 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 softwareProcedure:
1. Set the mode of the FP0 control unit to PROG.
2. Select the “SYSTEM REGISTER” in “PLCCONFIGURATION” option from the NPST menu.
3. Select the function to be set in the “SYSTEM REGISTER”in “PLC CONFIGURATION” screen. The value set in theselected system register will appear.
4. To change a set value, write the new value as indicatedin 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 IIProcedure:
1. Set the mode of the FP0 control unit to PROG.
2. Press the keys on the FP programmer II, as shown below.ENTACLR
OP(- )
5 0
3. Specify the register number (e.g. No.20) for theparameter to be set and read the parameter.The value set in the selected register will be displayed.
2 0 READ
4. To change the set value, press the <CLR (clear)> key andwrite the new value as indicated in the system registertable.
AppendixFP0
8 - 13
8.4 Table of System Registers
Precautions when setting system registersSystem register settings are effective from the time they are set.However, input, tool port, RS232C port, and modem connection settings becomeeffective when the mode is changed from PROG. to RUN. With regard to the modemconnection setting, when the power is turned off and on or when the mode is changedfrom PROG. to RUN, the controller sends a command to the modem which enables itfor 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. Thetimer and counter together total 144 points, and the default value for the split is 100. Thusthe 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 exampleTo increase the number of timers to 120, change the value of system register 5 to K120.
Setvalue: n
Timer
Counter
MIN (0): All counter
MAX (144): All timer
Set value < nCounter size increases
Set value > nTimer size increases
0
144
For FP0 T32, set the system registers 5 and 6 to the same value. This sets the timer toa non-hold type and counter to a hold type.
By setting system register 5 to “0”, the whole area becomes the counter. Also, by settingit to the value “144”, the whole area becomes the timer.
FP0Appendix
8 - 14
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 supplyinterruption are fixed at the areas shown in the table below, and the settings for systemregisters 6 to 8 and 14, will be invalid.C10/C14/C16Timer 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 Non-hold type: 1652 words (DT0 to DT1651)g
Hold type: 8 words (DT1652 to DT1659)
C32/SL1Timer 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 Non-hold type: 6112 words (DT0 to DT6111)g
Hold type: 32 words (DT6112 to DT6143)
With the FP0 T32, set each relay and register to a hold type or non-hold type.
Setting value < nHold type size increases
Setting value > nNon-hold type size increases
Settingvalue: n
Non-holdtype
Hold type
For normal situations, set the system registers 5 and 6 to the same value. This sets thetimer 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 thevalue 1 higher than the last number, the whole area becomes non-hold type.Default value
TypeArea
FP0 T32
Timer All non-hold type
Counter All hold type
Internalrelay
Non-holdtype
Non-hold type: 10 words (WR0 to WR9)
Hold type Hold type: 53 words (WR10 to WR62)
Data register All hold type
AppendixFP0
8 - 15
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 Defaultvalue
Description
Allocationof usermemory
0 Sequence program areacapacity
The set values are fixed and cannot bechanged.The stored values vary depending on thetype.
K3: 3K words (FP0 C10, C14, C16)K5: 5K words (FP0 C32, SL1)K10: 10K words (FP0 T32)
1 to 3 Not used
Hold/Non- hold
5 Timer and counter division(setting of starting counternumber)
K100 K0 to K144
6 to 8 Not used(Available type: C10, C14,C16, C32, SL1)
With the FP0 C10/C14/C16/C32/SL1, valuesset with the programming tool become invalid.
6 Hold type area startingnumber setting for timer andcounter(Available type: T32)
K100 K0 to K144 Set the system regis-ters 5 and 6 to thesame value.
7 Hold type area startingnumber setting for internalrelays (in word units)(Available type: T32)
K10 K0 to K63
8 Hold type area startingnumber setting for dataregisters(Available type: T32)
K0 K0 to K16384
9 to 13 Not used
14 Not used(Available type: C10, C14,C16, C32, SL1)
With the FP0 C10/C14/C16/C32/SL1, valuesset with the programming tool become invalid.
Hold or non-hold settingfor step ladder process(Available type: T32)
K1 K0: Hold
K1: Non-hold
15 Not used
Action onerror
20 Disable or enable setting forduplicated output
K0 K0: Disable (will be syntax error)
K1: Enable (will not be syntax error)
21, 22 Not used
23 Operation setting when anI/O verification error occurs
K0 K0: Stop
K1: Continuation
24, 25 Not used
26 Operation setting when anoperation error occurs
K0 K0: Stop
K1: Continuation
27 Operation settings whencommunication error occursin the remote I/O (S-LINK)system
K1 K0: Stop
K1: Continuation
FP0Appendix
8 - 16
8.4 Table of System Registers
Item Address Name Defaultvalue
Description
Action onerror
28, 29 Not usederror
4 Not used With the FP0, values set with the program-ming tool become invalid.
Timetti
30 Unusedsetting 31 Wait time setting for
multi-frame communicationK2600(6500 ms)
K4 to K32760: 10 ms to 81900 ms
Used of default setting (K2600/ 6500 ms) isrecommended.
set value × 2.5 ms = Wait time setting formulti - frame commu-nication (ms)
In programming tool software,enter the time (a number divisibleby 2.5).
In FP Programmer II, enter the setvalue (equal to the time divided by2.5).
32, 33 Unused With the FP0, values set with the program-ming tool become invalid.
34 Constant value settings forscan time
K0 K1 to K64 (2.5 ms to 160 ms): Scans onceeach specified time interval.
K0: Normal scan
set value × 2.5 ms = Constant value settingfor scan time (ms)
In programming tool software,enter the time (a number divisibleby 2.5).In FP Programmer II, enter the setvalue (equal to the time divided by2.5).
AppendixFP0
8 - 17
8.4 Table of System Registers
Item Ad-dress
Name Defaultvalue
Description
Inputsetting
400 High-speedcounter modesettings (X0 tox2)
Setting byprogrammingtool software
H0 CH0 0: Do not set input X0 as high-speedcounter.
1: 2-phase input (X0, 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 decision (X0, X1)
10:Direction decision (X0, X1),Reset input (X2)
CH1 0: Do not set input X1 as high-speedcounter.
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 directiondifferentiation, the setting for CH1 is invalid.
• If reset input settings overlap, the setting of CH1 takesprecedence.
• If system register 400 to 403 have been set simultaneously forthe same input relay, the following precedence order iseffective: [High-speed counter] ' [Pulse catch] ' [Interruptinput].
• If the NPST-GR software is used, Ver. 4.0 or a subsequentversion is required for the settings of system register 400 to403.
FP0Appendix
8 - 18
8.4 Table of System Registers
Item Ad-dress
Name Defaultvalue
Description
Inputsetting
400 High-speedcounter modesettings (X0 tox2)
Setting byFP program-mer II
H0 CH0/CH1
0: Do not use high-speed counter.
1: 2-phase input (X0,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), Resetinput (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)
H 0 0
Notes
• If the operation mode is set to 2-phase, individual, or directiondifferentiation, the setting for CH1 is invalid.
• If reset input settings overlap, the setting of CH1 takesprecedence.
• If system register 400 to 403 have been set simultaneously forthe same input relay, the following precedence order iseffective: [High-speed counter] ' [Pulse catch] ' [Interruptinput].
• If the NPST-GR software is used, Ver. 4.0 or a subsequentversion is required for the settings of system register 400 to403.
8.4 Table of System Registers
AppendixFP0
8 - 19
Item Ad-dress
Name Defaultvalue
Description
Inputsetting
401 High-speedcounter modesettings (X3 toX5)
Setting byprogrammingtool software
H0 CH2 0: Do not set input X3 as high-speedcounter.
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 decision (X3, X4)10:Direction decision (X3, X4), Reset input
(X5)
CH3 0: Do not set input X4 as high-speedcounter.
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 directiondifferentiation, the setting for CH3 is invalid.
• If reset input settings overlap, the setting of CH3 takesprecedence.
• If system register 400 to 403 have been set simultaneously forthe same input relay, the following precedence order iseffective: [High-speed counter] ' [Pulse catch] ' [Interruptinput].
• If the NPST-GR software is used, Ver. 4.0 or a subsequentversion is required for the settings of system register 400 to403.
FP0Appendix
8 - 20
8.4 Table of System Registers
Item Ad-dress
Name Defaultvalue
Description
Inputsetting
401 High-speedcounter modesettings (X3 toX5)
Setting byFP program-mer II
H0 CH2/CH3
0: Do not usehigh-speedcounter.
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 usehigh-speedcounter.
3: Incremental input(X4)
4: Incremental input(X4),Reset input (X5)
5: Decremental input(X4)
6: Decremental input(X4),Reset input (X5)
H 0 0
Notes
• If the operation mode is set to 2-phase, individual, or directiondifferentiation, the setting for CH3 is invalid.
• If reset input settings overlap, the setting of CH3 takesprecedence.
• If system register 400 to 403 have been set simultaneously forthe same input relay, the following precedence order iseffective: [High-speed counter] ' [Pulse catch] ' [Interruptinput].
• If the NPST-GR software is used, Ver. 4.0 or a subsequentversion is required for the settings of system register 400 to403.
AppendixFP0
8 - 21
8.4 Table of System Registers
Item Address Name Defaultvalue
Description
Inputsetting
402 Pulse catch input functionsettings
H00: Standard input1: Pulse catch input
In FP Programmer II, enter the above set-tings in hexadecimal.
When X3 and X4 are set to pulse catch input
With the FP0, settings X6 and X7 are invalid.
X5 X4 X3 X2 X1 X00 0 0 0 0 0
0 0 0 1 1 0 0 0
15 0
X0
H8H1
402:
Input H18
X1X2X3X4X5
403 Interrupt input settings H0
When setting inputs X0, X1, X2, and X3 asinterrupts, and X0 and X1 are set as interruptinputs when going from on to off.
Using FP programmer II
Specify the input con-tacts used as inter-rupt inputs in the up-per byte.
Using programming tool software
(0: Standard input/1: Interrupt input)
Specify the effectiveinterrupt edge in thelower byte.
(When 0: on/When 1: off)
X5 X4 X3 X2 X1 X0
X5 X4 X3 X2 X1 X0
0 0 1 115 0
X0
HFH0
403:
Input H30F
X1X2X3X4X5
1 10 0 0 0X0
H3H0
X1X2X3X4X5
1 1
Specifyedge
Specifyinterrupt
404 to 407 Unused With the FP0, values set with the program-ming tool become invalid.
next page
FP0Appendix
8 - 22
8.4 Table of System Registers
Notes
• With the NPST-GR software, “0” or “1” is set for each bit onthe screen in the setting for system register 403.
• If system register 400 to 403 are set simultaneously for thesame 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 incrementalinput mode, even if input X0 is specified as an interrupt inputand as pulse catch input, those settings are invalid, and inputX0 functions as counter input for the high-speed counter.No. 400: H1 a This setting will be valid.No. 402: H1No. 403: H1
AppendixFP0
8 - 23
8.4 Table of System Registers
Item Address Name Defaultvalue
Description
Tool portsetting
410 Unit number setting for toolport (when connectingC-NET)
K1 K1 to K32 (Unit No. 1 to 32)
411 Communication formatsetting for tool port
Setting item
S Default setting value
S Modem communication:Disabled
S Data length (character bits):8 bits
H0
When connecting a modem, set the unitnumber to 1 with system resister 410.
Modem communication
0: Disabled
1: EnabledData length(character bits)
0: 8 bits
1: 7 bits
15 06
Using programming tool softwareSelect items from the menu.
Using FP programmer IISpecify the setting contents using Hconstants.
414 Baud ratesetting fortool port
Setting byprogrammingtool software
H0 0: 9600 bit/s
1: 19200 bit/s
Tool port/RS232Cport set-ting
414 Baud ratesetting fortool port andRS232C port
Setting byFP program-mer II
H1
RS232C port
H0: 19200 bit/s
H1: 9600 bit/s
H2: 4800 bit/s
H3: 2400 bit/s
H4: 1200 bit/s
H5: 600 bit/s
H6: 300 bit/s
Tool port
H0: 9600 bit/s
H1: 19200 bit/s
If 19,200 bit/s is set for both the tool portand RS232C port' H100 should be written.
H 0 0
If anything otherthan H0 or H1 is setfor the tool portbaud rate, the baudrate will be 9600bit/s.
NoteNPST-GR software Ver. 4 or later must be used to set systemregister 414.
FP0Appendix
8 - 24
8.4 Table of System Registers
Item Address Name Defaultvalue
Description
RS232Cportsetting
412 Communication methodsetting for RS232C port
K0 Using programming tool software
Select items from the menu.
Using FP programmer II
K0: RS232C port is not used.
K1: Computer link mode (when connectingC-NET)
K2: Serial data communication mode (gen-eral port)
413 Communication formatsetting for RS232C port
Setting item/Default settingvalue
- Start code: None
- Terminal code: CR
- Stop bit: 1 bit
- Parity check: With odd
- Data length: 8 bits
H3 Using programming tool software
Select items from the menu.
Using FP programmer II
Specify the setting contents using Hconstants.
15 06
Data length 0: 7 bits 1: 8 bits
Parity check 00: None 01: With odd11: With even
Start code 0: No STX 1: STX
Terminal code 00: CR 01: CR+LF10: None 11: ETX
Stop bit 0: 1 bit 1: 2 bits
414 Baud ratesetting forRS232C port
Setting byprogrammingtool software
H1 0: 19200 bit/s1: 9600 bit/s2: 4800 bit/s3: 2400 bit/s4: 1200 bit/s5: 600 bit/s6: 300 bit/s
415 Unit number setting forRS232C port (whenconnecting C-NET)
K1 K1 to K32 (unit No. 1 to 32)
416 Modem compatibility settingfor RS232C port
H0 Using programming tool software
Select items from the menu.
Using FP programmer II
H0: Modem disabled
H8000: Modem enabled
417 Starting address setting forreception buffer
K0 C10C/C14C/C16C: K0 to K1659
C32C/SL1: K0 to K6143
T32C: K0 to K16383
NoteNPST-GR software Ver. 4 or later must be used to set systemregister 414.
AppendixFP0
8 - 25
8.4 Table of System Registers
Item Address Name Defaultvalue
Description
RS232Cport
tti
418 Capacitysetting for
ti
C10C/ C14C/C16C
K1660 K0 to K1660psetting
greceptionbuffer C32C/SL1 K6144 K0 to K6144buffer
T32C K16384 K0 to K16384
FP0Appendix
8 - 26
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 statesare not output externally. Writing is not possible with a programming tool or an instruction.
Address Name DescriptionR9000 Self-diagnostic
error flagTurns on when a self -diagnostic error occurs.The self -diagnostic error code is stored in DT9000.
R9001 toR9003
Not used
R9004 I/O verification errorflag
Turns on when an I/O verification error occurs.
The position number of the I/O where the verification error was occured isstored in DT9010.
R9005,R9006
Not used
R9007 Operation error flag(hold)
Turns on and keeps the on state when an operation error occurs. The ad-dress where the error occurred is stored in DT9017 (indicates the first opera-tion error which occurred).
R9008 Operation error flag(non-hold)
Turns on for an instant when an operation error occurs.
The address where the operation error occurred is stored in DT9018. Thecontents 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 (F60to 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 timercontact
Turns on when the set time elapses (set value reaches 0) in the timing opera-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 errorflag
Turns on when scan time exceeds the time specified in system register 34during 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.
AppendixFP0
8 - 27
8.5 Table of Special Internal Relays
Address Name DescriptionR9013 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 pulserelay
Turns off only at the first scan in the operation.
Turns on from the second scan and maintains the on state.
R9015 Step ladder initialon pulse relay
Turns on for an instant only in the first scan of the
process the moment step ladder process is opened.
R9016,R9017
Not used
R9018 0.01 s clock pulserelay
Repeats on/off operations in 0.01 s cycles.
0.01 sR9019 0.02 s clock pulse
relayRepeats on/off operations in 0.02 s cycles.
0.02 sR901A 0.1 s clock pulse
relayRepeats on/off operations in 0.1 s cycles.
0.1sR901B 0.2 s clock pulse
relayRepeats on/off operations in 0.2 s. cycles
0.2 sR901C 1 s clock pulse
relayRepeats on/off operations in 1 s cycles.
1 sR901D 2 s clock pulse
relayRepeats on/off operations in 2 s cycles.
2 sR901E 1 min clock pulse
relayRepeats on/off operations in 1 min cycles.
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 toR9025
Not used
R9026(* Note)
Message flag Turns on while the F149 (MSG) instruction is executed.
R9027(* Note)
Remote mode flag Turns on while the mode selector is set to REMOTE.
R9028 Not used
Note
Used by the system.
FP0Appendix
8 - 28
8.5 Table of Special Internal Relays
Address Name DescriptionR9029(* Note)
Forcing flag Turns on during forced on/off operation for I/O relay and timer/counter con-tacts.
R902A(* Note)
External interruptenable flag
Turns on while the external interrupt trigger is enabled by the ICTL instruc-tion.
R902B(* Note)
Interrupt error flag Turns on when an interrupt error occurs.
R902C toR902F
Not used
R9030,R9031
Not used
R9032 RS232C port modeflag
When “General-use port” is selected, ”K2” goes on.
R9033 Printout instructionflag
Turns on while a F147 (PR) instruction is executed.
Turns off when a F147 (PR) instruction is not executed.
R9034 Rewrite during RUNflag
This is a special internal relay that goes on for only the first scan followingthe completion of rewriting in the RUN mode.(CPU Ver. 2.1 or later available)
R9035 S-LINK I/O commu-nication error flag
Turns on when the S-LINK error (ERR 1, 3 or 4) occurs using S-LINK sys-tem.
R9036 S-LINK commu-nication status flag
Turns on when communication is taking place with an S-LINK input/outputunit.
R9037 RS232C commu-nication error flag
Turns on when the serial data communication error occurs.
R9038 RS232C receptioncompleted flag
Turns on when a terminator is received during the serial data communicating.
R9039 RS232C transmis-sion completed flag
Turns on while data is not send during the serial data communicating.
Turns off while data is being sent during the serial data communicating.
R903A High-speed countercontrol flag for ch0
Turns on while the high-speed counter instruction “F166 (HC1S) to F170(PWM)” is executed.
R903B High-speed countercontrol flag for ch1
Turns on while the high-speed counter instruction “F166 (HC1S) to F170(PWM)” is executed.
R903C High-speed countercontrol flag for ch2
Turns on while the high-speed counter instruction “F166 (HC1S) to F170(PWM)” is executed.
R903D High-speed countercontrol flag for ch3
Turns on while the high-speed counter instruction “F166 (HC1S) to F170(PWM)” is executed.
R903E,R903F
Not used
Note
Used by the system.
AppendixFP0
8 - 29
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 specificinformation. With the exception of registers for which “Writing is possible” is indicated inthe “Description” column, these registers cannot be written to.
Address Name Description
FP0 T32 FP0 C10, C14,C16, C32, SL1
p
DT90000 DT9000 Self-diagnostic errorcode
The self-diagnostic error code is stored here whena self-diagnostic error occurs. Monitor the errorcode using decimal display.
DT90010 DT9010 I/O verify error unit The position of the I/O for which an error occurredis stored in bits 0 to 3.
DT90014 DT9014 Auxiliary register foroperation
One shift-out hexadecimal digit is stored in bitpositions 0 to 3 when F105 (BSR) or F106 (BSL)instruction is executed.
DT90015 DT9015 Auxiliary register foroperation
The divided remainder (16-bit) is stored inDT9015/DT90015 when F32 (%) or F52 (B%)instruction is executed.
DT90016 DT9016
instruction is executed.
The divided remainder (32-bit) is stored DT9015and DT9016/DT90015 and DT90016 when F33(D%) or F53 (DB%) instruction is executed.
DT90017 DT9017 Operation erroraddress (hold)
After commencing operation, the address wherethe first operation error occurred is stored. Monitorthe address using decimal display.
DT90018 DT9018 Operation erroraddress (non-hold)
The address where a operation error occurred isstored. 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 every2.5ms. (H0 to HFFFF)
Difference between the values of the two points(absolute value) × 2.5ms = Elapsed time betweenthe two points.
FP0Appendix
8 - 30
8.6 Table of Special Data Registers
Address Name Description
FP0 T32 FP0 C10, C14,C16, C32, SL1
p
DT9020(Available type:SL1)
S-LINK status flag /error flag
Notes
S ERR1 and ERR3 occur even if the power supplyon 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 disconnectedwire in the S-LINK system, or whatever is causingthe problem, and then either turn the power to theFP0 on again, press the SET switch to reset it, orturn the power supply on again on the S-LINK unitside.
15 034
DT9020
125
Not used
S-LINK communication status(1: Communication in progress)
ERR4(1: Disconnected wire, or S-LINKinput/output unit error)
ERR3(1: Problem with voltage levelbetween D and G)
Not used
ERR1(1: Short-circuit between D and G)
AppendixFP0
8 - 31
8.6 Table of Special Data Registers
Address Name Description
FP0 T32 FP0 C10, C14,C16, C32, SL1
p
DT9021(Available type:SL1)
No. of units connectedto S-LINK / erroraddress
(When normal)
Note
S When the SET switch is pressed, the numberof input/outputunits connected to theS-LINKsystem is set.(If the same address has been specified formultiple units, the units are counted as asingle unit. This is invalid, however, if anERR4 error is in progress.)
15 034
DT9021
125678
No. of units connected:0 to 128 (0 to H80)
(If ERR4 occurs)
15 034
DT9021
125678
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 (currentvalue)(* Note)
The current scan time is stored here. Scan time iscalculated using the formula:Scan time (ms) = stored data (decimal) × 0.1
K50 indicates 5ms.
NoteScan time display is only possible in RUN mode, and shows theoperation cycle time. The maximum and minimum values arecleared when each the mode is switched between RUN mode andPROG. mode.
FP0Appendix
8 - 32
8.6 Table of Special Data Registers
Address Name Description
FP0 T32 FP0 C10, C14,C16, C32, SL1
p
DT90023 DT9023 Scan time (minimumvalue)(* Note 1)
The minimum scan time is stored here. Scan timeis calculated using the formula:Scan time (ms) = stored data (decimal) × 0.1
K50 indicates 5ms.
DT90024 DT9024 Scan time (maximumvalue)(* Note 1)
The maximum scan time is stored here. Scan timeis calculated using the formula:Scan time (ms) = stored data (decimal) × 0.1
K125 indicates 12.5ms.
DT90025(* Note 2)
DT9025(* Note 2)
Mask conditionmonitoring registerfor interrupts(INT 0 to 5)
The mask conditions of interrupts using ICTLinstruction can be monitored here. Monitor usingbinary display.
0: interrupt disabled (masked)1: interrupt enabled (unmasked)
15 11 7 3 0 (Bit No.)
23 19 16 (INT No.)
DT90026 DT9026 Not used
DT90027(* Note 2)
DT9027(* Note 2)
Periodical interruptinterval (INT 24)
The value set by ICTL instruction is stored.
- K0: periodical interrupt is not used
- K1 to K3000: 10ms to 30s
DT90028 DT9028 Not used
DT90029 DT9029 Not used
DT90030(* Note 2)
DT9030(* Note 2)
Message 0 The contents of the specified message are storedin these special data registers when F149 (MSG)i t ti i t dDT90031
(* Note 2)DT9031(* Note 2)
Message 1
p g ( )instruction is executed.
DT90032(* Note 2)
DT9032(* Note 2)
Message 2
DT90033(* Note 2)
DT9033(* Note 2)
Message 3
DT90034(* Note 2)
DT9034(* Note 2)
Message 4
DT90035(* Note 2)
DT9035(* Note 2)
Message 5
DT90036 DT9036 Not used
DT90037 DT9037 Work 1 for F96 (SRC)instruction
The number of data that match the searched datais stored here when F96 (SRC) instruction isexecuted.
Notes
1) Scan time display is only possible in RUN mode, and showsthe operation cycle time. The maximum and minimum valuesare cleared when each the mode is switched between RUNmode and PROG. mode.
2) Used by the system.
AppendixFP0
8 - 33
8.6 Table of Special Data Registers
Address Name Description
FP0 T32 FP0 C10, C14,C16, C32, SL1
p
DT90038 DT9038 Work 2 for F96 (SRC)instruction
The position of the first matching data, countingfrom the starting 16-bit area, is stored here whenan F96 (SRC) instruction is executed.
DT90039 toDT90043
DT9039 toDT9043
Not used
DT90044 DT9044 High-speed counterelapsed value for ch0
The elapsed value (24-bit data) for the high-speedcounter is stored here. Each time the ED instruc-tion is executed, the elapsed value for the high-speed counter is automatically transferred to the
i l i DT90 d DT90 /DT900DT90045 DT9045
p yspecial registers DT9044 and DT9045/DT90044and DT90045.
The value can be written by executing F1 (DMV)instruction.
DT90046 DT9046 High-speed countertarget value for ch0
The target value (24-bit data) of the high-speedcounter specified by the high-speed counter in-struction is stored here.
Target values have been preset for the variousDT90047 DT9047
Target values have been preset for the variousinstructions, to be used when the high-speedcounter related instruction F166 to F170 is execut-ed. These preset values can only be read, andcannot be written.
DT90048 DT9048 High-speed counterelapsed value area forch1
The elapsed value (24-bit data) for the high-speedcounter is stored here. Each time the ED instruc-tion is executed, the elapsed value for the high-speed counter is automatically transferred to the
i l i DT90 8 d DT90 9/DT900 8DT90049 DT9049
p yspecial registers DT9048 and DT9049/DT90048and DT90049.
The value can be written by executing F1 (DMV)instruction.
DT90050 DT9050 High-speed countertarget value area forch1
The target value (24-bit data) of the high-speedcounter specified by the high-speed counter in-struction is stored here.
Target values have been preset for the variousDT90051 DT9051
Target values have been preset for the variousinstructions, to be used when the high-speedcounter related instruction F166 to F170 is execut-ed. These preset values can only be read, andcannot be written.
FP0Appendix
8 - 34
8.6 Table of Special Data Registers
Address Name Description
FP0 T32 FP0 C10, C14,C16, C32, SL1
p
DT90052 DT9052 High-speedcounter controlflag
A value can be written with F0 (MV) instruction to reset thehigh-speed counter, disable counting, stop high-speedcounter instruction (F168), and clear the high-speedcounter.
Control code setting
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 offour to high-speed channels 0 to 3 as shown below.
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
bit 15 0
for ch3
34781112
for ch2 for ch1 for ch0
DT9052/DT90052
A hardware reset disable is only effective when using thereset 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/calendarmonitor(hour/minute)
Hour and minute data of the clock/calendar are stored here.This data is read-only data; it cannot be overwritten.
Higher 8 bits Lower 8 bits
Hour dataH00 to H23 (BCD)
Minute dataH00 to H59 (BCD)
AppendixFP0
8 - 35
8.6 Table of Special Data Registers
Address Name Description
FP0 T32 FP0 C10, C14,C16, C32, SL1
p
DT90054 Clock/calendarmonitor andsetting(minute/second)
The year, month, day, hour, minute, second, and day-of-the-week data for the calendar timer is stored. The built-in calen-dar timer will operate correctly through the year 2099 andsupports leap years. The calendar timer can be set (the timeset) by writing a value using a programming tool software ora program that uses the F0 (MV) instruction
DT90055 Clock/calendarmonitor andsetting(day/hour)
Higher 8 bits Lower 8 bits
DT90054 Minute data Second data
a program that uses the F0 (MV) instruction.
DT90056 Clock/calendarmonitor andsetting(year/month)
DT90054 Minute dataH00 to H59 (BCD)
Second dataH00 to H59 (BCD)
DT90055 Day dataH01 to H31 (BCD)
Hour dataH00 to H23 (BCD)
DT90056 Year dataH00 H99 (BCD)
Month dataH01 H12 (BCD)DT90057 Clock/calendar
monitor andsetting(day-of-the-week)
Day-of-the-weekdataH00 to H06 (BCD)
H00 to H99 (BCD) H01 to H12 (BCD)
DT90057
FP0Appendix
8 - 36
8.6 Table of Special Data Registers
Address Name Description
FP0 T32 FP0 C10, C14,C16, C32, SL1
p
DT90058 Clock/calendartime setting and30 secondscorrection
The clock/calendar is adjusted as follows.
When setting the clock/calendar by programBy 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.
If you changed the values of DT90054 to DT90057 with thedata monitor functions of programming tool software, the timewill be set when the new values are written. Therefore, it isunnecessary to write to DT90058.
When the correcting times less than 30 secondsBy setting the lowest bit of DT90058 to 1, the value will bemoved up or down and become exactly 0 seconds. After thecorrection is completed, DT90058 is cleared to 0.
Example:Correct to 0 seconds with X0 turns on
At the time of correction, if between 0 and 29 seconds, it willbe moved down, and if the between 30 and 59 seconds, it willbe moved up. In the example above, if the time was 5 minutes29 seconds, it will become 5 minutes 0 second; and, if the timewas 5 minutes 35 seconds, it will become 6 minutes 0 second.
( DF )
[ F0 MV, H 0, DT90054 ]
[ F0 MV, H8000, DT90058 ]
[ F0 MV, H 512, DT90055 ]
1
1X0
Inputs 0. .minutes and0 secondsInputs 12th. .hour 5th daySets the time. .
Correct to 0second.
( DF )
[ F0 MV, H 1, DT90058 ]1
1X0
Note
After discharging the battery (including when the power is turnedon for the first time), the values of DT90053 to DT90058 change atrandom. Once the time and date have been set, these values willfunction normally.
AppendixFP0
8 - 37
8.6 Table of Special Data Registers
Address Name Description
FP0 T32 FP0 C10, C14,C16, C32, SL1
p
DT90059 DT9059 Serial communicationerror code
bit 15 0
Error flag ofRS232C port
34781112
DT9059/DT90059
Error flag oftool 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 ladderprocess
Processnumber:0 to 15
Indicates the startup condition of the step ladder pro-cess. When the proccess starts up, the bit correspond-ing to the process number turns on “1”.
DT90061 DT9061 Processnumber:16 to 31
DT9060/15 11 7 3 0 (Bit No.)
g p
Monitor using binary display.
DT90062 DT9062 Processnumber:32 to 47
DT9060/DT90060
15 11 7 3 0 (Bit No.)
15 11 7 3 0 (Process No.)0:
DT90063 DT9063 Processnumber:48 to 63
0:not -executing1: executing
DT90064 DT9064 Processnumber:64 to 79
A programming tool software can be used to write data.
DT90065 DT9065 Processnumber:80 to 95
DT90066 DT9066 Processnumber:96 to 111
DT90067 DT9067 Processnumber:112 to 127
DT90104 DT9104 High-speed counterelapsed value area forch2
The elapsed value (24-bit data) for the high-speedcounter is stored here. Each time the ED instruction isexecuted, the elapsed value for the high-speed counteris automatically transferred to the special registers
DT90105 DT9105is automatically transferred to the special registersDT9104 and DT9105/DT90104 and DT90105.
The value can be written by executing a DMV (F1)instruction.
DT90106 DT9106 High-speed countertarget value area forch2
The target value (24-bit data) of the high-speed counterspecified by the high-speed counter instruction is storedhere.
T t l h b t f th i i tDT90107 DT9107 Target values have been preset for the various instruc-tions, to be used when the high-speed counter relatedinstruction F166 to F170 is executed. These preset val-ues can only be read, and cannot be written.
FP0Appendix
8 - 38
8.6 Table of Special Data Registers
Address Name Description
FP0 T32 FP0 C10, C14,C16, C32, SL1
p
DT90108 DT9108 High-speed counterelapsed value area forch3
The elapsed value (24-bit data) for the high-speedcounter is stored here. Each time the ED instruction isexecuted, the elapsed value for the high-speed counteris automatically transferred to the special registers
DT90109 DT9109is automatically transferred to the special registersDT9108 and DT9109/DT90108 and DT90109.
The value can be written by executing a DMV (F1)instruction.
DT90110 DT9110 High-speed countertarget value area forch3
The target value (24-bit data) of the high-speed counterspecified by the high-speed counter instruction is storedhere.
T t l h b t f th i i tDT90111 DT9111 Target values have been preset for the various instruc-tions, to be used when the high-speed counter relatedinstruction F166 to F170 is executed. These preset val-ues can only be read, and cannot be written.
AppendixFP0
8 - 39
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 erroror syntax check error has occurred. Confirm the contents of the error and take theappropriate 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 oferror are displayed.Using FP programmer II:With the syntax check error, the error code and message is displayedby simply connecting the unit.With the self -diagnostic error, press the following keys.
READ011OP(- )
ACLR ENT
Then the self -diagnostic error code will be displayed.
2. Check the error contents in the table of error codesusing 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 orincorrect setting written in the program. When the mode selector of controller is switchedto the RUN mode, the total check function automatically activates and eliminates thepossibility of incorrect operation from syntax errors in the program.
When a syntax check error is detectedERROR/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 errorBy changing to the PROG. mode, the error will clear and the ERROR/ALARM LED willturn off.
FP0Appendix
8 - 40
8.7 Error Codes
Steps to take for syntax errorChange to the PROG. mode, and then execute the total check function while onlinemode with the programming tool connected. This will call up the content of error and theaddress 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 occurrenceof an abnormality in the system. The self -diagnostic function monitors the memoryabnormal detection, I/O abnormal detection, and other devices.
When a self -diagnostic error occursThe controller’s ERROR/ALARM LED begins flashing.
The operation of the controller might stop depending on the content of error and thesystem 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 andDT9018/DT90017 and DT90018.
Clearing the self -diagnostic errorUsing NPST-GR software:At the “STATUS DISPLAY”, press the <F3> (error clear) key. Error codes 43 and highercan be cleared.
Using FP programmer IIPress the keys as shown below. Error codes 43 and higher can be cleared.
211OP(- )
ACLR ENT WRTSC
SHIFT
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 alsobe cleared.
The error can also be cleared depending on the self-diagnostic error set instruction F148(ERR).
Steps to take for self -diagnostic errorThe steps to be taken will differ depending on the error contents. For more details, usethe 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 unitFP0 S-LINK Unit Hardware Manual
AppendixFP0
8 - 41
8.7 Error Codes
8.7.2 Table of Syntax Check Error
Errorcode
Name Operationstatus
Description and steps to take
E1 Syntax error Stops A program with a syntax error has been written.
Change to PROG. mode and correct the error.
E2 Duplicatedoutput error
Stops Two or move OT (Out) instructions and KP (Keep) instructions areprogrammed using same relay.
Change to PROG. mode and correct the program so that one relayis 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 andLBL), one instruction is either missing or in an incorrect position.
Change to PROG. mode and enter the two instructions whichmust be used in a pair in the correct positions.
E4 Parametermismatch error
Stops An instruction has been written which does not agree with systemregister settings. For example, the number setting in a program doesnot agree with the timer/counter range setting.
Change to PROG. mode, check the system register settings, andchange so that the settings and the instruction agree.
E5 Program areaerror
Stops An instruction which must be written to a specific area (main programarea or subprogram area) has been written to a different area (forexample, a subroutine SUB to RET is placed before an ED instruc-tion).
Change to PROG. mode and enter the instruction in the correctarea.
E8 High- levelinstructionoperand error
Stops There is an incorrect operand in an instruction which requires a spe-cific combination of operands (for example, the operands must all beof a certain type).
Enter the correct combination of operands.
FP0Appendix
8 - 42
8.7 Error Codes
8.7.3 Table of Self -diagnostic Error
Errorcode
Name Operationstatus
Description and steps to take
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 toagree 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 theinstruction.
Selection of operation status using system register 26:- to continue operation, set K1 (CONT)- to stop operation, set K0 (STOP)
E46 Remote I/O(S-LINK) error
Selectable If an S-LINK error (ERR1, 3, or 4) is detected in the S-LINK systemas 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.
E100toE199
Self-diagnosticerror set byF148 (ERR)i t ti
Stops The self-diagnostic error specified by the F148 (ERR) instruction isoccurred.
Take steps to clear the error condition according to theE200toE299
( )instruction
ContinuesTake steps to clear the error condition according to thespecification you chose.
AppendixFP0
8 - 43
8.8 FP0-SL1 S-LINK Address
8.8 FP0-SL1 S-LINK Address
I/O ad-dress
S-LINK address I/O ad-dress
S-LINK address I/O ad-dress
S-LINK address I/O ad-dress
S-LINK addressdressinput(X)
Deci-mal
Hexa-decimal
dressinput(X)
Deci-mal
Hexa-decimal
dressinput(X)
Deci-mal
Hexa-decimal
dressinput(X)
Deci-mal
Hexa-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-dress
S-LINK address I/O ad-dress
S-LINK address I/O ad-dress
S-LINK address I/O ad-dress
S-LINK addressdressinput(Y)
Deci-mal
Hexa-decimal
dressinput(Y)
Deci-mal
Hexa-decimal
dressinput(Y)
Deci-mal
Hexa-decimal
dressinput(Y)
Deci-mal
Hexa-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
FP0Appendix
8 - 44
8.9 Binary/Hexadecimal/BCD Expressions
8.9 Binary/Hexadecimal/BCD Expressions
Decimal Hexadecimal Binary BCD code
0
1
2
3
4
5
6
7
0000
0001
0002
0003
0004
0005
0006
0007
00000000 00000000
00000000 00000001
00000000 00000010
00000000 00000011
00000000 00000100
00000000 00000101
00000000 00000110
00000000 00000111
0000 0000 0000 0000
0000 0000 0000 0001
0000 0000 0000 0010
0000 0000 0000 0011
0000 0000 0000 0100
0000 0000 0000 0101
0000 0000 0000 0110
0000 0000 0000 0111
8
9
10
11
12
13
14
15
0008
0009
000A
000B
000C
000D
000E
000F
00000000 00001000
00000000 00001001
00000000 00001010
00000000 00001011
00000000 00001100
00000000 00001101
00000000 00001110
00000000 00001111
0000 0000 0000 1000
0000 0000 0000 1001
0000 0000 0001 0000
0000 0000 0001 0001
0000 0000 0001 0010
0000 0000 0001 0011
0000 0000 0001 0100
0000 0000 0001 0101
16
17
18
19
20
21
22
23
0010
0011
0012
0013
0014
0015
0016
0017
00000000 00010000
00000000 00010001
00000000 00010010
00000000 00010011
00000000 00010100
00000000 00010101
00000000 00010110
00000000 00010111
0000 0000 0001 0110
0000 0000 0001 0111
0000 0000 0001 1000
0000 0000 0001 1001
0000 0000 0010 0000
0000 0000 0010 0001
0000 0000 0010 0010
0000 0000 0010 0011
24
25
26
27
28
29
30
31
0018
0019
001A
001B
001C
001D
001E
001F
00000000 00011000
00000000 00011001
00000000 00011010
00000000 00011011
00000000 00011100
00000000 00011101
00000000 00011110
00000000 00011111
0000 0000 0010 0100
0000 0000 0010 0101
0000 0000 0010 0110
0000 0000 0010 0111
0000 0000 0010 1000
0000 0000 0010 1001
0000 0000 0011 0000
0000 0000 0011 0001
⋮63⋮
255⋮
9999
⋮003F
⋮00FF
⋮270F
⋮00000000 00111111
⋮00000000 11111111
⋮00100111 00001111
⋮0000 0000 0110 0011
⋮0000 0010 0101 0101
⋮1001 1001 1001 1001
AppendixFP0
8 - 45
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
b7 b b b b b b bASCII HEX
Most significant digit
b7 b6 b5 b4 b3 b2 b1 b0ASCII HEXcode
0 1 2 3 4 5 6 7
0 0 0 0 0 NUL DEL 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
0 1 1 0
digi
t
6 ACK SYN & 6 F V f v
0 1 1 1
nific
antd
7 BEL ETB ’ 7 G W g w
1 0 0 0
asts
igni
8 BS CAN ( 8 H X h x
1 0 0 1 Leas
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
FP0Appendix
8 - 46
8.10 ASCII Codes
FP0 Index
I - 1
Index
A
ASCII codes, 8 - 45
B
Basic function instructions, 2 - 4
Basic instructions, 2 - 3, 2 - 7
Baud rate, 6 - 7, 8 - 23, 8 - 24
BCD, 8 - 44
BCD arithmetic instructions, 3 - 7
BCD data, 4 - 5
BIN arithmetic instructions, 3 - 6
Binary, 8 - 44
Bit manipulation instructions, 3 - 10
C
Carry flag, 8 - 26
Character constants (M), 1 - 23
Clock pulse relay, 8 - 27
Communication format setting, 8 - 23,8 - 24
Constants, 1 - 21, 8 - 9
Control instructions, 2 - 5
Counter (C), 1 - 10
D
Data compare instructions, 2 - 6
Data comparison instructions, 3 - 7
Data conversion instructions, 3 - 8
Data reception, 6 - 4
Data register (DT), 1 - 13
Data rotate instructions, 3 - 9
Data shift instructions, 3 - 9
Data transfer instructions, 3 - 6
Data transmission, 6 - 3
Decimal constants (K), 1 - 21
Duplicated output, 4 - 3
Duplicated output error, 8 - 41
E
Elapsed value area for timer/counter(EV), 1 - 18
Error codes, 8 - 39
Execution condition, 3 - 4
External input relays (X), 1 - 6
External output relays (Y), 1 - 6
F
Forced input and output, 4 - 27
G
General -use serial communications, 6 - 3
H
Hexadecimal constants (H), 1 - 22
Hexadecimal, 8 - 44
High- level instruction number, 3 - 3
High- level instructions, 3 - 3, 3 - 11
High-speed counter function, 5 - 3, 5 - 9
High-speed counter function specifica-tions, 5 - 5
Hold types, 8 - 11
Hold types and non-hold type settings,8 - 14
I
I/O allocation, 8 - 7
Index modification, 4 - 7
Index registers (IX, IY), 1 - 19, 4 - 7
Index FP0
I - 2
Internal relays (R), 1 - 7
Interrupt input settings, 8 - 21
L
Leading edge detection method, 4 - 13
Logic operation instructions, 3 - 8
M
Memory areas, 1 - 12, 8 - 9
Modem compatibility setting, 8 - 24
Modem connection setting, 8 - 11
N
Non-hold type, 8 - 11
O
Operand, 3 - 3
Operation errors, 4 - 10
Overflow, 1 - 27
P
Performance specifications, 8 - 3
Pulse catch input function settings, 8 - 21
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 to8 - 25
RS232C transmission format, 6 - 5
S
S-LINK address, 8 - 43
Self -diagnostic error, 8 - 40, 8 - 42
Self -diagnostic error code, 8 - 29
Self -diagnostic error flag, 8 - 26
Sequence basic instructions, 2 - 3
Set value area for timer/counter (SV),1 - 17
Setting the timers and counters, 8 - 13
Special data registers, 1 - 15, 8 - 29
Special instructions, 3 - 10
Special internal relays, 1 - 9, 8 - 26
Start codes (STX), 6 - 6
Syntax check error, 8 - 39, 8 - 41
Syntax error, 8 - 41
System registers, 8 - 11, 8 - 15
T
Terminal codes (EXT), 6 - 6
Timer (T), 1 - 10
Tool port setting, 8 - 11, 8 - 23
Trigger, 3 - 4
U
Underflow, 1 - 27
Record of changesFP0
R - 1
Record of changesManual 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/ACG-M309E
NOV.1999 4th edition
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/ACG-M309E-1
JUN.2000 5th edition
S Additional high- level instructions“Floating point type real number operation instructions”[“F309 (FMV) to F338 (DEG)”]
Record of changes FP0
R - 2