nais control 1131 fp0-fp1-fpm instruction set

549
NAiS Control 1131 FP0/FP1/FP–M Instruction Set NAiS Control 1131 FP0/FP1/FP–M Instruction Set ACGM0130END V1.1 10/1999 Matsushita Electric Works (Europe) AG is a global brand name of Matsushita Electric Works.

Upload: muhammad-rodhy

Post on 11-Apr-2015

2.370 views

Category:

Documents


9 download

TRANSCRIPT

Page 1: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131

FP0/FP1/FP–MInstruction Set

NA

iS C

on

trol 1131 F

P0/F

P1/F

P–M

Instru

ction

Set

AC

GM

0130EN

D V

1.1 10/1999M

atsushita Electric W

orks (Europe) A

G

is a global brand name of Matsushita Electric Works.

Page 2: Nais Control 1131 FP0-FP1-FPM Instruction Set

BEFORE BEGINNINGThis manual and everything described in it are copyrighted. You may not copy thismanual, in whole or part, without written consent of Matsushita Electric Works(Europe) AG.

Matsushita Electric Works (Europe) AG pursues a policy of continuous improvementof the design and performance of its products, therefore, we reserve the right tochange the manual/product without notice. In no event will Matsushita Electric Works(Europe) AG be liable for direct, special, incidental, or consequential damageresulting from any defect in the product or its documentation, even if advised of thepossibility of such damages.

LIMITED WARRANTYAll implied warranties on the product, including merchantability and fitness, arelimited to one year from the date of purchase.

If physical defects caused by distribution are found, Matsushita Electric Works(Europe) AG, will replace/repair the product free of charge. Exceptions include:

� When physical defects are due to different usage/treatment of theproduct other than described in the manual.

� When physical defects are due to defective equipment other than thedistributed product.

� When physical defects are due to modifications/repairs by someoneother than Matsushita Electric Works (Europe) AG.

� When physical defects are due to natural disasters.

�MS–DOS and Windows are registered trademarks of Microsoft Corporation.�IBM Personal Computer AT is registered trademark of the International Business

Machines Corporation.

Page 3: Nais Control 1131 FP0-FP1-FPM Instruction Set

Important Symbols

The following symbols are used in this manual:

Whenever the warning triangle is used, especially importantsafety instructions are given. If they are not adhered to, theresults could be:

•personal injury and/or•significant damage to instruments or their contents,

e.g. data

�Note

Contains important additional information or indicates that youshould proceed with caution.

� Example:

Contains an illustrative example of the previous text section.

� next pageIndicates that the text will be continued on the next page.

!

Page 4: Nais Control 1131 FP0-FP1-FPM Instruction Set
Page 5: Nais Control 1131 FP0-FP1-FPM Instruction Set
Page 6: Nais Control 1131 FP0-FP1-FPM Instruction Set

iMatsushita Electric Works (Europe) AG

Table of Contents

Part 1

Chapter 1 Basics

1.1 Operands 1 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.1 In– /Outputs 1 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.2 Internal Relays 1 – 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.3 Special Internal Relays 1 – 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.4 Timers and Counters 1 – 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.5 Data Registers (DT) 1 – 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.6 Special Data Registers (DT) 1 – 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.7 File Registers (FL) 1 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.8 Link Relays and Registers (L/LD) 1 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . .

1.2 Addresses 1 – 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.1 Matsushita Addresses 1 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.2 IEC Addresses 1 – 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.3 Constants 1 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.1 Decimal Constants 1 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.2 Hexadecimal Constants 1 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.3 BCD Constants 1 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.4 Data Types 1 – 14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.1 BOOL 1 – 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.2 INTEGER 1 – 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.3 DOUBLE INTEGER 1 – 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.4 STRING 1 – 16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.5 WORD 1 – 16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.6 DOUBLE WORD 1 – 16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.7 ARRAY 1 – 17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.8 TIME 1 – 22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.9 REAL 1 – 22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 7: Nais Control 1131 FP0-FP1-FPM Instruction Set

Table of Contents NAiS Control 1131

ii

Matsushita Electric Works (Europe) AG

Part 2 IEC Functions

Chapter 2 Conversion Functions

(E_)BOOL_TO_INT 2 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)BOOL_TO_DINT 2 – 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)BOOL_TO_WORD 2 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)BOOL_TO_DWORD 2 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_BOOL 2 – 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_DINT 2 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_WORD 2 – 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_DWORD 2 – 17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_REAL 2 – 19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_TIME 2 – 21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_BCD 2 – 23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_BOOL 2 – 25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_INT 2 – 27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_WORD 2 – 29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_TIME 2 – 31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_DWORD 2 – 33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_REAL 2 – 35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_BCD 2 – 37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)WORD_TO_BOOL 2 – 39. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)WORD_TO_INT 2 – 41. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)WORD_TO_DINT 2 – 43. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)WORD_TO_DWORD 2 – 45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)WORD_TO_TIME 2 – 47. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DWORD_TO_BOOL 2 – 49. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DWORD_TO_INT 2 – 51. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DWORD_TO_DINT 2 – 53. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DWORD_TO_WORD 2 – 55. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DWORD_TO_TIME 2 – 57. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)REAL_TO_INT 2 – 59. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)REAL_TO_DINT 2 – 61. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TIME_TO_INT 2 – 63. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TIME_TO_DINT 2 – 65. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TIME_TO_WORD 2 – 67. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 8: Nais Control 1131 FP0-FP1-FPM Instruction Set

Table of ContentsNAiS Control 1131

iiiMatsushita Electric Works (Europe) AG

(E_)TIME_TO_DWORD 2 – 69. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TRUNC_TO_INT 2 – 71. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TRUNC_TO_DINT 2 – 74. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)BCD_TO_INT 2 – 77. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)BCD_TO_DINT 2 – 79. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)REAL_TO_TIME 2 – 81. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TIME_TO_REAL 2 – 83. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Chapter 3 Numerical Functions

(E_)ABS 3 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Chapter 4 Arithmetic Functions

(E_)MOVE 4 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ADD 4 – 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)SUB 4 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MUL 4 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DIV 4 – 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MOD 4 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)SQRT 4 – 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)SIN 4 – 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ASIN 4 – 21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)COS 4 – 24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ACOS 4 – 27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TAN 4 – 30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ATAN 4 – 33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)LN 4 – 36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)LOG 4 – 39. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)EXP 4 – 42. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)EXPT 4 – 45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 9: Nais Control 1131 FP0-FP1-FPM Instruction Set

Table of Contents NAiS Control 1131

iv

Matsushita Electric Works (Europe) AG

Chapter 5 Process Data Type Functions

(E_)ADD_TIME 5 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)SUB_TIME 5 – 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MUL_TIME_INT 5 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MUL_TIME_DINT 5 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MUL_TIME_REAL 5 – 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DIV_TIME_INT 5 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DIV_TIME_DINT 5 – 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DIV_TIME_REAL 5 – 17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Chapter 6 Bitshift Functions

(E_)SHL 6 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)SHR 6 – 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ROL 6 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ROR 6 – 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Chapter 7 Bitwise Boolean Functions

(E_)AND 7 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)OR 7 – 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)XOR 7 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)NOT 7 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Chapter 8 Selection Function

(E_)MAX 8 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MIN 8 – 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)LIMIT 8 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MUX 8 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 10: Nais Control 1131 FP0-FP1-FPM Instruction Set

Table of ContentsNAiS Control 1131

vMatsushita Electric Works (Europe) AG

Chapter 9 Comparison Functions

(E_)GT 9 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)GE 9 – 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)EQ 9 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)LE 9 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)LT 9 – 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)NE 9 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Part 3IEC Function Blocks

Chapter 10 Bistable Function Blocks

(E_)SR 10 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)RS 10 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Chapter 11 Edge Detection

(E_)R_TRIG 11 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)F_TRIG 11 – 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Chapter 12 Counter

(E_)CTU 12 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)CTD 12 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)CTUD 12 – 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Chapter 13 Timer

(E_)TP 13 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TON 13 – 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TOF 13 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 11: Nais Control 1131 FP0-FP1-FPM Instruction Set

Table of Contents NAiS Control 1131

vi

Matsushita Electric Works (Europe) AG

Part 4 Matsushita Instructions

Chapter 14 Matsushita Instructions

CT, Down Counter 14 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

DF, Leading Edge Differential 14 – 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

DFN, Trailing Edge Diffential 14 – 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ICTL, Interrupt Control 14 – 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

JP, Jump to label 14 – 14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

KEEP, Serves as a relay with set and reset inputs 14 – 15. . . . . . . . . . . . . . . . . . . . . . .

LBL, Label for the JP and LOOP Instruction 14 – 16. . . . . . . . . . . . . . . . . . . . . . . . . . . .

LOOP, Loop to Label 14 – 17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

LSR, Left shift register 14 – 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

MC, Master Control relay 14 – 19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

MCE, Master Conrol Relay End 14 – 20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

TM_1ms, On Delay Timer for 0.001s Units 14 – 21. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

TM_10ms, On Delay Timer for 0.01s Units 14 – 23. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

TM_100ms, On Delay Timer for 0.1s Units 14 – 25. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

TM_1s, On Delay Timer for 1s Units 14 – 27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F0 (MV), 16–bit data move 14 – 29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F1 (DMV) 32–bit data move 14 – 30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F2 (MVN) 16–bit data inversions and move 14 – 31. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F3 (DMVN) 32–bit data inversions and move 14 – 32. . . . . . . . . . . . . . . . . . . . . . . . . . .

F5 (BTM) Bit data move 14 – 33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F6 (DGT) Digit data move 14 – 34. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F10 (BKMV) Block transfer 14 – 35. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F11 (COPY) Block copy 14 – 36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F12 EPRD EEPROM read from memory 14 – 37. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

P13 EPWT EEPROM write to memory 14 – 39. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F15 (XCH) 16–bit data exchange 14 – 42. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F16 (DXCH) 32–bit data exchange 14 – 43. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F17 (SWAP) Higher/lower byte in 16–bit data exchange 14 – 44. . . . . . . . . . . . . . . . . .

F20 (ADD) 16–bit addition 14 – 45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F21 (DADD) 32–bit addition 14 – 46. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F22 (ADD2) 16–bit addition, destination can be specified 14 – 47. . . . . . . . . . . . . . . .

F23 (DADD2) 32–bit addition, destination can be specified 14 – 48. . . . . . . . . . . . . . .

F25 (SUB) 16–bit subtraction 14 – 49. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 12: Nais Control 1131 FP0-FP1-FPM Instruction Set

Table of ContentsNAiS Control 1131

viiMatsushita Electric Works (Europe) AG

F26 (DSUB) 32–bit subtraction 14 – 50. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F27 (SUB2) 16–bit subtraction, destination can be specified 14 – 51. . . . . . . . . . . . . .

F28 (DSUB2) 32–bit subtraction, destination can be specified 14 – 52. . . . . . . . . . . .

F30 (MUL) 16–bit multiplication, destination can be specified 14 – 53. . . . . . . . . . . . .

F31 (DMUL) 32–bit multiplication, destination can be specified 14 – 54. . . . . . . . . . . .

F32 (DIV) 16–bit division, destination can be specified 14 – 55. . . . . . . . . . . . . . . . . . .

F33 (DDIV) 32–bit division, destination can be specified 14 – 56. . . . . . . . . . . . . . . . .

F35 (INC) 16–bit increment 14 – 57. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F36 (DINC) 32–bit increment 14 – 58. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F37 (DEC) 16–bit decrement 14 – 59. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F38 (DDEC) 32–bit decrement 14 – 60. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F40 (BADD) 4–digit BCD addition 14 – 61. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F41 (DBADD) 8–digit BCD addition 14 – 62. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F42 (BADD2) 4–digit BCD addition, destination can be specified 14 – 63. . . . . . . . . .

F43 (DBADD2) 8–digit BCD addition, destination can be specified 14 – 64. . . . . . . .

F45 (BSUB) 4–digit BCD subtraction 14 – 65. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F46 (DBSUB) 8–digit BCD subtraction 14 – 66. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F47 (BSUB2) 4–digit BCD subtraction, destination can be specified 14 – 67. . . . . . .

F48 (DBSUB2) 8–digit BCD subtraction, destination can be specified 14 – 68. . . . . .

F50 (BMUL) 4–digit BCD multiplication, destination can be specified 14 – 69. . . . . . .

F51 (DBMUL) 8–digit BCD multiplication, destination can be specified 14 – 70. . . . .

F52 (BDIV) 4–digit BCD division, destination can be specified 14 – 71. . . . . . . . . . . .

F53 (DBDIV) 8–digit BCD division, destination can be specified 14 – 72. . . . . . . . . . .

F55 (BINC) 4–digit BCD increment 14 – 73. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F56 (DBINC) 8–digit BCD increment 14 – 74. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F57 (BDEC) 4–digit BCD decrement 14 – 75. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F58 (DBDEC) 8–digit BCD decrement 14 – 76. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F60 (CMP) 16–bit data compare 14 – 77. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F61 (DCMP) 32–bit data compare 14 – 78. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F62 (WIN) 16–bit data band compare 14 – 79. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F63 (DWIN) 32–bit data band compare 14 – 80. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F64 (BCMP) Block data compare 14 – 81. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F65 (WAN) 6–bit data AND 14 – 82. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F66 (WOR) 16–bit data OR 14 – 83. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F67 (XOR) 16–bit data exclusive OR 14 – 84. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F68 (XNR) 16–bit data exclusive NOR 14 – 85. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F70 (BCC) Block check code calculation 14 – 86. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F71 (HEX2A) HEX → ASCII conversion 14 – 87. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 13: Nais Control 1131 FP0-FP1-FPM Instruction Set

Table of Contents NAiS Control 1131

viii

Matsushita Electric Works (Europe) AG

F72 (A2HEX) ASCII → HEX conversion 14 – 88. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F73 (BCD2A) BCD → ASCII conversion 14 – 89. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F74 (A2BCD) ASCII → BCD conversion 14 – 90. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F75 (BIN2A) 16–bit BIN → ASCII conversion 14 – 92. . . . . . . . . . . . . . . . . . . . . . . . . . .

F76 (A2BIN) ASCII → 16–bit BIN conversion 14 – 93. . . . . . . . . . . . . . . . . . . . . . . . . . .

F77 (DBIN2A) 32–bit BIN → ASCII conversion 14 – 94. . . . . . . . . . . . . . . . . . . . . . . . . .

F78 (DA2BIN) ASCII → 32–bit BIN conversion 14 – 95. . . . . . . . . . . . . . . . . . . . . . . . . .

F80 (BCD) 16–bit BIN → 4–digit BCD conversion 14 – 96. . . . . . . . . . . . . . . . . . . . . . .

F81 (BIN) 4–digit BCD → 16–bit BIN conversion 14 – 97. . . . . . . . . . . . . . . . . . . . . . . .

F82 (BCD) 32–bit BIN → 8–digit BCD conversion 14 – 98. . . . . . . . . . . . . . . . . . . . . . .

F83 (DBIN) 8–digit BCD → 32–bit BIN conversion 14 – 99. . . . . . . . . . . . . . . . . . . . . . .

F84 (INV) 16–bit data invert (one’s complement) 14 – 100. . . . . . . . . . . . . . . . . . . . . . .

F85 (NEG) 16–bit data two’s complement 14 – 101. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F86 (DNEG) 32–bit data two’s complement 14 – 102. . . . . . . . . . . . . . . . . . . . . . . . . . . .

F87 (ABS) 16–bit data absolute value 14 – 103. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F88 (DABS) 32–bit data absolute value 14 – 104. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F89 (EXT) 16–bit data sign extension 14 – 105. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F90 (DECO) Decode 14 – 106. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F91 (SEGT) 16–bit data 7–segment decode 14 – 108. . . . . . . . . . . . . . . . . . . . . . . . . . .

F92 (ENCO) Encode 14 – 110. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F93 (UNIT) 16–bit data combine 14 – 111. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F94 (DIST) 16–bit data distribution 14 – 113. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F95 (ASC) Character → ASCII transfer 14 – 116. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F96 (SRC) Table data search (16–bit search) 14 – 117. . . . . . . . . . . . . . . . . . . . . . . . . .

F100 (SHR) Right shift of 16–bit data in bit units 14 – 118. . . . . . . . . . . . . . . . . . . . . . .

F101 (SHL) Left shift of 16–bit data in bit units 14 – 119. . . . . . . . . . . . . . . . . . . . . . . . .

F105 (BSR) Right shift of one hexadecimal digit (4 bits) of 16–bit data 14 – 120. . . .

F106 (BSL) Left shift of one hexadecimal digit (4 bits) of 16–bit data 14 – 121. . . . . .

F110 (WSHR) Right shift of one word (16 bits) of 16–bit data range 14 – 122. . . . . .

F111 (WSHL) Left shift of one word (16 bits) of 16–bit data range 14 – 123. . . . . . . .

F112 (WBSR) Right shift of one hex. digit (4 bits) of 16–bit data range 14 – 124. . . .

F113 (WBSL) Left shift of one hex. digit (4 bits) of 16–bit data range 14 – 125. . . . . .

F118 (UCD) Up/Down Counter 14 – 126. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F119 (LRSR) LEFT/RIGHT shift register 14 – 127. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F120 (ROR) 16–bit data right rotate 14 – 129. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F121 (ROL) 16–bit data left rotate 14 – 130. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F122 (RCR) 16–bit data right rotate with carry–flag data 14 – 131. . . . . . . . . . . . . . . .

F123 (RCL) 16–bit data left rotate with carry–flag data 14 – 132. . . . . . . . . . . . . . . . . .

Page 14: Nais Control 1131 FP0-FP1-FPM Instruction Set

Table of ContentsNAiS Control 1131

ixMatsushita Electric Works (Europe) AG

F130 (BTS) 16–bit data bit set 14 – 133. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F131 (BTR) 16–bit data bit reset 14 – 134. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F132 (BTI) 16–bit data bit invert 14 – 135. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F133 (BTT) 16–bit data test 14 – 136. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F135 (BCU) Number of ON bits in 16–bit data 14 – 137. . . . . . . . . . . . . . . . . . . . . . . . .

F136 (DBCU) Number of ON bits in 32–bit data 14 – 138. . . . . . . . . . . . . . . . . . . . . . . .

F137 (STMR) Auxiliary timer (sets the ON– delay timer for 0.01s units) 14 – 139. . .

F138 (HMSS) h:min:s → s conversion 14 – 140. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F139 (SHMS) s → h:min:s conversion 14 – 141. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F140 (STC) Carry–flag set 14 – 142. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F141 (CLC) Carry–flag reset 14 – 143. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F143 (IORF) Partial I/O update 14 – 144. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F144 (TRNS) Serial communication (RS232C) 14 – 145. . . . . . . . . . . . . . . . . . . . . . . . .

F147 (PR) Parallel printout 14 – 147. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F148 (ERR) Self–diagnostic error set 14 – 148. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F149 (MSG) Message display 14 – 149. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F157 (CADD) Time addition 14 – 150. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F158 (CSUB) Time subtraction 14 – 151. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F162 (HC0S) High–speed counter output set 14 – 153. . . . . . . . . . . . . . . . . . . . . . . . . .

F163 (HC0R) High–speed counter output reset 14 – 154. . . . . . . . . . . . . . . . . . . . . . . .

F164 (SPD0) Pulse output control; Pattern output control 14 – 155. . . . . . . . . . . . . . .

F165 (CAM0) Cam control 14 – 156. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F166 (HC1S) Sets Output of High– speed counter (4Channels) 14 – 157. . . . . . . . . .

F167 (HC1R) Resets Output of High–speed Counter (4 Channels) 14 – 159. . . . . . .

F168 (SPD1) Positioning Pulse Instruction 14 – 161. . . . . . . . . . . . . . . . . . . . . . . . . . . .

F169 (PLS) Pulse Width Modulation y 40 Hz 14 – 166. . . . . . . . . . . . . . . . . . . . . . . . . . .

F170 (PWM) Pulse Width Modulation 14 – 169. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F183 (DSTM) Special 32–bit timer 14 – 172. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F327 (INT) Floating point data → 16–bit integer data 14 – 174. . . . . . . . . . . . . . . . . .

F328 (DINT) Floating point data → 32–bit integer data 14 – 176. . . . . . . . . . . . . . . . .

F333 (FINT) Rounding the first decimal point down 14 – 178. . . . . . . . . . . . . . . . . . . . .

F334 (FRINT) Rounding the first decimal point off 14 – 180. . . . . . . . . . . . . . . . . . . . . .

F335 (FSIGN) Floating point data sign changes 14 – 182. . . . . . . . . . . . . . . . . . . . . . . .

F337 (RAD) Conversion of angle units (Degrees → Radians) 14 – 184. . . . . . . . . . . .

F338 (DEG) Conversion of angle units (Radians → Degrees) 14 – 186. . . . . . . . . . . .

F355 (PID) PID processing instruction 14 – 188. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 15: Nais Control 1131 FP0-FP1-FPM Instruction Set

Table of Contents NAiS Control 1131

x

Matsushita Electric Works (Europe) AG

Chapter 15 Standard Matsushita Function Blocks

CT_FB 15 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TM_1ms_FB 15 – 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TM_10ms_FB 15 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TM_100ms_FB 15 – 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TM_1s_FB 15 – 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Appendix A High–Speed Counter, Pulse and PWM Output

A.1 High–Speed Counter, Pulse and PWM Output A – 3. . . . . . . . . . . . . . . . . . . . . . . A.1.1 High–speed counter function A – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.1.2 Pulse output function A – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.1.3 PWM output function A – 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A.2 Specifications and Restricted Items A – 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2.1 Specifications A – 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2.2 Functions and Restrictions A – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A.3 High–Speed Counter Function A – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.3.1 Types of Input Modes A – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.3.2 I/O Allocation A – 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A.4 Pulse Output Function A – 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.4.1 SDT Variables A – 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.4.2 Positioning Function F168 A – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.4.3 Pulse Output Function F169 A – 14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.4.4 High–Speed Counter Control Instruction F0_MV A – 15. . . . . . . . . . . . A.4.5 Elapsed Value Change and Read Instruction F1_DMV A – 16. . . . . . .

A.5 Sample Program for Positioning Control A – 17. . . . . . . . . . . . . . . . . . . . . . . . . . . A.5.1 Relative Value Positioning Operation (Plus Direction) A – 18. . . . . . . . A.5.2 Relative Value Positioning Operation (Minus Direction) A – 19. . . . . . . A.5.3 Absolute Value Positioning Operation A – 20. . . . . . . . . . . . . . . . . . . . . . A.5.4 Home Return Operation (Minus Direction) A – 21. . . . . . . . . . . . . . . . . . A.5.5 Home Return Operation (Plus Direction) A – 22. . . . . . . . . . . . . . . . . . . . A.5.6 JOG Operation (Plus Direction) A – 23. . . . . . . . . . . . . . . . . . . . . . . . . . . A.5.7 JOG Operation (Minus Direction) A – 24. . . . . . . . . . . . . . . . . . . . . . . . . . A.5.8 Emergency Stop A – 24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Appendix B Glossar

Alphabetical Index of All Instructions

Record of Changes

Page 16: Nais Control 1131 FP0-FP1-FPM Instruction Set

Part 1

Chapter 1

Basics

1.1 Operands 1 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.1.1 In–/Outputs 1 – 3. . . . . . . . . . . . . . . . . . . . . . . . .

1.1.2 Internal Relays 1 – 4. . . . . . . . . . . . . . . . . . . . . .

1.1.3 Special Internal Relays 1 – 4. . . . . . . . . . . . . . .

1.1.4 Timers and Counters 1 – 5. . . . . . . . . . . . . . . . .

1.1.5 Data Registers (DT) 1 – 6. . . . . . . . . . . . . . . . . .

1.1.6 Special Data Registers (DT) 1 – 6. . . . . . . . . . .

1.1.7 File Registers (FL) 1 – 7. . . . . . . . . . . . . . . . . . .

1.1.8 Link Relays and Registers (L/LD) 1 – 7. . . . . .

1.2 Addresses 1 – 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.2.1 Matsushita Addresses 1 – 9. . . . . . . . . . . . . . . .

1.2.2 IEC Addresses 1 – 10. . . . . . . . . . . . . . . . . . . . .

1.3 Constants 1 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.3.1 Decimal Constants 1 – 13. . . . . . . . . . . . . . . . . .

1.3.2 Hexadecimal Constants 1 – 13. . . . . . . . . . . . .

1.3.3 BCD Constants 1 – 13. . . . . . . . . . . . . . . . . . . . .

Page 17: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 2

Matsushita Electric Works (Europe) AG

1.4 Data Types 1 – 14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.4.1 BOOL 1 – 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.4.2 INTEGER 1 – 15. . . . . . . . . . . . . . . . . . . . . . . . . .

1.4.3 DOUBLE INTEGER 1 – 15. . . . . . . . . . . . . . . . .

1.4.4 STRING 1 – 16. . . . . . . . . . . . . . . . . . . . . . . . . . .

1.4.5 WORD 1 – 16. . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.4.6 DOUBLE WORD 1 – 16. . . . . . . . . . . . . . . . . . . .

1.4.7 ARRAY 1 – 17. . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.4.8 TIME 1 – 22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.4.9 REAL 1 – 22. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 18: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Basics

1 – 3Matsushita Electric Works (Europe) AG

1.1 Operands

1.1 Operands

In NAiS Control the following operands are available:

• in– and outputs (X/Y) as well as internal memory areas

• internal relays

• special internal relays

• timers and counters

• data registers

• special data registers

• file registers

• link registers and relays

The number of operands which are available depends on the PLC–type and itsconfiguration. To see how many of the respective operands are available, refer to yourhardware description.

1.1.1 In– /Outputs

The amount of in–/outputs available depends on the PLC and unit type. Each inputterminal corresponds to one input X, each output terminal corresponds to one outputY.

In system register 20, the output is fixed as duplicated by NAiS Control.

�Note

Outputs which do not exist physically can be used like flags.These flags are non–holding, which means their contents will belost, e.g. after a power failure.

Page 19: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 4

Matsushita Electric Works (Europe) AG

1.1 Operands

1.1.2 Internal Relays

Internal Relays are memory areas where you can store interim results. Internal relaysare treated like internal outputs.

In system register no. 7 define which internal relays are supposed to beholding/non–holding. Holding means that its values will be retained even after a powerfailure.

The number of available internal relays depends on the PLC type (� hardwaredescription of your PLC).

1.1.3 Special Internal Relays

Special internal relays are memory areas which are reserved for special PLC functions.They are automatically set/reset by the PLC and are used:

• to indicate certain system states, e.g. errors

• as an impulse generator

• to initialize the system

• as ON/OFF control flag under certain conditionssuch as when some flags get a certain status if data are ready fortransmission in a PLC network.

The number of special internal relays available depends on the PLC type (� hardwaredescription of your PLC).

�Note

Special internal relays can only be read.

Page 20: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Basics

1 – 5Matsushita Electric Works (Europe) AG

1.1 Operands

1.1.4 Timers and Counters

Timers and Counters use one common memory and address area.

Define in system registers 5 and 6 how the memory area is to be divided between timersand counters and which timers/counters are supposed to be holding or non–holding.Holding means that even after a power failure all data will be saved, which is not thecase in non–holding registers.

Entering a number in system register 5 means that the first counter is defined. Allsmaller numbers define timers.

For example, if you enter zero, you define counters only. If you enter the highest valuepossible, you define timers only.

In the default setting the holding area is defined by the start address of the counter area.This means all timers are holding and all counters are non–holding. You can of coursecustomize this setting and set a higher value for the holding area, which means someof the timers, or if you prefer, all of them can be defined as holding.

In addition to the timer/counter area, there is a memory area reserved for the set value(SV) and the elapsed value (EV) of each timer/counter contact. The size of both areasis 16 bits (WORD). In the SV and EV area one INTEGER value from 0 to 32,767 canbe stored.

Timer/Counter No. SV EV Relay

TM0 SV0 EV0 T0

.

.

.

.

.

.

.

.

.

.

.

.

TM99 SV99 EV99 T99

CT100 SV100 EV100 C100

.

.

.

.

.

.

.

.

.

.

.

.

While a timer or counter is being processed, the respective acual value can be read andunder certain conditions be edited.

�Note

After changing the settings in system register 5, do not forget toadjust the addresses of the timers/counters in your PLC programbecause they correspond to the TM/CT numbers.

Page 21: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 6

Matsushita Electric Works (Europe) AG

1.1 Operands

1.1.5 Data Registers (DT)

Data registers have a width of 16 bits. You can use them, for example, to write and readconstants/parameters. If an instruction requires 32 bits, two 16–bit data registers areused. If this is the case, enter the address of the first data register with the prefix DDTinstead of DT. The next data register (word) will be used automatically (� example1.2.1).

2. word 1. word DT2 DT1

32 bit data register

Data registers can be holding or non–holding. Holding means that even after a powerfailure all data will be saved. Set the holding/non–holding areas in system register 8 byentering the start address of the holding area.

The amount of data registers available depends on the PLC type (� hardwaredescription).

1.1.6 Special Data Registers (DT)

Special data registers are like the special internal relays reserved for special functionsand are in most cases set/reset by the PLC.

The register has a width of 16 bits (data type = WORD). The amount of special dataregisters available depends on the PLC type (� hardware description).

Most special data registers can only be read. Here some exceptions:

• actual values of the high–speed counter (DT9044 and DT9045; forFP0–T32CP DT90044 and DT90045)

• control flag of the high–speed counter DT9052 (DT90053 forFP0–T32CP)

• real–time clock (DT9054 to DT9058; FP0–T32CP: DT90054 toDT90058)

• interrupts and scan time (DT9027, DT9023–DT9024; FP0–T32CP:DT90027, DT90023–DT90024)...

Page 22: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Basics

1 – 7Matsushita Electric Works (Europe) AG

1.1 Operands

1.1.7 File Registers (FL)

Some PLC–types (� hardware description) provide additional data registers which canbe used to increase the number of data registers. File registers are used in the sameway as data registers. Set the holding/non–holding area in system register 9. Holdingmeans that even after a power failure all data will be saved.

1.1.8 Link Relays and Registers (L/LD)

Link relays have a width of 1 bit (BOOL). Set the:

• transmission area

• amount of link relay words to be sent

• holding/non–holding area

in system registers 10–13 and 40–55. For a detailed description refer to the manualFP3/FP5 MEWNET Link Unit, ACGM0015.

Link registers have a width of 16 bits (WORD). Set the:

• transmission area

• amount of link relay words to be sent

• holding/non–holding area

in system registers 10–13 and 40–55. For a detailed description refer to the manualFP3/FP5 MEWNET Link Unit, ACGM0015.

Page 23: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 8

Matsushita Electric Works (Europe) AG

1.2 Addresses

1.2 Addresses

In the List of Global Variables, enter the physical address in the field “Address” for eachglobal variable used in the PLC program.

The operand and the address number are part of the address. In NAiS Control you canuse either Matsushita and/or IEC addresses. The following abbreviations are used:

Meaning Matsushita IEC

Input X I

Output Y Q

Memory (internal memory area) R M0

Timer relay T M1

Counter relay C M2

Set value SV M3

Elapsed value EV M4

Data register DT/DDT M5

Link relay L M6

Link register LD M7

File register FL M8

You find the register numbers (e.g.: DT9000/90000) in your hardware description. Thenext two sections show how Matsushita and IEC addresses are composed.

Page 24: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Basics

1 – 9Matsushita Electric Works (Europe) AG

1.2 Addresses

1.2.1 Matsushita Addresses

A Matsushita address represents the hardware address of an in–/output, register, orcounter.

For example, the hardware address of the 1st input and the 4th output of an FP1 is:

• X0 (X = input, 0 = first relay)

• Y3 (Y = output, 3 = fourth relay)

Use the following Matsushita abbreviations for the memory areas:

Memory Area Abbr. Example

Memory (internal memory area) R R9000: self diagnostic error

Timer relay T T200: timer relay no. 200(settings in system register 5+6)

Counter relay C C100: counter relay no. 100(settings in system register 5+6)

Set value SV SV200 (set value for counter relay 200)

Elapsed value EV EV100 (elapsed value for timer relay 100)

Data register DT DT9001(signals power failure)

Link relay L L1270

Link register LD LD255

File register FL FL8188

You find the register numbers in your hardware description.

Page 25: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 10

Matsushita Electric Works (Europe) AG

1.2 Addresses

1.2.2 IEC Addresses

The composition of an IEC–1131 address depends on:

• operand type

• data type

• slot no. of the unit (word address)

• relay no. (bit address)

• PLC type

In– and Outputs are the most important components of a programmable logic controller(PLC). The PLC receives signals from the input relays and processes them in the PLCprogram. The results can either be stored or sent to the output relays, which means thePLC controls the outputs.

A PLC provides special memory areas, in short “M”, to store interim results, for example.

If you want to read the status of the input 1 of the first module and control the output4 of the second module, for example, you need the physical address of each in–/output.Physical NAiS Control addresses are composed of the per cent sign, an abbreviationfor in–/output, an abbreviation for the data type and of the word and bit address:

� Example: IEC address for an input

%IX0.0

PhysicalAddress

InputData Type=BOOL

Word Address

Bit Address

The per cent sign is the indicator of a physical address. “I”means input, “X” means data type BOOL. The first zerorepresents the word address (slot no.) and the second one thebit address. Note that counting starts with zero and thatcounting word and bit addresses differs among the PLC types.

Each PLC provides internal memory areas (M) to store interimresults, for example. When using internal memory areas suchas data registers, do not forget the additional number (here 5)for the memory type:

� Example: IEC address for an internal memory area%MW5.0

PhysicalAddress Internal

Memory Area Data TypeMemory Type

Word Address

Bit addresses do not have to be defined for data registers,counters, timers, or the set and actual values.

Page 26: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Basics

1 – 11Matsushita Electric Works (Europe) AG

1.2 Addresses

According to IEC 1131, abbreviations for in– and output are “I” and “O”, respectively.Abbreviations for the memory areas are as follows:

Memory Type No. Example

Internal Relay (R) 0 %MX0.900.0 = internal relay R9000

Timer (T) 1 %MX1.200 = counter no. 200

Counter (C) 2 %MX2.100 = counter no. 100

Set Value counters/timers (SV) 3 %MW3.200 = set value of the counter no. 200

Elapsed Value counters/timers (EV) 4 %MW4.100 = elapsed value of the timer no. 100

Data Registers (DT) 5 %MW5.9001 = data register DT9001

�Note

Tables with hardware addresses can be found in the hardwaredescription of your PLC.

The following data types are available:

Data Type Abbreviation Range of Values Data Width

BOOL BOOL 0 (FALSE), 1 (TRUE) 1 bit

INTEGER INT –32,768 to 32,768 16 bit

DOUBLE INTEGER DINT –2,147,438,648 to 2,147,438,647 32 bit

WORD WORD 0 to 65,535 16 bit

DOUBLE WORD DWORD 0 to 4,294,987,295 32 bit

TIME 16 bit TIME T#0.00s to T#327.67s 16 bit*

TIME 32 bit TIME T#0,00s to T#21 474 836.47s 32 bit*

REAL REAL –1,175494 x 10–38 to –3,402823 x 10–38 and 1,175494 x 10–38 to 3,402823 x 10–38

32 bit

*depends on your PLC

�Note

Please take into account that not all data types can be used witheach IEC command.

� next page

Page 27: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 12

Matsushita Electric Works (Europe) AG

1.2 Addresses

Numbering of in–/output addresses depends on the type of PLC used (� respectivehardware description). For FP0/FP1/FP–M the addresses are not serially numbered.Counting restarts with zero at the first output. Supposing you have one FP1–C24 with16 inputs and 8 outputs, the resulting addresses are: for the input: %IX0.0 – %IX0.15,and for the output: %QX0.0 – %QX0.7. In other words the counting for the word andbit number begins at zero for the outputs.

�Notes

• Find the tables with all memory areas in your hardwaredescription.

• When using timers, counters, set/elapsed values, and dataregisters, the bit address does not have to be indicated.

• You can also enter the register number (R9000, DT9001/90001)or the Matsushita address e.g. “X0” (input 0) instead of theIEC–address.

Page 28: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Basics

1 – 13Matsushita Electric Works (Europe) AG

1.3 Constants

1.3 Constants

A constant represents a fixed value. Depending on the application, a constant can beused as a addend, multiplier, address, in–/output number, set value, etc.

There are 3 types of constants:

• decimal

• hexadecimal

• BCD

1.3.1 Decimal Constants

Decimal constants can have a width of either 16 or 32 bits.

Range 16 bit: –32,768 to 32,768

Range 32 bit: –2,147,483,648 to 2,147,483,648

Constants are internally changed into 16–bit binary numbers including character bit andare processed as such. Simply enter the decimal number in your program.

1.3.2 Hexadecimal Constants

Hexadecimal constants occupy fewer digit positions than binary data. 16 bit constantscan be represented by 4–digit, 32–bit constants by 8–digit hecadecimal constants.

Range 16 bit: 8000 to 7FFF

Range 32 bit: 80000000 to 7FFFFFFFF

Enter e.g.: 16#7FFF for the hexadecimal value 7FFF in your program.

1.3.3 BCD Constants

BCD is the abbreviation for Binary Coded Decimal.

Range 16 bit: 0 to 9999

Range 32 bit: 0 to 99999999

Enter BCD constants in the program either as:

binary: 2#0001110011100101 orhexadecimal: 16#9999

Page 29: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 14

Matsushita Electric Works (Europe) AG

1.4 Data Types

1.4 Data Types

NAiS Control provides elementary and user defined data types.

Elementary data types

Data Type Abbreviation Value Range Data Width

BOOL BOOL 0 (FALSE) or 1 (TRUE) 1 bit

INTEGER INT –32,768 to 32,768 16 bit

DOUBLE INTEGER DINT –2,147,483,648 to 2,147,483,647 32 bit

WORD WORD 0 to 65,535 16 bit

DOUBLE WORD DWORD 0 to 4,294,967,295 32 bit

STRING STRING 1 to 255 bytes (ASCII) 8 bits per byte

TIME 16 bit TIME T#0,00s to T#327.67s 16 bit*

TIME 32 bit TIME T#0,00s to T#21 474 836,47s 32 bit*

REAL REAL –1,175494 x 10–38 to –3,402823 x 10–38 and 1,175494 x 10–38 to 3,402823 x 10–38

32 bit

*depends on your PLC

A data type has to be assigned to each variable.

User defined data typesWe differentiate between array and Data Unit Types (DUT). An array consists of severalelementary data types which are all of the same type. A DUT consists of severalelementary data types but of different data types. Each represents a new data type.

Page 30: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Basics

1 – 15Matsushita Electric Works (Europe) AG

1.4 Data Types

1.4.1 BOOL

Variables of the data type BOOL are binary switches. They either have the status 0 or1 and have a width of 1 bit.

The status 0 corresponds to FALSE and means that the variable has the status OFF.

The status 1 corresponds to TRUE and means that the variable has the status ON.

The default initial value, e.g. for the variable declaration in the POU header or in the Listof Global Variables = 0 (FALSE). In this case the variable has the status FALSE at themoment the PLC program starts. If it should be TRUE at the start, reset the initial valueto TRUE.

1.4.2 INTEGER

Variables of the data type INTEGER are integral natural numbers (without comma) andin WORD format. The range for INTEGER values is –32,768 to 32,768 (decimal).

The default intial value, e.g. for the variable declaration in the POU header or in the Listof Global Variables = 0 (FALSE). You can enter INTEGER numbers in DEC, HEX– orBIN format:

Decimal Hexadecimal Binary

1,234 16#4D2 2#10011010010

–1,234 16#FB2E 2#1111101100101110

1.4.3 DOUBLE INTEGER

Variables of the data type DOUBLE INTEGER are 32–bit natural numbers withoutcommas and in DOUBLD WORD format. The range for INTEGER values is–2,147,483,648 and 2,147,483,648 decimal.

The default intial value, e.g. for the variable declaration in the POU header or in the Listof Global Variables, = 0 (FALSE). You can enter DOUBLE INTEGER numbers in DEC,HEX– or BIN format:

Decimal Hexadecimal Binary

123,456,789 16#75BCD15 2#111010110111100110100010101

–123,456,789 16#F8A432EB 2#1111100010100100001100101110

Page 31: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 16

Matsushita Electric Works (Europe) AG

1.4 Data Types

1.4.4 STRING

The data type STRING consists of a series, i.e. string, of ASCII characters. You canstore a maximum of 255 characters in one string. Each character of the string is storedin a byte.

�Notes

• The data type STRING is only available for the FP2 andFP10SH.

• For the PLCs FP0, FP1 and FP–M you can only enter the datatype STRING as a constant in the POU body (� F95_ASC ofthe Matsushita Library).

• For detailed information, � Online Help in NAiS Control.

1.4.5 WORD

A variable of the data type WORD consists of 16 bits. The states of 16 in–/outputs canbe represented by one word (WORD), for example.

The default intial value, e.g. for the variable declaration in the POU header or in the Listof Global Variables, = 0 (FALSE). Enter WORD values in (DEC), HEX– or BIN format:

Decimal Hexadecimal Binary

1,234 16#4D2 2#10011010010

–1,234 16#FB2E 2#1111101100101110

1.4.6 DOUBLE WORD

A variable of the data type DOUBLE WORD consists of 32 bits. The states of 32in–/outputs can be represented by one DOUBLE WORD, for example.

The default intial value, e.g. for the variable declaration in the POU header or in the Listof Global Variables, = 0 (FALSE). Enter numbers in (DEC), HEX– or BIN format:

Decimal Hexadecimal Binary

123,456,789 16#75BCD15 2#111010110111100110100010101

–123,456,789 16#F8A432EB 2#1111100010100100001100101110

Page 32: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Basics

1 – 17Matsushita Electric Works (Europe) AG

1.4 Data Types

1.4.7 ARRAY

An array is a combination of variables, all of which have the same data type. Thiscombination represents a variable itself, and therefore it has to be declared. This meansthat in order to make an array available for the entire project, it has to be declared inthe List of Global Variables. If an array is used within a POU only, declare it in the POUheader only.

Data types valid for arrays are:

• BOOL

• INT

• DINT

• WORD

• DWORD

• TIME

• REAL

Arrays may be:

• 1–dimensional

• 2–dimensional

• 3–dimensional

� Example: 1–dimensional ARRAY

Declaration in the global variable list:

Declare in the global variable list:• identifier (name for calling up the array in the program)

• initial address where array is saved in the memory

• number of elements and data type of an array

• initial values of individual array elements and

• comment

The declared array can be imagined as follows:onedim_array[0]element 1

onedim_array[2]element 3

onedim_array[14]element 15

onedim_array[15] element 16onedim_array[1] element 2

� next page

Page 33: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 18

Matsushita Electric Works (Europe) AG

1.4 Data Types

Initialize Arrays with ValuesThe initialisation of arrays with values starts with the first array element(element 1) and ends with the last array element (element 16). Theinitialisation values are entered one after another into the field initial and areseparated from each other by commas.

If subsequent array elements are initialised with the same value, theabbreviated writing number(value) is possible.

* number stands for the number of array elements

* value stands for the initialisation value

In the example, element 1 was initialised with value 1, element 2 with value 2etc.

Use Array Elements in the ProgramYou may use a 1–dimensional array element by entering identifier[Var1].

* identifier (name of the array, see field Identifier)

* Var1 is a variable of the type INT or a constant which has to be located inthe value range of the array declaration. For this example Var1 is assigned tothe range 0...15

In the example you call up the third array element (Element 3) withonedim_array[2]. If you wish to assign a value to this element in an ILprogram for example, you enter the following:LD current_temperatureST onedim_array[2]

Addresses of Array ElementsThe array elements of the 1–dimensional array are subsequently saved in thePLC’s memory starting with element 1. This means for the example describedabove:

Matsushita Address

IEC–Address Array Element Array Element Name

DTO %MW5.0 element 1 onedim_array(0)

DT1 %MW5.1 element 2 onedim_array(1)

DT2 %MW5.2 element 3 onedim_array(2)

DT3 %MW5.3 element 4 onedim_array(3)

DT4 %MW5.4 element 5 onedim_array(4)

... ... ... ...

DT13 %MW5.13 element 14 onedim_array(13)

DT14 %MW5.14 element 15 onedim_array(14)

DT15 %MW5.15 element 16 onedim_array(15)

Page 34: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Basics

1 – 19Matsushita Electric Works (Europe) AG

1.4 Data Types

� Example: 2–dimensional ARRAY

Declaration in the global variable list:

The declared array can be imagined as follows:

twodim_array[3,1]element 1

twodim_array[3,2]element 2

twodim_array[4,6]element 12

twodim_array[5,6]element 18

Initialize arrays with valuesThe initialisation of arrays with values starts with the first array element(element 1) and ends with the last array element (element 18). Theinitialisation values are entered one after another into the field initial and areseparated from each other by commas.

If subsequent array elements are initialised with the same value, theabbreviated writing number(value) is possible.

* number stands for the number of array elements

* value stands for the initialisation value

In the example element 1 was initialised with the value FALSE, element 2 withthe value TRUE and the remaining array elements are initialised with FALSE.

Use array elements in the programYou may use a 2–dimensional array element by entering identifier[Var1Var2].

* identifier (name of the array, see field Identifier)

* Var1 and Var2 are variables of the type INT or constants which have to belocated in the value range of the array declaration. For this example Var1 isassigned to the range 3...5 and Var2 to the range 1...6.

In the example you call up the element 12 with twodim_array[4,6]. If you wishto assign a value to this element in an IL program for example, you enter thefollowing:

LD current_temperatureST twodim_array[4,6]

� next page

Page 35: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 20

Matsushita Electric Works (Europe) AG

1.4 Data Types

Addresses of array elementsThe array elements of the 2–dimensional array are subsequently saved in thePLC’s memory starting with element 1. The following storage occupationresults for the example described above:

MatsushitaAddress

IEC–Address Array Element Array Element Name

R0 %MX0.0.0 element 1 twodim_array[3,1]

R1 %MX0.0.1 element 2 twodim_array[3,2]

R2 %MX0.0.2 element 3 twodim_array[3,3]

... ... ... ...

R5 %MX0.0.5 element 6 twodim_array[3,6]

R6 %MX0.0.6 element 7 twodim_array[4,1]

R7 %MX0.0.7 element 8 twodim_array[4,2]

... ... ... ...

RF %MX0.0.15 element 16 twodim_array[5,4]

R10 %MX0.1.0 element 17 twodim_array[5,5]

R11 %MX0.1.1 element 18 twodim_array[5,6]

� Example: 3–dimensional ARRAY

Declaration in the global variable list:

The declared array can be imagined as follows:

threedim_array[–8,0,2]element 1

threedim_array[–8,0,3]element 2

threedim_array[–7,0,2]element 13

threedim_array[1,0,4]element 111

Page 36: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Basics

1 – 21Matsushita Electric Works (Europe) AG

1.4 Data Types

Initialize arrays with valuesThe initialisation of arrays with values starts with the first array element(element 1) and ends with the last array element (element 120). Theinitialisation values are entered one after another into the field initial and areseparated from each other by commas. If subsequent array elements areinitialised with the same value, the abbreviated writing number(value) ispossible.

* number stands for the number of array elements* value stands for the initialisation value

In the example all array elements were initialised with the value 123.

Use array elements in the programAccess to a 3–dimensional array is possible by enteringidentifier[Var1,Var2,Var3,Var4].

* identifier is the name of the array, (see field Identifier)

* Var1, Var 2 and Var3 are variables of the type INT or constants which haveto be located in the value range of the array declaration (see field Type). Forthis example Var1 is assigned to the range 8...1 and Var2 to the range 0...3and Var3 to the range 2...4.

In the example you call up element 15 with threedim_array[–7,0,4]. If youwish to assign a value to this element in an IL program, for example, youenter the following:LD current_temperatureST threedim_array[–7,0,4]

Addresses of array elementsThe array elements of the 3–dimensional array are subsequently saved in thePLC’s memory starting with element 1. The following storage occupationresults for the example described above:

MatsushitaAddress

IEC–Address Array Element Array Element Name

DT0 %MW5.0 element 1 threedim_array[–8,0,2]

DT1 %MW5.1 element 2 threedim_array[–8,0,3]

DT2 %MW5.2 element 3 threedim_array[–8,0,4]

DT3 %MW5.3 element 4 threedim_array[–8,1,2]

DT4 %MW5.4 element 5 threedim_array[–8,1,3]

... ... ... ...

DT10 %MW5.10 element 11 threedim_array[–8,3,3]

DT11 %MW5.11 element 12 threedim_array[–8,3,4]

DT12 %MW5.12 element 13 threedim_array[–7,0,2]

DT13 %MW5.13 element 14 threedim_array[–7,0,3]

... ... ... ...

DT117 %MW5.117 element 118 threedim_array[1,3,2]

DT118 %MW5.118 element 119 threedim_array[1,3,3]

DT119 %MW5.119 element 120 threedim_array[1,3,4]

Page 37: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Basics

1 – 22

Matsushita Electric Works (Europe) AG

1.4 Data Types

1.4.8 TIME

For variables of the data type TIME (16 Bit), using FP1 or FP–M, you can indicate aninterval of 0.01 to 327.67 seconds. The resolution amounts to 10ms.

For variables of the data type TIME (32 Bit), using FP0, you can indicate an interval of0.01 to 21 474 836.47 seconds. The resolution amounts to 10ms.

Default ( 16 and 32 bit) = T#0 (corresponds to 0 seconds)

�Note

Times with negative signs cannot be processed. T#–2s is e.g.interpreted as T#10m53s350ms.

� Example:

T#321,12sT#321120msT#0,01sT#3d5h10m3s100ms

1.4.9 REAL

Variables of the data type REAL are real numbers or floating point constants. The valuerange for REAL values is between –1,175494 x 10–38 to –3,402823 x 10–38 and1,175494 x 10–38 to 3,402823 x 10–38. The default for the initial value, e.g. for thevariable declaration in the POU header or in the global variable list = 0.0 You can enterREAL values in the following format: [+–] Integer.Integer [(Ee) [+–] Integer]

� Example:

5.983e–7–33.876e123.876e30.000123123.0

�Note

The REAL value always has to be entered with a decimal point(e.g. 123.0).

Page 38: Nais Control 1131 FP0-FP1-FPM Instruction Set

Part 2IEC Functions

Page 39: Nais Control 1131 FP0-FP1-FPM Instruction Set
Page 40: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 2

Conversion Functions

(E_)BOOL_TO_INT 2 -- 3. . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)BOOL_TO_DINT 2 -- 5. . . . . . . . . . . . . . . . . . . . . . . .

(E_)BOOL_TO_WORD 2 -- 7. . . . . . . . . . . . . . . . . . . . . .

(E_)BOOL_TO_DWORD 2 -- 9. . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_BOOL 2 -- 11. . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_DINT 2 -- 13. . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_WORD 2 -- 15. . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_DWORD 2 -- 17. . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_REAL 2 -- 19. . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_TIME 2 -- 21. . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)INT_TO_BCD 2 -- 23. . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_BOOL 2 -- 25. . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_INT 2 -- 27. . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_WORD 2 -- 29. . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_TIME 2 -- 31. . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_DWORD 2 -- 33. . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_REAL 2 -- 35. . . . . . . . . . . . . . . . . . . . . . . .

(E_)DINT_TO_BCD 2 -- 37. . . . . . . . . . . . . . . . . . . . . . . . .

(E_)WORD_TO_BOOL 2 -- 39. . . . . . . . . . . . . . . . . . . . .

(E_)WORD_TO_INT 2 -- 41. . . . . . . . . . . . . . . . . . . . . . . .

(E_)WORD_TO_DINT 2 -- 43. . . . . . . . . . . . . . . . . . . . . .

(E_)WORD_TO_DWORD 2 -- 45. . . . . . . . . . . . . . . . . . .

(E_)WORD_TO_TIME 2 -- 47. . . . . . . . . . . . . . . . . . . . . .

Page 41: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 -- 2 Matsushita Electric Works (Europe) AG

(E_)DWORD_TO_BOOL 2 -- 49. . . . . . . . . . . . . . . . . . . .

(E_)DWORD_TO_INT 2 -- 51. . . . . . . . . . . . . . . . . . . . . .

(E_)DWORD_TO_DINT 2 -- 53. . . . . . . . . . . . . . . . . . . . .

(E_)DWORD_TO_WORD 2 -- 55. . . . . . . . . . . . . . . . . . .

(E_)DWORD_TO_TIME 2 -- 57. . . . . . . . . . . . . . . . . . . . .

(E_)REAL_TO_INT 2 -- 59. . . . . . . . . . . . . . . . . . . . . . . . .

(E_)REAL_TO_DINT 2 -- 61. . . . . . . . . . . . . . . . . . . . . . . .

(E_)TIME_TO_INT 2 -- 63. . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TIME_TO_DINT 2 -- 65. . . . . . . . . . . . . . . . . . . . . . . .

(E_)TIME_TO_WORD 2 -- 67. . . . . . . . . . . . . . . . . . . . . .

(E_)TIME_TO_DWORD 2 -- 69. . . . . . . . . . . . . . . . . . . . .

(E_)TRUNC_TO_INT 2 -- 71. . . . . . . . . . . . . . . . . . . . . . .

(E_)TRUNC_TO_DINT 2 -- 74. . . . . . . . . . . . . . . . . . . . . .

(E_)BCD_TO_INT 2 -- 77. . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)BCD_TO_DINT 2 -- 79. . . . . . . . . . . . . . . . . . . . . . . . .

(E_)REAL_TO_TIME 2 -- 81. . . . . . . . . . . . . . . . . . . . . . .

(E_)TIME_TO_REAL 2 -- 83. . . . . . . . . . . . . . . . . . . . . . .

Page 42: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 3Matsushita Electric Works (Europe) AG

Conversion Functions

Outline BOOL_TO_INT converts a value of the data type BOOL into a valueof the data type INT. If you require an enable output and an enableinput: E_BOOL_TO_INT

� Data Types

Input Variable Output Variable

BOOL INTEGER

� Example BOOL_TO_INT

In this example the function BOOL_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (Boolean_value) has been declared.However, you may enter a constant directly at the input contact of thefunction.

LDThe Boolean_value of the data type BOOL is converted into a value ofthe data type INTEGER. The converted value is written into INT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

(E_)BOOL_TO_INT

Page 43: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 4

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under BOOL_TO_INT also applies toE_BOOL_TO_INT. The function E_BOOL_TO_INT, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_BOOL_TO_INT will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_BOOL_TO_INT

In this example the function E_BOOL_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (Boolean_value and enable) havebeen declared. However, you may enter constants directly at the inputcontact of the function (enable input e.g. for tests).

LDIf enable is set (TRUE), the Boolean_value (1 bit) will be converted intoan INTEGER value. The converted value is written into INT_value.

ILIf you want to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 44: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 5Matsushita Electric Works (Europe) AG

Conversion Functions

Outline BOOL_TO_DINT converts a value of the data type BOOL into avalue of the data type DINT. If you require an enable output and anenable input: E_BOOL_TO_DINT

� Data Types

Input Variable Output Variable

BOOL DOUBLE INTEGER

� Example BOOL_TO_DINT

In this example the function BOOL_TO_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (Boolean_value) has been declared.However, you may enter a constant directly at the input contact of thefunction.

LDThe Boolean_value of the data type BOOL is converted into a DOUBLEINTEGER value. The converted value is written into DINT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

(E_)BOOL_TO_DINT

Page 45: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 6

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under BOOL_TO_DINT also applies toE_BOOL_TO_DINT. The function E_BOOL_TO_DINT, however,has in addition an enabled input (EN = enable) and an enabledoutput (ENO = enable output) of the data type BOOL. If EN is set(TRUE), E_BOOL_TO_DINT will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_BOOL_TO_DINT

In this example the function E_BOOL_TO_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (Boolean_value and enable) havebeen declared. However, you may enter constants directly at the inputcontact of the function (enable input e.g. for tests).

LDIf enable is set (TRUE), the Boolean_value (1 bit) is converted into aDOUBLE INTEGER value (32 bit). The converted value is written intoDINT_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 46: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 7Matsushita Electric Works (Europe) AG

Conversion Functions

Outline BOOL_TO_WORD converts a value of the data type BOOL into avalue of the data type WORD. If you require an enable output andan enable input: E_BOOL_TO_WORD

� Data Types

Input Variable Output Variable

BOOL WORD

� Example BOOL_TO_WORD

In this example the function BOOL_TO_WORD is programmed in ladderdiagram (LD) instruction list (IL) programmiert. The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (Boolean_value) has been declared.However, you may enter a constant directly at the input contact of thefunction.

LDThe Boolean_value of the data type BOOL is converted into a value ofthe data type WORD. The converted value is written into WORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

(E_)BOOL_TO_WORD

Page 47: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 8

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under BOOL_TO_WORD also applies toE_BOOL_TO_WORD. The function E_BOOL_TO_WORD,however, has in addition an enabled input (EN = enable) and anenabled output (ENO = enable output) of the data type BOOL. If ENis set (TRUE), E_BOOL_TO_WORD will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_BOOL_TO_WORD

In this example the function E_BOOL_TO_WORD is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (Boolean_value and enable) havebeen declared. However, you may enter constants directly at the inputcontact of the function (enable input e.g. for tests).

LDBoolean_value (1 bit) is converted into a value of the data type WORD(16 bit). The converted value is written into WORD_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 48: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 9Matsushita Electric Works (Europe) AG

Conversion Functions

Outline BOOL_TO_DWORD converts a value of the data type BOOL into avalue of the data type DWORD. If you require an enable output andan enable input: E_BOOL_TO_DWORD

� Data Types

Input Variable Output Variable

BOOL DOUBLE WORD

� Example BOOL_TO_DWORD

In this example the function BOOL_TO_DWORD is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (Boolean_value) has been declared.However, you may enter a constant directly at the input contact of thefunction.

LDThe Boolean_value of the data type BOOL is converted into a value ofthe data type DOUBLE INTEGER. The converted value is written intoDWORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

(E_)BOOL_TO_DWORD

Page 49: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 10

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under BOOL_TO_DWORD also applies toE_BOOL_TO_DWORD. The function E_BOOL_TO_DWORD,however, has in addition an enabled input (EN = enable) and anenabled output (ENO = enable output) of the data type BOOL. If ENis set (TRUE), E_BOOL_TO_DWORD will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_BOOL_TO_DWORD

In this example the function E_BOOL_TO_DWORD is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (Boolean_value and enable) havebeen declared. However, you may enter constants directly at the inputcontact of the function (enable input e.g. for tests).

LDIf enable is set (TRUE), the Boolean_value (1 bit) is converted into avalue of the data type DOUBLE WORD. The converted value is writteninto DWORD_value.

ILIf you want to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 50: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 11Matsushita Electric Works (Europe) AG

Conversion Functions

Outline INT_TO_BOOL converts a value of the type INT into a value of thetype BOOL. If you require an enable output and an enable input:E_INT_TO_BOOL

� Data Types

Input Variable Output Variable

INTEGER BOOL

� Example INT_TO_BOOL

In this example the function INT_TO_BOOL is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (INT_value) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

LDINT_value (16 bit) of the data type INTEGER is converted into a Booleanvalue. The result is written into Boolean_value.

ILIf you want to call the function in an instruction list, enter the following:

� Notes next page

(E_)INT_TO_BOOL

Page 51: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 12

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under INT_TO_BOOL also applies toE_INT_TO_BOOL. The function E_INT_TO_BOOL, however, hasin addition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_INT_TO_BOOL will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_INT_TO_BOOL

In this example the function E_INT_TO_BOOL is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (INT_value and enable) have beendeclared. Instead, you may enter constants directly at the input contactof the function (enable input e.g. for tests).

LDIf enable is set (TRUE), the INT_value of the data type INTEGER (16 bit)is converted into a Boolean value (1 bit). The converted value is writteninto Boolean_value.

ILIf you want to call the function in an instruction list, enter the following:

�Notes

• If INT_value has the value 0, the conversion result will be 0(FALSE), in any other case it will be 1 (TRUE).

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 52: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 13Matsushita Electric Works (Europe) AG

Conversion Functions

Outline INT_TO_DINT converts a value of the type INT into a value of thetype DINT. If you require an enable output and an enable input:E_INT_TO_DINT

� Data Types

Input Variable Output Variable

INTEGER DOUBLE INTEGER

� Example INT_TO_DINT

In this example the function INT_TO_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (INT_value) has been declared.However, you may enter a constant directly at the input contact of thefunction.

LDINT_value of the data type INTEGER is converted into a value of thedata type DOUBLE INTEGER. The result will be written into DINT_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

(E_)INT_TO_DINT

Page 53: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 14

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under INT_TO_DINT also applies toE_INT_TO_DINT. The function E_INT_TO_DINT, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_INT_TO_DINT will be activated. If EN is reset (FALSE), the statusof the variable will be frozen until EN is set again. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_INT_TO_DINT

In this example the function E_INT_TO_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (INT_value and enable) have beendeclared. However, you may enter constants directy at the input contactofthe function (enable input e.g. for tests).

LDIf enable is set (TRUE), the INT_value of the data type INTEGER (16 bit)is converted into a value of the data type DOUBLE INTEGER (32 bit).The converted value is written into DINT_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 54: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 15Matsushita Electric Works (Europe) AG

Conversion Functions

Outline INT_TO_WORD converts a value of the type INT into a value of thetype WORD. If you require an enable output and an enable input:E_INT_TO_WORD

� Data Types

Input Variable Output Variable

INTEGER WORD

� Example INT_TO_WORD

In this example the function INT_TO_WORD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDINT_value of the data type INTEGER is converted into a value of thedata type WORD. The result is written in WORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)INT_TO_WORD

Page 55: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 16

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under INT_TO_WORD also applies toE_INT_TO_WORD. The function E_INT_TO_WORD, however, hasin addition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_INT_TO_WORD will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_INT_TO_WORD

In this example the function E_INT_TO_WORD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the INT_value of the data type INTEGER (16 bit)is converted into a value of the data type WORD (16 bit). The convertedvalue is written in WORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The bit combination of the input variable will be assignedto the output variable.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 56: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 17Matsushita Electric Works (Europe) AG

Conversion Functions

Outline INT_TO_DWORD converts a value of the type INT into a value of thetype DWORD. If you require an enable output and an enable input:E_INT_TO_DWORD

� Data Types

Input Variable Output Variable

INTEGER DOUBLE WORD

� Example INT_TO_DWORD

In this example the function INT_TO_DWORD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDINT_value of the data type INTEGER is converted into a value of thedata type DOUBLE WORD (32 bit). The result is written in DWORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

(E_)INT_TO_DWORD

Page 57: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 18

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under INT_TO_DWORD also applies toE_INT_TO_DWORD. The function E_INT_TO_DWORD, however,has in addition an enabled input (EN = enable) and an enabledoutput (ENO = enable output) of the data type BOOL. If EN is set(TRUE), E_INT_TO_DWORD will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_INT_TO_DWORD

In this example the function E_INT_TO_DWORD is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the INT_value of the data type INTEGER (16 bit)is converted into a value of the data type DOUBLE WORD (32 bit). Theconverted value is written inDWORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 58: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 19Matsushita Electric Works (Europe) AG

Conversion Functions

Outline INT_TO_REAL converts a value of the data type INTEGER into avalue of the data type REAL. If you require an enable input (EN) andan enable output (ENO): E_INT_TO_REAL

� Data Types

Input Variable Output Variable

INTEGER REAL

� Example INT_TO_REAL

In this example the function INT_TO_REAL is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (INT_value) has been declared.Instead, you may enter a constant directy at the input contact ofthefunction.

LDINT_value of the data type INTEGER is converted into a value of thedata type REAL.The converted value is stored in REAL_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

(E_)INT_TO_REAL

Page 59: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 20

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under INT_TO_REAL also applies toE_INT_TO_REAL. However, in addition to the INT_TO_REALfunction, E_INT_TO_REAL has an enable input (EN) and an enableoutput (ENO) of the data type BOOL. If EN is set (TRUE),E_INT_TO_REAL will be activated. If EN is reset (FALSE), the statusof the variable will be frozen until EN is set again. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

INTEGER REAL

� Example E_INT_TO_REAL

In this example the function E_INT_TO_REAL is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (INT_value and enable) have beendeclared. Instead, you may enter constants directy at the input contactofthe function (enable input e.g. for tests).

LDIf enable is set (TRUE), INT_value of the data type INTEGER isconverted into a value of the data type REAL. The converted value iswritten into REAL_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 60: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 21Matsushita Electric Works (Europe) AG

Conversion Functions

Outline INT_TO_TIME converts a value of the type INT into a value of thetype TIME. The resolution is 10ms, e.g. when the INTEGER value= 350, the TIME value = 3s500ms. If you require an enable outputand an enable input: E_INT_TO_TIME.

� Data Types

Input Variable Output Variable

INTEGER TIME

� Example INT_TO_TIME

In this example the function INT_TO_TIME is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POE HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDINT_value of the data type INTEGER is converted into a value of the datatype TIME. The result will be written into the output variable time_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

(E_)INT_TO_TIME

Page 61: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 22

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under INT_TO_TIME also applies toE_INT_TO_TIME. The function E_WORD_TO_DWORD, however,has in addition an enabled input (EN = enable) and an enabledoutput (ENO = enable output) of the data type BOOL. If EN is set(TRUE), E_INT_TO_TIME will be activated. If EN is reset (FALSE),the status of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_INT_TO_TIME

In this example the function E_INT_TO_TIME is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POE HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), INT _value of the data type INTEGER will beconverted into a value of the data type TIME. The result will be writteninto the output variable time_value. Once the function has beenprocessed, ENO will be set.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 62: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 23Matsushita Electric Works (Europe) AG

Conversion Functions

Outline INT_TO_BCD converts a binary value of the type INTEGER in aBCD value (binary coded decimal integer) of the type WORD in orderto be able to output BCD values in word format. If you require anenable output and an enable input: E_INT_TO_BCD

� Data Types

Input Variable Output Variable

INTEGER WORD

� Example INT_TO_BCD

In this example the function INT_TO_BCD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (INT_value) has been declared.Instead, you may enter a decimal constant (0 – 9999) directly at the inputcontact of the function.

LDINT_value of the data type INTEGER is converted into a BCD value ofthe data type WORD. The converted value is written into BCD_value_16bit.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)INT_TO_BCD

Page 63: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 24

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under INT_TO_BCD also applies toE_INT_TO_BCD. E_INT_TO_BCD, however, has in addition anenabled input (EN = enable) and an enabled output (ENO = enableoutput) of the type BOOL. If EN is set (TRUE), E_INT_TO_BCD willbe activated. If EN is reset (FALSE), the status of the variable will befrozen until EN is set again. ENO will adopt the status of EN.Therefore, you may connect further function blocks/functions withENO which are controlled by the status of EN.

� Example E_INT_TO_BCD

E_INT_TO_BCD is programmed in ladder diagram (LD) and instructionlist (IL). The same POU header is used for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (INT_value and enable) have beendeclared. Instead, you may enter decimal constants (0 – 9999) forINT_value and a constant for the enable input (e.g. for tests) directly atthe input contact of the function instead.

LDIf enable is set (TRUE), INT_value of the data type INTEGER isconverted into a BCD value of the data type WORD. The converted valueis written into BCD_value_16bit.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• Since the output variable is of the type WORD and 16 bitswide, the value of the input variable should have a maxi-mum of 4 decimal places and should thus be located be-tween 0 and 9999.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 64: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 25Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DINT_TO_BOOL converts a value of the data type DINT into a valueof the data type BOOL. If you require an enable output and an enableinput: E_DINT_TO_BOOL

� Data Types

Input Variable Output Variable

DOUBLE INTEGER BOOL

� Example DINT_TO_BOOL

In this example the function DINT_TO_BOOL is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDDINT_value of the data type DOUBLE INTEGER is converted into avalue of the data type BOOL. The converted value in written in Boolean_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)DINT_TO_BOOL

Page 65: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 26

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under DINT_TO_BOOL also applies toE_DINT_TO_BOOL. E_DINT_TO_BOOL, however, has in additionan enabled input (EN = enable) and an enabled output (ENO =enable output) of the data type BOOL. If EN is set (TRUE),E_DINT_TO_BOOL will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_DINT_TO_BOOL

In this example the function E_DINT_TO_BOOL is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDDINT_value of the data type DOUBLE INTEGER (32 bit) is convertedinto a Boolean value (1 bit). The converted value is written in Boolean_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• If the variable DINT_value has the value 0, the conversionresult = FALSE, in any other case it will be TRUE.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 66: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 27Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DINT_TO_INT converts a value of the data type DINT into a valueof the data type INT. If you require an enable output and an enableinput: E_DINT_TO_INT

� Data Types

Input Variable Output Variable

DOUBLE INTEGER INTEGER

� Example DINT_TO_INT

In this example the function DINT_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDDINT_value of the data type DOUBLE INTEGER (32 bit) is convertedinto a value of the data type INTEGER (16 bit). The converted value iswritten in INT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)DINT_TO_INT

Page 67: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 28

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under DINT_TO_INT also applies toE_DINT_TO_INT. The function E_DINT_TO_INT, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_DINT_TO_INT will be activated. If EN is reset (FALSE), the statusof the variable will be frozen until EN is set again. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_DINT_TO_INT

In this example the function E_DINT_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the DINT_value of the data type DOUBLEINTEGER (32 bit) will be converted into a value of the data typeINTEGER (16 bit). The converted value will be written in INT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The value of the input variable should be between –32768and 32767.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 68: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 29Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DINT_TO_WORD converts a value of the data type DINT into avalue of the data type WORD. If you require an enable output andan enable input: E_DINT_TO_WORD

� Data Types

Input Variable Output Variable

DOUBLE INTEGER WORD

� Example DINT_TO_WORD

In this example the function DINT_TO_WORD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDDINT_value of the data type DOUBLE INTEGER (32 bit) is convertedinto a value of the data type WORD (16 bit). The converted value iswritten in WORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)DINT_TO_WORD

Page 69: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 30

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under DINT_TO_WORD also applies toE_DINT_TO_WORD. E_DINT_TO_WORD, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_DINT_TO_WORD will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_DINT_TO_WORD

In this example the function E_DINT_TO_WORD is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the DINT_value of the data type DOUBLEINTEGER (32 bit) will be converted into a value of the data type WORD(15 bit). The converted value will be written in WORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The first 16 bits of the input variable are assigned to theoutput variable.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 70: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 31Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DINT_TO_TIME bzw. E_DINT_TO_TIME converts a value of thedata type DINT into a value of the data type TIME. A value of 1corresponds to a time of 10ms, e.g. an input value of 123 isconverted to a TIME T#1s230.00ms.

� Data types

input variable output variableDINT TIME

� Example DINT_TO_TIME

In this example the function DINT_TO_TIME is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderIn the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variable DINT_value is declared. However, youcan write a constant directly at the input contact of the function instead.

BodyDINT_value of the data type DOUBLE INTEGER is converted to value ofthe data type TIME. The result is written into the output variable time_value.

LD Body

IL BodyIf you wish to call up the function using instruction list, enter the following:

� Note next page

(E_)DINT_TO_TIME

Page 71: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 32

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline E_DINT_TO_TIME has in addition an enabled input (EN) and anenable output (ENO) of the data type BOOL. If EN is set (TRUE), thefunction is activated. If EN is reset (FALSE), the status of the variablewill be frozen until EN is set again. ENO will adopt the status of EN.Hence, you can connect further FP/FUN to the ENO that aredetermined by EN.

� Example E_DINT_TO_TIME

POU HeaderIn the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variables start and DINT_value have beendeclared. However, you can write a constant directly at the input contactof the function instead.

BodyWhen start is set (TRUE), DINT_value of the data type DOUBLEINTEGER is converted to a value of the data type TIME. The result iswritten into the output variable time_value. After the function has beenprocessed, ENO is set.

LD Body

IL BodyIf you wish to call up the function using instruction list, enter the following:

�Note

It does not matter whether the names of the functions arecapitalized in the IL editor or not.

Page 72: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 33Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DINT_TO_DWORD converts a value of the data type DINT into avalue of the data type DWORD. If you require an enable output andan enable input: E_DINT_TO_DWORD

� Data Types

Input Variable Output Variable

DOUBLE INTEGER DOUBLE WORD

� Example DINT_TO_DWORD

In this example the function DINT_TO_DWORD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDDINT_value of the data type DOUBLE INTEGER is converted into avalue of the data type DOUBLE WORD. The converted value is written inDWORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)DINT_TO_DWORD

Page 73: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 34

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under DINT_TO_DWORD also applies toE_DINT_TO_DWORD. E_DINT_TO_DWORD, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_DINT_TO_DWORD will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_DINT_TO_DWORD

In this example the function E_DINT_TO_DWORD is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the DINT_value of the data type DOUBLEINTEGER (32 bit) will be converted into a value of the data typeDOUBLE WORD (32 bit). The converted value will be written inDWORD_value.|

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The bit combination of the input variable is assigned to theoutput variable.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 74: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 35Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DINT_TO_REAL converts a value of the data type DOUBLEINTEGER into a value of the data type REAL. If you require anenable input (EN) and an enable output (ENO): E_DINT_TO_REAL

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

DOUBLE INTEGER REAL

� Example DINT_TO_REAL

In this example the function DINT_TO_REAL is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (DINT_value) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

LDDINT_value of the data type DOUBLE INTEGER is converted into avalue of the data type REAL. The converted value is stored inREAL_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)DINT_TO_REAL

Page 75: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 36

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under DINT_TO_REAL also applies toE_DINT_TO_REAL. However, in addition to the DINT_TO_REALfunction, E_DINT_TO_REAL has an enable input (EN) and anenable output (ENO) of the data type BOOL. If EN is set (TRUE),E_DINT_TO_REAL will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

DOUBLE INTEGER REAL

� Example E_DINT_TO_REAL

In this example the function E_DINT_TO_REAL is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (DINT_value and enable) have beendeclared. Instead, you may enter constants directly at the input contact ofthe function (enable input e.g. for tests).

LDIf enable is set (TRUE), DINT_value of the data type DOUBLE INTEGERis converted into a value of the data type REAL. The converted value isstored in REAL_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It is not important whether the function names in the IL editorare capitalized or not.

Page 76: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 37Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DINT_TO_BCD converts a value of the data type DINT into a BCDvalue of the data type DWORD. If you require an enable output andan enable input: E_DINT_TO_BCD

� Data Types

Input Variable Output Variable

DOUBLE INTEGER DOUBLE WORD

� Example DINT_TO_BCD

In this example the function DINT_TO_BCD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants.

LDDINT_value of the data type DOUBLE INTEGER is converted into a BCDvalue of the data type DOUBLE WORD. The converted value is written inBCD_value_32bit.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)DINT_TO_BCD

Page 77: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 38

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under DINT_TO_BCD also applies toE_DINT_TO_BCD. The function E_DINT_TO_BCD, however, hasin addition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_BCD_TO_INT will be activated. If EN is reset (FALSE), the statusof the variable will be frozen until EN is set again. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_DINT_TO_BCD

In this example the function E_DINT_TO_BCD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the DINT_value of the data type DOUBLEINTEGER (32 bit) will be converted into a BCD value of the data typeDOUBLE WORD (32 bit). The converted value will be written inBCD_value_32bit.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The value for the input variable should be between 0 and99999999.

• It is not important whether the function names in the ILeditor are capitalized or not.

Page 78: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 39Matsushita Electric Works (Europe) AG

Conversion Functions

Outline WORD_TO_BOOL converts a value of the type WORD into a valueof the type BOOL. If you require an enable output and an enableinput: E_WORD_TO_BOOL

� Data Types

Input Variable Output Variable

WORD BOOL

� Example WORD_TO_BOOL

In this example the function WORD_TO_BOOL is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDWORD_value_16bit of the data type WORD is converted into a Booleanvalue (1 bit). The result will be written in Boolean_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)WORD_TO_BOOL

Page 79: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 40

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under WORD_TO_BOOL also applies toE_WORD_TO_BOOL. E_WORD_TO_BOOL, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_WORD_TO_BOOL will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_WORD_TO_BOOL

In this example the function E_WORD_TO_BOOL is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set, the value WORD _value (16 bit) of the data type WORDwill be converted into a Boolean value. The result will be written inBoolean_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• If the variable WORD_value has the value 0 (16#0000), theconversion result will be = 0 (FALSE), in any other case itwill be 1 (TRUE).

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 80: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 41Matsushita Electric Works (Europe) AG

Conversion Functions

Outline WORD_TO_INT converts a value of the type WORD into a value ofthe type INT. If you require an enable output and an enable input:E_WORD_TO_INT

� Data Types

Input Variable Output Variable

WORD INTEGER

� Example WORD_TO_INT

In this example the function WORD_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants/variables.

LDWORD_value of the data type WORD is converted into a value of thedata type INTEGER. The result will be written in INT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)WORD_TO_INT

Page 81: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 42

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under WORD_TO_INT also applies toE_WORD_TO_INT. The function E_WORD_TO_INT, however, hasin addition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_WORD_TO_INT will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_WORD_TO_INT

In this example the function E_WORD_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set, the value in WORD _value (16 bit) of the data typeWORD will be converted into an INTEGER value. The result will bewritten in INT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The bit combination of WORD_value is assigned toINT_value.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 82: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 43Matsushita Electric Works (Europe) AG

Conversion Functions

Outline WORD_TO_DINT converts a value of the type WORD into a valueof the type DINT. If you require an enable output and an enable input:E_WORD_TO_DINT

� Data Types

Input Variable Output Variable

WORD DOUBLE INTEGER

� Example WORD_TO_DINT

In this example the function WORD_TO_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants/variables.

LDWORD_value of the data type WORD is converted into a value of thedata type INTEGER. The result will be written in DINT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)WORD_TO_DINT

Page 83: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 44

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under WORD_TO_DINT also applies toE_WORD_TO_DINT. E_WORD_TO_DINT, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_WORD_TO_DINT will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_WORD_TO_DINT

In this example the function E_WORD_TO_DINT is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set, the value WORD _value (16 bit) of the data type WORDwill be converted into a value of the data type DOUBLE INTEGER. Theresult will be written in DINT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 84: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 45Matsushita Electric Works (Europe) AG

Conversion Functions

Outline WORD_TO_DWORD converts a value of the type WORD into avalue of the type DWORD. If you require an enable output and anenable input: E_WORD_TO_DWORD

� Data Types

Input Variable Output Variable

WORD DOUBLE WORD

� Example WORD_TO_DWORD

In this example the function WORD_TO_DWORD is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants/variables.

LDWORD_value of the data type WORD is converted into a value of thedata type DOUBLE WORD. The result will be written in DWORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The bit combination of WORD_value is assigned toDWORD_value.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

(E_)WORD_TO_DWORD

Page 85: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 46

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under WORD_TO_DWORD also applies toE_WORD_TO_DWORD. E_WORD_TO_DWORD, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_WORD_TO_DWORD will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example WORD_TO_DWORD

In this example the function E_WORD_TO_DWORD is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set, the value in WORD _value (16 bit) of the data typeWORD will be converted into a value of the data type DOUBLE WORD(32 bit). The result will be written in DWORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 86: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 47Matsushita Electric Works (Europe) AG

Conversion Functions

Outline WORD_TO_TIME converts a value of the type WORD into a valueof the type TIME. If you require an enable output and an enableinput: E_WORD_TO_TIME

� Data Types

Input Variable Output Variable

WORD TIME

� Example WORD_TO_TIME

input variable 12345 ⇒ output variable: T#123.45s orinput variable 16#0012 ⇒ output variable: T#180ms

In this example the function WORD_TO_TIME is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDWORD_value of the data type WORD (16 bit) is converted into a value ofthe data type TIME (16 bit). The result will be written into the outputvariable time_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Note next page

(E_)WORD_TO_TIME

Page 87: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 48

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under WORD_TO_TIME also applies toE_WORD_TO_TIME. E_WORD_TO_TIME, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_WORD_TO_TIME will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_WORD_TO_TIME

Input variable: 4444 ⇒ output variable: T#44.44s

In this example the function E_WORD_TO_TIME is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), WORD _value of the data type WORD will beconverted into a value of the data type TIME. The result will be writteninto the output variable time_value. Once the function has beenprocessed, ENO will be set.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 88: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 49Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DWORD_TO_BOOL converts a value of the data type DOUBLEWORD into a value of the data type BOOL. If you require an enableoutput and an enable input: E_DWORD_TO_BOOL

� Data Types

Input Variable Output Variable

DOUBLE WORD BOOL

� Example DWORD_TO_BOOL

In this example the function DWORD_TO_BOOL is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDDWORD_value of the data type DOUBLE WORD is converted into aBoolean value (1 bit). the converted value is written in Boolean_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)DWORD_TO_BOOL

Page 89: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 50

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline E_DWORD_TO_BOOL converts a value of the data type DOUBLEWORD into a value of the data type BOOL. In addition to theDWORD_TO_BOOL function, E_DWORD_TO_BOOL has anenable input (EN) and an enable output (ENO) of the data typeBOOL. If EN is set (TRUE), E_DWORD_TO_BOOL will be activated.If EN is not set (FALSE), the status of the output variable will remainunchanged until EN is set. ENO will adopt the status of EN.Therefore, you may connect further function blocks/functions withENO which are controlled by the status of EN.

� Example E_DWORD_TO_BOOL

In this example the function E_DWORD_TO_BOOL is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the DWORD_value of the data type DOUBLEWORD will be converted into a Boolean value (1 bit). The convertedvalue will be written in Boolean_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• If the variable DWORD_value has the value 0(16#00000000), the conversion result will be = FALSE; inany other case it will be TRUE.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 90: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 51Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DWORD_TO_INT converts a value of the data type DWORD into avalue of the data type INT. If you require an enable output and anenable input: E_DWORD_TO_INT

� Data Types

Input Variable Output Variable

DOUBLE WORD INTEGER

� Example DWORD_TO_INT

In this example the function DWORD_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDDWORD_value of the data type DOUBLE WORD (32 bit) is convertedinto an INTEGER value (16 bit). The converted value is written inINT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)DWORD_TO_INT

Page 91: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 52

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under DWORD_TO_INT also applies toE_DWORD_TO_INT. E_DWORD_TO_INT, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_DWORD_TO_INT will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_DWORD_TO_INT

In this example the function E_DWORD_TO_INT is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the DWORD_value of the data type DOUBLEWORD (32 bit) will be converted into a value of the data type INTEGER(16 bit). The converted value will be written in INT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The first 16 bit of the input variable are assigned to theoutput variable.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 92: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 53Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DWORD_TO_DINT converts a value of the data type DOUBLEWORD into a value of the data type DOUBLE INTEGER. If yourequire an enable output and an enable input:E_DWORD_TO_DINT

� Data Types

Input Variable Output Variable

DOUBLE WORD DOUBLE INTEGER

� Example DWORD_TO_DINT

In this example the function DWORD_TO_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDDWORD_value of the data type DOUBLE WORD is converted into aDOUBLE INTEGER value. The converted value is written in DINT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)DWORD_TO_DINT

Page 93: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 54

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under DWORD_TO_DINT also applies toE_DWORD_TO_DINT. The function E_DWORD_TO_DINT,however, has in addition an enabled input (EN = enable) and anenabled output (ENO = enable output) of the data type BOOL. If ENis set (TRUE), E_DWORD_TO_DINT will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_DWORD_TO_DINT

In this example the function E_DWORD_TO_DINT is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the DWORD _value of the data type DOUBLEWORD (32 bit) will be converted into a value of the data type DOUBLEINTEGER (32 bit). The converted value will be written in DINT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The bit combination of the input variable will be assignedto the output variable.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 94: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 55Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DWORD_TO_WORD converts a value of the data type DOUBLEWORD into a value of the data type WORD. If you require an enableoutput and an enable input: E_DWORD_TO_WORD

� Data Types

Input Variable Output Variable

DOUBLE WORD WORD

� Example DWORD_TO_WORD

In this example the function DWORD_TO_WORD is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDDWORD_value of the data type DOUBLE WORD (32 bit) is convertedinto a value of the data type WORD (16 bit). The converted value iswritten in WORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Notes next page

(E_)DWORD_TO_WORD

Page 95: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 56

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under DWORD_TO_WORD also applies toE_DWORD_TO_WORD. E_DWORD_TO_WORD, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_DWORD_TO_WORD will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_DWORD_TO_WORD

In this example the function E_DWORD_TO_WORD is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the DWORD _value of the data type DOUBLEWORD (32 bit) will be converted into a value of the data type WORD (16bit). The converted value will be written in WORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The first 16 bits of the input variable are assigned to theoutput variable.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 96: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 57Matsushita Electric Works (Europe) AG

Conversion Functions

Outline DWORD_TO_TIME bzw. E_DWORD_TO_TIME converts a value ofthe data type DWORD into a value of the data type TIME. A valueof 1 corresponds to a time of 10ms, e.g. the input value 12345(16#3039) is converted to a TIME T#2m3s450.00ms.

� Data types

input variable output variableDWORD TIME

� Example DWORD_TO_TIME

In this example the function DWORD_TO_TIME is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderIn the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variable DWORD_value is declared. However,you can write a constant directly at the input contact of the functioninstead.

BodyDWORD_value of the data type DWORD (32 bits) is converted into avalue of the data type TIME (16 bits). The result is written into the outputvariable time_value.

LD Body

IL BodyIf you wish to call up the function using instruction list, enter the following:

� Note next page

(E_)DWORD_TO_TIME

Page 97: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 58

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline E_DWORD_TO_TIME has in addition an enabled input (EN) and anenable output (ENO) of the data type BOOL. If EN is set (TRUE), thefunction is activated. If EN is reset (FALSE), the status of the variablewill be frozen until EN is set again. The status of EN is assumed byENO. Hence you can connect further FB/FUN that are determinedby EN.

� Example E_DWORD_TO_TIME

POU HeaderIn the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variables start and DWORD_value have beendeclared. However, you can write a constant directly at the input contactof the function instead.

BodyWhen start is set (TRUE), DWORD_value of the data type DWORD isconverted to a value of the data type TIME. The result is written into theoutput variable time_value. After the function has been processed, ENOis set.

LD Body

IL BodyIf you wish to call up the function using instruction list, enter the following:

�Note

It does not matter whether the names of the functions arecapitalized in the IL editor or not.

Page 98: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 59Matsushita Electric Works (Europe) AG

Conversion Functions

Outline REAL_TO_INT converts a value of the data type REAL into a valueof the data type INTEGER. If you require an enable input (EN) andan enable output (ENO): E_REAL_TO_INT

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL INTEGER

� Example REAL_TO_INT

In this example the function REAL_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (REAL_value) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

LDREAL_value of the data type REAL is converted into a value of the datatype INTEGER. The converted value is stored in INT_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)REAL_TO_INT

Page 99: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 60

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under REAL_TO_INT also applies toE_REAL_TO_INT. However, in addition to the REAL_TO_INTfunction, E_REAL_TO_INT has an enable input (EN) and an enableoutput (ENO) of the data type BOOL. If EN is set (TRUE),E_REAL_TO_INT will be activated. If EN is reset (FALSE), the statusof the variable will be frozen until EN is set again. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL INTEGER

� Example E_REAL_TO_INT

In this example the function E_REAL_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (REAL_value and enable) have beendeclared. Instead, you may enter constants directly at the input contact ofthe function (enable input e.g. for tests).

LDIf enable is set (TRUE), REAL_value of the data type REAL is convertedinto a value of the data type INTEGER. The converted value is stored inINT_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 100: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 61Matsushita Electric Works (Europe) AG

Conversion Functions

Outline REAL_TO_DINT converts a value of the data type REAL into a valueof the data type DOUBLE INTEGER. If you require an enable input(EN) and an enable output (ENO): E_REAL_TO_DINT

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL DOUBLE INTEGER

� Example REAL_TO_DINT

In this example the function REAL_TO_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (REAL_value) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

LDREAL_value of the data type REAL is converted into a value of the datatype DOUBLE INTEGER. The converted value is stored in DINT_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)REAL_TO_DINT

Page 101: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 62

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under REAL_TO_DINT also applies toE_REAL_TO_DINT. However, in addition to the REAL_TO_DINTfunction, E_REAL_TO_DINT has an enable input (EN) and anenable output (ENO) of the data type BOOL. If EN is set (TRUE),E_REAL_TO_DINT will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL DOUBLE INTEGER

� Example E_REAL_TO_DINT

In this example the function E_REAL_TO_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (REAL_value and enable) have beendeclared. Instead, you may enter constants directly at the input contact ofthe function (enable input e.g. for tests).

LDIf enable is set (TRUE), REAL_value of the data type REAL is convertedinto a value of the data type DOUBLE INTEGER. The converted value isstored in DINT_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 102: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 63Matsushita Electric Works (Europe) AG

Conversion Functions

Outline TIME_TO_INT converts a value of the type TIME into a value of thetype INT. If you require an enable output and an enable input:E_TIME_TO_INT

� Data Types

Input Variable Output Variable

TIME INTEGER

� Example TIME_TO_INT

Input variable: T#12.34s ⇒ output variable: 1234

In this example the function TIME_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDTime_value of the data type TIME is converted into a value of the datatype INTEGER. The result will be written into the output variable INT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)TIME_TO_INT

Page 103: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 64

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under TIME_TO_INT also applies toE_TIME_TO_INT. The function E_TIME_TO_INT, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_TIME_TO_INT will be activated. If EN is reset (FALSE), the statusof the variable will be frozen until EN is set again. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_TIME_TO_INT

Input variable: T#0.34s ⇒ output variable: 34 orinput variable: T#22.22s ⇒ output variable: 2222

In this example the function E_TIME_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), time_value of the data type TIME will beconverted into a value of the data type INTEGER. The result will bewritten into the output variable INT_value. Once the function has beenprocessed, ENO will be set.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 104: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 65Matsushita Electric Works (Europe) AG

Conversion Functions

Outline TIME_TO_DINT bzw. E_TIME_TO_DINT converts a value of thedata type TIME into a value of the data type DINT. The time 10mscorresponds to the value 1, e.g. an input value of T#1m0s isconverted to the value 6000.

� Data types

input variable output variableTIME DINT

� Example TIME_TO_DINT

In this example the function TIME_TO_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderIn the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variable time_value is declared. However, youcan write a constant directly at the input contact of the function instead.

Bodytime_value of the data type TIME is converted to value of the data typeDOUBLE INTEGER. The result is written into the output variableDINT_value.

LD Body

IL BodyIf you wish to call up the function using instruction list, enter the following:

� Note next page

(E_)TIME_TO_DINT

Page 105: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 66

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline E_TIME_TO_DINT has in addition an enabled input (EN) and anenable output (ENO) of the data type BOOL. If EN is set (TRUE), thefunction is activated. If EN is reset (FALSE), the status of the variablewill be frozen until EN is set again. ENO will adopt the status of EN.Hence, you can connect further FP/FUN to the ENO that aredetermined by EN.

� Example E_TIME_TO_DINT

POU HeaderIn the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variables start and time_value have beendeclared. However, you can write a constant directly at the input contactof the function instead.

BodyWhen start is set (TRUE), time_value of the data type TIME is convertedto a value of the data type DOUBLE INTEGER. The result is written intothe output variable DINT_value. After the function has been processed,ENO is set.

LD Body

IL BodyIf you wish to call up the function using instruction list, enter the following:

�Note

It does not matter whether the names of the functions arecapitalized in the IL editor or not.

Page 106: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 67Matsushita Electric Works (Europe) AG

Conversion Functions

Outline TIME_TO_WORD converts a value of the type TIME into a value ofthe type WORD. If you require an enable output and an enable input:E_TIME_TO_WORD

� Data Types

Input Variable Output Variable

TIME WORD

� Example TIME_TO_WORD

Input variable: T#12.34s ⇒ output variable: 1234 orinput variable: T#1.00s ⇒ output variable: 16#0064

In this example the function TIME_TO_WORD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDTime_value of the data type TIME is converted into a value of the datatype WORD. The result will be written into the output variable WORD_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Note next page

(E_)TIME_TO_WORD

Page 107: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 68

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under TIME_TO_WORD also applies toE_TIME_TO_WORD. The function E_TIME_TO_WORD, however,has in addition an enabled input (EN = enable) and an enabledoutput (ENO = enable output) of the data type BOOL. If EN is set(TRUE), E_TIME_TO_WORD will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN. Input variable: T#1.44s ⇒ output variable: 144 orinput variable: T#1.44s ⇒ output variable: 16#90

� Example E_TIME_TO_WORD

In this example the function TIME_TO_WORD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the time _value of the data type TIME will beconverted into a value of the data type WORD. The result will be writteninto the output variable WORD_value. Once the function has beenprocessed, ENO will be set.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 108: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 69Matsushita Electric Works (Europe) AG

Conversion Functions

Outline TIME_TO_DWORD bzw. E_TIME_TO_DWORD converts a value ofthe data type TIME into a value of the data type DWORD. The time10ms corresponds to the value 1, e.g. an input value of T#1s isconverted to the value 100 (16#64).

� Data types

input variable output variableTIME DWORD

� Example TIME_TO_DWORD

In this example the function TIME_TO_DWORD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderIn the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variable time_value is declared. However, youcan write a constant directly at the input contact of the function instead.

Bodytime_value of the data type TIME is converted to a value of the data typeDWORD and written into the output variable DWORD_value.

LD Body

IL BodyIf you wish to call up the function using instruction list, enter the following:

� Note next page

(E_)TIME_TO_DWORD

Page 109: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 70

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline E_TIME_TO_DWORD has in addition an enabled input (EN) and anenable output (ENO) of the data type BOOL. If EN is set (TRUE), thefunction is activated. If EN is reset (FALSE), the status of the variablewill be frozen until EN is set again. ENO will adopt the status of EN.Hence, you can connect further FP/FUN to the ENO that aredetermined by EN.

� Example E_ TIME_TO_DWORD

POU HeaderIn the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variables start and time_value have beendeclared. However, you can write a constant directly at the input contactof the function instead.

BodyWhen start is set (TRUE), time_value of the data type TIME is convertedto a value of the data type DWORD. The result is written into the outputvariable DWORD_value. After the function has been processed, ENO isset.

LD Body

IL BodyIf you wish to call up the function using instruction list, enter the following:

�Note

It does not matter whether the names of the functions arecapitalized in the IL editor or not.

Page 110: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 71Matsushita Electric Works (Europe) AG

Conversion Functions

Outline TRUNC_TO_INT cuts off the decimal digits of a REAL number anddelivers an output variable of the data type INTEGER. If you requirean enable input (EN) and an enable output (ENO):E_TRUNC_TO_INT

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL INTEGER

� Example TRUNC_TO_INT

In this example the function TRUNC_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (REAL _value) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

LDThe decimal digits of REAL_value are cut off. The result is stored as a16–bit INTEGER in INT_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.� next page

(E_)TRUNC_TO_INT

Page 111: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 72

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under TRUNC_TO_INT also applies toE_TRUNC_TO_INT. However, in addition to the TRUNC_TO_INTfunction, E_TRUNC_TO_INT has an enable input (EN) and anenable output (ENO) of the data type BOOL. If EN is set (TRUE),E_TRUNC_TO_INT will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL INTEGER

� Example E_TRUNC_TO_INT

In this example the function E_TRUNC_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (REAL _value and enable) have beendeclared. Instead, you may enter constants directly at the input contact ofthe function (enable input e.g. for tests).

LDIf enable is set (TRUE), the decimal digits of REAL_value are cut off. Theresult is stored as a 16–bit INTEGER in INT_value.

ILIf you want to call the function in an instruction list, enter the following:

Page 112: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 73Matsushita Electric Works (Europe) AG

Conversion Functions

�Notes

• Cutting off the decimal digits decreases a positive numbertowards zero and increases a negative number towardszero.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)TRUNC_TO_INT:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data typeREAL

R9008 %MX0.900.8 for an instant output variable is greater than a 16–bitINTEGER

R9009 %MX0.900.9 for an instant output variable is zero

Page 113: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 74

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline TRUNC_TO_DINT cuts off the decimal digits of a REAL number anddelivers an output variable of the data type DOUBLE INTEGER. Ifyou require an enable input (EN) and an enable output (ENO):E_TRUNC_TO_DINT

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL DOUBLE INTEGER

� Example TRUNC_TO_DINT

In this example the function TRUNC_TO_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (REAL _value) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

LDThe decimal digits of REAL_value are cut off. The result is stored as a32–bit DOUBLE INTEGER in DINT_value.

ILIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)TRUNC_TO_DINT

Page 114: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 75Matsushita Electric Works (Europe) AG

Conversion Functions

Outline E_TRUNC_TO_DINT cuts off the decimal digits of a REAL numberand delivers an output variable of the data type DOUBLE INTEGER.In addition to the TRUNC_TO_DINT function, E_TRUNC_TO_DINThas an enable input (EN) and an enable output (ENO) of the datatype BOOL. If EN is set (TRUE), E_TRUNC_TO_DINT will beactivated. If EN is reset (FALSE), the status of the variable will befrozen until EN is set again. ENO will adopt the status of EN.Therefore, you may connect further function blocks/functions withENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL DOUBLE INTEGER

� Example E_TRUNC_TO_DINT

In this example the function E_TRUNC_TO_DINT is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (REAL_value and enable) have beendeclared. Instead, you may enter constants directy at the input contactofthe function (enable input e.g. for tests).

� next page

Page 115: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 76

Matsushita Electric Works (Europe) AG

Conversion Functions

LDIf enable is set (TRUE), the decimal digits of REAL_value are cut off. Theresult is stored as a 32–bit DOUBLE INTEGER in DINT_value.

ILIf you want to call the function in an instruction list, enter the following:

�Notes

• Cutting off the decimal digits decreases a positive numbertowards zero and increases a negative number towardszero.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)TRUNC_TO_DINT:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data typeREAL

R9008 %MX0.900.8 for an instant output variable is greater than a 32–bitDOUBLE INTEGER

R9009 %MX0.900.9 for an instant output variable is zero

Page 116: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 77Matsushita Electric Works (Europe) AG

Conversion Functions

Outline BCD_TO_INT converts binary coded decimal numbers (BCD) intobinary values of the type INTEGER. If you require an enable input(EN) and an enable output (ENO): E_BCD_TO_INT

� Data Types

Input Variable Output Variable

WORD INTEGER

� Example BCD_TO_INT

In this example the function BCD_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU Header

All input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (BCD_value_16bit) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

BCD constants can be indicated in NAiS Control as follows:

2#0001100110010101 or 16#1995

LD

BCD_value_16bit of the data type WORD is converted into an INTEGERvalue. The converted value is written into output variable INT_value.

IL

If you wish to call up the function in an instruction list, enter the following:

� Note next page

(E_)BCD_TO_INT

Page 117: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 78

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under BCD_TO_INT also applies toE_BCD_TO_INT. The function E_BCD_TO_INT, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the type BOOL. If EN is set (TRUE),E_BCD_TO_INT will be activated. If EN is reset (FALSE), the statusof the variable will be frozen until EN is set again. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_BCD_TO_INT

In this example the function BCD_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (BCD_value_16bit and enable) havebeen declared. Instead, you may enter constants directly at the inputcontact of the function (enable input e.g. for tests). BCD constants canbe indicated in NAiS Control as follows:2#0001100110010101 or 16#1995

LD

If enable is set (TRUE), BCD_value_16bit of the data type WORD isconverted into an INTEGER value. The converted value is written intovariable INT_value.

IL

If you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 118: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 79Matsushita Electric Works (Europe) AG

Conversion Functions

Outline BCD_TO_DINT converts a BCD value (binary coded decimalinteger) of the data type DOUBLE WORD in a binary value of thedata type DOUBLE INTEGER in order to process a BCD value indouble word format. If you require an enable output and an enableinput: E_BCD_TO_DINT

� Data Types

Input Variable Output Variable

DOUBLE WORD DOUBLE INTEGER

� Example BCD_TO_DINT

In this example the function BCD_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (BCD _value_32bit) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

BCD constants can be indicated in NAiS Control as follows:2#00011001100101010001100110010101 or 16#19951995

LDBCD_value_32bit of the data type DOUBLE WORD is converted into aDOUBLE INTEGER value. The converted value is written into DINT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

� Note next page

(E_)BCD_TO_DINT

Page 119: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 80

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under BCD_TO_DINT also applies toE_BCD_TO_DINT. The function E_BCD_TO_DINT, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the type BOOL. If EN is set (TRUE),E_BCD_TO_DINT will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_BCD_TO_DINT

In this example the function BCD_TO_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (BCD_value_32bit and enable) havebeen declared. Instead, you may enter constants directly at the inputcontact of the function (enable input e.g. for tests).

BCD constants can be indicated in NAiS Control as follows:2#00011001100101010001100110010101 or 16#19951995

LDIf enable is set (TRUE), BCD_value_32bit of the data type DOUBLEWORD will be converted into a DOUBLE INTEGER value. The convertedvalue will be written into DINT_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 120: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 81Matsushita Electric Works (Europe) AG

Conversion Functions

Outline REAL_TO_TIME converts a value of the data type REAL to a valueof the data time TIME. 10ms of the data type TIME correspond to 1.0REAL unit, e.g. when REAL = 1.0, TIME = 10ms; when REAL =100.0, TIME = 1s. The value of the data type real is rounded off tothe nearest whole number for the conversion. If you require anenable output and an enable input: E_REAL_TO_TIME.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL TIME

� Example REAL_TO_TIME

In this example the function REAL_TO_TIME is programmed in ladderdiagram (LD) and instruction list (IL). Since constants are entered directlyat the function’s input contact pins, only the output variable need be de-clared in the header.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

Body

By clicking on the view icon while in the online mode, you can see theresult 0.00ms immediately. Since the value at the REAL input contact isless than 0.5, it is rounded down to 0.0.

LD Body

IL Body

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

(E_)REAL_TO_TIME

Page 121: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 82

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under REAL_TO_TIME also applies to E_REALTO_TIME. The function E_REAL_TO_TIME, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the type BOOL. If EN is set (TRUE),E_REAL_TO_TIME will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_REAL_TO_TIME

In this example the function E_REAL_TO_TIME is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

Body

In this example the input variables start and input_real have beendeclared. Instead, you may enter constants directly at the contact pins ofthe function (enable input e.g. for tests). If start is set (TRUE), input_realof the data type REAL will be converted into a TIME value. Theconverted value will be written into result_time.

LD Body

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 122: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

2 – 83Matsushita Electric Works (Europe) AG

Conversion Functions

Outline TIME_TO_REAL converts a value of the data type TIME to a valueof the data time REAL. 10ms of the data type TIME correspond to1.0 REAL unit, e.g. when TIME = 10ms, REAL = 1.0; when TIME =1s, REAL = 100.0. The resolution amounts to 10ms. If you requirean enable output and an enable input: E_TIME_TO_REAL.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

TIME REAL

� Example TIME_TO_REAL

In this example the function TIME_TO_REAL is programmed in ladderdiagram (LD) and instruction list (IL).

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable input_time has been declared. Instead,you may enter constants directly at the contact pins of the function(enable input e.g. for tests).

LD Body

IL Body

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

(E_)TIME_TO_REAL

Page 123: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

2 – 84

Matsushita Electric Works (Europe) AG

Conversion Functions

Outline Anything stated under TIME_TO_REAL also applies toE_TIME_TO_REAL. The function E_TIME_TO_REAL, however,has in addition an enabled input (EN = enable) and an enabledoutput (ENO = enable output) of the type BOOL. If EN is set (TRUE),E_TIME_TO_REAL will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_TIME_TO_REAL

In this example the function E_TIME_TO_REAL is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables start and input_real have beendeclared. Instead, you may enter constants at the contact pins of thefunction (enable input e.g. for tests).

Body

If start is set (TRUE), input_time of the data type TIME will be convertedinto a REAL value. The converted value will be written into result_real.Since the value for the input_time is less than 10ms, the multiplicand isrounded down to zero.

LD Body

IL Body

If you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 124: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 3

Numerical Functions

(E_)ABS 3 -- 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 125: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

3 – 2

Matsushita Electric Works (Europe) AG

Numerical Functions

Page 126: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

3 – 3Matsushita Electric Works (Europe) AG

Numerical Functions

Outline ABS calculates the value in the accumulator into an absolute value.The result is saved in the output variable. If you require an enableoutput and an enable input: E_ABS

� Data Types

Input Variable Output Variable

INTEGER as input data type

DOUBLE INTEGER

REAL

� Example ABS

In this example the function ABS is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDInput_value of the data type INTEGER is converted into an absolutevalue of the data type INTEGER. The converted value is written inabsolute_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)ABS

Page 127: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

3 – 4

Matsushita Electric Works (Europe) AG

Numerical Functions

Outline Anything stated under ABS also applies to E_ABS. E_ABS,however, has in addition an enabled input (EN = enable) and anenabled output (ENO = enable output) of the data type BOOL. If ENis set (TRUE), E_ABS will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_ABS

In this example the function E_ABS is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDIf enable is set (TRUE), the input_value is converted into an absolutevalue. The converted value is written in absolute_value.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 128: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 4

Arithmetic Functions

(E_)MOVE 4 -- 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ADD 4 -- 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)SUB 4 -- 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MUL 4 -- 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DIV 4 -- 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MOD 4 -- 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)SQRT 4 -- 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)SIN 4 -- 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ASIN 4 -- 21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)COS 4 -- 24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ACOS 4 -- 27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TAN 4 -- 30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ATAN 4 -- 33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)LN 4 -- 36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)LOG 4 -- 39. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)EXP 4 -- 42. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)EXPT 4 -- 45. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 129: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 2

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Page 130: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 3Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline MOVE assigns the unchanged value of the input variable to theoutput. If you require an enable output and an enable input:E_MOVE

� Data Types

Input Variable Output Variable

all data types as input data type

� Example MOVE

In this example the function MOVE is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LDInput_value is assigned to output_value without being modified.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)MOVE

Page 131: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 4

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under MOVE also applies to E_MOVE. E_MOVE,however, has in addition an enabled input (EN = enable) and anenabled output (ENO = enable output) of the data type BOOL. If ENis set (TRUE), E_MOVE will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_MOVE

In this example the function E_MOVE is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables

LDIf enable is set (TRUE), input_value is transferred to the variableoutput_value. E_MOVE serves as assignment operator in the LD andFBC.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 132: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 5Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline The content of the accumulator is added to the operand defined inthe operand field. The result is transferred to the accumulator.

� Data Types

Input Variable Output Variable

INTEGER as input data type

DOUBLE INTEGER

REAL

Input and output variables have to be of the same data type.

� Example ADD

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 INT 0 Input_1

1 VAR var_2 INT 0 Input_2

2 VAR var_3 INT 0 Output

IL BodyLD var_1 (* Load var_1 in accu *)

ADD var_2 (* Add var_2 to accu; store result in accu *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 and op3 must be one of the above noted datatypes. All operands must be of the same data type.

• It is not important whether the function names in the ILeditor are capitalized or not.

(E_)ADD

Page 133: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 6

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline E_ADD adds the input variables IN1 + IN2 + ... and writes theaddition result into the output variable. E_ADD operates just like thestandard operator ADD (see: Online Help: Help > Index > StandardOperators). However, E_ADD has an additional enabled input (EN= enable) and an enabled output (ENO = enable output) of the datatype BOOL. If EN is set (TRUE), E_ADD will be activated. If EN isreset (FALSE), the variable’s status will be frozen until EN is setagain. ENO will adopt the status of EN. Therefore, you may connectfurther function blocks/functions with ENO which are controlled bythe status of EN.

� Example E_ADD

In this example the function E_ADD is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyIf enable is set (TRUE), summand_1 is added to summand_2. The resultis written in sum.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of2 to 28.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 134: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 7Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline The content of the accumulator is subtracted from the operanddefined in the operand field. The result is transferred to theaccumulator.

� Data Types

Input Variable Output Variable

INTEGER as input data type

DOUBLE INTEGER

REAL

Input and output variables have to be of the same data type.

� Example SUB

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 INT 0 Input_1

1 VAR var_2 INT 0 Input_2

2 VAR var_3 INT 0 Output

IL BodyLD var_1 (* Load var_1 in accu *)

SUB var_2 (* Subtract var_2 from accu; store result in accu *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 and op3 must be one of the above noted datatypes. All operands must be of the same data type.

• It is not important whether the function names in the ILeditor are capitalized or not.

(E_)SUB

Page 135: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 8

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline E_SUB operates just as the standard operator SUB (Online Help:Help > Index > Standard Operators). E_SUB, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_SUB will be activated. If EN is reset (FALSE), the status of thevariable will be frozen until EN is set again. ENO will adopt the statusof EN. Therefore, you may connect further function blocks/functionswith ENO which are controlled by the status of EN.

� Example E_SUB

In this example the function E_SUB is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables

LD BodyIf enable is set, subtrahend (data type INT) is subracted from minuend.The result will be written in result (data type INT).

IL BodyIf you wish to call up E_SUB in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 136: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 9Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline The content of the accumulator is multiplied by the operand definedin the operand field. The result is transferred to the accumulator.

� Data Types

Input Variable Output Variable

INTEGER as input data type

DOUBLE INTEGER

REAL

Input and output variables have to be of the same data type.

� Example MUL

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 INT 0 Input_1

1 VAR var_2 INT 0 Input_2

2 VAR var_3 INT 0 Output

IL BodyLD var_1 (* Load var_1 in accu *)

MUL var_2 (* Multiply var_2 by accu; store result in accu *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 and var_3 must be of one of the above noteddata types. All operands must be of the same data type.

• It is not important whether the function names in the ILeditor are capitalized or not.

(E_)MUL

Page 137: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 10

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline E_MUL multiplies the values of the input variables with each other.E_MUL operates just as the standard operator MUL (Online Help:Help > Index > Standard Operators). E_MUL, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_MUL will be activated. If EN is reset (FALSE), the status of thevariable will be frozen until EN is set again. ENO will adopt the statusof EN. Therefore, you may connect further function blocks/functionswith ENO which are controlled by the status of EN.

� Example E_MUL

In this example the function E_MUL is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables

LD BodyIf enable is set (TRUE), the multiplicant is multiplied with the multiplicator.The result will be written in result.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of2 to 28.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

Page 138: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 11Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline The content of the accumulator is divided by the operand defined inthe operand field. The result is transferred to the accumulator.

� Data Types

Input Variable Output Variable

INTEGER as input dada type

DOUBLE INTEGER

REAL

Input and output variables have to be of the same data type.

� Example DIV

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 INT 0 Input_1

1 VAR var_2 INT 0 Input_2

2 VAR var_3 INT 0 Output

IL BodyLD var_1 (* Load var_1 in accu *)

DIV var_2 (* Divide accu by var_2; store result in accu *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 and op3 must be one of the above noted datatypes. All operands must be of the same data type.

• It is not important whether the function names in the ILeditor are capitalized or not.

(E_)DIV

Page 139: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 12

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline E_DIV divides the value of the first input variable by the value of thesecond. E_DIV operates just as the standard operator DIV (OnlineHelp: Help > Index > Standard Operators), however, it has in additionan enabled input (EN = enable) and an enabled output (ENO =enable output) of the data type BOOL. If EN is set (TRUE), E_DIVwill be activated. If EN is reset (FALSE), the status of the variable willbe frozen until EN is set again. ENO will adopt the status of EN.Therefore, you may connect further function blocks/functions withENO which are controlled by the status of EN.

�Note

With FP1–C14/C16 E_DIV cannot be used for a 32–bit division(DINT) as this will cause a compiler error.

� Example E_DIV

In this example the function E_DIV is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.LDIf enable is set (TRUE), dividend is divided by divisor. The result iswritten in result.

ILIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 140: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 13Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline MOD divides the value of the first input variable by the value of thesecond. The rest of the integral division (5 : 2 : 2 + rest = 1) is writtenin the output variable. If you require an enable output and an enableinput: E_MOD

� Data Types

Input Variable Output Variable

INTEGER as input data type

DOUBLE INTEGER

Input and output variables have to be of the same data type.

� Example MOD

In this example the function MOD is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyDividend is divided by divisor. The integal rest of the division is written indivision_rest.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)MOD

Page 141: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 14

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under MOD also applies to E_MOD. E_MOD,however, has in addition an enabled input (EN = enable) and anenabled output (ENO = enable output) of the data type BOOL. If ENis set (TRUE), E_MOD will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_MOD

In this example the function E_MOD is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables

LD BodyIf enable is set (TRUE), dividend is divided by divisor. The rest of thedivision is written in division_rest (e.g: 5 : 2 = 2; rest = 1).

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 142: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 15Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline SQRT calculates the square root of an input variable of the data typeREAL (value ≥ 0.0). The result is written into the output variable. Ifyou require an enable input (EN) and an enable output (ENO):E_SQRT.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example SQRT

In this example the function SQRT is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (input_value) has been declared.Instead, you may enter a constant at the input contact of the function.

LD BodyThe square root of input_value is calculated and written into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)SQRT

Page 143: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 16

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under SQRT also applies to E_SQRT. However, inaddition to the SQRT function, E_SQRT has an enable input (EN)and an enable output (ENO) of the data type BOOL. If EN is set(TRUE), E_SQRT will be activated. If EN is not set (FALSE), thestatus of the output variable will remain unchanged until EN is set.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example E_SQRT

In this example the function E_SQRT is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value and enable) have beendeclared. Instead, you may enter a constant at the input contact of thefunction (enable input e.g. for tests).

LD BodyIf enable is set (TRUE), the square root of input_value is calculated andwritten into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

� next page

Page 144: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 17Matsushita Electric Works (Europe) AG

Arithmetic Functions

�Notes

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)SQRT:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data type

R9008 %MX0.900.8 for an instant REAL or input variable is not � 0.0

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 145: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 18

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline SIN calculates the sine of the input variable and writes the result intothe output variable. The angle data has to be specified in radians(value < 52707176). If you require an enable input (EN) and anenable output (ENO): E_SIN.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example SIN

In this example the function SIN is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (input_value) has been declared.Instead, you may enter a constant at the input contact of the function.

LD BodyThe sine of input_value is calculated and written into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)SIN

Page 146: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 19Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under SIN also applies to E_SIN. However, inaddition to the SIN function, E_SIN has an enable input (EN) and anenable output (ENO) of the data type BOOL. If EN is set (TRUE),E_SIN will be activated. If EN is not set (FALSE), the status of theoutput variable will remain unchanged until EN is set. ENO will adoptthe status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example E_SIN

In this example the function E_SIN is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value and enable) have beendeclared. Instead, you may enter a constant at the input contact of thefunction (enable input e.g. for tests).

LD BodyIf enable is set (TRUE), the sine of input_value is calculated and writteninto output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

Page 147: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 20

Matsushita Electric Works (Europe) AG

Arithmetic Functions

�Notes

• The accuracy of the calculation decreases as the angledata specified in the input variable increases. Therefore,we recommend entering angle data in radians ≥ –2π and ≤2π.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)SIN:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data type

R9008 %MX0.900.8 for an instant REAL or input variable is � 52707176

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 148: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 21Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline ASIN calculates the arc sine of the input variable and writes theangle data in radians into the output variable. The function returnsa value from –π/2 to π/2. If you require an enable input (EN) and anenable output (ENO): E_ASIN.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example ASIN

In this example the function ASIN is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (input_value) has been declared.Instead, you may enter a constant at the input contact of the function.

LD BodyThe arc sine of input_value is calculated and written into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)ASIN

Page 149: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 22

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under ASIN also applies to E_ASIN. However, inaddition to the ASIN function, E_ASIN has an enable input (EN) andan enable output (ENO) of the data type BOOL. If EN is set (TRUE),E_ASIN will be activated. If EN is not set (FALSE), the status of theoutput variable will remain unchanged until EN is set. ENO will adoptthe status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example E_ASIN

In this example the function E_ASIN is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value and enable) have beendeclared. Instead, you may enter a constant at the input contact of thefunction (enable input e.g. for tests).

LD BodyIf enable is set (TRUE), the arc sine of input_value is calculated andwritten into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

� next page

Page 150: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 23Matsushita Electric Works (Europe) AG

Arithmetic Functions

�Notes

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)ASIN:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data type� �

R9008 %MX0.900.8 for an instantREAL or input variable is not � –1.0 and �1.0

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 151: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 24

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline COS calculates the cosine of the input variable and writes the resultinto the output variable. The angle data has to be specified in radians(value <52707176). If you require an enable input (EN) and anenable output (ENO): E_COS.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example COS

In this example the function COS is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (input_value) has been declared.Instead, you may enter a constant at the input contact of the function.

LD BodyThe cosine of input_value is calculated and written into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)COS

Page 152: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 25Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under COS also applies to E_COS. However, inaddition to the COS function, E_COS has an enable input (EN) andan enable output (ENO) of the data type BOOL. If EN is set (TRUE),E_COS will be activated. If EN is not set (FALSE), the status of theoutput variable will remain unchanged until EN is set. ENO will adoptthe status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example E_COS

In this example the function E_COS is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value and enable) have beendeclared. Instead, you may enter a constant at the input contact of thefunction (enable input e.g. for tests).

LD BodyIf enable is set (TRUE), the cosine of input_value is calculated andwritten into output_value.

IL BodyIf you want to call up the function in an instruction list, enter the following:

Page 153: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 26

Matsushita Electric Works (Europe) AG

Arithmetic Functions

�Notes

• The accuracy of the calculation decreases as the angledata specified in the input variable increases. Therefore,we recommend to enter angle data in radians ≥ –2π and ≤2π.

• It is not important whether the function names in the ILeditor are capitalized or not.

• The following error flags apply to (E_)COS:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data type

R9008 %MX0.900.8 for an instantREAL or input variable � 52707176

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 154: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 27Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline ACOS calculates the arc cosine of the input variable and writes theangle data in radians into the output variable. The function returnsa value from 0.0 to π. If you require an enable input (EN) and anenable output (ENO): E_ACOS.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example ACOS

In this example the function ACOS is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (input_value) has been declared.Instead, you may enter a constant at the input contact of the function.

LD BodyThe arc cosine of input_value is calculated and written into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)ACOS

Page 155: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 28

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under ACOS also applies to E_ACOS. However, inaddition to the ACOS function, E_ACOS has an enable input (EN)and an enable output (ENO) of the data type BOOL. If EN is set(TRUE), E_ACOS will be activated. If EN is not set (FALSE), thestatus of the output variable will remain unchanged until EN is set.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example E_ACOS

In this example the function E_ACOS is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value and enable) have beendeclared. Instead, you may enter a constant at the input contact of thefunction (enable input e.g. for tests).

LD BodyIf enable is set (TRUE), the arc cosine of input_value is calculated andwritten into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

� next page

Page 156: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 29Matsushita Electric Works (Europe) AG

Arithmetic Functions

�Notes

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)ACOS:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data type� �

R9008 %MX0.900.8 for an instantREAL or input variable is not � –1.0 and �1.0

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 157: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 30

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline TAN calculates the tangent of the input variable and writes the resultinto the output variable. The angle data has to be specified in radians(value < 52707176). If you require an enable input (EN) and anenable output (ENO): E_TAN.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example TAN

In this example the function TAN is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (input_value) has been declared.Instead, you may enter a constant at the input contact of the function.

LD BodyThe tangent of input_value is calculated and written into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)TAN

Page 158: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 31Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under TAN also applies to E_TAN. However, inaddition to the TAN function, E_TAN has an enable input (EN) andan enable output (ENO) of the data type BOOL. If EN is set (TRUE),E_TAN will be activated. If EN is not set (FALSE), the status of theoutput variable will remain unchanged until EN is set. ENO will adoptthe status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example E_TAN

In this example the function E_TAN is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value and enable) have beendeclared. Instead, you may enter a constant at the input contact of thefunction (enable input e.g. for tests).

LD BodyIf enable is set (TRUE), the tangent of input_value is calculated andwritten into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

Page 159: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 32

Matsushita Electric Works (Europe) AG

Arithmetic Functions

�Notes

• The accuracy of the calculation decreases as the angledata specified in the input variable increases. Therefore,we recommend to enter angle data in radians ≥ –2π and ≤2π.

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)TAN:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data type

R9008 %MX0.900.8 for an instant REAL or input variable is � 52707176

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 160: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 33Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline ATAN calculates the arc tangent of the input variable (value ±52707176) and writes the angle data in radians into the outputvariable. The function returns a value greater than –π/2 and smallerthan π/2. If you require an enable input (EN) and an enable output(ENO): E_ATAN.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example ATAN

In this example the function ATAN is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (input_value) has been declared.Instead, you may enter a constant at the input contact of the function.

LD BodyThe arc tangent of input_value is calculated and written into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)ATAN

Page 161: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 34

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under ATAN also applies to E_ATAN. However, inaddition to the ATAN function, E_ATAN has an enable input (EN) andan enable output (ENO) of the data type BOOL. If EN is set (TRUE),E_ATAN will be activated. If EN is not set (FALSE), the status of theoutput variable will remain unchanged until EN is set. ENO will adoptthe status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example E_ATAN

In this example the function E_ATAN is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value and enable) have beendeclared. Instead, you may enter a constant at the input contact of thefunction (enable input e.g. for tests).

LD BodyIf enable is set (TRUE), the arc tangent of input_value is calculated andwritten into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

� next page

Page 162: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 35Matsushita Electric Works (Europe) AG

Arithmetic Functions

�Notes

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)ATAN:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data type�

R9008 %MX0.900.8 for an instantREAL or input variable � 52707176

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 163: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 36

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline LN calculates the logarithm of the input variable (value > 0.0) to thebase e (Euler’s number = 2.7182818) and writes the result into theoutput variable. This function is the reversion of the EXP function.If you require an enable input (EN) and an enable output (ENO):E_LN.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example LN

In this example the function LN is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (input_value) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

BodyThe logarithm of input_value is calculated to the base e and written intooutput_value.

LD Body

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)LN

Page 164: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 37Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under LN also applies to E_LN. However, in additionto the LN function, E_LN has an enable input (EN) and an enableoutput (ENO) of the data type BOOL. If EN is set (TRUE), E_LN willbe activated. If EN is not set (FALSE), the status of the outputvariable will remain unchanged until EN is set. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example E_LN

In this example the function E_LN is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value and enable) have beendeclared. Instead, you may enter a constant directly at the input contactof the function (enable input e.g. for tests).

LD BodyIf enable is set (TRUE), the logarithm of input_value is calculated to thebase e and written into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

Page 165: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 38

Matsushita Electric Works (Europe) AG

Arithmetic Functions

�Notes

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)LN:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data type

R9008 %MX0.900.8 for an instant REAL or input variable is not > 0.0

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 166: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 39Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline LOG calculates the logarithm of the input variable (value > 0.0) to thebase 10 and writes the result into the output variable. If you requirean enable input (EN) and an enable output (ENO): E_LOG.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example LOG

In this example the function LOG is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (input_value) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

LD BodyThe logarithm of input_value is calculated to the base 10 and written intooutput_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)LOG

Page 167: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 40

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under LOG also applies to E_LOG. However, inaddition to the LOG function, E_LOG has an enable input (EN) andan enable output (ENO) of the data type BOOL. If EN is set (TRUE),E_LOG will be activated. If EN is not set (FALSE), the status of theoutput variable will remain unchanged until EN is set. ENO will adoptthe status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example E_LOG

In this example the function E_LOG is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value and enable) have beendeclared. Instead, you may enter a constant directly at the input contactof the function (enable input e.g. for tests).

LDIf enable is set (TRUE), the logarithm of input_value is calculated to thebase 10 and written into output_value.

ILIf you want to call the function in an instruction list, enter the following:

� next page

Page 168: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 41Matsushita Electric Works (Europe) AG

Arithmetic Functions

�Notes

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)LOG:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data type

R9008 %MX0.900.8 for an instant REAL or input variable is not > 0.0

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 169: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 42

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline EXP calculates the power of the input variable to the base e (Euler’snumber = 2.7182818) and writes the result into the output variable.The input variable has to be greater than –87.33 and smaller than88.72. This function is the reverse of the LN function. If you requirean enable input (EN) and an enable output (ENO): E_EXP.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example EXP

In this example the function EXP is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variable (input_value) has been declared.Instead, you may enter a constant directly at the input contact of thefunction.

LD BodyThe power of input_value is calculated to the base e and written into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)EXP

Page 170: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 43Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under EXP also applies to E_EXP. However, inaddition to the EXP function, E_EXP has an enable input (EN) andan enable output (ENO) of the data type BOOL. If EN is set (TRUE),E_EXP will be activated. If EN is not set (FALSE), the status of theoutput variable will remain unchanged until EN is set. ENO will adoptthe status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Data Types

Input Variable Output Variable

REAL as input data type

� Example E_EXP

In this example the function E_EXP is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value and enable) have beendeclared. Instead, you may enter a constant directly at the input contactof the function (enable input e.g. for tests).

LD BodyIf enable is set (TRUE), the power of input_value is calculated to thebase of e and written into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

Page 171: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 44

Matsushita Electric Works (Europe) AG

Arithmetic Functions

�Notes

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)EXP:

No. IEC Address set if

R9007 %MX0.900.7 permanently input variable does not have the data type

R9008 %MX0.900.8 for an instantREAL or input variable is not > –87.33 and <88.72

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 172: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 45Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline EXPT raises the first input variable to the power of the second inputvariable (OUT = IN1IN2) and writes the result into the output variable.Input variables have to be within the range –1.70141 x 1038 to1.70141 x 1038. If you require an enable input (EN): and an enableoutput (ENO): E_EXPT.

�Note

This function is only available for the FP0.

� Data Types

Input Variable Output Variable

1st input variable REAL as 1st input data type

2nd input variable REAL

� Example EXPT

In this example the function EXPT is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value_1 and input_value_2)have been declared. Instead, you may enter constants directly at theinput contacts of the function.LD Bodyinput_value_1 is raised to the power of input_value_2. The result iswritten into output_value.

IL BodyIf you want to call the function in an instruction list, enter the following:

�Note

Please see notes at the end of this section.

(E_)EXPT

Page 173: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 46

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Outline Anything stated under EXPT also applies to E_EXPT. However, inaddition to the EXPT function, E_EXPT has an enable input (EN)and an enable output (ENO) of the data type BOOL. If EN is set(TRUE), E_EXPT will be activated. If EN is not set (FALSE), thestatus of the output variable will remain unchanged until EN is set.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Data Types

Input Variable Output Variable

1st input variable REAL as 1st input data type

2nd input variable REAL

� Example E_EXPT

In this example the function E_EXPT is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for bothprogramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (input_value_1, input_value_2 andenable) have been declared. Instead, you may enter constants directly atthe input contacts of the function (enable input e.g. for tests).

Page 174: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

4 – 47Matsushita Electric Works (Europe) AG

Arithmetic Functions

LD BodyIf enable is set (TRUE), input_value_1 is raised to the power of input_value_2. The result is written into output_value.

IL BodyIf you want to call up the function in an instruction list, enter the following:

�Notes

• It does not matter whether the function names in the IL edi-tor are capitalized or not.

• The following error flags apply to (E_)EXPT:

No. IEC Address set if

R9007 %MX0.900.7 permanently first and the second input variable do not

R9008 %MX0.900.8 for an instanthave the data type REAL

R900B %MX0.900.11 permanently output variable is zero

R9009 %MX0.900.9 for an instant processing result overflows the outputvariable

Page 175: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

4 – 48

Matsushita Electric Works (Europe) AG

Arithmetic Functions

Page 176: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 5

Process Data Type Functions

(E_)ADD_TIME 5 -- 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)SUB_TIME 5 -- 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MUL_TIME_INT 5 -- 7. . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MUL_TIME_DINT 5 -- 9. . . . . . . . . . . . . . . . . . . . . . .

(E_)MUL_TIME_REAL 5 -- 11. . . . . . . . . . . . . . . . . . . . . .

(E_)DIV_TIME_INT 5 -- 13. . . . . . . . . . . . . . . . . . . . . . . . .

(E_)DIV_TIME_DINT 5 -- 15. . . . . . . . . . . . . . . . . . . . . . .

(E_)DIV_TIME_REAL 5 -- 17. . . . . . . . . . . . . . . . . . . . . . .

Page 177: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

5 – 2

Matsushita Electric Works (Europe) AG

Process Data Type Functions

Page 178: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

5 – 3Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline ADD_TIME adds the times of the two input variables and writes thesum in the output variable. If you require an enable output and anenable input: E_ADD_TIME.

� Data Types

Input Variable Output Variable

TIME TIME

� Example ADD_TIME

In this example the function ADD_TIME is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

LD Bodytime_value_1 and time_value_2 are added. The result is written in time_value_3.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)ADD_TIME

Page 179: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

5 – 4

Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline Anything stated under ADD_TIME also applies to E_ADD_TIME.The function E_ADD_TIME, however, has in addition an enabledinput (EN = enable) and an enabled output (ENO = enable output)of the data type BOOL. If EN is set (TRUE), E_ADD_TIME will beactivated. If EN is reset (FALSE), the status of the variable will befrozen until EN is set again. ENO will adopt the status of EN.Therefore, you may connect further function blocks/functions withENO which are controlled by the status of EN.

� Example E_ADD_TIME

In this example the function E_ADD_TIME is programmed in ladder dia-gram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

LD BodyIf enable is set (TRUE), time _value_1 and time_value_2 are added. Theresult is written in time_value_3. Once the function has been processed,ENO will be set.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 180: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

5 – 5Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline SUB_TIME subtracts the value of the second input variable from thevalue of the first. If you require an enable output and an enable input:E_SUB_TIME.

� Data Types

Input Variable Output Variable

TIME TIME

� Example SUB_TIME

In this example the function SUB_TIME is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

LD BodySubtrahend is subtracted from minuend. The result will be written in re-sult.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)SUB_TIME

Page 181: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

5 – 6

Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline Anything stated under SUB_TIME also applies to E_SUB_TIME.The function E_SUB_TIME, however, has in addition an enabledinput (EN = enable) and an enabled output (ENO = enable output)of the data type BOOL. If EN is set (TRUE), E_SUB_TIME will beactivated. If EN is reset (FALSE), the status of the variable will befrozen until EN is set again. ENO will adopt the status of EN.Therefore, you may connect further function blocks/functions withENO which are controlled by the status of EN.

� Example E_SUB_TIME

In this example the function E_SUB_TIME is programmed in ladder dia-gram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

LD BodyIf enable is set (TRUE), subtrahend is subtracted from minuend. The re-sult will be written in result. Once the function has been processed, ENOwill be set.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 182: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

5 – 7Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline MUL_TIME_INT multiplies the values of the two input variables witheach other and writes the result into the output variable. If yourequire an enable output and an enable input: E_MUL_TIME_INT.

� Data Types

Input Variable Output Variable

TIME TIME

INTEGER TIME

� Example MUL_TIME_INT

In this example the function MUL_TIME_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

LD Bodytime_value_1 is multiplied with multiplicator. The result is written intime_value_2.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)MUL_TIME_INT

Page 183: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

5 – 8

Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline Anything stated under MUL_TIME_INT also applies toE_MUL_TIME_INT. The function E_MUL_TIME_INT, however, hasin addition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_MUL_TIME_INT will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_MUL_TIME_INT

In this example the function E_MUL_TIME_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

LD BodyIf enable is set (TRUE), the time_value_1 is multiplied with multiplicator.The result will be written in time_value_2. Once the function has beenprocessed, ENO will be set.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 184: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

5 – 9Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline MUL_TIME_DINT multiplies the values of the input variables andwrites the result to the output variable. If you require an enableoutput (EN) and an enable input (ENO), use: E_MUL_TIME_DINT.

� Data types

input variable output variableTIME, DINT TIME

� Example MUL_TIME_DINT

In this example the function MUL_TIME_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU Header

In the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variables time_value and multiplier have beendeclared. However, you can write a constant directly at the input contactof the function instead.

Body

time_value_1 is multiplied by multiplier. The result is written in time_value_2.

LD Body

IL Body

If you wish to call up the function using instruction list, enter the following:

� Note next page

(E_)MUL_TIME_DINT

Page 185: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

5 – 10

Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline E_MUL_TIME_DINT multiplies the values of the input variables andwrites the result to the output variable. E_MUL_TIME_DINT has inaddition an enabled input (EN) and an enable output (ENO) of thedata type BOOL. If EN is set (TRUE), the function is activated. If ENis not set (FALSE), the function is not executed and the value of theoutput variable remains unchanged until EN is set. ENO will adoptthe status of EN. Therefore, you may connect further functions andfunction blocks that are controlled by the status of EN.

� Example E_MUL_TIME_DINT

In this example the function E_MUL_TIME_DINT is programmed in lad-der diagram (LD) and instruction list (IL). The same POU header is usedfor both programming languages.

POU Header

In the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variables start, time_value_1, and multiplierhave been declared. However, you can write a constant directly at theinput contact of the function instead.

Body

When start is set (TRUE), time_value_1 is multiplied by multiplier. Theresult is written in time_value_2. After the function has been processed,ENO is set.

LD Body

IL Body

If you wish to call up the function using instruction list, enter the following:

�Note

It does not matter whether the names of the functions are ca-pitalized in the IL editor or not.

Page 186: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

5 – 11Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline MUL_TIME_REAL multiplies the value of the first input variable ofthe data type TIME by the value of the second input variable of thedata type REAL. The REAL value is rounded off to the nearest wholenumber. The result is written into the output variable. If you requirean enable output and an enable input: E_MUL_TIME_REAL.

�Note

This function is only available for the FP0.� Data Types

Input Variable Output Variable

TIME TIME

REAL

� Example MUL_TIME_REAL

In this example the function MUL_TIME_REAL is programmed using theladder diagram (LD) editor. Since constants are entered directly at theinput function pins, only the output variable need be declared in the hea-der.

POU HeaderAll input and output variables that are required for programming the func-tion are declared in the POU header.

Body

The constant T#1h30m is multiplied by the value 3.5, which is roundedoff to 4.0 in the actual calculation. The result is written in mul_result. Byclicking on the view icon while in the online mode, you can see the resultT#6h0m0s0.00ms immediately.

LD Body

IL Body

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)MUL_TIME_REAL

Page 187: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

5 – 12

Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline Anything stated under MUL_TIME_REAL also applies toE_MUL_TIME_REAL. The function E_MUL_TIME_REAL, however,has in addition an enabled input (EN = enable) and an enabledoutput (ENO = enable output) of the data type BOOL. If EN is set(TRUE), E_MUL_TIME_REAL will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_MUL_TIME_REAL

In this example the function E_MUL_TIME_REAL is programmed in lad-der diagram (LD) and instruction list (IL). The same POU header is usedfor both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

Body

If start is set (TRUE), input_time is multiplied by input_real. The result iswritten in mul_result. Once the function has been processed, ENO will beset. In this example the input variables have been declared in the POUheader. However, you may enter constants directly at the contact pins ofthe function.

LD Body

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 188: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

5 – 13Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline DIV_TIME_INT divides the value of the first input variable by thevalue of the second input variable and writes the result into theoutput variable. If you require an enable output and an enable input:E_DIV_TIME_INT.

� Data Types

Input Variable Output Variable

TIME TIME

INTEGER TIME

� Example DIV_TIME_INT

In this example the function DIV_TIME_INT is programmed in ladder dia-gram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

LD Bodytime_value_1 is divided by INT_value. The result is written in time_value_2.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)DIV_TIME_INT

Page 189: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

5 – 14

Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline Anything stated under DIV_TIME_INT also applies toE_DIV_TIME_INT. The function E_DIV_TIME_INT, however, has inaddition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_DIV_TIME_INT will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_DIV_TIME_INT

In this example the function E_DIV_TIME_INT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

LD BodyIf enable is set (TRUE), time_value_1 is divided by INT_value. The resultis written in time_value_2. Once the function has been processed, ENOwill be set.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 190: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

5 – 15Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline DIV_TIME_DINT divides the value of the first input variable by thevalue of the second and writes the result into the output variable. Ifyou require an enable output (EN) and an enable input (ENO), use:E_DIV_TIME_DINT.

� Data types

input variable output variableTIME, DINT TIME

� Example DIV_TIME_DINT

In this example the function DIV_TIME_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU Header

In the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variables time_value_1 and DINT_value havebeen declared. However, you can write a constant directly at the inputcontact of the function instead.

Body

time_value_1 is divided by DINT_value. The result is written in time_value_2.

LD Body

IL Body

If you wish to call up the function using instruction list, enter the following:

� Note next page

(E_)DIV_TIME_DINT

Page 191: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

5 – 16

Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline E_DIV_TIME_DINT divides the value of the first input variable by thevalue of the second and writes the result into the output variable.E_DIV_TIME_DINT has in addition an enabled input (EN) and anenable output (ENO) of the data type BOOL. If EN is set (TRUE), thefunction is activated. If EN is not set (FALSE), the function is notexecuted and the value of the output variable remains unchangeduntil EN is set. ENO will adopt the status of EN. Therefore, you mayconnect further functions and function blocks that are controlled bythe status of EN.

� Example E_DIV_TIME_DINT

In this example the function E_DIV_TIME_DINT is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU Header

In the POU header, all input and output variables are declared that areused for programming this function.

In this example, the input variables start, time_value_1, and DINT_valuehave been declared. However, you can write a constant directly at theinput contact of the function instead.

Body

When start is set (TRUE), time_value_1 is divided by DINT_value. Theresult is written in time_value_2. After the function has been processed,ENO is set.

LD Body

IL Body

If you wish to call up the function using instruction list, enter the following:

�Note

It does not matter whether the names of the functions are ca-pitalized in the IL editor or not.

Page 192: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

5 – 17Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline DIV_TIME_REAL divides the value of the first input variable of thedata type TIME by the value of the second input variable of the datatype REAL. The REAL value is rounded off to the nearest wholenumber. The result is written into the output variable. If you requirean enable output and an enable input: E_DIV_TIME_REAL.

�Note

This function is only available for the FP0.� Data Types

Input Variable Output Variable

TIME TIME

REAL

� Example DIV_TIME_REAL

Here the function DIV_TIME_REAL is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both programminglanguages.POU HeaderAll input and output variables that are required for programming the func-tion are declared in the POU header.

Body

The value of variable input_time is divided by the value of the variableinput_real. The result is written in div_result. In this example the inputvariables have been declared in the POU header. However, you may en-ter constants directly at the contact pins of the function.

LD Body

IL Body

If you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

(E_)DIV_TIME_REAL

Page 193: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

5 – 18

Matsushita Electric Works (Europe) AG

Process Data Type Functions

Outline Anything stated under DIV_TIME_REAL also applies toE_DIV_TIME_REAL. The function E_DIV_TIME_REAL, however,has in addition an enabled input (EN = enable) and an enabledoutput (ENO = enable output) of the data type BOOL. If EN is set(TRUE), E_DIV_TIME_REAL will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_DIV_TIME_REAL

In this example the function E_DIV_TIME_REAL is programmed in lad-der diagram (LD) and instruction list (IL). The same POU header is usedfor both programming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

Body

If start is set (TRUE), input_time is divided by input_real. The result iswritten in div_result. Once the function has been processed, ENO will beset. In this example the input variables have been declared in the POUheader. However, you may enter constants directly into the function.

LD Body

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 194: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 6

Bitshift Functions

(E_)SHL 6 -- 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)SHR 6 -- 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ROL 6 -- 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)ROR 6 -- 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 195: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

6 – 2

Matsushita Electric Works (Europe) AG

Bitshift Functions

Page 196: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

6 – 3Matsushita Electric Works (Europe) AG

Bitshift Functions

Outline SHL shifts a bit value by a defined number of positions (n) to the leftand fills the vacant positions with zeros.Bit shift to the left, zero–filled on right

these 4 bits are filled up with zeros

15

bit

bit

DT0

11 8 3 0. . 12 . . . .7 4. .

DT0

11 8

0 0 0 0

3 . 015 . . 12 . . .7 4. .

source register (n = 4 bit)

target register

E_SHL shifts a bit value by a defined number of positions (n) tothe left and fills the vacant positions with zeros when EN ist set(TRUE).

15

bit

bit

DT0

11 8 3 0

EN = TRUE

. . 12 . . . .7 4. .

DT0

11 8

0 0 0 0

3 . 015 . . 12 . . .7 4. .

source register (n = 4 bit)

target register

these 4 bits are filled up with zeros

� Data Types

1. + 2. Input Variable Output Variable

BOOL as data type of the

WORDtwo input variables

DOUBLE WORD

Input and output variables have to be of the same data type.

(E_)SHL

Page 197: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

6 – 4

Matsushita Electric Works (Europe) AG

Bitshift Functions

� Example SHL

In this example the function SHL is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyThe first n bits (here 3) of source_register are left–shifted, the vacantpositions on the right are filled with zeros. The result is written in tar-get_register.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

Page 198: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

6 – 5Matsushita Electric Works (Europe) AG

Bitshift Functions

Outline Anything stated under SHL also applies to E_SHL. The functionE_SHL, however, has in addition an enabled input (EN = enable) andan enabled output (ENO = enable output) of the data type BOOL. IfEN is set (TRUE), E_SHL will be activated. If EN is reset (FALSE),the status of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.Left shift by bits:

� Example E_SHL

In this example the function E_SHL is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyAll bits of source_register are left–shifted by n positions (here 3) and thevacant positions on the right are zero filled. The result is written in tar-get_register.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 199: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

6 – 6

Matsushita Electric Works (Europe) AG

Bitshift Functions

Outline SHR shifts a bit value by a defined number of positions (n) to the rightand fills the vacant positions with zeros.Bit shift to the right, zero–filled on left:

the 4 most significant bits are filled up with zeros

3

bit

bit

DT0

11 8 015 . . 12 . . . .7 4. .

DT0 0 0 0 0

11 8 3 015 . . 12 . . . .7 4. .

source register (n = 4 bit)

target register

E_SHR shifts a bit value by a defined number of positions (n) tothe right and fills the vacant positions with zeros when EN is set(TRUE).

3

bit

bit

DT0

11 8 0

EN = TRUE

15 . . 12 . . . .7 4. .

DT0 0 0 0 0

11 8 3 015 . . 12 . . . .7 4. .

source register (n = 4 bit)

target register

the 4 most significant bits are filled up with zeros

� Data Types

1. + 2. Input Variable Output Variable

BOOL as data type of the

WORDtwo input variables

DOUBLE WORD

Input and output variables have to be of the same data type.

� next page

(E_)SHR

Page 200: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

6 – 7Matsushita Electric Works (Europe) AG

Bitshift Functions

� Example SHR

In this example the function SHR is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyThe last n bits (here 3) of source_register are right–shifted. The vacantpositions on the left are filled with zeros. The result is written in target_register.

IL BodyIf you wish to call up the function SHR in an instruction list, enter the fol-lowing:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 201: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

6 – 8

Matsushita Electric Works (Europe) AG

Bitshift Functions

Outline Anything stated under SHR also applies to E_SHR. The functionE_SHR, however, has in addition an enabled input (EN = enable)and an enabled output (ENO = enable output) of the data typeBOOL. If EN is set (TRUE), E_SHR will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_SHR

In this example the function E_SHR is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyIf enable is set (TRUE), all bits of source_register (data type WORD) willbe right–shifted by n positions (in this case 3). The vacant positions onthe right are zero filled. The result is written in target_register (data typeWORD).

IL BodyIf you wish to call up E_SHR in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 202: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

6 – 9Matsushita Electric Works (Europe) AG

Bitshift Functions

Outline ROL rotates a defined number (n) of bits to the left.

15

0

0

1

bit

0 0 0 0 1 0

11 8

0 0 1 1 0 1 0 0

3 0. . 12 . . . .7 4. .

bit

DT0 0 0 1 0 0 0 1 1

11 80 1 0 0 0 0 1

3 015 . . 12 . . . .7 4. .

source register (n = 4 bit)

DT0

target register

E_ROL rotates a defined number (n) of bits to the leftwhen EN is set (TRUE).

15

0

0

1

bit

0 0 0 0 1 0

11 8

0 0 1 1 0 1 0 0

3 0

EN = TRUE

. . 12 . . . .7 4. .

bit

DT0 0 0 1 0 0 0 1 1

11 80 1 0 0 0 0 1

3 015 . . 12 . . . .7 4. .

source register (n = 4 bit)

DT0

target register

� Data Types

1. + 2. Input Variable Output Variable

BOOL as data type of the

WORDtwo input variables

DOUBLE WORD

Input and output variables have to be of the same data type.

(E_)ROL

Page 203: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

6 – 10

Matsushita Electric Works (Europe) AG

Bitshift Functions

� Example ROL

In this example the function ROL is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants/variables.

LD BodyThe last n bits (here 3) of source_register are left–rotated. The result willbe written in target_register.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

Page 204: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

6 – 11Matsushita Electric Works (Europe) AG

Bitshift Functions

Outline Anything stated under ROL also applies to E_ROL. The functionE_ROL, however, has in addition an enabled input (EN = enable)and an enabled output (ENO = enable output) of the data typeBOOL. If EN is set (TRUE), E_ROL will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_ROL

In this example the function E_ROL is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables

LD BodyIf enable is set (TRUE), all bits of source_register are left–rotated byn–positions (in this case 3). The result will be written in target_register.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 205: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

6 – 12

Matsushita Electric Works (Europe) AG

Bitshift Functions

Outline ROR rotates a defined number (n) of bits to the right.

0

DT0 0

0

3

source register ( n = 4 bit)

bit

DT0 0 0 0 1 0 0 1 0

11 8

0 0 1 1 1 0

015 . . 12 . . . .7 4. .

bit 15 . . 12 . . . .7 4. .

target register

0 1 0 0 0 0 1

11 8

0 0 1 0 0 0 1 1

3 0

E_ROR rotates a defined number (n) of bits to the right when ENist set (TRUE).

0

DT0 0

0

3

source register ( n = 4 bit)

bit

DT0 0 0 0 1 0 0 1 0

11 8

0 0 1 1 1 0

0

EN = TRUE

15 . . 12 . . . .7 4. .

bit 15 . . 12 . . . .7 4. .

target register

0 1 0 0 0 0 1

11 8

0 0 1 0 0 0 1 1

3 0

� Data Types

1. + 2. Input Variable Output Variable

BOOL as data type of the

WORDtwo input variables

DOUBLE WORD

Input and output variables have to be of the same data type.

� next page

(E_)ROR

Page 206: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

6 – 13Matsushita Electric Works (Europe) AG

Bitshift Functions

� Example ROR

In this example the function ROR is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyThe first n bits (here n = 3) of source_register are right–rotated. The re-sult will be written in target_register.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 207: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

6 – 14

Matsushita Electric Works (Europe) AG

Bitshift Functions

Outline Anything stated under ROR also applies to E_ROR. The functionE_ROR, however, has in addition an enabled input (EN = enable)and an enabled output (ENO = enable output) of the data typeBOOL. If EN is set (TRUE), E_ROR will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_ROR

In this example the function E_ROR is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables

LD BodyIf enable is set (TRUE), all bits of source_register are right–rotated byn–positions (in this case 3). The result will be written in target_register.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 208: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 7

Bitwise Boolean Functions

(E_)AND 7 -- 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)OR 7 -- 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)XOR 7 -- 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)NOT 7 -- 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 209: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

7 – 2

Matsushita Electric Works (Europe) AG

Bitwise Boolean Functions

Page 210: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

7 – 3Matsushita Electric Works (Europe) AG

Bitwise Boolean Functions

Outline The content of the accumulator is connected with the operanddefined in the operand field by a logical AND operation. The resultis transferred to the accumulator.

� Data Types

Input Variable Output Variable

BOOL as input data type

WORD

DWORD

Input and output variables have to be of the same data type.

� Example AND

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 BOOL FALSE Input_1

1 VAR var_2 BOOL FALSE Input_2

2 VAR var_3 BOOL FALSE Output

IL BodyLD var_1 (* Load var_1 in accu *)

AND var_2 (* Perform an AND of accu with var_2; storeresult in accu *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 and var_3 must be of one of the above noteddata types. All operands must be of the same data type.

• The number of input contacts lies in the range of 2 to 28.

• It is not important whether the function names in the ILeditor are capitalized or not.

(E_)AND

Page 211: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

7 – 4

Matsushita Electric Works (Europe) AG

Bitwise Boolean Functions

Outline E_AND links the input variables with a logical AND. E_AND operatesjust as the standard operator AND (see: Online Help: Help > Index> Standard Operators). However, E_AND has an additional enabledinput (EN = enable) and an enabled output (ENO = enable output)of the data type BOOL. If EN is set (TRUE), E_AND will be activated.If EN is reset (FALSE), the variable’s status will be frozen until EN isset again. ENO will adopt the status of EN. Therefore, you mayconnect further function blocks/functions with ENO which arecontrolled by the status of EN.

� Example E_AND

In this example the function E_AND is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyIf enable is set (TRUE), operand_1 will be logically AND–linked with ope-rand_2. The result will be written into the output variable result.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_BitN lies in the range of 2to 28.

• It does not matter whether the function names in the ILeditor are capitalized or not.

Page 212: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

7 – 5Matsushita Electric Works (Europe) AG

Bitwise Boolean Functions

Outline The content of the accumulator is connected with the operanddefined in the operand field by a logical OR operation. The result istransferred to the accumulator.

� Data Types

Input Variable Output Variable

BOOL as input data type

WORD

DWORD

Input and output variables have to be of the same data type.

� Example OR

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 BOOL FALSE Input_1

1 VAR var_2 BOOL FALSE Input_2

2 VAR var_3 BOOL FALSE Output

IL BodyLD var_1 (* Load var_1 in accu *)

OR var_2 (* Perform an OR of accu with var_2; storeresult in accu *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 and var_3 must be of one of the above noteddata types. All operands must be of the same data type.

• The number of input contacts lies in the range of 2 to 28.

• It is not important whether the function names in the ILeditor are capitalized or not.

(E_)OR

Page 213: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

7 – 6

Matsushita Electric Works (Europe) AG

Bitwise Boolean Functions

Outline E_OR operates just as the standard operator OR (Online Help: Help> Index > Standard Operators). E_OR, however, has in addition anenabled input (EN = enable) and an enabled output (ENO = enableoutput) of the data type BOOL. If EN is set (TRUE), E_OR will beactivated. If EN is reset (FALSE), the status of the variable will befrozen until EN is set again. ENO will adopt the status of EN.Therefore, you may connect further function blocks/functions withENO which are controlled by the status of EN.

� Example E_OR

In this example the function E_OR is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables

LD BodyIf enable is set (TRUE), operand_1 and operand_2 are linked with a logi-cal OR. The result will be written in result.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_BitN lies in the range of 2to 28.

• It does not matter whether the function names in the ILeditor are capitalized or not.

Page 214: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

7 – 7Matsushita Electric Works (Europe) AG

Bitwise Boolean Functions

Outline The content of the accumulator is connected with the operanddefined in the operand field by a logical XOR operation. The resultis transferred to the accumulator.

� Data Types

Input Variable Output Variable

BOOL as input data type

WORD

DWORD

Input and output variables have to be of the same data type.

� Example XOR

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 BOOL FALSE Input_1

1 VAR var_2 BOOL FALSE Input_2

2 VAR var_3 BOOL FALSE Output

IL BodyLD var_1 (* Load var_1 in accu *)

XOR var_2 (* Perform an XOR of accu with var_2; storeresult in accu *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 and var_3 must be of one of the above noteddata types. All operands must be of the same data type.

• The number of input contacts lies in the range of 2 to 28.

• It is not important whether the function names in the ILeditor are capitalized or not.

(E_)XOR

Page 215: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

7 – 8

Matsushita Electric Works (Europe) AG

Bitwise Boolean Functions

Outline E_XOR operates as the standard operator XOR (Online Help: Help> Index > Standard Operators. The function E_XOR, however, hasin addition an enabled input (EN = enable) and an enabled output(ENO = enable output) of the data type BOOL. If EN is set (TRUE),E_WORD_TO_DWORD will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_XOR

In this example the function E_XOR is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyIf enable is set, the Boolean variables operand_1 and operand_2 are logi-cally EXCLUSIVE–OR linked and the result is written in result.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_BitN lies in the range of 2to 28.

• It does not matter whether the function names in the ILeditor are capitalized or not.

Page 216: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

7 – 9Matsushita Electric Works (Europe) AG

Bitwise Boolean Functions

Outline NOT performs a bit inversion of input variables. The result will bewritten in the output variable. If you require an enable output and anenable input: E_NOT.

� Data Types

Input Variable Output Variable

BOOL as input data type

WORD

DWORD

Input and output variables have to be of the same data type.

� Example NOT

In this example the function NOT is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyThe bits of input_value are inversed (0 is inversed to 1 and vice versa).The inversed result is written in negation.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

� Note next page

(E_)NOT

Page 217: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

7 – 10

Matsushita Electric Works (Europe) AG

Bitwise Boolean Functions

Outline Anything stated under NOT also applies to E_NOT. The functionE_NOT, however, has in addition an enabled input (EN = enable)and an enabled output (ENO = enable output) of the data typeBOOL. If EN is set (TRUE), E_NOT will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_NOT

In this example the function E_NOT is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables

LD BodyIf enable is set (TRUE), each bit of input_value will be inverted, i.e. 0 isinverted to 1 and vice versa. The result will be written in negation.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 218: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 8

Selection Functions

(E_)MAX 8 -- 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MIN 8 -- 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)LIMIT 8 -- 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)MUX 8 -- 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 219: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

8 – 2

Matsushita Electric Works (Europe) AG

Selection Functions

Page 220: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

8 – 3Matsushita Electric Works (Europe) AG

Selection Functions

Outline MAX determines the input variable with the highest value. If yourequire an enable output and an enable input: E_MAX.

� Data Types

Input Variable Output Variable

any data type except String,but all of the same type

as input data type

� Example MAX

In this example the function MAX is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD Bodyvalue_1 and value_2 are compared with each other. The higher value ofthe two is written in maximum_value.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of2 to 28.

• It does not matter whether the function names in the ILeditor are capitalized or not.

(E_)MAX

Page 221: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

8 – 4

Matsushita Electric Works (Europe) AG

Selection Functions

Outline Anything stated under MAX also applies to E_MAX. The functionE_MAX, however, has in addition an enabled input (EN = enable)and an enabled output (ENO = enable output) of the data typeBOOL. If EN is set (TRUE), E_MAX will be activated. If EN is reset(FALSE), the status of the variable will be frozen until EN is set again.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by thestatus of EN.

� Example E_MAX

In this example the function E_MAX is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables

LD BodyIf enable is set (TRUE), value_1 is compared with value_2. The highervalue will be written in maximum_value.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of2 to 28.

• It does not matter whether the function names in the ILeditor are capitalized or not.

Page 222: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

8 – 5Matsushita Electric Works (Europe) AG

Selection Functions

Outline MIN dectects the input variable with the lowest value. If you requirean enable output and an enable input: E_MIN.

� Data Types

Input Variable Output Variable

any data type except String,but all of the same type

as input data type

� Example MIN

In this example the function MIN is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD Bodyvalue_1 and value_2 are compared with each other. The lower value ofthe two is written in minimum_value.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of2 to 28.

• It does not matter whether the function names in the ILeditor are capitalized or not.

(E_)MIN

Page 223: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

8 – 6

Matsushita Electric Works (Europe) AG

Selection Functions

Outline Anything stated under MIN also applies to E_MIN. The functionE_MIN, however, has in addition an enabled input (EN = enable) andan enabled output (ENO = enable output) of the data type BOOL. IfEN is set (TRUE), E_MIN will be activated. If EN is reset (FALSE),the status of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_MIN

In this example the function E_MIN is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables

LD BodyIf enable is set (TRUE), value_1 is compared with value_2. The smallervalue will be written into minimum_value.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of2 to 28.

• It does not matter whether the function names in the ILeditor are capitalized or not.

Page 224: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

8 – 7Matsushita Electric Works (Europe) AG

Selection Functions

Outline In LIMIT the 1. input variable forms the lower and the 3. input variablethe upper limit value. If the 2. input variable is within this limit, it willbe transferred to the output variable. If it is above this limit, the upperlimit value will be transferred, if it is below this limit the lower limitvalue will be transferred. If you require an enable output and anenable input: E_LIMIT.

� Data Types

Input Variable Output Variable

any data type, but all of the same type as input data type

� Example LIMIT

In this example the function LIMIT is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD Bodylower_limit_val and upper_limit_val form the range where the comparison_value has to be, if it has to be transferred to result. If thecomparison_value is above the upper_limit_val, the value of upper_limit_val will be transferred to result. If it is below the lower_limit_val, the value of lower_limit_val will be transferred to result.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

� Note next page

(E_)LIMIT

Page 225: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

8 – 8

Matsushita Electric Works (Europe) AG

Selection Functions

Outline Anything stated under LIMIT also applies to E_LIMIT. E_LIMIT,however, has in addition an enabled input (EN = enable) and anenabled output (ENO = enable output) of the data type BOOL. If ENis set (TRUE), E_LIMIT will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_LIMIT

In this example the function E_LIMIT is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

|This example uses variables. You may also use constants for the inputvariables

LD BodyIf enable is set (TRUE), comparison_value is compared with lower_limit_val and upper_limit_val. If the comparison_value is within thelimit values, the value of comparison_value is written in result. If the comparison_value surpasses the value in lower_limit_val, the value oflower_limit_val will be transferred in result. If it exceeds the value of upper_limit_val , the value of upper_limit_val will be transferred into result.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 226: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

8 – 9Matsushita Electric Works (Europe) AG

Selection Functions

Outline The function Multiplexer selects an input variable and writes its valueinto the output variable. With the 1. input variable is determineswhich input variable it to be written into the output variable. Thefunction MUX can be configured for any desired number of inputs.If you require an enable output and an enable input: E_MUX.

� Data Types

Input Variable Output Variable

1. input variable INTEGER as data type of 2. or 3.

2. + 3. input variable any desired, but both of the identicaltype

input variable

�Note

The difference between the functions E_MUX and E_SEL isthat in E_MUX you can select between multiple channels withan integer value, while in E_SEL you can only choosebetween two channels with a Boolean value.

(E_)MUX

Page 227: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

8 – 10

Matsushita Electric Works (Europe) AG

Selection Functions

� Example MUX

In this example the function MUX is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyIn channel_select you find the integer value (0, 1...n) for the selection ofchannel_0 or channel_1. The result will be written in output.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts aNumN lies in the range of 2to 28.

• It does not matter whether the function names in the ILeditor are capitalized or not.

� next page

Page 228: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

8 – 11Matsushita Electric Works (Europe) AG

Selection Functions

Outline Anything stated under MUX also applies to E_MUX. E_MUX,however, has in addition an enabled input (EN = enable) and anenabled output (ENO = enable output) of the data type BOOL. If ENis set (TRUE), E_MUX will be activated. If EN is reset (FALSE), thestatus of the variable will be frozen until EN is set again. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_MUX

In this example the function E_MUX is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariablesLD BodyIf enable is set (TRUE), E_MUX will be executed. In channel_select youfind the value for the selection of channel_0 or channel_1. In E_MUX thenumber of channels is not limited.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts aNumN lies in the range of 2to 28.

• It does not matter whether the function names in the ILeditor are capitalized or not.

Page 229: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

8 – 12

Matsushita Electric Works (Europe) AG

Selection Functions

Page 230: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 9

Comparison Functions

(E_)GT 9 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)GE 9 – 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)EQ 9 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)LE 9 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)LT 9 – 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)NE 9 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 231: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

9 – 2

Matsushita Electric Works (Europe) AG

Comparison Functions

Page 232: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

9 – 3Matsushita Electric Works (Europe) AG

Comparison Functions

Outline The content of the accumulator is compared with the operanddefined in the operand field. If the accumulator is greater, ”TRUE” isstored in the accumulator, else ”FALSE”.

� Data Types

Input Variable Output Variable

any data type, but all ofthe same type

BOOL

� Example GT

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 BOOL FALSE Input_1

1 VAR var_2 BOOL FALSE Input_2

2 VAR var_3 BOOL FALSE Output

IL BodyLD var_1 (* Load var_1 in accu *)

GT var_2 (* Compare accu with var_2; storeBOOL result of comparison in accu;

if accu > var_2, TRUE is stored inaccu, else false *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 can be of any data type; both variables must beof the same data type though. var_3 must be of type BOOL.

• The number of input contacts lies in the range of 2 to 28.

• It is not important whether the function names in the IL editorare capitalized or not.

(E_)GT

Page 233: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

9 – 4

Matsushita Electric Works (Europe) AG

Comparison Functions

Outline E_GT compares the two input variables. If the first is greater than thesecond, the result will be TRUE, otherwise FALSE. E_GT operatesjust as the standard operator GT (Online Help: Help > Index >Standard Operators). E_GT has in addition an enable input (EN) andan enable output (ENO) of the data type BOOL. If EN is set (TRUE),E_GT will be activated. If EN is not set (FALSE), the status of theoutput variable will remain unchanged until EN is set. ENO will adoptthe status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_GT

In this example the function E_GT is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (comparison_value, reference_valueand enable) have been declared. Instead, you may enter constants di-rectly at the input contacts of a function (enable input e.g. for tests).

LD BodyIf enable is set (TRUE), the comparison_value is compared with the reference_value. If the comparison_value is greater than the reference_value, the value TRUE will be written into result, otherwiseFALSE.

IL Body

If you want to call the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of 2 to28.

• It does not matter whether the function names in the IL editorare capitalized or not.

Page 234: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

9 – 5Matsushita Electric Works (Europe) AG

Comparison Functions

Outline The content of the accumulator is compared with the operanddefined in the operand field. If the accumulator is greater or equal,”TRUE” is stored in the accumulator, else ”FALSE”.

� Data Types

Input Variable Output Variable

any data type, but all ofthe same type

BOOL

� Example GE

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 BOOL FALSE Input_1

1 VAR var_2 BOOL FALSE Input_2

2 VAR var_3 BOOL FALSE Output

IL BodyLD var_1 (* Load var_1 in accu *)

GE var_2 (* Compare accu with var_2; store BOOLresult of comparison in accu;

if accu ≥ var_2, TRUE is stored in accu, elsefalse *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 can be of any data type; both variables must beof the same data type though. var_3 must be of type BOOL.

• The number of input contacts lies in the range of 2 to 28.

• It is not important whether the function names in the IL editorare capitalized or not.

(E_)GE

Page 235: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

9 – 6

Matsushita Electric Works (Europe) AG

Comparison Functions

Outline E_GE compares the two input variables with each other. If the firstvalue is greater than or equal to the second value, the result will beTRUE, otherwise FALSE. E_GE operates just as the standardoperator GE (Online Help: Help > Index > Standard Operators).E_GE has in addition an enable input (EN) and an enable output(ENO) of the data type BOOL. If EN is set (TRUE), E_GE will beactivated. If EN is not set (FALSE), the status of the output variablewill remain unchanged until EN is set. ENO will adopt the status ofEN. Therefore, you may connect further function blocks/functionswith ENO which are controlled by the status of EN.

� Example E_GE

In this example the function E_GE is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyIf enable is set (TRUE), the comparison_value is compared with the reference_value. If the comparison_value is greater than or equal to thereference_value, the value TRUE will be written in result, otherwiseFALSE.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of 2 to28.

• It does not matter whether the function names in the IL editorare capitalized or not.

Page 236: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

9 – 7Matsushita Electric Works (Europe) AG

Comparison Functions

Outline The content of the accumulator is compared with the operanddefined in the operand field. If both values are equal, ”TRUE” isstored in the accumulator, else ”FALSE”.

� Data Types

Input Variable Output Variable

any data type, but all ofthe same type

BOOL

� Example EQ

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 BOOL FALSE Input_1

1 VAR var_2 BOOL FALSE Input_2

2 VAR var_3 BOOL FALSE Output

IL BodyLD var_1 (* Load var_1 in accu *)

EQ var_2 (* Compare accu with var_2; store BOOLresult of comparison in accu;

if accu = var_2, TRUE is stored in accu, elsefalse *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 can be of any data type; both variables must beof the same data type though. var_3 must be of type BOOL.

• The number of input contacts lies in the range of 2 to 28.

• It is not important whether the function names in the IL editorare capitalized or not.

(E_)EQ

Page 237: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

9 – 8

Matsushita Electric Works (Europe) AG

Comparison Functions

Outline E_EQ compares the value of the two input variables with each other.In case they are identical, the result will be TRUE, otherwise FALSE.E_EQ operates just as the standard operator EQ (Online Help: Help> Index > Standard Operators). E_EQ has in addition an enable in-put (EN) and an enable output (ENO) of the data type BOOL. If ENis set (TRUE), E_EQ will be activated. If EN is not set (FALSE), thestatus of the output variable will remain unchanged until EN is set.ENO will adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions with ENO which are controlled by the sta-tus of EN.

� Example E_EQ

In this example the function E_EQ is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.LD BodyIf enable is set (TRUE), the variable comparison_value is compared withthe variable reference_value. If the values of the two variables are identi-cal, the value TRUE will be written in result, otherwise FALSE.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of 2 to28.

• It does not matter whether the function names in the IL editorare capitalized or not.

Page 238: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

9 – 9Matsushita Electric Works (Europe) AG

Comparison Functions

Outline The content of the accumulator is compared with the operanddefined in the operand field. If the accumulator is lower or equal,”TRUE” is stored in the accumulator, else ”FALSE”.

� Data Types

Input Variable Output Variable

any data type, but all ofthe same type

BOOL

� Example LE

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 BOOL FALSE Input_1

1 VAR var_2 BOOL FALSE Input_2

2 VAR var_3 BOOL FALSE Output

IL BodyLD var_1 (* Load var_1 in accu *)

LE var_2 (* Compare accu with var_2; store BOOLresult of comparison in accu;

if accu ≤ var_2, TRUE is stored in accu, elsefalse *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 can be of any data type; both variables must beof the same data type though. var_3 must be of type BOOL.

• The number of input contacts lies in the range of 2 to 28.

• It is not important whether the function names in the IL editorare capitalized or not.

(E_)LE

Page 239: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

9 – 10

Matsushita Electric Works (Europe) AG

Comparison Functions

Outline E_LE compares the two input variables. If the first value is less thanor equal to the second value, the result will be TRUE, otherwiseFALSE. E_LE operates just as the standard operator LE (OnlineHelp: Help > Index > Standard Operators). E_LE has in addition anenable input (EN) and an enable output (ENO) of the data typeBOOL. If EN is set (TRUE), E_LE will be activated. If EN is not set(FALSE), the status of the output variable will remain unchangeduntil EN is set. ENO will adopt the status of EN. Therefore, you mayconnect further function blocks/functions with ENO which arecontrolled by the status of EN.

� Example E_LE

In this example the function E_LE is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariables.

LD BodyIf enable is set (TRUE), the comparison_value is compared with the va-riable reference_value. If the comparison_value is less than or equal tothe reference_value, TRUE will be written in result, otherwise FALSE.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of 2 to28.

• It does not matter whether the function names in the IL editorare capitalized or not.

Page 240: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

9 – 11Matsushita Electric Works (Europe) AG

Comparison Functions

Outline The content of the accumulator is compared with the operanddefined in the operand field. If the accumulator is lower than theoperand, ”TRUE” is stored in the accumulator, else ”FALSE”.

� Data Types

Input Variable Output Variable

any data type, but all ofthe same type

BOOL

� Example LT

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 BOOL FALSE Input_1

1 VAR var_2 BOOL FALSE Input_2

2 VAR var_3 BOOL FALSE Output

IL BodyLD var_1 (* Load var_1 in accu *)

LT var_2 (* Compare accu with var_2; store BOOLresult of comparison in accu;

if accu < var_2, TRUE is stored in accu, elsefalse *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 can be of any data type; both variables must beof the same data type though. var_3 must be of type BOOL.

• The number of input contacts lies in the range of 2 to 28.

• It is not important whether the function names in the IL editorare capitalized or not.

(E_)LT

Page 241: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

9 – 12

Matsushita Electric Works (Europe) AG

Comparison Functions

Outline E_LT compares two input variables with each other. If the first valueis less than the second value, the result is TRUE, otherwise FALSE.E_LT operates just as the standard operator LT (Online Help: Help> Index > Standard Operators). E_LT has in addition an enable input(EN) and an enable output (ENO) of the data type BOOL. If EN is set(TRUE), E_LT will be activated. If EN is not set (FALSE), the statusof the output variable will remain unchanged until EN is set. ENO willadopt the status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_LT

In this example the function E_LT is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU HeaderAll input and output variables which are required for programming thefunction are declared in the POU header.

This example uses variables. You may also use constants for the inputvariablesLD BodyIf enable is set (TRUE), the comparison_value is compared with the reference_value. If the comparison_value is less than or equal to the reference_value, TRUE will be written in result, otherwise FALSE.

IL BodyIf you wish to call up the function in an instruction list, enter the following:

�Notes

• The number of input contacts a_NumN lies in the range of 2 to28.

• It does not matter whether the function names in the IL editorare capitalized or not.

Page 242: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC FunctionsNAiS Control 1131

9 – 13Matsushita Electric Works (Europe) AG

Comparison Functions

Outline The content of the accumulator is compared with the operanddefined in the operand field. If both values are not equal, ”TRUE” isstored in the accumulator, else ”FALSE”.

� Data Types

Input Variable Output Variable

any data type, but all ofthe same type

BOOL

� Example NE

POU Header

Class Identi-fier

Type Initial Comment

0 VAR var_1 BOOL FALSE Input_1

1 VAR var_2 BOOL FALSE Input_2

2 VAR var_3 BOOL FALSE Output

IL BodyLD var_1 (* Load var_1 in accu *)

NE var_2 (* Compare accu with var_2; store BOOLresult of comparison in accu;

if accu ≠ var_2, TRUE is stored in accu, elsefalse *)

ST var_3 (* Store accu in var_3 *)

LD Body

�Notes

• var_1, var_2 can be of any data type; both variables must beof the same data type though. var_3 must be of type BOOL.

• The number of input contacts lies in the range of 2 to 28.

• It is not important whether the function names in the IL editorare capitalized or not.

(E_)NE

Page 243: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Functions NAiS Control 1131

9 – 14

Matsushita Electric Works (Europe) AG

Comparison Functions

Outline E_NE compares the two input variables with each other. If they areunequal, the result is TRUE, otherwise FALSE. E_NE operates justas the standard operator NE (Online Help: Help > Index > StandardOperators). E_NE has in addition an enable input (EN) and anenable output (ENO) of the data type BOOL. If EN is set (TRUE),E_NE will be activated. If EN is not set (FALSE), the status of theoutput variable will remain unchanged until EN is set. ENO will adoptthe status of EN. Therefore, you may connect further functionblocks/functions with ENO which are controlled by the status of EN.

� Example E_NE

In this example the function E_NE is programmed in ladder diagram (LD)and instruction list (IL). The same POU header is used for both program-ming languages.

POU Header

All input and output variables which are required for programming thefunction are declared in the POU header.

In this example the input variables (comparison_value, reference_valueand enable) have been declared. However, you may enter constants di-rectly into the function (enable input e.g. for tests).

LD Body

If enable is set (TRUE), the comparison_value is compared with the reference_value. If the two values are unequal, TRUE will be written intoresult, otherwise FALSE.

IL Body

If you want to call up the function in an instruction list, enter the following:

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 244: Nais Control 1131 FP0-FP1-FPM Instruction Set

Part 3IEC Function Blocks

Page 245: Nais Control 1131 FP0-FP1-FPM Instruction Set
Page 246: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 10

Bistable Function Blocks

(E_)SR 10 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)RS 10 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 247: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

10 – 2

Matsushita Electric Works (Europe) AG

Bistable Function Blocks

Page 248: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

10 – 3Matsushita Electric Works (Europe) AG

Bistable Function Blocks

Outline The function block SR (set/reset) or E_SR allows you to both set andreset an output. For the SR you declare the following:SET: set

The output Q is set for each rising edge at SET.RESET: reset

The output Q is reset for each rising edge detected atRESET, except SET is set (see time chart)

Q: signal outputis set, if a rising edge is detected at SET, is reset, if arising edge is detected at RESET, and if the SET is notset.

� Data Types

Input Variable Output Variable

BOOL (SET and RESET) BOOL (Q)

�Notes

� Q is set if a rising edge is detected at both inputs (Set andReset)

� Upon initialising, Q always has the status zero (reset).

� Time Chart

SET

Q

RESET

(E_)SR

Page 249: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

10 – 4

Matsushita Electric Works (Europe) AG

Bistable Function Blocks

� Example SR

In the following example, the function block SR is programmed in ladderdiagram (LD) and in the instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are used for programming the func-tion block SR are declared in the POU header. This also includes thefunction block (FB) itself. By declaring the FB you create a copy of theoriginal FB. This copy is saved under copy_name, and a separate dataarea is reserved.

LD BodyIf set is set (status = TRUE), signal_output will be set. If only reset is set,the signal_output will be reset (status = FALSE). If both set and reset areset, signal_output will be set.

IL BodyIf you wish to call up SR: copy_name in the instruction list, you enter thefollowing:

The nomination copy_name.SET or copy_name.RESET etc. has to bemaintained in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

Page 250: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

10 – 5Matsushita Electric Works (Europe) AG

Bistable Function Blocks

Outline Anything stated for SR also applies to E_SR. The function blockE_SR, however, further contains an enabled input (EN = enable) andan enabled output (ENO = enable output). If EN is set (TRUE), E_SRwill be activated. If EN is reset (FALSE), the variable’s condition isfrozen until EN is set again (see time chart). ENO will adopt thestatus of EN. Therefore, you can connect further functionblocks/functions to ENO which are controlled by the status of EN.

� Time Chart

EN

SET

RESET

Q

� Example E_SR

If the same variables are used for programming as described under SR ,the program for E_SR would be designed as follows:

POU HeaderIn the POU Header the input enable is declared additionally.

Page 251: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

10 – 6

Matsushita Electric Works (Europe) AG

Bistable Function Blocks

LD BodyIf enable is set, E_SR will be as described for SR. The condition will befrozen, if enable is reset, as shown in the above time chart. As soon enable is set E_SR will continue working in the previous status.

You can now connect a further function block to ENO which will be acti-vated only, if EN is set by this E_SR (TRUE).

IL Body

The status of enable is loaded in the IL, and copy_name.EN is assignedto it. The nomination copy_name.EN or copy_name.PT etc. has to bemaintained in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 252: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

10 – 7Matsushita Electric Works (Europe) AG

Bistable Function Blocks

Outline The function block RS (reset/set) or E_RS allows you to both resetand set an output. For the RS you declare the following:SET: set

The output Q is set for each rising edge at SET, ifRESET is not set.

RESET: resetThe output Q is reset for each rising edge at RESET.

Q: signal outputis set, if a rising edge is detected at SET and if RESETis not set; is reset, if a rising edge is detected at RESET.

� Data Types

Input Variable Output Variable

BOOL (SET and RESET) BOOL (Q)

�Note

Q is reset if a rising edge is detected at both inputs.

� Time Chart

SET

Q

RESET

(E_)RS

Page 253: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

10 – 8

Matsushita Electric Works (Europe) AG

Bistable Function Blocks

� Example RS

In the following example, the function block RS is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU HeaderAll input and output variables which are used for programming the func-tion block RS are declared in the POU header. This also includes thefunction block (FB) itself. By declaring the FB you create a copy of theoriginal FB. This copy is saved under copy_name, and a separate dataarea is reserved.

LD BodyIf set is set (status = TRUE) the signal_output will be set. If only reset isset, the signal_output will be reset (status = FALSE). If both set and resetare set, the signal_output will be reset to FALSE.

IL BodyIf you wish to call up RS: copy_name instruction list, you enter the follo-wing:

The nomination copy_name.SET or copy_name.RESET etc. has to bemaintained in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

Page 254: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

10 – 9Matsushita Electric Works (Europe) AG

Bistable Function Blocks

Outline Anything stated for RS also applies to E_RS. The function blockE_RS has in addition an enable input (EN) and an enable output(ENO) of the data type BOOL. If EN is set (TRUE), E_RS will beactivated. If EN is not set (FALSE), the status of the output variablewill remain unchanged until EN is set. ENO will adopt the status ofEN. Therefore, you can connect further function blocks/functions toENO which are controlled by the condition of EN.

� Time Chart

EN

SET

RESET

Q

� Example E_RS

If the same variables are used for programming as described under RS,the program would be designed as follows:

POU HeaderIn the POU header the input enable is additionally declared.

Page 255: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

10 – 10

Matsushita Electric Works (Europe) AG

Bistable Function Blocks

LD BodyIf enable is set, E_RS will be as described under RS. If enable is reset,as shown in the above time chart, the condition will be frozen. As soon asenable is set again, E_SR continues working in the previous status.

You can now connect a further function block with ENO which will be acti-vated only if EN is set by this E_RS (TRUE).

IL Body

The status of enable is loaded in the IL and assigned to copy_name.EN.

The nomination copy_name.EN or copy_name.PT etc. has to be maintai-ned in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 256: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 11

Edge Detection

(E_)R_TRIG 11 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)F_TRIG 11 – 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 257: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

11 – 2

Matsushita Electric Works (Europe) AG

Edge Detection

Page 258: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

11 – 3Matsushita Electric Works (Europe) AG

Edge Detection

Outline The function block R_TRIG (rising edge trigger) or E_R_TRIG allowsyou to recognize a rising edge at an input. For R_TRIG declare thefollowing:CLK: signal input

the output Q is set for each rising edge at the signalinput (clk = clock)

Q: signal outputis set when a rising edge is detected at CLK.

� Data Types

Input Variable Output Variable

BOOL (CLK) BOOL (Q)

�Note

The output Q of a function block (E_)R_TRIG remains set fora complete PLC cycle after the occurrence of a rising edge(status change FALSE –> TRUE) at the CLK input and is thenreset in the following cycle.

(E_)R_TRIG

Page 259: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

11 – 4

Matsushita Electric Works (Europe) AG

Edge Detection

� Example R_TRIG

In the following example, the function block R_TRIG is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU HeaderAll input and output variables which are used for programming the func-tion block R_TRIG are declared in the POU header. This also includesthe function block (FB) itself. By declaring the FB you create a copy ofthe original FB. This copy is saved under copy_name, and a separatedata area is reserved.

LD Bodysignal_output will be set, if a rising edge is detected at signal_input.

IL BodyIf you wish to call up R_TRIG: copy_name instruction list, enter the follo-wing:

The nomination copy_name.CLK or copy_name.Q has to be maintainedin the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

Page 260: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

11 – 5Matsushita Electric Works (Europe) AG

Edge Detection

Outline Anything stated for R_TRIG also applies to E_R_TRIG. The functionblock E_R_TRIG has in addition an enable input (EN) and an enableoutput (ENO) of the data type BOOL. If EN is set (TRUE), E_R_TRIGwill be activated. If EN is not set (FALSE), the status of the outputvariable will remain unchanged until EN is set. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions to ENO which are controlled by the condition of EN.

� Example E_R_TRIG

If the same variables are used for programming as described underR_TRIG, the program for E_R_TRIG would be designed as follows:

POU Header

In the POU Header the input enable is declared additionally.

LD Body

If enable is set, E_R_TRIG will be as described for R_TRIG.

If enable is reset, the status will be frozen. As soon as enable is setagain, E_R_TRIG continuous working in the previous status (see timechart).

You may now connect a further function block with ENO which will beactivated only, if the EN of this E_R_TRIG is set (TRUE).

IL Body

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 261: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

11 – 6

Matsushita Electric Works (Europe) AG

Edge Detection

Outline The function block F_TRIG (falling edge trigger) or E_F_TRIG allowsyou to recognize a falling edge at an input. For F_TRIG declare thefollowing:CLK: signal input

the output Q is set for each falling edge at the signalinput (clk = clock)

Q: signal outputis set, if a falling edge is detected at CLK.

� Data Types

Input Variable Output Variable

BOOL (CLK) BOOL (Q)

�Note

The output Q of a function block (E_)F_TRIG remains set for acomplete PLC cycle after the occurrence of a rising edge(status change FALSE –> TRUE) at the CLK input and is thenreset in the following cycle.

� next page

(E_)F_TRIG

Page 262: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

11 – 7Matsushita Electric Works (Europe) AG

Edge Detection

� Example F_TRIG

In the following example, the function block F_TRIG is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU Header

All input and output variables which are used for programming the func-tion block F_TRIG are declared in the POU header. This also includesthe function block (FB) itself. By declaring the FB you create a copy ofthe original FB. This copy is saved under copy_name, and a separatedata area is reserved.

LD Body

signal_output will be set, if a falling edge is detected at signal_input.

IL Body

If you want to call the F_TRIG: copy_name in an instruction list, enter thefollowing:

The nomination copy_name.CLK or copy_name.Q has to be continued inthe IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 263: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

11 – 8

Matsushita Electric Works (Europe) AG

Edge Detection

Outline Anything stated for F_TRIG also applies to E_F_TRIG. The functionblock E_F_TRIG has in addition an enable input (EN) and an enableoutput (ENO) of the data type BOOL. If EN is set (TRUE), E_F_TRIGwill be activated. If EN is not set (FALSE), the status of the outputvariable will remain unchanged until EN is set. ENO will adopt thestatus of EN. Therefore, you can connect further functionblocks/functions to ENO which are controlled by the status of EN.

� Example E_F_TRIG

If the same variables are used for programming as described underF_TRIG, the program for E_R_TRIG would be designed as follows:

POU Header

In the POU Header the input enable is declared additionally.

LD Body

If enable is set, E_F_TRIG will be as described for F_TRIG.

If enable is reset, the status will be frozen. As soon as enable is setagain, E_F_TRIG continuous working in the previous state (see timechart). You may now connect a further function block with ENO which willbe activated only, if the EN of this E_F_TRIG is set (TRUE).

IL Body

The status of enable is loaded in the IL and assigned to copy_name.EN.The nomination copy_name.EN or PT etc. has to be maintained in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 264: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 12

Counter

(E_)CTU 12 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)CTD 12 – 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)CTUD 12 – 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 265: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

12 – 2

Matsushita Electric Works (Europe) AG

Counter

Page 266: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

12 – 3Matsushita Electric Works (Europe) AG

Counter

Outline The function block CTU (count up) or E_CTU allows you to programcounting procedures. For CTU declare the following:

CU: clock generatorthe value 1 is added to CV for each rising edge at CU,except RESET is set

RESET: resetCV is reset to zero for each rising edge at RESET

PV: set valueif PV (preset value) is reached, Q is set

Q: signal outputis set, if CV is greater than/equal to PV

CV: current valuecontains the addition result (CV = current value)

� Data Types

Input Variable Output Variable

BOOL (CV and RESET) BOOL (Q)

INT (PV) INT (CV)

� Time Chart

CU

Q

RESET

CV

PV

� Example CTU

In the following example, the function block CTU is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

(E_)CTU

Page 267: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

12 – 4

Matsushita Electric Works (Europe) AG

Counter

POU Header

All input and output variables which are used for programming the func-tion block CTU are declared in the POU header. This also includes thefunction block (FB) itself. By declaring the FB you create a copy of theoriginal FB. This copy is saved under copy_name. A separate data areais reserved for this copy.

LD Body

If reset is set (status = TRUE), current_value (CV) will be reset. If a risingedge is detected at clock, the value 1 will be added to current_value. If arising edge is detected at clock, this procedure will be repeated until current_value is greater than/equal to set_value. Then, signal_output willbe set.

IL Body

The nomination coyp name.CU or copy_name.RESET etc. has to bemaintained in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

Page 268: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

12 – 5Matsushita Electric Works (Europe) AG

Counter

Outline Anything stated under CTU also applies to E_CTU. The functionblock E_CTU has in addition an enable input (EN) and an enableoutput (ENO) of the data type BOOL. If EN is set (TRUE), E_CTU willbe activated. If EN is not set (FALSE), the status of the outputvariable will remain unchanged until EN is set (see time chart). ENOwill adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions to ENO which are controlled by the statusof EN.

� Time Chart

EN

CU

Q

RESET

CV

PV

� Example E_CTU

If the same variables are used for programming as described under CTU,the program for E_CTU would be designed as follows:

POU Header

In the POU Header the input enable is additionally declared.

Page 269: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

12 – 6

Matsushita Electric Works (Europe) AG

Counter

LD Body

If enable is set, E_CTU will be as described for CTU.

If enable is reset, as shown in the above time chart, the condition will befrozen and CU ignored. As soon as enable is set, E_CTU continues wor-king with the previous status.

You may now connect a further function block with ENO which will beactivated only, if the EN of this E_CTU is set (TRUE).

IL Body

The status of enable is loaded in the IL and assigned to copy_name.EN.The nomination copy_name.EN or copy_name.PT etc.has to be main-tained in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 270: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

12 – 7Matsushita Electric Works (Europe) AG

Counter

Outline The function block CTD (count down) or E_CTD allows you toprogram counting procedures. For CTD declare the following:CD: clock generator input

the value 1 is subtracted from the current value CV foreach rising edge detected at CD, except LOAD is set orCV has reached the value zero.

LOAD: setwith LOAD the counter state is reset to PV

PV: preset valueis the value subjected to subtraction during the firstcounting procedure

Q: signal outputis set if CV = zero

CV: current valuecontains the current subtraction result (CV = currentvalue)

� Data types

Input Variable Output Variable

BOOL (CD and LOAD) BOOL (Q)

INT (PV) INT (CV)

� Time Chart

CU

LOAD

CV

PV

Q

(E_)CTD

Page 271: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

12 – 8

Matsushita Electric Works (Europe) AG

Counter

� Example CTD

In the following example the function block CTD is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU Header

All input and output variables which are used for programming the func-tion block CTD are declared in the POU header. This also includes thefunction block (FB) itself. By declaring the FB you create a copy of theoriginal FB. This copy is saved under copy_name, and a separate dataarea is reserved.

LD Body

If set is set (status = TRUE), the preset_value (PV) is loaded in the current_value (CV). The value 1 will be subtracted from the current_valueeach time a rising edge is detected at clock. This procedure will be re-peated until the current_value is greater than/equal to zero. Then, signal_output will be set.

� next page

Page 272: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

12 – 9Matsushita Electric Works (Europe) AG

Counter

IL Body

If you want to call up the CTD: copy_name in an instruction list, enter thefollowing:

The nomination copy_name.CD or copy_name.LOAD etc. has to bemaintained in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 273: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

12 – 10

Matsushita Electric Works (Europe) AG

Counter

Outline Anything stated under CTD also applies to E_CTD. The functionblock E_CTD has in addition an enable input (EN) and an enableoutput (ENO) of the data type BOOL. If EN is set (TRUE), E_CTD willbe activated. If EN is not set (FALSE), the status of the outputvariable will remain unchanged until EN is set (see time chart). ENOwill adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions to ENO which are controlled by thecondition of EN.

� Time Chart

CD

EN

LOAD

Q

PV

� Example E_CTD

If the same variables are used for programming as described under CTDthe program for E_CTD would be designed as follows:

POU Header

In the POU Header the input enable is additionally declared.

� next page

Page 274: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

12 – 11Matsushita Electric Works (Europe) AG

Counter

LD Body

If enable is set, E_CTD will be as described for CTD.

If enable is reset, as shown in the above time chart, the status will befrozen and CD ignored. As soon as enable is set again, E_CTD continu-ous working with the previous counter state.

You may now connect a further function block with ENO which will beactivated only if the EN of this E_CTD is set (TRUE).

IL Body

The status of enable is loaded in the IL and assigned to copy_name.EN.The nomination copy_name.EN or copy_name.PT etc.has to be maintai-ned in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 275: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

12 – 12

Matsushita Electric Works (Europe) AG

Counter

Outline The function block CTUD (count up/down) or E_CTUD allows you toprogram counting procedures (up and down). For CTUD declare thefollowing:CU: count up

the value 1 is added to the current CV for each risingedge detected at CU, except RESET and/or LOADis/are set.

CD: count downthe value 1 is subtracted from the current CV for eachrising edge detected at CD, except RESET and/orLOAD is/are set and if CU and CD are simultaneouslyset. In the latter case counting will be upwards.

RESET: resetif RESET is set, CV will be reset

LOAD: setif LOAD is set, PV is loaded to CV. This, however, doesnot apply, if RESET is set simultaneously. In this case,LOAD will be ignored.

PV: preset valuedefines the preset value which is to be attained with theaddition or subtraction (PV = preset value)

QU: signal output – count upis set, if CV is greater than/equal to PV

QD: signal output – count downis set, if CV = zero

CV: current valueis the addition/subtraction result (CV = current value)

� Data Types

Input Variable Output Variable

BOOL (CU, CD, RESET, LOAD) BOOL (QU and QD)

INT (PV) INT (CV)

� next page

(E_)CTUD

Page 276: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

12 – 13Matsushita Electric Works (Europe) AG

Counter

� Time Chart

CU

CD

RESET

LOAD

QU

QDCV

PV

� Example CTUD

In the following example, the function block CTUD is programmed in lad-der diagram (LD) and instruction list (IL). The same POU header is usedfor both programming languages.

POU Header

All input and output variables which are used for programming the func-tion block CTUD are declared in the POU header. This also includes thefunction block (FB) itself. By declaring the FB you create a copy of theoriginal FB. This copy is saved under copy_name. A separate data areais reserved for this copy.

Page 277: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

12 – 14

Matsushita Electric Works (Europe) AG

Counter

LD Body

Count up:If reset is set, the current_value (CV) will be reset. If up_clock is set, thevalue 1 is added to the current_value. This procedure is repeated foreach rising edge detected at up_clock until the current value is greaterthan/equal to the set_value. Then output_up is set. The procedure is notconducted, if reset and/or set is/are set.

Count down:If set is set (status = TRUE), the set_value (PV = preset value) will beloaded in the current_value (CV). If down_clock is set, the value 1 is sub-tracted from set_value at each clock. This procedure is repeated at eachclock until the current_value is smaller than/equal to zero. Then, signal_output is set. The procedure will not be conducted, if reset and/orset is/are set or if CU and CV are set at the same time. In the latter case,counting will be downwards.

IL Body

If you want to call the CTD: copy_name in an instruction list, enter thefollowing:

The nomination copy_name.CU or copy_name.RESET etc. has to bemaintained in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

� next page

Page 278: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

12 – 15Matsushita Electric Works (Europe) AG

Counter

Outline Anything stated under CTUD also applies to E_CTUD. The functionblock E_CTUD has in addition an enable input (EN) and an enableoutput (ENO) of the data type BOOL. If EN is set (TRUE), E_CTUDwill be activated. If EN is not set (FALSE), the status of the outputvariable will remain unchanged until EN is set (see time chart). ENOwill adopt the status of EN. Therefore, you may connect furtherfunction blocks/functions to ENO which are controlled by thecondition of EN.

� Time Chart

EN

CU

CD

RESET

LOAD

QU

QD

CV

PV

� Example E_CTUD

If the same variables are used for programming as described underCTUD the program for E_CTUD would be designed as follows.

Page 279: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

12 – 16

Matsushita Electric Works (Europe) AG

Counter

POU Header

In the POU Header the input enable is declared additionally.

LD Body

If enable is set, E_CTUD will be as described under CTUD.

If enable is reset, as shown in the time chart, the status will be frozenand CU/CD ignored. As soon as enable is set again, E_CTUD continuesworking with the previous counter state. You may now connect a furtherfunction block with ENO which will be activated only, if the EN of thisE_CTUD is set (TRUE).

IL Body

The status of enable is loaded in the IL and assigned to copy_name.EN.The nomination copy_name.EN or copy_name.PT etc.has to be maintai-ned in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 280: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 13

Timer

(E_)TP 13 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TON 13 – 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(E_)TOF 13 – 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 281: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

13 – 2

Matsushita Electric Works (Europe) AG

Timer

Page 282: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

13 – 3Matsushita Electric Works (Europe) AG

Timer

Outline The function block TP or E_TP allows you to program a clock timerwith a defined clock period. For TP declare the following:IN: clock generator

if a rising edge is detected at IN, a clock is generatedhaving the period as defined in PT

PT: clock period(16–bit value: 0 – 327.27s, 32–bit value:0 –21,474,836.47s; resolution 10ms each) a clockhaving the period PT is caused for each rising edge atIN. A new rising edge detected at PT within the pulseperiod does not cause a new clock (see time chart,section C)

Q: signal output is set for the period of PT as soon as a rising edge isdetected at IN

ET: current valuecontains the elapsed clock period. If PT = ET, Q will bereset

� Data Types

Input Variable Output Variable

BOOL (IN) BOOL (Q)

TIME (PT) TIME (ET)

(E_)TP

Page 283: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

13 – 4

Matsushita Electric Works (Europe) AG

Timer

� Time Chart TP

t0 t1 + PT t2 t3 t4 t4 + PT

t0 t1 + PT t2 t2 + PT t4 t4 + PT

t0 t1 t2 t3 t4 t5 t6 t7IN

Q

ET

PT

A B C

ÉÉÉÉÉÉÉÉ

ÉÉÉÉÉÉÉÉ

ÉÉÉÉÉÉ

t

A + B) Independent of the turn–on period of the IN signal, a clock is generatedat the output Q having a length defined by PT. The function block TP isstarted (triggered), if a rising edge is detected at the input IN.

C) A rising edge at the input IN does not have any influence during the pro-cessing of PT.

� Time Chart E_TP

ÉÉÉÉÉÉ

IN

Q

ET

PT

A B C

ÉÉÉÉÉÉ

ÉÉÉÉ

ÉÉÉÉÉÉ

EN

t0 t0 + PT t2 t2 + PT t4 t4 + PT t5

t6

t0 t1 t2 t3 t4 t5

t0 t0 + PT t2 t3 t4 t4 + PT t5 t6

� next page

Page 284: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

13 – 5Matsushita Electric Works (Europe) AG

Timer

� Example TP

In the following example the function block TP is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU Header

All input and output variables which are used for programming the func-tion block TP are declared in the POU header. This also includes thefunction block (FB) itself. By declaring the FB you create a copy of theoriginal FB. This copy is saved under copy_name. A separate data areais reserved for this copy.

LD Body

If start is set (status = TRUE), the clock is emitted at signal_output untilthe set_value for the clock period is reached.

IL Body

If you want to call TP: copy_name in an instruction list, enter the follo-wing:

The nomination copy_name.IN or copy_name.ET etc. has to be maintained in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 285: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

13 – 6

Matsushita Electric Works (Europe) AG

Timer

Outline Anything stated under TP also applies to E_TP. The function blockE_TP has in addition an enable input (EN) and an enable output(ENO) of the data type BOOL. If EN is set (TRUE), E_TP will beactivated. If EN is not set (FALSE), the status of the output variablewill remain unchanged until EN is set. ENO will adopt the status ofEN. Therefore, you can connect further function blocks/functions toENO which are controlled by the status of EN.

� Example E_TP

If the same variables are used for programming as described under TP,the program for E_TP would be designed as follows:

POU Header

In the POU Header the input enable is declared additionally.

LD Body

If enable is set, E_TP will be as described for TP.

If enable is reset, the status will be frozen and the start signal IN will beignored. As soon as enable is set again, E_TP continues processing.

You may now connect a further function block with ENO which will beactivated only if the EN of this E_TP is set (TRUE).

� next page

Page 286: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

13 – 7Matsushita Electric Works (Europe) AG

Timer

IL Body

The status of enable is loaded in the IL and assigned to copy_name.EN.The nomination copy_name.EN or copy_name.PT etc. has to be maintai-ned in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 287: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

13 – 8

Matsushita Electric Works (Europe) AG

Timer

Outline The function block TON or E_TON allows you to program a switchon delay as is demonstrated in our Start–Up Manual ”First Steps”.For TON declare the following:IN: timerON

an internal timer is started for each rising edge detectedat IN

PT: switch on delay(16–bit value: 0 – 327.27s, 32–bit value: 0 –21,474,836.47s; resolution 10ms each) the desiredswitch on delay is defined here(PT = preset time)

Q: signal outputis set if PT = ET

ET: current valueis the actually elapsed time (ET = elapsed time)

� Data Types

Input Variable Output Variable

BOOL (IN) BOOL (Q)

TIME (PT) ITIME (ET)

�Note

This function is not available for FP1–C14/C16/C24/C40 andFP5 (version 1.0 to 1.9).

� next page

(E_)TON

Page 288: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

13 – 9Matsushita Electric Works (Europe) AG

Timer

� Time Chart TON

ÉÉÉÉÉÉÉÉÉÉ

IN

Q

ET

PT

A B

ÉÉÉÉÉÉ

t0 t1 t2 t3

t0 t0 + PT t1 t2 t3

t0 t1 t2 t3

t

A)Q is set delayed with the time defined in PT. Resetting is without anydelay.

B)If the input IN is only set for the period of the delay time PT or evenfor a shorter period of time (t3 – t2 < PT), Q will not be set.

� Time Chart E_TON

t0 t0+PT t1 t4 t4+PT t5 t6 t6 + PT

ÉÉÉÉÉÉ

ÉÉÉÉ

IN

Q

ET

PT

A B

ÉÉÉÉÉÉ

ÉÉÉÉ

t0 t1 t2 t3 t4 t5 t6

t0 t1 t2 t3 t4 t5 t6

t

EN

Page 289: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

13 – 10

Matsushita Electric Works (Europe) AG

Timer

� Example TON

In the following example the function block TON is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU Header

All input and output variables which are used for programming the func-tion block TON are declared in the POU header. This also includes thefunction block (FB) itself. By declaring the FB you create a copy of theoriginal FB. This copy is saved under copy_name. A separate data areais reserved for this copy.

LD Body

If start is set (status = TRUE), the input signal is transferred to signal_output with a delay by the time period set_value.

IL Body

If you want to call the TON: copy_name in an instruction list, enter thefollowing:|

The nomination copy_name.IN or copy_name.ET etc. has to be main-tained in the IL.

�Note

It is not important whether the function names in the IL editorare capitalized or not.

� next page

Page 290: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

13 – 11Matsushita Electric Works (Europe) AG

Timer

Outline Anything stated under TON also applies to E_TON. The functionblock E_TON has in addition an enable input (EN) and an enableoutput (ENO) of the data type BOOL. If EN is set (TRUE), E_TONwill be activated. If EN is not set (FALSE), the status of the outputvariable will remain unchanged until EN is set. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions to ENO which are controlled by the status of EN.

� Example E_TON

If the same variables are used for programming as described under TONthe program for E_TON would be designed as follows:

POU Header

In the POU Header the input enable is declared additionally.

LD Body

If enable is set, E_TON will be as described for TON.

If enable is reset, the status will be frozen and the start signal at IN willbe ignored. As soon as enable is set again, E_TON continues working.

You may now connect a further function block with ENO which will beactivated only if the EN of this E_TON is set (TRUE).

Page 291: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

13 – 12

Matsushita Electric Works (Europe) AG

Timer

IL Body

The status of enable is loaded in the IL and assigned to copy_name.EN.The nomination copy_name.EN or copy_name.PT etc. has to be maintai-ned in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 292: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

13 – 13Matsushita Electric Works (Europe) AG

Timer

Outline The function block TOF or E_TOF allows you to program a switch offdelay, e.g. to switch off the ventilator of a machine at a later point oftime than the machine itself. For TON declare the following:IN: timerON

an internal time measuring device is started, if a fallingedge is detected at IN. If a rising edge is detected at INbefore PT has reached its value, Q will not be switchedoff (see time chart, section B)

PT: switch–off delay (16–bit value: 0 – 327.27s, 32–bit value: 0 –21,474,836.47s; resolution 10ms each) the intendedswitch–off delay is defined here (PT = preset time)

Q: signal output is reset, if PT = ET

ET: current valuerepresents the actually elapsed time (ET = elapsedtime)

� Data Types

Input Variable Output Variable

BOOL (IN) BOOL (Q)

TIME (PT) TIME (ET)

�Note

This function is not available for FP1–C14/C16/C24/C40 andFP5 (version 1.0 to 1.9).

(E_)TOF

Page 293: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

13 – 14

Matsushita Electric Works (Europe) AG

Timer

� Time Chart TOF

t0 t1 + PT t2 t5 + PT

t0 t1 t2 t3 t4 t5IN

Q

ET

PT

A B

ÉÉÉÉÉÉÉÉ

ÉÉÉÉ

ÉÉÉÉÉÉÉÉ

t0 t1 t2 t3 t4 t5

A)Q is switched off with a delay corresponding to the time defined inPT. Switching on is carried out without delay.

B)If IN (as in the time chart on top for t3 to t4) is set prior to the lapseof the delay time PT, Q remains set (time chart for t2 to t3).

� Time Chart E_TOF

ÉÉÉÉ

IN

Q

ET

PT

ÉÉÉÉ

ÉÉÉÉ

ÉÉÉÉÉÉ

ÉÉÉÉ

EN

t0 t1 + PT t2 t5 + PT t6 t7 + PT t8

t0 t1 t2 t3 t4 t5 t6

t7 t8

t0 t1 t2 t3 t4 t5 t6 t7

� next page

Page 294: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

13 – 15Matsushita Electric Works (Europe) AG

Timer

� Example TOF

In the following example, the function block TOF is programmed in ladderdiagram (LD) and instruction list (IL). The same POU header is used forboth programming languages.

POU Header

All input and output variables which are used for programming the func-tion block TOF are declared in the POU header. This also includes thefunction block (FB) itself. By declaring the FB you create a copy of theoriginal FB. This copy is saved under copy_name. A separate data areais reserved for this copy.

LD Body

If start is set, this signal is transferred to signal_output with a delay cor-responding to the period of time set_value.

IL Body

If you want to call the TOF: copy_name in an instruction list, enter thefollowing:

The nomination copy_name.IN or copy_name.ET etc. has to be maintained in the IL.

�Note

It is not important whether the function names in the IL editorare capitalized or not.

Page 295: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

13 – 16

Matsushita Electric Works (Europe) AG

Timer

Outline Anything stated under TOF also applies to E_TOF. The functionblock E_TOF has in addition an enable input (EN) and an enableoutput (ENO) of the data type BOOL. If EN is set (TRUE), E_TOF willbe activated. If EN is not set (FALSE), the status of the outputvariable will remain unchanged until EN is set. ENO will adopt thestatus of EN. Therefore, you may connect further functionblocks/functions to ENO which are controlled by the condition of EN.

� Example E_TOF

If the same variables are used for programming as described under TOFthe program for E_TOF would be designed as follows:

POU Header

In the POU Header the input enable is declared additionally.

LD Body

If enable is set, E_TOF will be as described for TOF.

If enable is reset, the status will be frozen and CD ignored. As soon asenable is set again, E_TOF continues working.

You may now connect a further function block with ENO which will beactivated only if the EN of this E_TOF is set (TRUE).

� next page

Page 296: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function BlocksNAiS Control 1131

13 – 17Matsushita Electric Works (Europe) AG

Timer

IL Body

The status of enable is loaded in the IL and assigned to copy_name.EN.The nomination copy_name.EN or copy_name.PT etc. has to be maintained in the IL.

�Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 297: Nais Control 1131 FP0-FP1-FPM Instruction Set

IEC Function Blocks NAiS Control 1131

13 – 18

Matsushita Electric Works (Europe) AG

Timer

Page 298: Nais Control 1131 FP0-FP1-FPM Instruction Set

Part 4Matsushita Instructions

Page 299: Nais Control 1131 FP0-FP1-FPM Instruction Set
Page 300: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 14

Matsushita Instructions

CT, Down Counter 14 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . . .

DF, Leading Edge Differential 14 – 10. . . . . . . . . . . . . . . . . .

DFN, Trailing Edge Diffential 14 – 11. . . . . . . . . . . . . . . . . . .

ICTL, Interrupt Control 14 – 12. . . . . . . . . . . . . . . . . . . . . . . .

JP, Jump to label 14 – 14. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

KEEP, Serves as a relay with set and reset inputs 14 – 15

LBL, Label for the JP and LOOP Instruction 14 – 16. . . . .

LOOP, Loop to Label 14 – 17. . . . . . . . . . . . . . . . . . . . . . . . .

LSR, Left shift register 14 – 18. . . . . . . . . . . . . . . . . . . . . . . .

MC, Master Control relay 14 – 19. . . . . . . . . . . . . . . . . . . . . .

MCE, Master Conrol Relay End 14 – 20. . . . . . . . . . . . . . . .

TM_1ms, On Delay Timer for 0.001s Units 14 – 21. . . . . .

TM_10ms, On Delay Timer for 0.01s Units 14 – 23. . . . . .

TM_100ms, On Delay Timer for 0.1s Units 14 – 25. . . . . .

TM_1s, On Delay Timer for 1s Units 14 – 27. . . . . . . . . . . .

F0 (MV), 16–bit data move 14 – 29. . . . . . . . . . . . . . . . . . . .

F1 (DMV) 32–bit data move 14 – 30. . . . . . . . . . . . . . . . . . .

F2 (MVN) 16–bit data inversions and move 14 – 31. . . . . .

F3 (DMVN) 32–bit data inversions and move 14 – 32. . . .

F5 (BTM) Bit data move 14 – 33. . . . . . . . . . . . . . . . . . . . . . .

F6 (DGT) Digit data move 14 – 34. . . . . . . . . . . . . . . . . . . . .

F10 (BKMV) Block transfer 14 – 35. . . . . . . . . . . . . . . . . . . .

F11 (COPY) Block copy 14 – 36. . . . . . . . . . . . . . . . . . . . . . .

Page 301: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 2

Matsushita Electric Works (Europe) AG

F12 EPRD EEPROM read from memory 14 – 37. . . . . . . .

P13 EPWT EEPROM write to memory 14 – 39. . . . . . . . . .

F15 (XCH) 16–bit data exchange 14 – 42. . . . . . . . . . . . . .

F16 (DXCH) 32–bit data exchange 14 – 43. . . . . . . . . . . . .

F17 (SWAP) Higher/lower byte in 16–bit data exchange 14 – 44. . . . . . . . . . . . . . . . . . . . . . . . .

F20 (ADD) 16–bit addition 14 – 45. . . . . . . . . . . . . . . . . . . . .

F21 (DADD) 32–bit addition 14 – 46. . . . . . . . . . . . . . . . . . .

F22 (ADD2) 16–bit addition, destination can be specified 14 – 47. . . . . . . . . . . . . . . . . . . . . . . .

F23 (DADD2) 32–bit addition, destination can be specified 14 – 48. . . . . . . . . . . . . . . . . . . . . . . .

F25 (SUB) 16–bit subtraction 14 – 49. . . . . . . . . . . . . . . . . .

F26 (DSUB) 32–bit subtraction 14 – 50. . . . . . . . . . . . . . . .

F27 (SUB2) 16–bit subtraction, destination can be specified 14 – 51. . . . . . . . . . . . . . . . . . . . . . . .

F28 (DSUB2) 32–bit subtraction, destination can be specified 14 – 52. . . . . . . . . . . . . . . . . . . . . . . .

F30 (MUL) 16–bit multiplication, destination can be specified 14 – 53. . . . . . . . . . . . . . . . . . . . . . . .

F31 (DMUL) 32–bit multiplication, destination can be specified 14 – 54. . . . . . . . . . . . . . . . . . . . . . . .

F32 (DIV) 16–bit division, destination can be specified 14 – 55. . . . . . . . . . . . . . . . . . . . . . . .

F33 (DDIV) 32–bit division, destination can be specified 14 – 56. . . . . . . . . . . . . . . . . . . . . . . .

F35 (INC) 16–bit increment 14 – 57. . . . . . . . . . . . . . . . . . . .

F36 (DINC) 32–bit increment 14 – 58. . . . . . . . . . . . . . . . . .

F37 (DEC) 16–bit decrement 14 – 59. . . . . . . . . . . . . . . . . .

F38 (DDEC) 32–bit decrement 14 – 60. . . . . . . . . . . . . . . . .

F40 (BADD) 4–digit BCD addition 14 – 61. . . . . . . . . . . . . .

Page 302: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 3Matsushita Electric Works (Europe) AG

F41 (DBADD) 8–digit BCD addition 14 – 62. . . . . . . . . . . . .

F42 (BADD2) 4–digit BCD addition, destination can bespecified 14 – 63. . . . . . . . . . . . . . . . . . . . . . . . .

F43 (DBADD2) 8–digit BCD addition, destination can be specified 14 – 64. . . . . . . . . . . . . . . . . . . . . . . .

F45 (BSUB) 4–digit BCD subtraction 14 – 65. . . . . . . . . . .

F46 (DBSUB) 8–digit BCD subtraction 14 – 66. . . . . . . . . .

F47 (BSUB2) 4–digit BCD subtraction, destination can be specified 14 – 67. . . . . . . . . . . . . . . . . . . . . . . .

F48 (DBSUB2) 8–digit BCD subtraction, destination can be specified 14 – 68. . . . . . . . . . . . . . . . . . . . . . . .

F50 (BMUL) 4–digit BCD multiplication, destination can be specified 14 – 69. . . . . . . . . . . . . . . . . . . . . . . .

F51 (DBMUL) 8–digit BCD multiplication, destination can be specified 14 – 70. . . . . . . . . . . . . . . . . . . . . . . .

F52 (BDIV) 4–digit BCD division, destination can be specified 14 – 71. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F53 (DBDIV) 8–digit BCD division, destination can be specified 14 – 72. . . . . . . . . . . . . . . . . . . . . . . .

F55 (BINC) 4–digit BCD increment 14 – 73. . . . . . . . . . . . .

F56 (DBINC) 8–digit BCD increment 14 – 74. . . . . . . . . . . .

F57 (BDEC) 4–digit BCD decrement 14 – 75. . . . . . . . . . . .

F58 (DBDEC) 8–digit BCD decrement 14 – 76. . . . . . . . . .

F60 (CMP) 16–bit data compare 14 – 77. . . . . . . . . . . . . . .

F61 (DCMP) 32–bit data compare 14 – 78. . . . . . . . . . . . . .

F62 (WIN) 16–bit data band compare 14 – 79. . . . . . . . . . .

F63 (DWIN) 32–bit data band compare 14 – 80. . . . . . . . .

F64 (BCMP) Block data compare 14 – 81. . . . . . . . . . . . . .

F65 (WAN) 6–bit data AND 14 – 82. . . . . . . . . . . . . . . . . . . .

F66 (WOR) 16–bit data OR 14 – 83. . . . . . . . . . . . . . . . . . . .

Page 303: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 4

Matsushita Electric Works (Europe) AG

F67 (XOR) 16–bit data exclusive OR 14 – 84. . . . . . . . . . .

F68 (XNR) 16–bit data exclusive NOR 14 – 85. . . . . . . . . .

F70 (BCC) Block check code calculation 14 – 86. . . . . . . .

F71 (HEX2A) HEX � ASCII conversion 14 – 87. . . . . . . . .

F72 (A2HEX) ASCII � HEX conversion 14 – 88. . . . . . . . .

F73 (BCD2A) BCD � ASCII conversion 14 – 89. . . . . . . .

F74 (A2BCD) ASCII � BCD conversion 14 – 90. . . . . . . .

F75 (BIN2A) 16–bit BIN � ASCII conversion 14 – 92. . . .

F76 (A2BIN) ASCII � 16–bit BIN conversion 14 – 93. . . .

F77 (DBIN2A) 32–bit BIN � ASCII conversion 14 – 94. . .

F78 (DA2BIN) ASCII � 32–bit BIN conversion 14 – 95. . .

F80 (BCD) 16–bit BIN � 4–digit BCD conversion 14 – 96

F81 (BIN) 4–digit BCD � 16–bit BIN conversion 14 – 97.

F82 (BCD) 32–bit BIN � 8–digit BCD conversion 14 – 98

F83 (DBIN) 8–digit BCD � 32–bit BIN conversion 14 – 99

F84 (INV) 16–bit data invert (one’s complement) 14 – 100

F85 (NEG) 16–bit data two’s complement 14 – 101. . . . . .

F86 (DNEG) 32–bit data two’s complement 14 – 102. . . . .

F87 (ABS) 16–bit data absolute value 14 – 103. . . . . . . . .

F88 (DABS) 32–bit data absolute value 14 – 104. . . . . . . .

F89 (EXT) 16–bit data sign extension 14 – 105. . . . . . . . . .

F90 (DECO) Decode 14 – 106. . . . . . . . . . . . . . . . . . . . . . . .

F91 (SEGT) 16–bit data 7–segment decode 14 – 108. . . .

F92 (ENCO) Encode 14 – 110. . . . . . . . . . . . . . . . . . . . . . . .

F93 (UNIT) 16–bit data combine 14 – 111. . . . . . . . . . . . . .

F94 (DIST) 16–bit data distribution 14 – 113. . . . . . . . . . . .

F95 (ASC) Character � ASCII transfer 14 – 116. . . . . . . .

Page 304: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 5Matsushita Electric Works (Europe) AG

F96 (SRC) Table data search (16–bit search) 14 – 117. . .

F100 (SHR) Right shift of 16–bit data in bit units 14 – 118

F101 (SHL) Left shift of 16–bit data in bit units 14 – 119. .

F105 (BSR) Right shift of one hexadecimal digit (4 bits) of 16–bit data 14 – 120. . . . . . . . . . . . . . . . . . .

F106 (BSL) Left shift of one hexadecimal digit (4 bits) of 16–bit data 14 – 121. . . . . . . . . . . . . . . . . . .

F110 (WSHR) Right shift of one word (16 bits) of 16–bit data range 14 – 122. . . . . . . . . . . . . . . . . . .

F111 (WSHL) Left shift of one word (16 bits) of 16–bit data range 14 – 123. . . . . . . . . . . . . . . . . . . .

F112 (WBSR) Right shift of one hex. digit (4 bits) of 16–bit data range 14 – 124. . . . . . . . . . . . . . . . . . . .

F113 (WBSL) Left shift of one hex. digit (4 bits) of 16–bit data range 14 – 125. . . . . . . . . . . . . . . . . . . .

F118 (UCD) Up/Down Counter 14 – 126. . . . . . . . . . . . . . . .

F119 (LRSR) LEFT/RIGHT shift register 14 – 127. . . . . . .

F120 (ROR) 16–bit data right rotate 14 – 129. . . . . . . . . . .

F121 (ROL) 16–bit data left rotate 14 – 130. . . . . . . . . . . . .

F122 (RCR) 16–bit data right rotate with carry–flag data 14 – 131. . . . . . . . . . . . . . . . . . . . . . . .

F123 (RCL) 16–bit data left rotate with carry–flag data 14 – 132. . . . . . . . . . . . . . . . . . . . . . . .

F130 (BTS) 16–bit data bit set 14 – 133. . . . . . . . . . . . . . . .

F131 (BTR) 16–bit data bit reset 14 – 134. . . . . . . . . . . . . .

F132 (BTI) 16–bit data bit invert 14 – 135. . . . . . . . . . . . . . .

F133 (BTT) 16–bit data test 14 – 136. . . . . . . . . . . . . . . . . .

F135 (BCU) Number of ON bits in 16–bit data 14 – 137. .

F136 (DBCU) Number of ON bits in 32–bit data 14 – 138.

F137 (STMR) Auxiliary timer (sets the ON– delay timer for 0.01s units) 14 – 139.

Page 305: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 6

Matsushita Electric Works (Europe) AG

F138 (HMSS) h:min:s � s conversion 14 – 140. . . . . . . . .

F139 (SHMS) s � h:min:s conversion 14 – 141. . . . . . . . .

F140 (STC) Carry–flag set 14 – 142. . . . . . . . . . . . . . . . . . .

F141 (CLC) Carry–flag reset 14 – 143. . . . . . . . . . . . . . . . . .

F143 (IORF) Partial I/O update 14 – 144. . . . . . . . . . . . . . .

F144 (TRNS) Serial communication (RS232C) 14 – 145. .

F147 (PR) Parallel printout 14 – 147. . . . . . . . . . . . . . . . . . .

F148 (ERR) Self–diagnostic error set 14 – 148. . . . . . . . . .

F149 (MSG) Message display 14 – 149. . . . . . . . . . . . . . . .

F157 (CADD) Time addition 14 – 150. . . . . . . . . . . . . . . . . .

F158 (CSUB) Time subtraction 14 – 151. . . . . . . . . . . . . . .

F162 (HC0S) High–speed counter output set 14 – 153. . .

F163 (HC0R) High–speed counter output reset 14 – 154.

F164 (SPD0) Pulse output control; Pattern output control 14 – 155. . . . . . . . . . . . . . . . . .

F165 (CAM0) Cam control 14 – 156. . . . . . . . . . . . . . . . . . .

F166 (HC1S) Sets Output of High– speed counter(4Channels) 14 – 157. . . . . . . . . . . . . . . . . . . . . . . . . . .

F167 (HC1R) Resets Output of High–speed Counter (4 Channels) 14 – 159. . . . . . . . . . . . . . . . . . . . . . . . . .

F168 (SPD1) Positioning Pulse Instruction 14 – 161. . . . .

F169 (PLS) Pulse Width Modulation y 40 Hz 14 – 166. . .

F170 (PWM) Pulse Width Modulation 14 – 169. . . . . . . . . .

F183 (DSTM) Special 32–bit timer 14 – 172. . . . . . . . . . . . .

F327 (INT) Floating point data � 16–bit integer data 14 – 174. . . . . . . . . . . . . . . . . . . . . . . . . .

F328 (DINT) Floating point data � 32–bit integer data 14 – 176. . . . . . . . . . . . . . . . . . . . . . . . . .

F333 (FINT) Rounding the first decimal point down 14 – 178. . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 306: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 7Matsushita Electric Works (Europe) AG

F334 (FRINT) Rounding the first decimal point off 14 – 180. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

F335 (FSIGN) Floating point data sign changes 14 – 182.

F337 (RAD) Conversion of angle units (Degrees � Radians) 14 – 184. . . . . . . . . . . . . . . . . .

F338 (DEG) Conversion of angle units (Radians � Degrees) 14 – 186. . . . . . . . . . . . . . . . . .

F355 (PID) PID processing instruction 14 – 188. . . . . . . . .

Page 307: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 8

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Page 308: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 9Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The CT instruction is a down type preset counter. The Count triggersubtracts one count from the elapsed value area EV each time itsleading edges are detected. The Reset trigger resets the counterwhen it is ON. The constant SV (1 to 32767) can be set as preset(Set) value.

� Data Types

Variable Data Types

Count,

Reset,

C

BOOL

Num*, SV INT, WORD

� Operands

Relais T/C RegisterFor

X Y R L T C DT LD FL

Count,Reset

x x x x x x – – –

C – x x x – – – – –

WX WY WR WL SV EV DT LD FLSV

– – – – x – – – –

� Example

�Notes

� It is not possible to use this function in a function blockPOU.

� Every used counter must have a separate constant Num*.Available Num* addresses depend on system registers 5and 6.

� As input/output relays X and Y are sometimes handled inunits of 16 points, they are expressed as a combination ofdecimal and hexadecimal numbers as shown below.

CT Down Counter

Steps Availability

FP03 – 4

x: available–: not available

Page 309: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 10

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline DF is a leading edge differential instruction. The DF instructionexecutes and turns ON output o for a singular scan duration if thetrigger i changes from an OFF to an ON state.

� Data Types

Variable Output Variable

i, o BOOL

� Operands

Relais T/CFor

X Y R L T C

i x x x x x x

o – x x x – –

� Example

DFSteps Availability

FP01 Leading Edge Differntial

x: available–: not available

Page 310: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 11Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline DFN is trailing edge differential instruction. The DFN instructionexecutes and turns ON output o for a singular scan duration if thetrigger i changes from an ON to an OFF state.

� Data Types

Variable Data Type

i, o BOOL

� Operands

Relais T/CFor

X Y R L T C

i x x x x x x

o – x x x – –

� Example

LD Var_0 (* i = Var_0 *)

DFN (* Trailing edge differential for variable Var_0. *)

ST Var_1 (* o = Var_1 *)

(* At valid event the output variable Var_1 *)

(* is in the ON–state for one scan duration. *)

DFN Steps Availability

FP01 Trailing Edge Diffential

x: available–: not available

Page 311: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 12

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The ICTL (Interrupt Control) instruction sets all interrupts to enableor disable. Each time the ICTL instruction is executed, it is possibleto set parameters like the type and validity of interrupt programs.Settings can be specified by s1 and s2.

� s1: 16–bit equivalent constant or 16–bit area for interruptcontrol setting

� s2: 16–bit equivalent constant or 16–bit area for interrupttrigger condition setting

The number of interrupt programs available is:

� 16 interrupt module initiated interrupt programs (INT 0 to INT15)

� 8 advanced module (special modules, like positioning,...)initiated interrupt programs (INT 16 to INT 23)

� 1 time–initiated interrupt program (INT 24) (Time base 0.5 msand 10ms selectable for FP10SH)

Be sure to use ICTL instructions so that they are executed once atthe leading edge of the ICTL trigger using the DF instruction. Two ormore ICTL instructions can have the same trigger.

Bit 15 .. 8 7 .. 0

s1 16# Selection of control function00: Interrupt ”enable/disable” control01: Interrupt trigger reset control

Interrupt type selection00: Interrupt module initiated interrupt (INT 0–15)01: Advanced module

initiated interrupt (INT 16–23)02: Time–initiated interrupt (INT 24)

s1 16#s2 2#

00Bit 0: 0 Interrupt program 0 disabledBit 0: 1 Interrupt program 0 enabledBit 1: 0 Interrupt program 1 disabled...Bit 15: 1 Interrupt program 15 enabled� Example: s2 = 2#0000000000001010

00

�Notes

� The current enable/disable status of each interrupt moduleinitiated interrupt can be checked by monitoring thespecial data register DT90025.

� The current enable/disable status of each non–interruptmodule initiated interrupt can be checked by monitoringthe special data register DT90026.

� next page

ICTLSteps Availability

FP05 Interrupt Control

Page 312: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 13Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� The current interrupt interval of the time–interrupt can bechecked by monitoring the special data register DT90027.

� If a program is written into an interrupt task, the interruptconcerned will be enabled automatically during theinitialization routine when starting the program.

� With the ICTL instruction an interrupt task can be enabledor disabled by the program.

� Data Types

Variable Data Types

s1, s2 INT, WORD

� Operands

Relais T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

� Example

POU Header

IL BodyLD start (* Load value of EN–input *)DF (* Leading edge detection *)

ICTL Var_1,Var_2 (* Execute ICTL *)

LD Body

The interval for executing INT 24 program is specified as 100 ms(10ms time base selected) when the leading edge of start isdetected.

x: available–: not available

Page 313: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 14

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The JP (Jump to Label) instruction skips to the Label (LBL) functionthat has the same number Num* as the JP function when thepredetermined trigger EN is in the ON–state. The JP function willskip all instructions between a JP and an LBL of the same number.When the JP instruction is executed, the execution time of theskipped instructions is not included in the scan time. Two or more JPfunctions with the same number Num* can be used in a program.However, no two LBL instructions may be identically numbered. LBLinstructions are specified as destinations of JP, LOOP and F19_SJPinstructions. One JP and LBL instruction pair can be programmedbetween another pair. This construction is called nesting.

� Data Types

Variable Data Types

NUM* INT, WORD

� Example

LD start (* EN = start; Starting signal for the JP function. *)JP 1 (* Num* = 1 (Address of Label) *)

�Notes

� It is not possible to use this function in a function blockPOU.

� The JP and LBL instruction numbers Num* must be aconstant between:0 and 31 for FP1–C14/160 and 64 for FP1–C24/40/56/72 and FP–M

JPSteps Availability

All 32 – 3Jump to label

Page 314: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 15Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline KEEP serves as a relay with set and reset points. When theSetTrigger turns ON, output of the specified relay goes ON andmaintains its condition. Output relay goes OFF when theResetTrigger turns ON. The output relay’s ON state is maintaineduntil a ResetTrigger turns ON regardless of the ON or OFF statesof the SetTrigger. If the SetTrigger and ResetTrigger turn ONsimultaneously, the ResetTrigger is given priority.

� Data Types

Variable Data Types

Set Trigger

Reset Trigger

BOOL

Address BOOL

� Operands

Relais T/CFor

X Y R L T C

Set Trigger

Reset Trigger

x x x x x x

Address – x x x – –

� Example

POU Header

LD Body

KEEPSteps Availability

FP01Serves as a relay with set andreset inputs

x: available–: not available

Page 315: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 16

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The LBL (Label for the JP and LOOP) instruction skips to the LBLinstruction with the same number Num* as the JUMP instruction ifthe predetermined trigger EN is in the ON–state. It skips to the LBLinstruction with the same number Num* as the LOOP instruction andrepeats execution of what follows until the data of a specifiedoperand becomes ”0”.

� Data Types

Variable Data Types

NUM* INT, WORD

� Example

�Notes

� It is not possible to use this function in a function blockPOU.

� The LBL, JP and LOOP instruction numbers Num* must bea constant between0 and 31 for FP1–C14/160 and 64 for FP1–C24/40/56/72 and FP–M

LBLSteps Availability

All 31Label for the JP and LOOPInstruction

Page 316: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 17Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The LOOP (Loop to Label) instruction skips to the LBL instructionwith the same number Num* as the LOOP instruction and repeatsexecution of what follows until the data of a specified operandbecomes ”0”. The LBL instructions are specified as destination ofthe LOOP instruction. It is not possible to specify two or more LBLinstructions with the same number Num* within a program. If the setvalue s in the data area is ”0” from the beginning, the LOOPinstruction is not executed (ignored).

� Data Types

Variable Data Types

NUM*, s INT, WORD

� Operands

Relais T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

Num* numerical constant

� Example

�Notes

� It is not possible to use this function in a function blockPOU.

� The LOOP and LBL instruction numbers Num* must be aconstant between0 and 31 for FP1–C14/160 and 64 for FP1–C24/40/56/72 and FP–M

LOOPSteps Availability

All 34Loop to Label

x: available–: not available

Page 317: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 18

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Shifts 1 bit of the specified data area (WR) to the left (to the higherbit position). When programming the LSR instruction, be sure toprogram the data input (DataInput), shift (shiftTrigger) and resettriggers (ReSetTrigger). DataInput: specifies the state of newshift–in data: new shift–in data 1: when the input is ON new shift–indata 0: when the input is OFF shiftTrigger: shifts 1 bit to the left whenthe leading edge of the trigger is detected ReSetTrigger: turns all thebits of the data area to 0 if the trigger is in the ON–state. The areaavailable for this instruction is only the word internal relay (WR).

� Data Types

Variable Data Types

DataInput,

Shift Trigger,

Reset Trigger

BOOL

WR INT, WORD

� Operands

Relais T/CFor

X Y R L T C

DataInput

Shift Trigger,

Reset Trigger

x x x x x x

WX WY WR WL SV EVWR

– – x – – –

� Example

�Note

� Word internal relay (WR) number range, depends on thefree area in the Project –> Compile Options menu.

Left shift registerLSRSteps Availability

FP0

x: available–: not available

Page 318: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 19Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The MC (Master Control Relay) instruction executes the programbetween the master control relay MC and master control relay endMCE instructions of the same number Num* only if the trigger EN isin the ON–state. When the predetermined trigger EN is in the OFFstate, the program between the master control relay MC and mastercontrol relay end MCE instructions are not executed. A mastercontrol instruction (MC and MCE) pair may also be programmed inbetween another pair of master control instructions. Thisconstruction is called ”nesting”.

� Data Types

Variable Data Types

NUM* INT, WORD

� Example

�Notes

� It is not possible to use this function in a function blockPOU.

� The MC instruction number Num* must be a constantbetween0 and 15 for FP1–C14/160 and 31 for FP1–C24/40/56/72 und FP–M

MCSteps Availability

All 32 – 3Master Control relay

Page 319: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 20

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The MCE (Master Control Relay End) instruction executes theprogram between the master control relay MC and master controlrelay end MCE instructions of the same number Num* only if thetrigger EN is in the ON–state. When the predetermined trigger ENis in the OFF state, the program between the master control relay MCand master control relay end MCE instructions are not executed. Amaster control instruction (MC and MCE) pair may also beprogrammed in between another pair of master control instructions.This construction is called ”nestin,3g”.

� Data Types

Variable Data Types

NUM* INT, WORD

� Example MCE

LD start (* EN = start; Starting signal for the MC/MCE function. *)MC 1 (* 1 = Num* *)

(* ... *)(* Execute or execute not this program part. *)(* ... *)

MCE 1 (* 1 = Num* *)

�Notes

� It is not possible to use this function in a function blockPOU.

� The MCE instruction number Num* must be a constantbetween0 and 31 for FP1–C14/160 and 64 for FP1–C24/40/56/72 and FP–M

MCESteps Availability

All 32Master Conrol Relay End

Page 320: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 21Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The TM_10ms instruction sets the ON–delay timer for 0.001s units(0 to 32.767s).The areas used for the instruction are:

• Preset (Set) value area: SV• Count (Elapsed) value area: EV

When the mode is set to RUN mode, the Preset (Set) value istransferred to the SV. If the trigger of the timer instruction start is inthe ON–state, the Preset (Set) value is transferred to the EV from theSV. During the timing operation, the time is subtracted from the EV.The scan time is also subtracted from the EV in the next scan. Thetimer contact T turns ON, when the EV becomes 0.

� Data Types

Variable Data Types

start, T BOOL

Num*, SV INT, WORD

� Operands

Relais T/C RegisterFor

X Y R L T C DT LD FL

start x x x x x x – – –

T – x x x – – – – –

WX WY WR WL SV EV DT LD FLSV

– – – – x – – – –

Num* numerical constant

� Example

TM_1msSteps Availability

FP03 – 4On Delay Timer for 0.001sUnits

x: available–: not available

Page 321: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 22

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

�Notes

� It is not possible to use this function in a function blockPOU.

� Every used timer must have a separate constant Num*.Available Num* addresses depend on system registers 5and 6. Timers of type TM_1s, TM_100ms, TM_10ms,TM_1ms use the same Num* address range.

� The Matsushita timer functions (TM_1s, TM_100ms,TM_10ms, and TM_1s) use the same NUM* address area asthe Matsushita timer function blocks (TM_1s_FB,TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the ti-mer function blocks the compiler automatically assigns aNUM* address to every timer instance. The addresses areassigned counting downwards, starting at the highest pos-sible address. In order to avoid errors (address conflicts),these timer functions and function blocks should not beused together in a project.

Page 322: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 23Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The TM_10ms instruction sets the ON–delay timer for 0.01s units (0to 327.67s).The areas used for the instruction are:

• Preset (Set) value area: SV• Count (Elapsed) value area: EV

When the mode is set to RUN mode, the Preset (Set) value istransferred to the SV. If the trigger of the timer instruction start is inthe ON–state, the Preset (Set) value is transferred to the EV from theSV. During the timing operation, the time is subtracted from the EV.The scan time is also subtracted from the EV in the next scan. Thetimer contact T turns ON, when the EV becomes 0.

� Data Types

Variable Data Types

start, T BOOL

Num*, SV INT, WORD

� Operands

Relais T/C RegisterFor

X Y R L T C DT LD FL

start x x x x x x – – –

T – x x x – – – – –

WX WY WR WL SV EV DT LD FLSV

– x x x – – – – –

Num* numerical constant

� Example

TM_10msSteps Availability

FP03 – 4

On Delay Timer for0.01s Units

x: available–: not available

Page 323: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 24

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

�Notes

� It is not possible to use this function in a function blockPOU.

� Every used timer must have a separate constant Num*.Available Num* addresses depend on system registers 5and 6. Timers of type TM_1s, TM_100ms, TM_10ms,TM_1ms use the same Num* address range.

� The Matsushita timer functions (TM_1s, TM_100ms,TM_10ms, and TM_1s) use the same NUM* address area asthe Matsushita timer function blocks (TM_1s_FB,TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the ti-mer function blocks the compiler automatically assigns aNUM* address to every timer instance. The addresses areassigned counting downwards, starting at the highest pos-sible address. In order to avoid errors (address conflicts),these timer functions and function blocks should not beused together in a project.

Page 324: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 25Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The TM_100s instruction sets the ON–delay timer for 0.1s units (0to 3276.7s). The TM instruction is a down type preset timer.

The areas used for the instruction are:• Preset (Set) value area: SV• Count (Elapsed) value area: EV

When the mode is set to RUN mode, the Preset (Set) value istransferred to the SV. If the trigger of the timer instruction start is inthe ON–state, the Preset (Set) value is transferred to the EV from theSV. During the timing operation, the time is subtracted from the EV.The scan time is also subtracted from the EV in the next scan. Thetimer contact T turns ON, when the EV becomes 0.

� Data Types

Variable Data Types

start, T BOOL

Num*, SV INT, WORD

� Operands

Relais T/C RegisterFor

X Y R L T C DT LD FL

start x x x x x x – – –

T – x x x – – – – –

WX WY WR WL SV EV DT LD FLSV

x x x x x x x x x

Num* numerical constant

� Example

LD start (* EN = start; Starting signal for the TM_100ms function. *) TM_100ms 16,32123 (* Num* = 16 (Address of the timer) *)

(* SV = 32123 (Time, corresponding 3212,3 sec. ) *)ST Var_0 (* T = Var_0; The variable Var_0 turns ON, *)

(* when the EV becomes 0. *)

On Delay Timer for0.1s Units

TM_100ms Steps Availability

FP03 – 4

x: available–: not available

Page 325: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 26

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

�Notes

� It is not possible to use this function in a function blockPOU.

� Every used timer must have a separate constant Num*.Available Num* addresses depend on system registers 5and 6. Timers of type TM_1s, TM_100ms, TM_10ms,TM_1ms use the same Num* address range.

� The Matsushita timer functions (TM_1s, TM_100ms,TM_10ms, and TM_1s) use the same NUM* address area asthe Matsushita timer function blocks (TM_1s_FB,TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the ti-mer function blocks the compiler automatically assigns aNUM* address to every timer instance. The addresses areassigned counting downwards, starting at the highest pos-sible address. In order to avoid errors (address conflicts),these timer functions and function blocks should not beused together in a project.

Page 326: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 27Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The TM_1s instruction sets the ON–delay timer for 1s units (0 to32767s).

The areas used for the instruction are:• Preset (Set) value area: SV• Count (Elapsed) value area: EV

When the mode is set to RUN mode, the Preset (Set) value istransferred to the SV. If the trigger of the timer instruction start is inthe ON–state, the Preset (Set) value is transferred to the EV from theSV. During the timing operation, the time is subtracted from the EV.The scan time is also subtracted from the EV in the next scan. Thetimer contact T turns ON, when the EV becomes 0.

� Data Types

Variable Data Types

start, T BOOL

Num*, SV INT, WORD

� Operands

Relais T/C RegisterFor

X Y R L T C DT LD FL

start x x x x x x – – –

T – x x x – – – – –

WX WY WR WL SV EV DT LD FLSV

x x x x x x x x x

Num* numerical constant

� Example

LD start (* EN = start; Starting signal for the TM_1s function. *)TM_1s 13,SV13 (* Num* = 13 (Address of the timer) *)

(* SV = SV13 (containing the time for the timer) *)ST Var_0 (* T = Var_0; The variable Var_0 turns ON, *)

(* when the EV becomes 0. *)

TM_1s Steps Availability

FP04 – 5On Delay Timer for 1s Units

x: available–: not available

Page 327: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 28

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

�Notes

� It is not possible to use this function in a function blockPOU.

� Every used timer must have a separate constant Num*.Available Num* addresses depend on system registers 5and 6. Timers of type TM_1s, TM_100ms, TM_10ms,TM_1ms use the same Num* address range.

� The Matsushita timer functions (TM_1s, TM_100ms,TM_10ms, and TM_1s) use the same NUM* address area asthe Matsushita timer function blocks (TM_1s_FB,TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the ti-mer function blocks the compiler automatically assigns aNUM* address to every timer instance. The addresses areassigned counting downwards, starting at the highest pos-sible address. In order to avoid errors (address conflicts),these timer functions and function blocks should not beused together in a project.

Page 328: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 29Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 16–bit data or 16 bit equivalent constant specified by s is copiedto the 16–bit area specified by d, if the trigger EN is in the ON–state.

� Data Types

Variable Data Types

s, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s and d have to be of the same data type.

16–bit data moveSteps Availability

All 35F0 (MV)

x: available–: not available

Page 329: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 30

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 32 bit data or 32 bit equivalent constant specified by s is copiedto the 32–bit area specified by d, if the trigger EN is in the ON–state.

� Data Types

Variable Data Types

s, d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F1_DMV function. *)F1_DMV Var_0,Var_1 (* s = Var_0 (source) *)

(* d = Var_1 (destination) *)(* 32–bit data move from Var_0 to Var_1 *)

ST out (* option *)

�Note

The variables s and d have to be of the same data type.

32–bit data moveF1 (DMV)Steps Availability

All 37

x: available–: not available

Page 330: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 31Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 16 bit data or 16 bit equivalent constant specified by s is invertedand transferred to the 16–bit area specified by d if the trigger EN isin the ON–state.

� Data Types

Variable Data Types

s, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F2_MVN function. *)F2_MVN Var_0,

Var_1(* s = Var_0 (source) *)(* d = Var_1 (destination) *)(* 16–bit invert and move from Var_0 to Var_1 *)

ST out (* option *)

�Note

The variables s and d have to be of the same data type.

16–bit data inversionsand moveF2 (MVN)

Steps Availability

All 35

x: available–: not available

Page 331: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 32

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 32–bit data or 32–bit equivalent constant specified by s isinverted and transferred to the 32–bit area specified by d if the triggerEN is in the ON–state.

� Data Types

Variable Data Types

s, d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s and d have to be of the same data type.

32–bit data inversionsand moveF3 (DMVN)

Steps Availability

All 37

x: available–: not available

Page 332: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 33Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline 1 bit of the 16–bit data or constant value specified by s is copied toa bit of the 16–bit area specified by d according to the content speci-fied by n if the trigger EN is in the ON–state. When the 16–bit equiva-lent constant is specified by s, the bit data move operation is perfor-med internally converting it to 16–bit binary expression. The operandn specifies the bit number as follows:

• Bit No. 0 to 3: source bit No. (0 hex to F hex)

• Bit No. 8 to 11: destination bit No. (0 hex to F hex)

(The bits from 4 to 7 and 12 to 15 are invalid).

� Data Types

Variable Data Types

s, n, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s, n x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F5_BTM function. *)F5_BTM Var_0,Var_1 (* s = Var_0 (source) *)

Var_2 (* n = Var_1; e. g. Var_1 = 16#0A0B *)(* 11 source bit (B) ⇒ 10 destination bit (A) *)(* d = Var_2 (destination) *)

ST out (* option *)

�Note

The variables s and d have to be of the same data type.

Bit data moveF5 (BTM)Steps Availability

All 37

x: available–: not available

Page 333: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 34

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The digits of the 16–bit data or constant value specified by s arecopied to the digits of the 16–bit area specified by d if the trigger ENis in the ON–state. Copying multiple digits is also possible. 1 digitmeans 4–bit unit. The operand n specifies the bit number as follows:

• Bit No. 0 and 1: source digit No. (0 hex to 3 hex)

• Bit No. 4 and 5: number of digits to be copied (0 hex to 3hex)

0 = move 1 digit1 = move 2 digit (1 byte)2 = move 3 digit3 = move 4 digit (2 byte)

• Bit No. 8 and 9: destination digit No. (0 hex to 3 hex)

(The bits 2,3,6,7 and 10 through 15 are invalid).

� Data Types

Variable Data Types

s, n, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s, n x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s and d have to be of the same data type.

Digit data moveF6 (DGT)Steps Availability

All 37

x: available–: not available

Page 334: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 35Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The data block specified by the 16–bit starting area specified by s1and the 16–bit ending area specified by s2 are copied to the blockstarting from the 16–bit area specified by d if the trigger EN is in theON–state. The operands s1 and s2 should be:

• in the same operand

• s1 � s2

Whenever s1, s2 and d are in the same data area:

• s1 = d: data will be re–copied to the same data area.

� Data Types

Variable Data Types

s1, s2, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F10_BKMV function. *)

F10_BKMV Var_0,Var_1 (* s1 = Var_0 (source 1) *)Var_2 (* s2 = Var_1 (source 2) *)

(* d = Var_2 (destination) *)(* Var_0 to Var_1 ⇒ Var_2 *)

ST out (* option *)

�Note

The variables s1, s2 and d have to be of the same data type.

Block transferF10 (BKMV)Steps Availability

All 37

x: available–: not available

Page 335: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 36

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 16–bit equivalent constant or 16–bit area specified by s iscopied to all 16–bit areas of the block specified by d1 and d2 if thetrigger EN is in the ON–state. The operands d1 and d2 should be:

• in the same operand

• d1 � d2

� Data Types

Variable Data Types

s, d1, d2 INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d1, d2 – x x x x x x x x

� Example

�Note

The variables s, d1 and d2 have to be of the same data type.

Block copyF11 (COPY)Steps Availability

All 37

x: available–: not available

Page 336: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 37Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline This instruction is used to read information from the EEPROM.Before executing the F12_EPRD instruction, make sure that youhave valid data in the EEPROM memory location being read to thedestination area. Otherwise the values being read will not make anysense. Also ensure that there at least 64 free data registers (1 block= 64 words (DTs)) reserved for the destination area.

� Data Types

Parameter Data Type Comment

Input EN BOOL Activation of the function block (when EN has thestate TRUE, the function block will be executed atevery PLC scan)

Input s1 INT, WORD EEPROM start block number

Input s2 DINT, DWORD Number of blocks to write (1 block = 64 words(DTs))

Eingang d DINT, DWORD DT start address for information to be written

IOutput ENO BOOL When the function block was executed, ENO isset to TRUE. Helpful at cascading of functionblocks with EN–functionality

�Note

� One of the two inputs ’s1’ or ’s2’ has to be assigned con-stant number value.

� Operands

Relais T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2 x x x – x x x – –

WX WY WR WL SV EV DT LD FLd

– – – – – – x – –

EEPROM read from memoryF12 EPRDSteps Availability

Fp0 (from Ver. 2.0)11

x: available–: not available

Page 337: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 38

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� PLC–specific information

PLC type FP0 2,7kC10/C14/C16

FP0 5k C32 FP0 10kT32CP

Block size (1 block) 64 words (64 x16 bit )

64 words ( 64 x16 bit )

64 words (64 x16 bit )

EEPROM start block number 0 to 9 0 to 95 0 to 255

Number of blocks to be read /written each execution

1 to 2 1 to 8 1 to 255

Write duration (Additional scantime)

20 ms eachblock

5 ms each block 5 ms each block

Read duration (Additional scantime)

Less than 1 mseach block

Less than 1mseach block

Less than 1mseach block

Max number of writing events 100,000 10,000 10,000

Note Power down RUN –> Progmode changes are also counted

Max read times No limit No limit No limit

� Example

In this example the function F12_EPRD is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU Header

In the POU header, all input and output variables are declared that areused for programming this function.

Body

When the variable start changes from FALSE to TRUE, the function iscarried out. The function reads the first block (= 64 words) after startblock number 0 from the EEPROM and writes the information into thedata fields from data field[0] until data field[63].

LD Body

IL Body

Page 338: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 39Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline This instructions are used to save your PID profiles, timer profiles,counter profiles or positioning profiles ... into the built–in EEPROM.The EEPROM memory is not the same as the hold area. The holdarea stores data real time. Whenever the power shuts down, the holddata is stored in the EEPROM memory. The P13_EPWT instructionsends data into the EEPROM only when the instruction is executed.It also has a limitation of the number of times you can write to it (seetable below). You must make sure that the P13_EPWT instructionwill not be executed more often than the specified number of writes.For example, if you execute P13_EPWT with R901A relay (pulsetime 0.1s), the EEPROM will become inoperable after 100,000 * 0.1sec=10,000 sec (2.8 hours). However if you want to hold your profiledata such as positioning parameters or any other parameter valuesthat are changed infrequently, you will find this instruction veryuseful.

� Data Types

Parameter Data Type Comment

Input EN BOOL Activation of the function block (when EN changesfrom FALSE to TRUE, the function block will beexecuted one time)

Input s1 INT, WORD DT start address of the block(s) that you want tosave

Input s2 DINT, DWORD Number of blocks to write (1 block = 64 words(DTs))

Input d DINT, DWORD EEPROM start block number

IOutput ENO BOOL When the function block was executed, ENO isset to TRUE. Helpful at cascading of functionblocks with EN–functionality

�Note

� One of the two input variables s2 or d has to be assigned constant number value.

EEPROM write to memoryP13 EPWTSteps Availability

FP0 (from Ver. 2.0)11

Page 339: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 -- 40 Matsushita Electric Works (Europe) AG

Basic and High--level Instructions

J Operands

ForRelais T/C Register

ForWX WY WR WL SV EV DT LD FL

s1 -- -- -- -- -- -- x -- --

s2 dDWX DWY DWR DWL DSV DEV DDT DLD DFL

s2, dx x x -- x x x -- --

J PLC--specific information

PLC type FP0 2,7kC10/C14/C16

FP0 5k C32 FP0 10kT32CP

Block size (1 block) 64 words(64x16bit)

64 words(64x16bit)

64 words(64x16bit)

EEPROM start block number 0 to 9 0 to 95 0 to255

Number of blocks to be read /written each execution

1 to 2 1 to 8 1 to 255

Write duration(Additional scan time)

20 ms each block 5 ms eachblock

5 ms eachblock

Read duration(Additional scan time)

Less than 1mseach block

less than 1 mseach block

Less than 1mseach block

Max write times 100,000 10,000 10,000

Note: Power down, RUN -->PROG mode changes are alsocounted

Max read times No limit No limit No Limit

✩ Example

In this example the function P13_EPWT is programmed in ladder dia-gram (LD) and instruction list (IL). The same POU header is used forboth programming languages.POU HeaderIn the POU header, all inputand output variables are declared that are used for programming thisfunction.

Body

When the variable start changes from FALSE to TRUE, the function iscarried out. The function reads the contents of data field[0] until datafield[63] (s2* = 1 => 1 block = 64 words) and writes the information afterstart block number 0 into the EEPROM.

✧ next page

x: available--: not available

Page 340: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 41Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

LD Body

IL Body

Page 341: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 42

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The contents in the 16–bit areas specified by d1 and d2 areexchanged if the trigger EN is in the ON–state.

� Data Types

Variable Data Types

d1, d2 INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d1 – x x x x x x x x

d2 – x x x x x x x x

� Example

�Note

The variables d1 and d2 have to be of the same data type.

16–bit data exchangeF15 (XCH)Steps Availability

All 35

x: available–: not available

Page 342: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 43Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Two 32–bit data specified by d1 and d2 are exchanged if the triggerEN is in the ON–state.

� Data Types

Variable Data Types

d1, d2 DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

d1, d2 – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F16_DXCH function. *)F16_DXCH Var_0 (* d1=Var_0 (source/destination 1) *)

Var_1 (* d2=Var_1 (source/destination 2) *)ST out (* option *)

�Note

The variables d1 and d2 have to be of the same data type.

32–bit data exchangeF16 (DXCH)Steps Availability

All 35

x: available–: not available

Page 343: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 44

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The high order of 1 byte (higher 8–bit) and low order of 1 byte (lower8–bit) of 16–bit area specified by d are exchanged if the trigger ENis in the ON–state. 1 byte means 8 bits.

� Data Types

Variable Data Types

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F17_SWAP function. *)F17_SWAP Var_0 (* d = Var_0 (source/destination) *)

(* Byte1Byte0 ⇒ Byte0Byte1 *)ST out (* optional *)

Higher/lower byte in16–bit data exchangeF17 (SWAP)

Steps Availability

All 33

x: available–: not available

Page 344: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 45Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 16–bit equivalent constant or 16–bit area specified by s and the16–bit area specified by d are added together if the trigger EN is inthe ON–state. The added result is stored in d.

� Data Types

Variable Data Types

s, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s and d have to be of the same data type.

16–bit additionF20 (ADD)Steps Availability

All 35

x: available–: not available

Page 345: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 46

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 32–bit equivalent constant or 32–bit area specified by s and the32–bit data specified by d are added together if the trigger EN is inthe ON–state. The added result is stored in d.

� Data Types

Variable Data Types

s, d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s and d have to be of the same data type.

32–bit additionF21 (DADD)Steps Availability

All 37

x: available–: not available

Page 346: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 47Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 16–bit data or 16–bit equivalent constant specified by s1 ands2 are added together if the trigger EN is in the ON–state. The addedresult is stored in d.

� Data Types

Variable Data Types

s1, s2, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s1, s2 and d have to be of the same data type.

16–bit addition, destinationcan be specifiedF22 (ADD2)

Steps Availability

All 37

x: available–: not available

Page 347: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 48

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 32–bit data or 32–bit equivalent constant specified by s1 ands2 are added together if the trigger EN is in the ON–state. The addedresult is stored in d.

� Data Types

Variable Data Types

s1, s2, d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F23_DADD2function. *)

F23_DADD2 Var_0,Var_1Var_2 (* s1 = Var_0 (source1) *)(* s2 = Var_1 (source2) *)(* d = Var_2 (destination) *)(*s1 + s2 = d *)

ST out (* optional *)

�Note

The variables s1, s2 and d have to be of the same data type.

32–bit addition, destinationcan be specifiedF23 (DADD2)

Steps Availability

All 311

x: available–: not available

Page 348: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 49Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts the 16–bit equivalent constant or 16–bit area specified bys from the 16–bit area specified by d if the trigger EN is in the ON–state. The subtracted result is stored in d (minuend area).

� Data Types

Variable Data Types

s, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F25_SUB function. *)F25_SUB Var_0 (* s = Var_0 (source) *)

Var_1 (* d = Var_1 (destination) *)(* d – s = d *)

ST out (* optional *)

�Note

The variables s and d have to be of the same data type.

16–bit subtractionF25 (SUB)Steps Availability

All 35

x: available–: not available

Page 349: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 50

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts the 32–bit equivalent constant or 32–bit data specified bys from the 32–bit data specified by d if the trigger EN is in theON–state. The subtracted result is stored in d (minuend area).

� Data Types

Variable Data Types

s, d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s and d have to be of the same data type.

32–bit subtractionF26 (DSUB)Steps Availability

All 37

x: available–: not available

Page 350: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 51Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts the 16–bit data or 16–bit equivalent constant specified bys2 from the 16–bit data or 16–bit equivalent constant specified by s1if the trigger EN is in the ON–state. The subtracted result is storedin d.

� Data Types

Variable Data Types

s1, s2, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F27_SUB2 function. *)

F27_SUB2 Var_0,Var_1 (* s1 = Var_0 (source1) *)Var_2 (* s2 = Var_1 (source2) *)

(* d = Var_2 (destination) *)(* s1 – s2 = d *)

ST out (* optional *)

�Note

The variables s1, s2 and d have to be of the same data type.

16–bit subtraction,destination can be specifiedF27 (SUB2)

Steps Availability

All 37

x: available–: not available

Page 351: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 52

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts the 32–bit data or 32–bit equivalent constant specified bys2 from the 32–bit data or 32–bit equivalent constant specified by s1if the trigger is in the ON–state. The subtracted result is stored in d.

� Data Types

Variable Data Types

s1, s2, d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s1, s2 and d have to be of the same data type.

32–bit subtraction,destination can be specifiedF28 (DSUB2)

Steps Availability

All 311

x: available–: not available

Page 352: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 53Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Multiplies the 16–bit data or 16–bit equivalent constant s1 and the16–bit data or 16–bit equivalent constant specified by s2 if the triggerEN is in the ON–state. The multiplied result is stored in d (32–bitarea).

� Data Types

Variable Data Types

s1, s2 INT, WORD

d DINT, DWORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

DWX DWY DWR DWL DSV DEV DDT DLD DFLd

– x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F30_MUL func-tion. *)

F30_MUL Var_0,Var_1Var_2 (* s1 = Var_0 (source1) *)(* s2 = Var_1 (source2) *)(* d = Var_2 (destination) *)(* s1 * s2 = d *)

ST out (* optional *)

�Note

The variables s1, s2 and d have to be of the same data type(INT/DINT or WORD/DWORD).

16–bit multiplication,destination can be specifiedF30 (MUL)

Steps Availability

All 37

x: available–: not available

Page 353: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 54

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Multiplies the 32–bit data or 32–bit equivalent constant specified bys1 and the one specified by s2 if the trigger EN is in the ON–state.The multiplied result is stored in d[1], d[2] (64–bit area).

� Data Types

Variable Data Types

s1, s2 DINT, DWORD

d ARRAY [1..2] OF DINT or DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

POU Header

Class Identifier Type Initial Comment0 VAR start BOOL FALSE Enable signal1 VAR var_0 DINT 0 Variable 02 VAR var_1 DINT 0 Variable 13 VAR var_2 ARRAY [0..1]

OF DINT2(0) Result of multiplication

IL Body

LD start (* Load value of EN–input *)F31_DMUL var_0,var_1,var_2 (* Execute F31_DMUL *)

LD Body

Access to the result is possible with var_2[0] and var_2[1].

�Note

The variables s1, s2 and d have to be of the same data type.

32–bit multiplication,destination can be specifiedF31 (DMUL)

Steps AvailabilityAll 3, except FP1–C14/16and FP–M0.9k11

x: available–: not available

Page 354: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 55Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 16–bit data or 16–bit equivalent constant specified by s1 is di-vided by the 16–bit data or 16–bit equivalent constant specified bys2 if the trigger EN is in the ON–state. The quotient is stored in d andthe remainder is stored in the special data register DT9015(DT90015 for FP10/10S).

� Data Types

Variable Data Types

s1, s2, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F32_DIV func-tion. *)

F32_DIV Var_0,Var_1,Var_2 (* s1 = Var_0 (source1) *)(* s2 = Var_1 (source2) *)(* d = Var_2 (destination) *)(* s1 / s2 = d *)

ST out (* optional *)

�Note

The variables s1, s2 and d have to be of the same data type.

16–bit division, destinationcan be specifiedF32 (DIV)

Steps Availability

All 37

x: available–: not available

Page 355: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 56

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 32–bit data or 32–bit equivalent constant specified by s1 is di-vided by the 32–bit data or 32–bit equivalent constant specified bys2 if the trigger EN is in the ON–state. The quotient is stored in d andthe remainder is stored in the special data registers DT9016 andDT9015 (DT90016 and DT90015 for FP10/10S).

� Data Types

Variable Data Types

s1, s2, d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s1, s2 and d have to be of the same data type.

32–bit division, destination canbe specifiedF33 (DDIV)

Steps AvailabilityAll 3, except FP1–C14/16and FP–M0.9k11

x: available–: not available

Page 356: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 57Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Adds ”1” to the 16–bit data specified by d if the trigger EN is in theON–state. The added result is stored in d.

� Data Types

Variable Data Types

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F35_INC function. *)F35_INC Var_0 (* d = Var_0 (destination) *)

(* d + 1 = d *) ST out (* optional *)

16–bit incrementF35 (INC)Steps Availability

All 33

x: available–: not available

Page 357: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 58

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Adds ”1” to the 32–bit data specified by d if the trigger EN is in theON–state. The added result is stored in d.

� Data Types

Variable DataTypes

d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

d – x x x x x x x x

� Example

32–bit incrementF36 (DINC)Steps Availability

All 33

x: available–: not available

Page 358: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 59Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts ”1” from the 16–bit data specified by d if the trigger EN isin the ON–state. The result is stored in d.

� Data Types

Variable Data Types

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F37_DEC function. *)F37_DEC Var_0 (* d = Var_0 (destination) *)

(* d – 1 = d *) ST out (* optional *)

16–bit decrementF37 (DEC)Steps Availability

All 33

x: available–: not available

Page 359: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 60

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts ”1” to the 32–bit data specified by d if the trigger EN is inthe ON–state. The added result is stored in d.

� Data Types

Variable Data Types

d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

d – x x x x x x x x

� Example

32–bit decrementF38 (DDEC)Steps Availability

All 33

x: available–: not available

Page 360: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 61Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 4–digit BCD equivalent constant or 16–bit area for 4–digit BCDdata specified by s and the 16–bit area for 4–digit BCD dataspecified by d are added together if the trigger EN is in the ON–state.The added result is stored in d.

� Data Types

Variable Data Types

s, d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F40_BADDfunction. *)

F40_BADD Var_0,Var_1 (* s = Var_0 (source) *)(* d = Var_1 (destination) *)(* s + d = d *)

ST out (* optional *)

4–digit BCD additionF40 (BADD) 5

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 361: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 62

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 8–digit BCD equivalent constant or 8–digit BCD data specifiedby s and the 8–digit BCD data specified by d are added together ifthe trigger EN is in the ON–state. The added result is stored in d.

� Data Types

Variable Data Types

s, d DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

8–digit BCD additionF41 (DBADD) 7

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 362: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 63Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 4–digit BCD equivalent constant or 16–bit area for 4–digit BCDdata specified by s1 and s2 are added together if the trigger EN isin the ON–state. The added result is stored in d.

� Data Types

Variable Data Types

s1, s2, d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

4–digit BCD addition,destination can be specifiedF42 (BADD2) 7

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 363: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 64

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 4–digit BCD equivalent constant or 16–bit area for 4–digit BCDdata specified by s1 and s2 are added together if the trigger EN isin the ON–state. The added result is stored in d.

� Data Types

Variable Data Types

s1, s2, d DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F43_DBADD2 function. *)

F43_DBADD2 Var_0,Var_1Var_2 (* s1 = Var_0 (source1) *)(* s2 = Var_1 (source2) *)(* d = Var_2 (destination) *)(* s1 + s2 = d *)

ST out (* optional *)

8–digit BCD addition,destination can be specifiedF43 (DBADD2) 11

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 364: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 65Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts the 4–digit BCD equivalent constant or 16–bit area for4–digit BCD data specified by s from the 16–bit area for 4–digit BCDdata specified by d if the trigger EN is in the ON–state. Thesubtracted result is stored in d.

� Data Types

Variable Data Types

s, d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x x x x x x x x

� Example

4–digit BCD subtractionF45 (BSUB) 5

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 365: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 66

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts the 8–digit BCD equivalent constant or 8–digit BCD dataspecified by s from the 8–digit BCD data specified by d if the triggerEN is in the ON–state. The subtracted result is stored in d.

� Data Types

Variable Data Types

s, d DWORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x x x x x x x x

� Example

8–digit BCD subtractionF46 (DBSUB) 7

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 366: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 67Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts the 4–digit BCD equivalent constant or 16–bit area for4–digit BCD data specified by s2 from the 4–digit BCD equivalentconstant or 16–bit area for 4–digit BCD data specified by s1 if thetrigger EN is in the ON–state. The subtracted result is stored in d.

� Data Types

Variable Data Types

s1, s2, d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F47_BSUB2 function. *)

F47_BSUB2 Var_0,Var_1Var_2 (* s1 = Var_0 (source1) *)(* s2 = Var_1 (source2) *)(* d = Var_2 (destination) *)(* s1 – s2 = d *)

ST out (* optional *)

4–digit BCD subtraction,destination can be specifiedF47 (BSUB2) 7

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 367: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 68

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts the 8–digit BCD equivalent constant or 8–digit BCD dataspecified by s2 from the 8–digit BCD equivalent constant or 8–digitBCD data specified by s1 if the trigger EN is in the ON–state. Thesubtracted result is stored in d.

� Data Types

Variable Data Types

s1, s2, d DWORD

� Operands

Relais T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

8–digit BCD subtraction,destination can be specifiedF48 (DBSUB2) 11

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 368: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 69Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Multiplies the 4–digit BCD equivalent constant or 16–bit area for4–digit BCD data specified by s1 and s2 if the trigger EN is in theON–state. The multiplied result is stored in d (8–digit area).

� Data Types

Variable Data Types

s1, s2 WORD

d DWORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

DWX DWY DWR DWL DSV DEV DDT DLD DFLd

– x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F50_BMUL func-tion. *)

F50_BMUL Var_0,Var_1Var_2 (* s1 = Var_0 (source1) *)(* s2 = Var_1 (source2) *)(* d = Var_2 (destination) *)(* s1 * s2 = d *)

ST out (* optional *)

4–digit BCD multiplication,destination can be specifiedF50 (BMUL)

7

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 369: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 70

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Multiplies the 8–digit BCD equivalent constant or 8–digit BCD dataspecified by s1 and the one specified by s2 if the trigger EN is in theON–state. The multiplied result is stored in the ARRAY d[1], d[2](64–digit area).

� Data Types

Variable Data Types

s1, s2 DWORD

d ARRAY [1...2] OF DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

8–digit BCD multiplication,destination can be specifiedF51 (DBMUL) 11

Steps AvailabilityAll 3, except FP–C14/16and FP–M 0.9k

x: available–: not available

Page 370: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 71Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 4–digit BCD equivalent constant or the 16–bit area for 4–digitBCD data specified by s1 is divided by the 4–digit BCD equivalentconstant or the 16–bit area for 4–digit BCD data specified by s2 if thetrigger EN is in the ON–state. The quotient is stored in the areaspecified by d and the remainder is stored in special data registerDT9015 (DT90015 for FP0–T32CP).

� Data Types

Variable Data Types

s1, s2, d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F52_BDIV func-tion. *)

F52_BDIV Var_0,Var_1 (* s1 = Var_0 (source1) *)Var_2 (* s2 = Var_1 (source2) *)

(* d = Var_2 (destination) *)(* s1 / s2 = d *)

ST out (* optional *)

4–digit BCD division,destination can be specifiedF52 (BDIV) 7

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 371: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 72

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The 8–digit BCD equivalent constant or the 8–digit BCD dataspecified by s1 is divided by the 8–digit BCD equivalent constant orthe 8–digit BCD data specified by s2 if the trigger EN is in theON–state. The result is stored in the areas specified by d, and theremainder is stored in the special data registers DT9016 andDT9015 (DT90016 and DT90015 for FP0–T32CP).

� Data Types

Variable Data Types

s1, s2, d DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

8–digit BCD division,destination can be specifiedF53 (DBDIV) 11

Steps Availability

All 3, except FP–C14/16 and FP–M 0.9k

x: available–: not available

Page 372: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 73Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Adds ”1” to the 4–digit BCD data specified by d if the trigger EN isin the ON–state. The result is stored in d.

� Data Types

Variable Data Types

d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F55_BINC function. *)F55_BINC Var_0 (* d = Var_0 (destination) *)

(* d + 1 = d *) ST out (* optional *)

4–digit BCD incrementF55 (BINC) 3

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 373: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 74

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Adds ”1” to the 8–digit BCD data specified by d if the trigger EN isin the ON–state. The result is stored in d.

� Data Types

Variable Data Types

d DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

d – x x x x x x x x

� Example

8–digit BCD incrementF56 (DBINC) 3

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 374: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 75Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts ”1” from the 4–digit BCD data specified by d if the triggerEN is in the ON–state. The result is stored in d.

� Data Types

Variable Data Types

d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F57_BDEC function. *)F57_BDEC Var_0 (* d = Var_0 (destination) *)

(* d – 1 = d *) ST out (* optional *)

4–digit BCD decrementF57 (BDEC) 3

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 375: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 76

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts ”1” from the 8–digit BCD data specified by d if the triggerEN is in the ON–state. The result is stored in d.

� Data Types

Variable Data Types

d DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

d – x x x x x x x x

� Example

8–digit BCD decrementF58 (DBDEC) 3

Steps Availability

All 3, except FP–M 0.9k

x: available–: not available

Page 376: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 77Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Compares the 16–bit data specified by s1 with one specified by s2if the trigger EN is in the ON–state. The compare operation result isstored in special internal relays R9009, R900A to R900C.

Flag

Data comparisonbetween s1 and s2 R900A

(�flag)R900B(=flag)

R900C(�flag)

R9009(carry–flag)

s1�s2 OFF OFF ON #

16–bit datawith sign

s1=s2 OFF ON OFF OFFwith sign

s1�s2 ON OFF OFF #

s1�s2 # OFF # ON

16–bit datawithout sign

s1=s2 OFF ON OFF OFFwithout sign

s1�s2 # OFF # OFF

#: turns ON or OFF depending on the conditions

� Data Types

Variable Data Types

s1, s2 INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F60_CMP function. *)F60_CMP Var_0 (* s1 = Var_0 (source1) *)

Var_1 (* s2 = Var_1 (source2) *)(* s1 < s2; s1 = s2; s1 > s2 ? *)

ST out (* optional *)

�Note

The variables s1 and s2 have to be of the same data type.

16–bit data compareF60 (CMP) 5

Steps Availability

All 3

x: available–: not available

Page 377: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 78

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Compares the 32–bit data or 32–bit equivalent constant specified bys1 with one specified by s2 if the trigger EN is in the ON–state. Thecompare operation result is stored in special internal relays R9009,R900A to R900C.

Flag

Data comparisonbetween s1 and s2 R900A

(�flag)R900B(=flag)

R900C(�flag)

R9009(carry–flag)

s1�s2 OFF OFF ON #

32–bit datawith sign

s1=s2 OFF ON OFF OFFwith sign

s1�s2 ON OFF OFF #

s1�s2 # OFF # ON

32–bit datawithout sign

s1=s2 OFF ON OFF OFFwithout sign

s1�s2 # OFF # OFF

#: turns ON or OFF depending on the conditions

� Data Types

Variable Data Types

s1, s2 DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2 x x x x x x x x x

� Example

�Note

The variables s1 and s2 have to be of the same data type.

32–bit data compareF61 (DCMP) 9

Steps Availability

All 3

x: available–: not available

Page 378: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 79Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Compares the 16–bit equivalent constant or 16–bit data specified bys1 with the data band specified by s2 and s3, if the trigger EN is inthe ON–state. This instruction checks that s1 is in the data bandbetween s2 (lower limit) and s3 (higher limit), larger than s3, orsmaller than s2. The compare operation considers +/– sign. Sincethe BCD data is also treated as 16–bit data with sign, we recommendthe use of the BCD data within the range of 0 to 7999 to avoidconfusion. The compare operation result is stored in special internalrelays R900A, R900B, and R900C.

FlagComparison between

s1 , s2 and s3 R900A(�flag)

R900B(=flag)

R900C(�flag)

s1�s2 OFF OFF ON

s2�s1�s3 OFF ON OFF

s1�s3 ON OFF OFF

� Data Types

Variable Data Types

s1, s2, s3 INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2, s3 x x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F62_WIN function. *)

F62_WIN Var_0,Var_1 (* s1 = Var_0 (source1) *)Var_2 (* s2 = Var_1 (source2) *)

(* s3 = Var_2 (source3) *)(* s1 < s2; s2 ≤ s1 ≤ s3; s3 < s1; ? *)

ST out (* optional *)

�Note

The variables s1, s2 and s3 have to be of the same data type.

16–bit data band compareF62 (WIN) 7

Steps Availability

All 3

x: available–: not available

Page 379: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 80

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Compares the 32–bit equivalent constant or 32–bit data specified bys1 with the data band specified by s2 and s3, if the trigger EN is inthe ON–state. This instruction checks that s1 is in the data bandbetween s2 (lower limit) and s3 (higher limit), larger than s3, orsmaller than s2. The compare operation considers +/– sign. Sincethe BCD data is also treated as 16–bit data with sign, we recommendthe use of the BCD data within the range of 0 to 79999999 to avoidconfusion. The compare operation result is stored in special internalrelays R900A, R900B, and R900C.

FlagComparison between

s1 , s2 and s3 R900A(�flag)

R900B(=flag)

R900C(�flag)

s1�s2 OFF OFF ON

s2�s1�s3 OFF ON OFF

s1�s3 ON OFF OFF

� Data Types

Variable Data Types

s1, s2, s3 DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1, s2, s3 x x x x x x x x x

� Example

�Note

The variables s1, s2 and s3 have to be of the same data type.

32–bit data band compareF63 (DWIN) 13

Steps Availability

All 3

x: available–: not available

Page 380: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 81Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Compares the contents of data block specified by s2 with thecontents of data block specified by s3 according to the contentsspecified by s1 if the trigger EN is in the ON–state. The compareoperation result is stored in the special internal relay R900B. Whens2 = s3, the special internal relay is in the ON–state.

� Data Types

Variable Data Types

s1 WORD

s2, s3 INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1 x x x x x x x x x

s2, s3 x x x x x x x x x

� Example

s1= 1 0 0 4 hex A = Starting byte position of data blockspecified by s3

⇑ ⇑ ⇑ 1: Starting from higher byteA B C 0: Starting from lower byte

B = Starting byte position of data block specified by s2

1: Starting from higher byte0: Starting from lower byte

C = Number of bytes to be comparedrange: 01 hex to 99 hex (BCD)

� Example

LD start (* EN = start; Starting signal for the F64_BCMP func-tion. *)

F64_BCMP Var_0,Var_1 (* s1 = Var_0 (source1) *)Var_2 (* s2 = Var_1 (source2) *)

(* s3 = Var_2 (source3) *)ST out (* optional *)

�Note

The variables s2 and s3 have to be of the same data type.

Block data compareF64 (BCMP) 7

Steps Availability

All 3, except FP– C14/16and FP–M 0.9k

x: available–: not available

Page 381: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 82

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Executes AND operation of each bit in 16–bit equivalent constant or16–bit data specified by s1 and s2 if the trigger EN is in theON–state. The AND operation result is stored in the 16–bit areaspecified by d. When 16–bit equivalent constant is specified by s1or s2, the AND operation is performed internally converting it to16–bit binary expression. You can use this instruction to turn OFFcertain bits of the 16–bit data.

� Data Types

Variable Data Types

s1, s2, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s1, s2 and d have to be of the same data type.

16–bit data ANDF65 (WAN) 7

Steps Availability

All 3

x: available–: not available

Page 382: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 83Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Executes OR operation of each bit in 16–bit equivalent constant or16–bit data specified by s1 and s2 if the trigger EN is in theON–state. The OR operation result is stored in the 16–bit areaspecified by d. When 16–bit equivalent constant is specified by s1or s2, the OR operation is performed internally converting it to 16–bitbinary expression. You can use this instruction to turn ON certain bitsof the 16–bit data.

� Data Types

Variable Data Types

s1, s2, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F66_WOR function. *)

F66_WOR Var_0,Var_1 (* s1 = Var_0 (source1) *)Var_2 (* s2 = Var_1 (source2) *)

(* d = Var_2 (destination) *)(* s1 ODER s2 = d *)

ST out (* optional *)

�Note

The variables s1, s2 and d have to be of the same data type.

16–bit data ORF66 (WOR)7

Steps Availability

All 3

x: available–: not available

Page 383: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 84

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Executes exclusive OR operation of each bit in 16–bit equivalentconstant or 16–bit data specified by s1 and s2 if the trigger EN is inthe ON–state. The exclusive OR operation result is stored in the16–bit area specified by d. When 16–bit equivalent constant isspecified by s1 or s2, the exclusive OR operation is performedinternally converting it to 16–bit binary expression.You can use thisinstruction to review the number of identical bits in the two 16–bitdata.

� Data Types

Variable Data Types

s1, s2, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F67_XOR function. *)

F67_XOR Var_0,Var_1 (* s1 = Var_0 (source1) *)Var_2 (* s2 = Var_1 (source2) *)

(* d = Var_2 (destination) *)(* s1 XOR s2 = d *)

ST out (* optional *)

�Note

The variables s1, s2 and d have to be of the same data type.

16–bit data exclusive ORF67 (XOR) 7

Steps Availability

All 3

x: available–: not available

Page 384: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 85Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Executes exclusive NOR operation of each bit in 16–bit equivalentconstant or 16–bit data specified by s1 and s2 if the trigger EN is inthe ON–state. The exclusive NOR operation result is stored in the16–bit area specified by d. When 16–bit equivalent constant isspecified by s1 or s2, the exclusive NOR operation is performedinternally converting it to 16–bit binary expression. You can use thisinstruction to review the number of identical bits in the two 16–bitdata.

� Data Types

Variable Data Types

s1, s2, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s1, s2 and d have to be of the same data type.

16–bit data exclusive NORF68 (XNR) 7

Steps Availability

All 3

x: available–: not available

Page 385: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 86

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Calculates the Block Check Code (BCC) of s3 bytes of ASCII datastarting from the 16–bit area specified by s2 according to s1 if thetrigger EN is in the ON–state. The Block Check Code (BCC) is storedin the lower byte of the 16–bit area specified by d.s1 specifies the Block Check Code (BCC) calculation method usingdecimal data as follows:0: Addition1: Subtraction2: Exclusive OR operation10:Cyclic Redundancy Check (CRC) calculation (only FH10SH

from version 3.02 onwards)

� Data Types

Variable Data Types

s1, s3 INT

s2, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s3 x x x x x x x x x

s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F70_BCC function. *)

F70_BCC Var_0,Var_1Var_2,Var_3

(* s1 = Var_0 (source) *)(* (0 = ADD, 1 = SUB, 2 = XOR) *)(* Content e.g. 2 *)(* s2 = Var_1 (source) *)(* s3 = Var_2 (source) *)(* Content e.g. 12 *)(* d = Var_3 (destination) *)

ST out (* optional *)

Calculates the Block Check Code (BCC) of 12 bytes of ASCII data startingwith the content of Var_1 by exclusive OR operation if the trigger start is inthe ON–state. The Block Check Code (BCC) is stored in the lower byte ofVar_3.

�Note

The variables s2 and d have to be of the same data type.

Block check code calculationF70 (BCC) 9

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 386: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 87Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the data of s2 bytes starting from the 16–bit area specifiedby s1 to ASCII codes that express the equivalent hexadecimals if thetrigger EN is in the ON–state. The number of bytes to be convertedis specified by s2. The converted result is stored in the area startingwith the 16–bit area specified by d. ASCII code requires 8 bits (onebyte) to express one hexadecimal character. Upon conversion toASCII, the data length will thus be twice the length of the sourcedata.

� Data Types

Variable Data Types

s1 INT, WORD

s2 INT

d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1 x x x x x x x x x

s2 x x x x x x x x x

d – x x x x x x x x

� Example

HEX � ASCII conversionF71 (HEX2A) 7

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 387: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 88

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the ASCII codes that express the hexadecimal charactersstarting from the 16–bit area specified by s1 to hexadecimalnumbers if the trigger EN is in the ON–state. s2 specifies the numberof ASCII (number of characters) to be converted. The convertedresult is stored in the area starting from the 16–bit area specified byd. ASCII code requires 8 bits (one byte) to express one hexadecimalcharacter. Upon conversion to a hexadecimal number, the datalength will thus be half the length of the ASCII code source data.

� Data Types

Variable Data Types

s1 WORD

s2 INT

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1 x x x x x x x x x

s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F72_A2HEXfunction. *)

F72_A2HEX Var_0,Var_1Var_2 (* s1 = Var_0 (source1) *)(* s2 = Var_1 (source2) *)(* Content e.g. 4 *)(* d = Var_2 (destination) *)

ST out (* optional *)

Converts 4 ASCII codes starting with the content of Var_0 to hexadecimalnumbers if the trigger start is in the ON–state. The converted data is storedin Var_2.

ASCII � HEX conversionF72 (A2HEX) 7

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 388: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 89Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the BCD code starting from the 16–bit area specified by s1to the ASCII code that expresses the equivalent decimals accordingto the contents specified by s2 if the trigger EN is in the ON–state.s2 specifies the number of source data bytes and the direction ofconverted data (normal/reverse).

S2 = 16# � 0 0 �

1 Number of bytes for BCD data1: 1 byte (BCD code that expresses a 2-digit decimal)2: 2 byte (BCD code that expresses a 4-digit decimal)3: 3 byte (BCD code that expresses a 6-digit decimal)4: 4 byte (BCD code that expresses a 8-digit decimal)

2 Direction of converted data0: Normal direction1: Reverse direction

The converted result is stored in the area specified by d. ASCII coderequires 8 bits (one byte) to express one BCD character. Upon con-version to ASCII, the data length will thus be twice the length of theBCD source data.

� Data Types

Variable Data Types

s1 WORD

s2 INT, WORD

d WORD, ARRAY OF WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1 x x x x x x x x x

s2 x x x x x x x x x

d – x x x x x x x x

� Example

BCD � ASCII conversionF73 (BCD2A) 7

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 389: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 90

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the ASCII codes that express the decimal charactersstarting from the specified by s1 to BCD if the trigger EN is in theON–state. s2 specifies the number of source data bytes and thedirection of converted code source data.

S2 = 16# � 0 0 �

1 Number of bytes for ASCII character1: 1 byte (1 ASCII character)2: 2 byte (2 ASCII characters)3: 3 byte (3 ASCII characters)4: 4 byte (4 ASCII characters)5: 5 byte (5 ASCII characters)6: 6 byte (6 ASCII characters)7: 7 byte (7 ASCII characters)8: 8 byte (8 ASCII characters)

2 Direction converted data0: Normal direction1: Reverse direction

The converted result is stored in the area starting from the 16–bitarea specified by d. ASCII code requires 8 bits (1 byte) to express1 BCD character. Upon conversion to a BCD number, the data lengthwill thus be half the length of the ASCII code source data.

� Data Types

Variable Data Types

s1 WORD, ARRAY OF WORD

s2 INT, WORD

d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1 x x x x x x x x x

s2 x x x x x x x x x

d – x x x x x x x x

� next page

ASCII � BCD conversionF74 (A2BCD) 9

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 390: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 91Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Example

LD start (* EN = start; Starting signal for the F74_A2BCDfunction. *)

F74_A2BCD Var_0,Var_1Var_2 (* s1 = Var_0 (source1) *)(* s2 = Var_1 (source2) *)(* Content e.g. 16#0004 *)(* d = Var_2 (destination) *)

ST out (* optional *)

Converts 4 ASCII codes in normal direction starting with the content of Var_0to BCD data if the trigger start is in the ON–state. The converted data isstored in Var_2.

Page 391: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 92

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the 16–bit data specified by s1 to ASCII codes that expressthe equivalent decimals if the trigger EN is in the ON–state. s2specifies the length in bytes. The converted result is stored in thearea starting from the 16–bit area specified by d. In the destinationarea d, the data are stored starting with the highest byte and the digitorder of the source data s1 is reversed. When data is stored, a signdata is added at the head (–: 2DH; +: omitted) and unused destina-tion area d is filled with SPACE (20H).

� Data Types

Variable Data Types

s1 INT, WORD

s2 INT

d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1, s2 x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F75_BIN2Afunction. *)

F75_BIN2A Var_0,Var_1Var_2 (* s1 = Var_0 (source1) *)(* s2 = Var_1 (source2) *)(* Content e.g. 4 *)(* d = Var_2 (destination) *)

ST out (* optional *)

Converts the 16–bit data stored in Var_0 to 4 ASCII characters that expressthe equivalent decimals if the trigger start is in the ON–state. The converteddata is stored starting with Var_2.

16–bit BIN � ASCII conversionF75 (BIN2A) 7

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 392: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 93Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the ASCII codes that express the decimal characters start-ing from the 16–bit area specified by s1 to 16–bit data if the triggerEN is in the ON–state. s2 specifies the number of source data bytesto be converted using a decimal number. The converted result isstored in the area specified by d. The digital order of the source datais reversed and converted to 16–bit data.

� Data Types

Variable Data Types

s1 WORD

s2 INT

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1 x x x x x x x x x

s2 x x x x x x x x x

d – x x x x x x x x

� Example

ASCII � 16–bit BIN conversionF76 (A2BIN) 7

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 393: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 94

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the 32–bit data specified by s1 to ASCII codes that expressthe equivalent decimals if the trigger EN is in the ON–state. s2specifies the number of bytes used to express the destination datausing decimal. The converted result is stored in d. In the destinationarea d, the data are stored starting from the highest byte and the digitorder of the source data s1 is reversed. When data is stored, a signdata is added at the head (–: 2DH; +: omitted) and unuseddestination area d is filled with SPACE (20H).

� Data Types

Variable Data Types

s1 DINT, DWORD

s2 INT

d WORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s1 x x x x x x x x x

WX WY WR WL SV EV DT LD FLs2

x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F77_DBIN2Afunction. *)

F77_ Var_0,Var_1Var_2 (* s1 = Var_0 (source1) *)DBIN2A (* s2 = Var_1 (source2) *)

(* Content e.g. 10 *)(* d = Var_2 (destination) *)

ST out (* optional *)

Converts the 32–bit data starting with the content of Var_0 to 10 ASCII char-acters that express the equivalent decimals if the trigger start is in the ON–state. The converted data is stored starting with Var_2. If destination areais greater than necessary (10 characters, necessary are 8 characters) theunused destination area is filled with ASCII character 20H (SPACE). Afterexecution Var_2 contains 2020 H.

32–bit BIN � ASCIIconversionF77 (DBIN2A) 11

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 394: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 95Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the ASCII codes that express the decimal charactersstarting with the 16–bit area specified by s1 to 32–bit data if thetrigger EN is in the ON–state. s2 specifies the number of source databytes to be converted. The converted result is stored in d. You canadd a sign to ASCII codes. When data is plus, the sign can beomitted.

� Data Types

Variable Data Types

s1 WORD

s2 INT

d DINT, DWORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1 x x x x x x x x x

s2 x x x x x x x x x

DWX DWY DWR DWL DSV DEV DDT DLD DFLd

– x x x x x x x x

� Example

ASCII � 32–bit BINconversionF78 (DA2BIN)

11

Steps AvailabilityAll 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 395: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 96

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the 16–bit binary data specified by s to the BCD code thatexpresses 4–digit decimals if the trigger EN is in the ON–state. Theconverted data is stored in d. The binary data that can be convertedto BCD code are in the range of 0 (0 hex) to 9,999 (270F hex).

� Data Types

Variable Data Types

s INT, WORD

d INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F80_BCD function. *)F80_BCD Var_0, Var_1 (* s = Var_0 (source) *)

(* d = Var_1 (destination) *)ST out (* optional *)

16–bit BIN � 4–digit BCDconversionF80 (BCD)

5

Steps Availability

All 3

x: available–: not available

Page 396: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 97Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the BCD code that expresses 4–digit decimals specified bys to 16–bit binary data if the trigger EN is in the ON–state. Theconverted result is stored in the area specified by d.

� Data Types

Variable Data Types

s WORD

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x x x x x x x x

� Example

4–digit BCD � 16–bit BINconversionF81 (BIN) 5

Steps Availability

All 3

x: available–: not available

Page 397: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 98

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the 32–bit binary data specified by s to the BCD code thatexpresses 8–digit decimals if the trigger EN is in the ON–state. Theconverted result is stored in the area specified by d. The binary datathat can be converted to BCD code are in the range of 0 (0 hex) to99,999,999 (5F5E0FF hex).

� Data Types

Variable Data Types

s DINT, DWORD

d DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F82_DBCDfunction. *)

F82_DBCD Var_0,Var_1 (* s = Var_0 (source) *)(* d = Var_1 (destination) *)

ST out (* optional *)

32–bit BIN � 8–digit BCDconversionF82 (BCD) 7

Steps Availability

All 3

x: available–: not available

Page 398: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 99Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the BCD code that expresses 8–digit decimals specified bys to 32–bit binary data if the trigger EN is in the ON–state. Theconverted result is stored in the area specified by d.

� Data Types

Variable Data Types

s DWORD

d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

8–digit BCD � 32–bit BINconversionF83 (DBIN)

7

Steps Availability

All 3

x: available–: not available

Page 399: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 100

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Inverts each bit (0 or 1) of the 16–bit data specified by d if the triggerEN is in the ON–state. The inverted result is stored in the 16–bit areaspecified by d. This instruction is useful for controlling an external de-vice that uses negative logic operation.

� Data Types

Variable Data Types

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

� Example

16–bit data invert (one’scomplement)F84 (INV)

3

Steps Availability

All 3

x: available–: not available

Page 400: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 101Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Gets the two’s complement of 16–bit data specified by d if the triggerEN is in the ON–state. The two’s complement of the original 16–bitdata is stored in d. Two’s complement:A number system used to express positive and negative numbers inbinary. In this system, the number becomes negative if the most sig-nificant bit (MSB) of data is 1.The two’s complement is obtained by inverting all bits and adding 1to the inverted result. This instruction is useful for inverting the signof 16–bit data from positive to negative or from negative to positive.

� Data Types

Variable Data Types

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F85_NEG function. *)F85_NEG Var_0 (* d = Var_0 (destination) *)ST out (* optional *)

16–bit data two’s complementF85 (NEG)3

Steps Availability

All 3

x: available–: not available

Page 401: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 102

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Gets the two’s complement of 32–bit data specified by d if the triggerEN is in the ON–state. The two’s complement of the original 32–bitdata is stored in d. Two’s complement:A number system used to express positive and negative numbers inbinary. In this system, the number becomes negative if the most sig-nificant bit (MSB) of data is 1.The two’s complement is obtained by inverting all bits and adding 1to the inverted result. This instruction is useful for inverting the sign of 16–bit data frompositive to negative or from negative to positive.

� Data Types

Variable Data Types

d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

d – x x x x x x x x

� Example

32–bit data two’s complementF86 (DNEG) 3

Steps Availability

All 3

x: available–: not available

Page 402: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 103Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Gets the absolute value of 16–bit data with the sign specified by dif the trigger EN is in the ON–state. The absolute value of the 16–bitdata with +/– sign is stored in d. This instruction is useful to operatethe data whose sign (+/–) may vary.

� Data Types

Variable Data Types

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F87_ABS function. *)F87_ABS Var_0 (* d = Var_0 (destination) *)ST out (* optional *)

16–bit data absolute valueF87 (ABS) 3

Steps Availability

All 3

x: available–: not available

Page 403: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 104

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Gets the absolute value of 32–bit data with the sign specified by dif the trigger EN is in the ON–state. The absolute value of the 32–bitdata with sign is stored in d. This instruction is useful to operate thedata whose sign (+/–) may vary.

� Data Types

Variable Data Types

d DINT, DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

d – x x x x x x x x

� Example

32–bit data absolute valueF88 (DABS)3

Steps Availability

All 3

x: available–: not available

Page 404: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 105Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline F89 copies the sign bit of the specified 16–bit data to all the bits ofthe higher 16–bit area (extended 16–bit area).

� Data Types

Variables Data Types

s BOOL, INT

d DINT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s – x x x x x x x x

DWX DWY DWR DWL DSV DEV DDT DLD DFLd

– x x x x x x x x

� Example

· ·· ·Bit position · · · · ·Binary data

15 1211 8 7 4 3 0

R20: ON

Destination

Decimal data

· ·· · · · · · ·15

1

1211

1 1

8

1

7

1 1

4

1

3

1 0

0

Higher 16-bit area(extended 16-bit area)

Lower 16-bit area

DT1 DT0

· ·· ·Bit position · · · · ·Binary data

15

1

1211

1 1

8

1

7

1 1

4

1

3

1 0

0

Destination

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 sign extensionF89 (EXT) 3

Steps Availability

All 3

x: available–: not available

Page 405: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 106

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Decodes the contents of 16–bit data specified by s according to thecontents of n if the trigger EN is in the ON–state. The decoded resultis stored in the area starting with the 16–bit area specified by d.n specifies the starting bit position and the number of bits to bedecoded using hexadecimal data:Bit No. 0 to 3:number of bits to be decodedBit No. 8 to 11:starting bit position to be decoded(The bits No. 4 through No. 7 and No. 12 through No. 15 are invalid.)

Relationship between number of bits and occupied data area fordecoded result:

Number of bits to bedecoded

Data area requiredfor the result

Valid bits in the areafor the result

1 1-word 2-bit*

2 1-word 4-bit*

3 1-word 8-bit*

4 1-word 16-bit

5 2-word 32-bit

6 4-word 64-bit

7 8-word 128-bit

8 16-word 256-bit

*Invalid bits in the data area required for the result are set to 0.

� Data Types

Variable Data Types

s, n, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s, n x x x x x x x x x

d – x x x x x x x x

� next page

DecodeF90 (DECO) 7

Steps Availability

All 3

x: available–: not available

Page 406: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 107Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Example

�Note

The variables s, n and d have to be of the same data type.

Page 407: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 108

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the 16–bit equivalent constant or 16–bit data specified bys to 4–digit data for 7–segment indication if the trigger EN is in theON–state. The converted data is stored in the area starting with the16–bit area specified by d. The data for 7–segment indicationoccupies 8 bits (1 byte) to express 1 digit.

7–segment conversion table:

One digit data to beconverted

8-bit data for 7-seg-ment indication 7-segment Organization

of 7-segmentHexadecimal Binary g f e d c b a

indication of 7-segmentindication

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 0 0 1 1

H3 0 0 1 1 0 1 0 0 1 1 1 1

H4 0 1 0 0 0 1 1 0 0 1 1 0

H5 0 1 0 1 0 1 1 0 1 1 0 1a

H6 0 1 1 0 0 1 1 1 1 1 0 1

a

H7 0 1 1 1 0 0 1 0 0 1 1 1bf g

H8 1 0 0 0 0 1 1 1 1 1 1 1 ce

H9 1 0 0 1 0 1 1 0 1 1 1 1

ce

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

HC 1 1 0 0 0 0 1 1 1 0 0 0

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

� Data Types

Variable Data Types

s INT, WORD

d DINT, DWORD

� next page

16–bit data 7–segment decodeF91 (SEGT)5

Steps Availability

All 3

Page 408: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 109Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

DWX DWY DWR DWL DSV DEV DDT DLD DFLd

– x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F91_SEGT function. *)

F91_SEGT Var_0,Var_1 (* s = Var_0 (source) *)(* d = Var_1 (destination) *)

ST out (* optional *)

x: available–: not available

Page 409: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 110

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Encodes the contents of data specified by s according to the con-tents of n if the trigger EN is in the ON–state. The encoded result isstored in the 16–bit area specified by d starting with the specified bitposition. Invalid bits in the area specified for the encoded result areset to 0. n specifies the starting bit position of destination data d andthe number of bits to be decoded using hexadecimal data:Bit No. 0 to 3:number of bits to be encodedBit No. 8 to 11:starting bit position of destination data to be encoded(The bits No. 4 through No. 7 and No. 12 through No. 15 are invalid.)

� Data Types

Variable Data Types

s, n, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

n x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s, n and d have to be of the same data type.

EncodeF92 (ENCO) 7

Steps Availability

All 3

x: available–: not available

Page 410: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 111Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Extracts each lower 4 bits (bit position 0 to 3) starting with the 16–bitarea specified by s and combines the extracted data into 1 word ifthe trigger EN is in the ON–state.. The result is stored in the 16–bitarea specified by d. n specifies the number of data to be extractedThe range of n is 0 to 4.

The programming example provided below can be envisioned thus:

· ·· ·Bit position · · · · ·

Array[0] at s

15

0 0 0

12

0

11

0 0 0

8

0

7

0 0 0

4

0

3

0 0 0

0

1

start: ON

Destination

Source

Array[1] at s

Array[2] at s 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 · · · · ·

value at d

15

0 0 0

12

0

11

0 1 0

8

0

7

0 0 1

4

0

3

0 0 0

0

1

Bit positions 12 to 15 are filled with 0s.

� Data Types

Variable Data Types

s, d WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

n x x x x x x x x x

d – x x x x x x x x

� Example

In this example the function F93_UNIT is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

16–bit data combineF93 (UNIT)7

Steps Availability

All 3

x: available–: not available

Page 411: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 112

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

POU Header

In the POU header, all input and output variables are declared that are usedfor programming this function.

Body

When the variable start is set to TRUE, the function is carried out. The binaryvalues in the illustration on the previous page serve as the array values indata_input. In this example, variables are declared in the POU header. Ho-wever, you may assign constants directly at the input function’s contact pinsinstead.

LD Body

In this example, the view icon was activated so you can see the results im-mediately.

IL Body

�Note

The following error flags apply to F/P93:

No. IEC Address set if

R9007 %MX0.900.7 permanently –the area specified using the index modifier

R9008 %MX0.900.8 for an instantexceeds the limit

–the value at n � 5

Page 412: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 113Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Divides the 16–bit data specified by s into 4–bit units and distributesthe divided data into the lower 4 bits (bit position 0 to 3) of 16–bitareas starting with d if the trigger EN is in the ON–state. n specifiesthe number of data to be divided. The range of n is 0 to 4). When 0is specified by n, this instruction is not executed.

The programming example provided below can be envisioned thus:

Array[1] at d

· ·· ·Bit position · · · · ·

Array[0] at d

15

0 0 0

12

0

11

0 0 0

8

0

7

0 0 0

4

0

3

0 0 0

0

0

X0: ONDestination

Source

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

· ·· ·Bit position · · · · ·

value at s

15

0 1 1

12

1

11

0 0 1

8

1

7

0 0 0

4

1

3

0 0 0

0

0

n: 4

Array[2] at d 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

Array[3] at d 0 0 0 0 0 0 0 0 0 0 0 0 0 1

1

11

� Data Types

Variable Data Types

s, d WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s, n x x x x x x x x x

d – x x x x x x x x

� Example

In this example the function F94_DIST is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

16–bit data distributionF94 (DIST) 7

Steps Availability

All 3

x: available–: not available

Page 413: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 114

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

POU Header

In the POU header, all input and output variables are declared that are usedfor programming this function.

Body

When the variable start is set to TRUE, the function is carried out. The binaryvalues in the illustration on the previous page serve as the values calculated.In this example, variables are declared in the POU header. Also, a constantvalue of 4 is assigned directly at the contact pin for n.

LD Body

In this example, the view icon was activated so you can see the results im-mediately.

� next page

Page 414: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 115Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

IL Body

Activating the Monitor Header window (Monitor � Monitor Header) while on-line also allows you to see results immediately.

�Note

The following error flags apply to F/P94:

No. IEC Address set if

R9007 %MX0.900.7 permanently –the area specified using the index modifierexceeds the limit

R9008 %MX0.900.8 for an instant –the value at n � 5

–the last area for the result exceeds the limit

Page 415: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 116

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the character constants specified by s to ASCII codes if thetrigger EN is in the ON–state. The converted ASCII codes are storedin six 16–bit areas starting with the 16–bit area specified by d.

� Data Types

Variable Data Types

s STRING (12)

d INT, WORD

� Notes

� The output d is the start address for an Array [0..5] of INTor WORD (e. g. arrayname[0]).

� If character constant s is an empty character string (thismeans s = ’’) 12 x 20 hex will be written into the destinationarea d. 20 hex is the ASCII–code for space.

� If the number of character constants specified by s is lessthan 12 (e. g. s = ‘12345’), the ASCII code 20 hex (SPACE)is stored in the destination area d (e. g. d = ’32 31 34 33 20 3520 20 20 20 20 20’).

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s – – – – – – – – –

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F95_ASC function. *)F95_ASC ’ABCDEFGH’, (* s = ’ABCDEFGH’ *)

Var_0[0] (* d = Var_0[0] (destination) *)(* Var_0[0] start address for an ARRAY [0..n] of WORD *)(* The content of n must be at least 5 *)(* 0 to 5 are six 16–bit areas! *)

ST out (* option *)

Character � ASCII transferF95 (ASC) 15

Steps AvailabilityAll 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 416: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 117Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Searches the value that is the same as s1 in the block of 16–bit areasspecified by s2 (starting area) through s3 (ending area) if the triggerEN is in the ON–state. When the search operation is performed, thesearching results are stored as follows: The number of data that is the same as s1 is transferred to specialdata register DT9037 (DT90037 for FP10/10S). The position the data is first found in, counting from the starting16–bit area, is transferred to special data register DT9038 (DT90038for FP10/10S). Be sure that s2 ≤ s3.

� Data Types

Variable Data Types

s1, s2, s3 INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1 x x x x x x x x x

s2, s3 – x x x x x x x x

� Example

�Note

The variables s1, s2 and s3 have to be of the same data type.

Table data search(16–bit search)F96 (SRC) 7

Steps Availability

All 3

x: available–: not available

Page 417: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 118

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Shifts n bits of 16–bit data area specified at d to the right (to the lowerbit position) if the trigger EN is in the ON–state. When n bits areshifted to the right, the data in the nth bit is transferred to specialinternal relay R9009 (carry–flag) and the higher n bits of the 16–bitdata area specified by d are filled with 0s.

� Data Types

Variable Data Types

d INT, WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

n x x x x x x x x x

� Example

Right shift of 16–bit data inbit unitsF100 (SHR)

5

Steps Availability

All 3

x: available–: not available

Page 418: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 119Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Shifts n bits of 16–bit data area specified at d to the left (to the higherbit position) if the trigger EN is in the ON–state. When n bits areshifted to the left, the data in the nth bit is transferred to specialinternal relay R9009 (carry–flag) and n bits starting with bit position0 are filled with 0s.

� Data Types

Variable Data Types

d INT, WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

n x x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F101_SHL function. *)F101_SHL Var_1,Var (* d = Var_0 (destination) *)

_0 (* n = Var_1 (number of bits shifted to the left) *)ST out (* option *)

Left shift of 16–bit data inbit unitsF101 (SHL)

5

Steps Availability

All 3

x: available–: not available

Page 419: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 120

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Shifts one hexadecimal digit (4 bits) of the 16–bit area specified byd to the right (to the lower digit position) if the trigger EN is in theON–state. When one hexadecimal digit (4 bits) is shifted to the right,

• hexadecimal digit position 0 (bit position 0 to 3) of the dataspecified by d is shifted out and is transferred to the lower digit(bit position 0 to 3) of special data register DT9014) and

• hexadecimal digit position 3 (bit position 12 to 15) of the 16–bitarea specified by d becomes 0.

This instruction is useful when the hexadecimal or BCD data istreated.

� Data Types

Variable Data Types

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

� Example

Right shift of one hexadecimaldigit (4 bits) of 16–bit dataF105 (BSR)

3

Steps Availability

All 3

x: available–: not available

Page 420: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 121Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Shifts one hexadecimal digit (4 bits) of the 16–bit area specified byd to the left (to the higher digit position) if the trigger EN is in theON–state. When one hexadecimal digit (4 bits) is shifted to the left,

• hexadecimal digit position 3 (bit position 12 to 15) of the dataspecified by d is shifted out and is transferred to the lower digit(bit position 0 to 3) of special data register DT9014 (DT90014for FP10/10S).

• hexadecimal digit position 0 (bit position 0 to 3) of the 16–bitarea specified by d becomes 0.

This instruction is useful when the hexadecimal or BCD data istreated.

� Data Types

Variable Data Types

d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F106_BSL function. *)F106_BSL Var_0 (* d = Var_0 (destination) *)ST out (* optional *)

Left shift of one hexadecimaldigit (4 bits) of 16–bit dataF106 (BSL) 3

Steps Availability

All 3

x: available–: not available

Page 421: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 122

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Shifts one word (16 bits) of the data range specified by d1 (starting)and d2 (ending) to the right (to the lower word address) if the triggerEN is in the ON–state. When one word (16 bits) is shifted to the right,

• the starting word is shifted out

• the data in the ending word becomes 0

d1 and d2 should be:

• in the same operand

• d1 ≤ d2

� Data Types

Variable Data Types

d1, d2 INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d1, d2 – x x x x x x x x

� Example

�Note

The variables d1 and d2 have to be of the same data type.

Right shift of one word (16bits) of 16–bit data rangeF110 (WSHR)

5

Steps Availability

All 3

x: available–: not available

Page 422: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 123Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Shifts one word (16 bits) of the data range specified by d1 (starting)and d2 (ending) to the left (to the higher word address) if the triggerEN is in the ON–state. When one word (16 bits) is shifted to the left,

• the ending word is shifted out

• the data in the starting word becomes 0

d1 and d2 should be:

• in the same operand

• d1 ≤ d2

� Data Types

Variable Data types

d1, d2 INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d1, d2 – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F111_WSHL function. *)F111_WSHL Var_0,Var (* d1 = Var_0 (destination1) *)

_1 (* d2 = Var_1 (destination2) *)ST out (* optional *)

�Note

The variables d1 and d2 have to be of the same data type.

Left shift of one word (16bits) of 16–bit data rangeF111 (WSHL) 5

Steps Availability

All 3

x: available–: not available

Page 423: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 124

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Shifts one hexadecimal digit (4 bits) of the data range specified byd1 (starting) and d2 (ending) to the right (to the lower digit position)if the trigger EN is in the ON–state. When one hexadecimal digit (4bits) is shifted to the right,

• the data in the lower hexadecimal digit (bit position 0 to 3) ofthe 16–bit data specified by d1 is shifted out

• the data in the higher hexadecimal digit (bit position 12 to 15)of the 16–bit data specified by d2 becomes 0

d1 and d2 should be:

• in the same operand

• d1 ≤ d2

� Data Types

Variable Data Types

d1, d2 INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d1, d2 – x x x x x x x x

� Example

�Note

The variables d1 and d2 have to be of the same data type.

Right shift of one hex. digit(4 bits) of 16–bit data rangeF112 (WBSR)

5

Steps Availability

All 3

x: available–: not available

Page 424: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 125Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Shifts one hexadecimal digit (4 bits) of the data range specified byd1 (starting) and d2 (ending) to the left (to the higher digit position)if the trigger EN is in the ON–state. When one hexadecimal digit (4bits) is shifted to the left,

• the data in the higher hexadecimal digit (bit position 12 to 15)of the 16–bit data specified by d2 is shifted out.

• the data in the lower hexadecimal digit (bit position 0 to 3) ofthe 16–bit data specified by d1 becomes 0.

d1 and d2 should be:

• in the same operand

• d1 ≤ d2

� Data Types

Variable Data Types

d1, d2 INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d1, d2 – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F113_WBSL function. *)

F113_WBSL Var_0,Var_ (* d1 = Var_0 (destination1) *)1 (* d2 = Var_1 (destination2) *)

ST out (* optional *)

�Note

The variables d1 and d2 have to be of the same data type.

Left shift of one hex. digit (4 bits) of 16–bit data rangeF113 (WBSL)

5

Steps Availability

All 3

x: available–: not available

Page 425: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 126

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline

UD_Trig: DOWN counting if the trigger is in the OFF state.UP counting if the trigger is in the ON state.

Cnt_Trig: Adds or subtracts one count at the leading edge of thistrigger.

Rst_Trig: The condition is reset when this signal is on.The area for the elapsed value d becomes 0 when theleading edge of the trigger is detected (OFF –> ON).The value in s is transferred to d when the trailing edge ofthe trigger is detected (ON –>s OFF).

s: Preset (Set) value or area for Preset (Set) value.d: Area for count (elapsed) value.

� Data Types

Variable Data Types

UD_Trig, Cnt_Trig, Rst_Trig BOOL

s, d INT, WORD

� Operands

Relais T/C RegisterFor

X Y R L T C DT LD FL

UD_Trig,Cnt_Trig,Rst_Trig

x x x x x x – – –

WX WY WR WL SV EV DT LD FLs

x x x x x x x x x

d – x x x x x x x x

� Example

�Note

The variables s and d have to be of the same data type.

Up/Down CounterF118 (UCD) 5

Steps Availability

All 3

x: available–: not available

Page 426: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 127Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline

LR_trig: Left/right trigger; specifies the direction of the shift–out.LR_trig = ON: shifting out to the left, LR_trig = OFF:shifting out to the right.

DataInp: Specifies the new shift–in data. New shift–in data = 1:when the data input is in the ON–state. New shift–in data= 0: when the data input is in the OFF–state.

Sh_trig: Shifts 1 bit to the left or right when the leading edge ofthe trigger is detected (OFF → ON).

Rst_trig: Turns all the bits of the data range specified by d1 andd2 to 0 if this trigger is in the ON–state.

d1: Start of 16 bit area.d2: End of 16 bit area.Carry: Shifted–out bit.

� Data Types

Variable Data Types

LR_trig, DataInp, Sh_trig,Rst_trig, Carry

BOOL

d1, d2 INT, WORD

� Operands

Relay T/C RegisterFor

X Y R L T C DT LD FL

LR_trig,DataInp,Sh_trig,Rst_trig

x x x x x x – – –

Carry – x x x x x – – –

WX WY WR WL SV EV DT LD FLd1, d2

– x x x x x x x x

LEFT/RIGHT shift registerF119 (LRSR) 5

Steps Availability

All 3

x: available–: not available

Page 427: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 128

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Example

�Note

The variables d1 and d2 have to be of the same data type.

Page 428: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 129Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Rotates n bits of the 16–bit data specified by d to the right if thetrigger EN is in the ON–state. When n bits are rotated to the right,

• the data in bit position n–1 (nth bit starting from bit position 0)is transferred to the special internal relay R9009 (carry–flag)

• n bits starting from bit position 0 are shifted out to the right andinto the higher bit positions of the 16–bit data specified by d.

� Data Types

Variable Data Types

d INT, WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

n x x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F120_ROR function. *)F120_ROR Var_0,Var_ (* d = Var_0 *)

1 (* n = Var_1 *)ST out (* optional *)

16–bit data right rotateF120 (ROR) 5

Steps Availability

All 3

x: available–: not available

Page 429: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 130

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Rotates n bits of the 16–bit data specified by d to the left if the triggerEN is in the ON–state. When n bits are rotated to the left,

• the data in bit position 16–n (nth bit starting from bit position15) is transferred to special internal relay R9009 (carry–flag)

• n bits starting from bit position 15 are shifted out to the left andinto the lower bit positions of the 16–bit data specified by d.

� Data Types

Variable Data Types

d INT, WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

n x x x x x x x x x

� Example

16–bit data left rotateF121 (ROL) 5

Steps Availability

All 3

x: available–: not available

Page 430: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 131Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Rotates n bits of the 16–bit data specified by d including the data ofcarry–flag to the right if the trigger EN is in the ON–state. When n bitswith carry–flag data are rotated to the right,

• the data in bit position n–1 (nth bit starting from bit position 0)are transferred to special internal relay R9009 (carry–flag)

• n bits starting from bit position 0 are shifted out to the right andcarry–flag data and n–1 bits starting from bit position 0 aresubsequently shifted into the higher bit positions of the 16–bitdata specified by d.

� Data Types

Variable Data Types

d INT, WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

n x x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F122_RCR function. *)

F122_RCR Var_0,Var_1 (* d = Var_0 *)(* n = Var_1 *)

ST out (* optional *)

16–bit data right rotatewith carry–flag dataF122 (RCR)

5

Steps Availability

All 3

x: available–: not available

Page 431: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 132

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Rotates n bits of the 16–bit data specified by d including the data ofcarry–flag to the left if the trigger EN is in the ON–state. When n bitswith carry–flag data are rotated to the left,

• the data in bit position 16–n (nth bit starting from bit position15) is transferred to special internal relay R9009 (carry–flag).

• n bits starting from bit position 15 are shifted out to the left andcarry–flag data and n–1 bits starting from bit position 15 areshifted into lower bit positions of the 16–bit data specified byd.

� Data Types

Variable Data Types

d INT, WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

n x x x x x x x x x

� Example

16–bit data left rotate withcarry–flag dataF123 (RCL) 5

Steps Availability

All 3

x: available–: not available

Page 432: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 133Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Turns ON the bit specified by the bit position at n of the 16–bit dataspecified by d if the trigger EN is in the ON–state. Bits other than thebit specified do not change. The range of n is 0 to 15.

� Data Types

Variable Data Types

d INT, WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

n x x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F130_BTS function. *)

F130_BTS word1, bit_number (* d = word1 *)(* n = bit_number *)

ST out (* optional *)

16–bit data bit setF130 (BTS) 5

Steps Availability

All 3

x: available–: not available

Page 433: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 134

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Turns OFF the bit specified by the bit position at n of the 16–bit dataspecified by d if the trigger EN is in the ON–state. Bits other than thebit specified do not change. The range of n is 0 to 15.

� Data Types

Variable Data Types

d INT, WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

n x x x x x x x x x

� Example

16–bit data bit resetF131 (BTR)5

Steps Availability

All 3

x: available–: not available

Page 434: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 135Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Inverts [1 (ON) → 0 (OFF) or 0 (OFF) → 1 (ON)] the bit at bit positionn in the 16–bit data area specified by d if the trigger EN is in theON–state. Bits other than the bit specified do not change. The rangeof n is 0 to 15.

� Data Types

Variable Data Types

d INT, WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

n x x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F132_BTI function. *)

F132_BTI Var_0,Var_1 (* d = Var_0 *)(* n = Var_1 *)

ST out (* optional *)

16–bit data bit invertF132 (BTI)5

Steps Availability

All 3

x: available–: not available

Page 435: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 136

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Checks the state [1 (ON) or 0 (OFF)] of bit position n in the 16–bitdata specified by d if the trigger EN is in the ON–state. The specifiedbit is checked by special internal relay R900B.

• When specified bit is 0 (OFF), special internal relay R900B(=flag) turns ON.

• When specified bit is 1 (ON), special internal relay R900B(=flag) turns OFF.

n specifies the bit position to be checked in decimal data. Range ofn: 0 to 15

� Data Types

Variable Data Types

d INT, WORD

n INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

d – x x x x x x x x

n x x x x x x x x x

� Example

16–bit data testF133 (BTT) 5

Steps Availability

All 3

x: available–: not available

Page 436: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 137Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Counts the number of bits in the ON state (1) in the 16–bit dataspecified by s if the trigger EN is in the ON–state. The number of 1(ON) bits is stored in the 16–bit area specified by d.

� Data Types

Variable Data Types

s INT, WORD

d INT

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s – x x x x x x x x

d x x x x x x x x x

� Example

Number of ON bits in16–bit dataF135 (BCU)

5

Steps Availability

All 3

x: available–: not available

Page 437: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 138

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Counts the number of bits in the ON state (1) in the 32–bit dataspecified by s if the trigger EN is in the ON–state. The number of 1(ON) bits is stored in the 16–bit area specified by d.

� Data Types

Variable Data Types

s DINT, DWORD

d INT

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

WX WY WR WL SV EV DT LD FLd

– x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F136_DBCUfunction. *)

F136_DBCU Var_0,Var_1 (* s = Var_0 (source) *)(* d = Var_1 (destination) *)

ST out (* optional *)

Number of ON bits in32–bit dataF136 (DBCU) 7

Steps Availability

All 3

x: available–: not available

Page 438: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 139Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The auxiliary timer instruction F137 (STMR) is a down type timer.The formula of the timer–set time is 0.01 sec. * set value s (time canbe set from 0.01 to 327.67 sec.). If you use the special internal relayR900D as the timer contact, be sure to program it at the addressimmediately after the instruction.Timer operation:

• If the trigger EN of the auxiliary timer instruction (STMR) is inthe ON–state, the constant or value specified by s istransferred to the area specified by d.

• During the timing operation, the time is subtracted from thevalue in the area specified by d.

• The output ENO turns ON when the value in the area specifiedby d becomes 0.

� Data Types

Variable Data Types

s, d INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x x x x x x x x

� Example

�Notes

� The variables s and d have to be the same data type.� This function cannot be used in a function block.� Each timer used has to have its own constant Num*.

System registers 5 and 6 determine the Num* addressesavailable.The timer functions TM_1s, TM_100ms, TM_10ms andTM_1s use the same Num* address area.

Auxiliary timer (sets the ON–delay timer for 0.01s units)F137(STMR) 5

Steps Availability

FP0, FP1–C56/C72 andFP–M 2.7k/5k

x: available–: not available

Page 439: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 140

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the hours, minutes, and seconds data stored in the 32–bitarea specified by s to seconds data if the trigger EN is in theON–state. The converted seconds data is stored in the 32–bit areaspecified by d. All hours, minutes, and seconds data to convert andthe converted seconds data is BCD. The max. data input value is9,999 hours, 59 minutes and 59 seconds, which will be converted to35,999,999 seconds in BCD format.

� Data Types

Variable Data Types

s, d DWORD

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

h:min:s � s conversionF138 (HMSS) 7

Steps AvailabilityFP1–C24/40,FP1–C56/72 and FP–M 2.7k/5k

x: available–: not available

Page 440: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 141Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts the second data stored in the 32–bit area specified by s tohours, minutes, and seconds data if the trigger EN is in the ON–state. The converted hours, minutes, and seconds data is stored inthe 32–bit area specified by d. The seconds prior to conversion andthe hours, minutes, and seconds after conversion are all BCD data.The maximum data input value is 35,999,999 seconds, which isconverted to 9,999 hours, 59 minutes and 59 seconds.

� Data Types

Variable Data Types

s, d DWORD

� Operands

Relais T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

LD start (* EN = start; Starting signal for the F139_SHMS function. *)

F139_SHMS Var_0,Var_ (* s = Var_0 (source) *)1 (* d = Var_1 (destination) *)

ST out (* optional *)

s � h:min:s conversionF139 (SHMS) 5

Steps Availability

FP1–C24/40,FP1–C56/72and FP–M 2.7k/5k

x: available–: not available

Page 441: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 142

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Special internal relay R9009 (carry–flag) goes ON if the trigger ENis in the ON–state. This instruction can be used to control data usingcarry–flag R9009 (e.g. F122_RCR and F123_RCL instructions).

� Example

Carry–flag setF140 (STC) 1

Steps Availability

All 3, except FP1– C14/16and FP–M 0.9k

Page 442: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 143Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Special internal relay R9009 (carry–flag) goes OFF if the trigger ENis in the ON–state. This instruction can be used to control data usingcarry–flag R9009 (e.g. F122_RCR and F123_RCL instructions).

� Example

LD start (* EN = start; Starting signal for the F141_CLC function. *)F141_CLCST out (* optional *)

Carry–flag resetF141 (CLC) 1

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

Page 443: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 144

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Updates the inputs or outputs specified by d1 and d2 immediatelyafter the trigger EN is in the ON–state even in the program executionstage. Using this instruction, you can update inputs or outputswithout the time–lag caused by scanning. Specify the word addressas 0 ≤ d1 ≤ d2 ≤ 127. The partial I/O update instruction is executedonly for the I/O units on the master backplane or expansionbackplane. It is not executed for the I/O unit in the slave station ofthe Remote I/O System.

� Data Types

Variable Data Types

d1, d2 INT, WORD

� Operands

Relay T/C RegisterFor

WX(1) WY(1) WR WL SV EV DT LD FL

d1 x x x x x x x x x

d2 x x x x x x x x x

� Example

�Note

If variables are used for the inputs d1 and d2 then NAiSControl internally uses index registers.

Partial I/O updateF143 (IORF) 1

Steps Availability

All 3, except FP1–C14/16

x: available–: not available

Page 444: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 145Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline

• Based on bytes specified by n, the data of the data area (register)which follows the DT specified by s is transmitted from the RS232Cport. (Set n so that it may not exceed maximum of data register.)

• You cannot use the first word of the transmission source to set thetransmission bytes (n). The transmission bytes (n) decrease one byone at every transmission. When the transmission is completed, thetransmission bytes become 0 and the end–of–transmission flag(R9039) turns ON.

• The first word of the transmission source data area (register) isregarded the transmission bytes.

• Set 2 (for general port) to system register No. 412 to execute theF144 (TRNS) instruction.

• You can set the transmission baudrate and protocol by systemregister No. 413, 414.

• Header and terminator are automatically added to the transmissiondata.

• R9039 is OFF during transmission, it is in the ON–state after the endof transmission.

• The executing of F144 (TRNS) instruction clears the receiving endflag and receiving pointer, and starts the receiving process.

• When the transmission bytes are at 0, execution of the F144 (TRNS)instruction clears the receiving end flag and receiving pointer, andstarts the receiving process without performing the transmissionprocess. Use F144 (TRNS) instruction in this state when youexclusively receive repeat data.

� Data Types

Variable Data Types

s WORD

n INT, WORD

Serial communication(RS232C)F144 (TRNS) 5

Steps Availability

C types of FP0 and FP1–C24/40–C56/72, FP–M5k

Page 445: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 146

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s – – – – – – x – –

n x x x – x x x x x

� Example

LD start (* EN = start; Starting signal for the F144_TRNSfunction. *)

F144_TRNS Var_0,Var_1 (* s = Var_0 *)(* n = Var_1 *)

ST out (* optional *)

x: available–: not available

Page 446: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 147Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Outputs the ASCII codes for 12 characters stored in the 6–word areaspecified by s via the word external output relay specified by d if thetrigger EN is in the ON–state. If a printer is connected to the outputspecified by d, a character corresponding to the output ASCII codeis printed. Only bit positions 0 to 8 of d are used in the actual printout.ASCII code is output in sequence starting with the lower byte of thestarting area. Three scans are required for 1 character constantoutput. Therefore, 37 scans are required until all charactersconstants are output. Since it is not possible to execute multipleF147 (PR) instructions in one scan, use print–out flag R9033 to besure they are not executed simultaneously. If the characterconstants convert to ASCII code, use of the F95_ASC instruction isrecommended.

� Data Types

Variable Data Types

s INT, WORD

d WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s x x x x x x x x x

d – x – – – – – – –

� Example

Parallel printoutF147 (PR)5

Steps AvailabilityFP0 + TR–Types ofFP1–C24/40–C56/72,FP–M2.7k/5k

x: available–: not available

Page 447: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 148

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The error No. specified by n* is placed into special data registerDT9000 (DT90000 for FP10/10S). At the same time, theself–diagnostic error–flag R9000 is set and ERROR LED on the CPUis turned ON. The contents of the error–flag R9000 can be read andchecked using NAiS Control (Monitor → Display Special Relays→ Error Flag). The error No., special data register DT9000(DT90000 for FP10/10S), can be read and checked using NAiSControl (Monitor → Display Special Registers → Basic ErrorMessages). When n* = 0, the error is reset. (only for operationcontinue errors, n* = 200 to 299.) The ERROR LED is turned OFFand the contents of special data register DT9000 (DT90000 forFP10/10S) are cleared with 0. When n* = 100 to 199, the operationis halted. When n* = 200 to 299, the operation is continued. Flag condition:

• Error–flag (R9007): Turns ON and keeps the ON state whenthe n exceeds the limit.

• Error–flag (R9008): Turns ON for an instant when the nexceeds the limit.

� Data Types

Variable Data Types

n* INT, WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

n* – – – – – – – – –

� Example

LD start (* EN = start; Starting signal for the F148_ERR function. *)F148_ERR 100 (* n* = 100 *)ST out (* optional *)

Self–diagnostic error setF148 (ERR) 3

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 448: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 149Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline This instruction is used for displaying the message on the FPProgrammer II screen. After executing F149 (MSG) instruction, youcan see the message specified by s on the FP Programmer IIscreen. When the F149 (MSG) instruction is executed, themessage–flag R9026 is set and the message specified by s is setin special data registers DT9030 to DT9035 (DT90030 to DT90035for FP10/10S). Once the message is set in special data registers, themessage can’t be changed even if the F149 (MSG) instruction isexecuted again. You can clear the message with the FP ProgrammerII.

� Data Types

Variable Data Types

s STRING(12)

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s – – – – – – – – –

� Example

Message displayF149 (MSG) 13

Steps Availability

All 3, except FP1–C14/16 and FP–M 0.9k

x: available–: not available

Page 449: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 150

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The date/clock data (3 words) specified by s1 and the time data (2words) specified by s2 are added together if the trigger EN is in theON–state. The result is stored in the area (3 words, same format ass1) specified by d. All the data used in the F157 (CADD) instructionare handled in form of BCD.

� Example Clock/calendar data:

August 1, 1992 Time: 14:23:31 (hour:minutes:seconds)

s1[1]: 2331 hex (minutes/seconds)s1[2]: 0114 hex (day/hour)s1[3]: 9208 hex (year/month)

Time data:32 hours; 50 minutes; and 45 seconds

s2 lower byte: 5045 hex (minutes/seconds)s2 higher byte: 0032 hex (32 hours)

You cannot specify special data registers DT9054 to DT9056 (DT90054 toDT90056 for FP10/10S) for the operand d. These registers store built–in ca-lendar timer values. To change the built–in calendar timer value, first storethe added result in other memory areas and transfer them to the special dataregisters using the F0_MV instruction.

� Data Types

Variable Data Types

s1, d ARRAY [1..3] OF WORD

s2 DWORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1 x x x x x x x x x

d – x x x x x x x x

DWX DWY DWR DWL DSV DEV DDT DLD DFLs2

x x x x x x x x x

� Example

Time additionF157 (CADD) 9

Steps Availability

FP1– C24/40, FP1–C56/72, FP–M 2.7k/5k

x: available–: not available

Page 450: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 151Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Subtracts time data (2 words) specified by s2 from the date/clockdata (3 words) specified by s1 if the trigger EN is in the ON–state.The result is stored in the area (3 words, same format than s1) speci-fied by d. All the data used in the F158 (CSUB) instruction are han-dled in form of BCD.

� Example Clock/calendar data:

August 1, 1992 Time: 14:23:31 (hour:minutes:seconds)

s1[1]: 2331 hex (minutes/seconds)s1[2]: 0114 hex (day/hour)s1[3]: 9208 hex (year/month)

Time data:32 hours; 50 minutes; and 45 seconds

s2 lower byte: 5045 hex (minutes/seconds)s2 higher byte: 0032 hex (32 hours)

You cannot specify special data registers DT9054 to DT9056 (DT90054 toDT90056 for FP10/10S) for the operand d. These registers store built–in Ca-lendar timer values. To change the built–in Calendar timer value, first storethe added result in other memory areas and transfer them to the special dataregisters using the F0_MV instruction.

� Data Types

Variable Data Types

s1, d ARRAY [1..3] OF WORD

s2 DWORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s1 x x x x x x x x x

d – x x x x x x x x

DWX DWY DWR DWL DSV DEV DDT DLD DFLs2

x x x x x x x x x

Time subtractionF158 (CSUB) 9

Steps AvailabilityFP1– C24/40, FP1–C56/72, FP–M 2.7k/5k

x: available–: not available

Page 451: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 152

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Example

LD start (* EN = start; Starting signal for the F158_CSUBfunction. *)

F158_CSUB Var_0,Var_1Var_2 (* s1 = Var_0 (source1)*)(* s2 = Var_1 (source2) *)(* d = Var_2 (destination) *)(*s1 – s2 = d *)

ST out (* optional *)

Page 452: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 153Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Sets the value specified by s as target value of the high–speedcounter if the trigger EN is in the ON–state. When the elapsed value(DT9045 and DT9044) of the high–speed counter agrees with thetarget value (DT9047 and DT9046), the external output relayspecified by d turns ON. You can use 8 external output relays (Y0 toY7). The target value is stored in special data registers DT9047 andDT9046 when the F162 (HC0S) instruction is executed and it iscleared when the elapsed value of the high–speed counter agreeswith the target value. Use 24 bit binary data with sign data for thetarget value of HSC (FF800000 hex to 007FFFFF hex / –8,388,608to 8,388,607). Special internal relay R903A turns ON and stays ONwhile the F162 (HC0S) instruction is executed and it is cleared whenthe elapsed value of the high–speed counter coincides with thetarget value. Even if the reset operation of the high–speed counteris performed after executing the F162 (HC0S) instruction, the targetvalue setting is not cleared until the elapsed value of the high–speedcounter coincides with the target value. To reset the external outputrelay, which is set ON by the F162 (HC0S) instruction, use theF163_HC0R instruction. You can use the same external output relayspecified by the F162 (HC0S) instruction in other parts of program.It is not regarded duplicate use of the same output. While specialinternal relay R903A is in ON state, no other high–speed counterinstructions F162 (HC0S), F163_HC0R, F164_SPD0, F165_CAM0can be executed.

� Data Types

Variable Data Types

s DINT, DWORD

d BOOL

� Operands

Relais T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x – x x x – –

X Y R L T C DT LD FLd

– x – – – – – – –

� Example

High–speed counteroutput setF162 (HC0S) 7

Steps Availability

FP1, FP–M

x: available–: not available

Page 453: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 154

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Sets the value specified by s as target value of the high–speedcounter if the trigger EN is in the ON–state. When the elapsed value(DT9045 and DT9044) of the high–speed counter agrees with thetarget value (DT9047 and DT9046), the external output relayspecified by d turns OFF. You can use 8 external output relays (Y0to Y7). When the F163 (HC0R) instruction is executed, the targetvalue is stored in special data registers DT9047 and DT9046 and itis cleared when the elapsed value of the high–speed counter agreeswith the target value. Use 24 bit binary data with sign data for thetarget value of HSC (FF800000 hex to 007FFFFF hex / –8,388,608to 8,388,607). Once the F163 (HC0R) instruction is executed,special internal relay R903A turns ON and stays ON. It is clearedwhen the elapsed value of the high–speed counter agrees the targetvalue. Even if the reset operation of the high–speed counter isperformed after executing the F163 (HC0R) instruction, the targetvalue setting is not cleared until the elapsed value of the high–speedcounter agrees with the target value.You can use the same external output relay specified by the F163(HC0R) instruction in other parts of program. It is not consideredduplicate use of the same output. While special internal relay R903Ais in ON state, no other high–speed counter instructionsF162_HC0S, F163 (HC0R), F164_SPD0, F165_CAM0 can beexecuted.

� Data Types

Variable Data Types

s DINT, DWORD

d BOOL

� Operands

Relais T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x – x x x – –

X Y R L T C DT LD FLd

– x – – – – – – –

� Example

LD start (*EN = start; Starting signal for the F163_HC0R function*)

F163_HC0R Var_0, Var_1 (* s = Var_0*) (* d = Var_1 *)

ST out (* option *)

High–speed counteroutput resetF163 (HC0R) 7

Steps Availability

FP1, FP–M

x: available–: not available

Page 454: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 155Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Outputs the pattern of the pulse corresponding to the elapsed valueof HSC. When the executing condition is ON and HSC control–flag(R903A) is OFF, this instruction starts operation. This instructionexecutes pattern output or pulse output corresponding to the dataof the data table registered at the data register specified by s. Youcan use pulse output for positioning with a pulse motor and patternoutput for controlling an inverter. When you execute pulse outputwith this instruction, input the pulse of Y7 directly to HSC or input theencoder output pulse. When you execute pattern output, input theencoder output pulse to HSC. Specify at system register No. 400whether you will use HSC or not. It is not possible to execute thisinstruction without setting. The output coils of pattern output arewithin the 8 points Y0 to Y7. The output coil of pulse output is Y7 only.Select either pattern outputs or pulse outputs by the content of thefirst word of the data table. When you input 0 for one word of the firstaddress (all bits are 0), it will be the pulse output. When you executepattern output, an error occurs unless the No. of the control steps is1 to F or unless the No. of control points is 1 to 8. An error occurswhen the first target value is not FF800000 to 7FFFFF. An error doesnot occur when the first target value on and after the second one arenot FF800000 to 7FFFFF. The operation, however, is stopped andR903A turns OFF. When the frequency data is ”0”, pulse outputends. It will also end if the area is exceeded during its execution.

� Data Types

Variable Data Types

s INT, WORD

� Operands

Relais T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s – – – – – – x – –

� Example

Pulse output control;Pattern output controlF164 (SPD0)

3

Steps Availabilitypulse; Tr Types FP1/FP–M2.7k/5k, + FP–M 0.9kpattern: FP1 and FP–M

x: available–: not available

Page 455: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 156

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline Converts ON/OFF of output specified on the table corresponding tothe elapsed value of HSC. This instruction controls the output up to8 points (Y0 to Y7), corresponding to ON/OFF target value of eachcoil on the table, which is for the control of cam position specified bys. The target value is within the range of 23–bits data and 0 to8388607. If you execute cam control, you have to specify theoperating mode as addition counter. (If it is not addition counter, youwill not be able to execute the control properly.) The target value ismaximum 32 steps with FP1–C16, maximum 64 steps withFP1–C24/C40. If you cancel hard reset, soft reset, and controlmaximum value you can set the initial pattern at output, set theelapsed value to 0 and restart Cam control. You can output the initialpattern at the start of control. However, you cannot clear the elapsedvalue to 0.

� Data Types

Variable Data Types

s INT, WORD

� Operands

Relais T/C RegisterFür

WX WY WR WL SV EV DT LD FL

s – – – – – – x – –

� Example

LD start (*EN = start; Starting signal for the F165_CAM0 function*)

F165_CAM0 Var_0 (* s = Var_0*)

ST out (* option *)

Cam controlF165 (CAM0) 3

Steps Availability

All 3, except FP0 andFP–M 0.9k

x: available–: not available

Page 456: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 157Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline If the trigger EN of the instruction F166 has the status TRUE, pulsesat the HSC will be counted. If the elapsed value of the high–speedcounter equals the target value s, an interrupt will be executed andthe output relay d of the PLC will be set. In addition to this the specialrelay for the HSC n (R903A/B/C/D) will be reset and F166 isdeactivated.

Target Value (s)

Elapsed value of HSC

F166_startSpecial relay (n)R903A/B/C/DPLC output (d)

If the high–speed counter is reset (reset input of HSC from 0 to 1, seesystem register 400/401 in the project navigator) before the elapsedvalue has reached the target value s, the elapsed value will be resetto zero. F166 remains active and counting restarts at zero.The dupli-cate use of an external output relay in other instructions (OUT, SET,RST, KEEP and other F instructions) is not verifyed by NAiS Controland will not be detected.While the special relay(s) R903A/B/C/D is/are in ON state no other high–speed counter instructions can beexecuted.FP0 provides 4 HSC channels. The channel number isspecified by n (0 to 3).

n values 0 1 2 3Elapsed value register: DDT9044 DDT9048 DDT9104 DDT9108Target value register: DDT9046 DDT9050 DDT9106 DDT9110Used channel: CH0 of HSC0 CH1 of HSC0 CH0 of HSC1 CH1 of HSC1ON during execution: R903A R903B R903C R903D

s values–8388608 or 16#FF800000...8388607 or 16#7FFFFF

d values output0 Y0... ...7 Y7

Sets Output of High–speed counter (4Channels)F166 (HC1S) 11

Steps Availability

FP0

Page 457: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 158

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Data Types

Variable Data Types

n DINT, DWORD

s DINT, DWORD

d BOOL

� Operands

For Relais T/C Register

DWX DWY DWR DWL DSV DEV DDT DLD DFLs

x x x – x x x – –

X Y R L T C DT LD FLd

– x – – – – – – –

� Example

Globale Variable List:

Identifier Address Type Initial Comment0 out_0 %QX0.0 BOOL FALSE output Y0 of PLC

POU–Header:

Class Identifier Type Initial Comment

0 VAR_EXTERNAL out_0 BOOL FALSE output Y0 of PLC

1 VAR F166_start BOOL FALSE F166 start condition

POU Body (Instruction list)LD F166_start Load start conditionF166_HC1S 0,10000,out_0 execute F166

POU Body (Ladder Diagramm)

�Notes

� Assign a number to the input variable (e.g. Monitor � Mo-nitor Header, click the variable, enter the value, press <En-ter>) or replace the input variables by numbers.

� Error Flags:Nr. IEC–Address set if

R9007 %MX0.900.7 ON index is too high

R9008 %MX0.900.8 ON parameter s exceeds the valid range

x: available–: not available

Page 458: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 159Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline If the trigger EN of the instruction F167 has the status TRUE, pulsesat the HSC will be counted. If the elapsed value of the high–speedcounter equals the target value s, an interrupt will be executed andthe output relay d of the PLC will be reset. In addition to this thespecial relay for the HSC n (R903A/B/C/D) will be reset and F167 isdeactivated.

Target Value (s)

F167_startSpecial Relay (n)R903A/B/C/DPLCOutput (d)

If the high–speed counter is reset (reset input of HSC from 0 to 1, seesystem register 400/401 in the project navigator) before the elapsedvalue has reached the target value s, the elapsed value will be resetto zero. F167 remains active and counting restarts at zero. The dupli-cate use of an external output relay d in other instructions (OUT, SET,RST, KEEP and other F instructions) is not verifyed by NAiS Controland will not be detected. While the special relay(s) R903A/B/C/D is/are in ON state no other high–speed counter instructions can be ex-ecuted. FP0 provides 4 HSC channels. The channel number is spe-cified by n (0 to 3).

n values 0 1 2 3Elapsed value register:

DDT9044 DDT9048 DDT9104 DDT9108

Target value register:

DDT9046 DDT9050 DDT9106 DDT9110

Used channel: CH0 of HSC0 CH1 of HSC0 CH0 of HSC1 CH1 of HSC1ON during execu-tion:

R903A R903B R903C R903D

s values–8388608 or 16#FF800000...8388607 or 16#7FFFFF

d values output0 Y0... ...7 Y7

Resets Output of High–speedCounter (4 Channels)F167 (HC1R) 11

Steps Availability

FP0

Page 459: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 160

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Data Types

Variable Data Types

n DINT, DWORD

s DINT, DWORD

d BOOL

� Operands

For Relais T/C Register

DWX DWY DWR DWL DSV DEV DDT DLD DFLs

x x x – x x x – –

X Y R L T C DT LD FLd

– x – – – – – – –

� Example

POU Header

Class Identifier Type Initial Comment

0 VAR PLS Bool 16#0410,1000 output Y0 of PLC

1 VAR F169_start BOOL FALSE F169 start condition

POU Body (Instruction List):

LD F167_start load start conditionF167_HC1R 0,–200,out_0 execute F167

POU Body (Ladder Diagramm):

�Note

� Assign a number to the input variable (e.g. Monitor –>Monitor Header, click the variable, enter the value, press<Enter>) or replace the input variables by numbers.

� Error Flags:Nr. IEC–Address set ifR9007 %MX0.900.7 ON index is too high

R9008 %MX0.900.8 ON parameter s exceeds the valid range

x: available–: not available

Page 460: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 161Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The function generates a pulse train through the PLC outputs Y0 orY1 as defined in a look up table.

� When starting the function (EN = TRUE) the frequence Fmin issent to the ouput of the PLC and the special relaysR903A/R903B defined by n* will be set.

� After that, the frequence will be increased from Fmin to Fmaxduring the period Tdelay.

� The frequence Fmax remains unchanged until the number ofpulses DImp are output. Counting of the pulses starts at themoment Fmax is reached. �Imp = (Fmax+Fmin)/2*Tdelay*2–TargetPulseCount

� Afterwards, the frequence will be reduced from Fmax to Fminduring the period Tdelay.

� If the value of Fmin is reached, the special relaysR903A/R903B (defined by n*) and the PLC ouput will be reset.

� In addition to the pulse output a direction output can be reali-zed as well (see parameter init of DUT).

�Note

� If �Imp has a positive value, processing is executed asdescribed above.

� If �Imp = 0, Fmax will be reduced to Fmin without delay.

� If DImp has a negative value, Fmin will be reduced beforeFmax is reached but the number of TargetPulseCount pul-ses will be output.

Positioning Pulse InstructionF168 (SPD1)5

Steps Availability

TR Type of FP0

Page 461: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 162

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Data Types

Variable Data Types

s SDT (Strukturierter Datentyp)

n* INT, WORD

� Operands

Relais T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s – – – – – – x – –

n* – – – – – – – – –

Values for n 0 1Uses output: Y0 (direction Y2) Y1 (direction Y3)Elapsed value register: DDT9044 DDT9048Target value register: DDT9046 DDT9050Used channel: CH0 of HSC0 CH1 of HSC0Special relay (ON during execution):

R903A R903B

Local range input enabled: DT9052 bit 2 ON DT9052 bit 6 ONLocal range input: X0 X1

DUT for parameter s

Create the data table of the function by creating a DUT:

Enter the DUT into the list of global variables:

� next page

x: available–: not available

Page 462: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 163Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Parameter Init of DUT = 16#0XYZX = Pulse width (ON/OFF time):

X values ON time OFF time Comment0 50 % ON 50 % OFF max. Fmax = 6 kHz1 80 µs ON rest OFF max. Fmax = 9.5 kHz

Y = Pulse count mode:Z = Direction output:

YZ values Pulse count mode Direction output00 Incremental counting Not used02 Incremental counting OFF if TargetPulseCount value positive

ON if TargetPulseCount value negative03 Incremental counting ON if TargetPulseCount value positive

OFF if TargetPulseCount value negative10 Absolute counting Not used12 Absolute counting OFF if TargetPulseCount value positive

ON if TargetPulseCount value negative13 Absolute counting ON if TargetPulseCount value positive

OFF if TargetPulseCount value negative20 Return to origin point Not used22 Return to origin point OFF23 Return to origin point ON

Incremental counting:target value = elapsed value + TargetPulseCount(target value register) (elapsed value register)

Absolute counting:target value = 0 + TargetPulseCount(target value register)

Parameter Fmin of the DUTFmin values frequency40 40 Hz... ...5000 5.0 kHz

Parameter Fmax of DUTFmax values frequency40 40 Hz... ...9500 9.5 kHz

Parameter Tdelay of DUTTdelay values ramp time30 30 ms... ...32767 327.67 s

Page 463: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 164

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Parameter TargetPulseCount of DUTTargetPulseCount values–8388608 or 16#FF800000...8388607 or 16#7FFFFF

� Example

DUT:Define the DUT as described before and enter the parameter s (Init, Fmin,...) into the data table.

List of global variables:Enter the DUT into the list of global variables as described before. Either setthe initalizing parameters or assign the initialization values to the DUT ele-ments (e.g.: SPD_DUT.Init=16#0102) in you PLC programming code.

POU Header:

Class Identifier Type Initial Comment

0 VAR_EXTERNAL SPD_DUT SPD Init:=16#0102Fmin:=500Fmax:=5000Tdelay:=4000TargetPulseCount:=15000

SDT für F68_SPD1

1 VAR F168_start BOOL FALSE F168 start condition

POU Body (Instruction List):

LD F168_start Load start conditionF168_SPD1 SPD_DUT.Init,0 execute F168

POU Body (Ladder Diagramm):

� next page

Page 464: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 165Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

�Notes

� The message ’Function executed’ (R903A/B) appears du-ring the PLC program, and not when the function is merelycalled up.

� While the registers R903A/B have the status TRUE, no furt-her HSC commands can be executed (calling F168 has noeffect).

� Pulses are output by the HSC until the elapsed valueequals the target value.

� If you edit your program online (RUN mode), the number ofoutput pulses may be wrong.

� Error Flags:No. IEC–Address set if

R9007 %MX0.900.7 ON index is too high

R9008 %MX0.900.8 ON Fmin > Fmax

Page 465: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 166

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline PLC outputs pulses greater than/equal to 40Hz to a PLC outputaccording to the parameters defined in a data table.

� Data Types

Variable Data Types

s ARRAY [0..1] OF INT or WORD

n* INT, WORD

� Operands

Relais T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s – – – – – – – – –

n* – – – – – – – – –

Values for n 0 1Used output: Y0 (direction Y2) Y1 (direction Y3)Elapsed value register: DDT9044 DDT9048Used channel: CH0 of HSC0 CH1 of HSC0ON during execution: R903A R903B

�Note

If R903A/R903B has the status TRUE, no other high–speedcounter related instructions can be executed (calling theF169 instruction has no effect).

The frequency can be changed during execution of F169. The new set-tings will be used after the actual ON/OFF period has finished. UseF170_PWM function for frequency smaller than/equal to 38Hz.

Values for s ARRAY:

ARRAY[0] = 16#0XYZX = pulse width (ON/OFF time):

X values ON time OFF time1 10 % ON 90 % OFF2 20 % ON 80 % OFF... ... %

ON... %OFF

8 80 % ON 20 % OFF9 90 % ON 10 % OFF

� next page

Pulse Width Modulation � 40 HzF169 (PLS) 5

Steps Availability

TR type of FP0

x: available–: not available

Page 466: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 167Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Y = pulse count modeZ = direction output

YZ values Pulse count mode Direction output00 No counting Not used10 Incremental counting Not used12 Incremental counting OFF13 Incremental counting ON20 Decremental counting Not used22 Decremental counting ON23 Decremental counting OFF

The pulse count mode and the direction output parameters cannot bechanged during the execution of F169. Restart the function to activate newlyset parameters.

ARRAY[1] value Frequency40 40 Hz41 41 Hz... ...9999 9.99 kHz10000 10 kHz

The frequency can be changed during execution of F169. The new settingswill be used after the actual ON/OFF period has finished. Use F170_PWMfunction for frequency smaller than/equal to 38Hz.

�Notes

� If R903A/R903B has the status TRUE, no other high–speedcounter related instructions can be executed (calling theF169 instruction has no effect).

� If the frequency (see ARRAY[1]) is high, very small or veryhigh pulse width values (see ARRAY[0]) can deformat thepulse output as a result of the limited edge steepness ofthe PLC outputs.

� The frequency and the pulse–width repetition rate can bechanged in each PLC cycle.

� If incremental counting is choosen, pulse output stops assoon as the value of the register exceeds the value16#7FFFFF.

Page 467: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 168

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

The pulse width (ON/OFF time) can be changed during execution of F169.The new settings will be used after the end of the actual ON/OFF period.

� If decremental counting is choosen, pulse output stops assoon as the value of the register is less than the value16#FF800000.

� Pulse output may be stopped if the PLC program is chan-ged online (RUN mode).

� Example

POU Header

Class Identifier Type Initial Comment0 VAR PLS ARRAY

[0..1] OFINT

16#0410,1000

PLS ARRAY:

40% ON 60%OFF

incremental counting – no direction output

1 VAR F169_start BOOL FALSE F169 Start condition

IL Body

LD F169_start Load start conditionF169_PLS PLS,0 execute F169

LD Body

�Note

Assign a number to the input variable (e.g. Monitor –>Monitor Header, click the variable, enter the value, press<Enter>) or replace the input variables by numbers.

Page 468: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 169Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline This function outputs outputs defined in a data table to an output ofa PLC.

� Data Types

Variable Data Types

s ARRAY [0..1] OF INT or WORD

n* INT, WORD

� Operands

Relais T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s – – – – – – – – –

n* – – – – – – – – –

Values for n 0 1Used output: Y0 Y1Used channel: CH0 of HSC0 CH1 of HSC0ON during execution: R903A R903B

Values for s ARRAY

ARRAY[0] values Frequency Cycle duration 0 (16#0) 38 Hz (26 ms) 1 (16#1) 19 Hz (52 ms) 2 (16#2) 9.5 Hz (105 ms) 3 (16#3) 4.8 Hz (210 ms) 4 (16#4) 2.4 Hz (420 ms) 5 (16#5) 1.2 Hz (840 ms) 6 (16#6) 0.6 Hz (1.6 s) 7 (16#7) 0.3 Hz (3.4 s) 8 (16#8) 0.15 Hz (6.7 s)17 (16#11) 1 Hz (1 ms)*18 (16#12) 714 Hz (1.4 ms)*19 (16#13) 500 Hz (2 ms)*20 (16#14) 400 Hz (2.5 ms)*21 (16#15) 200 Hz (5 ms)*22 (16#16) 100 Hz (10 ms)*

(* Available beginning with Version 2.0). The frequency cannot be changed during execution of F170. Restart the function to aktivate newlyset parameters.

Use F169_PLS function for frequency f > 38Hz.

Pulse Width ModulationF170 (PWM) 5

Steps Availability

TR type of FP0

x: available–: not available

Page 469: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 170

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

ARRAY[1] values ON time OFF time0 0 % ON 100 % OFF1 0.1 % ON 99.9 % OFF2 0.2 % ON 99.8 % OFF... ... % ON ... % OFF998 99.8 % ON 0.2 % OFF999 99.9 % ON 0.1 % OFF1000 100 % ON 0 % OFF

The pulse width (ON/OFF time) can be changed during execution ofF170. The changes are valid after the current periode is finished.

�Notes

� If the special relays R903A/B have the status TRUE, noother high–speed counter related instructions can be ex-ecuted (calling the F170 instruction has no effect).

� If the frequency (see ARRAY[1]) is high, very small or veryhigh pulse width values (see ARRAY[0]) can deformat thepulse output as a result of the limited edge steepness ofthe PLC outputs.

� The period can be changed in each PLC cycle. The fre-quency is only assumed when this function is started.

� Example

POU Header

Class Identifier Type Initial Comment

0 VAR PWM ARRAY[0..1] OFINT

2(0) PWM ARRAY

1 VAR F170_start BOOL FALSE F170 start condition

POU Body (Instruction List):LD 5 define PWM parameters

ST PWM [0] 5 = Frequency 1.2 Hz

LD 500 500 = ON time 50% OFF time 50%

ST PWM [1]

LD F170_start load start condition

F170_PWM PWM,0 execute F170

� next page

Page 470: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 171Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

POU Body (Ladder Diagram):

�Note

Assign a number to the input variable (e.g. Monitor –>Monitor Header, click the variable, enter the value, press<Enter>) or replace the input variables by numbers.

Page 471: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 172

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The F183 instruction activates an upward counting 32 bit timer whichworks on–delayed. The smallest counting unit is 0.01s. Duringexecution of F183 (start = TRUE), elapsing time is added to theelapsed value d. The timer output q and the special internal relayR900D will be set if the elapsed value d equals the set value s. If thestart condition start is set to FALSE, execution will be interrupted andthe elapsed value d will be reset to zero. The set value s can bechanged during execution of F183.

Elapsedvalue(d)

Set value(s)

In(start)

Out(q)

The delay time of the timer can be calculated using the followingformula: (Set Value s) * (0.01s) = on–delay

�Note

If you use R900D as the timer contact, be sure to program itimmediately after the timer instruction.

start :Timer operation conditions : Set Value (0 to 2147483647), other values are considered as

0.d : Elapsed Value (0 to 2147483647)q : Timer output

� Data Types

Variable Data Types

start, q BOOL

s DINT, DWORD

� next page

Special 32–bit timerF183 (DSTM)

Steps Availability

FP0

Page 472: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 173Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x – x x x – –

X Y R L T C DT LD FLstart

x x x – x x – – –

q – x x – – – – – –

� Example

POU–Header:

Class Identifier Type Initial Comment0 VAR In BOOL FALSE start condition1 VAR Out BOOL FALSE ON if timer runs out2 VAR Set_Value DINT 10000 set value for timer (100 s)3 VAR Elapsed_Value DINT 0 elapsed value of timer

POU–Body (Instruction List):LD In load starting conditionF183_DSTM Set_Value

Elapsed_Valueexecute the timer

ST Out store result of timer

POU–Body (Ladder Diagram):

�Note

Assign a number to the input variable (for example:Monitor�Monitor Header, click the variable, enter the value,press <Enter>) or replace the input variables by numbers.

x: available–: not available

Page 473: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 174

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The function converts a floating point data at input s in the range–32767.99 to 32767.99 into integer data (including +/– sign). Theresult of the function is returned at output d.The converted integer value at output d is always less than or equalto the floating point value at input s:When there is a positive floating point value at the input, a positivepre–decimal value is returned at the output.When there is a negative floating point value at the input, the nextsmallest pre–decimal value is returned at the output.If the floating point value has only zeros after the decimal point, itspre–decimal point value is returned.The difference between the F and the P instruction is that the Pinstruction is only executed at the leading edge scan of the ENtrigger.

� Data Types

Variable Data Types

s REAL

d INT

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

WX WY WR WL SV EV DT LD FLd

– x x x x x x x x

� Example

In this example the function F327_INT is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

� next page

Floating point data � 16–bitinteger data (the largest integer notexceeding the floating point data)F327(INT) 8

Steps Availability

FP0

x: available–: not available

Page 474: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 175Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

POU Header

In the POU header, all input and output variables are declared that are usedfor programming this function.

In this example, the input variable input_value is declared. However, you canwrite a constant directly at the input contact of the function instead.

Body

When the variable start is set to TRUE, the function is carried out. It convertsthe floating point value –1.234 into the whole number value –2, which istransferred to the variable output_value at the output. Since the whole num-ber may not exceed the floating point value, the function rounds down here.

LD Body

IL Body

�Note

The following error flags apply to F/P327:

No. IEC Address set if

R9007 %MX0.900.7 permanently the value at input s is not a REAL number,

R9008 %MX0.900.8 for an instantor the converted result exceeds the range ofoutput d

R900B %MX0.900.11 to TRUE the result is 0

Page 475: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 176

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The function converts a floating point data at input s in the range–2147483000 to 214783000 into integer data (including +/– sign).The result of the function is returned at output d.The converted integer value at output d is always less than or equalto the floating point value at input s:When there is a positive floating point value at the input, a positivepre–decimal value is returned at the output.When there is a negative floating point value at the input, the nextsmallest pre–decimal value is returned at the output.If the floating point value has only zeros after the decimal point, itspre–decimal point value is returned.The difference between the F and the P instruction is that the Pinstruction is only executed at the leading edge scan of the ENtrigger.

� Data Types

Variable Data Types

s REAL

d DINT

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

In this example the function F328_DINT is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

� next page

Floating point data � 32–bitinteger data (the largest integer notexceeding the floating point data)

F328 (DINT)8

Steps Availability

FP0

x: available–: not available

Page 476: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 177Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

POU Header

In the POU header, all input and output variables are declared that are usedfor programming this function.

In this example, the input variable input_value is declared. However, you canwrite a constant directly at the input contact of the function instead.

Body

When the variable start is set to TRUE, the function is carried out. It convertsthe floating point value –1234567.89 into the whole number value–1234568, which is transferred to the variable output_value at the output.Since the whole number may not exceed the floating point value, the func-tion rounds down here.

LD Body

IL Body

�Note

The following error flags apply to F/P328:

No. IEC Address set if

R9007 %MX0.900.7 permanently the value at input s is not a REAL number,

R9008 %MX0.900.8 for an instantor the converted result exceeds the range ofoutput d

R900B %MX0.900.11 to TRUE the result is 0

Page 477: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 178

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The function rounds down the decimal part of the real number dataand returns it at output d.The difference between the F and the P instruction is that the Pinstruction is only executed at the leading edge scan of the ENtrigger.

� Data Types

Variable Data Types

s REAL

d REAL

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

In this example the function F333_FINT is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU Header

In the POU header, all input and output variables are declared that are usedfor programming this function.

In this example, the input variable input_value is declared. However, you canwrite a constant directly at the input contact of the function instead.

� next page

Rounding the firstdecimal point downF333(FINT)

8

Steps Availability

FP0

x: available–: not available

Page 478: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 179Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Body

The value 1234.888 is assigned to the variable input_value. When the varia-ble start is set to TRUE, the function is carried out. It rounds down the in-put_value after the decimal point and returns the result (here: 1234.000) atthe variable output_value.

LD Body

IL Body

�Note

The following error flags apply to F/P333:

No. IEC Address set if

R9007 %MX0.900.7 permanently the value at input s is not a REAL number

R9008 %MX0.900.8 for an instant

R900B %MX0.900.11 to TRUE the result is 0

R9009 %MX0.900.9 for an instant the result causes an overflow

Page 479: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 180

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The function rounds off the decimal part of the real number data andreturns it at output d.The difference between the F and the P instruction is that the Pinstruction is only executed at the leading edge scan of the ENtrigger.

� Data Types

Variable Data Types

s REAL

d REAL

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

In this example the function F334_FRINT is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU Header

In the POU header, all input and output variables are declared that are usedfor programming this function.

In this example, the input variable input_value is declared. However, you canwrite a constant directly at the input contact of the function instead.

� next page

Rounding the firstdecimal point offF334(FRINT) 8

Steps Availability

FP0

x: available–: not available

Page 480: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 181Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Body

When the variable start is set to TRUE, the function is carried out. It roundsoff the input_value = 1234.567 after the decimal point and returns the result(here: 1235.000) at the variable output_value.

LD Body

IL Body

�Note

The following error flags apply to F/P334:

No. IEC Address set if

R9007 %MX0.900.7 permanently the value at input s is not a REAL number

R9008 %MX0.900.8 for an instant

R900B %MX0.900.11 to TRUE the result is 0

R9009 %MX0.900.9 for an instant the result causes an overflow

Page 481: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 182

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The function changes the sign of the floating point value at input sand returns the result at output d.The difference between the F and the P instruction is that the Pinstruction is only executed at the leading edge scan of the ENtrigger.

� Data Types

Variable Data Types

s REAL

d REAL

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

In this example the function F335_FSIGN is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU Header

In the POU header, all input and output variables are declared that are usedfor programming this function.

In this example, the input variable input_value is declared. However, you canwrite a constant directly at the input contact of the function instead.

� next page

Floating point data sign changes(negative/positive conversion)F335 (FSIGN)

8

Steps Availability

FP0

x: available–: not available

Page 482: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 183Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Body

The value 333.4 is assigned to the variable input_value. When the variablestart is set to TRUE, the function is carried out. The output_value is then–333.4.

LD Body

IL Body

�Note

The following error flags apply to F/P335:

No. IEC Address set if

R9007 %MX0.900.7 permanently the value at input s is not a REAL number

R9008 %MX0.900.8 for an instant

R9009 %MX0.900.9 for an instant the result causes an overflow

Page 483: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 184

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The function converts the value of an angle entered at input s fromdegrees to radians and returns the result at output d.The differencebetween the F and the P instruction is that the P instruction is onlyexecuted at the leading edge scan of the EN trigger.

� Data Types

Variable Data Types

s REAL

d REAL

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

In this example the function F337_RAD is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU Header

In the POU header, all input and output variables are declared that are usedfor programming this function.

In this example, the input variable input_value is declared. However, you canwrite a constant directly at the input contact of the function instead.

� next page

Conversion of angle units(Degrees � Radians)F337 (RAD) 8

Steps Availability

FP0

x: available–: not available

Page 484: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 185Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Body

When the variable start is set to TRUE, the function is carried out.

LD Body

IL Body

�Note

The following error flags apply to F/P337:

No. IEC Address set if

R9007 %MX0.900.7 permanently the value at input s is not a REAL number

R9008 %MX0.900.8 for an instant

R900B %MX0.900.11 to TRUE the result is 0

R9009 %MX0.900.9 for an instant the result causes an overflow

Page 485: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 186

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The function converts the value of an angle entered at input s fromradians to degrees and returns the result at output d.The difference between the F and the P instruction is that the Pinstruction is only executed at the leading edge scan of the ENtrigger.

� Data Types

Variable Data Types

s REAL

d REAL

� Operands

Relay T/C RegisterFor

DWX DWY DWR DWL DSV DEV DDT DLD DFL

s x x x x x x x x x

d – x x x x x x x x

� Example

In this example the function F338_DEG is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

POU Header

In the POU header, all input and output variables are declared that are usedfor programming this function.

In this example, the input variable input_value is declared. However, you canwrite a constant directly at the input contact of the function instead.

� next page

Conversion of angle units(Radians � Degrees)F338(DEG) 8

Steps Availability

FP0

x: available–: not available

Page 486: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 187Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Body

When the variable start is set to TRUE, the function is carried out.

LD Body

IL Body

�Note

The following error flags apply to F/P338:

No. IEC Address set if

R9007 %MX0.900.7 permanently the value at input s is not a REAL number

R9008 %MX0.900.8 for an instant

R900B %MX0.900.11 to TRUE the result is 0

R9009 %MX0.900.9 for an instant the result causes an overflow

Page 487: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 188

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Outline The PID processing instruction is used to regulate a process (e.g. aheater) given a measured value (e.g. temperature) and apredetermined output value (e.g. 20�C). The function calculates aPID algorithm whose parameters are determined in a data table inthe form of an ARRAY with 30 elements that is entered at input s. Thedata table contains the following parameters:

ARRAY[0]: Control modeARRAY[1]: Set value (SP)ARRAY[2]: Measured value (PV)ARRAY[3]: Output value (MV)ARRAY[4]: Output lower limitARRAY[5]: Output upper limitARRAY[6]: Proportional gain (Kp)ARRAY[7]: Integral time (Ti)ARRAY[8]: Derivative time (Td)ARRAY[9]: Control cycle (Ts)ARRAY[10]: Auto–tuning progressARRAY[11] throughARRAY[29]: are utilized internally by the PID controller.

The difference between the F and the P instruction is that the P in-struction is only executed at the leading edge scan of the EN trigger.

� Detailed description of the data table for F355_PID

ARRAY[0]: Control modeWith this you select the type of PID processing and the activation (X= 8) of the auto–tuning.

16#X000: Reverse operation PI–D16#X001: Forward operation PI–D16#X002: Reverse operation I–PD16#X003: Forward operation I–PD

� next page

PID processing instructionF355 (PID) 4

Steps Availability

FP0

Page 488: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 189Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

�Note

The I–PD processing is somewhat more flexible than the PI–Dprocessing and therefore needs more time to adjust.

Forward and Reverse operation: The output value (MV) rises when the measured value (PV) sinks(e.g. heating).Forward operation: The output value (MV) rises when the measuredvalue (PV) rises (e.g. cooling).Auto–tuningWhen the most significant bit (MSB) in ARRAY[0] is set to 1, the autotuning is activated. The optimum values for the PID parameters Kp,Ti, and Td are determined by measuring the responses of theprocess and are stored in ARRAY[6], ARRAY[7] and in ARRAY[8].Thereafter the auto tuning is deactivated (MSB in ARRAY[0] is setto 0).Since some operations do not permit auto tuning, the MSB inARRAY[0] can be reset to 0 during the auto tuning process, therebystopping the auto tuning. In this case the processing is carried outbased on the original parameters.

ARRAY[1]:Set value (SP)Here you set the target value that should be reachedthrough the control process. It should fall within therange of the measured value. When using ananalogue input, you can use a range between 0 and4000.

ARRAY[2]:Measured value (PV)Here you enter the measured value that you want tobe corrected via the operation. An analogue–digitalconverter is necessary for this. Adjust it so that therange of the measured value corresponds to that ofthe set value.

ARRAY[3]:Output value (MV)The output value (the result of the PID operation) isstored in this data word. When using an analogueoutput, the range lies between 0 and 4000 or between–2000 and +2000.

ARRAY[4]:Output lower limitHere you enter a lower limit of the output valuebetween 0 and 10000. The value must be smaller thanthe output value’s upper limit.

Page 489: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 190

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

ARRAY[5]:Output upper limitHere you enter a lower limit of the output valuebetween 1 and 10000. The value must be larger thanthe output value’s lower limit.

ARRAY[6]:Proportional gain (Kp)In this data word, you write the parameter Kp. Thestored value multiplied by 0.1 corresponds to theactual value of Kp. Values in the range of 1 to 9999(0.1 to 999.9 in 0.1 steps) can be entered. If the autotuning control is activated, this value is automaticallyadjusted and rewritten.

ARRAY[7]: Integral time (Ti)In this data word, you write the parameter Ti. Thestored value multiplied by 0.1 corresponds to theactual value of Ti. Values in the range of 1 to 30000(0.1 to 3000s in 0.1s steps) can be entered. If the autotuning control is activated, this value is automaticallyadjusted and rewritten.

ARRAY[8]:Derivative time (Td)In this data word, you write the parameter Td. Thestored value multiplied by 0.1 corresponds to theactual value of Td. Values in the range of 1 to 10000(0.1 to 1000s in 0.1s steps) can be entered. If the autotuning control is activated, this value is automaticallyadjusted and rewritten.

ARRAY[9]:Control cycle (Ts)Here you set the cycle for executing PID processing.The value of the data word multiplied by 0.01corresponds to the actual value of Ts. Values in therange of 1 to 6000 (0.01s to 60.0s in 0.01s steps) canbe entered.

ARRAY[10]:Auto–tuning progressWhen auto tuning is selected for the specified controlmode (ARRAY[0]), a value from 1 to 5 will be storedindicating the progress of auto tuning.

ARRAY[11..29]: PID work areaThe function F355_PID uses this work area internallyto calculate the PID operation.

� next page

Page 490: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 191Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Explanation of the operation of F355_PID

Standard structure of the controller loop with PID processing instruction.

The above POU body represents the standard control loop.The controlinput is determined by the user (e.g. desired room temperature of 22�C).After the A/D conversion the set value (SP) is entered as the input valuefor the PID processing instruction.The measured value (PV) (e.g. currentroom temperature) is normally transmitted via a sensor and entered asthe input value for the PID processor. F355_PID calculates the standardtolerance e from the set value and the measured value (e = set value –measured value). With the parameters given (proportional gain Kp, inte-gral time Ti, ...) a new output value (MV) is calculated in increments setby the control cycle Ts. This result is then applied to the actuator (e.g. afan that regulates room temperature) after the D/A conversion.The analo-gue section represents the system’s actuator, e.g. heater and tempera-ture regulation of a room.

A PID operation consists of three components:

1. Proportional part (P part)A proportional part generates an output that is proportional to the input.The proportional gain Kp determines by how much the input value is in-creased or decreased.

� Example

A proportional part can be a simple electric resistor or a linear amplifier,for example.

The P part displays a relatively large maximum overshot, a long settlingtime and a constant standard tolerance.

Page 491: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 192

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

2. Integral part (I part)

An integral part produces an output quantity that corresponds to the timeintegral and input quantity (area of the input quantity). The integral timethus evaluates the output quantity MVi.The integral part can be a quantity scale of a tank that is filled by a vo-lume flow, for example. Because of the slow reaction time of the integralpart, it has a larger maximum overshot than the P component, but noconstant standard tolerance.

� Example:

Input quantity e and the output quantity MVi produced.

3. Derivative part (D part)

The derivative part produces an output quantity that corresponds to thetime derivation of the input quantity. The derivative time corresponds tothe weighting of the derived input quantity.A derivative component can be an RC–bleeder (capacitor hooked up inseries and resistance in parallel), for example.

� next page

Page 492: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 193Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Example

Input quantity e and the output quantity MVd produced.

4. PID controller

A PID controller is a combination of a P component, an I component anda D component. When the parameters Kp, Ti and Td are optimally adju-sted, a PID controller can quickly control and maintain a quantity at a pre-determined set value.

Reference equations for calculating the controller output MV

The following equations are used to calculate the controller output MVunder the following conditions:

In general:

The output value at time period n is calculated from the previous outputvalue (n–1) and the change in the output value in this time interval.

Reverse operation PI–D ARRAY[0] = 16#X000

Page 493: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 194

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

Forward operation PI–D ARRAY[0] = 16#X001

Reverse operation I–PD ARRAY[0] = 16#X002

Forward operation I–PD ARRAY[0] = 16#X003

� Data Types

Variable Data Type

s ARRAY [0..29] of INT or WORD

� Operands

Relay T/C RegisterFor

WX WY WR WL SV EV DT LD FL

s – – x x x x x x x

� next page

x: available–: not available

Page 494: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

14 – 195Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

� Example

In this example the function F355_PID is programmed in ladder diagram(LD) and instruction list (IL). The same POU header is used for both pro-gramming languages.

Global Variable List

POU Header

In the POU header, all input and output variables are declared that areused for programming this function.

In the initialization of the ARRAY Lookup_Table, the upper limit of thecontroller output is set to 4000. The proportional gain Kp is initially set at80 (8), Ti and Td at 200 (20s) and the control cycle Ts at 100 (1s).

Body

The standard function E_MOVE copies the value 16#8000 to the first ele-ment of the Lookup_Table when the variable activeautotuning is set fromFALSE to TRUE (i.e. activates the control mode auto tuning in the func-tion F355_PID). The variables Set_Value_SP and Process_Value_PV areassigned to the second and third elements of data table. They receivetheir values from the A/D converter CH0 and CH1. Because of EN inputof F355_PID is connected to the power rail, the function is carried out,when the PLC is in RUN mode. The calculated controller output is storedin the fourth element of data table and assigned to the variable Output_Value_MV. Its value is returned via a D/A converter from the PLCto the output of the system.

Page 495: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

14 – 196

Matsushita Electric Works (Europe) AG

Basic and High–level Instructions

LD Body

IL Body

�Note

The following error flags apply to F/P355:

No. IEC Address set if

R9007 %MX0.900.7 permanently the parameter settings are outside the

R9008 %MX0.900.8 for an instantallowed range.

Page 496: Nais Control 1131 FP0-FP1-FPM Instruction Set

Chapter 15

Standard Matsushita Function Blocks

CT_FB 15 – 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

TM_1ms_FB 15 – 6. . . . . . . . . . . . . . . . . . . . . . . . . . . .

TM_10ms_FB 15 – 9. . . . . . . . . . . . . . . . . . . . . . . . . . .

TM_100ms_FB 15 – 12. . . . . . . . . . . . . . . . . . . . . . . . .

TM_1s_FB 15 – 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 497: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

15 – 2

Matsushita Electric Works (Europe) AG

Page 498: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

15 – 3Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

Outline Counters realized with the CT_FB function block are down counters.The count area SV (set value) is 1 to 32767. For the CT_FB functionblock declare the following:

Count: count contacteach time a rising edge is detected at Count, the value1 is subtracted from the elapsed value EV until thevalue 0 is reached

Reset: reset contacteach time a rising edge is detected at Reset, the value0 is assigned to EV and the signal output C is reset;each time a falling edge is detected at Reset, the valueat SV is assigned to EV

SV: set valuevalue of EV after a reset procedure

C: signal outputis set when EV becomes 0

EV: elapsed valuecurrent counter value

� Data Types

Input Variable Output Variable

Count, Reset, C BOOL

SV, EV INT, WORD

� Time Chart

CT_FB

Page 499: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

15 – 4

Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

� Notes

� In order to work correctly, the CT_FB function block needs tobe reset each time before it is used.

� The number of available counters is limited and depends onthe settings in the system registers 5 and 6. The compiler as-signs a NUM* address to every counter instance. The ad-dresses are assigned counting downwards, starting at thehighest possible address.

� The Matsushita CT function (down counter) uses the sameNUM* address area (Num* input). In order to avoid errors (ad-dress conflicts), the CT function and the CT_FB function blockshould not be used together in a project.

� Example CT_FB

In the following example the function block CT_FB is programmed in lad-der diagram (LD) and instruction list (IL). The same POU header is usedfor both programming languages.

POU Header

All input and output variables which are used for programming the func-tion block CT_FB are declared in the POU header. This also includes thefunction block (FB) itself. By declaring the FB you create a copy of theoriginal FB. This copy is saved under copy_name, and a separate dataarea is reserved.

This example uses variables. You may also use constants for the inputvariables.

� next page

Page 500: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

15 – 5Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

LD Body

IL Body

If you want to call up the function block in an instruction list, enter thefollowing:

� Note

It does not matter whether the function names in the IL editorare capitalized or not.

Page 501: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

15 – 6

Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

Outline This timer for 0.001s units works as an ON–delay timer. If the startcontact of the function block is in the ON state, the preset time SV(set value) is started. When this time has elapsed, the timer contactT turns ON. For the TM_1ms_FB function block declare thefollowing:

start: start contacteach time a rising edge is detected, the set value SV iscopied to the elapsed value EV and the timer is started

SV: set valuethe defined ON–delay time (0 to 32.767s)

T: timer contactis set when the time defined at SV has elapsed, thismeans when EV becomes 0

EV: elapsed valuecount value from which 1 is subtracted every 0.001swhile the timer is running

� Data Types

Input Variable Output Variable

BOOL (start) BOOL (T)

INT, WORD (SV) INT, WORD (EV)

� Notes

� The number of available timers is limited and depends onthe settings in the system registers 5 and 6.

� The Matsushita timer functions (TM_1s, TM_100ms,TM_10ms, and TM_1s) use the same NUM* address area asthe Matsushita timer function blocks (TM_1s_FB,TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For thetimer function blocks the compiler automatically assigns aNUM* address to every timer instance. The addresses areassigned counting downwards, starting at the highestpossible address. In order to avoid errors (address con-flicts), these timer functions and function blocks shouldnot be used together in a project.

� next page

TM_1ms_FB

Page 502: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

15 – 7Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

� Time Chart

start

SV

EV

TONOFF

X 0

downloadPROG mode RUN mode

ONOFF

X 0

� Example TM_1ms_FB

In the following example the function block TM_1ms_FB is programmedin ladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU Header

All input and output variables which are used for programming the func-tion block TM_1ms_FB are declared in the POU header. This also inclu-des the function block (FB) itself. By declaring the FB you create a copyof the original FB. This copy is saved under Alarm_Control, and a sepa-rate data area is reserved.

This example uses variables. You may also use constants for the inputvariables.

Page 503: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

15 – 8

Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

LD Body

IL BodyIf you want to call up the function block in an instruction list, enter thefollowing:

� NoteIt does not matter whether the function names in the IL editorare capitalized or not.

Page 504: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

15 – 9Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

Outline This timer for 0.01s units works as an ON–delay timer. If the startcontact of the function block is in the ON state, the preset time SV(set value) is started. When this time has elapsed, the timer contactT turns ON. For the TM_10ms_FB function block declare thefollowing:

start: start contacteach time a rising edge is detected, the set value SV iscopied to the elapsed value EV and the timer is started

SV: set valuethe defined ON–delay time (0 to 327.67s)

T: timer contactis set when the time defined at SV has elapsed, thismeans when EV becomes 0

EV: elapsed valuecount value from which 1 is subtracted every 0.01swhile the timer is running

� Data Types

Input Variable Output Variable

BOOL (start) BOOL (T)

INT, WORD (SV) INT, WORD (EV)

� Notes

� The number of available timers is limited and depends onthe settings in the system registers 5 and 6.

� The Matsushita timer functions (TM_1s, TM_100ms,TM_10ms, and TM_1s) use the same NUM* address area asthe Matsushita timer function blocks (TM_1s_FB,TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For thetimer function blocks the compiler automatically assigns aNUM* address to every timer instance. The addresses areassigned counting downwards, starting at the highestpossible address. In order to avoid errors (address con-flicts), these timer functions and function blocks shouldnot be used together in a project.

TM_10ms_FB

Page 505: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

15 – 10

Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

� Time Chart:

start

SV

EV

TONOFF

X 0

downloadPROG mode RUN mode

ONOFF

X 0

� Example TM_10ms_FB

In the following example the function block TM_10ms_FB is programmedin ladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU Header

All input and output variables which are used for programming the func-tion block TM_10ms_FB are declared in the POU header. This also inclu-des the function block (FB) itself. By declaring the FB you create a copyof the original FB. This copy is saved under Alarm_Control, and a sepa-rate data area is reserved.

This example uses variables. You may also use constants for the inputvariables.

� next page

Page 506: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

15 – 11Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

LD Body

IL BodyIf you want to call up the function block in an instruction list, enter thefollowing:

� NoteIt does not matter whether the function names in the IL editorare capitalized or not.

Page 507: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

15 – 12

Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

Outline This timer for 0.1s units works as an ON–delay timer. If the startcontact of the function block is in the ON state, the preset time SV(set value) is started. When this time has elapsed, the timer contactT turns ON. For the TM_100ms_FB function block declare thefollowing:

start: start contacteach time a rising edge is detected, the set value SV iscopied to the elapsed value EV and the timer is started

SV: set valuethe defined ON–delay time (0 to 3276.7s)

T: timer contactis set when the time defined at SV has elapsed, thismeans when EV becomes 0

EV: elapsed valuecount value from which 1 is subtracted every 0.1s whilethe timer is running

� Data Types

Input Variable Output Variable

BOOL (start) BOOL (T)

INT, WORD (SV) INT, WORD (EV)

� Notes

� The number of available timers is limited and depends onthe settings in the system registers 5 and 6.

� The Matsushita timer functions (TM_1s, TM_100ms,TM_10ms, and TM_1s) use the same NUM* address area asthe Matsushita timer function blocks (TM_1s_FB,TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For thetimer function blocks the compiler automatically assigns aNUM* address to every timer instance. The addresses areassigned counting downwards, starting at the highestpossible address. In order to avoid errors (address con-flicts), these timer functions and function blocks shouldnot be used together in a project.

� next page

TM_100ms_FB

Page 508: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

15 – 13Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

� Time Chart:

start

SV

EV

TONOFF

X 0

downloadPROG mode RUN mode

ONOFF

X 0

� Example TM_100ms_FB

In the following example the function block TM_100ms_FB is program-med in ladder diagram (LD) and instruction list (IL). The same POU hea-der is used for both programming languages.

POU Header

All input and output variables which are used for programming the func-tion block TM_100ms_FB are declared in the POU header. This also inc-ludes the function block (FB) itself. By declaring the FB you create acopy of the original FB. This copy is saved under Alarm_Control, and aseparate data area is reserved.

This example uses variables. You may also use constants for the inputvariables.

Page 509: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

15 – 14

Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

LD Body

IL BodyIf you want to call up the function block in an instruction list, enter thefollowing:

� NoteIt does not matter whether the function names in the IL editorare capitalized or not.

Page 510: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

15 – 15Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

Outline This timer for 1s units works as an ON–delay timer. If the startcontact of the function block is in the ON state, the preset time SV(set value) is started. When this time has elapsed, the timer contactT turns ON. For the TM_1s_FB function block declare the following:

start: start contacteach time a rising edge is detected, the set value SV iscopied to the elapsed value EV and the timer is started

SV: set valuethe defined ON–delay time (0 to 32767s)

T: timer contactis set when the time defined at SV has elapsed, thismeans when EV becomes 0

EV: elapsed valuecount value from which 1 is subtracted every 1s whilethe timer is running

� Data Types

Input Variable Output Variable

BOOL (start) BOOL (T)

INT, WORD (EV) INT, WORD (EV)

� Notes

� The number of available timers is limited and depends onthe settings in the system registers 5 and 6.

� The Matsushita timer functions (TM_1s, TM_100ms,TM_10ms, and TM_1s) use the same NUM* address area asthe Matsushita timer function blocks (TM_1s_FB,TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For thetimer function blocks the compiler automatically assigns aNUM* address to every timer instance. The addresses areassigned counting downwards, starting at the highestpossible address. In order to avoid errors (address con-flicts), these timer functions and function blocks shouldnot be used together in a project.

TM_1s_FB

Page 511: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

15 – 16

Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

� Time Chart:

start

SV

EV

TONOFF

X 0

downloadPROG mode RUN mode

ONOFF

X 0

� Example TM_1s_FB

In the following example the function block TM_1s_FB is programmed inladder diagram (LD) and instruction list (IL). The same POU header isused for both programming languages.

POU Header

All input and output variables which are used for programming the func-tion block TM_1s_FB are declared in the POU header. This also includesthe function block (FB) itself. By declaring the FB you create a copy ofthe original FB. This copy is saved under Alarm_Control, and a separatedata area is reserved.

This example uses variables. You may also use constants for the inputvariables.

� next page

Page 512: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction SetNAiS Control 1131

15 – 17Matsushita Electric Works (Europe) AG

Standard Matsushita Function Blocks

LD Body

IL BodyIf you want to call up the function block in an instruction list, enter thefollowing:

� NoteIt does not matter whether the function names in the IL editorare capitalized or not.

Page 513: Nais Control 1131 FP0-FP1-FPM Instruction Set

Matsushita Instruction Set NAiS Control 1131

15 – 18

Matsushita Electric Works (Europe) AG

Page 514: Nais Control 1131 FP0-FP1-FPM Instruction Set

Appendix A

High–Speed Counter, Pulse and PWM Output

A.1 High–Speed Counter, Pulse and PWM Output A – 3

A.1.1 High–speed counter function A – 3. . . . . . .

A.1.2 Pulse output function A – 3. . . . . . . . . . . . . .

A.1.3 PWM output function A – 4. . . . . . . . . . . . . .

A.2 Specifications and Restricted Items A – 5. . . . . . . . .

A.2.1 Specifications A – 5. . . . . . . . . . . . . . . . . . . . .

A.2.2 Functions and Restrictions A – 7. . . . . . . . .

A.3 High–Speed Counter Function A – 9. . . . . . . . . . . . . .

A.3.1 Types of Input Modes A – 9. . . . . . . . . . . . . .

A.3.2 I/O Allocation A – 11. . . . . . . . . . . . . . . . . . . .

A.4 Pulse Output Function A – 12. . . . . . . . . . . . . . . . . . . .

A.4.1 SDT Variables A – 12. . . . . . . . . . . . . . . . . . .

A.4.2 Positioning Function F168 A – 13. . . . . . . . .

A.4.3 Pulse Output Function F169 A – 14. . . . . . .

A.4.4 High–Speed Counter Control Instruction F0_MV A – 15. . . . . . . . . . . . . . . . . . . . . . . . . .

A.4.5 Elapsed Value Change and Read Instruction F1_DMV A – 16. . . . . . . . . . . . . . . .

A.5 Sample Program for Positioning Control A – 17. . . .

A.5.1 Relative Value Positioning Operation (Plus Direction) A – 18. . . . . . . . . . . . . . . . . . .

A.5.2 Relative Value Positioning Operation (Minus Direction) A – 19. . . . . . . . . . . . . . . . . .

A.5.3 Absolute Value Positioning Operation A – 20. . . . . . . . . . . . . . . . . . . . . . .

Page 515: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 2

Matsushita Electric Works (Europe) AG

A.5.4 Home Return Operation (Minus Direction) A – 21. . . . . . . . . . . . . . . . . . . . . . . .

A.5.5 Home Return Operation (Plus Direction) A – 22. . . . . . . . . . . . . . . . . . . . . . . .

A.5.6 JOG Operation (Plus Direction) A – 23. . . .

A.5.7 JOG Operation (Minus Direction) A – 24. . .

A.5.8 Emergency Stop A – 24. . . . . . . . . . . . . . . . .

Page 516: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 3Matsushita Electric Works (Europe) AG

A.1 High–Speed Counter, Pulse and PWM Output

A.1 High–Speed Counter, Pulse and PWM Output

There are three functions available when using the high–speed counter built into theFP0 programmable controller. There are four channels for the built–in high–speedcounter. The channel number allocated for the high–speed counter will changedepending on the function being used.

The counting range is: K–8388608 to K8388607 (HFF8000 to H7FFFFF), coded 24–bitbinary.

A.1.1 High–speed counter function

The high–speed counter function counts external inputs such as those from sensors orencoders. When the count reaches the target value, this function turns the desiredoutput ON and OFF.

InverterMotor

EncoderSTARTSTOP signal

Wire

Roller Cutter

Encoder output isinput to the high–speed counter

Cutter bladecontrol signal

FP0

A.1.2 Pulse output function

Combined with a commercially available motor, the pulse output function enablespositioning control. With the appropriate instruction, you can perform trapezoidalcontrol, origin return, and JOG operation.

Motor

Motor

Motordriver

1

Motordriver

2

Y0Pulse output

CW/CCW

Pulse output

CW/CCW

Y2

Y1Y3

FP0

Page 517: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 4

Matsushita Electric Works (Europe) AG

A.1 Outline of Functions

A.1.3 PWM output function

By using the appropriate instruction, the PWM output function enables a pulse outputof the desired duty ratio.

When you increase the pulse width...

heating increases.

When you decrease it...

heatingdecrea-ses.

Page 518: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 5Matsushita Electric Works (Europe) AG

A.2 Specifications and Restricted Items

A.2 Specifications and Restricted Items

A.2.1 Specifications

High–Speed Counter

Input/output contact number beingused Memory area used

Performancespecifications

ON/OFFoutput

Countmode

Input contactnumber(value in

parenthesisis reset input)

Built–inhigh–speed

counterchannel

no.

Controlflag

Elapsedvaluearea

Targetvaluearea

Minimuminputpulsewidth

Maximumcountingspeed

Relatedinstructions

X0(X2) CH0 R903A

DT9044 to

DT9045

DT9046 to

DT9047 50 �s

Specifythe desired

Incrementalinput

X1(X2) CH1 R903B

DT9048 to

DT9049

DT9050 to

DT9051

50 �s<10 kHz>

Total of 4 CH withdesired

outputfrom Y0to Y7

inputDecrementalinput X3

(X5) CH2 R903CDT9104

to DT9105

DT9106 to

DT9107 100 �s

4 CH withmax. 10 kHz F0(MV)

F1(DMV)

X4(X5) CH3 R903D

DT9108to

DT9109

DT9110 to

DT9111

100 �s<5 kHz>

F1(DMV)

F166(HC1S)F167(HC1R)

Specifythe desired

2–phaseinputIncremental/

X0X1

(X2)CH0 R903A

DT9044 to

DT9045

DT9046 to

DT9047

50 �s<10 kHz> Total of

2 CH withdesiredoutputfrom Y0to Y7

decrementalinputDirectionaldistinction

X3X4

(X5)CH2 R903C

DT9104 to

DT9105

DT9106 to

DT9107

100�s<5 kHz>

2 CH withmax. 2 kHz

�Note

Reset input X2 can be set to either CH0 or CH1. Reset input X5can be set to either CH2 or CH3.

� next page

Page 519: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 6

Matsushita Electric Works (Europe) AG

A.2 Specifications and Restricted Items

Pulse Output

Input/output contact number beingused

Built–inhigh– Memory area used Performance

specifications

Pulseoutput

Directionaloutput

Homeinput

Homeproximity

input

speedcounterchannel

no.

Controlflag

Elapsedvaluearea

Targetvaluearea

specificationsfor maximum

outputfrequency

Relatedinstructions

Y0 Y2 X0DT9052<bit2> CH0 R903A

DT9044to

DT9045

DT9046to

DT9047

Max. 10 kHz for1–point output

F0(MV)F1(DMV)

Y1 Y3 X1DT9052<bit6> CH1 R903B

DT9048to

DT9049

DT9050to

DT9051

1–point outputMax. 5 kHz for 2–pointoutput

F1(DMV)F168(SPD1)F169(PLS)

�Note

The maximum 1–point output for instruction F168 (SPD1) is 9.5kHz.

PWM Output

Built–inhigh–speed

Memory area used Performance RelatedOutput number being used high–speed

counterchannel no. Control flag

specifications foroutput frequency

Relatedinstructions

Y0 CH0 R903A Frequency:0.15 Hz to 38 Hz F0(MV)

Y1 CH1 R903B

0.15 Hz to 38 HzDuty:0.1 % to 99.9 %

F1(DMV)F170(PWM)

Page 520: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 7Matsushita Electric Works (Europe) AG

A.2 Specifications and Restricted Items

A.2.2 Functions and Restrictions

The same channel cannot be used by more than one function, e.g. CH0 cannot beshared by the high–speed counter and pulse output functions.

The number allocated to each function cannot be used for normal input or outputs.Therefore the following examples are NOT possible:

� When using CH0 for 2–phase inputting with the high–speedcounter function, you cannot allot X0 and X1 to normal inputs.

� When using Y0 for the pulse output function, you cannot allot origininput X0 to a normal input.

� When using Y0 for the pulse output (with directional outputoperating) function, you cannot allot Y2 (directional output) to anormal 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:

When using the high–speed counter with no reset input and2–phase input, you can allot X2 to a normal input.

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. For example, while executing F166 (target value match ON instruction)and flag R903A is in the ON state, F167 (target value match OFF instruction) CANNOTbe executed with CH0.

The counting speed when using the high–speed counter function will differ dependingon the counting mode as shown in the table. Therefore, the following restrictions apply:

� While in the incremental input mode and using the two channelsCH0 and CH1, if CH0 is being used at 8 kHz, then CH1 can beused up to 2 kHz.

� While in the 2–phase input mode and using the two channels CH0and CH2, if CH0 is being used at 1 kHz, then CH2 can be used upto 1 kHz.

� next page

Page 521: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 8

Matsushita Electric Works (Europe) AG

A.2 Specifications and Restricted Items

The maximum output frequency when using the pulse output function will differdepending on the output contact number as shown in the table:

� When using either only Y0 or only Y1, the maximum outputfrequency is 10 kHz.

� 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.

Page 522: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 9Matsushita Electric Works (Europe) AG

A.3 High–Speed Counter Function

A.3 High–Speed Counter Function

� The high–speed counter function counts the input signals,and when the count reaches the target value, turns ON andOFF the desired output.

� The high–speed counter function is able to count high–speedpulses of frequencies up to 10 kHz.

� To turn ON an output when the target value is matched, usethe target value match ON instruction F166. To turn OFF anoutput, use the target value match OFF instruction F167.

� Preset the output to be turned ON and OFF with theSET/RET instruction.

In order to use the high–speed counter function, it is necessary to set system registersNo. 400 and No. 401.

A.3.1 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

� next page

Page 523: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 10

Matsushita Electric Works (Europe) AG

A.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

Page 524: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 11Matsushita Electric Works (Europe) AG

A.3 High–Speed Counter Function

A.3.2 I/O Allocation

The input allocation, as shown in the table in section A.2.1 , will differ depending on thechannel number being used. The output turned ON and OFF can be specified frombetween Y0 to Y7 as desired with instructions F166 and F167.

� Example 1:

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 selected fromY0 to Y7.

� Example 2:

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 selected fromY0 to Y7.

Page 525: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 12

Matsushita Electric Works (Europe) AG

A.4 Pulse Output Function

A.4 Pulse Output Function

The pulse function enables positioning control by use in combination with acommercially available pulse–string input type motor driver. It provides trapezoidalcontrol with the instruction F168 for automatically obtaining pulse outputs by specifyingthe initial speed, maximum speed, acceleration/deceleration time, and target value.The F168 instruction also enables automatic home return.

A JOG operation using instruction F169 for pulse output while the predetermined triggeris in the ON state is also possible.

When using the pulse output function, set the channels corresponding to systemregisters No. 400 and No. 401 to “Do not use high–speed counter.”

A.4.1 SDT Variables

SDT Variables are used in the following example programs. SDT means StructuredData Type. These variables can be comprised of several kinds of variables (e.g. Wordand Double Word).

SDT definitions or structures are administered globally and receive a structure name.For this structure, elements of various types are defined. If an SDT variable is to be usedin a program, you need to assign an appropriate SDT variable in the global variable list.If one structure element of an SDT variable is to be accessed, the structure elementmust be separated from the structure variable name by a period (e.g.Data_table1.Fmax).

Motor_Dat_1

Init WORDFmin INTFmax INTTdelay INTTargetPuls DINTTermination INT

LD 4000

LD 4500

Init WORDFmin INTFmax INTTdelay INTTargetPuls DINTTermination INT

Init WORDFmin INTFmax INTTdelay INTTargetPuls DINTTermination INT

DUT Pool Global Variables

Data_table1 Type: Motor_Dat_1

Data_table2 Type: Motor_Dat_1

POU

VAR_EXTERNAL Data_table1

VAR_EXTERNAL Data_table2

POU Header (local variables)

ST Data_table1.Fmax

ST Data_table2.Fmax

POU Body

Page 526: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 13Matsushita Electric Works (Europe) AG

A.4 Pulse Output Function

A.4.2 Positioning Function F168

This example illustrates normal positioning with an acceleration and a decelerationramp.

ÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏ

200msec 200msec

5000Hz

500Hz

10000 pulses

0Hz

(R903A)%MX0.903.10

Start_X3

positioning active

no effectStart_X3 no effect

The following program generates a pulse from output Y0. The initial speed is 500Hz,and the normal processing speed is 5000Hz. The acceleration and deceleration timesare 200ms each. The movement amount is 10000 pulses.

�Notes

� For trapezoidal control the initial and final speeds may not begreater than 5000Hz.

� The sum of maximum frequencies of all axes must not exceed10000Hz.

Page 527: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 14

Matsushita Electric Works (Europe) AG

A.4 Pulse Output Function

A.4.3 Pulse Output Function F169

The following example shows this process in a positive direction. The mode (ofoperation) 16#0112 sets the following conditions:

� The duty ratio is 10% pulse and 90% pause

� Incremental counting

� Directional output %QX0.2 (Y2) to ”0”.

A frequency of 300Hz is output via the input Start_X2. During frequency output, thecount of the elapsed value for the high–speed counter CH0 system registers(%MW0.904.8 and %MW0.904.9 (DT9048 u. DT9049), or %MW0.9004.8 and%MW0.9004.9 with the FP0–T32CP) decreases.

The following example shows this process in a negative direction. The mode (ofoperation) 16#0113 sets the following conditions:

� The duty ratio is 10% pulse and 90% pause

� Decremental counting

� Directional output %QX0.2 (Y2) to ”1”.

A frequency of 700Hz is output via the input Start_X6. During frequency output, thecount of the elapsed value for the high–speed counter CH0 system registers(%MW0.904.8 and %MW0.904.9 (DT9048 u. DT9049), or %MW0.9004.8 and%MW0.9004.9 with the FP0–T32CP) decreases.

Page 528: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 15Matsushita Electric Works (Europe) AG

A.4 Pulse Output Function

A.4.4 High–Speed Counter Control Instruction F0_MV

The function F0_MV is used for two different tasks. F0_MV is known as a MOVEfunction that copies values and memory contents. In addition, F0_MV is used to controlthe high–speed counter (e.g. for positioning a stepping motor). In this respect, F0_MVoffers the following functionality:

� This instruction is used for resetting the built–in high–speedcounter, stopping the pulse outputs, and setting and resetting thehome proximity input.

� Specify this instruction together with special data register%MW0.905.2 (DT9052) or %MW0.9005.2 with the FP0–T32CP.

� Once this instruction is executed, the settings will be retained untilthis instruction is executed again.

� Example 1:

The home proximity speed is the starting speed of the ramp.The switching is enabled by assigning the value 4 to thehigh–speed counter special register (%MW0.905.2 (DT9052) or%MW0.9005.2 with the FP0–T32CP). ”0” is entered just afterthat to perform the preset operations.

� next page

Page 529: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 16

Matsushita Electric Works (Europe) AG

A.4 Pulse Output Function

� Example 2:

A.4.5 Elapsed Value Change and Read Instruction F1_DMV

In these examples, HSCO_elapsedval is assigned to the address %MD0.904.4(DDT9044) or %MD0.9004.4 with the FP0–T32CP.

� Example 1:

� Example 2:

Page 530: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 17Matsushita Electric Works (Europe) AG

A.5 Sample Program for Positioning Control

A.5 Sample Program for Positioning Control

Wiring example

X0

X1

X2

X3

X4

X5

X6

X7

COM

ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ

Steppingmotor (–) (+)

Moving table

Input terminal

Y0

Y2

+

Pulse output

Directionaloutput

Outputterminal

Home sensor

Positioning start

Positioning start

Home return start

Home proximity sensorForward JOG start

Reverse JOG start

Overrun

FP0

COM

24V DCpower supply

Stepping motor driver

b contact a contact

a contact

b contact

Pulse input

COM

Directional input

Page 531: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 18

Matsushita Electric Works (Europe) AG

A.5 Sample Program for Positioning Control

A.5.1 Relative Value Positioning Operation (Plus Direction)

With Start_X1 positioning starts. Pos_runs_R10 indicates active positioning.Reaching the target position is indicated by Pos_done_R12 for 1s.

ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ

Motor

(– side) (+ side)

200msec 200msec

5000Hz

500 Hz0Hz

10000 pulses10000pulses

Page 532: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 19Matsushita Electric Works (Europe) AG

A.5 Sample Program for Positioning Control

A.5.2 Relative Value Positioning Operation (Minus Direction)

With Start_X2 positioning starts. Pos_runs_R20 indicates active positioning.Reaching the target position is indicated by Pos_done_R22 for 1s.

ÎÎÎÎÎÎÎÎÎÎÎÎ

Motor

(– side) (+ side)

300msec 300msec

6000Hz

1000Hz0Hz

8000 pulses8000

pulses

Page 533: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 20

Matsushita Electric Works (Europe) AG

A.5 Sample Program for Positioning Control

A.5.3 Absolute Value Positioning Operation

With Start_X1 positioning starts. Pos_runs_R30 indicates active positioning.Reaching the target position is indicated by Pos_done_R32 for 1s. With absolutepositioning, the directional output is controlled. The mode of operation 16#112 sets thedirectional output to ”1” when moving backward, and to ”0” when moving forward.

ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ

(– side) (+ side)

(10,000) 22,000 (30,000)

Motor

250msec 250msec

4000Hz

200Hz0Hz

Page 534: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 21Matsushita Electric Works (Europe) AG

A.5 Sample Program for Positioning Control

A.5.4 Home Return Operation (Minus Direction)

The return home direction causes the stepping motor to move in a reverse (minus)direction. The ramps are maintained, just as they are with other positioning processes.The braking ramp engages when the home proximity sensor turns on. Then thestepping motor runs at starting speed until the home sensor is activated. Then the pulseoutput stops, and the elapsed value is set to 0.

With Start_X3 positioning starts. Pos_runs_R40 indicates active positioning.Pos_done_R42 turns on for 1s after the return home is completed, and the elapsedvalue (Addr. %MW0.904.4 and %MW0.904.5 (DT9044 and DT9045) or %MW0.9004.4and %MW0.9004.5 with the FP0–T32CP) is set to 0.

ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ

Motor

Home_X0

(– side) (+ side)

150msec 150msec

2000Hz

100Hz0Hz

Homeprox_X4

Start_X3 Homeprox_X4 Home_X0

Page 535: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 22

Matsushita Electric Works (Europe) AG

A.5 Sample Program for Positioning Control

A.5.5 Home Return Operation (Plus Direction)

The return home direction causes the stepping motor to move in a forward (positive)direction. The ramps are maintained, just as they are with other positioning processes.The braking ramp engages when the home proximity sensor turns on. Then thestepping motor runs at starting speed until the home sensor is activated. Finally thepulse output stops, and the elapsed value is set to 0.

With Start_X3 positioning starts. Pos_runs_R50 indicates active positioning.Pos_done_R52 turns on for 1s after the return home is completed, and the elapsedvalue (Addr. %MW0.904.4 and %MW0.904.5 (DT9044 and DT9045) or %MW0.9004.4and %MW0.9004.5 with the FP0–T32CP) is set to 0.

ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ

Motor

(– side) (+ side)

100msec 100msec

2500Hz

120Hz0Hz

Home_X0

Home_X0

Homeprox_X4

Homeprox_X4Start_X3

Page 536: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Appendix A

A – 23Matsushita Electric Works (Europe) AG

A.5 Sample Program for Positioning Control

A.5.6 JOG Operation (Plus Direction)

The input Start_X5 starts the pulse output. The directional output %QX0.2 (Y2) is notcontrolled using this mode of operation (16#112).

ÎÎÎÎÎÎÎÎÎÎÎÎ

Motor(– side) (+ side) Start_X5

%QX0.0(X0)

10

Pulses

Page 537: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Appendix A

A – 24

Matsushita Electric Works (Europe) AG

A.5 Sample Program for Positioning Control

A.5.7 JOG Operation (Minus Direction)

The input Start_X6 starts the pulse output. The directional output %QX0.2 (Y2) is setusing this mode of operation (16#122).

ÎÎÎÎÎÎÎÎÎÎÎÎ

Motor(– side) (+ side) Start_X6

%QX0.0(X0)

10

Pulses

A.5.8 Emergency Stop

With a falling edge at the input, the pulse output is stopped. A break circuit has to beused as a protective circuit for this program. By using a break circuit, the emergencystop function is made fail–safe.

Page 538: Nais Control 1131 FP0-FP1-FPM Instruction Set

Appendix B

Glossary

Page 539: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Glossary

B – 2

Matsushita Electric Works (Europe) AG

Page 540: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Glossary

B – 3Matsushita Electric Works (Europe) AG

Action AssignmentAn action combines one sequence(created with the SFC–editor) with partsof the logic which are executed when aspecific step is active. An action containsparts of the over–all logic. An action canbe assigned to multiple steps and can becoded in FBD, LD or IL.BodyA POU consists of a header and a body.The body contains the PLC program.Data TypeEach variable is assigned a data type thatdetermines its bit length. There areelementary (e.g. BOOL, WORD) anduser–defined (e.g. ARRAY) data types.Data Unit TypeA Data Unit Type (DUT) is a group ofvariables composed of severalelementary data types. Such groups areused when data tables are edited.Declarationis the definition of � Variables for globalor local use.EN (Enable) Input/ENO (Enable Out)OutputMany function blocks have an input andoutput variable of the data type BOOL inaddition to the other input and outputvariables. The status of the ENO outputalways reflects the current status of theEN input.F Instructionsare common Matsushita instructions. TheP instructions function exactly the sameway as the F instructions with theexception that they are only executedwhen a leading edge is detected.FunctionFunctions are used within the definition ofthe user logic whenever a routine isneeded, which, when executed, yieldsexactly one result. Since Functions do notaccess any internal memory, everyinvocation of one Function with identical

input parameters always results in anidentical value, the Function result.As soon as a Function has been declaredit can be accessed from any other � Program Organization Unit of the � User Logic.

Function BlockFunction Blocks define both the algorithmas well as the data declaration of a part ofthe � User Logic. Due to this definitionthe logic can be considered a class. Notthe Function Block itself is invoked butseveral instances of this Function Blockcan be created, which can then be usedseparately. Each instance possesses itsown copy of the data declaration memory,which provides the necessary datainformation for executing the FunctionBlock functionality.The private data declaration memory of aFunction Block Instance persists fromone invocation of this instance to the nextone. This internal memory allows theimplementation of incrementalfunctionality by using Function Blocks.As a consequence several invocations ofone Function Block Instance with thesame input variables will not necessarilyyield the same results.In comparison with � Functions,Function Blocks allow you to define notonly one but a set of output variablesrepresenting the Function Block results.Substances of Function Blocks can bedeclared locally, for use within one POU.Declaring the instance of a FunctionBlock within a POU defines the scope ofthis instance at the same time.

Page 541: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Glossary

B – 4

Matsushita Electric Works (Europe) AG

Function Block Diagram FBDis a graphical language for programmingconnective logic. The individual � Program Organization Unit Variablesare connected with the inputs and outputsof function boxes. The connectionrepresents a data flow between variablesand inputs/outputs of function boxes.

A Function Block Diagram program isinternally structured via � Networks.

A Function Block Diagram network isdefined by a connected graph of functionboxes.

Function Block InstanceAn object of the � Function Block classpossesses its own copy of the FunctionBlock’s data declaration memory. Thisprivate data area is linked to the FunctionBlock algorithm for this particularinstance.

Global VariablesGlobal variables have physicaladdresses. They apply to the entireproject and can be copied into the POUheaders as VAR_EXTERNAL. TheGlobal Variable List is found in the ProjectNavigator.

HeaderA Program Organization Unit (POU)consists of a header and a body. In theheader all variables used in the POU arelisted and defined.

Identifieris the symbolic name of a variable.

Input VariableInput variables provide a functionblock/function with values with whichcalculations are carried out.

Instruction List ILis a low level textual language whichprovides the capabilities for effective PLCprogramming. It is based on individualinstructions which define one operationper instruction. Besides the � Variableslisted explicitly as arguments for anoperation the actual value of the

accumulator is used as an additionalimplicit argument. The result of anoperation is also stored here after theexecution of the appropriate instruction,thus providing a link between apreceeding instruction and oneafterwards.

An Instruction List program is internallystructured as an assembly of � Networks.

Ladder Diagram LDis a graphical language for programmingconnective logic. Similar to the � Function Block Diagram capabilities,the individual � Program OrganizationUnit � Variables are connected with theinputs and outputs of function boxes. Inaddition, Boolean connections can bedrawn by using coils and contacts. Thisconnection represents a Boolean signalflow.

A Ladder Diagram program is internallystructued via � Networks.

A Ladder Diagram network is defined bya connected graph of functions boxeslinked with the lefthand power rail.

Local VariablesLocal variables only apply to the POU inwhose header they have been declared.

LogicThe complete PLC program defined bythe user for solving the automationproblem. The user logic is structured via� Program Organization Units.

NetworkA network belongs to a POU body andcontains the logic (program).

Output VariableFunctions and function blocks write theirresults in output variables.

P Instructions� F instructions.

POU PoolThe POU Pool is located in the ProjectNavigator and contains all POUs that arepart of the project.

Page 542: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Glossary

B – 5Matsushita Electric Works (Europe) AG

Programis similar to a Function Block with oneimplicit � Function Block Instance. Thedifferences between Programs andFunction Blocks are:• Programs are only allowed on top of a

Program Organization Unit invocationhierarchy (i.e. a program may not beinvoked from another ProgramOrganization Unit)

• Directly represented � Variables canbe used for defining a Program

Program Organization Unit (POU)Program Organization Units are used forstructuring the complete user logic.Individual Units may invoke other ones,however a recursive POU structure is notallowed.Program Organization Units are eitherdefined as standard by default or userspecific due to the specific automationproblem to be solved by the � UserLogic.NAiSControl differentiates between theProgram Organization Unit Header(which contains the � Declaration part ofthe Program Organization Unit) and theProgram Organization Unit Body (whichcontains the Program Organization Unit’salgorithm).Due to different requirements for thesolution of a sub–problem, different typsof POUs are provided.The different Program Organization Unittypes are � Functions, � FunctionBlocks and � Programs.ProjectThe project represents the top level of thehierarchy in NAiS Control. It contains theentire task for the controller.

Sequential Function Chart SFCconsists of the basic elements steps andtransitions. While steps represent aspecific state during the execution of aPOU, a transition allows the definition ofthe conditions for changing from onestate to the next state.Using either parallel or alternativebranches you can complement severaltypes of SFC sequences.Specific connective logic program codecan be associated to the steps via actionsby using the appropriate languages � Function Block Diagram, LadderDiagram and � Instruction List.

Taskdefines the moment (and other executionparameters) of program execution. APOU of type program contains the logic,i.e., it defines what has to be done. Theassociation of a program to a task definesthe moment of the logic’s execution.

Variableenables the association of a specifier to aspecific memory area. Due to differentrequirements, data can be of differenttypes. Variables can be either global, foruse within the entire user program, orlocal, being restricted to the POU in whichit has been defined.

Page 543: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131Glossary

B – 6

Matsushita Electric Works (Europe) AG

Page 544: Nais Control 1131 FP0-FP1-FPM Instruction Set

I – 1Matsushita Electric Works (Europe) AG

Alphabetical Index of All Instructions

A

ABS 3 – 2

ADD 4 – 4

ADD_TIME 5 – 2

AND 7 – 2

ASIN 4– 20

ATAN 4– 32

B

BCD_TO_DINT 2– 79

BCD_TO_INT 2– 77

BOOL_TO_DINT 2 – 5

BOOL_TO_DWORD 2 – 9

BOOL_TO_INT 2 – 3

BOOL_TO_WORD 2 – 7

C

COS 4– 23

COS 4– 26

CT 14 – 8

CT_FB 15 – 2

CTD 12 – 6

CTU 12 – 2

CTUD 12– 11

D

DF 14 – 9

DFN 14 – 10

DINT_TO_BCD 2– 38

DINT_TO_BOOL 2– 25

DINT_TO_DWORD 2– 33

DINT_TO_INT 2– 27

DINT_TO_REAL 2– 35

DINT_TO_TIME 2– 31

DINT_TO_WORD 2– 29

DIV 4– 10

DIV_TIME_DINT 5– 14

DIV_TIME_INT 5– 12

DIV_TIME_REAL 5– 16

DWORD_TO_BOOL 2– 49

DWORD_TO_DINT 2– 53

DWORD_TO_INT 2– 51

DWORD_TO_TIME 2– 57

DWORD_TO_WORD 2– 55

E

EQ 9 – 6

EXP 4– 41

EXPT 4– 44

F

F_TRIG 11 – 5

F0 (MV) 14 – 28

F1 (DMV) 14 – 29

F2 (MVN) 14 – 30

F3 (DMVN) 14 – 31

F5 (BTM) 14 – 32

F6 (DGT) 14 – 33

F10 (BKMV) 14 – 34

F11 (COPY) 14 – 35

F12 (EPRD) 14 – 36

F15 (XCH) 14 – 41

F16 (DXCH) 14 – 42

F17 (SWAP) 14 – 43

F20 (ADD) 14 – 44

F21 (DADD) 14 – 45

F22 (ADD2) 14 – 46

Page 545: Nais Control 1131 FP0-FP1-FPM Instruction Set

Alphabetical Index of All Instructions NAiS Control 1131

Matsushita Electric Works (Europe) AGI – 2

F23 (DADD2) 14 – 47

F25 (SUB) 14 – 48

F26 (DSUB) 14 – 49

F27 (SUB2) 14 – 50

F28 (DSUB2) 14 – 51

F30 (MUL) 14 – 52

F31 (DMUL) 14 – 53

F32 (DIV) 14 – 54

F33 (DDIV) 14 – 55

F35 (INC) 14 – 56

F36 (DINC) 14 – 57

F37 (DEC) 14 – 58

F38 (DDEC) 14 – 59

F40 (BADD) 14 – 60

F41 (DBADD) 14 – 61

F42 (BADD2) 14 – 62

F43 (DBADD2) 14 – 63

F45 (BSUB) 14 – 64

F46 (DBSUB) 14 – 65

F47 (BSUB2) 14 – 66

F48 (DBSUB2) 14 – 67

F50 (BMUL) 14 – 68

F51 (DBMUL) 14 – 69

F52 (BDIV) 14 – 70

F53 (DBIV) 14 – 71

F55 (BINC) 14 – 72

F56 (DBINC) 14 – 73

F57 (BDEC) 14 – 74

F58 (DBDEC) 14 – 75

F60 (CMP) 14 – 76

F61 (DCMP) 14 – 77

F62 (WIN) 14 – 78

F63 (DWIN) 14 – 79

F64 (BCMP) 14 – 80

F66 (WOR) 14 – 82

F67 (XOR) 14 – 83

F65 (WAN) 14 – 81

F68 (XNR) 14 – 84

F70 (BCC) 14 – 85

F71 (HEX2A) 14 – 86

F72 (A2HEX) 14 – 87

F73 (BCD2A) 14 – 88

F74 (A2BCD) 14 – 89

F75 (BIN2A) 14 – 91

F76 (A2BIN) 14 – 92

F77 (DBIN2A) 14 – 93

F78 (DA2BIN) 14 – 94

F80 (BCD) 14 – 95

F81 (BIN) 14 – 96

F82 (BCD) 14 – 97

F83 (DBIN) 14 – 98

F84 (INV) 14 – 99

F85 (NEG) 14 – 100

F86 (DNEG) 14 – 101

F87 (ABS) 14 – 102

F88 (DABS) 14 – 103

F89 (EXT) 14 – 104

F90 (DECO) 14 – 105

F91 (SEGT) 14 – 107

F92 (ENCO) 14 – 109

F93 (UNIT) 14 – 110

F94 (DIST) 14 – 112

F95 (ASC) 14 – 115

F96 (SRC) 14 – 116

F100 (SHR) 14 – 117

F101 (SHL) 14 – 118

F105 (BSR) 14 – 119

F106 (BSL) 14 – 120

F110 (WSHR) 14 – 121

F111 (WSHL) 14 – 122

F112 (WBSR) 14 – 123

F113 (WBSL) 14 – 124

F118 (UCD) 14 – 125

F119 (LRSR) 14 – 126

Page 546: Nais Control 1131 FP0-FP1-FPM Instruction Set

NAiS Control 1131 Alphabetical Index of All Instructions

I – 3Matsushita Electric Works (Europe) AG

F120 (ROR) 14 – 128

F121 (ROL) 14 – 129

F122 (RCR) 14 – 130

F123 (RCL) 14 – 131

F130 (BTS) 14 – 132

F131 (BTR) 14 – 133

F132 (BTI) 14 – 134

F133 (BTT) 14 – 135

F135 (BCU) 14 – 136

F136 (DBCU) 14 – 137

F137 (STMR) 14 – 138

F138 (HMSS) 14 – 139

F139 (SHMS) 14 – 140

F140 (STC) 14 – 141

F141 (CLC) 14 – 142

F143 (IORF) 14 – 143

F144 (TRNS) 14 – 144

F147 (PR) 14 – 146

F148 (ERR) 14 – 147

F149 (MSG) 14 – 148

F157 (CADD) 14 – 149

F158 (CSUB) 14 – 150

F162 (HC0S) 14 – 152

F163 (HC0R) 14 – 153

F164 (SPD0) 14 – 154

F165 (CAM0) 14 – 155

F166 (HC1S) 14 – 156

F167 (HC1R) 14 – 158

F168 (SPD1) 14 – 160

F169 (PLS) 14 – 165

F170 (PWM) 14 – 168

F183 (DSTM) 14 – 171

F327 (INT) 14 – 173

F328 (DINT) 14 – 175

F333 (FINT) 14 – 177

F334 (FRINT) 14 – 179

F335 (FSIGN) 14 –181

F337 (RAD) 14 – 183

F338 (DEG) 14 – 185

F355 (PID) 14 – 187

G

GE 9 – 4

GT 9 – 2

I

ICTL 14 – 11

INT_TO_BCD 2– 23

INT_TO_BOOL 2– 11

INT_TO_DINT 2– 13

INT_TO_DWORD 2– 17

INT_TO_REAL 2– 19

INT_TO_TIME 2– 21

INT_TO_WORD 2– 15

J

JP 14 – 13

K

KEEP 14 – 14

L

LBL 14 – 15

LE 9 – 8

LIMIT 8 – 6

LN 4– 35

LOG 4– 38

LOOP 14 – 16

LSR 14 – 17

LT 9 – 10

Page 547: Nais Control 1131 FP0-FP1-FPM Instruction Set

Alphabetical Index of All Instructions NAiS Control 1131

Matsushita Electric Works (Europe) AGI – 4

M

MAX 8 – 2

MC 14 – 18

MCE 14 – 19

MIN 8 – 4

MOD 4– 12

MOVE 4 – 2

MUL 4 – 8

MUL_TIME_DINT 5 – 8

MUL_TIME_INT 5 – 6

MUL_TIME_REAL 5– 10

MUX 8 – 8

N

NE 9 – 12

NOT 7 – 8

O

OR 7 – 4

P

P13 (EPWT) 14 – 38

R

R_TRIG 11 – 2

REAL_TO_DINT 2– 62

REAL_TO_INT 2– 59

REAL_TO_TIME 2– 81

ROL 6 – 8

ROR 6– 11

RS 10 – 6

S

SHL 6 – 2

SHR 6 – 5

SIN 4– 17

SQRT 4– 14

SR 10 – 2

SUB 4 – 6

SUB_TIME 5 – 4

T

TAN 4– 29

TIME_TO_DINT 2– 65

TIME_TO_DWORD 2– 69

TIME_TO_INT 2– 63

TIME_TO_REAL 2– 83

TIME_TO_WORD 2– 67

TM_100ms 14 – 24

TM_100ms_FB 15 – 11

TM_10ms 14 – 22

TM_10ms_FB 15 – 8

TM_1ms 14 – 20

TM_1ms_FB 15 – 5

TM_1s 14 – 26

TM_1s_FB 15 – 14

TOF 13 – 12

TON 13 – 7

TP 13 – 2

TRUNC_TO_DINT 2– 74

TRUNC_TO_INT 2– 71

W

WORD_TO_BOOL 2– 39

WORD_TO_DINT 2– 44

WORD_TO_DWORD 2– 43

WORD_TO_INT 2– 41

WORD_TO_TIME 2– 47

X

XOR7– 8

Page 548: Nais Control 1131 FP0-FP1-FPM Instruction Set

Record of Changes

Manual No. Date Description of Changes

ACG–M0130END V1.0 June 1998 First edition

ACG–M0130END V1.1 Oct. 1999 Updated, appendix, glossary, new commands: IEC Functions: INT_TO_REAL, DINT_TO_TIME,DINT_TO_REAL, DWORD_TO_TIME, REAL_TO_INT,REAL_TO_DINT, TIME_TO_DINT, TIME_TO_DWORD,TRUNC_TO_INT, TRUNC_TO_DINT, SQRT, SIN, ASIN,COS, ACOS, TAN, ATAN, LN, LOG, EXP, EXPT,MUL_TIME_DINT, MUL_TIME_REAL, DIV_TIME_DINT,DIV_TIME_REAL;

Matsushita Instructions: CT, DF, DFN, ICTL, JP, KEEP,LBL, LOOP, LSR, MC, MCE, TM_1ms,TM_10ms,TM_100ms, TM_1s, F12 (EPRD), EEPROM read from memoryP13 (EPWT), EEPROM write to memoryF327 (INT), Floating point data 16–bit integer data (the

largest integer not exceeding the floating point data)

F328 (DINT), Floating point data 32–bit integer data (the largest integer not exceeding the floating point data)

F333 (FINT), Rounding the first decimal point downF334 (FRINT), Rounding the first decimal point offF335 (FSIGN), Floating point data sign changes

(negative/positive conversion)F337 (RAD), Conversion of angle units (Degrees

Radians)F338 (DEG), Conversion of angle units (Radians

Degrees)F355 (PID), PID processing instruction.

Page 549: Nais Control 1131 FP0-FP1-FPM Instruction Set

COPYRIGHT � 2000 All Rights Reserved ARCT1F0000ABC V1.x 12/99

Specifications are subject to change without notice. Printed in Europe

� Austria Matsushita Electric Works Austria GmbHStojanstraße 12, 2344 Maria Enzersdorf, Austria, Tel. (02236) 2 68 46, Fax (02236) 46133, http://www.matsushita.at

� Benelux Matsushita Electric Works Benelux B. V.De Rijn 4, (Postbus 211), 5684 PJ Best, (5680 AE Best), Netherlands, Tel. (0499) 37 2727, Fax (0499) 372185, http://www.matsushita.nl

� France Matsushita Electric Works France S.A.R.L.B.P. 44, 91371 Verrières le Buisson CEDEX, France, Tel. 01 60 13 57 57, Fax 01 60 13 57 58, http://www.matsushita–france.fr

� Germany Matsushita Electric Works Deutschland GmbHRudolf–Diesel–Ring 2, 83607 Holzkirchen, Germany, Tel. (08024) 648–0, Fax (08024) 648–555, http://www.matsushita.de

� Ireland Matsushita Electric Works Ltd., Irish Branch OfficeWaverley, Old Naas Road, Bluebell, Dublin 12, Republic of Ireland, Tel. (01) 460 09 69, Fax (01) 460 11 31

� Italy Matsushita Electric Works Italia s.r.l.Via del Commercio 3–5 (Z.I. Ferlina), 37012 Bussolengo (VR), Italy, Tel. (045) 675 27 11, Fax (045) 670 04 44, http://www.matsushita.it

� Portugal Matsushita Electric Works Portugal, Portuguese Branch OfficeAvda 25 de Abril, Edificio Alvorada 5º E, 2750 Cascais, Portugal, Tel. (351) 1482 82 66, Fax (351) 1482 74 21

� Scandinavia Matsushita Electric Works Scandinavia ABSjöängsvägen 10, 19272 Sollentuna, Sweden, Tel. +46 8 59 47 66 80, Fax (+46) 8 59 47 66 90, http://www.mac–europe.com

� Spain Matsushita Electric Works España S.A.Parque Empresarial Barajas, San Severo, 20, 28042 Madrid, Spain, Tel. (91) 329 38 75, Fax (91) 329 29 76

� Switzerland Matsushita Electric Works Schweiz AGGrundstrasse 8, 6343 Rotkreuz, Switzerland, Tel. (041) 799 70 50, Fax (041) 799 70 55, http://www.matsushita.ch

� United Kingdom Matsushita Electric Works UK Ltd.Sunrise Parkway, Linford Wood East, Milton Keynes, MK14 6LF, England, Tel. (01908) 231 555, Fax (01908) 231 599, http://www.matsushita.co.uk

�������������

� USA Aromat Corporation Head Office USA629 Central Avenue, New Providence, N.J. 07974, USA, Tel. 1–908–464–3550, Fax 1–908–464–8513, http://www.aromat.com

� China Matsushita Electric Works, Ltd. China Office2013, Beijing Fortune, Building 5, Dong San Huan Bei Lu, Chaoyang District, Beijing, China, Tel. 86–10–6590–8646, Fax 86–10–6590–8647

� Hong Kong Matsushita Electric Works Ltd. Hong KongRm1601, 16/F, Tower 2, The Gateway, 25 Canton Road, Tsimshatsui, Kowloon, Hong Kong, Tel. (852) 2956–3118, Fax (852) 2956–0398

� Japan Matsushita Electric Works Ltd. Automation Controls Group1048 Kadoma, Kadoma–shi, Osaka 571–8686, Japan, Tel. 06–6908–1050, Fax 06–6908–5781, http://www.mew.co.jp/e–acg/

� Singapore Matsushita Electric Works Pte. Ltd. (Asia Pacific)101 Thomson Road, #25–03/05, United Square, Singapore 307591,Tel. (65) 255–5473, Fax (65) 253–5689

Europe

North & South America

Asia

North America Europe Asia Pacific China JapanMatsushita Electric Works (Asia Pacific)

Matsushita Electric Works Group

Matsushita Electric Works

Matsushita Electric Works Ltd. Automation ControlsGroup

AromatCorporation