FP0/FP1/FP–M Instruction Set
NAiS Control 1131 FP0/FP1/FP–M Instruction Set
NAiS Control 1131
Matsushita Electric Works (Europe) AG
ACGM0130END V1.1 10/1999
is a global brand name of Matsushita Electric Works.
BEFORE BEGINNING This manual and everything described in it are copyrighted. You may not copy this manual, in whole or part, without written consent of Matsushita Electric Works (Europe) AG. Matsushita Electric Works (Europe) AG pursues a policy of continuous improvement of the design and performance of its products, therefore, we reserve the right to change the manual/product without notice. In no event will Matsushita Electric Works (Europe) AG be liable for direct, special, incidental, or consequential damage resulting from any defect in the product or its documentation, even if advised of the possibility of such damages.
LIMITED WARRANTY All implied warranties on the product, including merchantability and fitness, are limited 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: D When physical defects are due to different usage/treatment of the product other than described in the manual. D When physical defects are due to defective equipment other than the distributed product. D When physical defects are due to modifications/repairs by someone other than Matsushita Electric Works (Europe) AG. D When physical defects are due to natural disasters.
EMS–DOS and Windows are registered trademarks of Microsoft Corporation. EIBM Personal Computer AT is registered trademark of the International Business Machines Corporation.
Important Symbols The following symbols are used in this manual:
!
Note
Whenever the warning triangle is used, especially important safety instructions are given. If they are not adhered to, the results could be: • personal injury and/or • significant damage to instruments or their contents, e.g. data
Contains important additional information or indicates that you should proceed with caution.
Example: Contains an illustrative example of the previous text section.
next page Indicates that the text will be continued on the next page.
Table of Contents Part 1
Chapter 1
Basics
1.1
Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.1 In– /Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.2 Internal Relays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.3 Special Internal Relays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.4 Timers and Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.5 Data Registers (DT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.6 Special Data Registers (DT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.7 File Registers (FL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.8 Link Relays and Registers (L/LD) . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2
Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 – 8 1.2.1 Matsushita Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 – 9 1.2.2 IEC Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 – 10
1.3
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.1 Decimal Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.2 Hexadecimal Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.3 BCD Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1 1 1 1
– – – –
13 13 13 13
1.4
Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.1 BOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.2 INTEGER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.3 DOUBLE INTEGER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.4 STRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.5 WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.6 DOUBLE WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.7 ARRAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.8 TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.9 REAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1 1 1 1 1 1 1 1 1 1
– – – – – – – – – –
14 15 15 15 16 16 16 17 22 22
Matsushita Electric Works (Europe) AG
1–3 1–3 1–4 1–4 1–5 1–6 1–6 1–7 1–7
i
Table of Contents
NAiS Control 1131
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)INT_TO_REAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)INT_TO_TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)INT_TO_BCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 2 2 2
– – – –
17 19 21 23
(E_)DINT_TO_BOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)DINT_TO_INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)DINT_TO_WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)DINT_TO_TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 – 25 2 – 27 2 – 29 2 – 31
(E_)DINT_TO_DWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)DINT_TO_REAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)DINT_TO_BCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)WORD_TO_BOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)WORD_TO_INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 2 2 2 2
– – – – –
33 35 37 39 41
(E_)WORD_TO_DINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)WORD_TO_DWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)WORD_TO_TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)DWORD_TO_BOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 2 2 2
– – – –
43 45 47 49
(E_)DWORD_TO_INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)DWORD_TO_DINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)DWORD_TO_WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)DWORD_TO_TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 2 2 2
– – – –
51 53 55 57
(E_)REAL_TO_INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)REAL_TO_DINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)TIME_TO_INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (E_)TIME_TO_DINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 2 2 2
– – – –
59 61 63 65
(E_)TIME_TO_WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 – 67 ii
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Table of Contents
(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
Matsushita Electric Works (Europe) AG
iii
Table of Contents
Chapter 5
NAiS Control 1131
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
iv
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Chapter 9
Table of Contents
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
Matsushita Electric Works (Europe) AG
v
Table of Contents
NAiS Control 1131
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . JP, Jump to label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . KEEP, Serves as a relay with set and reset inputs . . . . . . . . . . . . . . . . . . . . . . . LBL, Label for the JP and LOOP Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
12 14 15 16
LOOP, Loop to Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LSR, Left shift register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . MC, Master Control relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . MCE, Master Conrol Relay End . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
17 18 19 20
TM_1ms, On Delay Timer for 0.001s Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TM_10ms, On Delay Timer for 0.01s Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TM_100ms, On Delay Timer for 0.1s Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TM_1s, On Delay Timer for 1s Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
21 23 25 27
F0 F1 F2 F3 F5
(MV), 16–bit data move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DMV) 32–bit data move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (MVN) 16–bit data inversions and move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DMVN) 32–bit data inversions and move . . . . . . . . . . . . . . . . . . . . . . . . . . . (BTM) Bit data move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14 14
– – – – –
29 30 31 32 33
F6 (DGT) Digit data move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F10 (BKMV) Block transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F11 (COPY) Block copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F12 EPRD EEPROM read from memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
34 35 36 37
P13 EPWT EEPROM write to memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F15 (XCH) 16–bit data exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F16 (DXCH) 32–bit data exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F17 (SWAP) Higher/lower byte in 16–bit data exchange . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
39 42 43 44
F20 F21 F22 F23
14 14 14 14
– – – –
45 46 47 48
(ADD) 16–bit addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DADD) 32–bit addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (ADD2) 16–bit addition, destination can be specified . . . . . . . . . . . . . . . . (DADD2) 32–bit addition, destination can be specified . . . . . . . . . . . . . . .
F25 (SUB) 16–bit subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 – 49 vi
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Table of Contents
F26 (DSUB) 32–bit subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 – 50 F27 (SUB2) 16–bit subtraction, destination can be specified . . . . . . . . . . . . . . 14 – 51 F28 F30 F31 F32
(DSUB2) 32–bit subtraction, destination can be specified . . . . . . . . . . . . (MUL) 16–bit multiplication, destination can be specified . . . . . . . . . . . . . (DMUL) 32–bit multiplication, destination can be specified . . . . . . . . . . . . (DIV) 16–bit division, destination can be specified . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
52 53 54 55
F33 F35 F36 F37
(DDIV) 32–bit division, destination can be specified . . . . . . . . . . . . . . . . . (INC) 16–bit increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DINC) 32–bit increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DEC) 16–bit decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
56 57 58 59
F38 F40 F41 F42
(DDEC) 32–bit decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (BADD) 4–digit BCD addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DBADD) 8–digit BCD addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (BADD2) 4–digit BCD addition, destination can be specified . . . . . . . . . .
14 14 14 14
– – – –
60 61 62 63
F43 F45 F46 F47
(DBADD2) 8–digit BCD addition, destination can be specified . . . . . . . . (BSUB) 4–digit BCD subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DBSUB) 8–digit BCD subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (BSUB2) 4–digit BCD subtraction, destination can be specified . . . . . . .
14 14 14 14
– – – –
64 65 66 67
F48 F50 F51 F52
(DBSUB2) 8–digit BCD subtraction, destination can be specified . . . . . . (BMUL) 4–digit BCD multiplication, destination can be specified . . . . . . . (DBMUL) 8–digit BCD multiplication, destination can be specified . . . . . (BDIV) 4–digit BCD division, destination can be specified . . . . . . . . . . . .
14 14 14 14
– – – –
68 69 70 71
F53 F55 F56 F57
(DBDIV) 8–digit BCD division, destination can be specified . . . . . . . . . . . (BINC) 4–digit BCD increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DBINC) 8–digit BCD increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (BDEC) 4–digit BCD decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
72 73 74 75
F58 F60 F61 F62
(DBDEC) 8–digit BCD decrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (CMP) 16–bit data compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DCMP) 32–bit data compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (WIN) 16–bit data band compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
76 77 78 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 F67 F68 F70
(WOR) 16–bit data OR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (XOR) 16–bit data exclusive OR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (XNR) 16–bit data exclusive NOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (BCC) Block check code calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
83 84 85 86
F71 (HEX2A) HEX → ASCII conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 – 87 Matsushita Electric Works (Europe) AG
vii
Table of Contents
NAiS Control 1131
F72 (A2HEX) ASCII → HEX conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 – 88 F73 (BCD2A) BCD → ASCII conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 – 89 F74 F75 F76 F77
(A2BCD) ASCII → BCD conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (BIN2A) 16–bit BIN → ASCII conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . (A2BIN) ASCII → 16–bit BIN conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . (DBIN2A) 32–bit BIN → ASCII conversion . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
90 92 93 94
F78 F80 F81 F82
(DA2BIN) ASCII → 32–bit BIN conversion . . . . . . . . . . . . . . . . . . . . . . . . . . (BCD) 16–bit BIN → 4–digit BCD conversion . . . . . . . . . . . . . . . . . . . . . . . (BIN) 4–digit BCD → 16–bit BIN conversion . . . . . . . . . . . . . . . . . . . . . . . . (BCD) 32–bit BIN → 8–digit BCD conversion . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
95 96 97 98
F83 F84 F85 F86
(DBIN) 8–digit BCD → 32–bit BIN conversion . . . . . . . . . . . . . . . . . . . . . . . 14 – 99 (INV) 16–bit data invert (one’s complement) . . . . . . . . . . . . . . . . . . . . . . . 14 – 100 (NEG) 16–bit data two’s complement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 – 101 (DNEG) 32–bit data two’s complement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 – 102
F87 F88 F89 F90
(ABS) 16–bit data absolute value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DABS) 32–bit data absolute value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (EXT) 16–bit data sign extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DECO) Decode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
F91 F92 F93 F94
(SEGT) 16–bit data 7–segment decode . . . . . . . . . . . . . . . . . . . . . . . . . . . (ENCO) Encode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (UNIT) 16–bit data combine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (DIST) 16–bit data distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14 – 108 14 – 110 14 – 111 14 – 113
– – – –
103 104 105 106
F95 (ASC) Character → ASCII transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F96 (SRC) Table data search (16–bit search) . . . . . . . . . . . . . . . . . . . . . . . . . . F100 (SHR) Right shift of 16–bit data in bit units . . . . . . . . . . . . . . . . . . . . . . . F101 (SHL) Left shift of 16–bit data in bit units . . . . . . . . . . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
116 117 118 119
F105 (BSR) Right shift of one hexadecimal digit (4 bits) of 16–bit data . . . . F106 (BSL) Left shift of one hexadecimal digit (4 bits) of 16–bit data . . . . . . F110 (WSHR) Right shift of one word (16 bits) of 16–bit data range . . . . . . F111 (WSHL) Left shift of one word (16 bits) of 16–bit data range . . . . . . . .
14 14 14 14
– – – –
120 121 122 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F120 (ROR) 16–bit data right rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F121 (ROL) 16–bit data left rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . F122 (RCR) 16–bit data right rotate with carry–flag data . . . . . . . . . . . . . . . .
14 14 14 14
– – – –
127 129 130 131
F123 (RCL) 16–bit data left rotate with carry–flag data . . . . . . . . . . . . . . . . . . 14 – 132 viii
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Table of Contents
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 Matsushita Electric Works (Europe) AG
ix
Table of Contents
NAiS Control 1131
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
A.2
A.3
A.4
A.5
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 Specifications and Restricted Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A – 5 A.2.1 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A – 5 A.2.2 Functions and Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A – 7 High–Speed Counter Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A – 9 A.3.1 Types of Input Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A – 9 A.3.2 I/O Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A – 11 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 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 x
Matsushita Electric Works (Europe) AG
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
Basics
NAiS Control 1131
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
1–2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Basics 1.1
1.1
Operands
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 its configuration. To see how many of the respective operands are available, refer to your hardware description.
1.1.1
In– /Outputs
The amount of in–/outputs available depends on the PLC and unit type. Each input terminal corresponds to one input X, each output terminal corresponds to one output Y. 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 be lost, e.g. after a power failure.
Matsushita Electric Works (Europe) AG
1–3
Basics 1.1
NAiS Control 1131 Operands
1.1.2
Internal Relays
Internal Relays are memory areas where you can store interim results. Internal relays are treated like internal outputs. In system register no. 7 define which internal relays are supposed to be holding/non–holding. Holding means that its values will be retained even after a power failure. The number of available internal relays depends on the PLC type (* hardware description 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 conditions such as when some flags get a certain status if data are ready for transmission in a PLC network.
The number of special internal relays available depends on the PLC type (* hardware description of your PLC).
+ Note
1–4
Special internal relays can only be read.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Basics 1.1
1.1.4
Operands
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 timers and 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 the case in non–holding registers. Entering a number in system register 5 means that the first counter is defined. All smaller numbers define timers. For example, if you enter zero, you define counters only. If you enter the highest value possible, 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 course customize this setting and set a higher value for the holding area, which means some of 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 areas is 16 bits (WORD). In the SV and EV area one INTEGER value from 0 to 32,767 can be 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 and under certain conditions be edited.
+ Note
After changing the settings in system register 5, do not forget to adjust the addresses of the timers/counters in your PLC program because they correspond to the TM/CT numbers.
Matsushita Electric Works (Europe) AG
1–5
Basics 1.1
NAiS Control 1131 Operands
1.1.5
Data Registers (DT)
Data registers have a width of 16 bits. You can use them, for example, to write and read constants/parameters. If an instruction requires 32 bits, two 16–bit data registers are used. If this is the case, enter the address of the first data register with the prefix DDT instead of DT. The next data register (word) will be used automatically (* example 1.2.1). 2. word DT2
1. word DT1
32 bit data register
Data registers can be holding or non–holding. Holding means that even after a power failure all data will be saved. Set the holding/non–holding areas in system register 8 by entering the start address of the holding area. The amount of data registers available depends on the PLC type (* hardware description).
1.1.6
Special Data Registers (DT)
Special data registers are like the special internal relays reserved for special functions and are in most cases set/reset by the PLC. The register has a width of 16 bits (data type = WORD). The amount of special data registers available depends on the PLC type (* hardware description). Most special data registers can only be read. Here some exceptions:
• • • •
1–6
actual values of the high–speed counter (DT9044 and DT9045; for FP0–T32CP DT90044 and DT90045) control flag of the high–speed counter DT9052 (DT90053 for FP0–T32CP) real–time clock (DT9054 to DT9058; FP0–T32CP: DT90054 to DT90058) interrupts and scan time (DT9027, DT9023–DT9024; FP0–T32CP: DT90027, DT90023–DT90024)...
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Basics 1.1
1.1.7
Operands
File Registers (FL)
Some PLC–types (* hardware description) provide additional data registers which can be used to increase the number of data registers. File registers are used in the same way as data registers. Set the holding/non–holding area in system register 9. Holding means 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 manual FP3/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 manual FP3/FP5 MEWNET Link Unit, ACGM0015.
Matsushita Electric Works (Europe) AG
1–7
Basics 1.2
NAiS Control 1131 Addresses
1.2
Addresses
In the List of Global Variables, enter the physical address in the field “Address” for each global variable used in the PLC program. The operand and the address number are part of the address. In NAiS Control you can use 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. The next two sections show how Matsushita and IEC addresses are composed.
1–8
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Basics 1.2
1.2.1
Addresses
Matsushita Addresses
A Matsushita address represents the hardware address of an in–/output, register, or counter. 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.
Matsushita Electric Works (Europe) AG
1–9
Basics 1.2
NAiS Control 1131 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 PLC program. The results can either be stored or sent to the output relays, which means the PLC 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 output 4 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 abbreviation for in–/output, an abbreviation for the data type and of the word and bit address:
,
Example:
IEC address for an input %IX0.0 Physical Address
Bit Address Input
Word Address Data Type=BOOL
The per cent sign is the indicator of a physical address. “I” means input, “X” means data type BOOL. The first zero represents the word address (slot no.) and the second one the bit address. Note that counting starts with zero and that counting word and bit addresses differs among the PLC types.
,
Each PLC provides internal memory areas (M) to store interim results, for example. When using internal memory areas such as data registers, do not forget the additional number (here 5) for the memory type: Example:
IEC address for an internal memory area %MW5.0 Physical Address
Word Address Internal Memory Area
Data Type
Memory Type
Bit addresses do not have to be defined for data registers, counters, timers, or the set and actual values. 1 – 10
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Basics 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 hardware description 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
–1,175494 x 10–38 to –3,402823 x 10–38 1,175494 x 10–38 to 3,402823 x 10–38
REAL
and
32 bit
*depends on your PLC
+ Note
Please take into account that not all data types can be used with each IEC command.
* next page
Matsushita Electric Works (Europe) AG
1 – 11
Basics 1.2
NAiS Control 1131 Addresses
Numbering of in–/output addresses depends on the type of PLC used (* respective hardware 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 with 16 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 and bit number begins at zero for the outputs.
+ Notes
• • •
1 – 12
Find the tables with all memory areas in your hardware description. When using timers, counters, set/elapsed values, and data registers, 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 the IEC–address.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Basics 1.3
1.3
Constants
Constants
A constant represents a fixed value. Depending on the application, a constant can be used as a addend, multiplier, address, in–/output number, set value, etc. There are 3 types of constants:
• • • 1.3.1
decimal hexadecimal BCD
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 and are 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 constants can 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 or hexadecimal: 16#9999
Matsushita Electric Works (Europe) AG
1 – 13
Basics 1.4
NAiS Control 1131 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
–1,175494 x 10–38 to –3,402823 x 10–38 1,175494 x 10–38 to 3,402823 x 10–38
REAL
and
32 bit
*depends on your PLC A data type has to be assigned to each variable. User defined data types We differentiate between array and Data Unit Types (DUT). An array consists of several elementary data types which are all of the same type. A DUT consists of several elementary data types but of different data types. Each represents a new data type.
1 – 14
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Basics 1.4
1.4.1
Data Types
BOOL
Variables of the data type BOOL are binary switches. They either have the status 0 or 1 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 List of Global Variables = 0 (FALSE). In this case the variable has the status FALSE at the moment the PLC program starts. If it should be TRUE at the start, reset the initial value to TRUE.
1.4.2
INTEGER
Variables of the data type INTEGER are integral natural numbers (without comma) and in 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 List of Global Variables = 0 (FALSE). You can enter INTEGER numbers in DEC, HEX– or BIN 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 without commas 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 List of 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
Matsushita Electric Works (Europe) AG
1 – 15
Basics 1.4
NAiS Control 1131 Data Types
1.4.4
STRING
The data type STRING consists of a series, i.e. string, of ASCII characters. You can store a maximum of 255 characters in one string. Each character of the string is stored in a byte.
+ Notes
• • •
1.4.5
The data type STRING is only available for the FP2 and FP10SH. For the PLCs FP0, FP1 and FP–M you can only enter the data type STRING as a constant in the POU body (* F95_ASC of the Matsushita Library). For detailed information, * Online Help in NAiS Control.
WORD
A variable of the data type WORD consists of 16 bits. The states of 16 in–/outputs can be represented by one word (WORD), for example. The default intial value, e.g. for the variable declaration in the POU header or in the List of 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 32 in–/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 List of 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
1 – 16
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Basics 1.4
1.4.7
Data Types
ARRAY
An array is a combination of variables, all of which have the same data type. This combination represents a variable itself, and therefore it has to be declared. This means that in order to make an array available for the entire project, it has to be declared in the List of Global Variables. If an array is used within a POU only, declare it in the POU header 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[1] element 2
onedim_array[14] element 15
onedim_array[15] element 16
* next page Matsushita Electric Works (Europe) AG
1 – 17
Basics 1.4
NAiS Control 1131 Data Types
Initialize Arrays with Values The initialisation of arrays with values starts with the first array element (element 1) and ends with the last array element (element 16). The initialisation values are entered one after another into the field initial and are separated from each other by commas. If subsequent array elements are initialised with the same value, the abbreviated 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 2 etc.
Use Array Elements in the Program You 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 in the value range of the array declaration. For this example Var1 is assigned to the range 0...15 In the example you call up the third array element (Element 3) with onedim_array[2]. If you wish to assign a value to this element in an IL program for example, you enter the following: LD current_temperature ST onedim_array[2]
Addresses of Array Elements The array elements of the 1–dimensional array are subsequently saved in the PLC’s memory starting with element 1. This means for the example described above:
1 – 18
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)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Basics 1.4
,
Example:
Data Types
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 values The initialisation of arrays with values starts with the first array element (element 1) and ends with the last array element (element 18). The initialisation values are entered one after another into the field initial and are separated from each other by commas. If subsequent array elements are initialised with the same value, the abbreviated 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 with the value TRUE and the remaining array elements are initialised with FALSE.
Use array elements in the program You 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 be located in the value range of the array declaration. For this example Var1 is assigned 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 wish to assign a value to this element in an IL program for example, you enter the following: LD ST
current_temperature twodim_array[4,6]
* next page Matsushita Electric Works (Europe) AG
1 – 19
Basics 1.4
NAiS Control 1131 Data Types
Addresses of array elements The array elements of the 2–dimensional array are subsequently saved in the PLC’s memory starting with element 1. The following storage occupation results for the example described above:
,
Example:
Matsushita Address
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]
3–dimensional ARRAY
Declaration in the global variable list:
The declared array can be imagined as follows: threedim_array[1,0,4] element 111
threedim_array[–7,0,2] element 13
threedim_array[–8,0,2] element 1 threedim_array[–8,0,3] element 2
1 – 20
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Basics 1.4
Data Types
Initialize arrays with values The initialisation of arrays with values starts with the first array element (element 1) and ends with the last array element (element 120). The initialisation values are entered one after another into the field initial and are separated from each other by commas. If subsequent array elements are initialised with the same value, the abbreviated writing number(value) is possible. * 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 program Access to a 3–dimensional array is possible by entering identifier[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 have to be located in the value range of the array declaration (see field Type). For this example Var1 is assigned to the range 8...1 and Var2 to the range 0...3 and Var3 to the range 2...4. In the example you call up element 15 with threedim_array[–7,0,4]. If you wish to assign a value to this element in an IL program, for example, you enter the following: LD current_temperature ST threedim_array[–7,0,4]
Addresses of array elements The array elements of the 3–dimensional array are subsequently saved in the PLC’s memory starting with element 1. The following storage occupation results for the example described above: Matsushita Address
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]
Matsushita Electric Works (Europe) AG
1 – 21
Basics 1.4
NAiS Control 1131 Data Types
1.4.8
TIME
For variables of the data type TIME (16 Bit), using FP1 or FP–M, you can indicate an interval 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 of 0.01 to 21 474 836.47 seconds. The resolution amounts to 10ms. Default ( 16 and 32 bit) = T#0
+ Note ,
(corresponds to 0 seconds)
Times with negative signs cannot be processed. T#–2s is e.g. interpreted as T#10m53s350ms.
Example: T#321,12s T#321120ms T#0,01s T#3d5h10m3s100ms
1.4.9
REAL
Variables of the data type REAL are real numbers or floating point constants. The value range for REAL values is between –1,175494 x 10–38 to –3,402823 x 10–38 and 1,175494 x 10–38 to 3,402823 x 10–38. The default for the initial value, e.g. for the variable declaration in the POU header or in the global variable list = 0.0 You can enter REAL values in the following format: [+–] Integer.Integer [(Ee) [+–] Integer]
,
Example: 5.983e–7 –33.876e12 3.876e3 0.000123 123.0
+ Note
1 – 22
The REAL value always has to be entered with a decimal point (e.g. 123.0).
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
IEC Functions
NAiS Control 1131
(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
2 -- 2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)BOOL_TO_INT Outline
BOOL_TO_INT converts a value of the data type BOOL into a value of the data type INT. If you require an enable output and an enable input: E_BOOL_TO_INT
J Data Types
Example
Input Variable
Output Variable
BOOL
INTEGER
BOOL_TO_INT In this example the function BOOL_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD The Boolean_value of the data type BOOL is converted into a value of the data type INTEGER. The converted value is written into 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 editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
2–3
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under BOOL_TO_INT also applies to E_BOOL_TO_INT. The function E_BOOL_TO_INT, however, has in addition 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_BOOL_TO_INT In this example the function E_BOOL_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (Boolean_value and enable) have been declared. However, you may enter constants directly at the input contact of the function (enable input e.g. for tests). LD If enable is set (TRUE), the Boolean_value (1 bit) will be converted into an INTEGER value. The converted value is written into INT_value.
IL If you want to call up the function in an instruction list, enter the following:
Note
2–4
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)BOOL_TO_DINT Outline
BOOL_TO_DINT converts a value of the data type BOOL into a value of the data type DINT. If you require an enable output and an enable input: E_BOOL_TO_DINT
J Data Types
Example
Input Variable
Output Variable
BOOL
DOUBLE INTEGER
BOOL_TO_DINT In this example the function BOOL_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD The Boolean_value of the data type BOOL is converted into a DOUBLE INTEGER value. The converted value is written into DINT_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 editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
2–5
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under BOOL_TO_DINT also applies to E_BOOL_TO_DINT. The function E_BOOL_TO_DINT, however, has in addition 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_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 further function blocks/functions with ENO which are controlled by the status of EN. E_BOOL_TO_DINT In this example the function E_BOOL_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (Boolean_value and enable) have been declared. However, you may enter constants directly at the input contact of the function (enable input e.g. for tests). LD If enable is set (TRUE), the Boolean_value (1 bit) is converted into a DOUBLE INTEGER value (32 bit). The converted value is written into DINT_value.
IL If you want to call the function in an instruction list, enter the following:
Note 2–6
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)BOOL_TO_WORD Outline
BOOL_TO_WORD converts a value of the data type BOOL into a value of the data type WORD. If you require an enable output and an enable input: E_BOOL_TO_WORD
J Data Types
Example
Input Variable
Output Variable
BOOL
WORD
BOOL_TO_WORD In this example the function BOOL_TO_WORD is programmed in ladder diagram (LD) instruction list (IL) programmiert. The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD The Boolean_value of the data type BOOL is converted into a value of the data type WORD. The converted value is written into WORD_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 editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
2–7
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under BOOL_TO_WORD also applies to E_BOOL_TO_WORD. The function E_BOOL_TO_WORD, however, has in addition 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_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 further function blocks/functions with ENO which are controlled by the status of EN. E_BOOL_TO_WORD In this example the function E_BOOL_TO_WORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (Boolean_value and enable) have been declared. However, you may enter constants directly at the input contact of the function (enable input e.g. for tests). LD Boolean_value (1 bit) is converted into a value of the data type WORD (16 bit). The converted value is written into WORD_value.
IL If you want to call the function in an instruction list, enter the following:
Note
2–8
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)BOOL_TO_DWORD Outline
BOOL_TO_DWORD converts a value of the data type BOOL into a value of the data type DWORD. If you require an enable output and an enable input: E_BOOL_TO_DWORD
J Data Types
Example
Input Variable
Output Variable
BOOL
DOUBLE WORD
BOOL_TO_DWORD In this example the function BOOL_TO_DWORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD The Boolean_value of the data type BOOL is converted into a value of the data type DOUBLE INTEGER. The converted value is written into DWORD_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 editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
2–9
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under BOOL_TO_DWORD also applies to E_BOOL_TO_DWORD. The function E_BOOL_TO_DWORD, however, has in addition 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_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 further function blocks/functions with ENO which are controlled by the status of EN. E_BOOL_TO_DWORD In this example the function E_BOOL_TO_DWORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (Boolean_value and enable) have been declared. However, you may enter constants directly at the input contact of the function (enable input e.g. for tests). LD If enable is set (TRUE), the Boolean_value (1 bit) is converted into a value of the data type DOUBLE WORD. The converted value is written into DWORD_value.
IL If you want to call up the function in an instruction list, enter the following:
Note 2 – 10
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)INT_TO_BOOL Outline
INT_TO_BOOL converts a value of the type INT into a value of the type BOOL. If you require an enable output and an enable input: E_INT_TO_BOOL
J Data Types
Example
Input Variable
Output Variable
INTEGER
BOOL
INT_TO_BOOL In this example the function INT_TO_BOOL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD INT_value (16 bit) of the data type INTEGER is converted into a Boolean value. The result is written into Boolean_value.
IL If you want to call the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 11
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under INT_TO_BOOL also applies to E_INT_TO_BOOL. The function E_INT_TO_BOOL, however, has in 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_INT_TO_BOOL In this example the function E_INT_TO_BOOL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (INT_value and enable) have been declared. Instead, you may enter constants directly at the input contact of the function (enable input e.g. for tests). LD If 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 written into Boolean_value.
IL If you want to call the function in an instruction list, enter the following:
Notes
• •
2 – 12
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 editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)INT_TO_DINT Outline
INT_TO_DINT converts a value of the type INT into a value of the type DINT. If you require an enable output and an enable input: E_INT_TO_DINT
J Data Types
Example
Input Variable
Output Variable
INTEGER
DOUBLE INTEGER
INT_TO_DINT In this example the function INT_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD INT_value of the data type INTEGER is converted into a value of the data type DOUBLE INTEGER. The result will be written into DINT_value.
IL If 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 editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
2 – 13
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under INT_TO_DINT also applies to E_INT_TO_DINT. The function E_INT_TO_DINT, however, has in 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_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 further function blocks/functions with ENO which are controlled by the status of EN. E_INT_TO_DINT In this example the function E_INT_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (INT_value and enable) have been declared. However, you may enter constants directy at the input contact ofthe function (enable input e.g. for tests). LD If 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.
IL If you want to call the function in an instruction list, enter the following:
Note 2 – 14
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)INT_TO_WORD Outline
INT_TO_WORD converts a value of the type INT into a value of the type WORD. If you require an enable output and an enable input: E_INT_TO_WORD
J Data Types
Example
Input Variable
Output Variable
INTEGER
WORD
INT_TO_WORD In this example the function INT_TO_WORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD INT_value of the data type INTEGER is converted into a value of the data type WORD. The result is written in WORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 15
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under INT_TO_WORD also applies to E_INT_TO_WORD. The function E_INT_TO_WORD, however, has in 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_INT_TO_WORD In this example the function E_INT_TO_WORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If 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 converted value is written in WORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 16
The bit combination of the input variable will be assigned to the output variable. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)INT_TO_DWORD Outline
INT_TO_DWORD converts a value of the type INT into a value of the type DWORD. If you require an enable output and an enable input: E_INT_TO_DWORD
J Data Types
Example
Input Variable
Output Variable
INTEGER
DOUBLE WORD
INT_TO_DWORD In this example the function INT_TO_DWORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD INT_value of the data type INTEGER is converted into a value of the data type DOUBLE WORD (32 bit). The result is written in DWORD_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 editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
2 – 17
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under INT_TO_DWORD also applies to E_INT_TO_DWORD. The function E_INT_TO_DWORD, however, has in 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_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 further function blocks/functions with ENO which are controlled by the status of EN. E_INT_TO_DWORD In this example the function E_INT_TO_DWORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If 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). The converted value is written in DWORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Note 2 – 18
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)INT_TO_REAL Outline
INT_TO_REAL converts a value of the data type INTEGER into a value of the data type REAL. If you require an enable input (EN) and an enable output (ENO): E_INT_TO_REAL
J Data Types
Example
Input Variable
Output Variable
INTEGER
REAL
INT_TO_REAL In this example the function INT_TO_REAL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 ofthe function. LD INT_value of the data type INTEGER is converted into a value of the data type REAL.The converted value is stored in REAL_value.
IL If 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 editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
2 – 19
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Anything stated under INT_TO_REAL also applies to E_INT_TO_REAL. However, in addition to the INT_TO_REAL function, E_INT_TO_REAL has an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_INT_TO_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 further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
INTEGER
REAL
E_INT_TO_REAL In this example the function E_INT_TO_REAL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (INT_value and enable) have been declared. Instead, you may enter constants directy at the input contact ofthe function (enable input e.g. for tests). LD If enable is set (TRUE), INT_value of the data type INTEGER is converted into a value of the data type REAL. The converted value is written into REAL_value.
IL If you want to call the function in an instruction list, enter the following:
Note 2 – 20
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)INT_TO_TIME Outline
INT_TO_TIME converts a value of the type INT into a value of the type TIME. The resolution is 10ms, e.g. when the INTEGER value = 350, the TIME value = 3s500ms. If you require an enable output and an enable input: E_INT_TO_TIME.
J Data Types
Example
Input Variable
Output Variable
INTEGER
TIME
INT_TO_TIME In this example the function INT_TO_TIME is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POE Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD INT_value of the data type INTEGER is converted into a value of the data type TIME. The result will be written into the output variable time_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 editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
2 – 21
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under INT_TO_TIME also applies to E_INT_TO_TIME. The function E_WORD_TO_DWORD, however, has in 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_TIME 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 further function blocks/functions with ENO which are controlled by the status of EN. E_INT_TO_TIME In this example the function E_INT_TO_TIME is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POE Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), INT _value of the data type INTEGER will be converted into a value of the data type TIME. The result will be written into the output variable time_value. Once the function has been processed, ENO will be set.
IL If you wish to call up the function in an instruction list, enter the following:
Note 2 – 22
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)INT_TO_BCD Outline
INT_TO_BCD converts a binary value of the type INTEGER in a BCD value (binary coded decimal integer) of the type WORD in order to be able to output BCD values in word format. If you require an enable output and an enable input: E_INT_TO_BCD
J Data Types
Example
Input Variable
Output Variable
INTEGER
WORD
INT_TO_BCD In this example the function INT_TO_BCD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 input contact of the function. LD INT_value of the data type INTEGER is converted into a BCD value of the data type WORD. The converted value is written into BCD_value_16bit.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 23
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under INT_TO_BCD also applies to E_INT_TO_BCD. E_INT_TO_BCD, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the type BOOL. If EN is set (TRUE), E_INT_TO_BCD 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 further function blocks/functions with ENO which are controlled by the status of EN. E_INT_TO_BCD E_INT_TO_BCD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (INT_value and enable) have been declared. Instead, you may enter decimal constants (0 – 9999) for INT_value and a constant for the enable input (e.g. for tests) directly at the input contact of the function instead. LD If enable is set (TRUE), INT_value of the data type INTEGER is converted into a BCD value of the data type WORD. The converted value is written into BCD_value_16bit. IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 24
Since the output variable is of the type WORD and 16 bits wide, the value of the input variable should have a maximum of 4 decimal places and should thus be located between 0 and 9999. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DINT_TO_BOOL Outline
DINT_TO_BOOL converts a value of the data type DINT into a value of the data type BOOL. If you require an enable output and an enable input: E_DINT_TO_BOOL
J Data Types
Example
Input Variable
Output Variable
DOUBLE INTEGER
BOOL
DINT_TO_BOOL In this example the function DINT_TO_BOOL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD DINT_value of the data type DOUBLE INTEGER is converted into a value of the data type BOOL. The converted value in written in Boolean_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 25
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under DINT_TO_BOOL also applies to E_DINT_TO_BOOL. E_DINT_TO_BOOL, however, has in addition 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_BOOL 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 further function blocks/functions with ENO which are controlled by the status of EN. E_DINT_TO_BOOL In this example the function E_DINT_TO_BOOL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD DINT_value of the data type DOUBLE INTEGER (32 bit) is converted into a Boolean value (1 bit). The converted value is written in Boolean_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 26
If the variable DINT_value has the value 0, the conversion result = FALSE, in any other case it will be TRUE. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DINT_TO_INT Outline
DINT_TO_INT converts a value of the data type DINT into a value of the data type INT. If you require an enable output and an enable input: E_DINT_TO_INT
J Data Types
Example
Input Variable
Output Variable
DOUBLE INTEGER
INTEGER
DINT_TO_INT In this example the function DINT_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD DINT_value of the data type DOUBLE INTEGER (32 bit) is converted into a value of the data type INTEGER (16 bit). The converted value is written in INT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 27
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under DINT_TO_INT also applies to E_DINT_TO_INT. The function E_DINT_TO_INT, however, has in addition 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 status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_DINT_TO_INT In this example the function E_DINT_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), the DINT_value of the data type DOUBLE INTEGER (32 bit) will be converted into a value of the data type INTEGER (16 bit). The converted value will be written in INT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 28
The value of the input variable should be between –32768 and 32767. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DINT_TO_WORD Outline
DINT_TO_WORD converts a value of the data type DINT into a value of the data type WORD. If you require an enable output and an enable input: E_DINT_TO_WORD
J Data Types
Example
Input Variable
Output Variable
DOUBLE INTEGER
WORD
DINT_TO_WORD In this example the function DINT_TO_WORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD DINT_value of the data type DOUBLE INTEGER (32 bit) is converted into a value of the data type WORD (16 bit). The converted value is written in WORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 29
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under DINT_TO_WORD also applies to E_DINT_TO_WORD. E_DINT_TO_WORD, however, has in addition 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_DINT_TO_WORD In this example the function E_DINT_TO_WORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), the DINT_value of the data type DOUBLE INTEGER (32 bit) will be converted into a value of the data type WORD (15 bit). The converted value will be written in WORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 30
The first 16 bits of the input variable are assigned to the output variable. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DINT_TO_TIME Outline
DINT_TO_TIME bzw. E_DINT_TO_TIME converts a value of the data type DINT into a value of the data type TIME. A value of 1 corresponds to a time of 10ms, e.g. an input value of 123 is converted to a TIME T#1s230.00ms.
J Data types
Example
input variable
output variable
DINT
TIME
DINT_TO_TIME In this example the function DINT_TO_TIME is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variable DINT_value is declared. However, you can write a constant directly at the input contact of the function instead. Body DINT_value of the data type DOUBLE INTEGER is converted to value of the data type TIME. The result is written into the output variable time_value. LD Body
IL Body If you wish to call up the function using instruction list, enter the following:
Note next page
Matsushita Electric Works (Europe) AG
2 – 31
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
E_DINT_TO_TIME has in addition an enabled input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), the function is 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. Hence, you can connect further FP/FUN to the ENO that are determined by EN. E_DINT_TO_TIME POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variables start and DINT_value have been declared. However, you can write a constant directly at the input contact of the function instead. Body When start is set (TRUE), DINT_value of the data type DOUBLE INTEGER is converted to a value of the data type TIME. The result is written into the output variable time_value. 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
2 – 32
It does not matter whether the names of the functions are capitalized in the IL editor or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DINT_TO_DWORD Outline
DINT_TO_DWORD converts a value of the data type DINT into a value of the data type DWORD. If you require an enable output and an enable input: E_DINT_TO_DWORD
J Data Types
Example
Input Variable
Output Variable
DOUBLE INTEGER
DOUBLE WORD
DINT_TO_DWORD In this example the function DINT_TO_DWORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD DINT_value of the data type DOUBLE INTEGER is converted into a value of the data type DOUBLE WORD. The converted value is written in DWORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 33
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under DINT_TO_DWORD also applies to E_DINT_TO_DWORD. E_DINT_TO_DWORD, however, has in addition 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_DINT_TO_DWORD In this example the function E_DINT_TO_DWORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), the DINT_value of the data type DOUBLE INTEGER (32 bit) will be converted into a value of the data type DOUBLE WORD (32 bit). The converted value will be written in DWORD_value.|
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 34
The bit combination of the input variable is assigned to the output variable. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DINT_TO_REAL Outline
Note
DINT_TO_REAL converts a value of the data type DOUBLE INTEGER into a value of the data type REAL. If you require an enable input (EN) and an enable output (ENO): E_DINT_TO_REAL
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
DOUBLE INTEGER
REAL
DINT_TO_REAL In this example the function DINT_TO_REAL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD DINT_value of the data type DOUBLE INTEGER is converted into a value of the data type REAL. The converted value is stored in REAL_value.
IL If 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
2 – 35
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Anything stated under DINT_TO_REAL also applies to E_DINT_TO_REAL. However, in addition to the DINT_TO_REAL function, E_DINT_TO_REAL has an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_DINT_TO_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 further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
DOUBLE INTEGER
REAL
E_DINT_TO_REAL In this example the function E_DINT_TO_REAL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (DINT_value and enable) have been declared. Instead, you may enter constants directly at the input contact of the function (enable input e.g. for tests). LD If enable is set (TRUE), DINT_value of the data type DOUBLE INTEGER is converted into a value of the data type REAL. The converted value is stored in REAL_value.
IL If you want to call the function in an instruction list, enter the following:
Note 2 – 36
It is not important whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DINT_TO_BCD Outline
DINT_TO_BCD converts a value of the data type DINT into a BCD value of the data type DWORD. If you require an enable output and an enable input: E_DINT_TO_BCD
J Data Types
Example
Input Variable
Output Variable
DOUBLE INTEGER
DOUBLE WORD
DINT_TO_BCD In this example the function DINT_TO_BCD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants. LD DINT_value of the data type DOUBLE INTEGER is converted into a BCD value of the data type DOUBLE WORD. The converted value is written in BCD_value_32bit.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 37
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under DINT_TO_BCD also applies to E_DINT_TO_BCD. The function E_DINT_TO_BCD, however, has in 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 status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_DINT_TO_BCD In this example the function E_DINT_TO_BCD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), the DINT_value of the data type DOUBLE INTEGER (32 bit) will be converted into a BCD value of the data type DOUBLE WORD (32 bit). The converted value will be written in BCD_value_32bit.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 38
The value for the input variable should be between 0 and 99999999. It is not important whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)WORD_TO_BOOL Outline
WORD_TO_BOOL converts a value of the type WORD into a value of the type BOOL. If you require an enable output and an enable input: E_WORD_TO_BOOL
J Data Types
Example
Input Variable
Output Variable
WORD
BOOL
WORD_TO_BOOL In this example the function WORD_TO_BOOL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD WORD_value_16bit of the data type WORD is converted into a Boolean value (1 bit). The result will be written in Boolean_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 39
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under WORD_TO_BOOL also applies to E_WORD_TO_BOOL. E_WORD_TO_BOOL, however, has in 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_BOOL 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 further function blocks/functions with ENO which are controlled by the status of EN. E_WORD_TO_BOOL In this example the function E_WORD_TO_BOOL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set, the value WORD _value (16 bit) of the data type WORD will be converted into a Boolean value. The result will be written in Boolean_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 40
If the variable WORD_value has the value 0 (16#0000), 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 editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)WORD_TO_INT Outline
WORD_TO_INT converts a value of the type WORD into a value of the type INT. If you require an enable output and an enable input: E_WORD_TO_INT
J Data Types
Example
Input Variable
Output Variable
WORD
INTEGER
WORD_TO_INT In this example the function WORD_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants/variables. LD WORD_value of the data type WORD is converted into a value of the data type INTEGER. The result will be written in 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
2 – 41
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under WORD_TO_INT also applies to E_WORD_TO_INT. The function E_WORD_TO_INT, however, has in 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_WORD_TO_INT In this example the function E_WORD_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set, the value in WORD _value (16 bit) of the data type WORD will be converted into an INTEGER value. The result will be written in INT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 42
The bit combination of WORD_value is assigned to INT_value. It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)WORD_TO_DINT Outline
WORD_TO_DINT converts a value of the type WORD into a value of the type DINT. If you require an enable output and an enable input: E_WORD_TO_DINT
J Data Types
Example
Input Variable
Output Variable
WORD
DOUBLE INTEGER
WORD_TO_DINT In this example the function WORD_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants/variables. LD WORD_value of the data type WORD is converted into a value of the data type INTEGER. The result will be written in DINT_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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
2 – 43
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under WORD_TO_DINT also applies to E_WORD_TO_DINT. E_WORD_TO_DINT, however, has in 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_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 further function blocks/functions with ENO which are controlled by the status of EN. E_WORD_TO_DINT In this example the function E_WORD_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set, the value WORD _value (16 bit) of the data type WORD will be converted into a value of the data type DOUBLE INTEGER. The result will be written in DINT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Note 2 – 44
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)WORD_TO_DWORD Outline
WORD_TO_DWORD converts a value of the type WORD into a value of the type DWORD. If you require an enable output and an enable input: E_WORD_TO_DWORD
J Data Types
Example
Input Variable
Output Variable
WORD
DOUBLE WORD
WORD_TO_DWORD In this example the function WORD_TO_DWORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants/variables. LD WORD_value of the data type WORD is converted into a value of the data type DOUBLE WORD. The result will be written in DWORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
The bit combination of WORD_value is assigned to DWORD_value. It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
2 – 45
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under WORD_TO_DWORD also applies to E_WORD_TO_DWORD. E_WORD_TO_DWORD, however, has in 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. WORD_TO_DWORD In this example the function E_WORD_TO_DWORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set, the value in WORD _value (16 bit) of the data type WORD will be converted into a value of the data type DOUBLE WORD (32 bit). The result will be written in DWORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Note 2 – 46
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)WORD_TO_TIME Outline
WORD_TO_TIME converts a value of the type WORD into a value of the type TIME. If you require an enable output and an enable input: E_WORD_TO_TIME
J Data Types
Example
Input Variable
Output Variable
WORD
TIME
WORD_TO_TIME input variable 12345 ⇒ output variable: T#123.45s or input variable 16#0012 ⇒ output variable: T#180ms In this example the function WORD_TO_TIME is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD WORD_value of the data type WORD (16 bit) is converted into a value of the data type TIME (16 bit). The result will be written into the output variable time_value.
IL If you wish to call up the function in an instruction list, enter the following:
Note next page
Matsushita Electric Works (Europe) AG
2 – 47
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under WORD_TO_TIME also applies to E_WORD_TO_TIME. E_WORD_TO_TIME, however, has in 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_TIME 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 further function blocks/functions with ENO which are controlled by the status of EN. E_WORD_TO_TIME Input variable: 4444 ⇒ output variable: T#44.44s In this example the function E_WORD_TO_TIME is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), WORD _value of the data type WORD will be converted into a value of the data type TIME. The result will be written into the output variable time_value. Once the function has been processed, ENO will be set.
IL If you wish to call up the function in an instruction list, enter the following:
Note 2 – 48
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DWORD_TO_BOOL Outline
DWORD_TO_BOOL converts a value of the data type DOUBLE WORD into a value of the data type BOOL. If you require an enable output and an enable input: E_DWORD_TO_BOOL
J Data Types
Example
Input Variable
Output Variable
DOUBLE WORD
BOOL
DWORD_TO_BOOL In this example the function DWORD_TO_BOOL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD DWORD_value of the data type DOUBLE WORD is converted into a Boolean value (1 bit). the converted value is written in Boolean_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 49
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
E_DWORD_TO_BOOL converts a value of the data type DOUBLE WORD into a value of the data type BOOL. In addition to the DWORD_TO_BOOL function, E_DWORD_TO_BOOL has an enable input (EN) and an enable output (ENO) of the data type BOOL. 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 remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_DWORD_TO_BOOL In this example the function E_DWORD_TO_BOOL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), the DWORD_value of the data type DOUBLE WORD will be converted into a Boolean value (1 bit). The converted value will be written in Boolean_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 50
If the variable DWORD_value has the value 0 (16#00000000), the conversion result will be = FALSE; in any other case it will be TRUE. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DWORD_TO_INT Outline
DWORD_TO_INT converts a value of the data type DWORD into a value of the data type INT. If you require an enable output and an enable input: E_DWORD_TO_INT
J Data Types
Example
Input Variable
Output Variable
DOUBLE WORD
INTEGER
DWORD_TO_INT In this example the function DWORD_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD DWORD_value of the data type DOUBLE WORD (32 bit) is converted into an INTEGER value (16 bit). The converted value is written in INT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 51
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under DWORD_TO_INT also applies to E_DWORD_TO_INT. E_DWORD_TO_INT, however, has in addition 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_DWORD_TO_INT In this example the function E_DWORD_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), the DWORD_value of the data type DOUBLE WORD (32 bit) will be converted into a value of the data type INTEGER (16 bit). The converted value will be written in INT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 52
The first 16 bit of the input variable are assigned to the output variable. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DWORD_TO_DINT Outline
DWORD_TO_DINT converts a value of the data type DOUBLE WORD into a value of the data type DOUBLE INTEGER. If you require an enable output and an enable input: E_DWORD_TO_DINT
J Data Types
Example
Input Variable
Output Variable
DOUBLE WORD
DOUBLE INTEGER
DWORD_TO_DINT In this example the function DWORD_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD DWORD_value of the data type DOUBLE WORD is converted into a DOUBLE INTEGER value. The converted value is written in DINT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 53
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under DWORD_TO_DINT also applies to E_DWORD_TO_DINT. The function E_DWORD_TO_DINT, however, has in addition 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_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 further function blocks/functions with ENO which are controlled by the status of EN. E_DWORD_TO_DINT In this example the function E_DWORD_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), the DWORD _value of the data type DOUBLE WORD (32 bit) will be converted into a value of the data type DOUBLE INTEGER (32 bit). The converted value will be written in DINT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 54
The bit combination of the input variable will be assigned to the output variable. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DWORD_TO_WORD Outline
DWORD_TO_WORD converts a value of the data type DOUBLE WORD into a value of the data type WORD. If you require an enable output and an enable input: E_DWORD_TO_WORD
J Data Types
Example
Input Variable
Output Variable
DOUBLE WORD
WORD
DWORD_TO_WORD In this example the function DWORD_TO_WORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD DWORD_value of the data type DOUBLE WORD (32 bit) is converted into a value of the data type WORD (16 bit). The converted value is written in WORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes next page
Matsushita Electric Works (Europe) AG
2 – 55
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under DWORD_TO_WORD also applies to E_DWORD_TO_WORD. E_DWORD_TO_WORD, however, has in addition 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_DWORD_TO_WORD In this example the function E_DWORD_TO_WORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), the DWORD _value of the data type DOUBLE WORD (32 bit) will be converted into a value of the data type WORD (16 bit). The converted value will be written in WORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Notes
• •
2 – 56
The first 16 bits of the input variable are assigned to the output variable. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)DWORD_TO_TIME Outline
DWORD_TO_TIME bzw. E_DWORD_TO_TIME converts a value of the data type DWORD into a value of the data type TIME. A value of 1 corresponds to a time of 10ms, e.g. the input value 12345 (16#3039) is converted to a TIME T#2m3s450.00ms.
J Data types
Example
input variable
output variable
DWORD
TIME
DWORD_TO_TIME In this example the function DWORD_TO_TIME is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header In the POU header, all input and output variables are declared that are used 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 function instead. Body DWORD_value of the data type DWORD (32 bits) is converted into a value of the data type TIME (16 bits). The result is written into the output variable time_value. LD Body
IL Body If you wish to call up the function using instruction list, enter the following:
Note next page
Matsushita Electric Works (Europe) AG
2 – 57
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
E_DWORD_TO_TIME has in addition an enabled input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), the function is activated. If EN is reset (FALSE), the status of the variable will be frozen until EN is set again. The status of EN is assumed by ENO. Hence you can connect further FB/FUN that are determined by EN. E_DWORD_TO_TIME POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variables start and DWORD_value have been declared. However, you can write a constant directly at the input contact of the function instead. Body When start is set (TRUE), DWORD_value of the data type DWORD is converted to a value of the data type TIME. The result is written into the output variable time_value. 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
2 – 58
It does not matter whether the names of the functions are capitalized in the IL editor or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)REAL_TO_INT Outline
Note
REAL_TO_INT converts a value of the data type REAL into a value of the data type INTEGER. If you require an enable input (EN) and an enable output (ENO): E_REAL_TO_INT
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
INTEGER
REAL_TO_INT In this example the function REAL_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD REAL_value of the data type REAL is converted into a value of the data type INTEGER. The converted value is stored in INT_value.
IL If 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
2 – 59
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Anything stated under REAL_TO_INT also applies to E_REAL_TO_INT. However, in addition to the REAL_TO_INT function, E_REAL_TO_INT has an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_REAL_TO_INT 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 further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
INTEGER
E_REAL_TO_INT In this example the function E_REAL_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (REAL_value and enable) have been declared. Instead, you may enter constants directly at the input contact of the function (enable input e.g. for tests). LD If enable is set (TRUE), REAL_value of the data type REAL is converted into a value of the data type INTEGER. The converted value is stored in INT_value.
IL If you want to call the function in an instruction list, enter the following:
Note 2 – 60
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)REAL_TO_DINT Outline
Note
REAL_TO_DINT converts a value of the data type REAL into a value of the data type DOUBLE INTEGER. If you require an enable input (EN) and an enable output (ENO): E_REAL_TO_DINT
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
DOUBLE INTEGER
REAL_TO_DINT In this example the function REAL_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD REAL_value of the data type REAL is converted into a value of the data type DOUBLE INTEGER. The converted value is stored in DINT_value.
IL If 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
2 – 61
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Anything stated under REAL_TO_DINT also applies to E_REAL_TO_DINT. However, in addition to the REAL_TO_DINT function, E_REAL_TO_DINT has an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_REAL_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 further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
DOUBLE INTEGER
E_REAL_TO_DINT In this example the function E_REAL_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (REAL_value and enable) have been declared. Instead, you may enter constants directly at the input contact of the function (enable input e.g. for tests). LD If enable is set (TRUE), REAL_value of the data type REAL is converted into a value of the data type DOUBLE INTEGER. The converted value is stored in DINT_value.
IL If you want to call the function in an instruction list, enter the following:
Note 2 – 62
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)TIME_TO_INT Outline
TIME_TO_INT converts a value of the type TIME into a value of the type INT. If you require an enable output and an enable input: E_TIME_TO_INT
J Data Types
Example
Input Variable
Output Variable
TIME
INTEGER
TIME_TO_INT Input variable: T#12.34s ⇒ output variable: 1234 In this example the function TIME_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Time_value of the data type TIME is converted into a value of the data type INTEGER. The result will be written into the output variable 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
2 – 63
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under TIME_TO_INT also applies to E_TIME_TO_INT. The function E_TIME_TO_INT, however, has in addition 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 status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_TIME_TO_INT Input variable: T#0.34s ⇒ output variable: 34 or input variable: T#22.22s ⇒ output variable: 2222 In this example the function E_TIME_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), time_value of the data type TIME will be converted into a value of the data type INTEGER. The result will be written into the output variable INT_value. Once the function has been processed, ENO will be set.
IL If you wish to call up the function in an instruction list, enter the following:
Note 2 – 64
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)TIME_TO_DINT Outline
TIME_TO_DINT bzw. E_TIME_TO_DINT converts a value of the data type TIME into a value of the data type DINT. The time 10ms corresponds to the value 1, e.g. an input value of T#1m0s is converted to the value 6000.
J Data types
Example
input variable
output variable
TIME
DINT
TIME_TO_DINT In this example the function TIME_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variable time_value is declared. However, you can write a constant directly at the input contact of the function instead. Body time_value of the data type TIME is converted to value of the data type DOUBLE INTEGER. The result is written into the output variable DINT_value. LD Body
IL Body If you wish to call up the function using instruction list, enter the following:
Note next page
Matsushita Electric Works (Europe) AG
2 – 65
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
E_TIME_TO_DINT has in addition an enabled input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), the function is 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. Hence, you can connect further FP/FUN to the ENO that are determined by EN. E_TIME_TO_DINT POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variables start and time_value have been declared. However, you can write a constant directly at the input contact of the function instead. Body When start is set (TRUE), time_value of the data type TIME is converted to a value of the data type DOUBLE INTEGER. The result is written into the output variable DINT_value. 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
2 – 66
It does not matter whether the names of the functions are capitalized in the IL editor or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)TIME_TO_WORD Outline
TIME_TO_WORD converts a value of the type TIME into a value of the type WORD. If you require an enable output and an enable input: E_TIME_TO_WORD
J Data Types
Example
Input Variable
Output Variable
TIME
WORD
TIME_TO_WORD Input variable: T#12.34s ⇒ output variable: 1234 or input variable: T#1.00s ⇒ output variable: 16#0064 In this example the function TIME_TO_WORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Time_value of the data type TIME is converted into a value of the data type WORD. The result will be written into the output variable WORD_value.
IL If you wish to call up the function in an instruction list, enter the following:
Note next page Matsushita Electric Works (Europe) AG
2 – 67
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under TIME_TO_WORD also applies to E_TIME_TO_WORD. The function E_TIME_TO_WORD, however, has in addition 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_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 further function blocks/functions with ENO which are controlled by the status of EN. Input variable: T#1.44s ⇒ output variable: 144 or input variable: T#1.44s ⇒ output variable: 16#90 E_TIME_TO_WORD In this example the function TIME_TO_WORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), the time _value of the data type TIME will be converted into a value of the data type WORD. The result will be written into the output variable WORD_value. Once the function has been processed, ENO will be set.
IL If you wish to call up the function in an instruction list, enter the following:
Note 2 – 68
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)TIME_TO_DWORD Outline
TIME_TO_DWORD bzw. E_TIME_TO_DWORD converts a value of the data type TIME into a value of the data type DWORD. The time 10ms corresponds to the value 1, e.g. an input value of T#1s is converted to the value 100 (16#64).
J Data types
Example
input variable
output variable
TIME
DWORD
TIME_TO_DWORD In this example the function TIME_TO_DWORD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variable time_value is declared. However, you can write a constant directly at the input contact of the function instead. Body time_value of the data type TIME is converted to a value of the data type DWORD and written into the output variable DWORD_value. LD Body
IL Body If you wish to call up the function using instruction list, enter the following:
Note next page
Matsushita Electric Works (Europe) AG
2 – 69
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
E_TIME_TO_DWORD has in addition an enabled input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), the function is 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. Hence, you can connect further FP/FUN to the ENO that are determined by EN. E_ TIME_TO_DWORD POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variables start and time_value have been declared. However, you can write a constant directly at the input contact of the function instead. Body When start is set (TRUE), time_value of the data type TIME is converted to a value of the data type DWORD. The result is written into the output variable DWORD_value. 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
2 – 70
It does not matter whether the names of the functions are capitalized in the IL editor or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)TRUNC_TO_INT Outline
Note
TRUNC_TO_INT cuts off the decimal digits of a REAL number and delivers an output variable of the data type INTEGER. If you require an enable input (EN) and an enable output (ENO): E_TRUNC_TO_INT
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
INTEGER
TRUNC_TO_INT In this example the function TRUNC_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD The decimal digits of REAL_value are cut off. The result is stored as a 16–bit INTEGER in INT_value.
IL If you want to call the function in an instruction list, enter the following:
Note
Please see notes at the end of this section.
Matsushita Electric Works (Europe) AG
next page 2 – 71
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Anything stated under TRUNC_TO_INT also applies to E_TRUNC_TO_INT. However, in addition to the TRUNC_TO_INT function, E_TRUNC_TO_INT has an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_TRUNC_TO_INT 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 further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
INTEGER
E_TRUNC_TO_INT In this example the function E_TRUNC_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (REAL _value and enable) have been declared. Instead, you may enter constants directly at the input contact of the function (enable input e.g. for tests). LD If enable is set (TRUE), the decimal digits of REAL_value are cut off. The result is stored as a 16–bit INTEGER in INT_value.
IL If you want to call the function in an instruction list, enter the following:
2 – 72
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
Notes
• • •
Cutting off the decimal digits decreases a positive number towards zero and increases a negative number towards zero. It does not matter whether the function names in the IL editor 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 type REAL
R9008
%MX0.900.8
for an instant
output variable is greater than a 16–bit INTEGER
R9009
%MX0.900.9
for an instant
output variable is zero
Matsushita Electric Works (Europe) AG
2 – 73
IEC Functions
NAiS Control 1131
Conversion Functions
(E_)TRUNC_TO_DINT Outline
Note
TRUNC_TO_DINT cuts off the decimal digits of a REAL number and delivers an output variable of the data type DOUBLE INTEGER. If you require an enable input (EN) and an enable output (ENO): E_TRUNC_TO_DINT
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
DOUBLE INTEGER
TRUNC_TO_DINT In this example the function TRUNC_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD The decimal digits of REAL_value are cut off. The result is stored as a 32–bit DOUBLE INTEGER in DINT_value.
IL If you want to call the function in an instruction list, enter the following:
Note 2 – 74
Please see notes at the end of this section. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
Outline
E_TRUNC_TO_DINT cuts off the decimal digits of a REAL number and delivers an output variable of the data type DOUBLE INTEGER. In addition to the TRUNC_TO_DINT function, E_TRUNC_TO_DINT has an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_TRUNC_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 further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
DOUBLE INTEGER
E_TRUNC_TO_DINT In this example the function E_TRUNC_TO_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (REAL_value and enable) have been declared. Instead, you may enter constants directy at the input contact ofthe function (enable input e.g. for tests).
next page
Matsushita Electric Works (Europe) AG
2 – 75
IEC Functions
NAiS Control 1131
Conversion Functions
LD If enable is set (TRUE), the decimal digits of REAL_value are cut off. The result is stored as a 32–bit DOUBLE INTEGER in DINT_value.
IL If you want to call the function in an instruction list, enter the following:
Notes
• • •
2 – 76
Cutting off the decimal digits decreases a positive number towards zero and increases a negative number towards zero. It does not matter whether the function names in the IL editor 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 type REAL
R9008
%MX0.900.8
for an instant
output variable is greater than a 32–bit DOUBLE INTEGER
R9009
%MX0.900.9
for an instant
output variable is zero
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)BCD_TO_INT Outline
BCD_TO_INT converts binary coded decimal numbers (BCD) into binary values of the type INTEGER. If you require an enable input (EN) and an enable output (ENO): E_BCD_TO_INT
J Data Types
Example
Input Variable
Output Variable
WORD
INTEGER
BCD_TO_INT In this example the function BCD_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. 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 INTEGER value. 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 Matsushita Electric Works (Europe) AG
2 – 77
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under BCD_TO_INT also applies to E_BCD_TO_INT. The function E_BCD_TO_INT, however, has in addition 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 status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_BCD_TO_INT In this example the function BCD_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (BCD_value_16bit and enable) have been declared. Instead, you may enter constants directly at the input contact of the function (enable input e.g. for tests). BCD constants can be 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 is converted into an INTEGER value. The converted value is written into variable INT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Note 2 – 78
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)BCD_TO_DINT Outline
BCD_TO_DINT converts a BCD value (binary coded decimal integer) of the data type DOUBLE WORD in a binary value of the data type DOUBLE INTEGER in order to process a BCD value in double word format. If you require an enable output and an enable input: E_BCD_TO_DINT
J Data Types
Example
Input Variable
Output Variable
DOUBLE WORD
DOUBLE INTEGER
BCD_TO_DINT In this example the function BCD_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. BCD constants can be indicated in NAiS Control as follows: 2#00011001100101010001100110010101 or 16#19951995 LD BCD_value_32bit of the data type DOUBLE WORD is converted into a DOUBLE INTEGER value. The converted value is written into DINT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Note next page Matsushita Electric Works (Europe) AG
2 – 79
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under BCD_TO_DINT also applies to E_BCD_TO_DINT. The function E_BCD_TO_DINT, however, has in addition 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_BCD_TO_DINT In this example the function BCD_TO_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (BCD_value_32bit and enable) have been declared. Instead, you may enter constants directly at the input contact of the function (enable input e.g. for tests). BCD constants can be indicated in NAiS Control as follows: 2#00011001100101010001100110010101 or 16#19951995 LD If enable is set (TRUE), BCD_value_32bit of the data type DOUBLE WORD will be converted into a DOUBLE INTEGER value. The converted value will be written into DINT_value.
IL If you wish to call up the function in an instruction list, enter the following:
Note 2 – 80
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)REAL_TO_TIME Outline
Note
REAL_TO_TIME converts a value of the data type REAL to a value of the data time TIME. 10ms of the data type TIME correspond to 1.0 REAL 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 to the nearest whole number for the conversion. If you require an enable output and an enable input: E_REAL_TO_TIME.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
TIME
REAL_TO_TIME In this example the function REAL_TO_TIME is programmed in ladder diagram (LD) and instruction list (IL). Since constants are entered directly at the function’s input contact pins, only the output variable need be declared in the header. POU Header All input and output variables which are required for programming the function are declared in the POU header.
Body By clicking on the view icon while in the online mode, you can see the result 0.00ms immediately. Since the value at the REAL input contact is less 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 editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
2 – 81
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under REAL_TO_TIME also applies to E_REAL TO_TIME. The function E_REAL_TO_TIME, however, has in addition 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_REAL_TO_TIME In this example the function E_REAL_TO_TIME is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
Body In this example the input variables start and input_real have been declared. Instead, you may enter constants directly at the contact pins of the function (enable input e.g. for tests). If start is set (TRUE), input_real of the data type REAL will be converted into a TIME value. The converted value will be written into result_time. LD Body
IL Body If you wish to call up the function in an instruction list, enter the following:
Note
2 – 82
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Conversion Functions
(E_)TIME_TO_REAL Outline
Note
TIME_TO_REAL converts a value of the data type TIME to a value of the data time REAL. 10ms of the data type TIME correspond to 1.0 REAL unit, e.g. when TIME = 10ms, REAL = 1.0; when TIME = 1s, REAL = 100.0. The resolution amounts to 10ms. If you require an enable output and an enable input: E_TIME_TO_REAL.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
TIME
REAL
TIME_TO_REAL In this example the function TIME_TO_REAL is programmed in ladder diagram (LD) and instruction list (IL). POU Header All input and output variables which are required for programming the function 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 editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
2 – 83
IEC Functions
NAiS Control 1131
Conversion Functions
Outline
Example
Anything stated under TIME_TO_REAL also applies to E_TIME_TO_REAL. The function E_TIME_TO_REAL, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the type BOOL. If EN is set (TRUE), E_TIME_TO_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 further function blocks/functions with ENO which are controlled by the status of EN. E_TIME_TO_REAL In this example the function E_TIME_TO_REAL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables start and input_real have been declared. Instead, you may enter constants at the contact pins of the function (enable input e.g. for tests). Body If start is set (TRUE), input_time of the data type TIME will be converted into 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 is rounded down to zero. LD Body
IL Body If you wish to call up the function in an instruction list, enter the following:
Note 2 – 84
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
Chapter 3 Numerical Functions (E_)ABS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 -- 3
IEC Functions
NAiS Control 1131
Numerical Functions
3–2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Numerical Functions
(E_)ABS Outline
ABS calculates the value in the accumulator into an absolute value. The result is saved in the output variable. If you require an enable output and an enable input: E_ABS
J 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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Input_value of the data type INTEGER is converted into an absolute value of the data type INTEGER. The converted value is written in absolute_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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
3–3
IEC Functions
NAiS Control 1131
Numerical Functions
Outline
Example
Anything stated under ABS also applies to E_ABS. E_ABS, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN is set (TRUE), E_ABS 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), the input_value is converted into an absolute value. The converted value is written in absolute_value.
IL If you wish to call up the function in an instruction list, enter the following:
Note
3–4
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
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
IEC Functions
NAiS Control 1131
Arithmetic Functions
4–2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)MOVE Outline
MOVE assigns the unchanged value of the input variable to the output. If you require an enable output and an enable input: E_MOVE
J Data Types
Example
Input Variable
Output Variable
all data types
as input data type
MOVE In this example the function MOVE is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Input_value is assigned to output_value without being modified.
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
4–3
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Example
Anything stated under MOVE also applies to E_MOVE. E_MOVE, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN is set (TRUE), E_MOVE 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD If enable is set (TRUE), input_value is transferred to the variable output_value. E_MOVE serves as assignment operator in the LD and FBC.
IL If you wish to call up the function in an instruction list, enter the following:
Note
4–4
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)ADD Outline
The content of the accumulator is added to the operand defined in the operand field. The result is transferred to the accumulator.
J 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 Identifier
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 Body LD
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 data types. All operands must be of the same data type. It is not important whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
4–5
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Example
E_ADD adds the input variables IN1 + IN2 + ... and writes the addition result into the output variable. E_ADD operates just like the standard operator ADD (see: Online Help: Help > Index > Standard Operators). However, E_ADD has an additional enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN is set (TRUE), E_ADD will be activated. If EN is reset (FALSE), the variable’s status will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. 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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body If enable is set (TRUE), summand_1 is added to summand_2. The result is written in sum.
IL Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
4–6
The number of input contacts a_NumN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)SUB Outline
The content of the accumulator is subtracted from the operand defined in the operand field. The result is transferred to the accumulator.
J 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 Identifier
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 Body LD
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 data types. All operands must be of the same data type. It is not important whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
4–7
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Example
E_SUB operates just as the standard operator SUB (Online Help: Help > Index > Standard Operators). E_SUB, however, has in addition 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 the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. 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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If enable is set, subtrahend (data type INT) is subracted from minuend. The result will be written in result (data type INT).
IL Body If you wish to call up E_SUB in an instruction list, enter the following:
Note 4–8
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)MUL Outline
The content of the accumulator is multiplied by the operand defined in the operand field. The result is transferred to the accumulator.
J 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 Identifier
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 Body LD
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 noted data types. All operands must be of the same data type. It is not important whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
4–9
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Example
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 in 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 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If enable is set (TRUE), the multiplicant is multiplied with the multiplicator. The result will be written in result.
IL Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
4 – 10
The number of input contacts a_NumN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)DIV Outline
The content of the accumulator is divided by the operand defined in the operand field. The result is transferred to the accumulator.
J 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 Identifier
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 Body LD
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 data types. All operands must be of the same data type. It is not important whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
4 – 11
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Note
Example
E_DIV divides the value of the first input variable by the value of the second. E_DIV operates just as the standard operator DIV (Online Help: Help > Index > Standard Operators), however, it has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN is set (TRUE), E_DIV 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 further function blocks/functions with ENO which are controlled by the status of EN.
With FP1–C14/C16 E_DIV cannot be used for a 32–bit division (DINT) as this will cause a compiler error.
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD If enable is set (TRUE), dividend is divided by divisor. The result is written in result.
IL If you wish to call up the function in an instruction list, enter the following:
Note 4 – 12
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)MOD Outline
MOD divides the value of the first input variable by the value of the second. The rest of the integral division (5 : 2 : 2 + rest = 1) is written in the output variable. If you require an enable output and an enable input: E_MOD
J 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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body Dividend is divided by divisor. The integal rest of the division is written in division_rest.
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
4 – 13
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Example
Anything stated under MOD also applies to E_MOD. E_MOD, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN is set (TRUE), E_MOD 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If enable is set (TRUE), dividend is divided by divisor. The rest of the division is written in division_rest (e.g: 5 : 2 = 2; rest = 1).
IL Body If you wish to call up the function in an instruction list, enter the following:
Note
4 – 14
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)SQRT Outline
Note
SQRT calculates the square root of an input variable of the data type REAL (value ≥ 0.0). The result is written into the output variable. If you require an enable input (EN) and an enable output (ENO): E_SQRT.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
SQRT In this example the function SQRT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 Body The square root of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Note
Please see notes at the end of this section.
Matsushita Electric Works (Europe) AG
4 – 15
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Anything stated under SQRT also applies to E_SQRT. However, in addition 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), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value and enable) have been declared. Instead, you may enter a constant at the input contact of the function (enable input e.g. for tests). LD Body If enable is set (TRUE), the square root of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
next page
4 – 16
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
Notes
• •
It does not matter whether the function names in the IL editor are capitalized or not. The following error flags apply to (E_)SQRT: No.
IEC Address
set
if
R9007
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
input variable does not have the data type REAL or input variable is not w 0.0
R900B
%MX0.900.11
permanently
output variable is zero
%MX0.900.9
for an instant
processing result overflows the output variable
R9009
Matsushita Electric Works (Europe) AG
4 – 17
IEC Functions
NAiS Control 1131
Arithmetic Functions
(E_)SIN Outline
Note
SIN calculates the sine of the input variable and writes the result into the output variable. The angle data has to be specified in radians (value < 52707176). If you require an enable input (EN) and an enable output (ENO): E_SIN.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
SIN In this example the function SIN is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 Body The sine of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Note 4 – 18
Please see notes at the end of this section.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
Outline
Anything stated under SIN also applies to E_SIN. However, in addition to the SIN function, E_SIN has an enable input (EN) and an enable 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 the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value and enable) have been declared. Instead, you may enter a constant at the input contact of the function (enable input e.g. for tests). LD Body If enable is set (TRUE), the sine of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Matsushita Electric Works (Europe) AG
4 – 19
IEC Functions
NAiS Control 1131
Arithmetic Functions
Notes
• • •
4 – 20
The accuracy of the calculation decreases as the angle data 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 editor are capitalized or not. The following error flags apply to (E_)SIN: No.
IEC Address
set
if
R9007
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
input variable does not have the data type REAL or input variable is w 52707176
R900B
%MX0.900.11
permanently
output variable is zero
R9009
%MX0.900.9
for an instant
processing result overflows the output variable
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)ASIN Outline
Note
ASIN calculates the arc sine of the input variable and writes the angle data in radians into the output variable. The function returns a value from –π/2 to π/2. If you require an enable input (EN) and an enable output (ENO): E_ASIN.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
ASIN In this example the function ASIN is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 Body The arc sine of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Note
Please see notes at the end of this section.
Matsushita Electric Works (Europe) AG
4 – 21
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Anything stated under ASIN also applies to E_ASIN. However, in addition to the ASIN function, E_ASIN has an enable input (EN) and an 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 the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value and enable) have been declared. Instead, you may enter a constant at the input contact of the function (enable input e.g. for tests). LD Body If enable is set (TRUE), the arc sine of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
next page
4 – 22
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
Notes
• •
It does not matter whether the function names in the IL editor are capitalized or not. The following error flags apply to (E_)ASIN: No.
IEC Address
set
if
R9007
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
input variable does not have the data type REAL 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 output variable
Matsushita Electric Works (Europe) AG
4 – 23
IEC Functions
NAiS Control 1131
Arithmetic Functions
(E_)COS Outline
Note
COS calculates the cosine of the input variable and writes the result into the output variable. The angle data has to be specified in radians (value <52707176). If you require an enable input (EN) and an enable output (ENO): E_COS.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
COS In this example the function COS is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 Body The cosine of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Note 4 – 24
Please see notes at the end of this section.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
Outline
Anything stated under COS also applies to E_COS. However, in addition to the COS function, E_COS has an enable input (EN) and an 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 the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value and enable) have been declared. Instead, you may enter a constant at the input contact of the function (enable input e.g. for tests). LD Body If enable is set (TRUE), the cosine of input_value is calculated and written into output_value.
IL Body If you want to call up the function in an instruction list, enter the following:
Matsushita Electric Works (Europe) AG
4 – 25
IEC Functions
NAiS Control 1131
Arithmetic Functions
Notes
• • •
4 – 26
The accuracy of the calculation decreases as the angle data 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 IL editor are capitalized or not. The following error flags apply to (E_)COS: No.
IEC Address
set
if
R9007
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
input variable does not have the data type REAL or input variable 52707176
R900B
%MX0.900.11
permanently
output variable is zero
R9009
%MX0.900.9
for an instant
processing result overflows the output variable
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)ACOS Outline
Note
ACOS calculates the arc cosine of the input variable and writes the angle data in radians into the output variable. The function returns a value from 0.0 to π. If you require an enable input (EN) and an enable output (ENO): E_ACOS.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
ACOS In this example the function ACOS is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 Body The arc cosine of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Note
Please see notes at the end of this section.
Matsushita Electric Works (Europe) AG
4 – 27
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Anything stated under ACOS also applies to E_ACOS. However, in addition 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), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value and enable) have been declared. Instead, you may enter a constant at the input contact of the function (enable input e.g. for tests). LD Body If enable is set (TRUE), the arc cosine of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
next page
4 – 28
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
Notes
• •
It does not matter whether the function names in the IL editor are capitalized or not. The following error flags apply to (E_)ACOS: No.
IEC Address
set
if
R9007
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
input variable does not have the data type REAL 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 output variable
Matsushita Electric Works (Europe) AG
4 – 29
IEC Functions
NAiS Control 1131
Arithmetic Functions
(E_)TAN Outline
Note
TAN calculates the tangent of the input variable and writes the result into the output variable. The angle data has to be specified in radians (value < 52707176). If you require an enable input (EN) and an enable output (ENO): E_TAN.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
TAN In this example the function TAN is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 Body The tangent of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Note 4 – 30
Please see notes at the end of this section.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
Outline
Anything stated under TAN also applies to E_TAN. However, in addition to the TAN function, E_TAN has an enable input (EN) and an 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 the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value and enable) have been declared. Instead, you may enter a constant at the input contact of the function (enable input e.g. for tests). LD Body If enable is set (TRUE), the tangent of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Matsushita Electric Works (Europe) AG
4 – 31
IEC Functions
NAiS Control 1131
Arithmetic Functions
Notes
• • •
4 – 32
The accuracy of the calculation decreases as the angle data 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 editor are capitalized or not. The following error flags apply to (E_)TAN: No.
IEC Address
set
if
R9007
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
input variable does not have the data type REAL or input variable is w 52707176
R900B
%MX0.900.11
permanently
output variable is zero
R9009
%MX0.900.9
for an instant
processing result overflows the output variable
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)ATAN Outline
Note
ATAN calculates the arc tangent of the input variable (value ± 52707176) and writes the angle data in radians into the output variable. The function returns a value greater than –π/2 and smaller than π/2. If you require an enable input (EN) and an enable output (ENO): E_ATAN.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
ATAN In this example the function ATAN is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 Body The arc tangent of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Note
Please see notes at the end of this section.
Matsushita Electric Works (Europe) AG
4 – 33
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Anything stated under ATAN also applies to E_ATAN. However, in addition to the ATAN function, E_ATAN has an enable input (EN) and an 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 the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value and enable) have been declared. Instead, you may enter a constant at the input contact of the function (enable input e.g. for tests). LD Body If enable is set (TRUE), the arc tangent of input_value is calculated and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
next page
4 – 34
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
Notes
• •
It does not matter whether the function names in the IL editor are capitalized or not. The following error flags apply to (E_)ATAN: No.
IEC Address
set
if
R9007
input variable does not have the data type REAL or input variable 52707176
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
R900B
%MX0.900.11
permanently
output variable is zero
R9009
%MX0.900.9
for an instant
processing result overflows the output variable
Matsushita Electric Works (Europe) AG
4 – 35
IEC Functions
NAiS Control 1131
Arithmetic Functions
(E_)LN Outline
Note
LN calculates the logarithm of the input variable (value > 0.0) to the base e (Euler’s number = 2.7182818) and writes the result into the output variable. This function is the reversion of the EXP function. If you require an enable input (EN) and an enable output (ENO): E_LN.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
LN In this example the function LN is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. Body The logarithm of input_value is calculated to the base e and written into output_value. LD Body
IL Body If you want to call the function in an instruction list, enter the following:
Note 4 – 36
Please see notes at the end of this section. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
Outline
Anything stated under LN also applies to E_LN. However, in addition to the LN function, E_LN has an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_LN will be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value and enable) have been declared. Instead, you may enter a constant directly at the input contact of the function (enable input e.g. for tests). LD Body If enable is set (TRUE), the logarithm of input_value is calculated to the base e and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Matsushita Electric Works (Europe) AG
4 – 37
IEC Functions
NAiS Control 1131
Arithmetic Functions
Notes
• •
It does not matter whether the function names in the IL editor are capitalized or not. The following error flags apply to (E_)LN: No.
IEC Address
set
if
R9007
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
input variable does not have the data type REAL or input variable is not > 0.0
R900B
%MX0.900.11
permanently
output variable is zero
%MX0.900.9
for an instant
processing result overflows the output variable
R9009
4 – 38
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)LOG Outline
Note
LOG calculates the logarithm of the input variable (value > 0.0) to the base 10 and writes the result into the output variable. If you require an enable input (EN) and an enable output (ENO): E_LOG.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
LOG In this example the function LOG is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD Body The logarithm of input_value is calculated to the base 10 and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Note
Please see notes at the end of this section.
Matsushita Electric Works (Europe) AG
4 – 39
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Anything stated under LOG also applies to E_LOG. However, in addition to the LOG function, E_LOG has an enable input (EN) and an 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 the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value and enable) have been declared. Instead, you may enter a constant directly at the input contact of the function (enable input e.g. for tests). LD If enable is set (TRUE), the logarithm of input_value is calculated to the base 10 and written into output_value.
IL If you want to call the function in an instruction list, enter the following:
next page
4 – 40
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
Notes
• •
It does not matter whether the function names in the IL editor are capitalized or not. The following error flags apply to (E_)LOG: No.
IEC Address
set
if
R9007
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
input variable does not have the data type REAL or input variable is not > 0.0
R900B
%MX0.900.11
permanently
output variable is zero
%MX0.900.9
for an instant
processing result overflows the output variable
R9009
Matsushita Electric Works (Europe) AG
4 – 41
IEC Functions
NAiS Control 1131
Arithmetic Functions
(E_)EXP Outline
Note
EXP calculates the power of the input variable to the base e (Euler’s number = 2.7182818) and writes the result into the output variable. The input variable has to be greater than –87.33 and smaller than 88.72. This function is the reverse of the LN function. If you require an enable input (EN) and an enable output (ENO): E_EXP.
This function is only available for the FP0.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
EXP In this example the function EXP is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the function. LD Body The power of input_value is calculated to the base e and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Note 4 – 42
Please see notes at the end of this section. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
Outline
Anything stated under EXP also applies to E_EXP. However, in addition to the EXP function, E_EXP has an enable input (EN) and an 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 the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types
Example
Input Variable
Output Variable
REAL
as input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value and enable) have been declared. Instead, you may enter a constant directly at the input contact of the function (enable input e.g. for tests). LD Body If enable is set (TRUE), the power of input_value is calculated to the base of e and written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Matsushita Electric Works (Europe) AG
4 – 43
IEC Functions
NAiS Control 1131
Arithmetic Functions
Notes
• •
4 – 44
It does not matter whether the function names in the IL editor are capitalized or not. The following error flags apply to (E_)EXP: No.
IEC Address
set
if
R9007
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
input variable does not have the data type REAL 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 output variable
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
(E_)EXPT Outline
Note
EXPT raises the first input variable to the power of the second input variable (OUT = IN1IN2) and writes the result into the output variable. Input variables have to be within the range –1.70141 x 1038 to 1.70141 x 1038. If you require an enable input (EN): and an enable output (ENO): E_EXPT.
This function is only available for the FP0.
J Data Types Input Variable
Example
1st input variable
REAL
2nd input variable
REAL
Output Variable as 1st input data type
EXPT In this example the function EXPT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function 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 the input contacts of the function. LD Body input_value_1 is raised to the power of input_value_2. The result is written into output_value.
IL Body If you want to call the function in an instruction list, enter the following:
Note
Please see notes at the end of this section.
Matsushita Electric Works (Europe) AG
4 – 45
IEC Functions
NAiS Control 1131
Arithmetic Functions
Outline
Anything stated under EXPT also applies to E_EXPT. However, in addition 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), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN.
J Data Types Input Variable
Example
1st input variable
REAL
2nd input variable
REAL
Output Variable as 1st input data type
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 both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (input_value_1, input_value_2 and enable) have been declared. Instead, you may enter constants directly at the input contacts of the function (enable input e.g. for tests).
4 – 46
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Arithmetic Functions
LD Body If enable is set (TRUE), input_value_1 is raised to the power of input_value_2. The result is written into output_value.
IL Body If 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 editor are capitalized or not. The following error flags apply to (E_)EXPT: No.
IEC Address
set
if
R9007
first and the second input variable do not have the data type REAL
%MX0.900.7
permanently
R9008
%MX0.900.8
for an instant
R900B
%MX0.900.11
permanently
output variable is zero
R9009
%MX0.900.9
for an instant
processing result overflows the output variable
Matsushita Electric Works (Europe) AG
4 – 47
IEC Functions
NAiS Control 1131
Arithmetic Functions
4 – 48
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
IEC Functions
NAiS Control 1131
Process Data Type Functions
5–2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Process Data Type Functions
(E_)ADD_TIME Outline
ADD_TIME adds the times of the two input variables and writes the sum in the output variable. If you require an enable output and an enable input: E_ADD_TIME.
J Data Types
Example
Input Variable
Output Variable
TIME
TIME
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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
LD Body time_value_1 and time_value_2 are added. The result is written in time_value_3.
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
5–3
IEC Functions
NAiS Control 1131
Process Data Type Functions
Outline
Example
Anything stated under ADD_TIME also applies to E_ADD_TIME. The function E_ADD_TIME, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN is set (TRUE), E_ADD_TIME 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 further function blocks/functions with ENO which are controlled by the status of EN. E_ADD_TIME In this example the function E_ADD_TIME is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
LD Body If enable is set (TRUE), time _value_1 and time_value_2 are added. The result is written in time_value_3. Once the function has been processed, ENO will be set.
IL Body If you wish to call up the function in an instruction list, enter the following:
Note 5–4
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Process Data Type Functions
(E_)SUB_TIME Outline
SUB_TIME subtracts the value of the second input variable from the value of the first. If you require an enable output and an enable input: E_SUB_TIME.
J Data Types
Example
Input Variable
Output Variable
TIME
TIME
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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
LD Body Subtrahend is subtracted from minuend. The result will be written in result.
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
5–5
IEC Functions
NAiS Control 1131
Process Data Type Functions
Outline
Example
Anything stated under SUB_TIME also applies to E_SUB_TIME. The function E_SUB_TIME, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN is set (TRUE), E_SUB_TIME 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 further function blocks/functions with ENO which are controlled by the status of EN. E_SUB_TIME In this example the function E_SUB_TIME is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
LD Body If enable is set (TRUE), subtrahend is subtracted from minuend. The result will be written in result. Once the function has been processed, ENO will be set.
IL Body If you wish to call up the function in an instruction list, enter the following:
Note 5–6
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Process Data Type Functions
(E_)MUL_TIME_INT Outline
MUL_TIME_INT multiplies the values of the two input variables with each other and writes the result into the output variable. If you require an enable output and an enable input: E_MUL_TIME_INT.
J Data Types
Example
Input Variable
Output Variable
TIME
TIME
INTEGER
TIME
MUL_TIME_INT In this example the function MUL_TIME_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
LD Body time_value_1 is multiplied with multiplicator. The result is written in time_value_2.
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
5–7
IEC Functions
NAiS Control 1131
Process Data Type Functions
Outline
Example
Anything stated under MUL_TIME_INT also applies to E_MUL_TIME_INT. The function E_MUL_TIME_INT, however, has in 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_MUL_TIME_INT In this example the function E_MUL_TIME_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
LD Body If 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 been processed, ENO will be set.
IL Body If you wish to call up the function in an instruction list, enter the following:
Note 5–8
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Process Data Type Functions
(E_)MUL_TIME_DINT Outline
MUL_TIME_DINT multiplies the values of the input variables and writes the result to the output variable. If you require an enable output (EN) and an enable input (ENO), use: E_MUL_TIME_DINT.
J Data types
Example
input variable
output variable
TIME, DINT
TIME
MUL_TIME_DINT In this example the function MUL_TIME_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variables time_value and multiplier have been declared. However, you can write a constant directly at the input contact of 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
Matsushita Electric Works (Europe) AG
5–9
IEC Functions
NAiS Control 1131
Process Data Type Functions
Outline
Example
E_MUL_TIME_DINT multiplies the values of the input variables and writes the result to the output variable. E_MUL_TIME_DINT has in addition an enabled input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), the function is activated. If EN is not set (FALSE), the function is not executed and the value of the output variable remains unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further functions and function blocks that are controlled by the status of EN. E_MUL_TIME_DINT In this example the function E_MUL_TIME_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variables start, time_value_1, and multiplier have been declared. However, you can write a constant directly at the input contact of the function instead. Body When start is set (TRUE), time_value_1 is multiplied by multiplier. The result 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 5 – 10
It does not matter whether the names of the functions are capitalized in the IL editor or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Process Data Type Functions
(E_)MUL_TIME_REAL Outline
Note
MUL_TIME_REAL multiplies the value of the first input variable of the data type TIME by the value of the second input variable of the data type REAL. The REAL value is rounded off to the nearest whole number. The result is written into the output variable. If you require an enable output and an enable input: E_MUL_TIME_REAL.
This function is only available for the FP0.
J Data Types Input Variable
Output Variable
TIME
TIME
REAL
Example
MUL_TIME_REAL In this example the function MUL_TIME_REAL is programmed using the ladder diagram (LD) editor. Since constants are entered directly at the input function pins, only the output variable need be declared in the header. POU Header All input and output variables that are required for programming the function are declared in the POU header.
Body The constant T#1h30m is multiplied by the value 3.5, which is rounded off to 4.0 in the actual calculation. The result is written in mul_result. By clicking on the view icon while in the online mode, you can see the result T#6h0m0s0.00ms immediately. LD Body
IL Body
Note
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
5 – 11
IEC Functions
NAiS Control 1131
Process Data Type Functions
Outline
Example
Anything stated under MUL_TIME_REAL also applies to E_MUL_TIME_REAL. The function E_MUL_TIME_REAL, however, has in 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_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 further function blocks/functions with ENO which are controlled by the status of EN. E_MUL_TIME_REAL In this example the function E_MUL_TIME_REAL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
Body If start is set (TRUE), input_time is multiplied by input_real. The result is written in mul_result. Once the function has been processed, ENO will be set. In this example the input variables have been declared in the POU header. However, you may enter 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
5 – 12
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Process Data Type Functions
(E_)DIV_TIME_INT Outline
DIV_TIME_INT divides the value of the first input variable by the value of the second input variable and writes the result into the output variable. If you require an enable output and an enable input: E_DIV_TIME_INT.
J Data Types
Example
Input Variable
Output Variable
TIME
TIME
INTEGER
TIME
DIV_TIME_INT In this example the function DIV_TIME_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
LD Body time_value_1 is divided by INT_value. The result is written in time_value_2.
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
5 – 13
IEC Functions
NAiS Control 1131
Process Data Type Functions
Outline
Example
Anything stated under DIV_TIME_INT also applies to E_DIV_TIME_INT. The function E_DIV_TIME_INT, however, has in addition 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. E_DIV_TIME_INT In this example the function E_DIV_TIME_INT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
LD Body If enable is set (TRUE), time_value_1 is divided by INT_value. The result is written in time_value_2. Once the function has been processed, ENO will be set.
IL Body If you wish to call up the function in an instruction list, enter the following:
Note 5 – 14
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Process Data Type Functions
(E_)DIV_TIME_DINT Outline
DIV_TIME_DINT divides the value of the first input variable by the value of the second and writes the result into the output variable. If you require an enable output (EN) and an enable input (ENO), use: E_DIV_TIME_DINT.
J Data types
Example
input variable
output variable
TIME, DINT
TIME
DIV_TIME_DINT In this example the function DIV_TIME_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variables time_value_1 and DINT_value have been declared. However, you can write a constant directly at the input contact 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
Matsushita Electric Works (Europe) AG
5 – 15
IEC Functions
NAiS Control 1131
Process Data Type Functions
Outline
Example
E_DIV_TIME_DINT divides the value of the first input variable by the value of the second and writes the result into the output variable. E_DIV_TIME_DINT has in addition an enabled input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), the function is activated. If EN is not set (FALSE), the function is not executed and the value of the output variable remains unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further functions and function blocks that are controlled by the status of EN. E_DIV_TIME_DINT In this example the function E_DIV_TIME_DINT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variables start, time_value_1, and DINT_value have been declared. However, you can write a constant directly at the input contact of the function instead. Body When start is set (TRUE), time_value_1 is divided by DINT_value. The result 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 5 – 16
It does not matter whether the names of the functions are capitalized in the IL editor or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Process Data Type Functions
(E_)DIV_TIME_REAL Outline
Note J Data Types
DIV_TIME_REAL divides the value of the first input variable of the data type TIME by the value of the second input variable of the data type REAL. The REAL value is rounded off to the nearest whole number. The result is written into the output variable. If you require an enable output and an enable input: E_DIV_TIME_REAL.
This function is only available for the FP0. 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 programming languages. POU Header All input and output variables that are required for programming the function are declared in the POU header.
Body The value of variable input_time is divided by the value of the variable input_real. The result is written in div_result. In this example the input variables have been declared in the POU header. However, you may enter 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
5 – 17
IEC Functions
NAiS Control 1131
Process Data Type Functions
Outline
Example
Anything stated under DIV_TIME_REAL also applies to E_DIV_TIME_REAL. The function E_DIV_TIME_REAL, however, has in addition 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_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 further function blocks/functions with ENO which are controlled by the status of EN. E_DIV_TIME_REAL In this example the function E_DIV_TIME_REAL is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
Body If start is set (TRUE), input_time is divided by input_real. The result is written in div_result. Once the function has been processed, ENO will be set. In this example the input variables have been declared in the POU header. However, you may enter constants directly into the function. LD Body
IL Body If you wish to call up the function in an instruction list, enter the following:
Note
5 – 18
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
Chapter 6 Bitshift Functions (E_)SHL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 -- 3 (E_)SHR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 -- 6 (E_)ROL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 -- 9 (E_)ROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 -- 12
IEC Functions
NAiS Control 1131
Bitshift Functions
6–2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Bitshift Functions
(E_)SHL Outline
SHL shifts a bit value by a defined number of positions (n) to the left and fills the vacant positions with zeros. Bit shift to the left, zero–filled on right source register (n = 4 bit) bit
15 . . 12 11 . . 8
7 . . 4
3 . . 0
15 . . 12 11 . . 8
7 . . 4
3 .
DT0
target register bit DT0
. 0
0 0 0 0 these 4 bits are filled up with zeros
E_SHL shifts a bit value by a defined number of positions (n) to the left and fills the vacant positions with zeros when EN ist set (TRUE). source register (n = 4 bit) bit
15 . . 12 11 . . 8
7 . . 4
3 . . 0
DT0 EN = TRUE target register bit
15 . . 12 11 . . 8
7 . . 4
DT0
3 .
. 0
0 0 0 0 these 4 bits are filled up with zeros
J Data Types 1. + 2. Input Variable
Output Variable
BOOL
as data type of the two input variables
WORD DOUBLE WORD
Input and output variables have to be of the same data type.
Matsushita Electric Works (Europe) AG
6–3
IEC Functions
NAiS Control 1131
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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body The first n bits (here 3) of source_register are left–shifted, the vacant positions on the right are filled with zeros. The result is written in target_register.
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 editor are capitalized or not.
next page
6–4
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Bitshift Functions
Outline
Example
Anything stated under SHL also applies to E_SHL. The function E_SHL, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN 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 will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. Left shift by bits: 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body All bits of source_register are left–shifted by n positions (here 3) and the vacant positions on the right are zero filled. The result is written in target_register.
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
6–5
IEC Functions
NAiS Control 1131
Bitshift Functions
(E_)SHR Outline
SHR shifts a bit value by a defined number of positions (n) to the right and fills the vacant positions with zeros. Bit shift to the right, zero–filled on left: source register
bit
(n = 4 bit) 15 . . 12 11 . . 8
7 . . 4
3 . . 0
target register bit 15 . . 12 11 . . 8
7 . . 4
3 . . 0
DT0
0 0 0 0
DT0
the 4 most significant bits are filled up with zeros
E_SHR shifts a bit value by a defined number of positions (n) to the right and fills the vacant positions with zeros when EN is set (TRUE). source register
bit
(n = 4 bit) 15 . . 12 11 . . 8
7 . . 4
3 . . 0
7 . . 4
3 . . 0
DT0 EN = TRUE target register bit 15 . . 12 11 . . 8 DT0
0 0 0 0
the 4 most significant bits are filled up with zeros
J Data Types 1. + 2. Input Variable
Output Variable
BOOL
as data type of the two input variables
WORD DOUBLE WORD
Input and output variables have to be of the same data type.
next page
6–6
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body The last n bits (here 3) of source_register are right–shifted. The vacant positions on the left are filled with zeros. The result is written in target_register.
IL Body If you wish to call up the function SHR in an instruction list, enter the following:
Note
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
6–7
IEC Functions
NAiS Control 1131
Bitshift Functions
Outline
Example
Anything stated under SHR also applies to E_SHR. The function E_SHR, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body If enable is set (TRUE), all bits of source_register (data type WORD) will be right–shifted by n positions (in this case 3). The vacant positions on the right are zero filled. The result is written in target_register (data type WORD).
IL Body If you wish to call up E_SHR in an instruction list, enter the following:
Note 6–8
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Bitshift Functions
(E_)ROL Outline
ROL rotates a defined number (n) of bits to the left. source register bit
(n = 4 bit) 15 . . 12 11 . . 8 0 0 0 1 0 0 1 0
7 . . 4
3 . . 0
0 0 1 1
0 1 0 0
bit
15 . . 12 11 . . 8
7 . . 4
3 . . 0
DT0
0 0 1 0
0 1 0 0
0 0 0 1
DT0
target register
0 0 1 1
E_ROL rotates a defined number (n) of bits to the left when EN is set (TRUE). source register bit DT0
(n = 4 bit) 15 . . 12 11 . . 8 0 0 0 1 0 0 1 0
7 . . 4
3 . . 0
0 0 1 1
0 1 0 0 EN = TRUE
target register bit
15 . . 12 11 . . 8
7 . . 4
3 . . 0
DT0
0 0 1 0
0 1 0 0
0 0 0 1
0 0 1 1
J Data Types 1. + 2. Input Variable
Output Variable
BOOL
as data type of the two input variables
WORD DOUBLE WORD
Input and output variables have to be of the same data type.
Matsushita Electric Works (Europe) AG
6–9
IEC Functions
NAiS Control 1131
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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants/variables. LD Body The last n bits (here 3) of source_register are left–rotated. The result will be written in target_register.
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 editor are capitalized or not.
next page
6 – 10
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Bitshift Functions
Outline
Example
Anything stated under ROL also applies to E_ROL. The function E_ROL, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If enable is set (TRUE), all bits of source_register are left–rotated by n–positions (in this case 3). The result will be written in target_register.
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
6 – 11
IEC Functions
NAiS Control 1131
Bitshift Functions
(E_)ROR Outline
ROR rotates a defined number (n) of bits to the right. source register
( n = 4 bit)
bit
15 . . 12 11 . . 8
7 . . 4
3 . . 0
DT0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
bit
15 . . 12 11 . . 8
7 . . 4
3 . . 0
DT0
0 1 0 0
0 0 1 0
0 0 1 1
target register
0 0 0 1
E_ROR rotates a defined number (n) of bits to the right when EN ist set (TRUE). source register
( n = 4 bit)
bit
15 . . 12 11 . . 8
7 . . 4
3 . . 0
DT0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
bit
15 . . 12 11 . . 8
7 . . 4
3 . . 0
DT0
0 1 0 0
0 0 1 0
0 0 1 1
EN = TRUE target register
0 0 0 1
J Data Types 1. + 2. Input Variable
Output Variable
BOOL
as data type of the two input variables
WORD DOUBLE WORD
Input and output variables have to be of the same data type.
next page
6 – 12
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body The first n bits (here n = 3) of source_register are right–rotated. The result will be written in target_register.
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
6 – 13
IEC Functions
NAiS Control 1131
Bitshift Functions
Outline
Example
Anything stated under ROR also applies to E_ROR. The function E_ROR, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If enable is set (TRUE), all bits of source_register are right–rotated by n–positions (in this case 3). The result will be written in target_register.
IL Body If you wish to call up the function in an instruction list, enter the following:
Note 6 – 14
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
Chapter 7 Bitwise Boolean Functions (E_)AND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 -- 3 (E_)OR
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 -- 5
(E_)XOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 -- 7 (E_)NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 -- 9
IEC Functions
NAiS Control 1131
Bitwise Boolean Functions
7–2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Bitwise Boolean Functions
(E_)AND Outline
The content of the accumulator is connected with the operand defined in the operand field by a logical AND operation. The result is transferred to the accumulator.
J 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 Identifier
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 Body LD
var_1
(* Load var_1 in accu *)
AND
var_2
(* Perform an AND of accu with var_2; 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 noted data 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 IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
7–3
IEC Functions
NAiS Control 1131
Bitwise Boolean Functions
Outline
Example
E_AND links the input variables with a logical AND. E_AND operates just as the standard operator AND (see: Online Help: Help > Index > Standard Operators). However, E_AND has an additional enabled input (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 is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body If enable is set (TRUE), operand_1 will be logically AND–linked with operand_2. The result will be written into the output variable result.
IL Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
7–4
The number of input contacts a_BitN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Bitwise Boolean Functions
(E_)OR Outline
The content of the accumulator is connected with the operand defined in the operand field by a logical OR operation. The result is transferred to the accumulator.
J 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 Identifier
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 Body LD
var_1
(* Load var_1 in accu *)
OR
var_2
(* Perform an OR of accu with var_2; 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 noted data 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 IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
7–5
IEC Functions
NAiS Control 1131
Bitwise Boolean Functions
Outline
Example
E_OR operates just as the standard operator OR (Online Help: Help > Index > Standard Operators). E_OR, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN is set (TRUE), E_OR 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If enable is set (TRUE), operand_1 and operand_2 are linked with a logical OR. The result will be written in result.
IL Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
7–6
The number of input contacts a_BitN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Bitwise Boolean Functions
(E_)XOR Outline
The content of the accumulator is connected with the operand defined in the operand field by a logical XOR operation. The result is transferred to the accumulator.
J 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 Identifier
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 Body LD
var_1
(* Load var_1 in accu *)
XOR
var_2
(* Perform an XOR of accu with var_2; 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 noted data 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 IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
7–7
IEC Functions
NAiS Control 1131
Bitwise Boolean Functions
Outline
Example
E_XOR operates as the standard operator XOR (Online Help: Help > Index > Standard Operators. The function E_XOR, however, has in 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), the status of the variable will be frozen until EN is set again. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body If enable is set, the Boolean variables operand_1 and operand_2 are logically EXCLUSIVE–OR linked and the result is written in result.
IL Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
7–8
The number of input contacts a_BitN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Bitwise Boolean Functions
(E_)NOT Outline
NOT performs a bit inversion of input variables. The result will be written in the output variable. If you require an enable output and an enable input: E_NOT.
J 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body The bits of input_value are inversed (0 is inversed to 1 and vice versa). The inversed result is written in negation.
IL Body If you wish to call up the function in an instruction list, enter the following:
Note next page Matsushita Electric Works (Europe) AG
7–9
IEC Functions
NAiS Control 1131
Bitwise Boolean Functions
Outline
Example
Anything stated under NOT also applies to E_NOT. The function E_NOT, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If enable is set (TRUE), each bit of input_value will be inverted, i.e. 0 is inverted to 1 and vice versa. The result will be written in negation.
IL Body If you wish to call up the function in an instruction list, enter the following:
Note 7 – 10
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
Chapter 8 Selection Functions (E_)MAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 -- 3 (E_)MIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 -- 5 (E_)LIMIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 -- 7 (E_)MUX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 -- 9
IEC Functions
NAiS Control 1131
Selection Functions
8–2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Selection Functions
(E_)MAX Outline
MAX determines the input variable with the highest value. If you require an enable output and an enable input: E_MAX.
J Data Types
Example
Input Variable
Output Variable
any data type except String, but all of the same type
as input data type
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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body value_1 and value_2 are compared with each other. The higher value of the two is written in maximum_value.
IL Body If 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 to 28. It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
8–3
IEC Functions
NAiS Control 1131
Selection Functions
Outline
Example
Anything stated under MAX also applies to E_MAX. The function E_MAX, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If enable is set (TRUE), value_1 is compared with value_2. The higher value will be written in maximum_value.
IL Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
8–4
The number of input contacts a_NumN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Selection Functions
(E_)MIN Outline
MIN dectects the input variable with the lowest value. If you require an enable output and an enable input: E_MIN.
J Data Types
Example
Input Variable
Output Variable
any data type except String, but all of the same type
as input data type
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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body value_1 and value_2 are compared with each other. The lower value of the two is written in minimum_value.
IL Body If 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 to 28. It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
8–5
IEC Functions
NAiS Control 1131
Selection Functions
Outline
Example
Anything stated under MIN also applies to E_MIN. The function E_MIN, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN 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 will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If enable is set (TRUE), value_1 is compared with value_2. The smaller value will be written into minimum_value.
IL Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
8–6
The number of input contacts a_NumN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Selection Functions
(E_)LIMIT Outline
In LIMIT the 1. input variable forms the lower and the 3. input variable the upper limit value. If the 2. input variable is within this limit, it will be transferred to the output variable. If it is above this limit, the upper limit value will be transferred, if it is below this limit the lower limit value will be transferred. If you require an enable output and an enable input: E_LIMIT.
J Data Types
Example
Input Variable
Output Variable
any data type, but all of the same type
as input data type
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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body lower_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 the comparison_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 Body If you wish to call up the function in an instruction list, enter the following:
Note next page Matsushita Electric Works (Europe) AG
8–7
IEC Functions
NAiS Control 1131
Selection Functions
Outline
Example
Anything stated under LIMIT also applies to E_LIMIT. E_LIMIT, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN is set (TRUE), E_LIMIT 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
| This example uses variables. You may also use constants for the input variables LD Body If enable is set (TRUE), comparison_value is compared with lower_limit_val and upper_limit_val. If the comparison_value is within the limit values, the value of comparison_value is written in result. If the comparison_value surpasses the value in lower_limit_val, the value of lower_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 Body If you wish to call up the function in an instruction list, enter the following:
Note 8–8
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Selection Functions
(E_)MUX Outline
The function Multiplexer selects an input variable and writes its value into the output variable. With the 1. input variable is determines which input variable it to be written into the output variable. The function MUX can be configured for any desired number of inputs. If you require an enable output and an enable input: E_MUX.
J Data Types
Note
Input Variable
Output Variable
1. input variable
INTEGER
2. + 3. input variable
any desired, but both of the identical type
as data type of 2. or 3. input variable
The difference between the functions E_MUX and E_SEL is that in E_MUX you can select between multiple channels with an integer value, while in E_SEL you can only choose between two channels with a Boolean value.
Matsushita Electric Works (Europe) AG
8–9
IEC Functions
NAiS Control 1131
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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body In channel_select you find the integer value (0, 1...n) for the selection of channel_0 or channel_1. The result will be written in output.
IL Body If 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 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. next page
8 – 10
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Selection Functions
Outline
Example
Anything stated under MUX also applies to E_MUX. E_MUX, however, has in addition an enabled input (EN = enable) and an enabled output (ENO = enable output) of the data type BOOL. If EN is set (TRUE), E_MUX 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 further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If enable is set (TRUE), E_MUX will be executed. In channel_select you find the value for the selection of channel_0 or channel_1. In E_MUX the number of channels is not limited.
IL Body If 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 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
8 – 11
IEC Functions
NAiS Control 1131
Selection Functions
8 – 12
Matsushita 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
IEC Functions
NAiS Control 1131
Comparison Functions
9–2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Comparison Functions
(E_)GT Outline
The content of the accumulator is compared with the operand defined in the operand field. If the accumulator is greater, ”TRUE” is stored in the accumulator, else ”FALSE”.
J Data Types
Example
Input Variable
Output Variable
any data type, but all of the same type
BOOL
GT POU Header Class Identifier
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 Body LD
var_1
(* Load var_1 in accu *)
GT
var_2
(* Compare accu with var_2; store BOOL result of comparison in accu; if accu > var_2, TRUE is stored in accu, 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 be of 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
9–3
IEC Functions
NAiS Control 1131
Comparison Functions
Outline
E_GT compares the two input variables. If the first is greater than the second, the result will be TRUE, otherwise FALSE. E_GT operates just as the standard operator GT (Online Help: Help > Index > Standard Operators). E_GT has in addition an enable input (EN) and an 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 the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (comparison_value, reference_value and enable) have been declared. Instead, you may enter constants directly at the input contacts of a 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 comparison_value is greater than the reference_value, the value TRUE will be written into result, otherwise FALSE.
IL Body If you want to call the function in an instruction list, enter the following:
Notes
• •
9–4
The number of input contacts a_NumN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Comparison Functions
(E_)GE Outline
The content of the accumulator is compared with the operand defined in the operand field. If the accumulator is greater or equal, ”TRUE” is stored in the accumulator, else ”FALSE”.
J Data Types
Example
Input Variable
Output Variable
any data type, but all of the same type
BOOL
GE POU Header Class Identifier
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 Body LD
var_1
(* Load var_1 in accu *)
GE
var_2
(* Compare accu with var_2; store BOOL result of comparison in accu; if accu ≥ var_2, TRUE is stored in accu, 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 be of 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
9–5
IEC Functions
NAiS Control 1131
Comparison Functions
Outline
E_GE compares the two input variables with each other. If the first value is greater than or equal to the second value, the result will be TRUE, otherwise FALSE. E_GE operates just as the standard operator 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 be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body If enable is set (TRUE), the comparison_value is compared with the reference_value. If the comparison_value is greater than or equal to the reference_value, the value TRUE will be written in result, otherwise FALSE.
IL Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
9–6
The number of input contacts a_NumN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Comparison Functions
(E_)EQ Outline
The content of the accumulator is compared with the operand defined in the operand field. If both values are equal, ”TRUE” is stored in the accumulator, else ”FALSE”.
J Data Types
Example
Input Variable
Output Variable
any data type, but all of the same type
BOOL
EQ POU Header Class Identifier
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 Body LD
var_1
(* Load var_1 in accu *)
EQ
var_2
(* Compare accu with var_2; store BOOL result of comparison in accu; if accu = var_2, TRUE is stored in accu, 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 be of 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
9–7
IEC Functions
NAiS Control 1131
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 input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_EQ will be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body If enable is set (TRUE), the variable comparison_value is compared with the variable reference_value. If the values of the two variables are identical, the value TRUE will be written in result, otherwise FALSE.
IL Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
9–8
The number of input contacts a_NumN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Comparison Functions
(E_)LE Outline
The content of the accumulator is compared with the operand defined in the operand field. If the accumulator is lower or equal, ”TRUE” is stored in the accumulator, else ”FALSE”.
J Data Types
Example
Input Variable
Output Variable
any data type, but all of the same type
BOOL
LE POU Header Class Identifier
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 Body LD
var_1
(* Load var_1 in accu *)
LE
var_2
(* Compare accu with var_2; store BOOL result of comparison in accu; if accu ≤ var_2, TRUE is stored in accu, 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 be of 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
9–9
IEC Functions
NAiS Control 1131
Comparison Functions
Outline
E_LE compares the two input variables. If the first value is less than or equal to the second value, the result will be TRUE, otherwise FALSE. E_LE operates just as the standard operator LE (Online Help: Help > Index > Standard Operators). E_LE has in addition an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_LE will be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables. LD Body If enable is set (TRUE), the comparison_value is compared with the variable reference_value. If the comparison_value is less than or equal to the reference_value, TRUE will be written in result, otherwise FALSE.
IL Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
9 – 10
The number of input contacts a_NumN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Comparison Functions
(E_)LT Outline
The content of the accumulator is compared with the operand defined in the operand field. If the accumulator is lower than the operand, ”TRUE” is stored in the accumulator, else ”FALSE”.
J Data Types
Example
Input Variable
Output Variable
any data type, but all of the same type
BOOL
LT POU Header Class Identifier
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 Body LD
var_1
(* Load var_1 in accu *)
LT
var_2
(* Compare accu with var_2; store BOOL result of comparison in accu; if accu < var_2, TRUE is stored in accu, 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 be of 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
9 – 11
IEC Functions
NAiS Control 1131
Comparison Functions
Outline
E_LT compares two input variables with each other. If the first value is 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 status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
This example uses variables. You may also use constants for the input variables LD Body If 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 Body If you wish to call up the function in an instruction list, enter the following:
Notes
• •
9 – 12
The number of input contacts a_NumN lies in the range of 2 to 28. It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Functions Comparison Functions
(E_)NE Outline
The content of the accumulator is compared with the operand defined in the operand field. If both values are not equal, ”TRUE” is stored in the accumulator, else ”FALSE”.
J Data Types
Example
Input Variable
Output Variable
any data type, but all of the same type
BOOL
NE POU Header Class Identifier
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 Body LD
var_1
(* Load var_1 in accu *)
NE
var_2
(* Compare accu with var_2; store BOOL result of comparison in accu; if accu ≠ var_2, TRUE is stored in accu, 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 be of 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
9 – 13
IEC Functions
NAiS Control 1131
Comparison Functions
Outline
Example
E_NE compares the two input variables with each other. If they are unequal, the result is TRUE, otherwise FALSE. E_NE operates just as the standard operator NE (Online Help: Help > Index > Standard Operators). E_NE has in addition an enable input (EN) and an enable 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 the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions with ENO which are controlled by the status of EN. 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 programming languages. POU Header All input and output variables which are required for programming the function are declared in the POU header.
In this example the input variables (comparison_value, reference_value and enable) have been declared. However, you may enter constants directly 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 into result, otherwise FALSE.
IL Body If you want to call up the function in an instruction list, enter the following:
Note 9 – 14
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
Part 3 IEC Function Blocks
Chapter 10 Bistable Function Blocks (E_)SR
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 – 3
(E_)RS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 – 7
IEC Function Blocks
NAiS Control 1131
Bistable Function Blocks
10 – 2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Bistable Function Blocks
(E_)SR Outline
The function block SR (set/reset) or E_SR allows you to both set and reset 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 at RESET, except SET is set (see time chart) Q: signal output is set, if a rising edge is detected at SET, is reset, if a rising edge is detected at RESET, and if the SET is not set.
J Data Types
Notes
Input Variable
Output Variable
BOOL (SET and RESET)
BOOL (Q)
D Q is set if a rising edge is detected at both inputs (Set and Reset) D Upon initialising, Q always has the status zero (reset).
J Time Chart SET
RESET
Q
Matsushita Electric Works (Europe) AG
10 – 3
IEC Function Blocks
NAiS Control 1131
Bistable Function Blocks
Example
SR In the following example, the function block SR is programmed in ladder diagram (LD) and in the instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block SR are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name, and a separate data area is reserved.
LD Body If 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 are set, signal_output will be set.
IL Body If you wish to call up SR: copy_name in the instruction list, you enter the following:
The nomination copy_name.SET or copy_name.RESET etc. has to be maintained in the IL.
Note
It does not matter whether the function names in the IL editor are capitalized or not. next page
10 – 4
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Bistable Function Blocks
Outline
Anything stated for SR also applies to E_SR. The function block E_SR, however, further contains an enabled input (EN = enable) and an enabled output (ENO = enable output). If EN is set (TRUE), E_SR will be activated. If EN is reset (FALSE), the variable’s condition is frozen until EN is set again (see time chart). ENO will adopt the status of EN. Therefore, you can connect further function blocks/functions to ENO which are controlled by the status of EN.
J 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 Header In the POU Header the input enable is declared additionally.
Matsushita Electric Works (Europe) AG
10 – 5
IEC Function Blocks
NAiS Control 1131
Bistable Function Blocks
LD Body If enable is set, E_SR will be as described for SR. The condition will be frozen, 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 activated 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 assigned to it. The nomination copy_name.EN or copy_name.PT etc. has to be maintained in the IL.
Note
10 – 6
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Bistable Function Blocks
(E_)RS Outline
The function block RS (reset/set) or E_RS allows you to both reset and set an output. For the RS you declare the following: SET: set The output Q is set for each rising edge at SET, if RESET is not set. RESET: reset The output Q is reset for each rising edge at RESET. Q: signal output is set, if a rising edge is detected at SET and if RESET is not set; is reset, if a rising edge is detected at RESET.
J Data Types
Note
Input Variable
Output Variable
BOOL (SET and RESET)
BOOL (Q)
Q is reset if a rising edge is detected at both inputs.
J Time Chart SET
RESET
Q
Matsushita Electric Works (Europe) AG
10 – 7
IEC Function Blocks
NAiS Control 1131
Bistable Function Blocks
Example
RS In the following example, the function block RS is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block RS are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name, and a separate data area is reserved.
LD Body If set is set (status = TRUE) the signal_output will be set. If only reset is set, the signal_output will be reset (status = FALSE). If both set and reset are set, the signal_output will be reset to FALSE.
IL Body If you wish to call up RS: copy_name instruction list, you enter the following:
The nomination copy_name.SET or copy_name.RESET etc. has to be maintained in the IL.
Note 10 – 8
It does not matter whether the function names in the IL editor are capitalized or not. next page
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Bistable Function Blocks
Outline
Anything stated for RS also applies to E_RS. The function block E_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 be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you can connect further function blocks/functions to ENO which are controlled by the condition of EN.
J 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 Header In the POU header the input enable is additionally declared.
Matsushita Electric Works (Europe) AG
10 – 9
IEC Function Blocks
NAiS Control 1131
Bistable Function Blocks
LD Body If 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 as enable is set again, E_SR continues working in the previous status.
You can now connect a further function block with ENO which will be activated 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 maintained in the IL.
Note
10 – 10
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
Chapter 11 Edge Detection (E_)R_TRIG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 – 3 (E_)F_TRIG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 – 6
IEC Function Blocks
NAiS Control 1131
Edge Detection
11 – 2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Edge Detection
(E_)R_TRIG Outline
The function block R_TRIG (rising edge trigger) or E_R_TRIG allows you to recognize a rising edge at an input. For R_TRIG declare the following: CLK: signal input the output Q is set for each rising edge at the signal input (clk = clock) Q: signal output is set when a rising edge is detected at CLK.
J Data Types
Note
Input Variable
Output Variable
BOOL (CLK)
BOOL (Q)
The output Q of a function block (E_)R_TRIG remains set for a complete PLC cycle after the occurrence of a rising edge (status change FALSE –> TRUE) at the CLK input and is then reset in the following cycle.
Matsushita Electric Works (Europe) AG
11 – 3
IEC Function Blocks
NAiS Control 1131
Edge Detection
Example
R_TRIG In the following example, the function block R_TRIG is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block R_TRIG are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name, and a separate data area is reserved.
LD Body signal_output will be set, if a rising edge is detected at signal_input.
IL Body If you wish to call up R_TRIG: copy_name instruction list, enter the following:
The nomination copy_name.CLK or copy_name.Q has to be maintained in the IL.
Note
It does not matter whether the function names in the IL editor are capitalized or not.
next page
11 – 4
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Edge Detection
Outline
Example
Anything stated for R_TRIG also applies to E_R_TRIG. The function block E_R_TRIG has in addition an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_R_TRIG will be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions to ENO which are controlled by the condition of EN. E_R_TRIG If the same variables are used for programming as described under R_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 set again, E_R_TRIG continuous working in the previous status (see time chart). You may now connect a further function block with ENO which will be activated 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
11 – 5
IEC Function Blocks
NAiS Control 1131
Edge Detection
(E_)F_TRIG Outline
The function block F_TRIG (falling edge trigger) or E_F_TRIG allows you to recognize a falling edge at an input. For F_TRIG declare the following: CLK: signal input the output Q is set for each falling edge at the signal input (clk = clock) Q: signal output is set, if a falling edge is detected at CLK.
J Data Types
Note
Input Variable
Output Variable
BOOL (CLK)
BOOL (Q)
The output Q of a function block (E_)F_TRIG remains set for a complete PLC cycle after the occurrence of a rising edge (status change FALSE –> TRUE) at the CLK input and is then reset in the following cycle.
next page
11 – 6
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Edge Detection
Example
F_TRIG In the following example, the function block F_TRIG is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block F_TRIG are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name, and a separate data 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 the following:
The nomination copy_name.CLK or copy_name.Q has to be continued in the IL.
Note
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
11 – 7
IEC Function Blocks
NAiS Control 1131
Edge Detection
Outline
Example
Anything stated for F_TRIG also applies to E_F_TRIG. The function block E_F_TRIG has in addition an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_F_TRIG will be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you can connect further function blocks/functions to ENO which are controlled by the status of EN. E_F_TRIG If the same variables are used for programming as described under F_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 set again, E_F_TRIG continuous working in the previous state (see time chart). You may now connect a further function block with ENO which will be 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 11 – 8
It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
Chapter 12 Counter (E_)CTU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 – 3 (E_)CTD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 – 7 (E_)CTUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 – 12
IEC Function Blocks
NAiS Control 1131
Counter
12 – 2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Counter
(E_)CTU Outline
The function block CTU (count up) or E_CTU allows you to program counting procedures. For CTU declare the following: CU:
clock generator the value 1 is added to CV for each rising edge at CU, except RESET is set
RESET: reset CV is reset to zero for each rising edge at RESET PV:
set value if PV (preset value) is reached, Q is set
Q:
signal output is set, if CV is greater than/equal to PV
CV:
current value contains the addition result (CV = current value)
J Data Types Input Variable
Output Variable
BOOL (CV and RESET)
BOOL (Q)
INT (PV)
INT (CV)
J Time Chart CU
Q
RESET
CV PV
Example
CTU In the following example, the function block CTU is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages.
Matsushita Electric Works (Europe) AG
12 – 3
IEC Function Blocks
NAiS Control 1131
Counter
POU Header All input and output variables which are used for programming the function block CTU are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name. A separate data area is reserved for this copy.
LD Body If reset is set (status = TRUE), current_value (CV) will be reset. If a rising edge is detected at clock, the value 1 will be added to current_value. If a rising edge is detected at clock, this procedure will be repeated until current_value is greater than/equal to set_value. Then, signal_output will be set.
IL Body
The nomination coyp name.CU or copy_name.RESET etc. has to be maintained in the IL.
Note
It does not matter whether the function names in the IL editor are capitalized or not. next page
12 – 4
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Counter
Outline
Anything stated under CTU also applies to E_CTU. The function block E_CTU has in addition an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_CTU will be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set (see time chart). ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions to ENO which are controlled by the status of EN.
J 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.
Matsushita Electric Works (Europe) AG
12 – 5
IEC Function Blocks
NAiS Control 1131
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 be frozen and CU ignored. As soon as enable is set, E_CTU continues working with the previous status. You may now connect a further function block with ENO which will be activated 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 maintained in the IL.
Note
12 – 6
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Counter
(E_)CTD Outline
The function block CTD (count down) or E_CTD allows you to program counting procedures. For CTD declare the following: CD: clock generator input the value 1 is subtracted from the current value CV for each rising edge detected at CD, except LOAD is set or CV has reached the value zero. LOAD: set with LOAD the counter state is reset to PV PV: preset value is the value subjected to subtraction during the first counting procedure Q: signal output is set if CV = zero CV: current value contains the current subtraction result (CV = current value)
J Data types Input Variable
Output Variable
BOOL (CD and LOAD)
BOOL (Q)
INT (PV)
INT (CV)
J Time Chart CU
LOAD
Q CV
PV
Matsushita Electric Works (Europe) AG
12 – 7
IEC Function Blocks
NAiS Control 1131
Counter
Example
CTD In the following example the function block CTD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block CTD are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name, and a separate data area 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_value each time a rising edge is detected at clock. This procedure will be repeated until the current_value is greater than/equal to zero. Then, signal_output will be set.
next page
12 – 8
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Counter
IL Body If you want to call up the CTD: copy_name in an instruction list, enter the following:
The nomination copy_name.CD or copy_name.LOAD etc. has to be maintained in the IL.
Note
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
12 – 9
IEC Function Blocks
NAiS Control 1131
Counter
Outline
Anything stated under CTD also applies to E_CTD. The function block E_CTD has in addition an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_CTD will be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set (see time chart). ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions to ENO which are controlled by the condition of EN.
J Time Chart CD
EN
LOAD
Q
PV
Example
E_CTD If the same variables are used for programming as described under CTD the program for E_CTD would be designed as follows: POU Header In the POU Header the input enable is additionally declared.
next page 12 – 10
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks 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 be frozen and CD ignored. As soon as enable is set again, E_CTD continuous working with the previous counter state. You may now connect a further function block with ENO which will be activated 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 maintained in the IL.
Note
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
12 – 11
IEC Function Blocks
NAiS Control 1131
Counter
(E_)CTUD Outline
The function block CTUD (count up/down) or E_CTUD allows you to program counting procedures (up and down). For CTUD declare the following: CU: count up the value 1 is added to the current CV for each rising edge detected at CU, except RESET and/or LOAD is/are set. CD: count down the value 1 is subtracted from the current CV for each rising edge detected at CD, except RESET and/or LOAD is/are set and if CU and CD are simultaneously set. In the latter case counting will be upwards. RESET: reset if RESET is set, CV will be reset LOAD: set if LOAD is set, PV is loaded to CV. This, however, does not apply, if RESET is set simultaneously. In this case, LOAD will be ignored. PV: preset value defines the preset value which is to be attained with the addition or subtraction (PV = preset value) QU: signal output – count up is set, if CV is greater than/equal to PV QD: signal output – count down is set, if CV = zero CV: current value is the addition/subtraction result (CV = current value)
J Data Types Input Variable
Output Variable
BOOL (CU, CD, RESET, LOAD)
BOOL (QU and QD)
INT (PV)
INT (CV)
next page
12 – 12
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Counter
J Time Chart CU
CD
RESET
LOAD
QU
QD CV PV
Example
CTUD In the following example, the function block CTUD is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block CTUD are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name. A separate data area is reserved for this copy.
Matsushita Electric Works (Europe) AG
12 – 13
IEC Function Blocks
NAiS Control 1131
Counter
LD Body Count up: If reset is set, the current_value (CV) will be reset. If up_clock is set, the value 1 is added to the current_value. This procedure is repeated for each rising edge detected at up_clock until the current value is greater than/equal to the set_value. Then output_up is set. The procedure is not conducted, if reset and/or set is/are set. Count down: If set is set (status = TRUE), the set_value (PV = preset value) will be loaded in the current_value (CV). If down_clock is set, the value 1 is subtracted from set_value at each clock. This procedure is repeated at each clock until the current_value is smaller than/equal to zero. Then, signal_output is set. The procedure will not be conducted, if reset and/or set 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 the following:
The nomination copy_name.CU or copy_name.RESET etc. has to be maintained in the IL.
Note
It does not matter whether the function names in the IL editor are capitalized or not. next page
12 – 14
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Counter
Outline
Anything stated under CTUD also applies to E_CTUD. The function block E_CTUD has in addition an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_CTUD will be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set (see time chart). ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions to ENO which are controlled by the condition of EN.
J Time Chart EN
CU
CD
RESET
LOAD
QU
QD
CV PV
Example
E_CTUD If the same variables are used for programming as described under CTUD the program for E_CTUD would be designed as follows.
Matsushita Electric Works (Europe) AG
12 – 15
IEC Function Blocks
NAiS Control 1131
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 frozen and CU/CD ignored. As soon as enable is set again, E_CTUD continues working with the previous counter state. You may now connect a further function block with ENO which will be activated only, if the EN of this E_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 maintained in the IL.
Note 12 – 16
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
Chapter 13 Timer (E_)TP
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 – 3
(E_)TON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 – 8 (E_)TOF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 – 13
IEC Function Blocks
NAiS Control 1131
Timer
13 – 2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Timer
(E_)TP Outline
The function block TP or E_TP allows you to program a clock timer with a defined clock period. For TP declare the following: IN: clock generator if a rising edge is detected at IN, a clock is generated having 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 clock having the period PT is caused for each rising edge at IN. A new rising edge detected at PT within the pulse period 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 is detected at IN ET: current value contains the elapsed clock period. If PT = ET, Q will be reset
J Data Types Input Variable
Output Variable
BOOL (IN)
BOOL (Q)
TIME (PT)
TIME (ET)
Matsushita Electric Works (Europe) AG
13 – 3
IEC Function Blocks
NAiS Control 1131
Timer
J Time Chart
TP
ÉÉÉÉ ÉÉÉÉ ÉÉÉÉ ÉÉÉÉ
IN
t0
Q
t1
t2
t0
t3
t1 + PT
t2
t2 + PT
t1 + PT
t2
t3
ÉÉÉ ÉÉÉ t4 t5 t6 t7
t4
t4 + PT
ET PT
t t0 A
t4
t4 + PT
B
C
A + B) Independent of the turn–on period of the IN signal, a clock is generated at the output Q having a length defined by PT. The function block TP is started (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 processing of PT.
J Time Chart
E_TP EN t6 IN
Q ET
ÉÉÉ ÉÉÉÉÉÉ ÉÉÉ ÉÉ ÉÉ t0
t1
t2
t0
t0 + PT t2
t0
t0 + PT
t3
t4
t2 + PT
t4
t4 + PT
t4
t4 + PT
ÉÉÉ ÉÉÉ t5
t5
PT
A
t2
t3 B
t5
t6
C
next page
13 – 4
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Timer
Example
TP In the following example the function block TP is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block TP are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name. A separate data area is reserved for this copy.
LD Body If start is set (status = TRUE), the clock is emitted at signal_output until the set_value for the clock period is reached.
IL Body If you want to call TP: copy_name in an instruction list, enter the following:
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
13 – 5
IEC Function Blocks
NAiS Control 1131
Timer
Outline
Example
Anything stated under TP also applies to E_TP. The function block E_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 be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you can connect further function blocks/functions to ENO which are controlled by the status of EN. 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 be ignored. As soon as enable is set again, E_TP continues processing. You may now connect a further function block with ENO which will be activated only if the EN of this E_TP is set (TRUE).
next page
13 – 6
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
13 – 7
IEC Function Blocks
NAiS Control 1131
Timer
(E_)TON Outline
The function block TON or E_TON allows you to program a switch on 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 detected at IN PT: switch on delay (16–bit value: 0 – 327.27s, 32–bit value: 0 – 21,474,836.47s; resolution 10ms each) the desired switch on delay is defined here(PT = preset time) Q: signal output is set if PT = ET ET: current value is the actually elapsed time (ET = elapsed time)
J Data Types
Note
Input Variable
Output Variable
BOOL (IN)
BOOL (Q)
TIME (PT)
ITIME (ET)
This function is not available for FP1–C14/C16/C24/C40 and FP5 (version 1.0 to 1.9).
next page
13 – 8
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Timer
J Time Chart
TON IN
ÉÉÉÉÉ ÉÉÉÉÉ t0
Q
t0
ÉÉÉ ÉÉÉ
t1
t0 + PT
t1
t2
t3
t2
t3
t2
t3
ET PT
t t0
t1 A
B
A) Q is set delayed with the time defined in PT. Resetting is without any delay. B) If the input IN is only set for the period of the delay time PT or even for a shorter period of time (t3 – t2 < PT), Q will not be set. J Time Chart
E_TON EN
IN
ÉÉÉ ÉÉ ÉÉ ÉÉÉ ÉÉ ÉÉ t0
Q
t0
t1
t2
t3
t0+PT t1
t4
t4
t4+PT
t5
ÉÉÉ ÉÉÉ t6
t5
t6
t6 + PT
ET PT t t0
t1
t2 A
Matsushita Electric Works (Europe) AG
t3
t4
t5
t6 B
13 – 9
IEC Function Blocks
NAiS Control 1131
Timer
Example
TON In the following example the function block TON is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block TON are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name. A separate data area is 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 the following: |
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 editor are capitalized or not. next page
13 – 10
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Timer
Outline
Example
Anything stated under TON also applies to E_TON. The function block E_TON has in addition an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_TON will be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions to ENO which are controlled by the status of EN. E_TON If the same variables are used for programming as described under TON the 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 will be ignored. As soon as enable is set again, E_TON continues working. You may now connect a further function block with ENO which will be activated only if the EN of this E_TON is set (TRUE).
Matsushita Electric Works (Europe) AG
13 – 11
IEC Function Blocks
NAiS Control 1131
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
13 – 12
It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Timer
(E_)TOF Outline
The function block TOF or E_TOF allows you to program a switch off delay, e.g. to switch off the ventilator of a machine at a later point of time than the machine itself. For TON declare the following: IN: timerON an internal time measuring device is started, if a falling edge is detected at IN. If a rising edge is detected at IN before PT has reached its value, Q will not be switched off (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 intended switch–off delay is defined here (PT = preset time) Q: signal output is reset, if PT = ET ET: current value represents the actually elapsed time (ET = elapsed time)
J Data Types
Note
Input Variable
Output Variable
BOOL (IN)
BOOL (Q)
TIME (PT)
TIME (ET)
This function is not available for FP1–C14/C16/C24/C40 and FP5 (version 1.0 to 1.9).
Matsushita Electric Works (Europe) AG
13 – 13
IEC Function Blocks
NAiS Control 1131
Timer
J Time Chart
TOF IN
ÉÉÉÉ ÉÉ ÉÉÉÉ ÉÉ
t0
t1
Q t0
ET
t2
t1 + PT
t3
ÉÉÉÉ ÉÉÉÉ
t4
t5
t2
t5 + PT
PT
t0
t1
t2
t3
A
t4
t5
B
A) Q is switched off with a delay corresponding to the time defined in PT. 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 lapse of the delay time PT, Q remains set (time chart for t2 to t3). J Time Chart
E_TOF EN t7 IN
t2
t0
t2
Q ET
ÉÉ ÉÉÉÉÉ ÉÉ ÉÉÉÉÉ
t0 t1
t1 + PT
t3
t4
t5
t5 + PT
t6 t6
t8
ÉÉ ÉÉ ÉÉ ÉÉ t7 + PT
t8
PT
t0 t1
t2 t3
t4
t5
t6
t7
next page
13 – 14
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks Timer
Example
TOF In the following example, the function block TOF is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block TOF are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name. A separate data area is reserved for this copy.
LD Body If start is set, this signal is transferred to signal_output with a delay corresponding to the period of time set_value.
IL Body If you want to call the TOF: copy_name in an instruction list, enter the following:
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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
13 – 15
IEC Function Blocks
NAiS Control 1131
Timer
Outline
Example
Anything stated under TOF also applies to E_TOF. The function block E_TOF has in addition an enable input (EN) and an enable output (ENO) of the data type BOOL. If EN is set (TRUE), E_TOF will be activated. If EN is not set (FALSE), the status of the output variable will remain unchanged until EN is set. ENO will adopt the status of EN. Therefore, you may connect further function blocks/functions to ENO which are controlled by the condition of EN. E_TOF If the same variables are used for programming as described under TOF the 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 as enable is set again, E_TOF continues working. You may now connect a further function block with ENO which will be activated only if the EN of this E_TOF is set (TRUE).
next page
13 – 16
Matsushita Electric Works (Europe) AG
NAiS Control 1131
IEC Function Blocks 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 editor are capitalized or not.
Matsushita Electric Works (Europe) AG
13 – 17
IEC Function Blocks
NAiS Control 1131
Timer
13 – 18
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
Matsushita Instruction Set
NAiS Control 1131
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 14 – 2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set
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
Matsushita Electric Works (Europe) AG
14 – 3
Matsushita Instruction Set
NAiS Control 1131
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 14 – 4
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set
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 Matsushita Electric Works (Europe) AG
14 – 5
Matsushita Instruction Set
NAiS Control 1131
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 14 – 6
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set
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
Matsushita Electric Works (Europe) AG
14 – 7
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
14 – 8
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
CT Outline
Steps
Down Counter
3–4
Availability FP0
The CT instruction is a down type preset counter. The Count trigger subtracts one count from the elapsed value area EV each time its leading edges are detected. The Reset trigger resets the counter when it is ON. The constant SV (1 to 32767) can be set as preset (Set) value.
J Data Types Variable
Data Types
Count,
BOOL
Reset, C Num*, SV
INT, WORD
J Operands For
Relais
T/C
Register
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
FL
–
–
–
–
x
–
–
–
–
SV
x: –:
available not available
Example
Notes
It is not possible to use this function in a function block POU. Every used counter must have a separate constant Num*. Available Num* addresses depend on system registers 5 and 6. As input/output relays X and Y are sometimes handled in units of 16 points, they are expressed as a combination of decimal and hexadecimal numbers as shown below.
Matsushita Electric Works (Europe) AG
14 – 9
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
DF Outline
Leading Edge Differntial
1
Availability FP0
DF is a leading edge differential instruction. The DF instruction executes and turns ON output o for a singular scan duration if the trigger i changes from an OFF to an ON state.
J Data Types Variable
Output Variable
i, o
BOOL
J Operands For
Relais
T/C
X
Y
R
L
T
C
i
x
x
x
x
x
x
o
–
x
x
–
–
x x: –:
available not available
Example
14 – 10
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
DFN Outline
Trailing Edge Diffential
1
Availability FP0
DFN is trailing edge differential instruction. The DFN instruction executes and turns ON output o for a singular scan duration if the trigger i changes from an ON to an OFF state.
J Data Types Variable
Data Type
i, o
BOOL
J Operands For
Relais
T/C
X
Y
R
L
T
C
i
x
x
x
x
x
x
o
–
x
x
–
–
x x: –:
available not available
Example LD
Var_0
DFN ST
(* i = Var_0 *) (* Trailing edge differential for variable Var_0. *)
Var_1
(* o = Var_1 *) (* At valid event the output variable Var_1 *) (* is in the ON–state for one scan duration. *)
Matsushita Electric Works (Europe) AG
14 – 11
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
ICTL Outline
Interrupt Control
5
Availability FP0
The ICTL (Interrupt Control) instruction sets all interrupts to enable or disable. Each time the ICTL instruction is executed, it is possible to set parameters like the type and validity of interrupt programs. Settings can be specified by s1 and s2. D s1: 16–bit equivalent constant or 16–bit area for interrupt control setting D s2: 16–bit equivalent constant or 16–bit area for interrupt trigger condition setting The number of interrupt programs available is: D 16 interrupt module initiated interrupt programs (INT 0 to INT 15) D 8 advanced module (special modules, like positioning,...) initiated interrupt programs (INT 16 to INT 23) D 1 time–initiated interrupt program (INT 24) (Time base 0.5 ms and 10ms selectable for FP10SH) Be sure to use ICTL instructions so that they are executed once at the leading edge of the ICTL trigger using the DF instruction. Two or more ICTL instructions can have the same trigger.
Notes
14 – 12
Bit
15 .. 8
7 .. 0
s1 16#
Selection of control function 00: Interrupt ”enable/disable” control 01: Interrupt trigger reset control
Interrupt type selection 00: 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#
00 Bit 0: 0 Interrupt program 0 disabled Bit 0: 1 Interrupt program 0 enabled Bit 1: 0 Interrupt program 1 disabled ... Bit 15: 1 Interrupt program 15 enabled Example: s2 = 2#0000000000001010
00
The current enable/disable status of each interrupt module initiated interrupt can be checked by monitoring the special data register DT90025. The current enable/disable status of each non–interrupt module initiated interrupt can be checked by monitoring the special data register DT90026. next page
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
The current interrupt interval of the time–interrupt can be checked by monitoring the special data register DT90027. If a program is written into an interrupt task, the interrupt concerned will be enabled automatically during the initialization routine when starting the program. With the ICTL instruction an interrupt task can be enabled or disabled by the program. J Data Types Variable s1, s2
Data Types INT, WORD
J Operands For s1, s2
Relais
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
x
x
x
x
x
x
x
x
x
x: –:
available not available
Example POU Header
IL Body LD DF
start
(* Load value of EN–input *) (* 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 is detected.
Matsushita Electric Works (Europe) AG
14 – 13
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
JP Outline
Jump to label
2–3
Availability All 3
The JP (Jump to Label) instruction skips to the Label (LBL) function that has the same number Num* as the JP function when the predetermined trigger EN is in the ON–state. The JP function will skip all instructions between a JP and an LBL of the same number. When the JP instruction is executed, the execution time of the skipped instructions is not included in the scan time. Two or more JP functions with the same number Num* can be used in a program. However, no two LBL instructions may be identically numbered. LBL instructions are specified as destinations of JP, LOOP and F19_SJP instructions. One JP and LBL instruction pair can be programmed between another pair. This construction is called nesting.
J Data Types Variable NUM*
Data Types INT, WORD
Example LD JP
Notes
start 1
(* EN = start; Starting signal for the JP function. *) (* Num* = 1 (Address of Label) *)
D It is not possible to use this function in a function block POU. D The JP and LBL instruction numbers Num* must be a constant between: 0 and 31 for FP1–C14/16 0 and 64 for FP1–C24/40/56/72 and FP–M
14 – 14
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
KEEP Outline
Steps
Serves as a relay with set and reset inputs
1
Availability FP0
KEEP serves as a relay with set and reset points. When the SetTrigger turns ON, output of the specified relay goes ON and maintains its condition. Output relay goes OFF when the ResetTrigger turns ON. The output relay’s ON state is maintained until a ResetTrigger turns ON regardless of the ON or OFF states of the SetTrigger. If the SetTrigger and ResetTrigger turn ON simultaneously, the ResetTrigger is given priority.
J Data Types Variable Set Trigger
Data Types BOOL
Reset Trigger Address
BOOL
J Operands For Set Trigger
Relais
T/C
X
Y
R
L
T
C
x
x
x
x
x
x
–
x
x
x
–
–
Reset Trigger Address
x: –:
available not available
Example POU Header
LD Body
Matsushita Electric Works (Europe) AG
14 – 15
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
LBL Outline
Label for the JP and LOOP Instruction
Steps 1
Availability All 3
The LBL (Label for the JP and LOOP) instruction skips to the LBL instruction with the same number Num* as the JUMP instruction if the predetermined trigger EN is in the ON–state. It skips to the LBL instruction with the same number Num* as the LOOP instruction and repeats execution of what follows until the data of a specified operand becomes ”0”.
J Data Types Variable NUM*
Data Types INT, WORD
Example
Notes
D It is not possible to use this function in a function block POU. D The LBL, JP and LOOP instruction numbers Num* must be a constant between 0 and 31 for FP1–C14/16 0 and 64 for FP1–C24/40/56/72 and FP–M
14 – 16
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
LOOP Outline
Loop to Label
4
Availability All 3
The LOOP (Loop to Label) instruction skips to the LBL instruction with the same number Num* as the LOOP instruction and repeats execution of what follows until the data of a specified operand becomes ”0”. The LBL instructions are specified as destination of the LOOP instruction. It is not possible to specify two or more LBL instructions with the same number Num* within a program. If the set value s in the data area is ”0” from the beginning, the LOOP instruction is not executed (ignored).
J Data Types Variable
Data Types
NUM*, s
INT, WORD
J Operands For s
Relais
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
x
x
x
x
x
x
x
x
x
Num*
T/C
numerical constant
x: –:
available not available
Example
Notes
D It is not possible to use this function in a function block POU. D The LOOP and LBL instruction numbers Num* must be a constant between 0 and 31 for FP1–C14/16 0 and 64 for FP1–C24/40/56/72 and FP–M
Matsushita Electric Works (Europe) AG
14 – 17
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
LSR Outline
Availability
Steps
Left shift register
FP0
Shifts 1 bit of the specified data area (WR) to the left (to the higher bit position). When programming the LSR instruction, be sure to program the data input (DataInput), shift (shiftTrigger) and reset triggers (ReSetTrigger). DataInput: specifies the state of new shift–in data: new shift–in data 1: when the input is ON new shift–in data 0: when the input is OFF shiftTrigger: shifts 1 bit to the left when the leading edge of the trigger is detected ReSetTrigger: turns all the bits of the data area to 0 if the trigger is in the ON–state. The area available for this instruction is only the word internal relay (WR).
J Data Types Variable
Data Types
DataInput,
BOOL
Shift Trigger, Reset Trigger WR
INT, WORD
J Operands For DataInput
Relais
T/C
X
Y
R
L
T
C
x
x
x
x
x
x
WX
WY
WR
WL
SV
EV
–
–
x
–
–
–
Shift Trigger, Reset Trigger WR
x: –:
available not available
Example
Note
14 – 18
D Word internal relay (WR) number range, depends on the free area in the Project –> Compile Options menu.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
MC Outline
Master Control relay
2–3
Availability All 3
The MC (Master Control Relay) instruction executes the program between the master control relay MC and master control relay end MCE instructions of the same number Num* only if the trigger EN is in the ON–state. When the predetermined trigger EN is in the OFF state, the program between the master control relay MC and master control relay end MCE instructions are not executed. A master control instruction (MC and MCE) pair may also be programmed in between another pair of master control instructions. This construction is called ”nesting”.
J Data Types Variable NUM*
Data Types INT, WORD
Example
Notes
D It is not possible to use this function in a function block POU. D The MC instruction number Num* must be a constant between 0 and 15 for FP1–C14/16 0 and 31 for FP1–C24/40/56/72 und FP–M
Matsushita Electric Works (Europe) AG
14 – 19
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
MCE Outline
Master Conrol Relay End
2
Availability All 3
The MCE (Master Control Relay End) instruction executes the program between the master control relay MC and master control relay end MCE instructions of the same number Num* only if the trigger EN is in the ON–state. When the predetermined trigger EN is in the OFF state, the program between the master control relay MC and master control relay end MCE instructions are not executed. A master control instruction (MC and MCE) pair may also be programmed in between another pair of master control instructions. This construction is called ”nestin,3g”.
J Data Types Variable
Data Types
NUM*
Example
Notes
INT, WORD
MCE LD MC
start 1
MCE
1
(* EN = start; Starting signal for the MC/MCE function. *) (* 1 = Num* *) (* ... *) (* Execute or execute not this program part. *) (* ... *) (* 1 = Num* *)
D It is not possible to use this function in a function block POU. D The MCE instruction number Num* must be a constant between 0 and 31 for FP1–C14/16 0 and 64 for FP1–C24/40/56/72 and FP–M
14 – 20
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
TM_1ms Outline
Steps
On Delay Timer for 0.001s Units
3–4
Availability FP0
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 is transferred to the SV. If the trigger of the timer instruction start is in the ON–state, the Preset (Set) value is transferred to the EV from the SV. During the timing operation, the time is subtracted from the EV. The scan time is also subtracted from the EV in the next scan. The timer contact T turns ON, when the EV becomes 0.
J Data Types Variable
Data Types
start, T
BOOL
Num*, SV
INT, WORD
J Operands For
Relais
Register
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
FL
–
–
–
–
x
–
–
–
–
SV Num*
T/C
numerical constant
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 21
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Notes
14 – 22
D It is not possible to use this function in a function block POU. D Every used timer must have a separate constant Num*. Available Num* addresses depend on system registers 5 and 6. Timers of type TM_1s, TM_100ms, TM_10ms, TM_1ms use the same Num* address range. D The Matsushita timer functions (TM_1s, TM_100ms, TM_10ms, and TM_1s) use the same NUM* address area as the Matsushita timer function blocks (TM_1s_FB, TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the timer function blocks the compiler automatically assigns a NUM* address to every timer instance. The addresses are assigned counting downwards, starting at the highest possible address. In order to avoid errors (address conflicts), these timer functions and function blocks should not be used together in a project.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
On Delay Timer for 0.01s Units
TM_10ms Outline
Steps 3–4
Availability FP0
The TM_10ms instruction sets the ON–delay timer for 0.01s units (0 to 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 is transferred to the SV. If the trigger of the timer instruction start is in the ON–state, the Preset (Set) value is transferred to the EV from the SV. During the timing operation, the time is subtracted from the EV. The scan time is also subtracted from the EV in the next scan. The timer contact T turns ON, when the EV becomes 0.
J Data Types Variable start, T
Data Types BOOL
Num*, SV
INT, WORD
J Operands For
Relais
Register
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
FL
–
x
x
x
–
–
–
–
–
SV Num*
T/C
numerical constant
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 23
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Notes
14 – 24
D It is not possible to use this function in a function block POU. D Every used timer must have a separate constant Num*. Available Num* addresses depend on system registers 5 and 6. Timers of type TM_1s, TM_100ms, TM_10ms, TM_1ms use the same Num* address range. D The Matsushita timer functions (TM_1s, TM_100ms, TM_10ms, and TM_1s) use the same NUM* address area as the Matsushita timer function blocks (TM_1s_FB, TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the timer function blocks the compiler automatically assigns a NUM* address to every timer instance. The addresses are assigned counting downwards, starting at the highest possible address. In order to avoid errors (address conflicts), these timer functions and function blocks should not be used together in a project.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
TM_100ms Outline
Steps
On Delay Timer for 0.1s Units
3–4
Availability FP0
The TM_100s instruction sets the ON–delay timer for 0.1s units (0 to 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 is transferred to the SV. If the trigger of the timer instruction start is in the ON–state, the Preset (Set) value is transferred to the EV from the SV. During the timing operation, the time is subtracted from the EV. The scan time is also subtracted from the EV in the next scan. The timer contact T turns ON, when the EV becomes 0.
J Data Types Variable start, T
Data Types BOOL
Num*, SV
INT, WORD
J Operands For
Relais
Register
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
FL
x
x
x
x
x
x
x
x
x
SV Num*
T/C
numerical constant
x: –:
available not available
Example LD TM_100ms
start 16,32123
ST
Var_0
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the TM_100ms function. *) (* Num* = 16 (Address of the timer) *) (* SV = 32123 (Time, corresponding 3212,3 sec. ) *) (* T = Var_0; The variable Var_0 turns ON, *) (* when the EV becomes 0. *)
14 – 25
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Notes
D It is not possible to use this function in a function block POU. D Every used timer must have a separate constant Num*. Available Num* addresses depend on system registers 5 and 6. Timers of type TM_1s, TM_100ms, TM_10ms, TM_1ms use the same Num* address range. D The Matsushita timer functions (TM_1s, TM_100ms, TM_10ms, and TM_1s) use the same NUM* address area as the Matsushita timer function blocks (TM_1s_FB, TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the timer function blocks the compiler automatically assigns a NUM* address to every timer instance. The addresses are assigned counting downwards, starting at the highest possible address. In order to avoid errors (address conflicts), these timer functions and function blocks should not be used together in a project.
14 – 26
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
TM_1s Outline
On Delay Timer for 1s Units
4–5
Availability FP0
The TM_1s instruction sets the ON–delay timer for 1s units (0 to 32767s). 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 is transferred to the SV. If the trigger of the timer instruction start is in the ON–state, the Preset (Set) value is transferred to the EV from the SV. During the timing operation, the time is subtracted from the EV. The scan time is also subtracted from the EV in the next scan. The timer contact T turns ON, when the EV becomes 0.
J Data Types Variable start, T
Data Types BOOL
Num*, SV
INT, WORD
J Operands For
Relais
Register
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
FL
x
x
x
x
x
x
x
x
x
SV
Num*
T/C
numerical constant
x: –:
available not available
Example LD TM_1s
start 13,SV13
ST
Var_0
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the TM_1s function. *) (* Num* = 13 (Address of the timer) *) (* SV = SV13 (containing the time for the timer) *) (* T = Var_0; The variable Var_0 turns ON, *) (* when the EV becomes 0. *)
14 – 27
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Notes
D It is not possible to use this function in a function block POU. D Every used timer must have a separate constant Num*. Available Num* addresses depend on system registers 5 and 6. Timers of type TM_1s, TM_100ms, TM_10ms, TM_1ms use the same Num* address range. D The Matsushita timer functions (TM_1s, TM_100ms, TM_10ms, and TM_1s) use the same NUM* address area as the Matsushita timer function blocks (TM_1s_FB, TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the timer function blocks the compiler automatically assigns a NUM* address to every timer instance. The addresses are assigned counting downwards, starting at the highest possible address. In order to avoid errors (address conflicts), these timer functions and function blocks should not be used together in a project.
14 – 28
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F0
(MV)
Outline
Steps
16–bit data move
5
Availability All 3
The 16–bit data or 16 bit equivalent constant specified by s is copied to the 16–bit area specified by d, if the trigger EN is in the ON–state.
J Data Types Variable
Data Types
s, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 29
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F1
Steps
(DMV)
Outline
32–bit data move
7
Availability All 3
The 32 bit data or 32 bit equivalent constant specified by s is copied to the 32–bit area specified by d, if the trigger EN is in the ON–state.
J Data Types Variable
Data Types
s, d
DINT, DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
Note
14 – 30
LD F1_DMV
start Var_0,Var_1
ST
out
(* EN = start; Starting signal for the F1_DMV function. *) (* s = Var_0 (source) *) (* d = Var_1 (destination) *) (* 32–bit data move from Var_0 to Var_1 *) (* option *)
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F2
Outline
Steps
16–bit data inversions and move
(MVN)
5
Availability All 3
The 16 bit data or 16 bit equivalent constant specified by s is inverted and transferred to the 16–bit area specified by d if the trigger EN is in the ON–state.
J Data Types Variable
Data Types
s, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
LD F2_MVN
start Var_0, Var_1
ST
out
(* EN = start; Starting signal for the F2_MVN function. *) (* s = Var_0 (source) *) (* d = Var_1 (destination) *) (* 16–bit invert and move from Var_0 to Var_1 *) (* option *)
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 31
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F3 (DMVN) Outline
Steps
32–bit data inversions and move
7
Availability All 3
The 32–bit data or 32–bit equivalent constant specified by s is inverted and transferred to the 32–bit area specified by d if the trigger EN is in the ON–state.
J Data Types Variable
Data Types
s, d
DINT, DWORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
14 – 32
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
F5 (BTM) Outline
Bit data move
7
Availability All 3
1 bit of the 16–bit data or constant value specified by s is copied to a bit of the 16–bit area specified by d according to the content specified by n if the trigger EN is in the ON–state. When the 16–bit equivalent constant is specified by s, the bit data move operation is performed internally converting it to 16–bit binary expression. The operand n 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). J Data Types Variable
Data Types
s, n, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
LD F5_BTM
start Var_0,Var_1 Var_2
ST
out
(* EN = start; Starting signal for the F5_BTM function. *) (* s = Var_0 (source) *) (* n = Var_1; e. g. Var_1 = 16#0A0B *) (* 11 source bit (B) ⇒ 10 destination bit (A) *) (* d = Var_2 (destination) *) (* option *)
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 33
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F6
Steps
(DGT)
Outline
Digit data move
7
Availability All 3
The digits of the 16–bit data or constant value specified by s are copied to the digits of the 16–bit area specified by d if the trigger EN is in the ON–state. Copying multiple digits is also possible. 1 digit means 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 3 hex) 0 = move 1 digit 1 = move 2 digit (1 byte) 2 = move 3 digit 3 = 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).
J Data Types Variable
Data Types
s, n, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
14 – 34
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F10
Steps
(BKMV)
Outline
Block transfer
7
Availability All 3
The data block specified by the 16–bit starting area specified by s1 and the 16–bit ending area specified by s2 are copied to the block starting from the 16–bit area specified by d if the trigger EN is in the ON–state. The operands s1 and s2 should be: • in the same operand • s1 x s2 Whenever s1, s2 and d are in the same data area: • s1 = d: data will be re–copied to the same data area.
J Data Types Variable
Data Types
s1, s2, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
LD
start
F10_BKMV
Var_0,Var_1 Var_2
ST
out
(* EN = start; Starting signal for the F10_BKMV function. *) (* s1 = Var_0 (source 1) *) (* s2 = Var_1 (source 2) *) (* d = Var_2 (destination) *) (* Var_0 to Var_1 ⇒ Var_2 *) (* option *)
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 35
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F11
Steps
(COPY)
Outline
Block copy
7
Availability All 3
The 16–bit equivalent constant or 16–bit area specified by s is copied to all 16–bit areas of the block specified by d1 and d2 if the trigger EN is in the ON–state. The operands d1 and d2 should be: • in the same operand • d1 x d2
J Data Types Variable
Data Types
s, d1, d2
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
14 – 36
The variables s, d1 and d2 have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F12
Steps
EPRD
Outline
EEPROM read from memory
Availability Fp0 (from Ver. 2.0)
11
This instruction is used to read information from the EEPROM. Before executing the F12_EPRD instruction, make sure that you have valid data in the EEPROM memory location being read to the destination area. Otherwise the values being read will not make any sense. Also ensure that there at least 64 free data registers (1 block = 64 words (DTs)) reserved for the destination area.
J Data Types
Note
Parameter
Data Type
Comment
Input EN
BOOL
Activation of the function block (when EN has the state TRUE, the function block will be executed at every 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 is set to TRUE. Helpful at cascading of function blocks with EN–functionality
D One of the two inputs ’s1’ or ’s2’ has to be assigned constant number value.
J Operands Relais For s1, s2
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
x
x
x
–
x
x
x
–
–
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
–
–
–
–
–
x
–
–
d x: available –: not available
Matsushita Electric Works (Europe) AG
14 – 37
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
J PLC–specific information PLC type
FP0 2,7k FP0 5k C32 C10/C14/C16
FP0 10k T32CP
Block size (1 block)
64 words (64 x 16 bit )
64 words ( 64 x 16 bit )
64 words (64 x 16 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 scan time)
20 ms each block
5 ms each block
5 ms each block
Read duration (Additional scan time)
Less than 1 ms each block
Less than 1ms each block
Less than 1ms each block
Max number of writing events
100,000
10,000
10,000
No limit
No limit
No limit
Note Power down RUN –> Prog mode changes are also counted Max read times
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 programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
Body When the variable start changes from FALSE to TRUE, the function is carried out. The function reads the first block (= 64 words) after start block number 0 from the EEPROM and writes the information into the data fields from data field[0] until data field[63]. LD Body
IL Body
14 – 38
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
P13 b
Steps
EEPROM write to memory
EPWT
Outline
11
Availability FP0 (from Ver. 2.0)
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 hold area stores data real time. Whenever the power shuts down, the hold data is stored in the EEPROM memory. The P13_EPWT instruction sends 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 (see table below). You must make sure that the P13_EPWT instruction will not be executed more often than the specified number of writes. For example, if you execute P13_EPWT with R901A relay (pulse time 0.1s), the EEPROM will become inoperable after 100,000 * 0.1 sec=10,000 sec (2.8 hours). However if you want to hold your profile data such as positioning parameters or any other parameter values that are changed infrequently, you will find this instruction very useful.
J Data Types
Note
Parameter
Data Type
Comment
Input EN
BOOL
Activation of the function block (when EN changes from FALSE to TRUE, the function block will be executed one time)
Input s1
INT, WORD
DT start address of the block(s) that you want to save
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 is set to TRUE. Helpful at cascading of function blocks with EN–functionality
D One of the two input variables s2 or d has to be assigned constant number value.
Matsushita Electric Works (Europe) AG
14 – 39
Matsushita Instruction Set
NAiS Control 1131
Basic and High--level Instructions
J Operands For s1
Relais
T/C
WX
WY
WR
WL
SV
EV
DT
LD
FL
--
--
--
--
--
--
x
--
--
DEV
DDT
DLD
DFL
x
x
--
--
DWX DWY DWR DWL DSV s2 d s2,
Register
x
x
x
--
x
x: available --: not available
J PLC--specific information PLC type
FP0 2,7k C10/C14/C16
FP0 5k C32
FP0 10k T32CP
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 each block
5 ms each block
Read duration (Additional scan time)
Less than 1ms each block
less than 1 ms each block
Less than 1ms each block
Max write times
100,000
10,000
10,000
No limit
No limit
No Limit
Note: Power down, RUN --> PROG mode changes are also counted Max read times
✩
Example In this example the function P13_EPWT is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages.POU HeaderIn the POU header, all input and output variables are declared that are used for programming this function.
Body When the variable start changes from FALSE to TRUE, the function is carried out. The function reads the contents of data field[0] until data field[63] (s2* = 1 => 1 block = 64 words) and writes the information after start block number 0 into the EEPROM.
✧ next page
14 -- 40
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
LD Body
IL Body
Matsushita Electric Works (Europe) AG
14 – 41
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F15
Steps
(XCH)
Outline
16–bit data exchange
5
Availability All 3
The contents in the 16–bit areas specified by d1 and d2 are exchanged if the trigger EN is in the ON–state.
J Data Types Variable
Data Types
d1, d2
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
14 – 42
The variables d1 and d2 have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F16
Steps
(DXCH)
Outline
32–bit data exchange
5
Availability All 3
Two 32–bit data specified by d1 and d2 are exchanged if the trigger EN is in the ON–state.
J Data Types Variable
Data Types
d1, d2
DINT, DWORD
J Operands For d1, d2
Relay
T/C
DWX DWY DWR DWL DSV –
x
x
x
x
Register
DEV
DDT
DLD
DFL
x
x
x
x
x: –:
available not available
Example LD F16_DXCH ST
Note
start Var_0 Var_1 out
(* EN = start; Starting signal for the F16_DXCH function. *) (* d1=Var_0 (source/destination 1) *) (* d2=Var_1 (source/destination 2) *) (* option *)
The variables d1 and d2 have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 43
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F17 Outline
Steps
Higher/lower byte in 16–bit data exchange
(SWAP)
3
Availability All 3
The high order of 1 byte (higher 8–bit) and low order of 1 byte (lower 8–bit) of 16–bit area specified by d are exchanged if the trigger EN is in the ON–state. 1 byte means 8 bits.
J Data Types Variable
Data Types
d
INT, WORD
J Operands For d
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 44
LD F17_SWAP
start Var_0
ST
out
(* EN = start; Starting signal for the F17_SWAP function. *) (* d = Var_0 (source/destination) *) (* Byte1Byte0 ⇒ Byte0Byte1 *) (* optional *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F20
Steps
16–bit addition
(ADD)
Outline
5
Availability All 3
The 16–bit equivalent constant or 16–bit area specified by s and the 16–bit area specified by d are added together if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable
Data Types
s, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 45
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F21
Steps
(DADD)
Outline
32–bit addition
7
Availability All 3
The 32–bit equivalent constant or 32–bit area specified by s and the 32–bit data specified by d are added together if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable
Data Types
s, d
DINT, DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
Note
14 – 46
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F22 Outline
Steps
16–bit addition, destination can be specified
(ADD2)
7
Availability All 3
The 16–bit data or 16–bit equivalent constant specified by s1 and s2 are added together if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable
Data Types
s1, s2, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 47
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F23 Outline
Steps
32–bit addition, destination can be specified
(DADD2)
11
Availability All 3
The 32–bit data or 32–bit equivalent constant specified by s1 and s2 are added together if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable
Data Types
s1, s2, d
DINT, DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s1, s2
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
Note
14 – 48
LD
start
F23_DADD2
Var_0,Var_1Var_2
ST
out
(* EN = start; Starting signal for the F23_DADD2 function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (*s1 + s2 = d *) (* optional *)
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F25
Steps
(SUB)
Outline
16–bit subtraction
5
Availability All 3
Subtracts the 16–bit equivalent constant or 16–bit area specified by s 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).
J Data Types Variable
Data Types
s, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
LD F25_SUB
start Var_0 Var_1
ST
out
(* EN = start; Starting signal for the F25_SUB function. *) (* s = Var_0 (source) *) (* d = Var_1 (destination) *) (* d – s = d *) (* optional *)
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 49
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F26
Steps
(DSUB)
Outline
32–bit subtraction
7
Availability All 3
Subtracts the 32–bit equivalent constant or 32–bit data specified by s from the 32–bit data specified by d if the trigger EN is in the ON–state. The subtracted result is stored in d (minuend area).
J Data Types Variable
Data Types
s, d
DINT, DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
Note
14 – 50
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F27
16–bit subtraction, destination can be specified
(SUB2)
Outline
Steps 7
Availability All 3
Subtracts the 16–bit data or 16–bit equivalent constant specified by s2 from the 16–bit data or 16–bit equivalent constant specified by s1 if the trigger EN is in the ON–state. The subtracted result is stored in d.
J Data Types Variable
Data Types
s1, s2, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
LD
start
F27_SUB2
Var_0,Var_1 Var_2
ST
out
(* EN = start; Starting signal for the F27_SUB2 function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (* s1 – s2 = d *) (* optional *)
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 51
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F28 Outline
Steps
32–bit subtraction, destination can be specified
(DSUB2)
11
Availability All 3
Subtracts the 32–bit data or 32–bit equivalent constant specified by s2 from the 32–bit data or 32–bit equivalent constant specified by s1 if the trigger is in the ON–state. The subtracted result is stored in d.
J Data Types Variable
Data Types
s1, s2, d
DINT, DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s1, s2
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
Note
14 – 52
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F30 Outline
Steps
16–bit multiplication, destination can be specified
(MUL)
7
Availability All 3
Multiplies the 16–bit data or 16–bit equivalent constant s1 and the 16–bit data or 16–bit equivalent constant specified by s2 if the trigger EN is in the ON–state. The multiplied result is stored in d (32–bit area).
J Data Types Variable
Data Types
s1, s2
INT, WORD
d
DINT, DWORD
J Operands For s1, s2
Relay
T/C
WX
WY
WR
WL
SV
EV
DT
LD
FL
x
x
x
x
x
x
x
x
x
DEV
DDT
DLD
DFL
x
x
x
x
DWX DWY DWR DWL DSV d
Register
–
x
x
x
x
x: –:
available not available
Example
Note
LD
start
F30_MUL
Var_0,Var_1Var_2
ST
out
(* EN = start; Starting signal for the F30_MUL function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (* s1 * s2 = d *) (* optional *)
The variables s1, s2 and d have to be of the same data type (INT/DINT or WORD/DWORD).
Matsushita Electric Works (Europe) AG
14 – 53
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
F31
32–bit multiplication, destination can be specified
(DMUL)
Outline
Availability All 3, except FP1–C14/16 and FP–M0.9k
11
Multiplies the 32–bit data or 32–bit equivalent constant specified by s1 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).
J Data Types Variable
Data Types
s1, s2
DINT, DWORD
d
ARRAY [1..2] OF DINT or DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s1, s2
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example POU Header 0 1 2 3
Class
Identifier
Type
Initial
VAR VAR VAR VAR
start var_0 var_1 var_2
BOOL DINT DINT ARRAY [0..1] OF DINT
FALSE 0 0 2(0)
Comment Enable signal Variable 0 Variable 1 Result of multiplication
IL Body LD F31_DMUL
start var_0,var_1,var_2
(* Load value of EN–input *) (* Execute F31_DMUL *)
LD Body
Access to the result is possible with var_2[0] and var_2[1].
Note
14 – 54
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F32 Outline
Steps
16–bit division, destination can be specified
(DIV)
7
Availability All 3
The 16–bit data or 16–bit equivalent constant specified by s1 is divided by the 16–bit data or 16–bit equivalent constant specified by s2 if the trigger EN is in the ON–state. The quotient is stored in d and the remainder is stored in the special data register DT9015 (DT90015 for FP10/10S).
J Data Types Variable
Data Types
s1, s2, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
LD
start
F32_DIV
Var_0,Var_1,Var_2
ST
out
(* EN = start; Starting signal for the F32_DIV function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (* s1 / s2 = d *) (* optional *)
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 55
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
F33
(DDIV)
Outline
32–bit division, destination can be specified
Availability All 3, except FP1–C14/16 and FP–M0.9k
11
The 32–bit data or 32–bit equivalent constant specified by s1 is divided by the 32–bit data or 32–bit equivalent constant specified by s2 if the trigger EN is in the ON–state. The quotient is stored in d and the remainder is stored in the special data registers DT9016 and DT9015 (DT90016 and DT90015 for FP10/10S).
J Data Types Variable
Data Types
s1, s2, d
DINT, DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s1, s2
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
Note
14 – 56
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F35
Steps
(INC)
Outline
16–bit increment
3
Availability All 3
Adds ”1” to the 16–bit data specified by d if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable
Data Types
d
INT, WORD
J Operands For d
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example LD F35_INC
start Var_0
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F35_INC function. *) (* d = Var_0 (destination) *) (* d + 1 = d *) (* optional *)
14 – 57
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F36
Steps
(DINC)
Outline
32–bit increment
3
Availability All 3
Adds ”1” to the 32–bit data specified by d if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable d
DataTypes DINT, DWORD
J Operands For d
Relay
T/C
Register
DWX
DWY
DWR
DWL
DSV
DEV
DDT
DLD
DFL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 58
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F37
Steps
(DEC)
Outline
16–bit decrement
3
Availability All 3
Subtracts ”1” from the 16–bit data specified by d if the trigger EN is in the ON–state. The result is stored in d.
J Data Types Variable
Data Types
d
INT, WORD
J Operands For d
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example LD F37_DEC
start Var_0
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F37_DEC function. *) (* d = Var_0 (destination) *) (* d – 1 = d *) (* optional *)
14 – 59
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F38
Steps
(DDEC)
Outline
32–bit decrement
3
Availability All 3
Subtracts ”1” to the 32–bit data specified by d if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable d
Data Types DINT, DWORD
J Operands For d
Relay
T/C
Register
DWX
DWY
DWR
DWL
DSV
DEV
DDT
DLD
DFL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 60
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F40
Steps Availability
(BADD)
Outline
4–digit BCD addition
5
All 3, except FP–M 0.9k
The 4–digit BCD equivalent constant or 16–bit area for 4–digit BCD data specified by s and the 16–bit area for 4–digit BCD data specified by d are added together if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable
Data Types
s, d
WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example LD
start
F40_BADD
Var_0,Var_1
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F40_BADD function. *) (* s = Var_0 (source) *) (* d = Var_1 (destination) *) (* s + d = d *) (* optional *)
14 – 61
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F41
Steps Availability
(DBADD)
Outline
8–digit BCD addition
7
All 3, except FP–M 0.9k
The 8–digit BCD equivalent constant or 8–digit BCD data specified by s and the 8–digit BCD data specified by d are added together if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable
Data Types
s, d
DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 62
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F42 Outline
Steps Availability
4–digit BCD addition, destination can be specified
(BADD2)
7
All 3, except FP–M 0.9k
The 4–digit BCD equivalent constant or 16–bit area for 4–digit BCD data specified by s1 and s2 are added together if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable
Data Types
s1, s2, d
WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 63
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F43
(DBADD2)
Outline
Steps Availability
8–digit BCD addition, destination can be specified
11
All 3, except FP–M 0.9k
The 4–digit BCD equivalent constant or 16–bit area for 4–digit BCD data specified by s1 and s2 are added together if the trigger EN is in the ON–state. The added result is stored in d.
J Data Types Variable
Data Types
s1, s2, d
DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s1, s2
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 64
LD
start
F43_DBADD2
Var_0,Var_1Var_2
ST
out
(* EN = start; Starting signal for the F43_DBADD2 function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (* s1 + s2 = d *) (* optional *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F45
Steps Availability
(BSUB)
Outline
4–digit BCD subtraction
5
All 3, except FP–M 0.9k
Subtracts the 4–digit BCD equivalent constant or 16–bit area for 4–digit BCD data specified by s from the 16–bit area for 4–digit BCD data specified by d if the trigger EN is in the ON–state. The subtracted result is stored in d.
J Data Types Variable
Data Types
s, d
WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 65
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F46
Steps Availability
(DBSUB)
Outline
8–digit BCD subtraction
7
All 3, except FP–M 0.9k
Subtracts the 8–digit BCD equivalent constant or 8–digit BCD data specified by s from the 8–digit BCD data specified by d if the trigger EN is in the ON–state. The subtracted result is stored in d.
J Data Types Variable
Data Types
s, d
DWORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
14 – 66
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F47
4–digit BCD subtraction, destination can be specified
(BSUB2)
Outline
Steps Availability 7
All 3, except FP–M 0.9k
Subtracts the 4–digit BCD equivalent constant or 16–bit area for 4–digit BCD data specified by s2 from the 4–digit BCD equivalent constant or 16–bit area for 4–digit BCD data specified by s1 if the trigger EN is in the ON–state. The subtracted result is stored in d.
J Data Types Variable
Data Types
s1, s2, d
WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example LD
start
F47_BSUB2
Var_0,Var_1Var_2
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F47_BSUB2 function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (* s1 – s2 = d *) (* optional *)
14 – 67
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F48
(DBSUB2)
Outline
8–digit BCD subtraction, destination can be specified
Steps Availability 11
All 3, except FP–M 0.9k
Subtracts the 8–digit BCD equivalent constant or 8–digit BCD data specified by s2 from the 8–digit BCD equivalent constant or 8–digit BCD data specified by s1 if the trigger EN is in the ON–state. The subtracted result is stored in d.
J Data Types Variable
Data Types
s1, s2, d
DWORD
J Operands For
Relais
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s1, s2
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 68
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F50
4–digit BCD multiplication, destination can be specified
(BMUL)
Outline
Steps Availability 7
All 3, except FP–M 0.9k
Multiplies the 4–digit BCD equivalent constant or 16–bit area for 4–digit BCD data specified by s1 and s2 if the trigger EN is in the ON–state. The multiplied result is stored in d (8–digit area).
J Data Types Variable
Data Types
s1, s2
WORD
d
DWORD
J Operands For s1, s2
Relay
T/C
WX
WY
WR
WL
SV
EV
DT
LD
FL
x
x
x
x
x
x
x
x
x
DEV
DDT
DLD
DFL
x
x
x
x
DWX DWY DWR DWL DSV d
Register
–
x
x
x
x
x: –:
available not available
Example LD
start
F50_BMUL
Var_0,Var_1Var_2
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F50_BMUL function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (* s1 * s2 = d *) (* optional *)
14 – 69
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F51
8–digit BCD multiplication, destination can be specified
(DBMUL)
Outline
Steps
Availability All 3, except FP–C14/16 and FP–M 0.9k
11
Multiplies the 8–digit BCD equivalent constant or 8–digit BCD data specified by s1 and the one specified by s2 if the trigger EN is in the ON–state. The multiplied result is stored in the ARRAY d[1], d[2] (64–digit area).
J Data Types Variable
Data Types
s1, s2
DWORD
d
ARRAY [1...2] OF DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s1, s2
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 70
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F52 Outline
Steps Availability
4–digit BCD division, destination can be specified
(BDIV)
7
All 3, except FP–M 0.9k
The 4–digit BCD equivalent constant or the 16–bit area for 4–digit BCD data specified by s1 is divided by the 4–digit BCD equivalent constant or the 16–bit area for 4–digit BCD data specified by s2 if the trigger EN is in the ON–state. The quotient is stored in the area specified by d and the remainder is stored in special data register DT9015 (DT90015 for FP0–T32CP).
J Data Types Variable
Data Types
s1, s2, d
WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example LD
start
F52_BDIV
Var_0,Var_1 Var_2
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F52_BDIV function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (* s1 / s2 = d *) (* optional *)
14 – 71
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps Availability
F53
8–digit BCD division, destination can be specified
(DBDIV)
Outline
All 3, except FP– C14/16 and FP–M 0.9k
11
The 8–digit BCD equivalent constant or the 8–digit BCD data specified by s1 is divided by the 8–digit BCD equivalent constant or the 8–digit BCD data specified by s2 if the trigger EN is in the ON–state. The result is stored in the areas specified by d, and the remainder is stored in the special data registers DT9016 and DT9015 (DT90016 and DT90015 for FP0–T32CP).
J Data Types Variable
Data Types
s1, s2, d
DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s1, s2
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 72
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F55
Steps Availability
(BINC)
Outline
4–digit BCD increment
3
All 3, except FP–M 0.9k
Adds ”1” to the 4–digit BCD data specified by d if the trigger EN is in the ON–state. The result is stored in d.
J Data Types Variable
Data Types
d
WORD
J Operands For d
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example LD F55_BINC
start Var_0
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F55_BINC function. *) (* d = Var_0 (destination) *) (* d + 1 = d *) (* optional *)
14 – 73
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F56
Steps Availability
(DBINC)
Outline
8–digit BCD increment
3
All 3, except FP–M 0.9k
Adds ”1” to the 8–digit BCD data specified by d if the trigger EN is in the ON–state. The result is stored in d.
J Data Types Variable
Data Types
d
DWORD
J Operands For d
Relay
T/C
DWX DWY DWR DWL DSV –
x
x
x
x
Register
DEV
DDT
DLD
DFL
x
x
x
x
x: –:
available not available
Example
14 – 74
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F57
Steps Availability
(BDEC)
Outline
4–digit BCD decrement
3
All 3, except FP–M 0.9k
Subtracts ”1” from the 4–digit BCD data specified by d if the trigger EN is in the ON–state. The result is stored in d.
J Data Types Variable
Data Types
d
WORD
J Operands For d
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example LD F57_BDEC
start Var_0
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F57_BDEC function. *) (* d = Var_0 (destination) *) (* d – 1 = d *) (* optional *)
14 – 75
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F58
Steps Availability
(DBDEC)
Outline
8–digit BCD decrement
3
All 3, except FP–M 0.9k
Subtracts ”1” from the 8–digit BCD data specified by d if the trigger EN is in the ON–state. The result is stored in d.
J Data Types Variable
Data Types
d
DWORD
J Operands For d
Relay
T/C
DWX DWY DWR DWL DSV –
x
x
x
x
Register
DEV
DDT
DLD
DFL
x
x
x
x
x: –:
available not available
Example
14 – 76
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F60
Steps Availability
(CMP)
Outline
16–bit data compare
All 3
5
Compares the 16–bit data specified by s1 with one specified by s2 if the trigger EN is in the ON–state. The compare operation result is stored in special internal relays R9009, R900A to R900C. Flag comparison between s1 and s2
Data
16–bit data with sign
16–bit data without sign
R900A (uflag)
R900B (=flag)
R900C (tflag)
R9009 (carry–flag)
s1ts2
OFF
OFF
ON
#
s1=s2
OFF
ON
OFF
OFF
s1us2
ON
OFF
OFF
#
s1ts2
#
OFF
#
ON
s1=s2
OFF
ON
OFF
OFF
s1us2
#
OFF
#
OFF
#: turns ON or OFF depending on the conditions
J Data Types Variable
Data Types
s1, s2
INT, WORD
J Operands For s1, s2
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
x
x
x
x
x
x
x
x
x
x: –:
available not available
Example
Note
LD F60_CMP
start Var_0 Var_1
ST
out
(* EN = start; Starting signal for the F60_CMP function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* s1 < s2; s1 = s2; s1 > s2 ? *) (* optional *)
The variables s1 and s2 have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 77
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F61
Steps Availability
(DCMP)
Outline
32–bit data compare
9
All 3
Compares the 32–bit data or 32–bit equivalent constant specified by s1 with one specified by s2 if the trigger EN is in the ON–state. The compare operation result is stored in special internal relays R9009, R900A to R900C. Flag comparison between s1 and s2
Data
32–bit data with sign
32–bit data without sign
R900A (uflag)
R900B (=flag)
R900C (tflag)
R9009 (carry–flag)
s1ts2
OFF
OFF
ON
#
s1=s2
OFF
ON
OFF
OFF
s1us2
ON
OFF
OFF
#
s1ts2
#
OFF
#
ON
s1=s2
OFF
ON
OFF
OFF
s1us2
#
OFF
#
OFF
#: turns ON or OFF depending on the conditions
J Data Types Variable
Data Types
s1, s2
DINT, DWORD
J Operands For s1, s2
Relay
T/C
DWX DWY DWR DWL DSV x
x
x
x
x
Register
DEV
DDT
DLD
DFL
x
x
x
x
x: –:
available not available
Example
Note
14 – 78
The variables s1 and s2 have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F62
Steps Availability
(WIN)
Outline
16–bit data band compare
7
All 3
Compares the 16–bit equivalent constant or 16–bit data specified by s1 with the data band specified by s2 and s3, if the trigger EN is in the ON–state. This instruction checks that s1 is in the data band between s2 (lower limit) and s3 (higher limit), larger than s3, or smaller than s2. The compare operation considers +/– sign. Since the BCD data is also treated as 16–bit data with sign, we recommend the use of the BCD data within the range of 0 to 7999 to avoid confusion. The compare operation result is stored in special internal relays R900A, R900B, and R900C. Flag Comparison between s1 , s2 and s3
R900A (uflag)
R900B (=flag)
R900C (tflag)
s1ts2
OFF
OFF
ON
s2xs1xs3
OFF
ON
OFF
s1us3
ON
OFF
OFF
J Data Types Variable
Data Types
s1, s2, s3
INT, WORD
J Operands For s1, s2, s3
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
x
x
x
x
x
x
x
x
x
x: –:
available not available
Example
Note
LD
start
F62_WIN
Var_0,Var_1 Var_2
ST
out
(* EN = start; Starting signal for the F62_WIN function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* s3 = Var_2 (source3) *) (* s1 < s2; s2 ≤ s1 ≤ s3; s3 < s1; ? *) (* optional *)
The variables s1, s2 and s3 have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 79
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F63
Steps Availability
(DWIN)
Outline
32–bit data band compare
13
All 3
Compares the 32–bit equivalent constant or 32–bit data specified by s1 with the data band specified by s2 and s3, if the trigger EN is in the ON–state. This instruction checks that s1 is in the data band between s2 (lower limit) and s3 (higher limit), larger than s3, or smaller than s2. The compare operation considers +/– sign. Since the BCD data is also treated as 16–bit data with sign, we recommend the use of the BCD data within the range of 0 to 79999999 to avoid confusion. The compare operation result is stored in special internal relays R900A, R900B, and R900C. Flag Comparison between s1 , s2 and s3
R900A (uflag)
R900B (=flag)
R900C (tflag)
s1ts2
OFF
OFF
ON
s2xs1xs3
OFF
ON
OFF
s1us3
ON
OFF
OFF
J Data Types Variable
Data Types
s1, s2, s3
DINT, DWORD
J Operands For s1, s2, s3
Relay
T/C
DWX DWY DWR DWL DSV x
x
x
x
x
Register
DEV
DDT
DLD
DFL
x
x
x
x
x: –:
available not available
Example
Note
14 – 80
The variables s1, s2 and s3 have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
F64
(BCMP)
Outline
Block data compare
Availability All 3, except FP– C14/16 and FP–M 0.9k
7
Compares the contents of data block specified by s2 with the contents of data block specified by s3 according to the contents specified by s1 if the trigger EN is in the ON–state. The compare operation result is stored in the special internal relay R900B. When s2 = s3, the special internal relay is in the ON–state.
J Data Types Variable
Data Types
s1
WORD
s2, s3
INT, WORD
J Operands Relay
For
Register
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
x: –:
available not available
Example s1=
T/C
1
0
0 4
⇑ A
⇑ B
⇑ C
hex
A = Starting byte position of data block specified by s3 1: Starting from higher byte 0: Starting from lower byte B = Starting byte position of data block specified by s2 1: Starting from higher byte 0: Starting from lower byte C = Number of bytes to be compared range: 01 hex to 99 hex (BCD)
Example
Note
LD
start
F64_BCMP
Var_0,Var_1 Var_2
ST
out
(* EN = start; Starting signal for the F64_BCMP function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* s3 = Var_2 (source3) *) (* optional *)
The variables s2 and s3 have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 81
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F65
Steps Availability
(WAN)
Outline
16–bit data AND
All 3
7
Executes AND operation of each bit in 16–bit equivalent constant or 16–bit data specified by s1 and s2 if the trigger EN is in the ON–state. The AND operation result is stored in the 16–bit area specified by d. When 16–bit equivalent constant is specified by s1 or s2, the AND operation is performed internally converting it to 16–bit binary expression. You can use this instruction to turn OFF certain bits of the 16–bit data.
J Data Types Variable
Data Types
s1, s2, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
14 – 82
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F66
Steps Availability
(WOR)
Outline
16–bit data OR
7
All 3
Executes OR operation of each bit in 16–bit equivalent constant or 16–bit data specified by s1 and s2 if the trigger EN is in the ON–state. The OR operation result is stored in the 16–bit area specified by d. When 16–bit equivalent constant is specified by s1 or s2, the OR operation is performed internally converting it to 16–bit binary expression. You can use this instruction to turn ON certain bits of the 16–bit data.
J Data Types Variable
Data Types
s1, s2, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
LD
start
F66_WOR
Var_0,Var_1 Var_2
ST
out
(* EN = start; Starting signal for the F66_WOR function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (* s1 ODER s2 = d *) (* optional *)
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 83
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F67
Steps Availability
(XOR)
Outline
16–bit data exclusive OR
7
All 3
Executes exclusive OR operation of each bit in 16–bit equivalent constant or 16–bit data specified by s1 and s2 if the trigger EN is in the ON–state. The exclusive OR operation result is stored in the 16–bit area specified by d. When 16–bit equivalent constant is specified by s1 or s2, the exclusive OR operation is performed internally converting it to 16–bit binary expression.You can use this instruction to review the number of identical bits in the two 16–bit data.
J Data Types Variable
Data Types
s1, s2, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
14 – 84
LD
start
F67_XOR
Var_0,Var_1 Var_2
ST
out
(* EN = start; Starting signal for the F67_XOR function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (* s1 XOR s2 = d *) (* optional *)
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps Availability
F68
(XNR)
Outline
16–bit data exclusive NOR
7
All 3
Executes exclusive NOR operation of each bit in 16–bit equivalent constant or 16–bit data specified by s1 and s2 if the trigger EN is in the ON–state. The exclusive NOR operation result is stored in the 16–bit area specified by d. When 16–bit equivalent constant is specified by s1 or s2, the exclusive NOR operation is performed internally converting it to 16–bit binary expression. You can use this instruction to review the number of identical bits in the two 16–bit data.
J Data Types Variable
Data Types
s1, s2, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
The variables s1, s2 and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 85
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
F70
(BCC)
Outline
Block check code calculation
Availability All 3, except FP1– C14/16 and FP–M 0.9k
9
Calculates the Block Check Code (BCC) of s3 bytes of ASCII data starting from the 16–bit area specified by s2 according to s1 if the trigger EN is in the ON–state. The Block Check Code (BCC) is stored in the lower byte of the 16–bit area specified by d. s1 specifies the Block Check Code (BCC) calculation method using decimal data as follows: 0: Addition 1: Subtraction 2: Exclusive OR operation 10: Cyclic Redundancy Check (CRC) calculation (only FH10SH from version 3.02 onwards)
J Data Types Variable
Data Types
s1, s3
INT
s2, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
Example LD
start
F70_BCC
Var_0,Var_1Var_2, Var_3
ST
out
available not available
(* EN = start; Starting signal for the F70_BCC function. *) (* 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) *) (* optional *)
Calculates the Block Check Code (BCC) of 12 bytes of ASCII data starting with the content of Var_1 by exclusive OR operation if the trigger start is in the ON–state. The Block Check Code (BCC) is stored in the lower byte of Var_3.
Note 14 – 86
The variables s2 and d have to be of the same data type. Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
F71
HEX ³ ASCII conversion
(HEX2A)
Outline
Availability All 3, except FP1– C14/16 and FP–M 0.9k
7
Converts the data of s2 bytes starting from the 16–bit area specified by s1 to ASCII codes that express the equivalent hexadecimals if the trigger EN is in the ON–state. The number of bytes to be converted is specified by s2. The converted result is stored in the area starting with the 16–bit area specified by d. ASCII code requires 8 bits (one byte) to express one hexadecimal character. Upon conversion to ASCII, the data length will thus be twice the length of the source data.
J Data Types Variable
Data Types
s1
INT, WORD
s2
INT
d
WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 87
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
F72
ASCII ³ HEX conversion
(A2HEX)
Outline
Availability All 3, except FP1– C14/16 and FP–M 0.9k
7
Converts the ASCII codes that express the hexadecimal characters starting from the 16–bit area specified by s1 to hexadecimal numbers if the trigger EN is in the ON–state. s2 specifies the number of ASCII (number of characters) to be converted. The converted result is stored in the area starting from the 16–bit area specified by d. ASCII code requires 8 bits (one byte) to express one hexadecimal character. Upon conversion to a hexadecimal number, the data length will thus be half the length of the ASCII code source data.
J Data Types Variable
Data Types
s1
WORD
s2
INT
d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example LD
start
F72_A2HEX
Var_0,Var_1Var_2
ST
out
(* EN = start; Starting signal for the F72_A2HEX function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* Content e.g. 4 *) (* d = Var_2 (destination) *) (* optional *)
Converts 4 ASCII codes starting with the content of Var_0 to hexadecimal numbers if the trigger start is in the ON–state. The converted data is stored in Var_2.
14 – 88
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps Availability
F73
BCD ³ ASCII conversion
(BCD2A)
Outline
All 3, except FP1– C14/16 and FP–M 0.9k
7
Converts the BCD code starting from the 16–bit area specified by s1 to the ASCII code that expresses the equivalent decimals according to 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 of converted data (normal/reverse). S2 = 16# j 0 0 j 1
2
Number of bytes for BCD data 1: 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)
Direction of converted data 0: Normal direction 1: Reverse direction
The converted result is stored in the area specified by d. ASCII code requires 8 bits (one byte) to express one BCD character. Upon conversion to ASCII, the data length will thus be twice the length of the BCD source data. J Data Types Variable
Data Types
s1
WORD
s2
INT, WORD
d
WORD, ARRAY OF WORD
J Operands For
Relay
T/C
Register
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
Matsushita Electric Works (Europe) AG
x: –:
available not available
14 – 89
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
F74
ASCII ³ BCD conversion
(A2BCD)
Outline
Availability All 3, except FP1– C14/16 and FP–M 0.9k
9
Converts the ASCII codes that express the decimal characters starting from the specified by s1 to BCD if the trigger EN is in the ON–state. s2 specifies the number of source data bytes and the direction of converted code source data. S2 = 16# j 0 0 j Number of bytes for ASCII character 1: 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)
1
Direction converted data 0: Normal direction 1: Reverse direction
2
The converted result is stored in the area starting from the 16–bit area specified by d. ASCII code requires 8 bits (1 byte) to express 1 BCD character. Upon conversion to a BCD number, the data length will thus be half the length of the ASCII code source data. J Data Types Variable
Data Types
s1
WORD, ARRAY OF WORD
s2
INT, WORD
d
WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
next page
14 – 90
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
Example LD
start
F74_A2BCD
Var_0,Var_1Var_2
ST
out
(* EN = start; Starting signal for the F74_A2BCD function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* Content e.g. 16#0004 *) (* d = Var_2 (destination) *) (* optional *)
Converts 4 ASCII codes in normal direction starting with the content of Var_0 to BCD data if the trigger start is in the ON–state. The converted data is stored in Var_2.
Matsushita Electric Works (Europe) AG
14 – 91
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps Availability
F75
(BIN2A)
Outline
16–bit BIN ³ ASCII conversion
All 3, except FP1– C14/16 and FP–M 0.9k
7
Converts the 16–bit data specified by s1 to ASCII codes that express the equivalent decimals if the trigger EN is in the ON–state. s2 specifies the length in bytes. The converted result is stored in the area starting from the 16–bit area specified by d. In the destination area d, the data are stored starting with the highest byte and the digit order of the source data s1 is reversed. When data is stored, a sign data is added at the head (–: 2DH; +: omitted) and unused destination area d is filled with SPACE (20H).
J Data Types Variable
Data Types
s1
INT, WORD
s2
INT
d
WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example LD
start
F75_BIN2A
Var_0,Var_1Var_2
ST
out
(* EN = start; Starting signal for the F75_BIN2A function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* Content e.g. 4 *) (* d = Var_2 (destination) *) (* optional *)
Converts the 16–bit data stored in Var_0 to 4 ASCII characters that express the equivalent decimals if the trigger start is in the ON–state. The converted data is stored starting with Var_2.
14 – 92
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps Availability
F76
(A2BIN)
Outline
ASCII ³ 16–bit BIN conversion
All 3, except FP1– C14/16 and FP–M 0.9k
7
Converts the ASCII codes that express the decimal characters starting from the 16–bit area specified by s1 to 16–bit data if the trigger EN is in the ON–state. s2 specifies the number of source data bytes to be converted using a decimal number. The converted result is stored in the area specified by d. The digital order of the source data is reversed and converted to 16–bit data.
J Data Types Variable
Data Types
s1
WORD
s2
INT
d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 93
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps Availability
F77
32–bit BIN ³ ASCII conversion
(DBIN2A)
Outline
All 3, except FP1– C14/16 and FP–M 0.9k
11
Converts the 32–bit data specified by s1 to ASCII codes that express the equivalent decimals if the trigger EN is in the ON–state. s2 specifies the number of bytes used to express the destination data using decimal. The converted result is stored in d. In the destination area d, the data are stored starting from the highest byte and the digit order of the source data s1 is reversed. When data is stored, a sign data is added at the head (–: 2DH; +: omitted) and unused destination area d is filled with SPACE (20H).
J Data Types Variable
Data Types
s1
DINT, DWORD
s2
INT
d
WORD
J Operands For s1 s2 d
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
x
x
x
x
x
x
x
x
x
WX
WY
WR
WL
SV
EV
DT
LD
FL
x
x
x
x
x
x
x
x
x
–
x
x
x
x
x
x
x
x
x: –:
Example LD
start
F77_ DBIN2A
Var_0,Var_1Var_2
ST
out
available not available
(* EN = start; Starting signal for the F77_DBIN2A function. *) (* s1 = Var_0 (source1) *) (* s2 = Var_1 (source2) *) (* Content e.g. 10 *) (* d = Var_2 (destination) *) (* optional *)
Converts the 32–bit data starting with the content of Var_0 to 10 ASCII characters 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 area is greater than necessary (10 characters, necessary are 8 characters) the unused destination area is filled with ASCII character 20H (SPACE). After execution Var_2 contains 2020 H.
14 – 94
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F78 Outline
Steps
ASCII ³ 32–bit BIN conversion
(DA2BIN)
Availability All 3, except FP1– C14/16 and FP–M 0.9k
11
Converts the ASCII codes that express the decimal characters starting with the 16–bit area specified by s1 to 32–bit data if the trigger EN is in the ON–state. s2 specifies the number of source data bytes to be converted. The converted result is stored in d. You can add a sign to ASCII codes. When data is plus, the sign can be omitted.
J Data Types Variable
Data Types
s1
WORD
s2
INT
d
DINT, DWORD
J Operands For
Relay
T/C
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
DEV
DDT
DLD
DFL
x
x
x
x
DWX DWY DWR DWL DSV d
Register
–
Example
Matsushita Electric Works (Europe) AG
x
x
x
x
x: –:
available not available
14 – 95
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Outline
Steps Availability
16–bit BIN ³ 4–digit BCD conversion
F80 (BCD)
All 3
5
Converts the 16–bit binary data specified by s to the BCD code that expresses 4–digit decimals if the trigger EN is in the ON–state. The converted data is stored in d. The binary data that can be converted to BCD code are in the range of 0 (0 hex) to 9,999 (270F hex).
J Data Types Variable
Data Types
s
INT, WORD
d
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
14 – 96
LD F80_BCD
start Var_0, Var_1
ST
out
(* EN = start; Starting signal for the F80_BCD function. *) (* s = Var_0 (source) *) (* d = Var_1 (destination) *) (* optional *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F81 Outline
Steps Availability
4–digit BCD " 16–bit BIN conversion
(BIN)
All 3
5
Converts the BCD code that expresses 4–digit decimals specified by s to 16–bit binary data if the trigger EN is in the ON–state. The converted result is stored in the area specified by d.
J Data Types Variable
Data Types
s
WORD
d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 97
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F82
32–bit BIN " 8–digit BCD conversion
(BCD)
Outline
Steps Availability All 3
7
Converts the 32–bit binary data specified by s to the BCD code that expresses 8–digit decimals if the trigger EN is in the ON–state. The converted result is stored in the area specified by d. The binary data that can be converted to BCD code are in the range of 0 (0 hex) to 99,999,999 (5F5E0FF hex).
J Data Types Variable
Data Types
s
DINT, DWORD
d
DWORD
J Operands For
Relay
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
Example
14 – 98
T/C
LD
start
F82_DBCD
Var_0,Var_1
ST
out
available not available
(* EN = start; Starting signal for the F82_DBCD function. *) (* s = Var_0 (source) *) (* d = Var_1 (destination) *) (* optional *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F83 Outline
Steps Availability
8–digit BCD " 32–bit BIN conversion
(DBIN)
7
All 3
Converts the BCD code that expresses 8–digit decimals specified by s to 32–bit binary data if the trigger EN is in the ON–state. The converted result is stored in the area specified by d.
J Data Types Variable
Data Types
s
DWORD
d
DINT, DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
Example
Matsushita Electric Works (Europe) AG
x: –:
available not available
14 – 99
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F84 Outline
Steps Availability
16–bit data invert (one’s complement)
(INV)
All 3
3
Inverts each bit (0 or 1) of the 16–bit data specified by d if the trigger EN is in the ON–state. The inverted result is stored in the 16–bit area specified by d. This instruction is useful for controlling an external device that uses negative logic operation.
J Data Types Variable
Data Types
d
INT, WORD
J Operands For d
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 100
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F85
Steps Availability
(NEG)
Outline
16–bit data two’s complement
3
All 3
Gets the two’s complement of 16–bit data specified by d if the trigger EN is in the ON–state. The two’s complement of the original 16–bit data is stored in d. Two’s complement: A number system used to express positive and negative numbers in binary. In this system, the number becomes negative if the most significant bit (MSB) of data is 1. The two’s complement is obtained by inverting all bits and adding 1 to the inverted result. This instruction is useful for inverting the sign of 16–bit data from positive to negative or from negative to positive.
J Data Types Variable
Data Types
d
INT, WORD
J Operands For d
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example LD F85_NEG ST
start Var_0 out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F85_NEG function. *) (* d = Var_0 (destination) *) (* optional *)
14 – 101
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F86
Steps Availability
(DNEG)
Outline
32–bit data two’s complement
All 3
3
Gets the two’s complement of 32–bit data specified by d if the trigger EN is in the ON–state. The two’s complement of the original 32–bit data is stored in d. Two’s complement: A number system used to express positive and negative numbers in binary. In this system, the number becomes negative if the most significant bit (MSB) of data is 1. The two’s complement is obtained by inverting all bits and adding 1 to the inverted result. This instruction is useful for inverting the sign of 16–bit data from positive to negative or from negative to positive.
J Data Types Variable
Data Types
d
DINT, DWORD
J Operands For d
Relay
T/C
DWX DWY DWR DWL DSV –
x
x
x
x
Register
DEV
DDT
DLD
DFL
x
x
x
x
x: –:
available not available
Example
14 – 102
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F87
Steps Availability
(ABS)
Outline
16–bit data absolute value
All 3
3
Gets the absolute value of 16–bit data with the sign specified by d if the trigger EN is in the ON–state. The absolute value of the 16–bit data with +/– sign is stored in d. This instruction is useful to operate the data whose sign (+/–) may vary.
J Data Types Variable
Data Types
d
INT, WORD
J Operands For d
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example LD F87_ABS ST
start Var_0 out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F87_ABS function. *) (* d = Var_0 (destination) *) (* optional *)
14 – 103
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F88
Steps Availability
(DABS)
Outline
32–bit data absolute value
All 3
3
Gets the absolute value of 32–bit data with the sign specified by d if the trigger EN is in the ON–state. The absolute value of the 32–bit data with sign is stored in d. This instruction is useful to operate the data whose sign (+/–) may vary.
J Data Types Variable
Data Types
d
DINT, DWORD
J Operands For d
Example
14 – 104
Relay
T/C
DWX DWY DWR DWL DSV –
x
x
x
x
Register
DEV
DDT
DLD
DFL
x
x
x
x
x: –:
available not available
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F89
Steps Availability
(EXT)
Outline
16–bit data sign extension
All 3
3
F89 copies the sign bit of the specified 16–bit data to all the bits of the higher 16–bit area (extended 16–bit area).
J Data Types Variables
Data Types
s
BOOL, INT
d
DINT
J Operands For s
Relay
T/C
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
DEV
DDT
DLD
DFL
x
x
x
x
DWX DWY DWR DWL DSV d
Register
–
x
x
x
x
x: –:
Example
available not available
Sign bit (0: positive, 1: negative)
Destination
DT0 Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 Binary data 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
Decimal data
K–2 R20: ON
Destination
DT1 DT0 Bit position 15 · · 1211 · · 8 7 · · 4 3 · · 0 15 · · 1211 · · 8 7 · · 4 3 · · 0 Binary data 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 Decimal data
K–2 Higher 16-bit area (extended 16-bit area)
Matsushita Electric Works (Europe) AG
Lower 16-bit area
14 – 105
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F90
Steps Availability
(DECO)
Outline
Decode
7
All 3
Decodes the contents of 16–bit data specified by s according to the contents of n if the trigger EN is in the ON–state. The decoded result is 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 be decoded using hexadecimal data: Bit No. 0 to 3: number of bits to be decoded Bit 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 for decoded result: Number of bits to be decoded
Data area required for the result
Valid bits in the area for the result
1
1-word
2-bit*
2
1-word
4-bit*
3
1-word
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
8-bit*
*Invalid bits in the data area required for the result are set to 0.
J Data Types Variable
Data Types
s, n, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
next page
14 – 106
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
Example
Note
The variables s, n and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 107
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F91
(SEGT)
Outline
Steps Availability
16–bit data 7–segment decode
5
All 3
Converts the 16–bit equivalent constant or 16–bit data specified by s to 4–digit data for 7–segment indication if the trigger EN is in the ON–state. The converted data is stored in the area starting with the 16–bit area specified by d. The data for 7–segment indication occupies 8 bits (1 byte) to express 1 digit. 7–segment conversion table: One digit data to be converted
8-bit data for 7-segment indication
Organization 7-segment of 7-segment indication indication g f e d c b a
Hexadecimal
Binary
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 1
H6
0 1 1 0
0 1 1 1
1 1 0 1
H7
0 1 1 1
0 0 1 0
0 1 1 1
H8
1 0 0 0
0 1 1 1
1 1 1 1
H9
1 0 0 1
0 1 1 0
1 1 1 1
HA
1 0 1 0
0 1 1 1
0 1 1 1
HB
1 0 1 1
0 1 1 1
1 1 0 0
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
a f
g
e
b c
d
J Data Types Variable
Data Types
s
INT, WORD
d
DINT, DWORD
next page
14 – 108
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
J Operands For s
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
x
x
x
x
x
x
x
x
x
DEV
DDT
DLD
DFL
x
x
x
x
DWX DWY DWR DWL DSV d –
x
x
x
x
x: –:
available not available
Example LD
start
F91_SEGT
Var_0,Var_1
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F91_SEGT function. *) (* s = Var_0 (source) *) (* d = Var_1 (destination) *) (* optional *)
14 – 109
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps Availability
F92
(ENCO)
Outline
Encode
All 3
7
Encodes the contents of data specified by s according to the contents of n if the trigger EN is in the ON–state. The encoded result is stored in the 16–bit area specified by d starting with the specified bit position. Invalid bits in the area specified for the encoded result are set to 0. n specifies the starting bit position of destination data d and the number of bits to be decoded using hexadecimal data: Bit No. 0 to 3: number of bits to be encoded Bit 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.)
J Data Types Variable
Data Types
s, n, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Note
14 – 110
The variables s, n and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F93
Steps Availability
(UNIT)
Outline
16–bit data combine
All 3
7
Extracts each lower 4 bits (bit position 0 to 3) starting with the 16–bit area specified by s and combines the extracted data into 1 word if the trigger EN is in the ON–state.. The result is stored in the 16–bit area specified by d. n specifies the number of data to be extracted The range of n is 0 to 4. The programming example provided below can be envisioned thus: Source Bit position 15 ·
· 12 11 ·
· 8 7
·
· 4 3
·
· 0
Array[0] at s
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Array[1] at s
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
Array[2] at s
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 start: ON
Destination Bit position 15 · value at d
· 12 11 ·
· 8 7
·
· 4 3
·
· 0
0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Bit positions 12 to 15 are filled with 0s.
J Data Types Variable
Data Types
s, d
WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
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 programming languages.
Matsushita Electric Works (Europe) AG
14 – 111
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
POU Header In the POU header, all input and output variables are declared that are used for programming this function.
Body When the variable start is set to TRUE, the function is carried out. The binary values in the illustration on the previous page serve as the array values in data_input. In this example, variables are declared in the POU header. However, you may assign constants directly at the input function’s contact pins instead. LD Body In this example, the view icon was activated so you can see the results immediately.
IL Body
Note
14 – 112
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 exceeds the limit
R9008
%MX0.900.8
for an instant
–the value at n w 5
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F94
Steps Availability
(DIST)
Outline
16–bit data distribution
All 3
7
Divides the 16–bit data specified by s into 4–bit units and distributes the divided data into the lower 4 bits (bit position 0 to 3) of 16–bit areas starting with d if the trigger EN is in the ON–state. n specifies the number of data to be divided. The range of n is 0 to 4). When 0 is specified by n, this instruction is not executed. The programming example provided below can be envisioned thus: n: 4
Source Bit position 15 · value at s
· 12 11 ·
· 8 7
·
· 4 3
·
· 0
0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 0
X0: ON
Destination Bit position 15 ·
· 12 11 ·
· 8 7
·
· 4 3
·
· 0
Array[0] at d
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Array[1] at d
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Array[2] at d
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
Array[3] at d
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
J Data Types Variable
Data Types
s, d
WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
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 programming languages.
Matsushita Electric Works (Europe) AG
14 – 113
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
POU Header In the POU header, all input and output variables are declared that are used for programming this function.
Body When the variable start is set to TRUE, the function is carried out. The binary values in the illustration on the previous page serve as the values calculated. In this example, variables are declared in the POU header. Also, a constant value 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 immediately.
next page
14 – 114
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
IL Body Activating the Monitor Header window (Monitor " Monitor Header) while online 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 modifier exceeds the limit
R9008
%MX0.900.8
for an instant
–the value at n w 5 –the last area for the result exceeds the limit
Matsushita Electric Works (Europe) AG
14 – 115
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
F95
Character " ASCII transfer
(ASC)
Outline
Availability All 3, except FP1– C14/16 and FP–M 0.9k
15
Converts the character constants specified by s to ASCII codes if the trigger EN is in the ON–state. The converted ASCII codes are stored in six 16–bit areas starting with the 16–bit area specified by d.
J Data Types Variable
Data Types
s
STRING (12)
d
INT, WORD
Notes D The output d is the start address for an Array [0..5] of INT or WORD (e. g. arrayname[0]). D If character constant s is an empty character string (this means s = ’’) 12 x 20 hex will be written into the destination area d. 20 hex is the ASCII–code for space. D If the number of character constants specified by s is less than 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 35 20 20 20 20 20 20’).
J Operands For
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
s
–
–
–
–
–
–
–
–
–
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 116
LD F95_ASC
start ’ABCDEFGH’, Var_0[0]
ST
out
(* EN = start; Starting signal for the F95_ASC function. *) (* s = ’ABCDEFGH’ *) (* 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! *) (* option *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F96 Outline
Steps Availability
Table data search (16–bit search)
(SRC)
7
All 3
Searches the value that is the same as s1 in the block of 16–bit areas specified by s2 (starting area) through s3 (ending area) if the trigger EN is in the ON–state. When the search operation is performed, the searching results are stored as follows: The number of data that is the same as s1 is transferred to special data register DT9037 (DT90037 for FP10/10S). The position the data is first found in, counting from the starting 16–bit area, is transferred to special data register DT9038 (DT90038 for FP10/10S). Be sure that s2 ≤ s3.
J Data Types Variable
Data Types
s1, s2, s3
INT, WORD
J Operands For
Relay
T/C
Register
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: –:
available not available
Example
Note
The variables s1, s2 and s3 have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 117
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F100 Outline
Steps Availability
Right shift of 16–bit data in bit units
(SHR)
All 3
5
Shifts n bits of 16–bit data area specified at d to the right (to the lower bit position) if the trigger EN is in the ON–state. When n bits are shifted to the right, the data in the nth bit is transferred to special internal relay R9009 (carry–flag) and the higher n bits of the 16–bit data area specified by d are filled with 0s.
J Data Types Variable
Data Types
d
INT, WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
14 – 118
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F101
Left shift of 16–bit data in bit units
(SHL)
Outline
Steps Availability All 3
5
Shifts n bits of 16–bit data area specified at d to the left (to the higher bit position) if the trigger EN is in the ON–state. When n bits are shifted to the left, the data in the nth bit is transferred to special internal relay R9009 (carry–flag) and n bits starting with bit position 0 are filled with 0s.
J Data Types Variable
Data Types
d
INT, WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example LD F101_SHL ST
start Var_1,Var _0 out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F101_SHL function. *) (* d = Var_0 (destination) *) (* n = Var_1 (number of bits shifted to the left) *) (* option *)
14 – 119
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F105
(BSR)
Outline
Right shift of one hexadecimal digit (4 bits) of 16–bit data
Steps Availability All 3
3
Shifts one hexadecimal digit (4 bits) of the 16–bit area specified by d to the right (to the lower digit position) if the trigger EN is in the ON–state. When one hexadecimal digit (4 bits) is shifted to the right, • hexadecimal digit position 0 (bit position 0 to 3) of the data specified 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–bit area specified by d becomes 0. This instruction is useful when the hexadecimal or BCD data is treated.
J Data Types Variable
Data Types
d
INT, WORD
J Operands For d
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 120
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F106
Left shift of one hexadecimal digit (4 bits) of 16–bit data
(BSL)
Outline
Steps Availability All 3
3
Shifts one hexadecimal digit (4 bits) of the 16–bit area specified by d to the left (to the higher digit position) if the trigger EN is in the ON–state. When one hexadecimal digit (4 bits) is shifted to the left, • hexadecimal digit position 3 (bit position 12 to 15) of the data specified by d is shifted out and is transferred to the lower digit (bit position 0 to 3) of special data register DT9014 (DT90014 for FP10/10S). • hexadecimal digit position 0 (bit position 0 to 3) of the 16–bit area specified by d becomes 0. This instruction is useful when the hexadecimal or BCD data is treated.
J Data Types Variable
Data Types
d
INT, WORD
J Operands For d
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example LD F106_BSL ST
start Var_0 out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F106_BSL function. *) (* d = Var_0 (destination) *) (* optional *)
14 – 121
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F110
Right shift of one word (16 bits) of 16–bit data range
(WSHR)
Outline
Steps Availability All 3
5
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 trigger EN 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
J Data Types Variable
Data Types
d1, d2
INT, WORD
J Operands For d1, d2
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
Note
14 – 122
The variables d1 and d2 have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F111 Outline
Steps Availability
Left shift of one word (16 bits) of 16–bit data range
(WSHL)
All 3
5
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 trigger EN 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
J Data Types Variable
Data types
d1, d2
INT, WORD
J Operands For d1, d2
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example LD F111_WSHL ST
Note
start Var_0,Var _1 out
(* EN = start; Starting signal for the F111_WSHL function. *) (* d1 = Var_0 (destination1) *) (* d2 = Var_1 (destination2) *) (* optional *)
The variables d1 and d2 have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 123
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F112 Outline
Steps Availability
Right shift of one hex. digit (4 bits) of 16–bit data range
(WBSR)
All 3
5
Shifts one hexadecimal digit (4 bits) of the data range specified by d1 (starting) and d2 (ending) to the right (to the lower digit position) if the trigger EN is in the ON–state. When one hexadecimal digit (4 bits) is shifted to the right, • the data in the lower hexadecimal digit (bit position 0 to 3) of the 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
J Data Types Variable
Data Types
d1, d2
INT, WORD
J Operands For d1, d2
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
Note
14 – 124
The variables d1 and d2 have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F113 Outline
Steps Availability
Left shift of one hex. digit (4 bits) of 16–bit data range
(WBSL)
All 3
5
Shifts one hexadecimal digit (4 bits) of the data range specified by d1 (starting) and d2 (ending) to the left (to the higher digit position) if the trigger EN is in the ON–state. When one hexadecimal digit (4 bits) 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) of the 16–bit data specified by d1 becomes 0. d1 and d2 should be: • in the same operand • d1 ≤ d2
J Data Types Variable
Data Types
d1, d2
INT, WORD
J Operands For d1, d2
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example LD
start
F113_WBSL
Var_0,Var_ 1 out
ST
Note
(* EN = start; Starting signal for the F113_WBSL function. *) (* d1 = Var_0 (destination1) *) (* d2 = Var_1 (destination2) *) (* optional *)
The variables d1 and d2 have to be of the same data type.
Matsushita Electric Works (Europe) AG
14 – 125
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F118
Steps Availability
(UCD)
Up/Down Counter
5
All 3
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 this trigger. Rst_Trig: The condition is reset when this signal is on. The area for the elapsed value d becomes 0 when the leading edge of the trigger is detected (OFF –> ON). The value in s is transferred to d when the trailing edge of the trigger is detected (ON –>s OFF). s: Preset (Set) value or area for Preset (Set) value. d: Area for count (elapsed) value. J Data Types Variable
Data Types
UD_Trig, Cnt_Trig, Rst_Trig
BOOL
s, d
INT, WORD
J Operands For UD_Trig, Cnt_Trig, Rst_Trig s d
Relais
T/C
Register
X
Y
R
L
T
C
DT
LD
FL
x
x
x
x
x
x
–
–
–
WX
WY
WR
WL
SV
EV
DT
LD
FL
x
x
x
x
x
x
x
x
x
–
x
x
x
x
x
x
x
x
x: available –: not available
Example
Note 14 – 126
The variables s and d have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps Availability
F119
(LRSR)
LEFT/RIGHT shift register
All 3
5
Outline LR_trig:
DataInp:
Sh_trig: Rst_trig: d1: d2: Carry:
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. 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. Shifts 1 bit to the left or right when the leading edge of the trigger is detected (OFF → ON). Turns all the bits of the data range specified by d1 and d2 to 0 if this trigger is in the ON–state. Start of 16 bit area. End of 16 bit area. Shifted–out bit.
J Data Types Variable
Data Types
LR_trig, DataInp, Sh_trig, Rst_trig, Carry
BOOL
d1, d2
INT, WORD
J Operands For
Relay
T/C
Register
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
FL
–
x
x
x
x
x
x
x
x
d1, d2
x: –:
Matsushita Electric Works (Europe) AG
available not available
14 – 127
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Example
Note
14 – 128
The variables d1 and d2 have to be of the same data type.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps Availability
F120
16–bit data right rotate
(ROR)
Outline
All 3
5
Rotates n bits of the 16–bit data specified by d to the right if the trigger 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 and into the higher bit positions of the 16–bit data specified by d.
J Data Types Variable
Data Types
d
INT, WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example LD F120_ROR ST
start Var_0,Var_ 1 out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F120_ROR function. *) (* d = Var_0 *) (* n = Var_1 *) (* optional *)
14 – 129
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps Availability
F121
16–bit data left rotate
(ROL)
Outline
All 3
5
Rotates n bits of the 16–bit data specified by d to the left if the trigger EN 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 position 15) is transferred to special internal relay R9009 (carry–flag) • n bits starting from bit position 15 are shifted out to the left and into the lower bit positions of the 16–bit data specified by d.
J Data Types Variable
Data Types
d
INT, WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
14 – 130
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F122 Outline
Steps Availability
16–bit data right rotate with carry–flag data
(RCR)
All 3
5
Rotates n bits of the 16–bit data specified by d including the data of carry–flag to the right if the trigger EN is in the ON–state. When n bits with 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 and carry–flag data and n–1 bits starting from bit position 0 are subsequently shifted into the higher bit positions of the 16–bit data specified by d.
J Data Types Variable
Data Types
d
INT, WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example LD
start
F122_RCR
Var_0,Var_1
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F122_RCR function. *) (* d = Var_0 *) (* n = Var_1 *) (* optional *)
14 – 131
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F123
16–bit data left rotate with carry–flag data
(RCL)
Outline
Steps Availability All 3
5
Rotates n bits of the 16–bit data specified by d including the data of carry–flag to the left if the trigger EN is in the ON–state. When n bits with carry–flag data are rotated to the left, • the data in bit position 16–n (nth bit starting from bit position 15) is transferred to special internal relay R9009 (carry–flag). • n bits starting from bit position 15 are shifted out to the left and carry–flag data and n–1 bits starting from bit position 15 are shifted into lower bit positions of the 16–bit data specified by d.
J Data Types Variable
Data Types
d
INT, WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
14 – 132
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps Availability
F130
(BTS)
Outline
16–bit data bit set
All 3
5
Turns ON the bit specified by the bit position at n of the 16–bit data specified by d if the trigger EN is in the ON–state. Bits other than the bit specified do not change. The range of n is 0 to 15.
J Data Types Variable
Data Types
d
INT, WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example LD
start
F130_BTS
word1, bit_number
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F130_BTS function. *) (* d = word1 *) (* n = bit_number *) (* optional *)
14 – 133
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F131
Steps Availability
(BTR)
Outline
16–bit data bit reset
All 3
5
Turns OFF the bit specified by the bit position at n of the 16–bit data specified by d if the trigger EN is in the ON–state. Bits other than the bit specified do not change. The range of n is 0 to 15.
J Data Types Variable
Data Types
d
INT, WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
14 – 134
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F132
Steps Availability
(BTI)
Outline
16–bit data bit invert
All 3
5
Inverts [1 (ON) → 0 (OFF) or 0 (OFF) → 1 (ON)] the bit at bit position n in the 16–bit data area specified by d if the trigger EN is in the ON–state. Bits other than the bit specified do not change. The range of n is 0 to 15.
J Data Types Variable
Data Types
d
INT, WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example LD
start
F132_BTI
Var_0,Var_1
ST
out
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F132_BTI function. *) (* d = Var_0 *) (* n = Var_1 *) (* optional *)
14 – 135
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F133
Steps Availability
(BTT)
Outline
16–bit data test
All 3
5
Checks the state [1 (ON) or 0 (OFF)] of bit position n in the 16–bit data specified by d if the trigger EN is in the ON–state. The specified bit 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 of n: 0 to 15
J Data Types Variable
Data Types
d
INT, WORD
n
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
14 – 136
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F135 Outline
Steps Availability
Number of ON bits in 16–bit data
(BCU)
All 3
5
Counts the number of bits in the ON state (1) in the 16–bit data specified 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.
J Data Types Variable
Data Types
s
INT, WORD
d
INT
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 137
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F136 Outline
Steps Availability
Number of ON bits in 32–bit data
(DBCU)
All 3
7
Counts the number of bits in the ON state (1) in the 32–bit data specified 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.
J Data Types Variable
Data Types
s
DINT, DWORD
d
INT
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
s
Register
DEV
DDT
DLD
DFL
x
x
x
x
x
x
x
x
x
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
d
x: –:
available not available
Example
14 – 138
LD
start
F136_DBCU
Var_0,Var_1
ST
out
(* EN = start; Starting signal for the F136_DBCU function. *) (* s = Var_0 (source) *) (* d = Var_1 (destination) *) (* optional *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F137 (STMR) Outline
Steps
Auxiliary timer (sets the ON– delay timer for 0.01s units)
Availability FP0, FP1–C56/C72 and FP–M 2.7k/5k
5
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 can be set from 0.01 to 327.67 sec.). If you use the special internal relay R900D as the timer contact, be sure to program it at the address immediately after the instruction. Timer operation: • If the trigger EN of the auxiliary timer instruction (STMR) is in the ON–state, the constant or value specified by s is transferred to the area specified by d. • During the timing operation, the time is subtracted from the value in the area specified by d. • The output ENO turns ON when the value in the area specified by d becomes 0.
J Data Types Variable
Data Types
s, d
INT, WORD
J Operands For
Relay
T/C
Register
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
x: –:
available not available
Example
Notes
D The variables s and d have to be the same data type. D This function cannot be used in a function block. D Each timer used has to have its own constant Num*. System registers 5 and 6 determine the Num* addresses available. The timer functions TM_1s, TM_100ms, TM_10ms and TM_1s use the same Num* address area.
Matsushita Electric Works (Europe) AG
14 – 139
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
F138
(HMSS)
Outline
h:min:s ³ s conversion
Availability FP1–C24/40,FP1–C56/ 72 and FP–M 2.7k/5k
7
Converts the hours, minutes, and seconds data stored in the 32–bit area specified by s to seconds data if the trigger EN is in the ON–state. The converted seconds data is stored in the 32–bit area specified by d. All hours, minutes, and seconds data to convert and the converted seconds data is BCD. The max. data input value is 9,999 hours, 59 minutes and 59 seconds, which will be converted to 35,999,999 seconds in BCD format.
J Data Types Variable
Data Types
s, d
DWORD
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example
14 – 140
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
F139
(SHMS)
Outline
s ³ h:min:s conversion
Availability FP1–C24/40,FP1–C56/72 and FP–M 2.7k/5k
5
Converts the second data stored in the 32–bit area specified by s to hours, minutes, and seconds data if the trigger EN is in the ON– state. The converted hours, minutes, and seconds data is stored in the 32–bit area specified by d. The seconds prior to conversion and the hours, minutes, and seconds after conversion are all BCD data. The maximum data input value is 35,999,999 seconds, which is converted to 9,999 hours, 59 minutes and 59 seconds.
J Data Types Variable
Data Types
s, d
DWORD
J Operands For
Relais
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
Example LD
start
F139_SHMS
Var_0,Var_ 1 out
ST
Matsushita Electric Works (Europe) AG
(* EN = start; Starting signal for the F139_SHMS function. *) (* s = Var_0 (source) *) (* d = Var_1 (destination) *) (* optional *)
14 – 141
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
F140
(STC)
Outline
Carry–flag set
1
Availability All 3, except FP1– C14/16 and FP–M 0.9k
Special internal relay R9009 (carry–flag) goes ON if the trigger EN is in the ON–state. This instruction can be used to control data using carry–flag R9009 (e.g. F122_RCR and F123_RCL instructions).
Example
14 – 142
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
F141
(CLC)
Outline
Carry–flag reset
1
Availability All 3, except FP1– C14/16 and FP–M 0.9k
Special internal relay R9009 (carry–flag) goes OFF if the trigger EN is in the ON–state. This instruction can be used to control data using carry–flag R9009 (e.g. F122_RCR and F123_RCL instructions).
Example LD F141_CLC ST
start
(* EN = start; Starting signal for the F141_CLC function. *)
out
(* optional *)
Matsushita Electric Works (Europe) AG
14 – 143
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F143
Steps Availability
(IORF)
Outline
Partial I/O update
All 3, except FP1–C14/16
1
Updates the inputs or outputs specified by d1 and d2 immediately after the trigger EN is in the ON–state even in the program execution stage. Using this instruction, you can update inputs or outputs without the time–lag caused by scanning. Specify the word address as 0 ≤ d1 ≤ d2 ≤ 127. The partial I/O update instruction is executed only for the I/O units on the master backplane or expansion backplane. It is not executed for the I/O unit in the slave station of the Remote I/O System.
J Data Types Variable
Data Types
d1, d2
INT, WORD
J Operands For
Relay WX(1) WY(1)
T/C
Register
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
x: –:
available not available
Example
Note
14 – 144
If variables are used for the inputs d1 and d2 then NAiS Control internally uses index registers.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
F144
Serial communication (RS232C)
(TRNS)
5
Availability C types of FP0 and FP1– C24/40–C56/72, FP–M5k
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 RS232C port. (Set n so that it may not exceed maximum of data register.) • You cannot use the first word of the transmission source to set the transmission bytes (n). The transmission bytes (n) decrease one by one at every transmission. When the transmission is completed, the transmission bytes become 0 and the end–of–transmission flag (R9039) turns ON. • The first word of the transmission source data area (register) is regarded the transmission bytes. • Set 2 (for general port) to system register No. 412 to execute the F144 (TRNS) instruction. • You can set the transmission baudrate and protocol by system register No. 413, 414. • Header and terminator are automatically added to the transmission data. • R9039 is OFF during transmission, it is in the ON–state after the end of transmission. • The executing of F144 (TRNS) instruction clears the receiving end flag 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, and starts the receiving process without performing the transmission process. Use F144 (TRNS) instruction in this state when you exclusively receive repeat data. J Data Types Variable
Data Types
s
WORD
n
INT, WORD
Matsushita Electric Works (Europe) AG
14 – 145
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
J Operands For
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
s
–
–
–
–
–
–
x
–
–
n
x
x
x
–
x
x
x
x
x
x: –:
available not available
Example
14 – 146
LD
start
F144_TRNS
Var_0,Var_1
ST
out
(* EN = start; Starting signal for the F144_TRNS function. *) (* s = Var_0 *) (* n = Var_1 *) (* optional *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps Availability
F147 Outline
FP0 + TR–Types of FP1–C24/40–C56/72, FP–M2.7k/5k
5
(PR)
Parallel printout
Outputs the ASCII codes for 12 characters stored in the 6–word area specified by s via the word external output relay specified by d if the trigger EN is in the ON–state. If a printer is connected to the output specified by d, a character corresponding to the output ASCII code is 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 the starting area. Three scans are required for 1 character constant output. Therefore, 37 scans are required until all characters constants are output. Since it is not possible to execute multiple F147 (PR) instructions in one scan, use print–out flag R9033 to be sure they are not executed simultaneously. If the character constants convert to ASCII code, use of the F95_ASC instruction is recommended.
J Data Types Variable
Data Types
s
INT, WORD
d
WORD
J Operands For
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
s
x
x
x
x
x
x
x
x
x
d
–
x
–
–
–
–
–
–
–
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 147
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps Availability
F148
(ERR)
Outline
Self–diagnostic error set
All 3, except FP1– C14/16 and FP–M 0.9k
3
The error No. specified by n* is placed into special data register DT9000 (DT90000 for FP10/10S). At the same time, the self–diagnostic error–flag R9000 is set and ERROR LED on the CPU is turned ON. The contents of the error–flag R9000 can be read and checked 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 NAiS Control (Monitor → Display Special Registers → Basic Error Messages). When n* = 0, the error is reset. (only for operation continue errors, n* = 200 to 299.) The ERROR LED is turned OFF and the contents of special data register DT9000 (DT90000 for FP10/10S) are cleared with 0. When n* = 100 to 199, the operation is halted. When n* = 200 to 299, the operation is continued. Flag condition: • Error–flag (R9007): Turns ON and keeps the ON state when the n exceeds the limit. • Error–flag (R9008): Turns ON for an instant when the n exceeds the limit.
J Data Types Variable
Data Types
n*
INT, WORD
J Operands For n*
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
–
–
–
–
–
–
–
–
x: –:
available not available
Example LD F148_ERR ST
14 – 148
start 100 out
(* EN = start; Starting signal for the F148_ERR function. *) (* n* = 100 *) (* optional *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps Availability
F149
(MSG)
Outline
All 3, except FP1– C14/16 and FP–M 0.9k
13
Message display
This instruction is used for displaying the message on the FP Programmer II screen. After executing F149 (MSG) instruction, you can see the message specified by s on the FP Programmer II screen. When the F149 (MSG) instruction is executed, the message–flag R9026 is set and the message specified by s is set in special data registers DT9030 to DT9035 (DT90030 to DT90035 for FP10/10S). Once the message is set in special data registers, the message can’t be changed even if the F149 (MSG) instruction is executed again. You can clear the message with the FP Programmer II.
J Data Types Variable
Data Types
s
STRING(12)
J Operands For s
Relay
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
–
–
–
–
–
–
–
–
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 149
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
F157
(CADD)
Outline
Example
Time addition
Availability FP1– C24/40, FP1– C56/72, FP–M 2.7k/5k
9
The date/clock data (3 words) specified by s1 and the time data (2 words) specified by s2 are added together if the trigger EN is in the ON–state. The result is stored in the area (3 words, same format as s1) specified by d. All the data used in the F157 (CADD) instruction are handled in form of BCD. Clock/calendar data: August 1, 1992 s1[1]: s1[2]: s1[3]:
Time: 14:23:31 (hour:minutes:seconds) 2331 hex (minutes/seconds) 0114 hex (day/hour) 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 to DT90056 for FP10/10S) for the operand d. These registers store built–in calendar timer values. To change the built–in calendar timer value, first store the added result in other memory areas and transfer them to the special data registers using the F0_MV instruction.
J Data Types Variable
Data Types
s1, d
ARRAY [1..3] OF WORD
s2
DWORD
J Operands For
Relay
T/C
Register
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
DEV
DDT
DLD
DFL
x
x
x
x
DWX DWY DWR DWL DSV s2 x
Example
14 – 150
x
x
x
x
x: –:
available not available
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps Availability
F158
(CSUB)
Outline
Example
Time subtraction
FP1– C24/40, FP1– C56/72, FP–M 2.7k/5k
9
Subtracts time data (2 words) specified by s2 from the date/clock data (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) specified by d. All the data used in the F158 (CSUB) instruction are handled in form of BCD. 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 to DT90056 for FP10/10S) for the operand d. These registers store built–in Calendar timer values. To change the built–in Calendar timer value, first store the added result in other memory areas and transfer them to the special data registers using the F0_MV instruction.
J Data Types Variable
Data Types
s1, d
ARRAY [1..3] OF WORD
s2
DWORD
J Operands For
Relay
T/C
Register
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
DEV
DDT
DLD
DFL
x
x
x
x
DWX DWY DWR DWL DSV s2
x
x
x
x
x
x: –:
Matsushita Electric Works (Europe) AG
available not available
14 – 151
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Example
14 – 152
LD
start
F158_CSUB
Var_0,Var_1Var_2
ST
out
(* EN = start; Starting signal for the F158_CSUB function. *) (* s1 = Var_0 (source1)*) (* s2 = Var_1 (source2) *) (* d = Var_2 (destination) *) (*s1 – s2 = d *) (* optional *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F162
(HC0S)
Outline
Steps Availability
High–speed counter output set
FP1, FP–M
7
Sets the value specified by s as target value of the high–speed counter if the trigger EN is in the ON–state. When the elapsed value (DT9045 and DT9044) of the high–speed counter agrees with the target value (DT9047 and DT9046), the external output relay specified by d turns ON. You can use 8 external output relays (Y0 to Y7). The target value is stored in special data registers DT9047 and DT9046 when the F162 (HC0S) instruction is executed and it is cleared when the elapsed value of the high–speed counter agrees with the target value. Use 24 bit binary data with sign data for the target value of HSC (FF800000 hex to 007FFFFF hex / –8,388,608 to 8,388,607). Special internal relay R903A turns ON and stays ON while the F162 (HC0S) instruction is executed and it is cleared when the elapsed value of the high–speed counter coincides with the target value. Even if the reset operation of the high–speed counter is performed after executing the F162 (HC0S) instruction, the target value setting is not cleared until the elapsed value of the high–speed counter coincides with the target value. To reset the external output relay, which is set ON by the F162 (HC0S) instruction, use the F163_HC0R instruction. You can use the same external output relay specified by the F162 (HC0S) instruction in other parts of program. It is not regarded duplicate use of the same output. While special internal relay R903A is in ON state, no other high–speed counter instructions F162 (HC0S), F163_HC0R, F164_SPD0, F165_CAM0 can be executed.
J Data Types Variable
Data Types
s
DINT, DWORD
d
BOOL
J Operands For s
Relais
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
x
x
x
–
x
x
x
–
–
X
Y
R
L
T
C
DT
LD
FL
–
x
–
–
–
–
–
–
–
d
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 153
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F163 Outline
Steps Availability
(HC0R)
High–speed counter output reset
FP1, FP–M
7
Sets the value specified by s as target value of the high–speed counter if the trigger EN is in the ON–state. When the elapsed value (DT9045 and DT9044) of the high–speed counter agrees with the target value (DT9047 and DT9046), the external output relay specified by d turns OFF. You can use 8 external output relays (Y0 to Y7). When the F163 (HC0R) instruction is executed, the target value is stored in special data registers DT9047 and DT9046 and it is cleared when the elapsed value of the high–speed counter agrees with the target value. Use 24 bit binary data with sign data for the target value of HSC (FF800000 hex to 007FFFFF hex / –8,388,608 to 8,388,607). Once the F163 (HC0R) instruction is executed, special internal relay R903A turns ON and stays ON. It is cleared when the elapsed value of the high–speed counter agrees the target value. Even if the reset operation of the high–speed counter is performed after executing the F163 (HC0R) instruction, the target value setting is not cleared until the elapsed value of the high–speed counter 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 considered duplicate use of the same output. While special internal relay R903A is in ON state, no other high–speed counter instructions F162_HC0S, F163 (HC0R), F164_SPD0, F165_CAM0 can be executed.
J Data Types Variable
Data Types
s
DINT, DWORD
d
BOOL
J Operands For s
Relais
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
x
x
x
–
x
x
x
–
–
X
Y
R
L
T
C
DT
LD
FL
–
x
–
–
–
–
–
–
–
d
x: –:
available not available
Example
14 – 154
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 *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions Steps
F164 Outline
3
Pulse output control; Pattern output control
(SPD0)
Availability pulse; Tr Types FP1/FP–M 2.7k/5k, + FP–M 0.9k pattern: FP1 and FP–M
Outputs the pattern of the pulse corresponding to the elapsed value of HSC. When the executing condition is ON and HSC control–flag (R903A) is OFF, this instruction starts operation. This instruction executes pattern output or pulse output corresponding to the data of the data table registered at the data register specified by s. You can use pulse output for positioning with a pulse motor and pattern output for controlling an inverter. When you execute pulse output with this instruction, input the pulse of Y7 directly to HSC or input the encoder output pulse. When you execute pattern output, input the encoder output pulse to HSC. Specify at system register No. 400 whether you will use HSC or not. It is not possible to execute this instruction without setting. The output coils of pattern output are within 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 the first word of the data table. When you input 0 for one word of the first address (all bits are 0), it will be the pulse output. When you execute pattern output, an error occurs unless the No. of the control steps is 1 to F or unless the No. of control points is 1 to 8. An error occurs when the first target value is not FF800000 to 7FFFFF. An error does not occur when the first target value on and after the second one are not FF800000 to 7FFFFF. The operation, however, is stopped and R903A turns OFF. When the frequency data is ”0”, pulse output ends. It will also end if the area is exceeded during its execution.
J Data Types Variable
Data Types
s
INT, WORD
J Operands For s
Relais
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
–
–
–
–
–
x
–
–
x: –:
available not available
Example
Matsushita Electric Works (Europe) AG
14 – 155
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions Steps
F165
(CAM0)
Outline
Cam control
3
Availability All 3, except FP0 and FP–M 0.9k
Converts ON/OFF of output specified on the table corresponding to the elapsed value of HSC. This instruction controls the output up to 8 points (Y0 to Y7), corresponding to ON/OFF target value of each coil on the table, which is for the control of cam position specified by s. The target value is within the range of 23–bits data and 0 to 8388607. If you execute cam control, you have to specify the operating mode as addition counter. (If it is not addition counter, you will not be able to execute the control properly.) The target value is maximum 32 steps with FP1–C16, maximum 64 steps with FP1–C24/C40. If you cancel hard reset, soft reset, and control maximum value you can set the initial pattern at output, set the elapsed value to 0 and restart Cam control. You can output the initial pattern at the start of control. However, you cannot clear the elapsed value to 0.
J Data Types Variable
Data Types
s
INT, WORD
J Operands Für s
Relais
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
–
–
–
–
–
x
–
–
x: –:
available not available
Example
14 – 156
LD
start
(*EN = start; Starting signal for the F165_CAM0 function*)
F165_CAM0
Var_0
(* s = Var_0*)
ST
out
(* option *)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F166 Outline
(HC1S)
Sets Output of High– speed counter (4Channels)
Steps Availability FP0
11
If the trigger EN of the instruction F166 has the status TRUE, pulses at the HSC will be counted. If the elapsed value of the high–speed counter equals the target value s, an interrupt will be executed and the output relay d of the PLC will be set. In addition to this the special relay for the HSC n (R903A/B/C/D) will be reset and F166 is deactivated. Target Value (s) Elapsed value of HSC F166_start Special relay (n) R903A/B/C/D PLC output (d)
If the high–speed counter is reset (reset input of HSC from 0 to 1, see system register 400/401 in the project navigator) before the elapsed value has reached the target value s, the elapsed value will be reset to zero. F166 remains active and counting restarts at zero.The duplicate use of an external output relay in other instructions (OUT, SET, RST, KEEP and other F instructions) is not verifyed by NAiS Control and 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 executed.FP0 provides 4 HSC channels. The channel number is specified by n (0 to 3). n values
0
1
2
3
Elapsed value register: Target value register: Used channel: ON during execution:
DDT9044 DDT9046 CH0 of HSC0 R903A
DDT9048 DDT9050 CH1 of HSC0 R903B
DDT9104 DDT9106 CH0 of HSC1 R903C
DDT9108 DDT9110 CH1 of HSC1 R903D
s values –8388608 or 16#FF800000 ... 8388607 or 16#7FFFFF
d values 0 ... 7
Matsushita Electric Works (Europe) AG
output Y0 ... Y7
14 – 157
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
J Data Types Variable
Data Types
n
DINT, DWORD
s
DINT, DWORD
d
BOOL
J Operands For
Relais
T/C
DWX DWY DWR DWL DSV s
Register
DEV
DDT
DLD
DFL
x
x
x
–
x
x
x
–
–
X
Y
R
L
T
C
DT
LD
FL
–
x
–
–
–
–
–
–
–
d
x: –:
available not available
Example Globale Variable List: 0
Identifier
Address
Type
Initial
Comment
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_HC1S
F166_start 0,10000,out_0
Load start condition execute F166
POU Body (Ladder Diagramm)
Notes
14 – 158
D 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. D 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
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F167 Outline
(HC1R)
Resets Output of High–speed Counter (4 Channels)
Steps Availability 11
FP0
If the trigger EN of the instruction F167 has the status TRUE, pulses at the HSC will be counted. If the elapsed value of the high–speed counter equals the target value s, an interrupt will be executed and the output relay d of the PLC will be reset. In addition to this the special relay for the HSC n (R903A/B/C/D) will be reset and F167 is deactivated.
Target Value (s) F167_start Special Relay (n) R903A/B/C/D PLCOutput (d)
If the high–speed counter is reset (reset input of HSC from 0 to 1, see system register 400/401 in the project navigator) before the elapsed value has reached the target value s, the elapsed value will be reset to zero. F167 remains active and counting restarts at zero. The duplicate use of an external output relay d in other instructions (OUT, SET, RST, KEEP and other F instructions) is not verifyed by NAiS Control and 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 executed. FP0 provides 4 HSC channels. The channel number is specified by n (0 to 3). n values
0
1
2
3
Elapsed value register: Target value register: Used channel: ON during execution:
DDT9044
DDT9048
DDT9104
DDT9108
DDT9046
DDT9050
DDT9106
DDT9110
CH0 of HSC0 R903A
CH1 of HSC0 R903B
CH0 of HSC1 R903C
CH1 of HSC1 R903D
s values –8388608 or 16#FF800000 ... 8388607 or 16#7FFFFF
d values
output
0 ... 7
Y0 ... Y7
Matsushita Electric Works (Europe) AG
14 – 159
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
J Data Types Variable
Data Types
n
DINT, DWORD
s
DINT, DWORD
d
BOOL
J Operands For
Relais
T/C
DWX DWY DWR DWL DSV s
Register
DEV
DDT
DLD
DFL
x
x
x
–
x
x
x
–
–
X
Y
R
L
T
C
DT
LD
FL
–
x
–
–
–
–
–
–
–
d
x: –:
available not available
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_HC1R
F167_start 0,–200,out_0
load start condition execute F167
POU Body (Ladder Diagramm):
Note
14 – 160
D 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. D 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
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F168 Outline
Steps Availability
(SPD1)
Positioning Pulse Instruction
5
TR Type of FP0
The function generates a pulse train through the PLC outputs Y0 or Y1 as defined in a look up table.
D When starting the function (EN = TRUE) the frequence Fmin is sent to the ouput of the PLC and the special relays R903A/R903B defined by n* will be set. D After that, the frequence will be increased from Fmin to Fmax during the period Tdelay. D The frequence Fmax remains unchanged until the number of pulses DImp are output. Counting of the pulses starts at the moment Fmax is reached. DImp = (Fmax+Fmin)/2*Tdelay*2–TargetPulseCount D Afterwards, the frequence will be reduced from Fmax to Fmin during the period Tdelay. D If the value of Fmin is reached, the special relays R903A/R903B (defined by n*) and the PLC ouput will be reset. D In addition to the pulse output a direction output can be realized as well (see parameter init of DUT).
Note
D If DImp has a positive value, processing is executed as described above. D If DImp = 0, Fmax will be reduced to Fmin without delay. D If DImp has a negative value, Fmin will be reduced before Fmax is reached but the number of TargetPulseCount pulses will be output.
Matsushita Electric Works (Europe) AG
14 – 161
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
J Data Types Variable
Data Types
s
SDT (Strukturierter Datentyp)
n*
INT, WORD
J Operands For
Relais
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
s
–
–
–
–
–
–
x
–
–
n*
–
–
–
–
–
–
–
–
–
x: –:
available not available
Values for n
0
1
Uses output: Elapsed value register: Target value register: Used channel: Special relay (ON during execution): Local range input enabled: Local range input:
Y0 (direction Y2) DDT9044 DDT9046 CH0 of HSC0 R903A
Y1 (direction Y3) DDT9048 DDT9050 CH1 of HSC0 R903B
DT9052 bit 2 ON X0
DT9052 bit 6 ON 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
14 – 162
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
Parameter Init of DUT = 16#0XYZ X = Pulse width (ON/OFF time): X values
ON time
0 1
50 % 80 µs
ON ON
OFF time
Comment
50 % rest
max. Fmax = 6 kHz max. Fmax = 9.5 kHz
OFF OFF
Y = Pulse count mode: Z = Direction output: YZ values
Pulse count mode
Direction output
00 02
Incremental counting Incremental counting
03
Incremental counting
10 12
Absolute counting Absolute counting
13
Absolute counting
20 22 23
Return to origin point Return to origin point Return to origin point
Not used OFF if TargetPulseCount value positive ON if TargetPulseCount value negative ON if TargetPulseCount value positive OFF if TargetPulseCount value negative Not used OFF if TargetPulseCount value positive ON if TargetPulseCount value negative ON if TargetPulseCount value positive OFF if TargetPulseCount value negative Not used OFF 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 DUT Fmin values 40 ... 5000
frequency 40 Hz ... 5.0 kHz
Parameter Fmax of DUT Fmax values 40 ... 9500
frequency 40 Hz ... 9.5 kHz
Parameter Tdelay of DUT Tdelay values 30 ... 32767
Matsushita Electric Works (Europe) AG
ramp time 30 ms ... 327.67 s
14 – 163
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Parameter TargetPulseCount of DUT TargetPulseCount 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 set the initalizing parameters or assign the initialization values to the DUT elements (e.g.: SPD_DUT.Init=16#0102) in you PLC programming code. POU Header: Type Initial
Comment
0 VAR_EXTERNAL SPD_DUT
Class
Identifier
SPD
SDT für F68_SPD1
1 VAR
BOOL FALSE
F168_start
Init:=16#0102 Fmin:=500 Fmax:=5000 Tdelay:=4000 TargetPulseCount: =15000
F168 start condition
POU Body (Instruction List): LD F168_SPD1
F168_start SPD_DUT.Init,0
Load start condition execute F168
POU Body (Ladder Diagramm):
next page
14 – 164
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
Notes
D The message ’Function executed’ (R903A/B) appears during the PLC program, and not when the function is merely called up. D While the registers R903A/B have the status TRUE, no further HSC commands can be executed (calling F168 has no effect). D Pulses are output by the HSC until the elapsed value equals the target value. D If you edit your program online (RUN mode), the number of output pulses may be wrong. D Error Flags: No.
IEC–Address
set
if
R9007
%MX0.900.7
ON
index is too high
R9008
%MX0.900.8
ON
Fmin > Fmax
Matsushita Electric Works (Europe) AG
14 – 165
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F169
Steps Availability
(PLS)
Outline
Pulse Width Modulation y 40 Hz
TR type of FP0
5
PLC outputs pulses greater than/equal to 40Hz to a PLC output according to the parameters defined in a data table.
J Data Types Variable
Data Types
s
ARRAY [0..1] OF INT or WORD
n*
INT, WORD
J Operands For
Relais
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
s
–
–
–
–
–
–
–
–
–
n*
–
–
–
–
–
–
–
–
– x: –:
Note
available not available
Values for n
0
1
Used output: Elapsed value register: Used channel: ON during execution:
Y0 (direction Y2) DDT9044 CH0 of HSC0 R903A
Y1 (direction Y3) DDT9048 CH1 of HSC0 R903B
If R903A/R903B has the status TRUE, no other high–speed counter related instructions can be executed (calling the F169 instruction has no effect). The frequency can be changed during execution of F169. The new settings will be used after the actual ON/OFF period has finished. Use F170_PWM function for frequency smaller than/equal to 38Hz. Values for s ARRAY: ARRAY[0] = 16#0XYZ X = pulse width (ON/OFF time): X values
ON time
1 2 ...
10 20 ... ON 80 90
8 9
OFF time % ON % ON % % ON % ON
90 80 ... OFF 20 10
% OFF % OFF % % OFF % OFF
next page
14 – 166
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
Y = pulse count mode Z = direction output YZ values
Pulse count mode
Direction output
00 10 12 13 20 22 23
No counting Incremental counting Incremental counting Incremental counting Decremental counting Decremental counting Decremental counting
Not used Not used OFF ON Not used ON OFF
The pulse count mode and the direction output parameters cannot be changed during the execution of F169. Restart the function to activate newly set parameters. ARRAY[1] value
Frequency
40 41 ... 9999 10000
40 41 ... 9.99 10
Hz Hz kHz kHz
The frequency can be changed during execution of F169. The new settings will be used after the actual ON/OFF period has finished. Use F170_PWM function for frequency smaller than/equal to 38Hz.
Notes
D If R903A/R903B has the status TRUE, no other high–speed counter related instructions can be executed (calling the F169 instruction has no effect). D If the frequency (see ARRAY[1]) is high, very small or very high pulse width values (see ARRAY[0]) can deformat the pulse output as a result of the limited edge steepness of the PLC outputs.
D The frequency and the pulse–width repetition rate can be changed in each PLC cycle. D If incremental counting is choosen, pulse output stops as soon as the value of the register exceeds the value 16#7FFFFF.
Matsushita Electric Works (Europe) AG
14 – 167
Matsushita Instruction Set
NAiS Control 1131
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.
D If decremental counting is choosen, pulse output stops as soon as the value of the register is less than the value 16#FF800000. D Pulse output may be stopped if the PLC program is changed online (RUN mode).
Example POU Header 0
Class
Identifier
Type
Initial
Comment
VAR
PLS
ARRAY [0..1] OF INT
16#0410,100 0
PLS ARRAY: 40% ON 60%OFF incremental counting – no direction output
1
VAR
F169_start
BOOL
FALSE
F169 Start condition
IL Body LD F169_PLS
F169_start PLS,0
Load start condition execute F169
LD Body
Note
14 – 168
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.
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
F170 Outline
Steps Availability
(PWM)
Pulse Width Modulation
TR type of FP0
5
This function outputs outputs defined in a data table to an output of a PLC.
J Data Types Variable
Data Types
s
ARRAY [0..1] OF INT or WORD
n*
INT, WORD
J Operands For
Relais
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
s
–
–
–
–
–
–
–
–
–
n*
–
–
–
–
–
–
–
–
– x: –:
available not available
Values for n
0
1
Used output: Used channel: ON during execution:
Y0 CH0 of HSC0 R903A
Y1 CH1 of HSC0 R903B
Values for s ARRAY ARRAY[0] values
Frequency
Cycle duration
0 (16#0) 1 (16#1) 2 (16#2) 3 (16#3) 4 (16#4) 5 (16#5) 6 (16#6) 7 (16#7) 8 (16#8) 17 (16#11) 18 (16#12) 19 (16#13) 20 (16#14) 21 (16#15) 22 (16#16)
38 19 9.5 4.8 2.4 1.2 0.6 0.3 0.15 1 714 500 400 200 100
(26 (52 (105 (210 (420 (840 (1.6 (3.4 (6.7 (1 (1.4 (2 (2.5 (5 (10
Hz Hz Hz Hz Hz Hz Hz Hz Hz Hz Hz Hz Hz Hz Hz
ms) ms) ms) ms) ms) ms) s) s) s) ms)* ms)* ms)* ms)* ms)* ms)*
(* Available beginning with Version 2.0). The frequency cannot be changed during execution of F170. Restart the function to aktivate newly set parameters.
Use F169_PLS function for frequency f > 38Hz.
Matsushita Electric Works (Europe) AG
14 – 169
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions ARRAY[1] values
ON time
0 1 2 ... 998 999 1000
0 0.1 0.2 ... 99.8 99.9 100
OFF time % ON % ON % ON % ON % ON % ON % ON
100 99.9 99.8 ... 0.2 0.1 0
% OFF % OFF % OFF % OFF % OFF % OFF % OFF
The pulse width (ON/OFF time) can be changed during execution of F170. The changes are valid after the current periode is finished.
Notes
D If the special relays R903A/B have the status TRUE, no other high–speed counter related instructions can be executed (calling the F170 instruction has no effect). D If the frequency (see ARRAY[1]) is high, very small or very high pulse width values (see ARRAY[0]) can deformat the pulse output as a result of the limited edge steepness of the PLC outputs.
D The period can be changed in each PLC cycle. The frequency is only assumed when this function is started.
Example POU Header Class
Identifier
Type
Initial
Comment
0
VAR
PWM
ARRAY [0..1] OF INT
2(0)
PWM ARRAY
1
VAR
F170_start
BOOL
FALSE
F170 start condition
POU Body (Instruction List): LD
5
ST
PWM [0]
define PWM parameters 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
14 – 170
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set 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.
Matsushita Electric Works (Europe) AG
14 – 171
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F183
Steps Availability
(DSTM)
Outline
Special 32–bit timer
FP0
The F183 instruction activates an upward counting 32 bit timer which works on–delayed. The smallest counting unit is 0.01s. During execution of F183 (start = TRUE), elapsing time is added to the elapsed value d. The timer output q and the special internal relay R900D will be set if the elapsed value d equals the set value s. If the start condition start is set to FALSE, execution will be interrupted and the elapsed value d will be reset to zero. The set value s can be changed during execution of F183. In(start) Elapsed value(d)
Set value(s)
Out(q)
The delay time of the timer can be calculated using the following formula: (Set Value s) * (0.01s) = on–delay
Note
If you use R900D as the timer contact, be sure to program it immediately after the timer instruction.
start :Timer operation condition s: Set Value (0 to 2147483647), other values are considered as 0. d : Elapsed Value (0 to 2147483647) q : Timer output J Data Types Variable start, q s
Data Types BOOL DINT, DWORD
next page
14 – 172
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
J Operands For
Relay
s start q
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
x
x
x
–
x
x
x
–
–
X
Y
R
L
T
C
DT
LD
FL
x
x
x
–
x
x
–
–
–
–
x
x
–
–
–
–
–
–
x: –:
available not available
Example POU–Header: 0 1 2 3
Class
Identifier
Type
Initial
Comment
VAR VAR VAR VAR
In Out Set_Value Elapsed_Value
BOOL BOOL DINT DINT
FALSE FALSE 10000 0
start condition ON if timer runs out set value for timer (100 s) elapsed value of timer
POU–Body (Instruction List): LD F183_DSTM ST
In Set_Value Elapsed_Value Out
load starting condition execute the timer 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.
Matsushita Electric Works (Europe) AG
14 – 173
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Floating point data " 16–bit integer data (the largest integer not exceeding the floating point data)
F327 (INT) Outline
Steps Availability FP0
8
The function converts a floating point data at input s in the range –32767.99 to 32767.99 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 equal to the floating point value at input s: When there is a positive floating point value at the input, a positive pre–decimal value is returned at the output. When there is a negative floating point value at the input, the next smallest pre–decimal value is returned at the output. If the floating point value has only zeros after the decimal point, its pre–decimal point value is returned. The difference between the F and the P instruction is that the P instruction is only executed at the leading edge scan of the EN trigger.
J Data Types Variable
Data Types
s
REAL
d
INT
J Operands For s
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
x
x
x
x
x
x
x
x
x
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
x
x
x
x
x
x
x
x
d
x: –:
available not available
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 programming languages.
next page
14 – 174
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variable input_value is declared. However, you can write 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 converts the floating point value –1.234 into the whole number value –2, which is transferred to the variable output_value at the output. Since the whole number 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
R9008
%MX0.900.8
for an instant
the value at input s is not a REAL number, or the converted result exceeds the range of output d
R900B
%MX0.900.11
to TRUE
the result is 0
Matsushita Electric Works (Europe) AG
14 – 175
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F328 (DINT) Outline
Floating point data " 32–bit Steps Availability integer data (the largest integer not FP0 8 exceeding the floating point data)
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 equal to the floating point value at input s: When there is a positive floating point value at the input, a positive pre–decimal value is returned at the output. When there is a negative floating point value at the input, the next smallest pre–decimal value is returned at the output. If the floating point value has only zeros after the decimal point, its pre–decimal point value is returned. The difference between the F and the P instruction is that the P instruction is only executed at the leading edge scan of the EN trigger.
J Data Types Variable
Data Types
s
REAL
d
DINT
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
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 programming languages.
next page
14 – 176
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variable input_value is declared. However, you can write 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 converts the 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 function 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
R9008
%MX0.900.8
for an instant
the value at input s is not a REAL number, or the converted result exceeds the range of output d
R900B
%MX0.900.11
to TRUE
the result is 0
Matsushita Electric Works (Europe) AG
14 – 177
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F333 (FINT) Outline
Steps Availability
Rounding the first decimal point down
FP0
8
The function rounds down the decimal part of the real number data and returns it at output d. The difference between the F and the P instruction is that the P instruction is only executed at the leading edge scan of the EN trigger.
J Data Types Variable
Data Types
s
REAL
d
REAL
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
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 programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variable input_value is declared. However, you can write a constant directly at the input contact of the function instead.
next page
14 – 178
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
Body The value 1234.888 is assigned to the variable input_value. When the variable start is set to TRUE, the function is carried out. It rounds down the input_value after the decimal point and returns the result (here: 1234.000) at the 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
Matsushita Electric Works (Europe) AG
14 – 179
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Outline
Steps Availability
Rounding the first decimal point off
F334 (FRINT)
FP0
8
The function rounds off the decimal part of the real number data and returns it at output d. The difference between the F and the P instruction is that the P instruction is only executed at the leading edge scan of the EN trigger.
J Data Types Variable
Data Types
s
REAL
d
REAL
J Operands Relay For
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
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 programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variable input_value is declared. However, you can write a constant directly at the input contact of the function instead.
next page
14 – 180
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
Body When the variable start is set to TRUE, the function is carried out. It rounds off 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
Matsushita Electric Works (Europe) AG
14 – 181
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F335
(FSIGN)
Outline
Floating point data sign changes (negative/positive conversion)
Steps Availability FP0
8
The function changes the sign of the floating point value at input s and returns the result at output d. The difference between the F and the P instruction is that the P instruction is only executed at the leading edge scan of the EN trigger.
J Data Types Variable
Data Types
s
REAL
d
REAL
J Operands Relay For
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
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 programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variable input_value is declared. However, you can write a constant directly at the input contact of the function instead.
next page
14 – 182
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
Body The value 333.4 is assigned to the variable input_value. When the variable start 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
Matsushita Electric Works (Europe) AG
the result causes an overflow
14 – 183
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F337 Outline
Steps Availability
Conversion of angle units (Degrees " Radians)
(RAD)
FP0
8
The function converts the value of an angle entered at input s from degrees to radians and returns the result at output d.The difference between the F and the P instruction is that the P instruction is only executed at the leading edge scan of the EN trigger.
J Data Types Variable
Data Types
s
REAL
d
REAL
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
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 programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variable input_value is declared. However, you can write a constant directly at the input contact of the function instead.
next page
14 – 184
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set 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
Matsushita Electric Works (Europe) AG
14 – 185
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
Conversion of angle units (Radians " Degrees)
F338 (DEG) Outline
Steps Availability FP0
8
The function converts the value of an angle entered at input s from radians to degrees and returns the result at output d. The difference between the F and the P instruction is that the P instruction is only executed at the leading edge scan of the EN trigger.
J Data Types Variable
Data Types
s
REAL
d
REAL
J Operands For
Relay
T/C
DWX DWY DWR DWL DSV
Register
DEV
DDT
DLD
DFL
s
x
x
x
x
x
x
x
x
x
d
–
x
x
x
x
x
x
x
x
x: –:
available not available
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 programming languages. POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In this example, the input variable input_value is declared. However, you can write a constant directly at the input contact of the function instead.
next page
14 – 186
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set 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
Matsushita Electric Works (Europe) AG
14 – 187
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
F355 Outline
Steps Availability
(PID)
PID processing instruction
4
FP0
The PID processing instruction is used to regulate a process (e.g. a heater) given a measured value (e.g. temperature) and a predetermined output value (e.g. 20_C). The function calculates a PID algorithm whose parameters are determined in a data table in the form of an ARRAY with 30 elements that is entered at input s. The data table contains the following parameters: ARRAY[0]: Control mode ARRAY[1]: Set value (SP) ARRAY[2]: Measured value (PV) ARRAY[3]: Output value (MV) ARRAY[4]: Output lower limit ARRAY[5]: Output upper limit ARRAY[6]: Proportional gain (Kp) ARRAY[7]: Integral time (Ti) ARRAY[8]: Derivative time (Td) ARRAY[9]: Control cycle (Ts) ARRAY[10]: Auto–tuning progress ARRAY[11] through ARRAY[29]: are utilized internally by the PID controller. The difference between the F and the P instruction is that the P instruction is only executed at the leading edge scan of the EN trigger.
J Detailed description of the data table for F355_PID ARRAY[0]: Control mode With this you select the type of PID processing and the activation (X = 8) of the auto–tuning. 16#X000: Reverse operation PI–D 16#X001: Forward operation PI–D 16#X002: Reverse operation I–PD 16#X003: Forward operation I–PD
next page
14 – 188
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
Note
The I–PD processing is somewhat more flexible than the PI–D processing 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 measured value (PV) rises (e.g. cooling). Auto–tuning When the most significant bit (MSB) in ARRAY[0] is set to 1, the auto tuning is activated. The optimum values for the PID parameters Kp, Ti, and Td are determined by measuring the responses of the process and are stored in ARRAY[6], ARRAY[7] and in ARRAY[8]. Thereafter the auto tuning is deactivated (MSB in ARRAY[0] is set to 0). Since some operations do not permit auto tuning, the MSB in ARRAY[0] can be reset to 0 during the auto tuning process, thereby stopping the auto tuning. In this case the processing is carried out based on the original parameters. ARRAY[1]: Set value (SP) Here you set the target value that should be reached through the control process. It should fall within the range of the measured value. When using an analogue input, you can use a range between 0 and 4000. ARRAY[2]: Measured value (PV) Here you enter the measured value that you want to be corrected via the operation. An analogue–digital converter is necessary for this. Adjust it so that the range of the measured value corresponds to that of the set value. ARRAY[3]: Output value (MV) The output value (the result of the PID operation) is stored in this data word. When using an analogue output, the range lies between 0 and 4000 or between –2000 and +2000. ARRAY[4]: Output lower limit Here you enter a lower limit of the output value between 0 and 10000. The value must be smaller than the output value’s upper limit.
Matsushita Electric Works (Europe) AG
14 – 189
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
ARRAY[5]: Output upper limit Here you enter a lower limit of the output value between 1 and 10000. The value must be larger than the output value’s lower limit. ARRAY[6]: Proportional gain (Kp) In this data word, you write the parameter Kp. The stored value multiplied by 0.1 corresponds to the actual 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 auto tuning control is activated, this value is automatically adjusted and rewritten. ARRAY[7]: Integral time (Ti) In this data word, you write the parameter Ti. The stored value multiplied by 0.1 corresponds to the actual value of Ti. Values in the range of 1 to 30000 (0.1 to 3000s in 0.1s steps) can be entered. If the auto tuning control is activated, this value is automatically adjusted and rewritten. ARRAY[8]: Derivative time (Td) In this data word, you write the parameter Td. The stored value multiplied by 0.1 corresponds to the actual value of Td. Values in the range of 1 to 10000 (0.1 to 1000s in 0.1s steps) can be entered. If the auto tuning control is activated, this value is automatically adjusted 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.01 corresponds to the actual value of Ts. Values in the range of 1 to 6000 (0.01s to 60.0s in 0.01s steps) can be entered. ARRAY[10]:Auto–tuning progress When auto tuning is selected for the specified control mode (ARRAY[0]), a value from 1 to 5 will be stored indicating the progress of auto tuning. ARRAY[11..29]: PID work area The function F355_PID uses this work area internally to calculate the PID operation.
next page
14 – 190
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Basic and High–level Instructions
J 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 control input 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 value for the PID processing instruction.The measured value (PV) (e.g. current room temperature) is normally transmitted via a sensor and entered as the input value for the PID processor. F355_PID calculates the standard tolerance e from the set value and the measured value (e = set value – measured value). With the parameters given (proportional gain Kp, integral time Ti, ...) a new output value (MV) is calculated in increments set by the control cycle Ts. This result is then applied to the actuator (e.g. a fan that regulates room temperature) after the D/A conversion.The analogue section represents the system’s actuator, e.g. heater and temperature 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 increased 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 settling time and a constant standard tolerance.
Matsushita Electric Works (Europe) AG
14 – 191
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
2. Integral part (I part) An integral part produces an output quantity that corresponds to the time integral and input quantity (area of the input quantity). The integral time thus evaluates the output quantity MVi. The integral part can be a quantity scale of a tank that is filled by a volume flow, for example. Because of the slow reaction time of the integral part, it has a larger maximum overshot than the P component, but no constant 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 the time derivation of the input quantity. The derivative time corresponds to the weighting of the derived input quantity. A derivative component can be an RC–bleeder (capacitor hooked up in series and resistance in parallel), for example.
next page
14 – 192
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set 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 and a D component. When the parameters Kp, Ti and Td are optimally adjusted, a PID controller can quickly control and maintain a quantity at a predetermined set value.
Reference equations for calculating the controller output MV The following equations are used to calculate the controller output MV under the following conditions: In general: The output value at time period n is calculated from the previous output value (n–1) and the change in the output value in this time interval.
Reverse operation PI–D
Matsushita Electric Works (Europe) AG
ARRAY[0] = 16#X000
14 – 193
Matsushita Instruction Set
NAiS Control 1131
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
J Data Types Variable
Data Type
s
ARRAY [0..29] of INT or WORD
J Operands Relay For s
T/C
Register
WX
WY
WR
WL
SV
EV
DT
LD
FL
–
–
x
x
x
x
x
x
x
x: –:
available not available
next page
14 – 194
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set 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 programming languages. Global Variable List
POU Header In the POU header, all input and output variables are declared that are used for programming this function.
In the initialization of the ARRAY Lookup_Table, the upper limit of the controller output is set to 4000. The proportional gain Kp is initially set at 80 (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 element of the Lookup_Table when the variable activeautotuning is set from FALSE to TRUE (i.e. activates the control mode auto tuning in the function F355_PID). The variables Set_Value_SP and Process_Value_PV are assigned to the second and third elements of data table. They receive their values from the A/D converter CH0 and CH1. Because of EN input of 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 stored in 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 PLC to the output of the system.
Matsushita Electric Works (Europe) AG
14 – 195
Matsushita Instruction Set
NAiS Control 1131
Basic and High–level Instructions
LD Body
IL Body
Note
14 – 196
The following error flags apply to F/P355: No.
IEC Address
set
if
R9007
%MX0.900.7
permanently
the parameter settings are outside the allowed range.
R9008
%MX0.900.8
for an instant
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
Matsushita Instruction Set
15 – 2
NAiS Control 1131
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Standard Matsushita Function Blocks
CT_FB 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 function block declare the following: Count:
Reset:
SV: C: EV:
count contact each time a rising edge is detected at Count, the value 1 is subtracted from the elapsed value EV until the value 0 is reached reset contact each time a rising edge is detected at Reset, the value 0 is assigned to EV and the signal output C is reset; each time a falling edge is detected at Reset, the value at SV is assigned to EV set value value of EV after a reset procedure signal output is set when EV becomes 0 elapsed value current counter value
J Data Types Input Variable
Output Variable
Count, Reset, C
BOOL
SV, EV
INT, WORD
J Time Chart
Matsushita Electric Works (Europe) AG
15 – 3
Matsushita Instruction Set
NAiS Control 1131
Standard Matsushita Function Blocks
Notes D In order to work correctly, the CT_FB function block needs to be reset each time before it is used. D The number of available counters is limited and depends on the settings in the system registers 5 and 6. The compiler assigns a NUM* address to every counter instance. The addresses are assigned counting downwards, starting at the highest possible address. D The Matsushita CT function (down counter) uses the same NUM* address area (Num* input). In order to avoid errors (address conflicts), the CT function and the CT_FB function block should not be used together in a project.
Example
CT_FB In the following example the function block CT_FB is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block CT_FB are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under copy_name, and a separate data area is reserved.
This example uses variables. You may also use constants for the input variables.
next page
15 – 4
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Standard Matsushita Function Blocks
LD Body
IL Body If you want to call up the function block in an instruction list, enter the following:
Note It does not matter whether the function names in the IL editor are capitalized or not.
Matsushita Electric Works (Europe) AG
15 – 5
Matsushita Instruction Set
NAiS Control 1131
Standard Matsushita Function Blocks
TM_1ms_FB Outline
This timer for 0.001s units works as an ON–delay timer. If the start contact of the function block is in the ON state, the preset time SV (set value) is started. When this time has elapsed, the timer contact T turns ON. For the TM_1ms_FB function block declare the following: start:
SV: T:
EV:
start contact each time a rising edge is detected, the set value SV is copied to the elapsed value EV and the timer is started set value the defined ON–delay time (0 to 32.767s) timer contact is set when the time defined at SV has elapsed, this means when EV becomes 0 elapsed value count value from which 1 is subtracted every 0.001s while the timer is running
J Data Types Input Variable
Output Variable
BOOL (start)
BOOL (T)
INT, WORD (SV)
INT, WORD (EV)
Notes D The number of available timers is limited and depends on the settings in the system registers 5 and 6. D The Matsushita timer functions (TM_1s, TM_100ms, TM_10ms, and TM_1s) use the same NUM* address area as the Matsushita timer function blocks (TM_1s_FB, TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the timer function blocks the compiler automatically assigns a NUM* address to every timer instance. The addresses are assigned counting downwards, starting at the highest possible address. In order to avoid errors (address conflicts), these timer functions and function blocks should not be used together in a project.
next page 15 – 6
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Standard Matsushita Function Blocks
J Time Chart start
ON OFF X
SV
0 X 0
EV T
ON OFF
download PROG mode
Example
RUN mode
TM_1ms_FB In the following example the function block TM_1ms_FB is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block TM_1ms_FB are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under Alarm_Control, and a separate data area is reserved.
This example uses variables. You may also use constants for the input variables.
Matsushita Electric Works (Europe) AG
15 – 7
Matsushita Instruction Set
NAiS Control 1131
Standard Matsushita Function Blocks
LD Body
IL Body If you want to call up the function block in an instruction list, enter the following:
Note It does not matter whether the function names in the IL editor are capitalized or not. 15 – 8
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Standard Matsushita Function Blocks
TM_10ms_FB Outline
This timer for 0.01s units works as an ON–delay timer. If the start contact of the function block is in the ON state, the preset time SV (set value) is started. When this time has elapsed, the timer contact T turns ON. For the TM_10ms_FB function block declare the following: start:
SV: T:
EV:
start contact each time a rising edge is detected, the set value SV is copied to the elapsed value EV and the timer is started set value the defined ON–delay time (0 to 327.67s) timer contact is set when the time defined at SV has elapsed, this means when EV becomes 0 elapsed value count value from which 1 is subtracted every 0.01s while the timer is running
J Data Types Input Variable
Output Variable
BOOL (start)
BOOL (T)
INT, WORD (SV)
INT, WORD (EV)
Notes D The number of available timers is limited and depends on the settings in the system registers 5 and 6. D The Matsushita timer functions (TM_1s, TM_100ms, TM_10ms, and TM_1s) use the same NUM* address area as the Matsushita timer function blocks (TM_1s_FB, TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the timer function blocks the compiler automatically assigns a NUM* address to every timer instance. The addresses are assigned counting downwards, starting at the highest possible address. In order to avoid errors (address conflicts), these timer functions and function blocks should not be used together in a project.
Matsushita Electric Works (Europe) AG
15 – 9
Matsushita Instruction Set
NAiS Control 1131
Standard Matsushita Function Blocks
J Time Chart: start
ON OFF X
SV
0 X 0
EV T
ON OFF
download PROG mode
Example
RUN mode
TM_10ms_FB In the following example the function block TM_10ms_FB is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block TM_10ms_FB are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under Alarm_Control, and a separate data area is reserved.
This example uses variables. You may also use constants for the input variables.
next page
15 – 10
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Standard Matsushita Function Blocks
LD Body
IL Body If you want to call up the function block in an instruction list, enter the following:
Note It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
15 – 11
Matsushita Instruction Set
NAiS Control 1131
Standard Matsushita Function Blocks
TM_100ms_FB Outline
This timer for 0.1s units works as an ON–delay timer. If the start contact of the function block is in the ON state, the preset time SV (set value) is started. When this time has elapsed, the timer contact T turns ON. For the TM_100ms_FB function block declare the following: start:
SV: T:
EV:
start contact each time a rising edge is detected, the set value SV is copied to the elapsed value EV and the timer is started set value the defined ON–delay time (0 to 3276.7s) timer contact is set when the time defined at SV has elapsed, this means when EV becomes 0 elapsed value count value from which 1 is subtracted every 0.1s while the timer is running
J Data Types Input Variable
Output Variable
BOOL (start)
BOOL (T)
INT, WORD (SV)
INT, WORD (EV)
Notes D The number of available timers is limited and depends on the settings in the system registers 5 and 6. D The Matsushita timer functions (TM_1s, TM_100ms, TM_10ms, and TM_1s) use the same NUM* address area as the Matsushita timer function blocks (TM_1s_FB, TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the timer function blocks the compiler automatically assigns a NUM* address to every timer instance. The addresses are assigned counting downwards, starting at the highest possible address. In order to avoid errors (address conflicts), these timer functions and function blocks should not be used together in a project.
next page
15 – 12
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Standard Matsushita Function Blocks
J Time Chart: start
ON OFF X
SV
0 X 0
EV T
ON OFF
download PROG mode
Example
RUN mode
TM_100ms_FB In the following example the function block TM_100ms_FB is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block TM_100ms_FB are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under Alarm_Control, and a separate data area is reserved.
This example uses variables. You may also use constants for the input variables.
Matsushita Electric Works (Europe) AG
15 – 13
Matsushita Instruction Set
NAiS Control 1131
Standard Matsushita Function Blocks
LD Body
IL Body If you want to call up the function block in an instruction list, enter the following:
Note It does not matter whether the function names in the IL editor are capitalized or not. 15 – 14
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Standard Matsushita Function Blocks
TM_1s_FB Outline
This timer for 1s units works as an ON–delay timer. If the start contact of the function block is in the ON state, the preset time SV (set value) is started. When this time has elapsed, the timer contact T turns ON. For the TM_1s_FB function block declare the following: start:
SV: T:
EV:
start contact each time a rising edge is detected, the set value SV is copied to the elapsed value EV and the timer is started set value the defined ON–delay time (0 to 32767s) timer contact is set when the time defined at SV has elapsed, this means when EV becomes 0 elapsed value count value from which 1 is subtracted every 1s while the timer is running
J Data Types Input Variable
Output Variable
BOOL (start)
BOOL (T)
INT, WORD (EV)
INT, WORD (EV)
Notes D The number of available timers is limited and depends on the settings in the system registers 5 and 6. D The Matsushita timer functions (TM_1s, TM_100ms, TM_10ms, and TM_1s) use the same NUM* address area as the Matsushita timer function blocks (TM_1s_FB, TM_100ms_FB, TM_10ms_FB, and TM_1s_FB). For the timer function blocks the compiler automatically assigns a NUM* address to every timer instance. The addresses are assigned counting downwards, starting at the highest possible address. In order to avoid errors (address conflicts), these timer functions and function blocks should not be used together in a project.
Matsushita Electric Works (Europe) AG
15 – 15
Matsushita Instruction Set
NAiS Control 1131
Standard Matsushita Function Blocks
J Time Chart: start
ON OFF X
SV
0 X 0
EV T
ON OFF
download PROG mode
Example
RUN mode
TM_1s_FB In the following example the function block TM_1s_FB is programmed in ladder diagram (LD) and instruction list (IL). The same POU header is used for both programming languages. POU Header All input and output variables which are used for programming the function block TM_1s_FB are declared in the POU header. This also includes the function block (FB) itself. By declaring the FB you create a copy of the original FB. This copy is saved under Alarm_Control, and a separate data area is reserved.
This example uses variables. You may also use constants for the input variables.
next page
15 – 16
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Matsushita Instruction Set Standard Matsushita Function Blocks
LD Body
IL Body If you want to call up the function block in an instruction list, enter the following:
Note It does not matter whether the function names in the IL editor are capitalized or not. Matsushita Electric Works (Europe) AG
15 – 17
Matsushita Instruction Set
15 – 18
NAiS Control 1131
Matsushita Electric Works (Europe) AG
Appendix A High–Speed Counter, Pulse and PWM Output A.1
A.2
A.3
A.4
A.5
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
Specifications and Restricted Items . . . . . . . . . A – 5 A.2.1
Specifications . . . . . . . . . . . . . . . . . . . . . A – 5
A.2.2
Functions and Restrictions . . . . . . . . . A – 7
High–Speed Counter Function . . . . . . . . . . . . . . A – 9 A.3.1
Types of Input Modes . . . . . . . . . . . . . . A – 9
A.3.2
I/O Allocation . . . . . . . . . . . . . . . . . . . . A – 11
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
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
Appendix A
A–2
NAiS Control 1131
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
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.1
A.1
High–Speed Counter, Pulse and PWM Output
High–Speed Counter, Pulse and PWM Output
There are three functions available when using the high–speed counter built into the FP0 programmable controller. There are four channels for the built–in high–speed counter. The channel number allocated for the high–speed counter will change depending on the function being used. The counting range is: K–8388608 to K8388607 (HFF8000 to H7FFFFF), coded 24–bit binary.
A.1.1
High–speed counter function
The high–speed counter function counts external inputs such as those from sensors or encoders. When the count reaches the target value, this function turns the desired output ON and OFF. Roller
Cutter
Wire Motor Encoder
Inverter START STOP signal
Encoder output is input to the high– speed counter
A.1.2
FP0
Cutter blade control signal
Pulse output function
Combined with a commercially available motor, the pulse output function enables positioning control. With the appropriate instruction, you can perform trapezoidal control, origin return, and JOG operation. Motor
FP0
Pulse output Y0 Y2
CW/CCW
Motor driver 1
Pulse output Y1 CW/CCW Y3
Motor driver 2 Motor
Matsushita Electric Works (Europe) AG
A–3
Appendix A
NAiS Control 1131
A.1 Outline of Functions
A.1.3
PWM output function
By using the appropriate instruction, the PWM output function enables a pulse output of the desired duty ratio. When you increase the pulse width...
When you decrease it...
heating increases.
heating decreases.
A–4
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.2
A.2
A.2.1
Specifications and Restricted Items
Specifications and Restricted Items
Specifications High–Speed Counter
Input/output contact number being used
ON/OFF output
Specify the desired output from Y0 to Y7
Specify the desired output from Y0 to Y7
Count mode
Incremental input Decremental input
2–phase input Incremental/ decremental input Directional distinction
+ Note
Input contact number (value in parenthesis is reset input)
Memory area used Built–in high– speed counter Control Elapsed value channel flag area no.
Target value area
DT9044 to DT9045
DT9046 to DT9047
X0 (X2)
CH0
X1 (X2)
CH1
R903B
X3 (X5)
CH2
R903C
DT9104 DT9106 to to DT9105 DT9107
R903A
Performance specifications
Minimum input pulse width
50 ms DT9048 DT9050 <10 kHz> to to DT9049 DT9051
Related Maximum instructions counting speed
Total of 4 CH with max. 10 kHz
100 ms <5 kHz>
X4 (X5)
CH3
R903D
DT9108 DT9110 to to DT9109 DT9111
X0 X1 (X2)
CH0
R903A
DT9044 DT9046 50 ms to to <10 kHz> DT9045 DT9047
X3 X4 (X5)
CH2
R903C
DT9104 DT9106 to to DT9105 DT9107
F0(MV) F1(DMV) F166(HC1S) F167(HC1R)
100ms <5 kHz>
Total of 2 CH with max. 2 kHz
Reset input X2 can be set to either CH0 or CH1. Reset input X5 can be set to either CH2 or CH3.
* next page
Matsushita Electric Works (Europe) AG
A–5
Appendix A A.2
NAiS Control 1131
Specifications and Restricted Items
Pulse Output Input/output contact number being used Pulse Directional output output
Home input
Home proximity input
Built–in Memory area used high– speed counter Control Elapsed Target value value channel flag area area no.
Y0
Y2
X0
DT9052
CH0
R903A
Y1
Y3
X1
DT9052
CH1
R903B
+ Note
Performance specifications for maximum output frequency
Related instructions
DT9044 DT9046 Max. to to 10 kHz for DT9045 DT9047 1–point output DT9048 DT9050 Max. 5 kHz for 2–point to to DT9049 DT9051 output
F0(MV) F1(DMV) F168(SPD1) F169(PLS)
The maximum 1–point output for instruction F168 (SPD1) is 9.5 kHz.
PWM Output Built–in high–speed counter channel no.
Memory area used
Y0
CH0
R903A
Y1
CH1
R903B
Output number being used
A–6
Control flag
Performance specifications for output frequency Frequency: 0.15 Hz to 38 Hz Duty: 0.1 % to 99.9 %
Related instructions
F0(MV) F1(DMV) F170(PWM)
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.2
A.2.2
Specifications and Restricted Items
Functions and Restrictions
The same channel cannot be used by more than one function, e.g. CH0 cannot be shared 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: D When using CH0 for 2–phase inputting with the high–speed counter function, you cannot allot X0 and X1 to normal inputs. D When using Y0 for the pulse output function, you cannot allot origin input X0 to a normal input. D When using Y0 for the pulse output (with directional output operating) function, you cannot allot Y2 (directional output) to a normal input or output. When using the high–speed counter with a mode that does not use the reset input, you can allot the inputs listed in parenthesis in the specifications table to a normal input.
,
Example: When using the high–speed counter with no reset input and 2–phase input, you can allot X2 to a normal input.
When any of the instructions related to the high–speed counter (F166 to F170) are executed, the control flag (special internal relay: R903A to R903D) corresponding to the used channel turns ON. When the flag for a channel turns ON, another instruction cannot be executed using that same channel. For example, while executing F166 (target value match ON instruction) and flag R903A is in the ON state, F167 (target value match OFF instruction) CANNOT be executed with CH0. The counting speed when using the high–speed counter function will differ depending on the counting mode as shown in the table. Therefore, the following restrictions apply: D While in the incremental input mode and using the two channels CH0 and CH1, if CH0 is being used at 8 kHz, then CH1 can be used up to 2 kHz. D While in the 2–phase input mode and using the two channels CH0 and CH2, if CH0 is being used at 1 kHz, then CH2 can be used up to 1 kHz.
* next page
Matsushita Electric Works (Europe) AG
A–7
Appendix A A.2
NAiS Control 1131
Specifications and Restricted Items
The maximum output frequency when using the pulse output function will differ depending on the output contact number as shown in the table: D When using either only Y0 or only Y1, the maximum output frequency is 10 kHz. D When using the two contacts Y0 and Y1, the maximum output frequency is 5 kHz. When using the high–speed counter function and pulse output function, specifications will differ depending on the conditions of use.
,
Example: When using one pulse output contact with a maximum output frequency of 5 kHz, the maximum counting speed of the high–speed counter being used simultaneously is 5 kHz with the incremental mode and 1 kHz with the 2–phase mode.
A–8
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.3
A.3
High–Speed Counter Function
High–Speed Counter Function D The high–speed counter function counts the input signals, and when the count reaches the target value, turns ON and OFF the desired output. D The high–speed counter function is able to count high–speed pulses of frequencies up to 10 kHz. D To turn ON an output when the target value is matched, use the target value match ON instruction F166. To turn OFF an output, use the target value match OFF instruction F167. D Preset the output to be turned ON and OFF with the SET/RET instruction.
In order to use the high–speed counter function, it is necessary to set system registers No. 400 and No. 401.
A.3.1
Types of Input Modes
Incremental input mode: ON OFF
X0 Count 0
1
2
3
4
n–3
n–2
n–1
n
Decremental input mode: ON OFF
X0 Count n
n–1
n–2
n–3
n–4
3
2
1
0
* next page
Matsushita Electric Works (Europe) AG
A–9
Appendix A A.3
NAiS Control 1131
High–Speed Counter Function
2–phase input mode: (Incremental input: CW) ON OFF
X0
ON OFF
X1 0
Count
1
2
n–1
n
(Decremental input: CCW) X0
ON OFF
X1
ON OFF
Count
n
n–1
n–2
n–3
2
1
Incremental/decremental input mode (separate input mode): X0
ON OFF
X1
ON OFF
Count 0
1
2
3
Increasing
4
3
2
1
2
Decreasing
3
4
Increasing
3 Decreasing
Directional distinction mode: X0
ON OFF
X1
ON OFF
Count 0
1
2
3
Increasing
A – 10
4
3
2
1
0
Decreasing
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.3
A.3.2
High–Speed Counter Function
I/O Allocation
The input allocation, as shown in the table in section A.2.1 , will differ depending on the channel number being used. The output turned ON and OFF can be specified from between Y0 to Y7 as desired with instructions F166 and F167.
,
Example 1: When using CH0 with incremental input and reset input Count input
Reset input
X0
X2
Yn
*
ON and OFF output
* The output turned ON and OFF when values match can be selected from Y0 to Y7.
,
Example 2: When using CH0 with 2–phase input and reset input A phase input B phase input Reset input
X0 X1 X2
Yn
*
ON and OFF output
* The output turned ON and OFF when values match can be selected from Y0 to Y7.
Matsushita Electric Works (Europe) AG
A – 11
Appendix A A.4
NAiS Control 1131
Pulse Output Function
A.4
Pulse Output Function
The pulse function enables positioning control by use in combination with a commercially available pulse–string input type motor driver. It provides trapezoidal control with the instruction F168 for automatically obtaining pulse outputs by specifying the initial speed, maximum speed, acceleration/deceleration time, and target value. The F168 instruction also enables automatic home return. A JOG operation using instruction F169 for pulse output while the predetermined trigger is in the ON state is also possible. When using the pulse output function, set the channels corresponding to system registers 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 Structured Data Type. These variables can be comprised of several kinds of variables (e.g. Word and 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 used in 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 element must be separated from the structure variable name by a period (e.g. Data_table1.Fmax). DUT Pool Motor_Dat_1
Global Variables Data_table1
Init WORD Fmin INT Fmax INT Tdelay INT TargetPuls DINT Termination INT
POU Type: Motor_Dat_1 Init WORD Fmin INT Fmax INT Tdelay INT TargetPuls DINT Termination INT
POU Header (local variables) VAR_EXTERNAL Data_table1 VAR_EXTERNAL Data_table2 POU Body
LD 4000 Data_table2
Type: Motor_Dat_1 Init WORD Fmin INT Fmax INT Tdelay INT TargetPuls DINT Termination INT
A – 12
ST Data_table1.Fmax
LD 4500 ST Data_table2.Fmax
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.4
A.4.2
Pulse Output Function
Positioning Function F168
This example illustrates normal positioning with an acceleration and a deceleration ramp. 5000Hz
10000 pulses
500Hz 0Hz
ÏÏÏÏÏÏÏÏÏ ÏÏÏÏÏÏÏÏÏ
200msec Start_X3 %MX0.903.10
200msec
no effect
positioning active
(R903A)
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 times are 200ms each. The movement amount is 10000 pulses.
+ Notes
D For trapezoidal control the initial and final speeds may not be greater than 5000Hz. D The sum of maximum frequencies of all axes must not exceed 10000Hz.
Matsushita Electric Works (Europe) AG
A – 13
Appendix A A.4
NAiS Control 1131
Pulse Output Function
A.4.3
Pulse Output Function F169
The following example shows this process in a positive direction. The mode (of operation) 16#0112 sets the following conditions: D The duty ratio is 10% pulse and 90% pause D Incremental counting D Directional output %QX0.2 (Y2) to ”0”. A frequency of 300Hz is output via the input Start_X2. During frequency output, the count 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 (of operation) 16#0113 sets the following conditions: D The duty ratio is 10% pulse and 90% pause D Decremental counting D Directional output %QX0.2 (Y2) to ”1”. A frequency of 700Hz is output via the input Start_X6. During frequency output, the count 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.
A – 14
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.4
A.4.4
Pulse Output Function
High–Speed Counter Control Instruction F0_MV
The function F0_MV is used for two different tasks. F0_MV is known as a MOVE function that copies values and memory contents. In addition, F0_MV is used to control the high–speed counter (e.g. for positioning a stepping motor). In this respect, F0_MV offers the following functionality: D This instruction is used for resetting the built–in high–speed counter, stopping the pulse outputs, and setting and resetting the home proximity input. D Specify this instruction together with special data register %MW0.905.2 (DT9052) or %MW0.9005.2 with the FP0–T32CP. D Once this instruction is executed, the settings will be retained until this 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 the high–speed counter special register (%MW0.905.2 (DT9052) or %MW0.9005.2 with the FP0–T32CP). ”0” is entered just after that to perform the preset operations.
* next page Matsushita Electric Works (Europe) AG
A – 15
Appendix A A.4
,
NAiS Control 1131
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:
A – 16
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.5
A.5
Sample Program for Positioning Control
Sample Program for Positioning Control
Wiring example FP0 Input terminal Home sensor
X0
Positioning start
X1
Positioning start
X2
Home return start
X3
Home proximity sensor Forward JOG start
X4
Reverse JOG start
X6
Overrun
X7
X5
a contact
COM
b contact a contact Moving table (–)
Stepping motor
b contact
ÎÎÎÎÎÎÎÎÎÎÎ ÎÎÎÎÎÎÎÎÎÎÎ (+)
Stepping motor driver Output terminal Pulse output
COM Pulse input
Y0
COM Directional output
Directional input
Y2
+ – 24V DC power supply
Matsushita Electric Works (Europe) AG
A – 17
Appendix A A.5
NAiS Control 1131
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.
5000Hz
ÎÎÎÎÎÎÎÎÎÎÎÎ ÎÎÎÎÎÎÎÎÎÎÎÎ 10000 pulses
Motor
(– side)
(+ side)
10000 pulses 500 Hz 0Hz 200msec
A – 18
200msec
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.5
A.5.2
Sample Program for Positioning Control
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.
6000Hz
ÎÎÎÎÎÎÎÎÎÎÎÎ 8000 pulses
Motor
(– side)
(+ side)
8000 pulses 1000Hz 0Hz 300msec
Matsushita Electric Works (Europe) AG
300msec
A – 19
Appendix A A.5
NAiS Control 1131
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 absolute positioning, the directional output is controlled. The mode of operation 16#112 sets the directional output to ”1” when moving backward, and to ”0” when moving forward.
(– side)
(+ side)
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
4000Hz
Motor
(10,000)
22,000
(30,000)
200Hz 0Hz 250msec
A – 20
250msec
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.5
A.5.4
Sample Program for Positioning Control
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 the stepping motor runs at starting speed until the home sensor is activated. Then the pulse output 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 elapsed value (Addr. %MW0.904.4 and %MW0.904.5 (DT9044 and DT9045) or %MW0.9004.4 and %MW0.9004.5 with the FP0–T32CP) is set to 0.
ÎÎÎÎÎÎÎÎÎÎÎÎ ÎÎÎÎÎÎÎÎÎÎÎÎ (– side)
(+ side)
Motor
Home_X0
Start_X3
Homeprox_X4
Home_X0
2000Hz
100Hz 0Hz
Homeprox_X4 150msec
Matsushita Electric Works (Europe) AG
150msec
A – 21
Appendix A A.5
NAiS Control 1131
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 the stepping motor runs at starting speed until the home sensor is activated. Finally the pulse 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 elapsed value (Addr. %MW0.904.4 and %MW0.904.5 (DT9044 and DT9045) or %MW0.9004.4 and %MW0.9004.5 with the FP0–T32CP) is set to 0.
ÎÎÎÎÎÎÎÎÎÎÎÎ ÎÎÎÎÎÎÎÎÎÎÎÎ (– side)
Motor
Homeprox_X4
A – 22
Start_X3
Homeprox_X4
Home_X0
(+ side)
Home_X0
2500Hz
120Hz 0Hz 100msec
100msec
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Appendix A A.5
A.5.6
Sample Program for Positioning Control
JOG Operation (Plus Direction)
The input Start_X5 starts the pulse output. The directional output %QX0.2 (Y2) is not controlled using this mode of operation (16#112).
(– side)
(+ side)
ÎÎÎÎÎÎÎÎÎÎÎÎ
Start_X5
1 0
Motor
Matsushita Electric Works (Europe) AG
%QX0.0(X0)
Pulses
A – 23
Appendix A A.5
NAiS Control 1131
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 set using this mode of operation (16#122).
(– side)
(+ side)
ÎÎÎÎÎÎÎÎÎÎÎÎ
Start_X6
1 0
Motor
A.5.8
%QX0.0(X0)
Pulses
Emergency Stop
With a falling edge at the input, the pulse output is stopped. A break circuit has to be used as a protective circuit for this program. By using a break circuit, the emergency stop function is made fail–safe.
A – 24
Matsushita Electric Works (Europe) AG
Appendix B Glossary
Glossary
B–2
NAiS Control 1131
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Action Assignment An action combines one sequence (created with the SFC–editor) with parts of the logic which are executed when a specific step is active. An action contains parts of the over–all logic. An action can be assigned to multiple steps and can be coded in FBD, LD or IL. Body A POU consists of a header and a body. The body contains the PLC program. Data Type Each variable is assigned a data type that determines its bit length. There are elementary (e.g. BOOL, WORD) and user–defined (e.g. ARRAY) data types. Data Unit Type A Data Unit Type (DUT) is a group of variables composed of several elementary data types. Such groups are used when data tables are edited. Declaration is the definition of Variables for global or local use. EN (Enable) Input/ENO (Enable Out) Output Many function blocks have an input and output variable of the data type BOOL in addition to the other input and output variables. The status of the ENO output always reflects the current status of the EN input. F Instructions are common Matsushita instructions. The P instructions function exactly the same way as the F instructions with the exception that they are only executed when a leading edge is detected. Function Functions are used within the definition of the user logic whenever a routine is needed, which, when executed, yields exactly one result. Since Functions do not access any internal memory, every invocation of one Function with identical
Matsushita Electric Works (Europe) AG
Glossary
input parameters always results in an identical value, the Function result. As soon as a Function has been declared it can be accessed from any other Program Organization Unit of the User Logic. Function Block Function Blocks define both the algorithm as well as the data declaration of a part of the User Logic. Due to this definition the logic can be considered a class. Not the Function Block itself is invoked but several instances of this Function Block can be created, which can then be used separately. Each instance possesses its own copy of the data declaration memory, which provides the necessary data information for executing the Function Block functionality. The private data declaration memory of a Function Block Instance persists from one invocation of this instance to the next one. This internal memory allows the implementation of incremental functionality by using Function Blocks. As a consequence several invocations of one Function Block Instance with the same input variables will not necessarily yield the same results. In comparison with Functions, Function Blocks allow you to define not only one but a set of output variables representing the Function Block results. Substances of Function Blocks can be declared locally, for use within one POU. Declaring the instance of a Function Block within a POU defines the scope of this instance at the same time.
B–3
Glossary
Function Block Diagram FBD is a graphical language for programming connective logic. The individual Program Organization Unit Variables are connected with the inputs and outputs of function boxes. The connection represents a data flow between variables and inputs/outputs of function boxes. A Function Block Diagram program is internally structured via Networks. A Function Block Diagram network is defined by a connected graph of function boxes. Function Block Instance An object of the Function Block class possesses its own copy of the Function Block’s data declaration memory. This private data area is linked to the Function Block algorithm for this particular instance. Global Variables Global variables have physical addresses. They apply to the entire project and can be copied into the POU headers as VAR_EXTERNAL. The Global Variable List is found in the Project Navigator. Header A Program Organization Unit (POU) consists of a header and a body. In the header all variables used in the POU are listed and defined. Identifier is the symbolic name of a variable. Input Variable Input variables provide a function block/function with values with which calculations are carried out. Instruction List IL is a low level textual language which provides the capabilities for effective PLC programming. It is based on individual instructions which define one operation per instruction. Besides the Variables listed explicitly as arguments for an operation the actual value of the B–4
NAiS Control 1131
accumulator is used as an additional implicit argument. The result of an operation is also stored here after the execution of the appropriate instruction, thus providing a link between a preceeding instruction and one afterwards. An Instruction List program is internally structured as an assembly of Networks. Ladder Diagram LD is a graphical language for programming connective logic. Similar to the Function Block Diagram capabilities, the individual Program Organization Unit Variables are connected with the inputs and outputs of function boxes. In addition, Boolean connections can be drawn by using coils and contacts. This connection represents a Boolean signal flow. A Ladder Diagram program is internally structued via Networks. A Ladder Diagram network is defined by a connected graph of functions boxes linked with the lefthand power rail. Local Variables Local variables only apply to the POU in whose header they have been declared. Logic The complete PLC program defined by the user for solving the automation problem. The user logic is structured via Program Organization Units. Network A network belongs to a POU body and contains the logic (program). Output Variable Functions and function blocks write their results in output variables. P Instructions F instructions. POU Pool The POU Pool is located in the Project Navigator and contains all POUs that are part of the project. Matsushita Electric Works (Europe) AG
NAiS Control 1131
Program is similar to a Function Block with one implicit Function Block Instance. The differences between Programs and Function Blocks are: • Programs are only allowed on top of a Program Organization Unit invocation hierarchy (i.e. a program may not be invoked from another Program Organization Unit) • Directly represented Variables can be used for defining a Program Program Organization Unit (POU) Program Organization Units are used for structuring the complete user logic. Individual Units may invoke other ones, however a recursive POU structure is not allowed. Program Organization Units are either defined as standard by default or user specific due to the specific automation problem to be solved by the User Logic. NAiSControl differentiates between the Program Organization Unit Header (which contains the Declaration part of the Program Organization Unit) and the Program Organization Unit Body (which contains the Program Organization Unit’s algorithm). Due to different requirements for the solution of a sub–problem, different typs of POUs are provided. The different Program Organization Unit types are Functions, Function Blocks and Programs. Project The project represents the top level of the hierarchy in NAiS Control. It contains the entire task for the controller.
Matsushita Electric Works (Europe) AG
Glossary
Sequential Function Chart SFC consists of the basic elements steps and transitions. While steps represent a specific state during the execution of a POU, a transition allows the definition of the conditions for changing from one state to the next state. Using either parallel or alternative branches you can complement several types of SFC sequences. Specific connective logic program code can be associated to the steps via actions by using the appropriate languages Function Block Diagram, Ladder Diagram and Instruction List. Task defines the moment (and other execution parameters) of program execution. A POU of type program contains the logic, i.e., it defines what has to be done. The association of a program to a task defines the moment of the logic’s execution. Variable enables the association of a specifier to a specific memory area. Due to different requirements, data can be of different types. Variables can be either global, for use within the entire user program, or local, being restricted to the POU in which it has been defined.
B–5
Glossary
B–6
NAiS Control 1131
Matsushita 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
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
COS
4– 23
COS
4– 26
CT
14 – 8
CT_FB
15 – 2
CTD
12 – 6
CTU
12 – 2
CTUD
12– 11
D DF DFN
DINT_TO_TIME
14 – 9 14 – 10
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
DINT_TO_BCD
2– 38
F16 (DXCH)
14 – 42
DINT_TO_BOOL
2– 25
F17 (SWAP)
14 – 43
DINT_TO_DWORD
2– 33
F20 (ADD)
14 – 44
DINT_TO_INT
2– 27
F21 (DADD)
14 – 45
DINT_TO_REAL
2– 35
F22 (ADD2)
14 – 46
Matsushita Electric Works (Europe) AG
I–1
Alphabetical Index of All Instructions
NAiS Control 1131
F23 (DADD2)
14 – 47
F68 (XNR)
14 – 84
F25 (SUB)
14 – 48
F70 (BCC)
14 – 85
F26 (DSUB)
14 – 49
F71 (HEX2A)
14 – 86
F27 (SUB2)
14 – 50
F72 (A2HEX)
14 – 87
F28 (DSUB2)
14 – 51
F73 (BCD2A)
14 – 88
F30 (MUL)
14 – 52
F74 (A2BCD)
14 – 89
F31 (DMUL)
14 – 53
F75 (BIN2A)
14 – 91
F32 (DIV)
14 – 54
F76 (A2BIN)
14 – 92
F33 (DDIV)
14 – 55
F77 (DBIN2A)
14 – 93
F35 (INC)
14 – 56
F78 (DA2BIN)
14 – 94
F36 (DINC)
14 – 57
F80 (BCD)
14 – 95
F37 (DEC)
14 – 58
F81 (BIN)
14 – 96
F38 (DDEC)
14 – 59
F82 (BCD)
14 – 97
F40 (BADD)
14 – 60
F83 (DBIN)
14 – 98
F41 (DBADD)
14 – 61
F84 (INV)
14 – 99
F42 (BADD2)
14 – 62
F85 (NEG)
14 – 100
F43 (DBADD2)
14 – 63
F86 (DNEG)
14 – 101
F45 (BSUB)
14 – 64
F87 (ABS)
14 – 102
F46 (DBSUB)
14 – 65
F88 (DABS)
14 – 103
F47 (BSUB2)
14 – 66
F89 (EXT)
14 – 104
F48 (DBSUB2)
14 – 67
F90 (DECO)
14 – 105
F50 (BMUL)
14 – 68
F91 (SEGT)
14 – 107
F51 (DBMUL)
14 – 69
F92 (ENCO)
14 – 109
F52 (BDIV)
14 – 70
F93 (UNIT)
14 – 110
F53 (DBIV)
14 – 71
F94 (DIST)
14 – 112
F55 (BINC)
14 – 72
F95 (ASC)
14 – 115
F56 (DBINC)
14 – 73
F96 (SRC)
14 – 116
F57 (BDEC)
14 – 74
F100 (SHR)
14 – 117
F58 (DBDEC)
14 – 75
F101 (SHL)
14 – 118
F60 (CMP)
14 – 76
F105 (BSR)
14 – 119
F61 (DCMP)
14 – 77
F106 (BSL)
14 – 120
F62 (WIN)
14 – 78
F110 (WSHR)
14 – 121
F63 (DWIN)
14 – 79
F111 (WSHL)
14 – 122
F64 (BCMP)
14 – 80
F112 (WBSR)
14 – 123
F66 (WOR)
14 – 82
F113 (WBSL)
14 – 124
F67 (XOR)
14 – 83
F118 (UCD)
14 – 125
F65 (WAN)
14 – 81
F119 (LRSR)
14 – 126
I–2
Matsushita Electric Works (Europe) AG
NAiS Control 1131
Alphabetical Index of All Instructions
F120 (ROR)
14 – 128
F337 (RAD)
14 – 183
F121 (ROL)
14 – 129
F338 (DEG)
14 – 185
F122 (RCR)
14 – 130
F355 (PID)
14 – 187
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
ICTL
F138 (HMSS)
14 – 139
INT_TO_BCD
2– 23
F139 (SHMS)
14 – 140
INT_TO_BOOL
2– 11
F140 (STC)
14 – 141
INT_TO_DINT
2– 13
F141 (CLC)
14 – 142
INT_TO_DWORD
2– 17
F143 (IORF)
14 – 143
INT_TO_REAL
2– 19
F144 (TRNS)
14 – 144
INT_TO_TIME
2– 21
F147 (PR)
14 – 146
INT_TO_WORD
2– 15
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
Matsushita Electric Works (Europe) AG
G GE
9–4
GT
9–2
I 14 – 11
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
I–3
Alphabetical Index of All Instructions
NAiS Control 1131
M MAX
8–2
MC
14 – 18
MCE
14 – 19
SQRT
4– 14
SR
10 – 2
SUB
4–6
SUB_TIME
5–4
MIN
8–4
MOD
4– 12
MOVE
4–2
TAN
4– 29
MUL
4–8
TIME_TO_DINT
2– 65
MUL_TIME_DINT
5–8
TIME_TO_DWORD
2– 69
MUL_TIME_INT
5–6
TIME_TO_INT
2– 63
MUL_TIME_REAL
5– 10
TIME_TO_REAL
2– 83
MUX
8–8
TIME_TO_WORD
2– 67
N NE
9 – 12
NOT
7–8
T
TM_100ms
14 – 24
TM_100ms_FB
15 – 11
TM_10ms
14 – 22
TM_10ms_FB TM_1ms
O OR
TM_1ms_FB 7–4
P P13 (EPWT)
14 – 38
R
15 – 8 14 – 20 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
R_TRIG
11 – 2
REAL_TO_DINT
2– 62
REAL_TO_INT
2– 59
REAL_TO_TIME
2– 81
WORD_TO_BOOL
2– 39
ROL
6–8
WORD_TO_DINT
2– 44
ROR
6– 11
WORD_TO_DWORD
2– 43
WORD_TO_INT
2– 41
WORD_TO_TIME
2– 47
RS
10 – 6
W
S SHL
6–2
SHR
6–5
SIN
4– 17
I–4
X XOR 7– 8
Matsushita Electric Works (Europe) AG
Record of Changes Manual No.
Date
ACG–M0130END V1.0
June 1998
First edition
Description of Changes
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 memory P13 (EPWT), EEPROM write to memory F327 (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 down F334 (FRINT), Rounding the first decimal point off F335 (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.
GLOBAL NETWORK
North America Aromat Corporation
Europe Matsushita Electric Works Group
Asia Pacific Matsushita Electric Works (Asia Pacific)
China Matsushita Electric Works
Japan Matsushita Electric Works Ltd. Automation Controls Group
Europe H Austria
Matsushita Electric Works Austria GmbH
H Benelux
Matsushita Electric Works Benelux B. V.
H France
Matsushita Electric Works France S.A.R.L.
Stojanstraße 12, 2344 Maria Enzersdorf, Austria, Tel. (02236) 2 68 46, Fax (02236) 46133, http://www.matsushita.at De Rijn 4, (Postbus 211), 5684 PJ Best, (5680 AE Best), Netherlands, Tel. (0499) 37 2727, Fax (0499) 372185, http://www.matsushita.nl 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
H Germany
Matsushita Electric Works Deutschland GmbH Rudolf–Diesel–Ring 2, 83607 Holzkirchen, Germany, Tel. (08024) 648–0, Fax (08024) 648–555, http://www.matsushita.de
H Ireland
Matsushita Electric Works Ltd., Irish Branch Office Waverley, Old Naas Road, Bluebell, Dublin 12, Republic of Ireland, Tel. (01) 460 09 69, Fax (01) 460 11 31
H Italy
Matsushita Electric Works Italia s.r.l.
H Portugal
Matsushita Electric Works Portugal, Portuguese Branch Office
H Scandinavia
Matsushita Electric Works Scandinavia AB
H Spain
Matsushita Electric Works España S.A.
H Switzerland
Matsushita Electric Works Schweiz AG
H United Kingdom
Matsushita Electric Works UK Ltd.
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 Avda 25 de Abril, Edificio Alvorada 5º E, 2750 Cascais, Portugal, Tel. (351) 1482 82 66, Fax (351) 1482 74 21 Sjöä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 Parque Empresarial Barajas, San Severo, 20, 28042 Madrid, Spain, Tel. (91) 329 38 75, Fax (91) 329 29 76 Grundstrasse 8, 6343 Rotkreuz, Switzerland, Tel. (041) 799 70 50, Fax (041) 799 70 55, http://www.matsushita.ch Sunrise Parkway, Linford Wood East, Milton Keynes, MK14 6LF, England, Tel. (01908) 231 555, Fax (01908) 231 599, http://www.matsushita.co.uk
North & South America H USA
Aromat Corporation Head Office USA 629 Central Avenue, New Providence, N.J. 07974, USA, Tel. 1–908–464–3550, Fax 1–908–464–8513, http://www.aromat.com
Asia H China
Matsushita Electric Works, Ltd. China Office
H Hong Kong
Matsushita Electric Works Ltd. Hong Kong
2013, Beijing Fortune, Building 5, Dong San Huan Bei Lu, Chaoyang District, Beijing, China, Tel. 86–10–6590–8646, Fax 86–10–6590–8647 Rm1601, 16/F, Tower 2, The Gateway, 25 Canton Road, Tsimshatsui, Kowloon, Hong Kong, Tel. (852) 2956–3118, Fax (852) 2956–0398
H Japan
Matsushita Electric Works Ltd. Automation Controls Group 1048 Kadoma, Kadoma–shi, Osaka 571–8686, Japan, Tel. 06–6908–1050, Fax 06–6908–5781, http://www.mew.co.jp/e–acg/
H 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
COPYRIGHT E
2000 All Rights Reserved
Specifications are subject to change without notice.
ARCT1F0000ABC V1.x 12/99 Printed in Europe