Nv Series v Series Programming Instructions (LD FBD SFC ST)

764
6F8C1226 Programming Instructions (LD/FBD/SFC/ST) Unified Controller nv Series Integrated Controller v series

description

NV series manual

Transcript of Nv Series v Series Programming Instructions (LD FBD SFC ST)

6F8C1226Programming Instructions (LD/FBD/SFC/ST)Unied Controllernv SeriesIntegrated Controllervseries1226.3.1009 Programming Instructions (LD/FBD/SFC/ST)Uni

ed Controller nv series &Integrated Controller V seriesUnied Controller nv series & Integrated Controller V seriesProgramming Instructions (LD/FBD/SFC/ST)September 30, 2010 Toshiba Corporation 2010 All Right Reserved.No part of this document may be reproducedwithout the prior written consent of Toshiba.Transmission Distribution & Industrial Systems CompanyMicroelectronics & System Components Department - System Components Support Group1, Toshiba-Cho, Fuchu-Shi, Tokyo, 183-8511, Japan Tel +81-42-333-2206Third EditionNotes(1) The technical information provided herein describes typical operations and applications of the product and does not guarantee the intellectual property rights or other rights of Toshiba or third parties nor allows license of its use.(2) No part or the whole of this document may be reproduced without prior consent.(3) The information herein may be changed in the future without notice.(4) All possible measures have been taken to prepare the information herein. If you have any question, comment, or nd any error, please contact us.PROSEC, TOSLINE, TOSDIC, CIEMAC are trademarks or registered trademarks of Toshiba Corporation.Microsoft, Windows are registered trademarks of Microsoft Corporation in the U.S. and other countries.DeviceNet is a registered trademark of Open DeviceNet Vender Association Inc. Unified Controller nv series/Integrated Controller V series Programming Instructions (LD/FBD/SFC/ST) i Restrictions on Application This product is not developed/manufactured for use in systems involving devices that directly affect human life (Note 1). Do not use them for such applications. To use this product for systems that involve devices that significantly affect human safety or maintenance of public functions (Note 2), special considerations (Note 3) are required in system operation, maintenance, and management. In this case, contact one of Toshiba's sales representatives. (Note 1) Devices that directly affect human life include the following. Medical devices such as life supporting devices and devices for surgical units. (Note 2) Systems that involve devices that significantly affect human safety or maintenance of public functions include the following. Main unit control systems of nuclear power plants, safety protection systems of nuclear facilities, and other systems that are critical for safety Operation control systems of mass transportation systems and air traffic control systems (Note 3) Special considerations indicate sufficient discussions with Toshiba's engineers to construct a safe system (e.g. employing fool-proof design, fail-safe design, or redundant design). Disclaimer Toshiba shall not be responsible for any damage caused by fire or earthquake, acts of a third party, other accidents, the user's willful acts or negligence, misuse, or use in abnormal conditions. Toshiba shall not be responsible for any incidental damage (loss of business profits, interruption of business, change or loss of stored memory) caused by use of or being unable to use this product. Toshiba shall not be responsible for any damage caused by failure to observe the information described in the operation manual. Toshiba shall not be responsible for any damage caused by malfunctions due to combination with any connected device. Toshiba shall not be responsible for any damage caused by malfunctions due to combination with any application program created by the customer. Note Use your cellular phone or PHS 1 meter or more away from the product main unit in operation, various transmission cables, and I/O bus cable. Otherwise, the system may malfunction. 6F8C1226 ii Creating control programs for Unified Controller nv series and Integrated Controller V series requires dedicated engineering tools. This manual describes instructions for programming languages which include ladder diagram language (hereinafter referred to as LD language), function block diagram (hereinafter referred to as FBD language), sequential function chart (herein after referred to as SFC) and structured text (herein after referred to as ST). They are utilized to create control programs for Unified Controller nv series or Integrated Controller V series using engineering tools. The instructions found in this manual can be utilized in the following engineering tools: Engineering tools Use nv-Tool 4 client server version nv-Tool 4 stand alone version For Unified Controller nv series nv-Tool 3 client server version nv-Tool 3 stand alone version For Integrated Controller V series The L controller of Integrated Controller V series offers MCS connection version and DS connection version which are described as follows in this manual: Type V series Model Notation MCS connection version Model2000 L2PU11/L2PU12 L2 Model3000 L3PU11 L3 DS connection version Model2000 L2PU22 L2DS Model3000 P3PU21 L3DS Instruction manuals regarding engineering tools include the following: Unified Controller nv series Integrated Controller V series Engineering Tool 4 Setup 6F8C1291 Unified Controller nv series Integrated Controller V series Engineering Tool 4 Basic 6F8C1290 Integrated Controller V series Engineering Tool 3 Setup 6F8C1011 Integrated Controller V series Engineering Tool 3 Basic 6F8C1006 Introduction Unified Controller nv series/Integrated Controller V series Programming Instructions (LD/FBD/SFC/ST) iii CONTENTS Chapter 1 For Programming 1 1.1 What are LD, FBD, SFC, and ST Languages? 3 1.2 Data 6 1.2.1 Data Type 6 1.2.2 Data Structure 8 1.2.3 Real Number Format 9 1.2.4 Variables 10 1.2.5 Variable Memory Allocation Rules 11 1.2.6 Variable Declaration Examples 11 1.2.7 Reading and Writing Variable 15 1.3 Program Structure 16 1.3.1 Task 16 1.3.2 POU (Program Organization Unit) 17 1.3.3 Program 18 1.3.4 Function 18 1.3.5 Function Block 22 1.4 Index Registers 25 1.5 System Flags 26 1.6 Handling of REAL Data 28 1.7 Introduction Behavior when Exceeding Data Boundary 30 1.8 Step Counting 31 1.9 How to Read Instruction Spec. 33 1.10 Instruction List 35 Chapter 2 LD/FBD Instructions 51 2.1 Contacts & Coils 52 2.2 Execution Control 72 2.3 Counters 77 2.4 Timers 85 2.5 Flip-Flops 104 2.6 Moving 111 2.7 Comparison 124 2.8 Selection 145 2.9 Type Conversion 167 2.10 Numeric Function 237 2.11 Logical Operation 259 2.12 Bit Operation 278 2.13 Arithmetic Operation 291 2.14 Data Processing 321 6F8C1226 iv 2.15 I/O 333 2.16 Process Operation 371 2.17 Program Control 451 2.18 String Processing 465 2.19 Control Statements 485 2.20 Communication 524 2.21 Duplex Control 594 2.22 Process Control 603 2.23 Tag Operation 638 2.24 RAS 686 Chapter 3 SFC Instructions 699 Appendix A Using Any Function 731 INDEX 749 1 Chapter 1 For Programming This manual describes the format and handling of the instructions. Read Chapter 1 thoroughly for it provides knowledge required to understand this manual. 1.1 What are LD, FBD, SFC, and ST Languages? 3 1.2 Data 6 1.2.1 Data Type 6 1.2.2 Data Structure 8 1.2.3 Real Number Format 9 1.2.4 Variables10 1.2.5 Variable Memory Allocation Rules11 1.2.6 Variable Declaration Examples 11 1.2.7 Reading and Writing Variable15 1.3 Program Structure16 1.3.1 Task16 1.3.2 POU (Program Organization Unit) 17 1.3.3 Program18 1.3.4 Function18 1.3.5 Function Block22 1.4 Index Registers25 1.5 System Flags26 1.6 Handling of REAL Data28 1.7 Introduction Behavior when Exceeding Data Boundary30 Chapter 1 For Programming 6F8C1226 2 1.8 Step Counting31 1.9 How to Read Instruction Spec. 33 1.10 Instruction List 35 1.1 What are LD, FBD, SFC, and ST Languages? Unified Controller nv series/Integrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 3 1.1 What are LD, FBD, SFC, and ST Languages? LD Language Ladder Diagram is a graphic language for commonly used Boolean operation and described using a combination of contacts and coils. The LD language can be treated in the same manner as electrical relay circuits and must be connected to the left and right power rails. Switch_1 Motor_OnADD_INT EN ENODone Offset LD Value LD Value SET Switch_3Switch_2 Switch_4 Horizontal link Right power rail Left power rail Vertical link Note: The characters LD, ST and SET are displayed on the semi-graphic Program Editor, but not displayed on the full-graphic one. FBD Language Function block diagram is a graphic language that expresses the flow of signals and data and is described using a combination of function s and function blocks. ADD_TIME Timer_1 Switch2 LD Switch1 LD DelayTime LD AND_BOOL TONpreset LD IN PTQETT_Value ST Start ST Note: The characters LD, ST and SET are displayed on the semi-graphic Program Editor, but not displayed on the full-graphic one. Chapter 1 For Programming 6F8C1226 4 SFC Language Sequential Function Chart is a graphic language suited for sequential control and consists of an SFC structure unit, which shows the control flow, action unit, which shows the action performed at each step, and transition condition unit, which shows the conditions for advancing through the steps. START T0 S1 S1 S2 Action_1 N LED S3 S1_ON S2_ON S3_ON T1 T2 ST language Structured text (ST) is a text language similar to C and PASCAL. It supports variables, multipliers, operators, assign statements, IF statements, CASE statements, FOR statements, WHILE statements, REPEAT statements, and call statements of functions and function blocks. It efficiently programs complicated control statements such as arithmetic operations and repeat. (* Initialize *) XO[0]:=XOUT; (* Output value *) XU[0]:=XIN; (* Input value *) XOUT:=B[0]*XIN; (* Conditional statement *) IF RUN THEN FOR XI:=M TO 0 BY -1 DO XOUT:=XOUT+A[XI]*XO[XI]; REPEAT A[XJ]:=A[XJ]+XO[XI]; UNTIL A[XJ]ET Restarts clock until ETPT; Output (Q) changes depending on the relation between PT and ET. PT>Input n is not satisfied FALSE(OFF) Chapter 2 LD/FBD Instructions 6F8C1226 126 Up to 15 input data are allowed. Input1 to n must have the same data type. The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series Input data up to INF compare the magnitude relation. NAN input data do not compare the magnitude relation. Unified Controller nv series INF and NAN input data is limited by the maximum value to compare the magnitude relation. Program example [LD/FBD language notation] SAMPLE17777 LD GT_INT SAMPLE26666 LD SAMPLE35555 LD SAMPLE44444 LD SIGNAL11 ST [ST language notation] SIGNAL1 := GT_INT( SAMPLE1, SAMPLE2, SAMPLE3, SAMPLE4); Compares the data in SAMPLE1 to 4 and outputs TRUE(ON) to SIGNAL1 because the condition SAMPLE1 SAMPLE2 SAMPLE3 SAMPLE4 is satisfied. Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series FALSE(OFF) is output as the result if NAN is input. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.7 Comparison Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 127 Greater Than or Equal Comparison Greater Than or Equal LD/FBD language notation Input 1 OutputGE_Input 2Input n EN input Edge execution Index modification Modifier ST language notation Output := GE_( Input1, Input2, , Inputn ); Arguments. The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input See below Input1n 2n15 Output BOOL Output Input 1n Symbol(_) INT GE_INT DINT GE_DINT UINT GE_UINT REAL GE_REAL WORD GE_WORD DWORD GE_DWORD TIME GE_TIME TOD GE_TOD DATE GE_DATE DT GE_DT Input 1 OutputGE_Input 2Input nChapter 2 LD/FBD Instructions 6F8C1226 128 Function Compares the value of input data and outputs the comparison result. Input Condition Output Input1Input2Input is satisfied TRUE(ON) Input data Input 1Input n Input1Input2Input n is not satisfied FALSE(OFF) Up to 15 input data are allowed. Input1 to n must have the same data type. The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series Input data up to INF compare the magnitude relation.NAN input data do not compare the magnitude relation. Unified Controller nv series INF and NAN input data are limited by the maximum value to compare the magnitude relation. Program example [LD/FBD language notation] SAMPLE17777 LD GE_INT SAMPLE26666 LD SAMPLE36666 LD SAMPLE45555 LD SIGNAL11 ST [ST language notation] SIGNAL1 := GE_INT( SAMPLE1, SAMPLE2, SAMPLE3, SAMPLE4); Compares the data in SAMPLE1 to 4 and outputs TRUE(ON) to SIGNAL1 because the condition SAMPLE1 SAMPLE2 SAMPLE3 SAMPLE4 is satisfied. Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series FALSE(OFF) is output as the result if NAN is input. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.7 Comparison Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 129 Equal Comparison Equal LD/FBD language notation Input 1 OutputEQ_Input 2Input n EN input Edge execution Index modification Modifier ST language notation Output := EQ_( Input1, Input2, , Inputn ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input See below Input1n 2n15 Output BOOL Output Input 1n Symbol (_) INT EQ_INT DINT EQ_DINT UINT EQ_UINT REAL EQ_REAL WORD EQ_WORD DWORD EQ_DWORD TIME EQ_TIME TOD EQ_TOD DATE EQ_DATE DT EQ_DT Input 1 OutputEQ_Input 2 Input n Chapter 2 LD/FBD Instructions 6F8C1226 130 Function Compares the value of input data and outputs the comparison result. Input Condition Output Input1 = Input2 == Input n is satisfied TRUE(ON) Input data Input 1Input n Input1 = Input2 == Input n is not satisfied FALSE(OFF) Up to 15 input data are allowed. Input1 to n must have the same data type. The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series Input data up to INF compare the magnitude relation.NAN input data do not compare the magnitude relation. Unified Controller nv series INF and NAN input data are limited by the maximum value to compare the magnitude relation. Program example [LD/FBD language notation] SAMPLE11234 LD EQ_INT SAMPLE21234 LD SAMPLE31234 LD SAMPLE41234 LD SIGNAL11 ST [ST language notation] SIGNAL1 := EQ_INT( SAMPLE1, SAMPLE2, SAMPLE3, SAMPLE4); Compares the data in SAMPLE1 to 4 and outputs TRUE(ON) to SIGNAL1 because the condition SAMPLE1=SAMPLE2=SAMPLE3=SAMPLE4 is satisfied. Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series FALSE(OFF) is output as the result if NAN is input. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.7 Comparison Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 131 Less Than or Equal Comparison Less Than or Equal LD/FBD language notation Input 1 OutputLE_Input 2Input n EN input Edge execution Index modification Modifier ST language notation Output := LE_( Input1, Input2, , Inputn ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input See below Input1n 2n15 Output BOOL Output Input 1n Symbol (_)INT LE_INT DINT LE_DINT UINT LE_UINT REAL LE_REAL WORD LE_WORD DWORD LE_DWORD TIME LE_TIME TOD LE_TOD DATE LE_DATE DT LE_DT Input 1 OutputLE_Input 2 Input n Chapter 2 LD/FBD Instructions 6F8C1226 132 Function Compares the value of input data and outputs the comparison result. Input Condition Output Input1Input2Input n is satisfied TRUE(ON) Input data Input 1Input n Input1Input2Input n is not satisfied FALSE(OFF) Up to 15 input data are allowed. Input1 to n must have the same data type. The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series Input data up to INF compare the magnitude relation.NAN input data do not compare the magnitude relation. Unified Controller nv series INF and NAN input data are limited by the maximum value to compare the magnitude relation. Program example [LD/FBD language notation] SAMPLE11111 LD LE_INT SAMPLE22222 LD SAMPLE32222 LD SAMPLE43333 LD SIGNAL11 ST [ST language notation] SIGNAL1 := LE_INT (SAMPLE1, SAMPLE2, SAMPLE3, SAMPLE4); Compares the data in SAMPLE1 to 4 and outputs TRUE(ON) to SIGNAL1 because the condition SAMPLE1 SAMPLE2 SAMPLE3 SAMPLE4 is satisfied. Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series When NAN is input, the result is FALSE(OFF). Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.7 Comparison Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 133 Less Than Comparison Less Than LD/FBD language notation Input 1 OutputLT_ Input 2Input n EN input Edge execution Index modification Modifier ST language notation Output := LT_( Input1, Input2, , Inputn ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input See below Input1n 2n15 Output BOOL Output Input 1n Symbol(_)INT LT_INT DINT LT_DINT UINT LT_UINT REAL LT_REAL WORD LT_WORD DWORD LT_DWORD TIME LT_TIME TOD LT_TOD DATE LT_DATE DT LT_DT Input 1 OutputLT_ Input 2 Input n Chapter 2 LD/FBD Instructions 6F8C1226 134 Function Compares the value of input data and outputs the comparison result. Input Condition Output Input116#65535 65535 TRUE(ON) DWORD_BCD_TO_UINT Each digit input>16#9 0 TRUE(ON) Program example [LD/FBD language notation] Normal execution SAMPLE1 16#1234 LD WORD_BCD_TO_UINT SAMPLE21234 ST The input data 16#00001234 in SAMPLE1 is converted to WORD and the result1234 is stored in SAMPLE2. Invalid data input SAMPLE1 16#1A39 LD WORD_BCD_TO_UINT SAMPLE20 ST Stores the result 0 in SAMPLE2 because the input data 16#1A39 in SAMPLE1 contains invalid data A. [ST language notation] SAMPLE2 := WORD_BCD_TO_UINT( SAMPLE1); Error information If the input BCD data contains invalid data between 16#A and 16#F, the conversion result is 0. Also the specific register BCD error flag and error flag are set to TRUE(ON). If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is output. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 189 BCD-Real Numbers Conversion Type Conversion BCD-Real Numbers Conversion LD/FBD language notation Input Output EN input Edge execution Index modification Modifier ST language notation Output := _BCD_TO_REAL( Input ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input See below Input Output REAL Output Input Output Input Symbol(_) WORD WORD_BCD_TO_REAL DWORD DWORD_BCD_TO_REAL Function The entered BCD data is converted to REAL data. Data between 16#A and 16#F is invalid in each digit of input data. The conversion range is shown below. The result is 0 if 16#A to16#F is present in each digit. Instruction Input Output BCD error 16#0 to16#9999 0.0 to 9999.0 WORD_BCD_TO_REAL Each digit input>16#9 0.0 TRUE(ON) 16#0 to16#99999999 0.0 to 100000000.0 DWORD_BCD_TO_REAL Each digit input>16#9 0.0 TRUE(ON) _BCD_TO_REAL_BCD_TO_REALChapter 2 LD/FBD Instructions 6F8C1226 190 Program example [LD/FBD language notation] Normal execution SAMPLE1 16#1234 LD WORD_BCD_TO_REAL SAMPLE21234.0ST Input data 16#1234 in SAMPLE1 is converted to REAL and the result 1234.0 is stored in SAMPLE2. Invalid data input SAMPLE1 16#1A39 LD WORD_BCD_TO_REAL SAMPLE20.0 ST Stores the result 0.0 in SAMPLE2 because the input data 16#1A39 in SAMPLE1 contains invalid data A. [ST language notation] SAMPLE2 := WORD_BCD_TO_REAL( SAMPLE1); Error information If the input BCD data contains invalid data between 16#A and 16#F, the conversion result is 0. Also, the special register BCD error flag and error flag are set to TRUE(ON). When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 191 BCD-Duration Conversion Type Conversion BCD-Duration Conversion LD/FBD language notation Input Output EN input Edge execution Index modification Modifier ST language notation Output := _BCD_TO_TIME( Input ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input See below Input Output TIME Output Input Output Input Symbol(_) WORD WORD_BCD_TO_TIME DWORD DWORD_BCD_TO_TIME Function The entered BCD data is converted to TIME data. Input data is converted as ms unit. Data between 16#A and 16#F is invalid in each digit of input data. The conversion range is shown below. The result is 0 if 16#A to 16#F is present in each digit. Instruction Input Output BCD error 16#0 to16#9999 T#0ms to T#9999ms WORD_BCD_TO_TIME Each digit input>16#9 T#0ms TRUE(ON) 16#0 to16#99999999T#0ms to T#99999999ms DOWRD_BCD_TO_TIME Each digit input>16#9 T#0ms TRUE(ON) _BCD_TO_TIME_BCD_TO_TIMEChapter 2 LD/FBD Instructions 6F8C1226 192 Program example [LD/FBD language notation] Normal execution SAMPLE1 16#1234 LD WORD_BCD_TO_TIME SAMPLE2T#1234msST Input data 16#1234 in SAMPLE1 is converted to elapsed time and the result T#1234ms is stored in SAMPLE2. Invalid data input SAMPLE1 16#1A39 LD WORD_BCD_TO_TIME SAMPLE2T#0msST Stores the result T#0ms in SAMPLE2 because the input data 16#1A39 in SAMPLE1 contains invalid data A. [ST language notation] SAMPLE2 := WORD_BCD_TO_TIME( SAMPLE1); Error information If the input BCD data contains invalid data between 16#A and 16#F, the conversion result is 0. Also the special register BCD error flag and error flag is set to TRUE(ON). When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 193 Duration-Integer Conversion Type Conversion Duration-Integer Conversion LD/FBD language notation Input Output EN input Edge execution Index modification Modifier ST language notation Output := TIME_TO_( Input ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input TIME Input Output See below Output Input Output Symbol(_) Output TIME_TO_INT INT TIME_TO_DINT DINT TIME_TO_UINT UINT Function The entered TIME data is converted to specified integer data. Converts with output in ms unit. The conversion range and limits are shown below: Instruction Input Output Limit -T#32768ms to T#32767ms -32768 to 32767 InputT#32767ms 32767 TIME_TO_DINT -T#2147483648ms to T#2147483647ms-2147483648 to 2147483647 T#0ms to T#65535ms 0 to 65535 InputT#65535ms 65535 TIME _TO_ TIME _TO_ Chapter 2 LD/FBD Instructions 6F8C1226 194 Program example [LD/FBD language notation] Normal execution SAMPLE1 T#1234ms LD TIME_TO_INT SAMPLE21234ST Converts input data -T#1234ms in SAMPLE1 to INT and stores the result -1234 in SAMPLE2. Limit execution SAMPLE1 T#40000ms LD TIME_TO_INT SAMPLE232768ST Stores the result -32768 in SAMPLE2 because input data -T#40000ms in SAMPLE1 exceeds the valid data range for INT. [ST language notation] SAMPLE2 := TIME_TO_INT( SAMPLE1); Error information If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is output. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 195 Duration-Real Numbers Conversion Type Conversion Duration-Real Numbers Conversion LD/FBD language notation Input OutputTIME_TO_REAL EN input Edge execution Index modification Modifier ST language notation Output := TIME_TO_REAL( Input ); Arguments Arg. Operand Type Const. Description Remarks Input TIME Input Output REAL Output Function The entered TIME data is converted to REAL data. Converts with output in ms unit. TIME data between -T#16777215ms and T#16777215ms will be accurate when converted to REAL. Program example [LD/FBD language notation] SAMPLE1T#1234msLD TIME_TO_REAL SAMPLE21234.0ST [ST language notation] SAMPLE2 := TIME_TO_REAL( SAMPLE1); Input data T#1234ms in SAMPLE1 is converted to REAL and the result 1234.0 is stored in SAMPLE2. Chapter 2 LD/FBD Instructions 6F8C1226 196 Duration-BCD Conversion Type Conversion Duration-BCD Conversion LD/FBD language notation Input Output EN input Edge execution Index modification Modifier ST language notation Output := TIME_TO_BCD_( Input ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input TIME Input Output See below Output Input Output Symbol(_) Output TIME_TO_BCD_WORD WORD TIME_TO_BCD_DWORD DWORD Function The entered TIME data is converted to BCD data. The conversion range and limits are shown below: Instruction Input Output Limit BCD errorT#0ms toT#9999ms 16#0 to16#9999 InputT#9999ms 16#9999 TRUE(ON) T#0ms to T#99999999ms16#0 to 16#99999999 InputT#99999999ms 16#99999999 TRUE(ON) TIME _TO_BCD_TIME _TO_BCD_2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 197 Program example [LD/FBD language notation] Normal execution SAMPLE1 T#1234ms LD TIME_TO_BCD_WORD SAMPLE216#1234ST Converts input data T#1234ms in SAMPLE1 to BCD and stores the result 16#1234 in SAMPLE2. Limit execution SAMPLE1 T#12345ms LD TIME_TO_BCD_WORD SAMPLE216#9999ST Stores the result 16#9999 in SAMPLE2 because input data T#12345ms in SAMPLE1 exceeds the valid range. [ST language notation] SAMPLE2 := TIME_TO_BCD_WORD( SAMPLE1); Error information If the BCD data after conversion exceeds the valid range of the output data, the conversion result is limited by: WORD 16#0 or 16#9999 DWORD 16#0 or 16#99999999 Also the special register BCD error flag and error flag are set to TRUE(ON). When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 198 Truncation Type Conversion Truncation LD/FBD language notation Input OutputTRUNC_ EN input Edge execution Index modification Modifier ST language notation Output := TRUNC_( Input ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input REAL Input Output See below Output Symbol(_) Output TRUNC_INT INT TRUNC_DINT DINT TRUNC_UINT UINT Input Output Input Output Function The entered REAL data is converted for fixed point integer data. Fractions are truncated. 2.6 2 -1.5 -1 -2.4 -2 The range of integer data after conversion is as follows. If the conversion result exceeds this range, the limit of the output data type is output. INT conversion : -32768 to 32767 DINT conversion : -2147483648 to 2147483647 UINT conversion : 0 to 65535 TRUNC_ 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 199 Program example [LD/FBD language notation] Normal execution SAMPLE1 4.567 LD TRUNC_INT SAMPLE24 ST Input data 4.567 in SAMPLE1 is converted to INT and the result 4 is stored in SAMPLE2. Limit execution SAMPLE1 54321.0 LD TRUNC_INT SAMPLE232767ST Input data 54321.0 in SAMPLE1 is converted to INT, but the result 32767 is stored in SAMPLE2 because the valid data range of SAMPLE2 is exceeded. [ST language notation] SAMPLE2 := TRUNC_INT( SAMPLE1); Error information If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is output. The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series When NAN is input, the result is 0. When INF is input, the result is the maximum value. Unified Controller nv series NAN and INF data is limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 200 Sign Negative Type Conversion Sign Negative LD/FBD language notation Input OutputNEG_ EN input Edge execution Index modification Modifier ST language notation Output := NEG_( Input ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input Input Output See below Output Input Symbol Output INT NEG_INT INT DINT NEG_DINT DINT REAL NEG_REAL REAL Input Output Function The sign of the input data is negated and the result is output. Program example [LD/FBD language notation] Normal execution SAMPLE1 1234 LD NEG_INT SAMPLE21234ST The sign of the input data 1234 in SAMPLE1 is inverted and the result -1234 is stored in SAMPLE2. NEG_ 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 201 Limit execution SAMPLE1 32768 LD NEG_INT SAMPLE232767ST The sign of the input data -32768 in SAMPLE1 is inverted, but the result 32767 is stored in SAMPLE2 because the valid data range of SAMPLE2 is exceeded. [ST language notation] SAMPLE2 := NEG_INT( SAMPLE1); Error information If the conversion result of the input data exceeds the valid range of the output data type, the limit of the output data type is output. The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. Unified Controller nv series NAN and INF data is limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 202 DEG-RAD Conversion Type Conversion DEG-RAD Conversion LD/FBD language notation Input OutputDEG_TO_RAD EN input Edge execution Index modification Modifier ST language notation Output := DEG_TO_RAD( Input ); Arguments Arg. Operand Type Const. Description Remarks Input REAL Input Output REAL Output Function The entered angle data is converted to radian data. Output = Angle / 180 Program example [LD/FBD language notation] SAMPLE190.0 LD DEG_TO_RAD SAMPLE21.57079ST [ST language notation] SAMPLE2 := DEG_TO_RAD( SAMPLE1); The input data 90 in SAMPLE1 is converted to radian and the result 1.57079 is stored in SAMPLE2. Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. If INF data is entered as input, the result is INF. Unified Controller nv series NAN and INF data is limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 203 RAD-DEG Conversion Type Conversion RAD-DEG Conversion LD/FBD language notation Input OutputRAD_TO_DEG EN input Edge execution Index modification Modifier ST language notation Output := RAD_TO_DEG( Input ); Arguments Arg. Operand Type Const. Description Remarks Input REAL Input Output REAL Output Function The entered radian data is converted to angle data. Output = Radian data 180 / Program example [LD/FBD language notation] SAMPLE11.57079LD RAD_TO_DEG SAMPLE290.0 ST [ST language notation] SAMPLE2 := RAD_TO_DEG( SAMPLE1); The input data 1.57079 in SAMPLE1 is converted to angle and the result 90 is stored in SAMPLE2. Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. If INF data is entered as input, the result is INF. Unified Controller nv series NAN and INF data is limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 204 BIN Conversion Type Conversion BIN Conversion PCS compatible instruction LD/FBD language notation Input OutputBIN__P EN input Edge execution Index modification Modifier ST language notation Output := BIN__P( Input ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input Input Output See below Output Input Output Input Symbol(_) Output WORD BIN_INT_P INT DWORD BIN_DINT_P DINT Function The entered BCD data is converted to INT data. The valid range of input data and the limit of output data are as follows. Input data between 16#A and 16#F are invalid. BIN_INT_P : 16#0 to 16#9999 [When each digit>9; limit each digit to 9] BIN_DINT_P : 16#0 to16#99999999 [When each digit>9; limit each digit to 9] BIN__P 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 205 Instruction Input Output Limit Valid input : Each digit 16#0 to 16#9 0 to 9999 BIN_INT_P Invalid input : Each digit > 16#9 Limit each digit: 9 Valid input : Each digit 16#0 to 16#9 0 to 99999999 BIN_DINT_P Invalid input : Each digit > 16#9 Limit each digit: 9 Program example [LD/FBD language notation] Normal execution SAMPLE1 16#1234 LD BIN_INT_P SAMPLE21234 ST The input data 16#1234 in SAMPLE1 is converted to BIN and the result 1234 is stored in SAMPLE2. Limit execution SAMPLE1 16#1A39 LD BIN_INT_P SAMPLE21939 ST Stores the result 1939 in SAMPLE2 because the input data 16#1A39 in SAMPLE1 contains invalid data A. [ST language notation] SAMPLE2 := BIN_INT_P( SAMPLE1); Error information If the input BCD data contains invalid data between 16#A and 16#F, the abnormal digit is limited to 9. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 206 Time Data Type Conversion Type Conversion Time Data Type Conversion LD/FBD language notation Input OutputDT_TO_ EN input Edge execution Index modification Modifier ST language notation Output := DT_TO_( Input ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Remarks Input T Input Output See below Output Input Output Symbol(_) Output DT_TO_TOD TOD DT_TO_DATE DATE Function The entered DT data is converted to specified TOD data or DATE data. Direct I/O variable cannot be specified for the input (Unified Controller nv series). Program example DT_TO_TOD [LD/FBD language notation] SAMPLE1 DT#1999-8-24-17:34:56 LD DT_TO_TOD SAMPLE2 TOD#17:34:56ST [ST language notation] SAMPLE2 := DT_TO_TOD( SAMPLE1); The time of day data is extracted from input data DT#1999-8-24-17:34:56 in SAMPLE1 and the result TOD#17:34:56 is stored in SAMPLE2. DT_TO_ 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 207 DT_TO_DATE [LD/FBD language notation] SAMPLE1 DT#1999-8-24-17:34:56 LD DT_TO_DATE SAMPLE2 DATE#1999-8-24ST [ST language notation] SAMPLE2 := DT_TO_DATE( SAMPLE1); The date data is extracted from input data DT#1999-8-24-17:34:56 in SAMPLE1 and the result DATE#1999-8-24 is stored in SAMPLE2. Error information When the input exceeds the variable area, the time data type conversion is not processed and the data boundary is exceeded. The following operation is performed if direct I/O variable is specified for the input (Unified Controller nv series): Controller Action Unified Controller nv series Error flag and table operation error flag are set to TRUE(ON) and the result is 0. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 208 Concatenate Time Data Type Conversion Concatenate Time Data LD/FBD language notation Input 1 OutputCONCAT_D_TODInput 2 EN input Edge execution Index modification Modifier ST language notation CONCAT_D_TOD ( Input1, Input2, Output ); Arguments Arg. Operand Type Const. Description Remarks DATE Input1 (Date data) Input TOD Input2 (Time of day data) Output DT Output Function The date data Input 1 is concatenated with time of day data Input 2 and the result is output. Direct I/O variable cannot be specified for the output (Unified Controller nv series). Program example [LD/FBD language notation] SAMPLE3 DT#1999-8-24-17:34:56ST CONCAT_D_TODSAMPLE2 TOD#17:34:56 LD SAMPLE1 DATE#1999-8-24 LD [ST language notation] CONCAT_D_TOD ( SAMPLE1, SAMPLE2, SAMPLE3); The date data DATE#1999-8-24 in SAMPLE1 is concatenated with time data TOD#17:34:56 in SAMPLE2 and the result DT#1999-8-24-17:34:56 is stored in SAMPLE3. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 209 Error information When the output exceeds the variable area, concatenate time data is not processed and the data boundary is exceeded. The following operation is performed if direct I/O variable is specified for the output- (Unified Controller nv series): Controller Action Unified Controller nv series Concatenation of time data is not executed. Error flag and table operation error flag are set to TRUE (ON). When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 210 ASCII-HEX Conversion Type Conversion ASCII-HEX Conversion T compatible instruction LD/FBD language notation Source table Destination tableATOH_T Table sizeTBLN EN input Edge execution Index modification Modifier ST language notation ATOH_T ( TBL, N, destination table); Arguments Arg. Operand Type Const. Description Remarks TBL PTR Source table Input N UINT Table size 1N64 Output PTR Destination table Function The N word ASCII data starting at variable specified with source table TBL is converted to WORD and the result is stored in destination table. Conversion is performed from low order byte of the source table and stored from the highest digit of the destination table. Valid ASCII data is 0(16#30) to 9(16#39) and A(16#41) to F(16#46). If the table size is odd, only the high order byte is updated in the final data of the destination table. Table size N is the size of the source table and may be between 1 and 64. If N=0, no conversion is performed. Direct I/O variable cannot be specified for source table or destination table (Integrated Controller, S Controller and Unified Controller). 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 211 Program example [LD/FBD language notation] F 8 7 0B (16#42) A (16#41)1 (16#31) 0 (16#30)3 (16#33) 2 (16#32)5 (16#35) 4 (16#34)7 (16#37) 6 (16#36)9 (16#39) 8 (16#38)F (16#46) E (16#45)D (16#44) C (16#43)1 (16#31) 0 (16#30)F 016#0123 16#4567 16#89AB 16#CDEF 16#01 Conversion9 wordsARRAY1 LD SAMPLE2 9 LD ATOH_TTBL N ARRAY2 ST Source table (ASCII data) ARRAY1 Destination table (WORD) ARRAY2 Because N=9, only the high order byte is updated for the final word of the destination table. Low order byte is previous value. [ST language notation] ATOH_T ( ARRAY1, SAMPLE2, ARRAY2); The nine words ASCII data starting at source table ARRAY1 is converted to WORD and the result is stored in ARRAY2. Because the table size is odd, only the top byte of the destination table ARRAY2[4] is updated and the low order byte retains the previous value. Error information When the source table and destination table exceed the variable area, the ASCIIHEX conversion is not processed and the data boundary is exceeded. The following operation is performed when there are invalid data (ASCII codes other than 0to9and AtoF): Controller Action Integrated Controller V series S Controller ASCIIHEX conversion is not executed. Error flag is set to TRUE(ON). Unified Controller nv series ASCIIHEX conversion is not executed. Error flag and ASCII data conversion error flag are set to TRUE(ON). If table size N exceeds 64, it is limited to N=64. The following operation is performed when direct I/O variable is specified for the source table or destination table: Controller Action Integrated Controller V series S Controller ASCIIHEX conversion is not executed. Error flag is set to TRUE(ON). Unified Controller nv series ASCIIHEX conversion is not executed. Error flag and ASCII data conversion error flag are set to TRUE(ON). When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 212 HEX-ASCII Conversion Type Conversion HEX-ASCII Conversion T compatible instruction LD/FBD language notation Source table Destination tableHTOA_T Table sizeTBLN EN input Edge execution Index modification Modifier ST language notation HTOA_T ( TBL, N, destination table ); Arguments Arg. Operand Type Const. Description Remarks TBL PTR Source table Input N UINT Table size 1N32 Output PTR Destination table Function The N word WORD data starting at variable specified with source table TBL is converted to ASCII data and the result is stored in destination table. Conversion is performed from top of the source table and stored from the low order byte of the destination table. Table size N is the size of the source table and may be between 1 and 32. If N=0, no conversion is performed. Direct I/O variable cannot be specified for the source table or destination table (Integrated Controller, S Controller, Unified Controller). 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 213 Program example [LD/FBD language notation] Source table (WORD) Destination table (ASCII data) ARRAY1 ARRAY2 F 016#012316#4567 16#89AB16#CDEF ConversionF 8 7 0 B(16#42) A(16#41) 1(16#31) 0(16#30) 3(16#33) 2(16#32) 5(16#35) 4(16#34) 7(16#37) 6(16#36) 9(16#39) 8(16#38) F(16#46) E(16#45) D(16#44) C(16#43) 8 wordsARRAY1 LD SAMPLE2 4 LD HTOA_T TBL N ARRAY2 ST [ST language notation] HTOA_T ( ARRAY1, SAMPLE2, ARRAY2); The four words WORD data starting at source table ARRAY1 is converted to ASCII and the result is stored in variable ARRAY2. Error information When the source table and destination table exceed the variable area, HEX-ASCII conversion is not processed and the data boundary is exceeded. If table size N exceeds 32, it is limited to N=32. The following operation is performed if direct I/O variable is specified for the source table or destination table: Controller Action Integrated Controller V series S Controller HEX-ASCII conversion is not executed. Error flag is set to TRUE(ON). Unified Controller nv series HEX-ASCII conversion is not executed. Error flag and table operation error flag are set to TRUE(ON). When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 214 ASCII-Real Numbers Conversion Type Conversion ASCII-Real Numbers Conversion LD/FBD language notation Input string Output ASC_TO_REALConverted N EN input Edge execution Index modification Modifier ST language notation Output := ASC_TO_REAL ( Input string, N ); Arguments Arg. Operand Type Const. Description Remarks STRING Input string Input N UINT Converted characters 1N64 Output REAL Output Function N characters from the beginning of the entered input string are converted to REAL. The input string may be expressed in numerical or exponential format. Numerical format123.456 Exponential format-123.456E+2 The valid range of converted characters is 1 N 64. If N=0, no conversion is performed. The following characters may be converted. However, spaces are valid only when they are at the beginning of the string. A space character is also counted as one character. +, -, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, E, e, .(period), (space) The entered character string is analyzed as follows: Direct I/O variable cannot be specified for the input string (Integrated Controller, S Controller, Unified Controller). SP e+Number.Number . E+Number2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 215 Program example [LD/FBD language notation] When the input string is specified in numerical format: SAMPLE3162.25 ST ASC_TO_REALSAMPLE2 6 LD SAMPLE1 162.25 LD N Six characters (specified by SAMPLE2) starting from the beginning of string 162.25 in SAMPLE1 are converted to REAL and the result 162.25 is stored in SAMPLE3. When the input string is specified in exponential format: SAMPLE30.125 ST ASC_TO_REALSAMPLE2 7 LD SAMPLE1 12.5E-23 LD N Seven characters (specified by SAMPLE2) starting from the beginning of string 12.5E-23 in SAMPLE1 are converted to REAL and the result 0.125 is stored in SAMPLE3. [ST language notation] SAMPLE3 := ASC_TO_REAL (SAMPLE1, SAMPLE2); Error information When the input string exceeds the variable area, ASCII-real numbers conversion is not processed and the data boundary is exceeded. If there is a character code that cannot be converted within N characters from the beginning of the input string, 0 is output as the result. When the number of input characters is greater than the converted characters N, N is limited to the number of entered characters. If the converted data exceeds the range of REAL data, 0 is output as the result. If converted characters N exceeds 64, it is limited to N=64. The following operation is performed if direct I/O variable is specified for the input string: Controller Action Integrated Controller V series S Controller Error flag is set to TRUE(ON) and the result is 0. Unified Controller nv series Error flag and table operation error flag are set to TRUE(ON) and the result is 0. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 216 Real Numbers-ASCII Conversion Type Conversion Real Numbers-ASCII Conversion LD/FBD language notation Input data Output REAL_TO_ASCOutput char SIZE Decimal characte N EN input Edge execution Index modification Modifier ST language notation REAL_TO_ASC (Input data, SIZE, N, Output ); Arguments Arg. Operand Type Const. Description Remarks REAL Input data SIZE UINT Output charactersInput0 : 0SIZE9 Input 9999999, input data is limited to 9999999. The following operation is performed when direct I/O variable is specified for the output string: Controller Action Integrated Controller V series S Controller Real Numbers-ASCII conversion is not executed. Error flag is set to TRUE(ON). Unified Controller nv series Real Numbers-ASCII conversion is not executed. Error flag and table operation error flag are set to TRUE(ON). When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 219 ASCII (decimal)-Double Integer Conversion Type Conversion ASCII(decimal)-Double Integer Conversion LD/FBD language notation Conversion table Output ASCDEC_TO_DINT Table sizeTBL N EN input Edge execution Index modification Modifier ST language notation Output := ASCDEC_TO_DINT ( TBL, N ); Arguments Arg. Operand Type Const. Description Remarks TBL PTR Conversion table Input N UINT Table size 1N64 Output DINT Output Function From conversion table TBL consisting of decimal ASCII data (including end code CR), the number of words specified by table size N are converted to DINT and the result is output. Valid ASCII data are 0(16#30) to 9(16#39), -(16#2D), +(16#2B) and CR(16#0D). The content of the conversion table that is subject to conversion starts with a number, + or and ends with end code CR. Table size N is from 1 to 64. When N=0, the result is output as 0. The range of data to be converted is from -2147483648 to 2147483647. The data format of the conversion table is as follows: 1) 12345678 0 2 (16#32) 1 (16#31)1 4 (16#34) 3 (16#33)2 6 (16#36) 5 (16#35)3 8 (16#38) 7 (16#37)4 CR (16#0D)5 2) -876543210 0 8 (16#38) - (16#2D)1 6 (16#36) 7 (16#37)2 4 (16#34) 5 (16#35)3 2 (16#32) 3 (16#33)4 0 (16#30) 1 (16#31)5 CR(16#0D)3) +135792468 0 1 (16#31) + (16#2B)1 5 (16#35) 3 (16#33)2 9 (16#39) 7 (16#37)3 4 (16#34) 2 (16#32)4 8 (16#38) 6 (16#36)5 CR (16#0D) Direct I/O variable cannot be specified for the conversion table (Integrated Controller, S Controller, Unified Controller). Chapter 2 LD/FBD Instructions 6F8C1226 220 Program example [LD/FBD language notation] Normal execution SAMPLE2-1234 ST ASCDEC_TO_DINT SAMPLE1 3 LD TBL1 LD TBL N TBL1 structure 0 "1"(16#31) "- " (16#2D) 1 "3" (16#33) "2" (16#32) 2 CR(16#0D) "4" (16#34) Starting with conversion table TBL1, the 3 words ASCII data specified by SAMPLE1 is converted to DINT and the result -1234 is stored in SAMPLE2. Abnormal execution SAMPLE20 ST ASCDEC_TO_DINT SAMPLE1 3 LD TBL1 LD TBL N TBL1 structure 0 "1" (16#31) "-" (16#2D) 1 "3" (16#33) "2" (16#32) 2 "5" (16#35) "4" (16#34) Because no CR code is detected when converting the 3 words ASCII data specified by SAMPLE1 starting with conversion TBL1 to DINT, the result 0 is stored in SAMPLE2 and the special register error flag is set to TRUE(ON). [ST language notation] SAMPLE2 := ASCDEC_TO_DINT (TBL1, SAMPLE1); Error information When the conversion table exceeds the variable area, ASCII (decimal) -double integer conversion is not processed and the data boundary is exceeded. The following operation is performed if an ASCII code other than the specified character is present before the CR code, if + or - is present anywhere other than the beginning of data, or if the CR code is not present. Controller Action Integrated Controller V series S Controller Result is 0. Error flag is set to TRUE(ON). Unified Controller nv series Result is 0. Error flag and ASCII data conversion error flag are set to TRUE(ON). 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 221 The following operation is performed if the conversion result exceeds the maximum value of DINT type. Controller Action Integrated Controller V series S Controller Result is the limit value. Error flag is set to TRUE(ON). Unified Controller nv series Result is the limit value. Error flag and ASCII data conversion error flag are set to TRUE(ON). If table size exceeds 64, it is limited to N=64. The following operation is performed when direct I/O variable is specified for the conversion table: Controller Action Integrated Controller V series S Controller Error flag is set to TRUE(ON) and the result is 0. Unified Controller nv series Error flag and table operation error flag are set to TRUE(ON) and the result is 0. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 222 ASCII(Hexadecimal) -Double Integer Conversion Type Conversion ASCII (Hexadecimal) -Double Integer Conversion LD/FBD language notation Conversion table OutputASCHEX_TO_DINT Table sizeTBL N EN input Edge execution Index modification Modifier ST language notation Output := ASCHEX_TO_DINT ( TBL, N ); Arguments Arg. Operand Type Const. Description Remarks TBL PTR Conversion table Input N UINT Table size 1N64 Output DINT Output Function From conversion table TBL consisting of hexadecimal ASCII data (including end code CR), the numbers of words specified by table size N are converted to DINT and the result is output. Valid ASCII data are as follows: 0 (16#30) to 9 (16#39), A(16#41) to F(16#46), a(16#61) to f(16#66) and CR(16#0D) The content of the conversion table that is subject to conversion starts with a number, A to F, or a to f and ends with end code CR. Table size N is from 1 to 64. When N=0, the result is output as 0. The data to be converted is from 0 to FFFFFFFF. The data format of the conversion table is as follows: 1) 12345678 0 2 (16#32) 1 (16#31)1 4 (16#34) 3 (16#33)2 6 (16#36) 5 (16#35)3 8 (16#38) 7 (16#37)4 CR (16#0D)5 2) ABCDef01 0 B (16#42) A (16#41)1 D (16#44) C (16#43)2 f (16#66) e (16#65)3 1 (16#31) 0 (16#30)4 CR (16#0D)5 Direct I/O variable cannot be specified for the conversion table (Integrated Controller, S Controller, Unified Controller). 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 223 Program example [LD/FBD language notation] Normal execution SAMPLE2109364 ST ASCHEX_TO_DINT SAMPLE1 3 LD TBL1 LD TBL N TBL structure 0 "A" (16#41) "1" (16#31) 1 "3" (16#33) "B" (16#42) 2 CR(16#0D) "4" (16#34) Starting with conversion table TBL1, the 3 words ASCII data specified by SAMPLE1 is converted to DINT and the result 109364 is stored in SAMPLE2. Abnormal execution SAMPLE20 ST ASCHEX_TO_DINT SAMPLE1 3 LD TBL1 LD TBL N TBL1 structure 0 "1" (16#31) "0" (16#30) 1 "3" (16#33) "2" (16#32) 2 "5" (16#35) "4" (16#34) Because no CR code is detected when converting the 3 words ASCII data specified by SAMPLE1 starting with conversion TBL1 to DINT, the result 0 is stored in SAMPLE2 and the special register error flag is set to TRUE(ON). [ST language notation] SAMPLE2 := ASCHEX_TO_DINT( TBL1, SAMPLE1); Error information When the conversion table exceeds the variable area, ASCII(hexadecimal)-double integer conversion is not processed and the data boundary is exceeded. The following operation is performed if an ASCII code other than the specified character is present before the CR code or if the CR code is not present: Controller Action Integrated Controller V series S Controller Result is 0. Error flag is set to TRUE(ON). Unified Controller nv series Result is 0. Error flag and ASCII data conversion error flag are set to TRUE(ON). Chapter 2 LD/FBD Instructions 6F8C1226 224 The following operation is performed if the conversion result exceeds the maximum value of DINT type: Controller Action Integrated Controller V series S Controller Result is the limit value. Error flag is set to TRUE(ON). Unified Controller nv series Result is the limit value. Error flag and ASCII data conversion error flag are set to TRUE(ON). If the table size exceeds 64, it is limited to N=64. The following operation is performed if direct I/O variable is specified for the conversion table: Controller Action Integrated Controller V series S Controller Error flag is set to TRUE(ON) and the result is 0. Unified Controller nv series Error flag and table operation error flag are set to TRUE(ON) and the result is 0. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 225 Double Integer-ASCII (decimal) Conversion Type Conversion Double Integer-ASCII (decimal) Conversion LD/FBD language notation Conversion Destination DINT_TO_ASCDECTable sizeIN N EN input Edge execution Index modification Modifier ST language notation DINT_TO_ASCDEC ( IN, N, Destination table ); Arguments Arg. Operand Type Const. Description Remarks IN DINT Conversion data Input N UINT Table size 1N64 Output PTR Destination table Function Conversion data IN is converted to decimal ASCII data and the result is output with end code CR appended at the end of converted ASCII data. Also, the number of converted character codes is output to index register XL. (XL contains the number of character codes including the end code CR. Table size N is from 1 to 64. No operation is performed when N=0. The range of data to be converted is from -2147483648 to 2147483647. The data format of the destination table is as follows: 1) 1234567890 0 "2" (16#32) "1" (16#31)1 "4" (16#34) "3" (16#33)2 "6" (16#36) "5" (16#35)3 "8" (16#38) "7" (16#37)4 "0" (16#30) "9" (16#39)5 CR(16#0D)2) -876543210 0 "8" (16#38) "-" (16#2D)1 "6" (16#36) "7" (16#37)2 "4" (16#34) "5" (16#35)3 "2" (16#32) "3" (16#33)4 "0" (16#30) "1" (16#31)5 CR(16#0D) Direct I/O variable cannot be specified for the destination table (Integrated Controller, S Controller, Unified Controller). Chapter 2 LD/FBD Instructions 6F8C1226 226 Program example [LD/FBD language notation] Normal execution TBL1 ST DINT_TO_ASCDEC SAMPLE2 3 LD SAMPLE1 -1234 LD IN N TBL1 structure 0 "1" (16#31) "-" (16#2D) 1 "3" (16#33) "2" (16#32) 2 CR(16#0D) "4" (16#34) Content -1234 of conversion table SAMPLE1 is converted to ASCII (decimal) and the result is stored in a 3 words area specified by SAMPLE2 starting from destination table TBL1. The number of characters 6 is stored in index register XL. Abnormal execution TBL1 ST DINT_TO_ASCDEC SAMPLE2 3 LD SAMPLE1 -12345 LD IN N TBL1 structure 0 "1" (16#31) "4" (16#34) 1 CR(16#0D) 2 Content of TBL1 is unchanged. Because the content of conversion data SAMPLE1 cannot be converted to ASCII (decimal) and stored in 3 words area specified by SAMPLE2 and starting with destination table TBL1 (four words are required), the contents of storage destination table TBL1 and index register XL are unchanged. Also, the special register error flag is set to TRUE(ON). [ST language notation] DINT_TO_ASCDEC ( SAMPLE1, SAMPLE2, TBL1); 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 227 Error information When the destination table exceeds the variable area, the double integer-ASCII (decimal) conversion is not processed and the data boundary is exceeded. The following operation is performed if the conversion result cannot be stored in area with number of words specified by N: Controller Action Integrated Controller V series S Controller Destination table and index register XL are not updated. Error flag is set to TRUE(ON). Unified Controller nv series Destination table and index register XL are not updated. Error flag and ASCII data conversion error flag are set to TRUE(ON). If table size exceeds 64, it is limited to N=64. The following operation is performed if direct I/O is specified for the destination table: Controller Action Integrated Controller V series S Controller Double integer-ASCII (decimal) conversion is not executed. Error flag is set to TRUE(ON). Unified Controller nv series Double integer-ASCII (decimal) conversion is not executed. Error flag and table operation error flag are set to TRUE(ON). When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. Chapter 2 LD/FBD Instructions 6F8C1226 228 Double Integer-ASCII (hexadecimal) Conversion Type Conversion Double Integer-ASCII (hexadecimal) Conversion LD/FBD language notation Conversion Destination table DINT_TO_ASCHEXTable sizeIN N EN input Edge execution Index modification Modifier ST language notation DINT_TO_ASCHEX ( IN, N, Destination table ); Arguments Arg. Operand Type Const. Description Remarks IN DINT Conversion data Input N UINT Table size 1N64 Output PTR Destination table Function Conversion data IN is converted to hexadecimal ASCII data and the result is output with end code CR appended at the end of converted ASCII data. Also, the number of converted character codes is output to index register XL (XL contains the number of character codes including the end code CR). Table size N is from 1 to 64. No operation is performed when N=0. The range of data to be converted is from -2147483648 to 2147483647. The data format of the storage destination table is as follows: 1) 305419896 0 "2" (16#32) "1" (16#31)1 "4" (16#34) "3" (16#33)2 "6" (16#36) "5" (16#35)3 "8" (16#38) "7" (16#37)4 0 CR(16#0D)5 2) -87654321 0 "A" (16#41) "F" (16#46)1 "6" (16#36) "C" (16#43)2 "0" (16#30) "8" (16#38)3 "F" (16#46) "4" (16#34)4 0 CR(16#0D)5 Direct I/O variable cannot be specified for the destination table (Integrated Controller, S Controller, Unified Controller). 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 229 Program example [LD/FBD language notation] Normal execution TBL1 ST DINT_TO_ASCHEX SAMPLE2 3 LD SAMPLE1 332340 LD IN N TBL1 structure 0 "1" (16#31) "5" (16#35) 1 "3" (16#33) "2" (16#32) 2 CR(16#0D) "4" (16#34) Content 332340 of conversion table SAMPLE1 is converted to ASCII (hexadecimal) and the result is stored in a 3 words area specified by SAMPLE2 starting from destination table TBL1. The number of characters 6 is stored in index register XL. Abnormal execution TBL1 ST DINT_TO_ASCHEX SAMPLE2 2 LD SAMPLE1 4660 LD IN N TBL1 structure 0 "1" (16#31) "4" (16#34) 1 CR(16#0D) 2 Content of TBL1 is unchanged. Because the content of conversion data SAMPLE1 cannot be converted to ASCII (hexadecimal) and stored in 2 words area specified by SAMPLE2 and starting with destination table TBL1 (three words are required), the contents of destination table TBL1 and index register XL are unchanged. Also, the special register error flag is set to TRUE(ON). [ST language notation] DINT_TO_ASCHEX ( SAMPLE1, SAMPLE2, TBL1); Error information When the destination table exceeds the variable area, the double integer-ASCII (hexadecimal) conversion is not processed and the data boundary is exceeded. The following operation is performed if the conversion result cannot be stored in area with number of words specified by N: Controller Action Integrated Controller V series S Controller Destination table and index register XL are not updated. Error flag is set to TRUE(ON). Unified Controller nv series Destination table and index register XL are not updated. Error flag and ASCII data conversion error flag are set to TRUE(ON). Chapter 2 LD/FBD Instructions 6F8C1226 230 if the table size exceeds 64, it is limited to N=64. The following operation is performed when direct I/O is specified for the destination table: Controller Action Integrated Controller V series S Controller Double integer-ASCII (hexadecimal) conversion is not executed. Error flag is set to TRUE(ON). Unified Controller nv series Double integer-ASCII (hexadecimal) conversion is not executed. Error flag and table operation error flag are set to TRUE(ON). When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 231 Array-String Conversion Type Conversion Array-String Conversion LD/FBD language notation Array data Destination string variable ARRAY_TO_STRINGTable sizeIN N EN input Edge execution Index modification Modifier ST language notation ARRAY_TO_STRING ( IN, N, Destination string variable ); Arguments Arg. Operand Type Const. Description Remarks IN PTR Array data Input N UINT Table size 1N129 Output STRING Destination string variable Function An N word shift JIS character code starting from input array data IN is output as STRING. The data to be converted is N words starting from IN and ends with CR code (16#0D). The table size N indicates the conversion size of the array data. No operation is performed when N=0. The range of table size N is from 1 to 129 (up to 256 bytes + CR code). The data formats of the source and destination table are as follows: 0 12 3 4 5 2 (16#32) 1 (16#31) 4 (16#34) 3 (16#33) 6 (16#36) 5 (16#35) 8 (16#38) 7 (16#37) CR (16#0D) 0123458 (16#38) - (16#2D)6 (16#36) 7 (16#37)4 (16#34) 5 (16#35)2 (16#32) 3 (16#33)CR (16#0D) 1 (16#31) 0 12 3 4 5 2 (16#32) 1 (16#31) 4 (16#34) 3 (16#33) 6 (16#36) 5 (16#35) 8 (16#38) 7 (16#37) 41 STRING length=8 VAR length=6 7 6 01 STRING length=9VAR length=62345678 (16#38) - (16#2D)6 (16#36) 7 (16#37)4 (16#34) 5 (16#35)2 (16#32) 3 (16#33) 1 (16#31) Ex. when character string is declared as follows Var. Data type Dec. A STRING [12] VAR Character code storage area word count as STRING [12] Number of Stored character Stored character codes 1) 12345678 2) -87654321 N=5 N=5 Direct I/O variable cannot be specified for the input string and destination string (Integrated Controller, S Controller, Unified Controller). Chapter 2 LD/FBD Instructions 6F8C1226 232 Program example [LD/FBD language notation] SAMPLE2 ST ARRAY_TO_STRING SAMPLE1 3 LD TBL1 LD IN N TBL1 structure 0 "1" (16#31) "5" (16#35) 1 "3" (16#33) "2" (16#32) 2 CR(16#0D) "4" (16#34) Variable Data type Dec. SAMPLE2 STRING [12] VAR SAMPLE2 result 0"1" (16#31) "5" (16#35) 1"3" (16#33) "2" (16#32) 2 "4" (16#34) String length=5 VAR length=6 34 5 6 73 "7" (16#37) "6" (16#36) [ST language notation] ARRAY_TO_STRING( TBL1, SAMPLE1, SAMPLE2); Starting with source array data TBL1, 3 words array data specified by SAMPLE1 is stored in STRING SAMPLE2. The data up to the end code CR in the source are converted. Error information When the array data and destination string exceed the variable area, the arraystring conversion is not processed and the data boundary is exceeded. If the source data cannot be stored in the destination STRING variable (INT((number of character codes up to CR+1)/2) > VAR length), the result is unchanged. If there is no CR code in the N word array starting with the source data, the result is unchanged (data format error). If the array data contains invalid 2 byte character code, it is replaced with ?? in the result. If N>129, the operation is limited to N=129. The following operation is performed when direct I/O variable is specified for the source array and output string. Controller Action Integrated Controller V series S Controller Arraystring conversion is not executed. Error flag is set to TRUE(ON). Unified Controller nv series Arraystring conversion is not executed. Error flag and table operation error flag are set to TRUE(ON). When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 233 String-Array Conversion Type Conversion String-Array Conversion LD/FBD language notation Input string Destination array STRING_TO_ARRAY Converted charactersIN L P Start of convertedcharacters EN input Edge execution Index modification Modifier ST language notation STRING_TO_ARRAY ( IN, L, P, Destination array ); Arguments Arg. Operand Type Const. Description Remarks IN STRING Input string L UINT Converted characters Input P UINT Start of converted characters Output PTR Destination array Function L character codes from the P character of the input string IN are stored in the specified array. CR code (16#0D) is appended at the end of the converted character code. No operation is performed when L=0. The data formats of the input string and destination are as follows: 0 12 3 4 5 3 (16#33) 2 (16#32) 5 (16#35) 4 (16#34) CR (16#0D) 0123456 (16#36) 7 (16#37)4 (16#34) 5 (16#35)CR (16#0D) 3 (16#33) 0 12 3 4 5 2 (16#32) 1 (16#31) 4 (16#34) 3 (16#33) 6 (16#36) 5 (16#35) 8 (16#38) 7 (16#37) STRING length=8 VAR length=6 7 6 01 STRING length=9VAR length=62345678 (16#38) - (16#2D)6 (16#36) 7 (16#37)4 (16#34) 5 (16#35)2 (16#32) 3 (16#33) 1 (16#31) Ex. when string variable is declared as follows: Var. Data type Dec. A STRING[12] VAR Character code storage area words as STRING[12]Number of Stored character Stored character code 1) 12345678 2) -87654321 When L=4, P=2 When L=5, P=3 Direct I/O variable cannot be specified for the input string and destination array (Integrated Controller, S Controller, Unified Controller). Chapter 2 LD/FBD Instructions 6F8C1226 234 Program example [LD/FBD language notation] TBL1 ST STRING_TO_ARRAY SAMPLE23 LD SAMPLE1 LD IN L TBL1 result0 "1" (16#31) 1 "3" (16#33) "2" (16#32) 2CR(16#0D) SAMPLE1 structure 0"1" (16#31) "5" (16#35) 1"3" (16#33) "2" (16#32) 2 "4" (16#34) String length=5 VAR length=6 34 5 6 73 SAMPLE32 LD P Variable Data type Dec. SAMPLE1 STRING [12] VAR [ST language notation] STRING_TO_ARRAY ( SAMPLE1, SAMPLE2, SAMPLE3, TBL1); In the source input string SAMPLE1, 3 characters specified by SAMPLE2 from character start position 2 specified by SAMPLE3 are output to destination array TBL1 with end code CR appended. Error information When the input string and destination array exceed the variable area, the stringarray conversion is not processed and the data boundary is exceeded. When the conversion character position P=0, L characters from the beginning are stored in the array. When conversion character position P > storage character count, only CR code is stored in the array. The following operation is performed when direct I/O variable is specified for the input string and destination array: Controller Action Integrated Controller V series S Controller Stringarray conversion is not executed. Error flag is set to TRUE(ON). Unified Controller nv series Stringarray conversion is not executed. Error flag and table operation error flag are set to TRUE(ON). When EN is used, ENO is reset to FALSE(OFF) when the above error occurs. 2.9 Type Conversion Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 235 Tag Number Conversion Type Conversion Tag Number Conversion LD/FBD language notation Tag variable Tag TO_INDEX Tag typeTAG TYPE EN input Edge execution Index modification Modifier ST language notation Tag number := TO_INDEX ( TAG, TYPE ); Arguments Arg. Operand Type Const. Description Remarks TAG PTR Tag variable (parameter) Input TYPE UINT Tag type 0 : PV 1 : LP 2 : PB 3 : SQ Output DINT Tag number Function The variable specified with tag variable TAG is converted to an array number within the type specified with tag type TYPE, and the result is output. The range of the tag type is from 0 to 3 (from 0 to 2 for the MCS type tag controller (model1000) because SQ is not included. Direct I/O variable cannot be specified for the tag variable. Array type notation (e.g. PV_PARA[0]) and Tag No. notation (e.g. FIC101) can be specified for tag variable. This instruction is useful when processes using tags are standardized (user FB) and tag variables are switched. For details, refer to "Program example. Note For the DS type tag controller, tag numbers of PV and LP are different, so no extension is required (e.g. FIC101. TAG). For the MCS type tag controller (model 1000), tag numbers of PV and LP are common, so Tag No. notation without extension (e.g. FIC101) is not interpreted correctly. Therefore, specify tag numbers with extension (e.g. FIC101.PVP and FIC101.ALP for LP, FIC101.TAG for PV). Chapter 2 LD/FBD Instructions 6F8C1226 236 Program example [LD/FBD language notation] User FB(TAG_FB) caller Variable Data type Val Dec. PV1 REAL 0 VAR PV2 REAL 0 VAR TAG_FB_1 TAG_FB VAR TAG_FB_2 TAG_FB VAR IND01.TAG: PV_PARA[0] IND02.TAG: PV_PARA[1] User FB(TAG_FB) Variable Data type Val Dec. TAG PTR VAR_INPUT OUT REAL VAR_OUTPUT IND01.RH=200.0 IND01.RL=0.0 IND01.PV=24.0 IND02.RH=100.0 IND02.RL=-100.0 IND02.PV=24.0 IND01.TAG LD TAG_FB TAG OUT PV1 12 ST TAG_FB_1 IND02.TAG LD TAG_FB TAG OUT PV2 62 ST TAG_FB_2 TAG{INT}[0] LD 0 LD TO_INDEX TAG TYPE XI ST PV_DATA[XI].PV LD PV_PARA[XI].RH LD PCT IN PV_RH OUT ST IND01: 0 IND02: 1 IND01: 24.0 IND02: 24.0 IND01:12.0 IND02:62.0 [ST language notation] TAG_FB_1 ( IND01.TAG); XI := TO_INDEX ( TAG{INT}[0], 0); PV1 := TAG_FB_1.OUT; OUT := PCT ( PV_DATA[XI].PV, PV_PARA[XI].RH); TAG_FB_2 (IND02.TAG); PV2 := TAG_FB_2.OUT; The user function block (TAG_FB) that has tag No. (TAG) as an input argument is executed twice. If IND01.TAG is specified, XI=0 in TAG_FB. If IND02.TAG is specified, XI=1. The specified tag variable is accessed in each case. Error information If anything other than 0 to 3 (0 to 2 for the MCS type tag controller (model1000)) is specified for tag type TYPE, or if tag variable TAG is out of range, a table operation error occurs and the result output is "-1". The following operation is performed if direct I/O is specified for the tag variable: Controller Action Integrated Controller V series S Controller Table operation error flag is set to TRUE(ON) and the result is -1. Unified Controller nv series Error flag and table operation error flag are set to TRUE(ON) and the result is -1. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.10 Numeric Function Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 237 2.10 Numeric Function No. Instruction Remarks 1 Square Root SQRT 2 Exponential EXP 3 Common Logarithms LOG 4 Natural Logarithms LN 5 Absolute Value ABS 6 Sine SIN 7 Cosine COS 8 Tangent TAN 9 Arcsine ASIN 10 Arccosine ACOS 11 Arctangent ATAN Chapter 2 LD/FBD Instruction 6F8C1226 238 Square Root Numeric Function Square Root LD/FBD language notation Input OutputSQRT EN input Edge execution Index modification Modifier ST language notation Output := SQRT( Input ); Arguments Arg. Operand Type Const. Description Input REAL Input Output REAL Output Function The square root of the input REAL data is obtained and the result is output. input input of sign Output Program example [LD/FBD language notation] SAMPLE13.0 LD SQRT SAMPLE21.732051ST [ST language notation] SAMPLE2 := SQRT (SAMPLE1); The square root of the input data 3 in SAMPLE1 is obtained and the result 1.732051 is stored in SAMPLE2. Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. If INF data is entered as input, the result is INF. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.10 Numeric Function Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 239 Exponential Numeric Function Exponential LD/FBD language notation Input OutputEXP EN input Edge execution Index modification Modifier ST language notation Output := EXP( Input ); Arguments Arg. Operand Type Const. Description Input REAL Input Output REAL Output Function The exponential of the input REAL data is obtained and the result is output. input exp Output 88.7228 01 3.40282E+38 Input dataResult output Program example [LD/FBD language notation] SAMPLE13.0 LD EXP SAMPLE220.08553ST [ST language notation] SAMPLE2 := EXP (SAMPLE1); The exponential of the input data 3 in SAMPLE1 is obtained and the result 20.08553 is stored in SAMPLE2. Chapter 2 LD/FBD Instruction 6F8C1226 240 Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. If INF data is entered as input, the result is INF. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.10 Numeric Function Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 241 Common Logarithms Numeric Function Common Logarithms LD/FBD language notation Input OutputLOG EN input Edge execution Index modification Modifier ST language notation Output := LOG( Input ); Arguments Arg. Operand Type Const. Description Input REAL Input Output REAL Output Function The common logarithm of the input REAL data is obtained and the result is output. If the input data is 0, the result is 0. Output=log( | input | ) 0-3.40282E+38 38.53184 Input dataResult output3.40282E+38 Program example [LD/FBD language notation] SAMPLE13.0 LD LOG SAMPLE20.4771213ST [ST language notation] SAMPLE2 := LOG( SAMPLE1); The common logarithm of the input data 3 in SAMPLE1 is obtained and the result 0.4771213 is stored in SAMPLE2. Chapter 2 LD/FBD Instruction 6F8C1226 242 Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. If INF data is entered as input, the result is INF. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.10 Numeric Function Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 243 Natural Logarithms Numeric Function Natural Logarithms LD/FBD language notation Input OutputLN EN input Edge execution Index modification Modifier ST language notation Output := LN( Input ); Arguments Arg. Operand Type Const. Description Input REAL Input Output REAL Output Function The natural logarithm of the input REAL data is obtained and the result is output. If the input data is 0, the result is 0. Outputln ( | input | ) 0-3.40282E+38 88.7228 Input dataResult output3.40282E+38 Program example [LD/FBD language notation] SAMPLE13.0 LD LN SAMPLE21.098612ST [ST language notation] SAMPLE2 := LN( SAMPLE1); The natural logarithm of the input data 3 in SAMPLE1 is obtained and the result 1.098612 is stored in SAMPLE2. Chapter 2 LD/FBD Instruction 6F8C1226 244 Error information The following operation is performed if the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. If INF data is entered as input, the result is INF. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.10 Numeric Function Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 245 Absolute Value Numeric Function Absolute Value LD/FBD language notation Input OutputABS_ EN input Edge execution Index modification Modifier ST language notation Output := ABS_( Input ); Arguments The following data types are supported for input and output arguments and the instruction symbol depends on the data type: Arg. Operand Type Const. Description Input Input Output See below Output Input Symbol(_ ) Output INT ABS_INT INT DINT ABS_DINT DINT REAL ABS_REAL REAL Function The absolute value of the input data is obtained and the result is output. For INT data, the absolute value of the maximum negative value is the maximum positive value. Input data Result outputABS_INT 32768 32767 ABS_DINT 2147483648 2147483647 Input Output ABS_ Chapter 2 LD/FBD Instruction 6F8C1226 246 Program example [LD/FBD language notation] SAMPLE1-1234 LD ABS_INT SAMPLE21234 ST [ST language notation] SAMPLE2 := ABS_INT (SAMPLE1); The absolute value of the input data -1234 in SAMPLE1 is obtained and the result 1234 is stored in SAMPLE2. Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.10 Numeric Function Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 247 Sine Numeric Function Sine LD/FBD language notation Input OutputSIN EN input Edge execution Index modification Modifier ST language notation Output := SIN( Input ); Arguments Arg. Operand Type Const. Description Input REAL Input Output REAL Output Function The sine of the input REAL data is obtained and the result is output. The input data must be in radians. Output = Sin (input) -4 0Input dataResul t output-2 - -3 2 3 4 1.0-1.0 Program example [LD/FBD language notation] SAMPLE11.047198LD SIN SAMPLE20.8660254ST [ST language notation] SAMPLE2 := SIN (SAMPLE1); The sine of the input data 1.047198 in SAMPLE1 is obtained and the result 0.8660254 is stored in SAMPLE2. Chapter 2 LD/FBD Instruction 6F8C1226 248 Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. If INF data is entered as input, the result is INF. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.10 Numeric Function Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 249 Cosine Numeric Function Cosine LD/FBD language notation Input OutputCOS EN input Edge execution Index modification Modifier ST language notation Output := COS( Input ); Arguments Arg. Operand Type Const. Description Input REAL Input Output REAL Output Function The cosine of the input REAL data is obtained and the result is output. The input data must be in radians. Output = Cos (input) 0Input data Result output-2 - -3 2 31.0-1.0 Program example [LD/FBD language notation] SAMPLE11.047198LD COS SAMPLE20.5 ST [ST language notation] SAMPLE2 := COS( SAMPLE1); The cosine of the input data 1.047198 in SAMPLE1 is obtained and the result 0.5 is stored in SAMPLE2. Chapter 2 LD/FBD Instruction 6F8C1226 250 Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. If INF data is entered as input, the result is INF. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.10 Numeric Function Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 251 Tangent Numeric Function Tangent LD/FBD language notation Input OutputTAN EN input Edge execution Index modification Modifier ST language notation Output := TAN( Input ); Arguments Arg. Operand Type Const. Description Input REAL Input Output REAL Output Function The tangent of the input REAL data is obtained and the result is output. The input data must be radians. OutputTan (input) 0Result output-2 - -3 2 3 4 -Infinity +Infinity Input data-4 Program example [LD/FBD language notation] SAMPLE11.047198LD TAN SAMPLE21.732051ST [ST language notation] SAMPLE2 := TAN( SAMPLE1); The tangent of the input data 1.047198 in SAMPLE1 is obtained and the result 1.732051 is stored in SAMPLE2. Chapter 2 LD/FBD Instruction 6F8C1226 252 Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. If INF data is entered as input, the result is INF. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset to FALSE(OFF) when the above error occurs. 2.10 Numeric Function Unified Controller nv seriesIntegrated Controller V series Programming Instructions (LD/FBD/SFC/ST) 253 Arcsine Numeric Function Arcsine LD/FBD language notation Input OutputASIN EN input Edge execution Index modification Modifier ST language notation Output := ASIN( Input ); Arguments Arg. Operand Type Const. Description Input REAL Input Output REAL Output Function The arcsine of the input REAL data is obtained and the result is output. The output data is in radians. Input data must be between -1.000000 and +1.000000. If Input data > 1.000000, Input data is assumed to be 1.000000. If Input data < -1.000000, Input data is assumed to be -1.000000 Output = Asin (input) -2.0 0Input dataResult output-1.0 -0.5-1.5 0.5 1.0 1.5 2.0 1.02.0-1.0-2.0 Chapter 2 LD/FBD Instruction 6F8C1226 254 Program example [LD/FBD language notation] SAMPLE10.5 LD ASIN SAMPLE20.5235988ST [ST language notation] SAMPLE2 := ASIN( SAMPLE1); The arcsine of the input data 0.5 in SAMPLE1 is obtained and the result 0.5235988 is stored in SAMPLE2. Error information The following operation is performed when the input data type is REAL: Controller Action Integrated Controller V series If NAN data is entered as input, the result is NAN. If INF data is entered as input, the result is INF. Unified Controller nv series NAN and INF data are limited by the maximum value. When EN is used, ENO output is reset