Home

FA-M3 Programming Tool WideField3 (Script)

image

Contents

1. E Step Counts Prefix Step Count Ww 12 L 12 D 15 F 9 E 10 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 15 E Function and Example This function stores the square root of s in the return value The square root of 16 bit data with a prefix of W is calculated in a 16 bit format The square root of 32 bit data with a prefix of L or F is calculated in a 32 bit format The square root of 64 bit data with a prefix of D or E is calculated in a 64 bit format The fractional portion of the value is truncated if s is an integer with a prefix of W L or D Example F D1001 SQR F D0001 When F D0001 2 0 F D1001 SQR 2 0 1 414214 D0001 D1001 IEEE code o 110 y of o als 0 0 af 0 T 0 0 oo 0 0 lp 0 0 af 0 0 0 IEEE code PEE HEEE EE heheee oho EEE oek Represents 1 414214 3FB504F3 G0807_01 VSD Figure G8 7 Example and Behavior of the SQR Function SEE ALSO The SQR function behaves in the same way as the SQR or FSQR instruction in ladder instructions For details on the SQR and FSQR instructions see Section 3 3 18 Square Root SQR Long word Square Root SQR L Section 3 3 19 Double Long word Square
2. G3 4 3 Converting Data Types This section describes how to convert data types You can convert the data type of a mathematical expression or function used in a script by enclosing within parentheses and then adding a prefix to it In the following example the result of a function returned as a single precision floating point type F is converted into a double precision floating point E value Example E SIN F D00001 In the following example the result of an addition of word W values is converted into a long word L value or bit B If the result of the addition is 0 in the conversion to a bit B value the conversion result is 0 Otherwise the result is 1 Example L W D00001 W D00003 B W D00001 W D00003 In addition the following types of type conversions cannot be performed directly among type conversions between integer values and floating point values You must change the data size between integer types or floating point types before converting the data type into floating point or integer Type conversion from word W to double precision floating point E Example E D00010 E W D00001 A compile error occurs E D00010 E D W D00001 Through double long word type D Type conversion from single precision floating point F to double long word D Example D DO00010 D F D00001 A compile error occurs D D00010 D E F D00001 Through double precision floating point type E
3. 2 Long word data SWAP L D0001 L D0003 Long word data swapping Before executing the instruction D0002 G0912_01 VSD D0004 1234 OFOF After executing the instruction Figure G9 12 SEE ALSO D0002 OFOF 1234 D0004 Example and Behavior of the SWAP Function The SWAP function behaves in the same way as the XCHG instruction in ladder instructions For details on the XCHG instruction see Section 3 7 8 Exchange XCHG Exchange Long word XCHG L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 28 G9 13 HSWAP Byte Swap HSWAP is a function for swapping the upper and lower bytes of a word data This function swaps the contents of the upper one byte and lower one byte of d HSWAP d Return Prefix a reas Description wL D F E 5 g Constant Expression Modification A data whose upper d and lower bytes are v v swapped Return No value is returned value E Return Value Arguments Return Value Input Output Arguments Input Output There is no restriction N A E Step Counts Prefix 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 29 E Function and Example This function swaps the contents of the upper one b
4. 62D AAAA Integer part a four digit number A 0 to 9 30 to 39 BBBB Decimal part a four digit number B 0 to 9 30 to 39 Sequence of s s s A s 1 A A s 2 A u Point 2E s 3 B B s 4 B B s 5 00 lt End of the string Null G1001_04 VSD AN CAUTION An instruction processing error occurs during execution in the CPU if the string to be converted contains a character that cannot be converted into a numeric value or if the conversion result exceeds the range of word or long word numbers TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character SEE ALSO The VAL function behaves in the same way as the VAL instruction in ladder instructions For details on the VAL instruction see Section 3 12 1 Convert String to Numeric VAL Convert String to Long word Numeric VAL L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 5 G10 2 STR Convert Numeric to String STR is a function for converting a binary data into a string This function converts a binary data s into a string in a format specified by n and stores the string in the return value Return value STR n s Return Prefix Index rei i
5. E Available Devices Return Value Input Output Range Behavior Restrictions Arguments s1 Input There is no restriction Input 0 lt n1 lt 32767 If the specified n1 is less than 0 the return value n1 is 1 error If n1 0 the concatenation result d is an n2 byte data starting from s2 s2 Input There is no restriction Input 0 lt n2 lt 2047 If the specified n2 is less than 0 or greater than n2 or equal to 2048 the return value is 1 error If n2 0 the concatenation result d is an n1 byte data starting from s1 d Output If the specified n is 0 or less the return value is 1 error R Processing result 0 Normal When an error 1 occurs the operation is not eturn Bed 1 Error performed and the value before execution is value aaa i maintained in d IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 31 E Step Counts Ww 269 4 In addition 21 steps are used for each script instruction E Function and Example This function concatenates byte data This function concatenates n1 bytes of data starting from s1 with n2 bytes of data starting from s2 and stores the concatenated data at the addresses starting from d The return value indicates whether the function is executed normally 0 or an error occurs 1 Example 1 When the concatenation destination does not overlap any concatenation sources W
6. Return Value Input Output Range Behavior Restrictions Arguments Input 1 lt s lt 1 If a value outside of the valid range is entered an s instruction processing error occurs during execution in the CPU Output The processing result is stored Return If an instruction processing error occurs during value execution in the CPU the return value is undetermined E Available Devices Step Count 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 25 E Function and Example This function calculates the single precision floating point value of ASIN arc sine of a real single precision floating point number in radians The relational expression is as follows Return value ASIN s1 s1 A real number data whose SIN is calculated 1 lt s1 lt 1 Return value The obtained SIN value in radians lt Return value lt _ 2 2 G0812_01 VSD Example F D1001 ASIN F D0001 When F D0001 II w F D1001 ASINC SIN SIN 3 D1001 IEEE code 2 IEEE code o 0 1 iy 1 iF sfofolo 1 1 aC 0 of 0 1 ofifo 0 iJo 0 10 Represents 1 047197 3F860A92 G0812_02 VSD Figure G8 12 Example and Behavior of the ASIN Function SEE ALSO The ASIN function behaves in the same way as the FASIN instruction in ladder instructions For d
7. Up to the NULL character 5 characters Sequence of the return value 00 End of the string Null 0 9 gt iji 4 G1008_01 VSD Figure G10 6 Example and Behavior of the Simplified MID Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character SEE ALSO The simplified MID function behaves in the same way as the SMID instruction in ladder instructions For details on the SMID instruction see Section 3 12 7 String Middle SMID in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 19 G10 9 RIGHT String Right RIGHT is a function for extracting a substring from the right side of a string This function extracts n characters from the right side of string s Return value RIGHTS s n Return Prefix index reine Description W L D F E s B Constant Expression Modification A source string or the s first device number of Vv P Vv Y devices that represent a source string The number of n characters in bytes to v v v v be extracted Return The extracted string value m Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If s is NULL or the string length is gr
8. E Display Contents of Compile Results The display contents of the compile result for a script displayed in the Script tab on the output window vary depending on whether the compile is completed normally or any error is detected When the Compile is Completed Normally A Block BLKO01 Compiling script 2011 10 6 16 52 38 Block BLK001 ST0001 Error 0 Serious VVarning 0 VVarning 0 Cross Reference Script G0501_04 VSD A Message displayed when a compile of a script starts Displays a message representing that a compile has started and also the start date and time of the compile B Compile results display Displays the number of errors and number of warnings as a compile result If the number of errors is Zero it indicates that the compile is completed successfully When Any Compile Error Occurs A l Block BLK001 Compiling script 2011 8 23 09 59 09 Block BLK001 Line 1 STOO01 Line 4 error Invalid argument specification of function SIN B Block BLK001 ST0001 Error 1 Serious VVarning 0 Warning 0 Cross Reference Script G0501_05 VSD A Message displayed when a compile of a script starts Displays a message representing that a compile has started and also the start date and time of the compile B Compile error warning output Displays the information of compile errors and warnings Displays the block file name where the script instruction exists the line number of t
9. If a script contains a compile error the ladder program converted from the script is not printed When printing the block or macro monitor window you can do this with online balloon comments monitors placed on converted ladders On the other hand when printing the Edit Block or Edit Macro window offline balloon comments monitors are displayed on the script instruction line If the online balloon comment monitor is placed on the converted ladder and you update an offline project with the online balloon comment monitor data the balloon is automatically moved to the script instruction line on the offline project IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 G3 1 Script Syntax This chapter describes the script syntax A script consists of script syntax which describes a series of processing and script functions which perform specific processing functioning as a kind of library Script syntax must be expressed with a combination of operands and operators and be coded based on the following syntax elements Assignment statements Operators Control statements IF statement SELECT statement FOR statement and EXITSCRIPT statement Data types prefixes Reserved words The following describes how to use each syntax element and related information IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 1 G3 2 Assignment Statements An assignment statement consists of the left hand side right hand s
10. ENDIF G0304_03 VSD Figure G3 2 Example of Nested Branch Statements IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 4 G3 4 1 G3 16 Data Types and Prefixes This section describes data types in scripts You can specify a data type by using a prefix The following table shows the relationship between prefixes and data types Word W long word L and double long word D types are referred to as integer types while single precision floating point F and double precision floating point E types are referred to as floating point types Table G3 7 Prefixes and Data Types W Word type Signed 16 bit integer 16 bit data decimal hexadecimal constant L Long word type Signed 32 bit integer 32 bit data decimal nexadecimal constant D Double long word type Signed 64 bit integer 64 bit data decimal nexadecimal constant precision floating point type 32 bit single precision floating point floating point constant E Double precision floating point type 64 bit double precision floating point floating point constant S String type String B Bit type 1 bit data TIP The data size of each data type is determined uniquely by each prefix except S the string type Specifying Data Types You can add a prefix to a device address to specify the data type of the device in a script If you want to use the device D00001 as a word type specify as follows
11. G0101_03 VSD Figure G1 3 Comparison of Different Implementations of a Computational Manipulation Allows using script functions In scripts you can use predefined functions for supporting advanced operations and string manipulations Using these script functions increases programming efficiency Increases program readability Program readability generally decreases as the size of a program grows As a result debugging and maintenance become more difficult Using scripts however increases program readability facilitating debugging and maintenance TIP Scripts are converted into a ladder instruction program and transferred to the CPU In the CPU those ladder instructions are executed in the same way as other ladder instructions The contents of scripts are also transferred to the CPU in a coding format separately from the converted ladder program When a program is uploaded the transferred contents of the scripts are uploaded and restored VON CAUTION Using scripts increases the programming efficiency and program readability However a ladder program converted from a script is not optimized in performance nor minimized in size because the flexibility of data processing is more important in scripts Therefore it is not helpful to enhance the processing speed or reduce the program step count IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G1 4 G1 2 Creating Scripts This section describes the procedure for creati
12. at the beginning of the line and then enter a mnemonic instruction Delimit the operands of the instruction by using space characters Display Ladder Converted from Script TIP Inline mnemonics are converted into ladder instructions and transferred to the CPU module You can add modify or delete inline mnemonics in online editing AN CAUTION You cannot use any end of text comment in inline mnemonics A compile error occurs if used IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 13 VON CAUTION G2 3 3 The following instructions cannot be used in inline mnemonics A compile error occurs if used All input side instructions e g LD AND CMP and NCALL Continuous type application instructions The following output side instructions OUT OUTN OUTW TIM CNT SFTR IL ILC NOP END SUB RET INTP IRET DI El FOR NEXT BRK CBD CBE STRCT STMOV SCALL NMOUT MRET JMP CALL MCALL PARA TPARA ACT and INACT Using the Functions for Ladders in Scripts This section describes how to use the functions of ladder programs in scripts Tag Names You can use tag names in scripts Tag names are used in scripts in the same way as in ladder instructions You must assign addresses to tag names separately from script editing Example B Switch 1 W Data 123 SEE ALSO For details on how to use tag names see Section E1 3 Entering Tag Names and Addresses in FA M3 Programming Tool Wid
13. Figure G10 9 Example and Behavior of the SDEL Function he end of the data to be deleted n1 n2 1 G1011_01 VSD TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character TIP There is no ladder instruction corresponding to the SDEL function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 25 G10 12 SINS String Insertion SINS is a function for inserting one string into another This function inserts string s2 before the n th character in string s1 and stores the obtained string in the return value Return value SINS s1 s2 n Return Value Arguments s1 Description A string into which another string is inserted or the first device number of devices that represent a string into which another string is inserted Prefix L D F Index Constant Modification Expression s2 A string to be inserted into another string or the first device number of devices that represent a string to be inserted into another string n An insertion position Return value E Return Value Arguments Return Value Arguments The string obtained by inserting another string is stored Input Output Range 1 to 2047 characters in string length 1 to 2047 characters in string length Behavior Restrictions If s1 is N
14. W D00001 Prefix Address G0304_01 VSD Figure G3 3 Specifying Data Types TIP If you omit a prefix a relay device is handled as a bit type B and a register device is handled as a word type W AN CAUTION If an index modification is used its additional value is independent of a prefix The additional size is defined depending on whether the indexed device is a register or relay Example W D00001 V001 123 If V001 10 D00011 is 123 W 100001 V001 123 If V001 10 from 100011 through 100026 are 123 IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 17 G3 4 2 Prefixes and Available Devices The types of devices to which you can add a prefix vary depending on each prefix The following table shows the relationship between prefixes and devices Table G3 8 Prefixes and Available Devices Prefix Available Devices XIY IJE LI M T C D B F WIZ RIVIHJAJ UJP W Word type Vi v vi vi vl v _x xlvi vi yvjyvilyvi lyvj vivijviv x L Long word type VIA AAJA lxx vw A A v lvl vw v lv lT vw iW x D Double long word type x x x x x xfxixtlwlyviv wvwt x w xtxlwtx x F Single precision floating point type V v v v v v x x vj vivj v vijvivj viviv x E Double precision floating point type x x x x x x x x v j vilvj v x vix xi vi xx S String type x x x x xftxtxixlvwilvjvi vi vivlvt xilvilv x B Bit type Vivilvl v v v xix xt xt xtx x x xlv x x fx
15. Converting Data Types in this manual IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 4 G3 2 Operators An operator is a symbol that denotes an operation performed on data Each operator is represented as a symbol such as an addition and division used in mathematical expressions in a script SEE ALSO For details on data type conversions that occur in various operations see Section G3 4 3 Converting Data Types in this manual E List of the Types of Operators There are five types of operators as follows Arithmetic operators Comparison operators Logical operators String manipulation operators Other operators G3 2 1 Arithmetic Operators An arithmetic operator returns the result of an arithmetic operation Table G3 1 List of Arithmetic Operators Supported in Scripts Calculates the sum of two values Addition D00001 D00002 D00003 L D00001 L D00013 L D00023 F D00001 F D00013 F D00023 Calculates the difference of two values Subtraction D00001 D00002 D00003 L D00001 L D00013 L D00023 F D00001 F D00013 F D00023 Calculates the product of two values Multiplication D00001 D00002 D00003 L D00001 L D00013 L D00023 F D00001 F D00013 F D00023 Calculates the quotient of two values Division D00001 D00002 D00003 L D00001 L D00013 L D00023 F D00001 F D00013 F D00023 MOD Calculates the remainder of two values D00001 D00002 MOD D00003 L D
16. Script editing Compile with wW 000001 aaal Step 3 G020304_02 VSD TIP When input candidates are shown the auto suggest function narrows down constant name candidates to possible matches as you a type TOUT_B WORD C TOUT_C WORD G020304_03 VSD TIP If the Automatically Display Candidate setting is turned on in the Instruction Instruction Parameter Completion area of the Set up Environment dialog box type and then the first one or more characters of your desired constant name to automatically display matched input candidates SEE ALSO For details on constant names see Chapter E3 Constant Definition in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 16 G2 3 5 Registering and Editing of Constant Definition You can register and edit constant definitions in the Script editing dialog box Registering Constant Definition To register constant definitions in the Script editing dialog box use the following procedure Procedure 1 In the Script editing dialog box click Register Constant Definition Register Constant Definition Constant Name The Register Constant Definition dialog box is displayed Comment Step 1 G020305_01 VSD 2 Enter the constant definition Register Constant Definition information Constant Name TIP TOUT Available values for constan
17. Securely tighten module mounting screws and terminal screws to avoid problems such as faulty operation Tighten terminal block screws with the correct tightening torque Refer to the hardware users manual or the applicable users manual for the appropriate tightening torque Securely lock connecting cables Securely lock the connectors of cables and check them thoroughly before turning on the power Interlock with emergency stop circuitry using external relays Equipment incorporating the FA M3 controller must be furnished with emergency stop circuitry that uses external relays This circuitry should be set up to interlock correctly with controller status stop run Ground for low impedance For safety reasons connect the FG grounding terminal to a Japanese Industrial Standards JIS Class D earlier called Class 3 Ground For compliance to CE Marking use braided or other wires that can ensure low impedance even at high frequencies for grounding Japanese Industrial Standard JIS Class D Ground means grounding resistance of 100 Q max IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 vi Configure and route cables with noise control considerations Perform installation and wiring that segregates system parts that may likely become noise sources and system parts that are susceptible to noise Segregation can be achieved by measures such as segregating by distance installing a filter or segregating t
18. User s FA MsS Manual v I T E S S E FA M3 Programming Tool WideField3 Script IM 34M06Q16 04E vigilantplant YOKOGAWA IM 34M06Q16 04E Yokogawa Electric Corporation 3rd Edition Blank Page Applicable Product Range free Multi controller FA M3 Model Name SF630 MCW FA M3 Programming Tool WideField3 The document number and document model code for this manual are given below Refer to the document number in all communications also refer to the document number or the document model code when purchasing additional copies of this manual Document No IM 34M06Q16 04E Document Model Code DOCIM Media No IM 34M06Q16 04E CD 3rd Edition Dec 2013 AR IM AMOR 10 04 ford Ealdon Dee 20 401300 All Rights Reserved Copyright 2013 Yokogawa Electric Corporation Important E About This Manual This Manual should be passed on to the end user Before using the controller read this manual thoroughly to have a clear understanding of the controller This manual explains the functions of this product but there is no guarantee that they will suit the particular purpose of the user Under absolutely no circumstances may the contents of this manual be transcribed or copied in part or in whole without permission The contents of this manual are subject to change without prior notice Every effort has been made to ensure accuracy in the preparation of this manual However should any errors
19. Arguments Input Output Input Input If n is 0 or less the return value is 1 error Output Processing result 0 Normal 1 Error There is no restriction When an error 1 occurs the operation is not performed and the value before execution is maintained in d Return Prefix X Y l E L M T c D B FIWJZ RIV H A U P Value Ww viviv L viviv s D viviv F viviv E viviv n Ww vlylvylvyv lvlv vlyly lylylvyv lvyv vlvliv L vivilyvivliy YVivivilylyvylyvyli lvyvilvjilylyv d D vivivily v y E vivivily v v Return w vilvivivily vivilyvluvilvilvivjlyl yiy value E Step Counts Prefix Step Count w 84 L 85 D 72 F 82 E 72 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 E Function and Example G8 3 This function calculates the total value of n signed values in a data area starting from s and stores the total value at the addresses starting from d The total value of 16 bit data with a prefix of W is calculated in a 32 bit format The total value of 32 bit data with a prefix of L or F is calculated in a 64 bit format The total value of 64 bit data with a prefix of D or E is calculated in a 64 bit format The return value indicates whether the function is executed normally 0 or an error occurs 1 Example Return v
20. Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 14 G8 7 SQR Square Root SQR is a function for calculating a square root This function stores the square root of s in the return value Return value SQR s Return Prefix Value Description Constant Expression Arguments id L E F E s Index Modification A data value whose square root is calculated or the first s device number of v v v v v v v v devices for which the square root is calculated The square root of s Return The data type of the Vv V V V V V value return value is the same as that of the argument 1 Specify the same prefix for s and the return value E Return Value Arguments Return Value Input Output Arguments Input s20 If s lt 0 an instruction processing error occurs during execution in the CPU Return Output If an instruction processing error occurs during value execution in the CPU the return value is undetermined E Available Devices Arguments Return Prefix xX Y l E L M T C D B FI W Z R V H AT UY P Value WwW v v v v v v v v v v v v v v v v L v v v v v v v v v v v v v v A v s D v v v v v v F v v v v v v v v v v v v v v v v E viviviy v v WwW v v v v v v v v v v v v v v v v L v v v v v v v v v v v v v v v v Return D s l g y P z value F v v v v v v v v v v v v v v v E v v v v v v
21. V001L 100 Compile error SEE ALSO For details on how to enter index modifications see Section E1 2 19 Input and Display of Indexed Devices in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E Indirect Specification You can use indirect specification in scripts When entering an indirect specification device in a script prefix a device with an character as in the case of ladder instructions However there are no script functions corresponding to the indirect address set SET indirect address add ADD and indirect address move MOV instructions Thus you must code these instructions using inline mnemonics if you require their use In addition when you use indirect specification set the initial setting of an indirect address at the beginning of the ladder program Even if the input condition of a script instruction is OFF the inside of the script is scanned Thus when indirect specification is used in the input condition for the inside of the script an instruction processing error occurs during execution in the CPU if the initial setting of the indirect address has not been performed Example W D00001 123 SEE ALSO For details on how to enter indirect specification devices see Section E1 2 21 Input and Display of Indirect Specification Devices in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E TIP The following functions are supported in ladder programs but not in scripts Su
22. conditional expression Correct the type of operands in the conditional expression to the bit type Example IF D00001 gt D00002 IF B X00301 Correct description IF W DO00001 Compile error A data type other than a numeric type W L D F E is passed on the operands of the minus operator Correct the data type to a numeric type Correct description Operands of logical negation operator must be bit type B or integer type W L A data type other than a bit type B or integer type W L is passed to the operand of the logical negation operator NOT Correct the data type to a bit type or integer type Invalid type of operands of binary operator xxx Check the data types of the right and left operands of the binary operator xxx Invalid type of assignment expression right hand value Check the data types of the left and right hand values of the assignment operator Operands of increment decrement operator must be integer type W L A data type other than an integer type W L is passed to the operand of the increment operator or the decrement operator Correct the data type to an integer type Division and remainder calculations are performed using zero Check the operands of the division or remainder calculation IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Message Empty values cannot be assigned Empty values cannot be calculated Invalid cons
23. lt Comparison operations Lowest AND OR XOR Logical product logical sum exclusive OR Assignment IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 3 G3 3 1 G3 8 Control Statements A control statement is used to change the flow of a program by conditionally selecting a different flow of processing by repetitive processing or canceling the processing There are three types of control statements conditional statements repetitive statements and script exit statements Conditional Branch Statements A conditional branch statement contains a combination of an IF and an ENDIF or of a SELECT and an ENDSELECT E IF ENDIF Statement The following types of IF ENDIF statements are supported Single Branch Type IF condition A THEN statement 1 ELSE statement 2 ENDIF If condition A is true statement 1 is executed If condition A is false statement 2 is executed Multiple Branch Type IF condition A THEN statement 1 ELSE IF condition B THEN statement 2 ELSE statement 3 ENDIF If condition A is true statement 1 is executed If condition A is false and condition B is true statement 2 is executed If conditions A and B are false statement 3 is executed In a conditional expression in an IF statement you can use the LDU or LDD script functions to specify a rising or falling edge as a condition In the following examples statement 1 is executed on rising and falling edges of X00301
24. of a word data 16 bits as the first character the lower byte 8 bits as the second character SEE ALSO The RIGHT function behaves in the same way as the SRIT instruction in ladder instructions For details on the SRIT instruction see Section 3 12 8 String Left SLFT String Right SRIT in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 21 G10 10 LEFT String Left LEFT is a function for extracting a substring from the left side of a string This function extracts n characters from the left side of string s Return value LEFT s n Return Prefix Index Value Description Constant Expression sain cat Arguments Ww L D F E S B Modification A source string or the s first device number of Vv P Vv Y devices that represent a source string The number of n characters in bytes to v v v v be extracted Return The extracted string v value eae E S E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If s is NULL or the string length is greater than s characters in 2047 an instruction processing error occurs string length during execution in the CPU Input 1 2047 If the number of characters to be extracted n is greater than the string length specified by s an instruction processing error occurs during execution in the CP
25. s 1 s 2 s 3 s 4 s 5 Example d RTRIM s 123456 d Example of the sequence of s 123456 we 4 2 3 4 5 6 wt a 123456 Delete trailing spaces End of the string Null d 1 d 2 d 3 G10 33 Resultd 123456 wt i i 2 3 4 5 P End of the string 6 00 Null G1015_01 VSD Figure G10 14 Example and Behavior of the RTRIM Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character TIP There is no ladder instruction corresponding to the RTRIM function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 34 G10 16 LTRIM Leading Space Deletion LTRIM is a function for deleting leading spaces from a string Return value LTRIM s Return Prefix Index Pisa is Description W L D F E s B Constant Expression Modification A string or the first s device number of a v v v v string Return The obtained string v value E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If s is NULL or the string length is greater than characters in 2047 an instruction processing error occurs string length during execution in the CPU s ve If the string specified by s contai
26. the return value is 1 error Output There is no restriction Specify the same prefix as s Processing result 0 Normal When an error 1 occurs the operation is not performed 1 Error and the value before execution is maintained in d W v v v L v v v D v v v F viviy E v v v Ww v v v Ww v v v L v v v D v v v F viviy E v v v Return w vivly value IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 5 E Step Counts Prefix Step Count wW 75 L 71 D 76 F 72 E 76 4 In addition 21 steps are used for each script instruction E Function and Example This function searches for the maximum value of n signed data values in a data area starting from s and stores the maximum value at the addresses starting from d Example Return value MAX s 10 d s 671 p 1666 s 1 225 Search for the maximum s 2 456 value s 3 1666 s 7 864 s 8 631 s 9 1235 G0802_01 VSD Figure G8 2 Example and Behavior of the MAX Function TIP There is no ladder instruction corresponding to the MAX function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 6 G8 3 MIN Minimum Value MIN is a function for searching for a minimum value This function searches for the minimum value of n values in a data area starting from s Return value MIN s
27. 0 afc 0 0 0 ead sais Hasse ais eaaule see den DOOO2 tsessevsssiasisinee canuiennd gt lt sieidid ounbigadsleuinsesislenuds DOOOT se tesscssecesscssaceseens gt Represents 2 0 40000000 ieee ace 0 0 1 i 1 1 il 0 1 ic 1 0 Jo 0 0 x 1 0 ae 1 1 ile 0 1 1 Represents 1 41421356 3FB504F3 G0808_01 VSD Figure G8 8 Example and Behavior of the POW Function TIP If the value of power exceeds the number range allowed for the prefix of the return value only a part of the result within the number range for the prefix is stored in the return value TIP There is no ladder instruction corresponding to the POW function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 18 G8 9 SIN Sine SIN is a function for calculating a sine value This function stores the sine of an angle of s in radians in the return value Return value SIN s Return Prefix index Scan n Description W L D F E s B Constant Expression Modification An angle data in radians whose SIN value is calculated or 3 the first device number d of devices for which the SIN value is calculated The sine value obtained Return for s The data type of the v v value return value is the same as that of the argument E Return Value Arguments Return Value
28. 1 The function converts a decimal string into a numeric value in a BIN format You can specify a sign by the first character To specify a positive sign specify a number string starting with 2B or 0 30 or specify a number string without any sign characters You can specify more than one 0 at the beginning of the string To specify a negative sign specify a number string starting with 62D An error occurs if the conversion result cannot be represented as a word or long word value Example of the sequence of s 12345 s z 4 s 1 2 3 s 2 4 5 s 3 00 lt End of the string Null G1001_01 VSD 3 When n 2 The function converts a hexadecimal string into a numeric value in a BIN format Example of the sequence of s ABCD S 7 B sti C D s 2 00 lt End of the string Null G1001_02 VSD 4 When n 3 The function converts a decimal string into a numeric value in a BCD format Example of the sequence of s 6789 s 6 7 sti 1g 19 s 2 00 lt End of the string Null G1001_03 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 4 5 When n 4 Valid only for a long word instruction The function converts a number string in the following format into a single precision floating point value sAAAA BBBB S Sign To specify a positive sign 62B or a space character 20 To specify a negative sign
29. 2D at the beginning of the conversion result and if s is a positive value or O the function returns the conversion result without adding any sign character at the beginning of the result TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 7 G10 3 SMOV String Move SMOV is a function for transferring string s to d SMOV s d Return Prefix index Value Description Constant Expression a Ar uments L D F E S B Modification A string to be s transferred or the first Vv P Vv P device number of a string to be transferred d The first device number Vv V of a destination Return No value is returned value E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If s is NULL or the string length is greater than s characters in 2047 an instruction processing error occurs string length during execution in the CPU d Output The destination device number Return N A value E Available Devices Return value 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 8 E Function and Example This function
30. 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 3 Bit Assignment Statements A bit assignment statement assigns a bit constant or the result of a bit operation on the right hand side to the left hand side Example B 100001 1 For assigning a bit constant B 100001 B I00002 AND B I00003 OR B 100004 For assigning an operation result B 100001 W D00001 lt W DO0002 For assigning a comparison result B 100001 LDU B X00301 For assigning the result of a function AN CAUTION Observe the following points when using assignment statements If the data types of the right and left hand sides are different the assignment statement generates an error Example W D00001 S D00001 A compile error occurs W D00001 L D00001 A compile error occurs L D00001 W D00001 A compile error occurs F D00001 FF7FFFFF A compile error occurs if a decimal or hexadecimal constant is assigned to a floating point type L D00001 1 2 A compile error occurs if a floating point constant is assigned to an integer type If the left hand side cannot be assigned the assignment statement generates an error In the following example it is not possible to assign a value to the value 5 and the assignment statement generates an error Example 5 W D00001 A compile error occurs SEE ALSO Operating between different data types requires the conversion of one or more data types For details on converting data types see Section G3 4 3
31. 75 Unal error is displayed 3 If there is any error the Results of Program Syntax Checking window is displayed Pa amy LADDER BLOCK 02 BLK02 MAIN PROGRAM BLK_MAIN SCRIPT BLOCK 01 SCRIPTO1 B macro List OUTPUT MACRO MAC_WIDE config Component Blocks 1 maIN PROGRAM BLK_ lt 2 3 offine E onine Step 3 G0502_02 VSD E 4 To jump to an error position double G Edit Block BLK001 BLK001 click the error message n age H corresponding to the position you p want to jump to in the Results of Program Syntax Checking window gt The display jumps to the relevant place in the ladder program that contains a script instruction with the syntax check error Step 4 G0502_03 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 8 TIP It is not possible to jump from a syntax check result to a relevant error position in the script Correct the script based on the script instruction that contains the error SEE ALSO For details on syntax checks see Chapter D3 Building and Managing a Project in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 9 E Syntax Check Error Messages The following table shows the list of syntax check error messages related to scripts Other error messages will be displayed for example if an instruction pa
32. A 00 s1 1 3 4 s1 2 5 6 n 9 s1 3 00 End of the string Null Result d AAA123456 d A A d 1 A 1 d 2 2 3 d 3 4 S d 4 6 00 End of the string Null PE E Figure G10 17 Example and Behavior of the LPAD Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character TIP There is no ladder instruction corresponding to the LPAD function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 40 G10 19 SDIST String to Byte unit Characters SDIST is a function for dividing a string into byte units SDIST s d Return Prefix Value Description Constant Expression Arguments al L D F E s B Index Modification A string to be divided or s the first device number v v v v of the string The first device number of the data obtained by Vv d dividing the source string Return No value is returned value E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If s is NULL or the string length is greater than s characters in 2047 an instruction processing error occurs string length during execution in the CPU Output The data obtained by dividing the source string is stored If an instruction processing error occurs the value be
33. Branch Statements Processing between THEN and ENDIF is performed when the condition specified by conditional expression s is met Prefix Constant Expression ne L D F E S B Modification v v v Return Value Behavior Restrictions Arguments IF s THEN Return Value Arguments Description W A bit for checking whether a condition is met E Return Value Arguments There is no restriction No value is returned E Available Devices Arguments Return Prefix X Y 1 E LC M T C D B FI WI Z R V H AYU P Value faa Mee eae E Step Counts Prefix Step Count t 2 B 7 4 In addition 21 steps are used for each script instruction 2 The step count varies depending on the contents of the IF statement IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 3 E Function and Example The program execution is branched depending on whether condition s is met The following types of conditional branch statements IF statements are supported 1 Single Branch Type IF condition A THEN statement 1 ELSE statement 2 ENDIF If condition A is true statement 1 is executed If condition A is false statement 2 is executed 2 Multiple Branch Type IF condition A THEN statement 1 ELSE IF condition B THEN statement 2 ELSE statement 3 ENDIF If condition A is true statement 1 is executed If condition A is false and condition B is true statement 2 is
34. Carry G0905_02 VSD Figure G9 5 Example and Behavior of the RSFTN Function In this example the function behaves as follows When the device to be shifted is a register the first m bits from the zeroth bit are shifted and if m is 17 or larger the lower m 16 bits of the next device are also shifted in addition to the 16 bits of the device The values of the bits not shifted in this example the second to 15th bits of D0002 are unchanged when the instruction is executed SEE ALSO The RSFTN function behaves in the same way as the RSFTN instruction in ladder instructions For details on the RSFTN instruction see Section 3 6 2 Shift m bit Data by n Bits RSFTN LSFTN in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 12 G9 6 Bits LSFTN is a function for shifting an m bit length data left by n bits LSFTN d m n Return Value Arguments Description The first device number of devices for which the shift operation is performed The bit length m bit length of a data to be shifted Constant Expression LSFTN Left Shift m bit Length Data by n Index Modification n The number of bits n bits to be shifted Return value E Return Value Arguments Return Value Arguments No value is returned Input Output Input Output Range Behavior Restrictions There is no
35. D0101 IEEE code of 1 1 1 1 th 1 111 qo ih di 1 1 if 1 ioh 1 f lf ooo ool Represents double precision floating point 1 234 3FF3 BE76 C000 0000 G0926_01 VSD Figure G9 27 Example and Behavior of the FTOE Function SEE ALSO The FTOE function behaves in the same way as the FTOE instruction in ladder instructions For details on the FTOE instruction see Section 3 8 10 Float to Double precision Float FTOE in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 57 G9 27 ETOF Double Precision Float to Float ETOF is a function for converting a double precision floating point data into a single precision floating point data Return value ETOF s Return Prefix index Value Description Constant Expression et at Arguments Ww L D F E S B Modification A data to be converted or the first device s number of devices v v v v whose data are converted Return Conversion result Y V value E Return Value Arguments Return Value Input Output Arguments There is no restriction The processing result is stored Arguments Return Value Return value Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Ed
36. D1001 isttevesscsesscrawsitnens j Represents 1 7320508 3FDDB3D7 3 E cae o o ha ili h 00 olo 1 1 aC 0 0 of 0 1 of 0 0 ipo 0 10 PERERA R DOOO2 ereti erneertssoseenscacs i CELTE DOOO erriren sinini Represents 1 047197 3F860AQ92 a G0814_02 VSD Figure G8 14 Example and Behavior of the ATAN Function SEE ALSO The ATAN function behaves in the same way as the FATAN instruction in ladder instructions For details on the FATAN instruction see Section 3 3 24 TAN FTAN TAN FATAN in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 30 G8 15 ANDV Logical AND ANDV is a function for performing a logical product operation Return value ANDV s1 s2 Return Prefix Value Description W L D F E s B Index Constant Expression Modification Arguments A data used in the logical product or the s1 first device number of v v v v v v y devices used as a data in the logical product A data used in the logical product or the s2 first device number of v v v v v v v devices used as a data in the logical product Return The obtained logical Vv VY value product value 1 Specify the same prefix for s1 s2 and the return value If B is specified for s1 and s2 no constant or expression can be used for s2 or s1 E Return Value Arguments Return Value Input Output Range Behavior Restri
37. Description wL D F E 5 Constant Expression Modification A value that specifies n i the format of the v v v v converted string A binary data or the s first device number of a v v v v v v binary data Return The obtained string 7 value 1 Even if s is W L or F specify W for n E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 0 5 If the specified n is less than 0 or greater than or n equal to 6 an instruction processing error occurs during execution in the CPU 5 Input Numeric data A numeric value or the device number of a device in which a numeric value is stored R Output The conversion result is stored eturn f valu If an instruction processing error occurs an indefinite value is returned E Available Devices gt x lt lt Prefix N SENESE SENESE SA RA XT NESS SENSES SINE SNES SENSES Return value o nic sis E Step Counts Prefix Step Count NE NPN 4 In addition 21 steps are used for each script instruction NESE NISNISN NE NPN NE SNES NL NEN SSN NESE SNPS SENSIS 2 Sl Ho RT RL IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 6 E Function and Example This function converts a numeric data s into a string in a format specified by n and writes the result in return value d This function can
38. EXITSCRIPT Script Exit Statement in this manual For details on nesting see Section G3 3 4 Restrictions on Control Statements in this manual IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 12 G11 4 EXITSCRIPT Script Exit Statement This statement exits the script without executing the part written after the EXITSCRIPT statement EXITSCRIPT E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments ae No value is returned E Available Devices 1 In addition 21 steps are used for each script instruction TIP The EXITSCRIPT statement turns off its input condition and executes the subsequent script statements by turning off the start script relay SEE ALSO For details on the start script relay see Section G2 1 2 Displaying a Script in the Ladder Format in this manual IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 13 E Function and Example The script is exited without executing the part written after the EXITSCRIPT statement statement 1 IF condition A THEN EXITSCRIPT ENDIF statement 2 Statement 1 is executed After that if condition A is true the script exits and statement 2 is not executed If condition A is false statement 2 is also executed TIP You can use the EXITSCRIPT statement with branch statements IF and SELECT statements and repetitive statements FOR statements Example The following example exits the script with
39. Edition Dec 25 2013 00 G8 37 E Function and Example This function performs an inversion of a 1 bit 16 bit 32 bit or 64 bit data and assigns the result to the specified device Not 1 bit is used with a prefix of B when an inversion of a 1 bit data is performed Not Word is used with a prefix of W when an inversion of a 16 bit data is performed Not Long word is used with a prefix of L when an inversion of a 32 bit data is performed Not Double Long word is used with a prefix of D when an inversion of a 64 bit data is performed The result of each type of inversion has the number of bits shown in the following table The operation result is assigned to the devices starting from the first device specified by return value d Instructions Not Word 1 word instruction 16 bits 32 bits 64 bits Specification Item Not 1 bit 1 bit instruction Not Long word Not Double Long word 2 word instruction 4 word instruction Number of bits of the operation result Device s to which the operation result d 1 d d 3 d 2 d 1 d is assigned Example W D1001 NOTV W D0001 D0001 The eE ET m D1001 0 1 0 1 1 0 1 0 1 0 1 0 0 0 0 1 G0818_01 VSD Figure G8 18 Example and Behavior of the NOTV Function TIP There is no operator or ladder instruction for 64 bit logical operations Use this function if you want to perform a 64 bit logical
40. Example IF LDU B X00301 THEN for executing statement 1 on a rising edge of X00301 statement 1 ENDIF IF LDD B X00301 THEN for executing statement 1 on a falling edge of X00301 statement 1 ENDIF IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 9 AN CAUTION You can nest IF statements by including one IF or SELECT statement within an IF statement The maximum nesting level is eight A compile error occurs if the nesting level of both IF and SELECT statements exceeds the maximum You can omit an ELSE and statements under the ELSE in both single and multiple branch types but cannot omit any THEN or ENDIF A compile error occurs if a THEN or ENDIF is missing In multiple branch types a space character is required between the ELSE and IF in each ELSE IF A compile error occurs if the space character is missing There is no limitation on the number of ELSE IFs There is no limitation on the number of statements in an IF statement in both single and multiple branch types SEE ALSO For details on the IF statement see Section G11 1 IF ENDIF Conditional Branch Statements in this manual For details on the LDU and LDD functions see Sections G7 1 LDU Logical Differential Up and G7 2 LDD Logical Differential Down in this manual For details on nesting see Section G3 3 4 Restrictions on Control Statements in this manual E SELECT ENDSELECT Statement The format of a SELECT ENDSELECT stat
41. H a Cancel buttons S hon rete ieee macro tist Step 4 G0201_04 VSD 5 After editing the script click OK The Fle Ea Fed Vow Pole One Debates Teas Wren Hep ei B B o amp ita cof 3e ew alee Ae FH Hea vaa alel oo edited contents are confirmed the Te g ro a tn a ea S 4 ae z z Algal Po Glee 5 Safin sie ale S a script is compiled and the Script x me JE Project C Edit Block BLK001 BLK001 editing dialog box closes Ee n Common Tag Name Defin gt The results of the compile are displayed Same P Project Settings Configu in the Script tab on the output window haai ra oo ee Ei Display Ladder Converted from Script E a m TIP Clicking Cancel displays a message box to confirm whether to finish the editing Clicking No discards all contents you edited and restores the script to the state before editing Click Yes to continue the editing Block BLK001 Compiling script 2011 10 4 17 01 31 Block BLKO01 T0003 Error 0 Serious Warning 0 Warning 0 Compile results Line 1 Step 22 Step 5 3 3020105 VSD TIP If the contents of the script you edited contain one or more errors the Script tab on the output window displays one or more compile errors and you must correct the contents of the script You can continue to the next operation
42. I O Comment for a ladder program AN CAUTION The following script items are not monitored in the Edit Mnemonics Script pane Return values from functions Indexed devices Indirect specification devices Structures and structure members Constant names Script monitoring is not performed for inline mnemonic lines Script monitoring cannot be used in an online edit screen SEE ALSO For details on program monitoring see Chapter K1 Using the Debugging Functions in FA M3 Programming Tool WideField3 Online IM 34M06Q16 03E For details on online editing see Chapter K2 Online Edit in FA M3 Programming Tool WideField3 Online IM 34M06Q16 03E G5 4 2 Hiding Monitor Line You can hide monitor lines in the script monitoring pane m Hiding Specified Monitor Line To hide the specified monitor line click the icon or press the Enter key on the monitor line To show a hidden monitor line click the icon or press the Enter key on the script line Monitor lines can be set to hidden state f f Set up speed when x301 is ON IF LOUCB X00301 THEN B x00301 O Mov i0000 D00021 movc sooo DO0OZ22 B 100201 ON f 4et up speed flag ON E B 100201 OFF B I00201 G0504_06 VSD Figure G5 7 Hiding Specified Monitor Line IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 16 m Hiding All Monitor Lines To hide all monitor lines at one time click Hide All Monitors from the right
43. Input Output Arguments s Input There is no restriction Return Output The processing result is stored value E Available Devices EET Ea JENE E Step Counts Prefix Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 19 E Function and Example This function calculates the SIN sine value single precision floating point value of an angle given in radians The relational expression is as follows Return value SIN s1 s1 An angle in radians for which SIN is calculated Return value The obtained SIN value 1 lt Return Value lt 1 Return value G0809_01 VSD Example F D1001 SIN F D0001 When F D0001 3 F D1001 SIN 60 SING gt D0001 IEEE code D1001 IEEE code Represents 0 8660254 3F5DB3D8 Ey G0809_02 VSD Figure G8 9 Example and Behavior of the SIN Function SEE ALSO The SIN function behaves in the same way as the FSIN instruction in ladder instructions For details on the FSIN instruction see Section 3 3 22 SIN FSIN SIN FASIN in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 20 G8 10 COS Cosine COS is a function for calculating a cosine value This function stores the cosine of an angle of s in radia
44. NPN NESE NSN NINES NEN NINE SENN SNES NE NPN NESE NINN NEN SNES STENNIS If s gt 0 the value is stored in d without any modification If s lt 0 the value is stored in d after the sign of the value is inverted Example Return value ABS s d S 12345 Figure G8 4 TIP Sign inversion 12345 G0804_01 VSD Example and Behavior of the ABS Function There is no ladder instruction corresponding to the ABS function NE NP NESE SPN SNNPNESSN IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 10 G8 5 LOG Logarithm LOG is a function for calculating the real value of the natural logarithm of a floating point value Return value LOG s Return Prefix Index Value Description Constant Expression ar i Arguments Ww L D F E S B Modification A floating point real number or the first s device number of a v v v v floating point real number Return The obtained natural Vv value logarithm E Return Value Arguments Return Value Input Output Behavior Restrictions Arguments If s lt 0 an instruction processing error occurs during execution in the CPU If an instruction processing error occurs during execution in the CPU the return value is undetermined E Available Devices Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E
45. Output There is no restriction R Processing result 0 Normal When an error 1 occurs the operation is not eturn fe ty value 1 Error performed and the value before execution is maintained in d E Available Devices Prefix IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 34 E Step Counts Prefix Step Count Ww 324 4 In addition 21 steps are used for each script instruction E Function and Example This function deletes a part of byte data This function deletes n3 bytes starting from the n2 th byte in n1 bytes of data starting from s and stores the remaining data to addresses starting from d as a set of continuous data n2 is a byte number counted from the first byte of the data s where n2 is 1 at the first byte The return value indicates whether the function is executed normally 0 or an error occurs 1 Example Return value HDEL s n1 n2 n3 d The beginning of the Destination 1 data to be deleted n2 Destination s d Transfer the remaining data s 1 as a set of continuous data d 1 s 2 _ d2 st3 d 3 s 4 poo d 4 The end of the data to be deleted n2 n3 1 n1 byte data G0915_01 VSD Figure G9 16 Example and Behavior of the HDEL Function TIP The functions which process in byte 8 bits units handle the upper byte of a word data 16 bit
46. Root SQR D Section 3 3 20 Square Root Float FSQR and Section 3 3 21 Square Root Double precision Float FSQR E in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 16 G8 8 POW Power POW is a function for calculating a power Return value POW s1 s2 Return Prefix index ta z Description w L D F E s B Constant Expression Modification The base of a power calculation or the first s1 device number of the v v v v v v y base of a power calculation The exponent of a power calculation or the s2 first device number of v v v v v the exponent of a power calculation Return The obtained power Vv VY VY value value 4 If you specify W L or D for the prefix of s1 specify W for the prefix of s2 If you specify F for the prefix of s1 specify F for the prefix of s2 2 Specify the same prefix for s1 and the return value E Return Value Arguments 1 When s1 and s2 are integers W L D Return Value Arguments Input Output Behavior Restrictions There is no restriction s2 Input s220 If s2 lt 0 the return value is 0 Return Output The processing result is stored value 2 When s1 and s2 are floating points F Return Value Input Output Range Behavior Restrictions Arguments s1 Input s120 If s1 lt 0 an instruction processing error occurs during executio
47. Type conversion from double precision floating point E to word W Example W D00010 W E D00001 A compile error occurs W D00010 W F E D00001 Through single precision floating point type F IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 18 Type conversion from double long word D to single precision floating point F Example F D00010 F D D00001 A compile error occurs F D00010 F E D D00001 Through double precision floating point type E A CAUTION A sign extension is performed if a type conversion is performed among a word W integer long word L integer and double long word D integer converting from a smaller data size integer to a larger data size integer If a conversion is performed from a larger data size integer to a smaller data size integer a part of the original value may be lost When a type conversion is performed from a double precision floating point E value to a single precision floating point F value a part of the original value may be lost A CAUTION Observe the following points when coding a multiplication In ladder instructions the multiplication result is a long word L value if the multiplicand in a multiplication is a word value W If the multiplicand in a multiplication is a long word L value the result is a double long word D value In scripts the type of a multiplication result is the same as that of the multiplicand in the multiplication Thus you must conv
48. Ww L D F E S B Modification A data to be converted or the first device s number of devices v v v v whose data are converted Return Conversion result Vv V value E Return Value Arguments Return Value Input Output Arguments There is no restriction The processing result is stored Arguments Return Value Return value 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 48 E Function and Example This function converts a single precision floating point data into a 16 bit integer data This function is used before the result of a floating point operation is used as an integer Example W D1001 FTOW F D0001 WV ieee ah 0 o of ool 1 1 o ofo 1 o sfo oF spo ot 9 o fo Represents 333 3333 43A6AAAB o fei a 0 o olo 0 0 To 110 of 1 o 1 _ Represents an integer 333 014D EN Figure G9 23 Example and Behavior of the FTOW Function SEE ALSO The FTOW function behaves in the same way as the FTOI instruction in ladder instructions For details on the FTOI instruction see Section 3 8 8 Float to Integer FTOI Float to Long word Integer FTOI L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 49 G9 23 FTOL Float
49. an overflow occurs when the absolute value of a value of s 8000 is calculated the return value is 1 error 80000000 and An overflow occurs for the following integers 8000000000000000 32768 8000 if the type of s is W 2147483648 80000000 if the type of s is L 9223372036854775808 8000000000000000 if the type of s is D Specify the same prefix as s d Output There is no restriction Specify the same prefix as d Return Processing result 0 Normal When an error 1 occurs the operation is not performed value 1 Error and the value before execution is maintained in d 2 When s is floating point F E Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Specify the same prefix as d d Output There is no restriction Specify the same prefix as s Return Processing result 0 Normal When an error 1 occurs the operation is not performed value 1 Error and the value before execution is maintained in d IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 9 E Available Devices wW L D F E W L D F E ue a E Step Counts Prefix Step Count wW 44 L 44 D 52 F 33 E 38 4 In addition 21 steps are used for each script instruction E Function and Example This function stores the absolute value of s at the addresses starting from d NEN NIN SYN NSN SIS NE
50. be eaesas 4 4 i h Peara 4 4 bean 0002 I 1 1 1 1 1 1 1 1 I 1 1 i i 1 i I CMT S TS 1 0 Script root program Converted ladder program D00001 Script program Converted ladder program 0026 ST0001 G0204_02 VSD Figure G2 7 Script Printing Format Both Script Programs and Converted Ladder Programs Are Printed IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 20 Procedure 1 Make sure that the project is opened 2 Select File Print from the menu The Print Setup dialog box appears 3 Click Block Macro for Print Layout Settings from the tree gt The list of setup items for print layout is displayed 4 Click Script in the setup items for print layout 5 If you want to print scripts turn on the Print checkbox and select either Script Program Only or Print Converted Ladder Also Scripts are printed in the selected format gt If you print blocks or macros scripts are printed following ladder programs VON CAUTION Print Setup Step 5 7 Compact printing Printing is performed with lengthwise pages filed as much as possible JT BAN Printing C Print Converted Ladder Also Balloon Comment Hidden Circuit Read from Default Printer Setup Save Settings Print Cancel G0204_03 VSD
51. cannot edit mnemonics or scripts in a comparison results window Ay CAUTION In offline editing of a ladder program the script contents corresponding to the ST number that is disappeared from the ladder program will be automatically deleted when the description of the script instruction is changed by editing operations such as deleting lines deleting overwriting the instruction and changing the ST number If the script contents are deleted the following message will be displayed To recover the contents perform Edit Undo If reusing the script leave that ST number of the script instruction intact WideField3 f The following script contents have been deleted because the ST number of the script instruction disappeared Perform Edit Undo to recover the contents TF reusing the script leave that ST number of the script instruction intact sTo001 5ST0002 G0201_05 2 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 1 2 Displaying a Script in the Ladder Format G2 6 You can display the contents of the coded script converted into a ladder program AY CAUTION You cannot edit program contents in the ladder conversion window E Display Contents in the Ladder Conversion Window A work device used in the script The identification instruction circuit that represents the beginning of the script The execution logic circuits of the script The identification instruction circuit that represents th
52. click menu of the script pane To show all hidden monitor lines click Show All Monitors All monitor lines can be set to hidden state ylisddes Convenes fomSeict f f Set up speed when x301 is ON IF LDUC B X00301 THEN Forced Set FS mov 1o0000 D00021 Forced Res Shift F5 movesooo D00022 E Sii B I00201 ON Set up speed flag ON Cancel Forced Set Reset F6 ELSE P Se 200201 a SEE Cancel All Forced Set Reset Shift F6 ENDIF iN Change Word Data F7 Change Long Word Data Shift F7 2 3 4 5 6 eZ 8 Change Double Long Word Data Jump to Device Monitor Alt S v Decimal Alt Shift D Hexadecimal Alt Shift H Hide All Monitors Show All Monitors Hide S Monitors n P G0504_07 VSD Show and hide all monitor lines Figure G5 8 Hiding All Monitor Lines IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G6 G6 1 Script Functions This chapter describes script functions Script functions can be broadly categorized as follows Basic Functions The basic functions correspond to the basic instructions in ladder instructions The details are described in Chapter G7 Computational Functions The computational functions correspond to the arithmetic instructions and logical instructions in ladder instructions The details are described in Chapter G8 Data Processing Functions The data processing functions correspond to the data transfer instructions data process
53. comment 3 Press the Enter key to confirm the comment gt The end of text comment is confirmed and the position cursor moves to the next line TIP After the end of the script line enter followed by a comment x Display Ladder Converted from Script IF p00001 lt 0 THENC If the data is negative set it to o gt G020301_03 VSD In addition to improving the readability of a program you can also use comments to suppress some lines in a script when a compile error occurs in the script or when the script does not work correctly on a CPU module Comments are stored in a CPU module when a program is downloaded You can add modify or delete comments or indents in online editing IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 11 E Indents Use this function to insert space characters at the beginning of a line in a script program You can use indents to distinguish the range of a control statement or a set of statements for specific processing from other parts The following describes the procedure for entering an indent Procedure 1 Click the Edit Mnemonics Script pane Enter space characters for indent 2 Move the position cursor to the cones idea tue laos Display Ladder Converted from Script desired number of space and tab IF D00001 lt 0 THEN If the data is nega 0 characters gt The line is indented as many number of space and tab characters as you entere
54. convert a long or long word integer or single precision floating point value into a number string You can specify decimal hexadecimal or real as the format of the obtained number string Example d STR n s 1 When n 0 or 1 Both 0 and 1 specify the same behavior The function converts a numeric value in a BIN format into a decimal string A sign character is added at the beginning of the string A space character 20 is added for a positive value or 0 2D is added for a negative value 2 When n 2 The function converts a numeric value in a BIN format into a hexadecimal string 3 When n 3 The function converts a numeric value in a BCD format into a decimal string 4 When n 4 Valid only when s is a single precision floating point F value The function converts a single precision floating point value into a string in the following format sAAAA BBBB s Sign For a positive sign a space character 20 For a negative sign 2D AAAA Integer part a four digit number A 0 to 9 30 to 39 BBBB Decimal part a four digit number B 0 to 9 30 to 39 Sequence of d d s A d 1 A A d 2 A ni Point 2E d 3 B B d 4 B B d 5 00 lt End of the string Null G1002_01 VSD 5 When n 5 The function basically behaves in the same way as in 1 above However if s is a negative value the function adds
55. converted ladder program is a set of circuits that cannot be edited in online editing and so on Procedure 1 Start program monitoring 2 Select View Display Ladder Converted from Script from the menu Aconverted ladder program is displayed SCRIPT 1003 D00003 123 Fao000T 00007 245 245 D0000 000004 245 246 below each script instruction All script Monitor Block BLKO01 BLKO01 Display Real Address instructions in the block are converted Th into and displayed as ladder programs ono Le 00003 100833 TIP tat au In the initial state of program monitoring a ee ladders converted from scripts are displayed noone Zias ee To hide the converted ladders select View nme AE lat mow Display Ladder Converted from Script from 00007 D00002 D00003 123 the menu again 00008 EREI wA 3 The converted ladder programs are ie monitored For the converted ladder Steps 2 and 3 programs you can use debugging functions including the forced set and forced reset functions and the change device current value function FEAL G0503_02 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 11 SEE ALSO For details on program monitoring see Chapter J2 Program Monitor in FA M3 Programming Tool WideField3 Online IM 34M06Q16 03E For det
56. d 2 Even if s and d are L D F or E specify W for the return value and n E Return Value Arguments 1 When s and d are 16 bit data W Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Specify the same prefix as d d Output There is no restriction Specify the same prefix as s Input 0 lt n lt 32767 If the specified n is 0 transferring data is not performed n and the return value is 0 normal If the specified n is less than 0 the return value is 1 error Return Processing result 0 Normal When an error 1 occurs the operation is not performed value 1 Error and the value before execution is maintained in d 2 When s and d are 32 bit data L F Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Specify the same prefix as d d Output There is no restriction Specify the same prefix as s Input O lt n lt 16383 If 0 is specified the transfer result is set to 0 n If the specified n is less than 0 or greater than or equal to 16384 the return value is 1 error Return Processing result 0 Normal When an error 1 occurs the operation is not performed value 1 Error and the value before execution is maintained in d 3 When s and d are 64 bit data D E Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Specify the sam
57. data type of the v v value return value is the same as that of the argument E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input If a value outside of the valid range is entered an s instruction processing error occurs during execution in the CPU Output The processing result is stored Return value If an instruction processing error occurs during execution in the CPU the return value is undetermined E Available Devices Step Count 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 29 E Function and Example This function calculates the single precision floating point value of ATAN arc tangent of a real single precision floating point number in radians The relational expression is as follows Return value TAN s1 s1 A real number data whose TAN is calculated lt s1 lt Return value The obtained TAN value in radians pated G0814_01 VSD Example F D1001 ATAN F DO0001 When F D0001 13 F D1001 ATAN y3 TAN TAN 3 3 v AA v V AA AA AA ices phh hhb h ehu h eh eh h e ol 4 1 4 h eh ehi r E D002 te sndecetecsesees cers ce ns gt Wevbbsevbsded teas eteane te
58. dialog box fields commands and buttons Example Select File New from the menu bar Click OK Representations in WideField3 Figures and Screens Screen examples given in this manual assumes that the application is running under Windows XP operating system environment Under Windows Vista Windows 7 and Windows 8 operating systems you may observe slight differences such as differences in icon names or application names Some figures in this manual may for reasons of convenience be emphasized or simplified or parts of it may be omitted Some screen images in this manual may differ from actual screens due to differences in the operating machine environment Notation for Procedures Procedure pages are laid out with the procedure steps on the left and the corresponding screen images on the right Procedure User actions are displayed in bold Description of the results of user actions is provided after the mark Screens The procedure step s corresponding to a screen image is indicated by step numbers below the screen Function Keys and Shortcut Keys In addition to using a mouse you can operate WideField3 menus using function keys and shortcut keys In general this manual describes operations using a mouse and does not include equivalent operations using function keys or short cut keys IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 xi E Other User s Manuals You should read the following user s manuals _F
59. error occurs during execution in the CPU If s2 is NULL or the string length of s2 is greater than 2047 an instruction processing error occurs during execution in the CPU Return value E Available Devices The obtained string is stored If an instruction processing error occurs an indefinite value is returned Arguments Return Prefix X Y l L M T Cc D B F W Z R V HJAJU Value s1 S v v v v v v v v v n w v v v v v v v v v v v v v v v s2 S v v v v v v v v v Return S ara aearar ar viv value IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 39 E Step Counts Prefix Step Count S 199 4 In addition 21 steps are used for each script instruction E Function and Example This function adds a character specified by s2 on the left side of string s1 as many times as needed until the total string length reaches n and then the function writes the obtained string in return value d Specify a character for string s2 and then the function adds the character repeatedly as needed If you specify two or more characters for string s2 the function extracts only the first character and adds it to the source string repeatedly as needed Example d LPAD s1 n s2 When s1 123456 n 9 and s2 A d AAA123456 Example of the sequence of s 123456 s1 1 2 s2
60. error occurs during execution in the CPU if the nesting level of IL ILC in both scripts and ladder programs exceeds 8 The FOR NEXT instruction is used when a FOR statement is converted into a ladder program An instruction processing error occurs during execution in the CPU if the nesting level of the following exceeds 16 FOR statements in scripts Script functions for which FOR NEXT instructions are used in functions FOR NEXT instructions in ladder programs Script functions for which FOR NEXT instructions are used in functions are as follows BSET HCHN HDEL HMOV LPAD LTRIM MAX MIN POW RPAD RTRIM SDIST SUM SUNIT TRIM IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 15 Nesting for Branch Statements IF and SELECT Statements The maximum nesting level for branch statements IF and SELECT statements is eight A compile error occurs if the nesting level of both IF and SELECT statements exceeds the maximum IF condition A THEN statement 1 m First Nesting Level SELECT condition B CASE constant X statement 2 a Second Nesting Level CASE constant Y statement 3 DEFAULT IF condition A THEN statement 4 m r Third Nesting Level l l Up to the eighth nesting T Jeeves allowed l ENDIF l ENDSELECT
61. for deleting a part of specified byte data This function deletes n3 bytes starting from the n2 th byte in n1 bytes of data starting from s and stores the remaining data to addresses starting from d as a set of continuous d ata Return value HDEL s n1 n2 n3 d Return Prefix inde Mad 3 Description L D F E s B Constant Expression Modification The first device number s of devices whose data v are deleted The total number of n1 bytes of the entire data v v v before the deletion The first byte number of n2 bytes to be deleted 4 The number of bytes to n3 be deleted x y ig The first device number of devices that store the d remaining data as a set of continuous data after the deletion Return Returns 0 normal or 1 j value error E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Input 0 lt n1 lt 2047 If the specified n1 is 0 deleting data is not n1 performed and the return value is 0 normal If the specified n1 is less than 0 or greater than or equal to 2048 the return value is 1 error n2 Input 1 lt n2 lt 2047 If the specified n2 is 0 or less or greater than or equal to 2048 the return value is 1 error n3 Input 1 lt n3 lt 2047 If the specified n3 is 0 or less or greater than or equal to 2048 the return value is 1 error d
62. in string s1 NG01NGBWR G1005_01 VSD Figure G10 3 Example and Behavior of the INSTR Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character SEE ALSO The INSTR function behaves in the same way as the SIST instruction in ladder instructions For details on the SIST instruction see Section 3 12 9 String Search SIST in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 13 G10 6 INSTR Simplified String Search Simplified INSTR is a function for searching for a string This function returns the first position counted from the beginning of string s1 of string s2 found in string s1 Return value INSTR s1 s2 Return Prefix Index nad A Description w L D F E s B Constant Expression Modification A string to be searched for or the first device number of devices that sa al d id represent the string 52 A string to be searched s V Vv V for in s1 Return The start position of the 7 value string found first E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If the string length specified by s2 is greater than characters in the string length specified by s1 an instruction string length processing error o
63. n d Return Prefix index Sac n Description W L D F E s B Constant Expression Modification The first device number s of devices in which the Vv V Y f P minimum value is searched for n2 The number of data M v M v The first device number d of devices in which the s Pr V Vv minimum value is stored Return Returns 0 normal or 1 7 r value error 1 Specify the same prefix for s and d 2 Even if s is L D F or E specify W for the return value and n E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Specify the same prefix as d n Input n gt 0 If n is 0 or less the return value is 1 error d Output There is no restriction Specify the same prefix as s Return Processing result 0 Normal When an error 1 occurs the operation is not performed value 1 Error and the value before execution is maintained in d E Available Devices Simin olr Z m nj ojrjz NENTS ENNIS NT NESSES NENTS SNE NINES NESSES NEN NEN NINES NESSES Return value IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 7 E Step Counts Prefix Step Count wW 75 L 71 D 76 F 72 E 76 4 In addition 21 steps are used for each script instruction E Function and Example This func
64. of Scripts This chapter describes an overview of the script function Function Limitations for Each CPU Type Table G1 1 Function Limitations for Each CPU Type CPU Modules Limitations SEE ALSO F3SP22 0S Scripts cannot be used F3SP28 3S F3SP38 6S F3SP53 4S F3SP58 6S F3SP59 7S F3SP66 4S Scripts cannot be used F3SP67 6S F3SP71 4N F3SP76 7N F3SP71 4S F3SP76 7S TIP This section does not describe hardware dependant limitations for each CPU type such as the number of available devices SEE ALSO For details on limitations for each CPU type refer to the user s manual for each type IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G1 1 G1 1 1 G1 1 2 G1 2 Scripts This section describes an overview and purpose of scripts and also precautions when using scripts What are Scripts A script is a code for a series of processing that is coded in a BASIC like format as opposed to a ladder language format A script consists of script syntax which describes a series of processing and script functions which perform specific processing that function as a kind of library A script instruction SCRIPT is used to call a script from a ladder program Ladder program Script _ IF X00301 1 THEN D0001 D0002 D0003 SCRIPT ST1 Hcr sri Pent G0101_01 VSD Figure G1 1 Script Instruction and Script Purpose of Scripts Using scripts has the following advantages Increases programmi
65. operation SEE ALSO The NOTV function behaves in the same way for 16 bit and 32 bit data as the NOT instruction in ladder instructions For details on the NOT instruction see Section 3 4 6 Not NOT Not Long word NOT L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E The difference is only in the data size for 1 bit and 64 bit data while the basic behavior is the same as that for the other data sizes IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Blank Page G9 Data Processing Functions IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 2 G9 1 RROT Right Rotate RROT is a function for rotating a 16 bit or 32 bit data right by n bits Return value RROT s n Return Peio O T Value Description Constant Expression at at Arguments w L D F E S B Modification The first device number s of devices for which the v v v v v rotation is performed The first device number z of devices that give the Vv 1 Specify the same prefix for s and the return value 2 v v v n number of bits to be rotated Return Rotation result Vv s value 2 Even if s is L specify W for n E Return Value Arguments E Available Devices Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Input W is specified for s If O is specified no operation is performed 1 lt ns16 If the n s
66. or omissions come to the attention of the user please contact the nearest Yokogawa Electric representative or sales office E Symbols Related to Safety A Danger This symbol on the product indicates that the operator must follow the instructions laid out in this user s manual to avoid the risk of personnel injuries fatalities or damage to the instrument Where indicated by this symbol the manual describes what special care the operator must exercise to prevent electrical shock or other dangers that may result in injury or the loss of life D Protective Ground Terminal Before using the instrument be sure to ground this terminal Function Ground Terminal Before using the instrument be sure to ground this terminal oN Alternating current Indicates alternating current Direct current Indicates direct current IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 The following symbols are used only in the user s manual A WARNING Indicates a Warning Draws attention to information essential to prevent hardware damage software damage or system failure AN CAUTION TIP Indicates a Caution Draws attention to information essential to the understanding of operation and functions Indicates a TIP Gives information that complements the present topic SEE ALSO Indicates a SEE ALSO reference Identifies a source to which to refer E Safety Precautions when Using Maintaining the Produc
67. precision Float to Long word Integer ETOI L Double precision Float to Double Long word Integer ETOI D in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 55 G9 26 FTOE Float to Double Precision Float FTOE is a function for converting a single precision floating point data into a double precision floating point data Return value FTOE s Return Prefix index Value Description Constant Expression et at Arguments Ww L D F E S B Modification A data to be converted or the first device s number of devices v v v v whose data are converted Return Conversion result V V value E Return Value Arguments Return Value Input Output Arguments There is no restriction The processing result is stored Arguments Return Value Return value 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 56 E Function and Example This function converts a single precision floating point data into a double precision floating point data Example E D0101 FTOE F D0001 V D0001 010 1111111 if 1 0 01 i af if 1 0 0 1 1 fol 0 1 10 Represents floating point 1 234 3F9D F3B6 IEEE code gt eee DOQO2 20 se 0x gt ore DO001 s gt V V V
68. restriction Return value Input E Available Devices 32768 lt m lt 32767 32768 lt m lt 32767 There is no restriction There is no restriction Arguments Return Prefix X Y I L M T C w Z RiV H AJU P Value d WwW v v v v v v v v v v v m WwW v v v v v v v v v v v v n Ww VIs y v v vivivilvlyvilviy Return value 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 13 E Function and Example This function shifts an m bit length data left by n bits The carry flag is changed according to the result of the shift operation After a shift operation Carry mbit _ gt ae i a a a ota a d ii ii li tn a pot l l l l A A O O O O O SOSS S n bit left shift G0906_01 VSD Example Lower two D0001 bits of D0002 D0001 Before the of4 ololo To of olo o To 1 0 o E operation 7 Filled with Os 3 bit left shift Discarded LLX f yyy D0001 After the operation 0 o o 1 o 0 1 o o o 1 1 0 1 o ofo ojo Carry G0906_02 VSD Figure G9 6 Example and Behavior of the LSFTN Function In this example the function behaves as follows When the device to be shifted is a register the first
69. s 25 This function combines only the lower bytes of n devices starting from the device specified by the combination source device s to make a continuous string where n is the number of word unit characters to be combined Then the function stores the string with termination code NULL 00 in the destination devices starting from the device d specified as the return value If the value of s is O the return value is NULL If the value of n is O the return value is NULL Example d SUNIT s n Example of the sequence of s Result d 00 A d A B 00 B Combine byte d 1 C D unit characters 00 C 00 D d 11 W n 26 d 12 Y Z yr End of the string 00 Xx d 13 00 Null 00 Y 00 Z G1020_01 VSD Figure G10 19 Example and Behavior of the SUNIT Function AN CAUTION Operation will not be valid if the n word range starting with s and the n byte range starting with d are overlapping TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character TIP There is no ladder instruction corresponding to the SUNIT function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Blank Page G11 1 G11 Program Control Functions IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 2 G11 1 IF ENDIF Conditional
70. so may adversely affect the functions of the module Use the following power source Use only power supply module F3PUqoo co in FA M3 Controller for supplying power input for control circuit connection If using this product as a UL approved product for the external power supply use a limited voltage current circuit power source or a Class 2 power source Refer to the user s manual before connecting wires Refer to the hardware user s manual or the applicable user s manual for the external wiring drawing Refer to A3 6 5 Connecting Output Devices in the hardware user s manual before connecting the wiring for the output signal Refer to A3 5 4 Grounding Procedure in the hardware user s manual for attaching the grounding wiring IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 viii E Waste Electrical and Electronic Equipment pz Waste Electrical and Electronic Equipment WEEE Directive 2002 96 EC This directive is only valid in the EU This product complies with the WEEE Directive 2002 96 EC marking requirement The following marking indicates that you must not discard this electrical electronic product in domestic household waste Product Category With reference to the equipment types in the WEEE directive Annex 1 this product is classified as a Monitoring and Control instrumentation product Do not dispose in domestic household waste When di
71. specified number of bits of data This function transfers the first n bit data of devices specified by s to the first 16 bits of devices specified by d PMOV s d n Return Prefix Index ra A Description L D F B Constant Expression Modification The first device number of devices i e the 3 source from which data d s id are transferred The first device number of devices i e the destination to which d the transfer data are v v assigned Specify the same data type as s The number of bits 1 to n 16 bits to be v v v v transferred Return No value is returned value 4 If s is a BCD code data specify a value of 4 8 12 or 16 E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments A Input There is no restriction Specify the same prefix as d d Output There is no restriction Specify the same prefix as S If s is a BCD code specify a value of 4 8 12 or 16 Return N A Return value 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 20 E Function and Example This function transfers a part of 16 bit data This function transfers the first n bit data of devices specified by s to the first 16 bits of devices specified by d Example 1 Transfer b
72. use a tag name that is the same as a reserved word IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G4 1 G4 Setting a Script in a Project This chapter describes how to set a script in a project Setting a script in a project means setting device areas for the projects that are used for work devices that temporarily store the operation results of script syntax and script functions When a script is used 512 points in the internal relay l 8 192 points in the cache register F and four points in the index register V are used as work devices regardless of the contents of the script A device area used in a ladder program or script and work device area cannot overlap each other Similarly when a local device is used a local device area and work device area cannot overlap each other Start address of the script work device o Cache Register F F3SP71 4N 4S 131 072 points F3SP76 7N 7S 524 288 points Script work device area Fixed to 8 192 points Local device area o Internal Relay I Start address of the script work device F3SP71 4N 4S 16 384 points F3SP76 7N 7S 65 535 points Script work device area Fixed to 512 points o Index Register V Start address of the script work device F3SP71 4N 4S 256 points F3SP76 7N 7S 256 points Script work device area Fixed to 4 points G0400_01 VSD Figure G4 1 Work Devices and Device Areas SEE ALSO For details on local devices see Chapter F2 Using Local
73. v v v v a F v v v v v v v v v v v v v E v v v v v v B viv v v Return value IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 18 E Step Counts Prefix Step Count Ww 4 L 4 D 5 F 4 E 5 B 6 4 In addition 21 steps are used for each script instruction E Function and Example This function transfers the data of devices specified by s based on the size of the prefix to the devices specified by d Move 1 bit is used with a prefix of B when a 1 bit data is transferred Move Word is used with a prefix of W when a 16 bit data is transferred Move Long word is used with a prefix of L or F when a 32 bit data is transferred Move Double Long word is used with a prefix of D or E when a 64 bit data is transferred Example MOV W D0001 W D0101 Data register Data register Transfer D0001 1216 D0101 1216 G0908_01 VSD Figure G9 8 Example and Behavior of the Simplified MOV Function SEE ALSO The simplified MOV function behaves in the same way as the MOV instruction in ladder instructions For details on the MOV instruction see Section 3 7 1 Move MOV Move Long word MOV L and Section 3 7 2 Move Double Long word MOV D in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 19 G9 9 PMOV Partial Move PMOV is a function for transferring the
74. 0 G3 12 AN CAUTION You can nest FOR statements by including one FOR statement within another The maximum nesting level is eight A compile error occurs if the nesting level exceeds the maximum The IL ILC instruction is used when a FOR statement is converted into a ladder program An instruction processing error occurs during execution in the CPU if the nesting level of an IL ILC instruction including the nesting in scripts and ladder program exceeds eight The FOR NEXT instruction is used when a FOR statement is converted into a ladder program An instruction processing error occurs during execution in the CPU if the nesting level of the following exceeds 16 FOR statements in scripts Script functions for which FOR NEXT instructions are used in functions FOR NEXT instructions in ladder programs Script functions for which FOR NEXT instructions are used in functions are as follows BSET HCHN HDEL HMOV LPAD LTRIM MAX MIN POW RPAD RTRIM SDIST SUM SUNIT TRIM There is no limitation on the number of statements in a FOR statement Note that the repetition counter can be referred to in a FOR NEXT loop but do not modify the repetition counter i e do not write a value in the repetition counter If you write a value in the repetition counter the subsequent behavior cannot be guaranteed If you use a rising edge or falling edge in the FOR statement only one repetition in which the first rising edg
75. 00001 L D00013 MOD L D00023 Increments the value 1 and returns the result D00001 D00002 L D00001 Decrements the value 1 and returns the result D00001 D00002 L D00001 SEE ALSO For details on the precedence of operators see Section G3 2 6 Operator Precedence in this manual AN CAUTION Arithmetic operators cannot process string type S data and bit type B data The remainder MOD operator cannot process floating point type F and E data Ifa space character does not exist after a division operator the device after the division operator is handled as a local device Example D00001 D00002 D00003 A division by D00003 is performed D00001 D00002 D00003 D00003 is handled as a local device IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 5 Spaces are required before and after a minus operator and decrement operator If there is no space the tag name might be identified as including the preceding and following letters You cannot use increment operators and decrement operators to process floating point type F and E data double long word D data mathematical expressions and constants and their names Increment operators and decrement operators can only be placed after a value You cannot put them before a value Example D00001 D00002 Increments 1 the value D00002 and assigns the result to D00001 D00001 D000
76. 01 D00002 OR D00003 L D00001 L D00013 OR L D00023 Performs a logical XOR operation of two values SEE ALSO For details on the precedence of operators see Section G3 2 6 Operator Precedence in this manual AN CAUTION B 100001 B 100101 XOR B 100102 D00001 D00002 XOR D00003 L D00001 L D00013 XOR L D00023 Logical operators cannot process string type S data and floating point type F or E data Also logical operators cannot perform logical operations of double long word D values Use script functions for executing logical operations For the logical operators AND OR XOR and NOT and the remainder operator MOD a space character is required before and after the operator A compile error occurs if a space character is missing IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 7 G3 2 4 String Manipulation Operators A string manipulation operator returns the result of a string manipulation Table G3 4 List of String Manipulation Operators Supported in Scripts Symbols Description Usage Examples Concatenates two strings S D00003 S D00001 amp S D00002 Compares two strings to see if they are the same D00001 S D00002 Compares two strings to see if they are different from each other S D00001 lt gt S D00002 TIP You can concatenate or compare up to two characters as a string literal Use a constant name if you want to concatenate or compare a string literal longer than t
77. 010 010 110 0 110 01 1110111010 1101 1 010 11010 0 1101111100 0101 110 0 11111 110 11010 1 1 01010 1 1101111 11010111111 IEEE code HE D0104 5e DE DO103 sarsi Vain GERREERT D0102 DE DO101 ereee ee gt 4 Represents floating point 1234 56789 4093 4A45 84F4 C6E7 V D0001 BIN code Represents an integer 1234 0000 04D2 G0924_01 VSD Figure G9 25 Example and Behavior of the ETOL Function SEE ALSO The ETOL function behaves in the same way as the ETOI instruction in ladder instructions For details on the ETOI instruction see Section 3 8 9 Double precision Float to Long word Integer ETOI L Double precision Float to Double Long word Integer ETOI D in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 53 G9 25 ETOD Double Precision Float to Integer ETOD is a function for converting a double precision floating point data into a 64 bit integer data Return value ETOD s Return Prefix index Value Description Constant Expression et at Arguments Ww L D F E S B Modification A data to be converted or the first device s number of devices v v v v whose data are converted Return Conversion result y V value E Return Value Arguments Return Value Input Output Arguments There is no restriction Th
78. 013 00 G10 23 G10 11 SDEL Substring Deletion SDEL is a function for deleting a substring from a string This function deletes an n2 character substring starting from the n1 th character in string s and stores the remaining string in the return value Return value SDEL s n1 n2 E Return Value Arguments Return Value Arguments Input Output Input Return Prefix Index nad a Description L D F E 5 g Constant Expression Modification A string from which a substring is deleted or the first device number s of devices that v v v v represent a string from which a substring is deleted n1 A deletion start position v v v The number of n2 characters in bytes to v v v be deleted Return The string after deletion Vv 7 value is stored Range 1 to 2047 characters in string length Behavior Restrictions If s is NULL or the string length is greater than 2047 an instruction processing error occurs during execution in the CPU If n1 is greater than the string length specified by s an instruction processing error occurs during execution in the CPU If n1 is O or less an instruction processing error occurs during execution in the CPU If n1 is greater than the string length specified by s an instruction processing error occurs during execution in the CPU Return value Output E Available Devices If n2 0 the return value is the s
79. 013 00 G10 29 When s1 ABCDEFG s2 12345 n1 4 and n2 3 d ABC12345G s1 s1 1 1 2 1 3 String whose substring is replaced with the other string n1 4 n2 3 Replacement start position n1 4 Replacement end position ni n2 1 6 s2 s2 1 2 2 2 3 String with which a substring of the other string is replaced 4 19 13 4 5 00 Transfer the string obtained by the replacement D estination d 1 d 2 d 3 d 4 G1013_02 VSD Figure G10 12 Example and Behavior of the REPLACE Function 2 TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character TIP There is no ladder instruction corresponding to the REPLACE function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 30 G10 14 TRIM Leading and Trailing Space Deletion TRIM is a function for deleting leading and trailing spaces from a string Return value TRIM s Return T Prefix Index matin X Description w L D F E s B Constant Expression Modification A string or the first s device number of a v v v v string Return The obtained string Vv value E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If s is NULL or the string lengt
80. 02 Compile error IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 6 G3 2 2 G3 2 3 Description Less than Comparison Operators A comparison operator returns the result of a comparison operation Table G3 2 Usage Examples D00001 lt D00002 L D00001 lt L D00003 F D00001 lt F D00003 Less than or equal to Greater than Greater than or equal to D00001 lt D00002 L D00001 lt L D00003 F D00001 lt F D00003 D00001 gt D00002 L D00001 gt L D00003 F D00001 gt F D00003 D00001 gt D00002 L D00001 gt L D00003 F D00001 gt F D00003 Equal to D00001 D00002 L D00001 L D00003 F D00001 F D00003 Table G3 3 Not equal to SEE ALSO For details on the precedence of operators see Section G3 2 6 Operator Precedence in this manual Logical Operators A logical operator returns the result of a logical operation D00001 lt gt D00002 L D00001 lt gt L D00003 F D00001 lt gt F D00003 Description Performs a logical NOT operation on a value List of Comparison Operators Supported in Scripts List of Logical Operators Supported in Scripts Usage Examples B 100001 NOT B 100101 D00001 NOT D00001 L D00001 NOT L D00001 Performs a logical AND operation of two values Performs a logical OR operation of two values B 100001 B 100101 AND B 100102 D00001 D00002 AND D00003 L D00001 L D00013 AND L D00023 B 100001 B 100101 OR B 100102 D000
81. 1 4 G3 20 G4 1 G4 3 work device ALPEA cceccceceeeeeeeeeeseeeeeeees G4 1 G4 2 X XORV Logical XOR e G8 34 IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Revision Information Document Name FA M3 Programming Tool WideField3 Script User s Manual Document No IM 34M06Q16 04E Edition Revised Item Jan 2012 New publication 2nd Sep 2012 Supported for WideField3 R2 03 3rd Dec 2013 Supported for WideField3 R3 01 Written by PLC Product Development amp Engineering Department Control Instruments Business Division IA Platform Business Headquarters Yokogawa Electric Corporation Published by Yokogawa Electric Corporation 2 9 32 Nakacho Musashino shi Tokyo 180 8750 JAPAN Printed by Kohoku Publishing amp Printing Inc IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Blank Page
82. 1 S v v v v v v v v v s2 S v v v v v v v v v n4 w v v v v v v v v v v v v v v v v n2 wW v v v v v v v v v v v v v v v v Return s vivivlyvlyvilvly viv value 1 In addition 21 steps are used for each script instruction E Function and Example This function replaces an n2 character substring starting from the n1 th character in string s1 with string s2 and stores the obtained string in the return value n1 is counted from the first character n1 1 of string s Specify the values of n1 and n2 within the lengths of strings s1 and s2 respectively Example d REPLACE s1 s2 n1 n2 When s1 ABCDEFG s2 123 n1 4 and n2 3 d ABC123G String whose substring is String with which a substring replaced with the other string or thie other stringis replaced s1 i 2 Replacement start position s2 1 3 00 s1 1 n1 th character 2 2 s1 2 Replacement end s position s2 3 s1 3 n1 n2 1 th character Transfer the string obtained by the replacement Destination d A B d 1 C 4 d 2 2 3 d 3 G 00 G1013_01 VSD Figure G10 11 Example and Behavior of the REPLACE Function 1 Even if the value of n2 is less than the length of string s2 the n2 characters are replaced with the entire string s2 and the obtained result is stored in string d IM 34M06Q16 04E 3rd Edition Dec 25 2
83. 2 R RAD Convert Degree to Radian 00 G9 59 reading CINCUINS i i cses05 asda cede ieee G1 6 remainder MOD c ccceeeeeeeeeeesteeeeeentreeeeeaes G3 4 repetitive statement cee cece G3 11 G11 5 REPLACE String Replacement 4 G10 27 reserved Word eccccccecceceeeeeeeeeeeeeteneeeeeenetees G3 20 return value oo ee eeeeeeeeceeeeeceeeeeeeseeeeeeeseeeeeeeteenaees G6 2 return Value ArQUMENK eee eeeeeeeeeeeeeeeeeeeeeees G6 3 RIGHTS String Right ccccceceseeeeeee G10 19 ising edge si 22 iciseicaieniaesitiiescueienis G3 8 G7 2 RPAD Right side Character Addition G10 36 Index 2 RROT Right Rotate i eeeeeeeeesteeeeenees G9 2 RSFT Right Shift ceeeeeeeeeeeeesteeeeeenaes G9 6 RSFTN Right Shift m bit Length Data byn BiS cts leat G9 10 RTRIM Trailing Space Deletion G10 32 S SCript FUNCOM iaitu tisnin G1 2 G3 1 G6 1 script instruction cccccccceeeeeeeeees G1 2 G2 1 G2 3 Script monitoring sessen G5 12 script number ST number G1 5 G2 1 G2 3 SCIIPUS VMAX saividescessadicdessaddacassasidessandcate nse G1 2 G3 1 SDEL Substring Deletion G10 23 SDIST String to Byte unit Characters G10 40 SELECT Branch Statement 0 0 G3 9 G11 9 sensor Control DIOCK 0 cecccceeeeeeeeeeesteeeeeeaes G1 6 setting a SCript eeeeeeeeeees G1 4 G4 1 G4 2 SIN SING ara rientaledotien G8 18 Singl
84. 3rd Edition Dec 25 2013 00 G8 11 E Function and Example This function calculates the real single precision floating point value of the natural logarithm logarithm to the base e of a real single precision floating point number The relational expression is as follows d LOG s s Areal number data whose LOG logarithm is obtained d The obtained LOG logarithm value Example F D1001 LOG F D0001 When F D0001 2 718282 F D1001 LOG 2 718282 1 ieee des o 110 oo 0 0 ao 0 1 a 110 fi i a 0 ooto 1 ofito 11011 E E E E DO002 eiren rrna gt lt TE A E E E T DOOO1 iieiea l Represents 2 718282 402DF855 JEEE codes 0 01 ha 111 h 0 0 oo 0 0 o o 0 0 ac 0 0 Jo 0 0 olo 0 00 Represents 1 3F800000 G0805_01 VSD Figure G8 5 Example and Behavior of the LOG Function SEE ALSO The LOG function behaves in the same way as the LOG instruction in ladder instructions For details on the LOG instruction see Section 3 3 25 LOG FLOG in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 12 G8 6 EXP Exponent EXP is a function for calculating the real value of the exponential operation for a floating point value Return value EXP s Return Prefix flee Value Description
85. 5 statement 3 ENDSELECT If the value of D00001 is 15 then it matches the second CASE and the third CASE However the second CASE has precedence and statement 2 is executed After statement 2 is executed the process jumps to ENDSELECT and thus statement 3 is not executed When a value range is specified for CASE in the format start value end value it is not checked if the start value is equal to or smaller than the end value If a start value larger than the end value is specified by mistake the statement for the CASE is not executed You can nest SELECT statements by including one IF or SELECT statement within a SELECT statement The maximum nesting level is eight A compile error occurs if the nesting level of both IF and SELECT statements exceeds the maximum SEE ALSO For details on the SELECT statement see Section G11 3 SELECT ENDSELECT Conditional Branch Statement in this manual For details on nesting see Section G3 3 4 Restrictions on Control Statements in this manual IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 11 G3 3 2 Repetitive Statements A repetitive statement contains a combination of a FOR and a NEXT The following types of repetitive statements FOR statements are supported Normal Type FOR repetition counter repetition initial value repetition final value statement 1 NEXT Statement 1 is executed repeatedly from the repetition initial value of the repetition coun
86. 6 and then writes the return value in a specified device After a conversion 0 00 is written in the upper 8 bits bits 8 to 15 of the return value The digit position n is O 0000 for the lowest digit bits O to 3 and 3 0003 for the highest digit bits 12 to 15 Example The following program converts the first digit of a data 1234 in X00201 into an ASCII code and writes the result in D0001 W D0001 ASC W X00201 1 Before the operation 1234 0000 Gonvelsian Write destination source 0001 0010 0011 0100 0000 0000 0000 0000 D0001 X00201 Digit position in tH the conversion 1 source After the operation 0033 Write destination 0000 0000 0011 0011 D0001 G0930_01 VSD Figure G9 31 Example and Behavior of the ASC Function SEE ALSO The ASC function behaves in the same way as the ASC instruction in ladder instructions For details on the ASC instruction see Section 3 8 13 Convert ASCII ASC in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 65 G9 31 APR Approximate Broken Line APR is a function for approximating a data according to a broken line table Return value APR s t n 1 Specify the same prefix for s t and the return value 2 Regardless of whether s t and the return value are W L or F specify W for n 3 If t
87. 9 L 9 D 26 B 10 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 33 E Function and Example This function performs a logical sum of 1 bit 16 bit 32 bit or 64 bit data and assigns the result to the specified device Logical OR 1 bit is used with a prefix of B when a logical sum of 1 bit data is performed Logical OR Word is used with a prefix of W when a logical sum of 16 bit data is performed Logical OR Long word is used with a prefix of L when a logical sum of 32 bit data is performed Logical OR Double Long word is used with a prefix of D when a logical sum of 64 bit data is performed The result of each type of logical sum has the number of bits shown in the following table The operation result is assigned to the devices starting from the first device specified by return value d Instructions Logical OR Word Logical OR Double Long word Specification Item Logical OR 1 bit Logical OR Long word 1 bit instruction F f 2 word instruction Aword instruction Number ONDIS ot 16 bits 32 bits 64 bits the operation result Device s to which the operation result d 1 d d 3 d 2 d 1 d is assigned Example W Y00601 ORV W X00501 W X00517 X00516 X00501 X00501 BIN code ore OR orn X00517 BIN code ofo 1 f ofofo 0 0 afo gt gt 0 Y00616 Y00601 Y00601 y 7 M BIN c
88. A M3 Programming Tool WideField3 Read Me First IM 34M06Q16 11E FA M3 Programming Tool WideField3 Introduction and Troubleshooting IM 34M06Q16 01E FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E _FA M3 Programming Tool WideField3 Online IM 34M06Q16 03E FA M3V Environment Tool Trace Function IM 34M06Q50 21E For individual sequence CPU modules please refer to the relevant user s manuals F3SP71 76 Sequence CPU Instruction Manual Functions for F3SP71 4N 4S F3SP76 7N 7S IM 34MO6P15 01E Sequence CPU Network Functions for F3SP71 4N 4S F3SP76 7N 7S IM 34M06P15 02E Sequence CPU Instruction Manual Instructions IM 34M06P12 03E F3SP66 67 Sequence CPU Functions for F3SP66 4S F3SP67 6S IM 34M06P14 01E Sequence CPU Network Functions for F3SP66 4S F3SP67 6S IM 34M06P14 02E Sequence CPU Instruction Manual Instructions IM 34M0O6P12 03E F3SP22 28 38 53 58 59 Sequence CPU Instruction Manual Functions for F3SP22 0S F3SP28 3N 3S F3SP38 6N 6S F3SP53 4H 4S F3SP58 6H 6S F3SP59 7S IM 34M06P13 01E Sequence CPU Instruction Manual Instructions IM 34M06P12 03E F3SP05 08 21 25 35 Sequence CPU Functions for F3SP21 F3SP25 and F3SP35 IM 34MO06P12 02E Sequence CPU Instruction Manual Instructions IM 34M0O6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 xii Refer to the following manuals as req
89. AP is a function for swapping one word or two word data This function swaps the contents of devices specified by d1 and d2 SWAP d1 d2 Return Prefix index Value Description Constant Expression epee Arguments Ww D F E S Modification d1 A data to be swapped F for the data of d2 A data to be swapped Vv d2 for the data of d1 Return No value is returned value 1 Specify the same prefix for d1 and d2 E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input Output There is no restriction Specify the same prefix as d2 Input Output There is no restriction Specify the same prefix as d1 Return N A value E Available Devices Arguments Return Prefix X YJ IJ E E M T OC D BY FI W Z R V H A UY P Value Ww v v v v v v v v v v v v v v v E L v v v v v v v v v v v v v v v j w v v v v v v v v v v v v v v v E L v v v v v v v v v v v v v v v Return value Step Count 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 E Function and Example G9 27 This function swaps the contents of devices specified by d1 and d2 Example 1 Word data SWAP W D0001 D0002 Before executing the instruction After executing the instruction
90. Constant Expression ar cas Arguments wW L D F E S B Modification A floating point number or the first device P P P number of a floating point number Return The obtained exponential operation v v value value E Return Value Arguments Return Value Input Output Arguments There is no restriction The processing result is stored Arguments Return Value Return value Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 13 E Function and Example This function calculates the real single precision floating point value of the exponential operation e raised to the power of S of a real single precision floating point number The relational expression is as follows d eS s Areal number data used as the exponent in the calculation of EXP exponent d The obtained EXP exponent value Example F D1001 EXP F D0001 When F D0001 1 0 F D1001 EXP 1 0 2 718282 D0001 IEEE code D1001 IEEE code Represents 2 718282 402DF854 G0806_01 VSD Figure G8 6 Example and Behavior of the EXP Function SEE ALSO The EXP function behaves in the same way as the EXP instruction in ladder instructions For details on the EXP instruction see Section 3 3 26 EXP FEXP in Sequence CPU Instruction Manual
91. D0101 HCHN W D0001 5 W D0010 3 W D0020 Source 1 Source 2 D0001 D0010 59 37 D0002 DOIT i Ge D0003 D0012 78 92 D0004 D0013 38 16 Doo0s 54 25 D0014 57 68 aren data 3 byte data Concatenate as Concatenate as leading data trailing data Destination D0020 D0021 D0022 D0023 D0024 0 0 G0914_01 VSD Figure G9 14 Example and Behavior of the HCHN Function 1 TIP The functions which process in byte 8 bits units handle the upper byte of a word data 16 bits as the first byte the lower byte as the second byte IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 32 2 When the concatenation destination overlaps a concatenation source The behavior in this case is the same as when the concatenation destination does not overlap any concatenation sources W D0101 HCHN W D0001 5 W D0010 3 W D0011 D0001 D0002 D0003 D0004 D0005 Source 1 5 byte data Concatenate as leading data D0011 D0012 D0013 D0014 Figure G9 15 TIP Destination D0010 D0011 D0012 D0013 D0014 Source 2 59 37 78 92 38 16 57 68 3 byte data Concatenate as trailing data G0914_02 VSD Example and Behavior of the HCHN Function 2 There is no ladder instruction corresponding to the HCHN function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 33 G9 15 HDEL Partial Byte Deletion HDEL is a function
92. Devices in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G4 2 G4 1 Setting Work Device Areas This section describes how to set work device areas Specify the start addresses of work device areas in Script Setup in Project Settings Configuration The number of points for a work device is fixed to 512 points in the internal relay I 8 192 points in the cache register F and four points in the index register V Procedure 1 Double click Project Settings Configuration in the Project window The Project Settings Configuration window is displayed 2 Click Script Setup in the Configuration tree The Script Setup screen is displayed 3 If you use a script turn on the Use script checkbox and enter the start addresses of the internal relay l cache register F and index register V that are used as script work devices When you enter a start address the range of the script work device is displayed on the side of the entry field TIP You must set a value of 32n 1 as the start address of the internal relay and a value of 2n 1 as the start address of the cache register or index register Start address of the Entire device areas of the script work devices selected CPU Project Settings Configuration Assignment Possible Range 1 32768 1 524288 1 256 E tial Data Setup IB Inter CPU Shared Memor
93. Example and Behavior of the COS Function SEE ALSO The COS function behaves in the same way as the FCOS instruction in ladder instructions For details on the FCOS instruction see Section 3 3 23 COS FCOS COS FACOS in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 22 G8 11 TAN Tangent TAN is a function for calculating a tangent value This function stores the tangent of an angle of s in radians in the return value Return value TAN s Return Prefix ndek Value Description Constant Expression sai cat Arguments W L D F E S B Modification An angle data in radians whose TAN value is calculated or the first device number of devices for which the TAN value is calculated The tangent value obtained for s The data type of the v v return value is the same as that of the argument Return value E Return Value Arguments Return Value Input Output Arguments s Input Return Output value Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 23 E Function and Example This function calculates the TAN tangent value single precision floating point value of an angle given in radians The relational expression is as follows Return value TAN s1 s1 An angle in radians for which TAN is
94. FOR NEXT instructions in ladder programs Script functions for which FOR NEXT instructions are used in functions are as follows BSET HCHN HDEL HMOV LPAD LTRIM MAX MIN POW RPAD RTRIM SDIST SUM SUNIT TRIM There is no limitation on the number of statements in a FOR statement Note that the repetition counter can be referred to in a FOR NEXT loop but do not modify the repetition counter i e do not write a value in the repetition counter If you write a value in the repetition counter the subsequent behavior cannot be guaranteed If you use a rising edge or falling edge in the FOR statement only one repetition in which the first rising edge or falling edge has been detected is executed When you use the BRK statement the condition for forcibly terminating a FOR NEXT loop must be met only after the loop is executed at least once IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 8 SEE ALSO Details of the FOR NEXT statement are given also in the section on the script syntax See Section G3 3 Control Statements in this manual For details on the EXITSCRIPT statement see Section G11 4 EXITSCRIPT Script Exit Statement in this manual For details on nesting see Section G3 3 4 Restrictions on Control Statements in this manual SEE ALSO The FOR NEXT statement behaves in the same way as the FOR NEXT instruction in ladder instructions For details on the FOR NEXT instruction se
95. G1 6 G2 16 G3 2 G3 7 control statement ceceeeeceeceeeeeeeeeeeteeeeeeees G3 8 converted ladder program G1 6 G2 6 G4 3 G5 10 COS Cosine ccccceceeeeeeeeeeceeeeeeeeeeteesnaeees G8 20 D data processing function G9 1 data type oe ecceeceeeeeeeeeeeeeeeseeeeeeeteeeeeeeeeaeees G3 16 Decrement annnm G3 4 DEG Convert Radian to Degree 08 G9 62 deleting unused tag NAMES s e G1 6 Index 1 IM 34M06Q16 04E 3rd Edition GUVISI OM iaioa aaa Ea G3 4 double long word type sessen G3 16 G6 2 double precision floating point type G3 16 G6 2 E Edit Mnemonics Script pane c ceeee G2 3 end of text COMMENT eseeeeeeeeeeeeeeeeeetees G2 10 ETOD Double Precision Float to Integer G9 54 ETOF Double Precision Float to Float G9 58 ETOL Double Precision Float to Integer G9 52 EXITSCRIPT Script Exit Statement eeeeeeeeeees G3 13 G11 12 EXP Exponent orresc ea G8 12 F falling CAGE eeeeeeeeeeeeeeeteeeeteeeeeeeeeaees G3 8 G7 4 FALSE get ncctutwadisat E A eee devin meeaey G3 20 FBCD Float to BCD esena G9 40 floating point type 00 eeeeeeeeeeteeeeeenteeeeeeaes G3 16 FOR NEXT Repetitive Statements G11 5 FTOE Float to Double Precision Float G9 55 FTOW Float to Integer G9 47 function and example cccseeseceeeeeeeeeeteees G6 3 function quick reference table 08 G6 2 H HCH
96. G9 18 FBCD Float to BCD FBCD is a function for converting a single precision floating point data into BCD codes FBCD s d Return Prefix index iad m Description L D F E s B Constant Expression Modification The first device number of devices for which the s floating point to BCD v v v conversion is performed The first device number d an integer of devices Y to which the conversion result is assigned Return No value is returned value E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction d Output The processing result is stored Return N A value E Available Devices Arguments Return Prefix X Y I L M T C D BI FI W Z R V H AY UY P Value es ee s F v v v v v v v v v v v v v v v d v v v v v v v v v v v v v v Return value Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 40 E Function and Example This function converts a single precision floating point data s into a BCD format in which the integer part and decimal part are separated and writes the result in d After the conversion the BCD format has the following form sAAAA BBBB Ss E Sign d ttre 0 for the plus sign or 1 for the minus sign AAAA I
97. In order to prevent electrical shock turn off all the power sources before connecting wires etc This product is classified as Class A for use in industrial environments If used in a residential environment it may cause electromagnetic interference EMI In such situations it is the user s responsibility to adopt the necessary measures against EMI IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 E Exemption from Responsibility Yokogawa Electric Corporation hereinafter simply referred to as Yokogawa Electric makes no warranties regarding the product except those stated in the WARRANTY that is provided separately Yokogawa Electric assumes no liability to any party for any loss or damage direct or indirect caused by the use or any unpredictable defect of the product E Software Supplied by the Company Yokogawa Electric makes no other warranties expressed or implied except as provided in its warranty clause for software supplied by the company Use the software with one computer only You must purchase another copy of the software for use with each additional computer Copying the software for any purposes other than backup is strictly prohibited Store the original media that contain the software in a safe place Reverse engineering such as decompiling of the software is strictly prohibited Under absolutely no circumstances may the software supplied by Yokogawa Electric be transferred exchanged or sublet or leased in
98. N Byte Chain n se G9 30 HDEL Partial Byte Deletion ee G9 33 HMOV Byte Block Move G9 21 HSWAP Byte Swap n se G9 28 l IF ENDIF Conditional Branch Statement eecceeeeeeeeeeeeeeeeeeneees G11 2 INCrEMON 44 os sect sscctecesscceees ssscenevsseceevtssaneeeeeee G3 4 ale 0 een G2 9 index modification 00 0 ee cette ee eeteeeeeeteeeeeenes G2 14 index register ccceeeeeeeeeeees G2 14 G4 1 G4 2 indirect specification ccceeeeeeeeeeeeeeees G2 14 inline mnemonic identification character G2 12 inline MNEMONICS 1 00 2 eee eect e cette ee eeeteeeeeeaes G2 12 INSTR Simplified String Search 2 0 G10 13 INSTR String Search G10 11 integer type ree G3 16 internal relay ccccecesessceeeeeeeeeeeeeneees G4 1 G4 2 interrupt rOUtING 22 cece eeeeeeeeeeeeeeeeeceeeeeeeeeeteees G1 6 ITOE Integer to Double Precision Float G9 45 ITOF Integer to Float ee ceeeeeeseeeeeeenees G9 43 IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 L ladder language 1 00 0 eeeeeeeeeteeeseeteeeeseeteeeeteenaeees G1 2 ladder program s G1 2 G1 3 G2 6 G5 10 LDD Logical Differential Down G7 2 LDU Logical Differential Up ee G7 4 LEFT String Left ccceescesseeseesteesteees G10 21 local OVICC scsccvesincteuvaedactvvdanstivventtnivventeeebecnn G2 13 LOG Logar ecese G8 10 logical Operator oieri a G3 6 long
99. Prefix Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 7 E Function and Example This function shifts a 16 bit or 32 bit data right by n bits Right Shift Word is used with a prefix of W when a right shift of a 16 bit data is performed Right Shift Long word is used with a prefix of L when a right shift of a 32 bit data is performed The last bit that is shifted out is stored in the carry Example W Y00601 RSFT W X00501 5 X00516 X00501 X00501 N N N N N N N N N N N N N w ke yo 5 bit right shift Y00616 ANAO neon Y00601 Discarded Filled with Os Y00601 Carry 0903 01 VSD Figure G9 3 Example and Behavior of the RSFT Function SEE ALSO The RSFT function behaves in the same way as the RSFT instruction in ladder instructions For details on the RSFT instruction see Section 3 6 1 Shift RSFT LSFT Shift Long word RSFT L LSFT L in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 8 G9 4 LSFT Left Shift LSFT is a function for shifting a 16 bit or 32 bit data left by n bits Return value LSFT s n Return Prefix index Peas 3 Description W L D F E s B Constant Expression Modification The first device number s of devices for which the P V
100. Range Behavior Restrictions Arguments Input 1 to 2047 If s is NULL or the string length is greater than s characters in 2047 an instruction processing error occurs string length during execution in the CPU Input 1 2047 If n is 0 or less an instruction processing error occurs n If n is greater than the string length specified by s an instruction processing error occurs during execution in the CPU R Output The obtained string is stored eturn vals If an instruction processing error occurs an indefinite value is returned E Available Devices Arguments Return Prefix X Y E Lb M T C D B F WI Z RIVy H AT UY P Value s S v v v v v v v v v n w v v v v v v v v v v v v v v v v Return S value 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 18 E Function and Example This function extracts a substring starting from the extraction position n and ending with the NULL character in source string s and writes the substring in the return value The extraction position n is counted from the first character n 1 of string s Example d MID s n When s ABC01234 and n 4 d 01234 Sequence of s AN n Extraction position A B 7 ale A i the 4 character s 1 C o i ae Sg a a s 3 T 7 ge character sae 660 ABC0123 4 00 ae
101. The obtained string is stored If an instruction processing error occurs an indefinite value is returned Return value IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 37 E Step Counts S 227 4 In addition 21 steps are used for each script instruction E Function and Example This function adds a character specified by s2 on the right side of string s1 as many times as needed until the total string length reaches n and then the function writes the obtained string in return value d Specify a character for string s2 and then the function adds the character repeatedly as needed If you specify two or more characters for string s2 the function extracts only the first character and adds it to the source string repeatedly as needed Example d RPAD s1 n s2 When s1 123456 n 9 and s2 A d 123456AAA Example of the sequence of s 123456 s1 ly 2 s2 A 00 s1 1 Ig 4 s1 2 5 6 n 9 s1 3 00 End of the string Null Result d 123456AAA d 1 2 d 3 4 d 2 5 6 d 3 A A d 4 A 00 End of the string Null G1017_01 VSD Figure G10 16 Example and Behavior of the RPAD Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the low
102. U R Output The obtained string is stored eturn f a value If an instruction processing error occurs an indefinite value is returned E Available Devices Return S value 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 22 E Function and Example This function extracts an n character substring from the left side of source string s and writes the substring in the return value Example d LEFTS s n When s ABC01234 and n 3 d ABC Sequence of s a EEE No of characters s L A B g 3 3 characters oy Te a ae ao st 2 4 9 s 3 3 4 Extract 3 characters from the left side ABC0123 4 s 4 00 ee 3 characters Sequence of the return value B gt C 00 G1010_01 VSD Figure G10 8 Example and Behavior of the LEFT Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character SEE ALSO The LEFT function behaves in the same way as the SLFT instruction in ladder instructions For details on the SLFT instruction see Section 3 12 8 String Left SLFT String Right SRIT in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2
103. ULL or the string length of s1 is greater than 2047 an instruction processing error occurs during execution in the CPU If s2 is NULL or the string length of s2 is greater than 2047 an instruction processing error occurs during execution in the CPU 1 2047 If n is 0 or less an instruction processing error occurs during execution in the CPU If n is greater than the string length specified by s1 an instruction processing error occurs during execution in the CPU Return value E Available Devices The obtained string is stored If an instruction processing error occurs an indefinite value is returned Arguments Return Prefix xX Y l LIMITI CID BI FIW IZ R V HJAJUJ P Value s1 S v v v v v v v vA v s2 S v v v v v v v v v n w v v v v v v v v v v v v v v v Return s lylei siv value IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 26 E Step Counts Prefix Step Count S 108 4 In addition 21 steps are used for each script instruction E Function and Example This function inserts string s2 before the n th character in string s1 and stores the obtained string in the return value n is counted from the first character n 1 of string s Example d SINS s1 s2 n When s1 ABCDE s2 123 and n 4 d ABC123DE String to be inserted into the other string String into which the other
104. a Processing FUNCTIONS ccccccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeneee G9 1 G9 1 RROT Right Rotate ccccccsccssseeeeeeeeeeeeeeseeeesneeeeeeeessseeesseseeeeeeseneess G9 2 G9 2 LROT Left Rotate siseses teenei seeedseceentd e siena aapea raeas are G9 4 G9 3 RSET Right SHG wise cccsecc scecsseccccctt seecesseteeses venedevesecateatieaereniantentiees G9 6 G9 4 LSFT Left Shift icscsii ccc ce ceceichedetecanceiaee ordinates G9 8 G9 5 RSFTN Right Shift m bit Length Data by n Bits ceesseeeeeee G9 10 G9 6 LSFTN Left Shift m bit Length Data by n Bits c cssscseeeeee G9 12 69 7 MOV MOVG eis cievcetsscecescctveccueesdetesced ev eeeeesece cht ieneta cdsceneeandeteie sd ceeeesiies G9 14 G9 8 MOV Simplified Move cccccccssceeeeeeceeeeesseeeeseeeeeeneeeseeesseeseseeeenseees G9 17 G9 9 PMOV Partial Move cccccccsccsseeeseeeeeeeeesseesesneeseeeeeeeeeesseeseseeeeeseees G9 19 G9 10 HMOV Byte Block Move sccccsscceeeeeceeecesseeeeeeeeeeeeeseeesesseeeesneeeeenees G9 21 G9 11 BSET Block Set ncecsecictececsccceescceestti de ecens doe cavtcesulent a okunan aaia G9 23 G9 12 SWAP SWap isiaisececechee cs dicecescteeideeaietis ext censeceneedtucedeevsecervaiveseceesecesesaues G9 26 G9 13 HSWAP Byte Swap cccccceccsseseeeeeseeeeeeeeseeeeeesaeenseeeseeesesseeseseeeeeenees G9 28 G9 14 HCHN Byte Chalin cc cccesscesscccececcestceessncecnesienteeessoneensecentenessoneenseces G9 30 G9 15 HDEL Pa
105. ac olo olofo 0 olofo 0 olo ololo Sates D0002 senn D0001 gt Represents 60 42700000 D1001 JEE ea of 0 1 i 1 alalalolo oo 1 1 ac olo of io 1 0 fo 0 ic ol1lo aL 3 G0928_01 VSD Figure G9 29 Example and Behavior of the RAD Function SEE ALSO The RAD function behaves in the same way as the FRAD instruction in ladder instructions For details on the FRAD instruction see Section 3 8 22 Convert Degree to Radian FRAD in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 61 G9 29 DEG Convert Radian to Degree DEG is a function for converting the unit of an angle from radians to degrees This function converts the unit of an angle s from radians to degrees and stores the obtained value in the return value Return value DEG s Return Prefix Value Description Constant Expression Arguments ii L D F E S B Index Modification An angle value in radian to be converted or the first device number of the devices that are converted i e conversion source The data type of the return value is the same as that of the argument v v The unit of the return value is degrees Return value E Return Value Arguments Return Value Input Output Arguments There is no res
106. ails on debugging functions see Chapter K1 Using the Debugging Functions in FA M3 Programming Tool WideField3 Online IM 34M06Q16 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 12 G5 4 Monitoring in the Script Pane In program monitoring you can monitor or debug a script in the Edit Mnemonics Script pane Monitor Block BLKO01 BLKOO1 Display Real Address DER e SCRIPT Jstooo1 2 100833 DFU mot 0 100833 100961 100835 e SEA of gt Monitoring in the script pane 7 Set up speed when X301 15 ON IF LOU B X00301 THEN B x00301 a mov 1o0000 D00021 w Do0021 005 mov s000 D00022 W DO00022 3E8 B 100201 ON Set up speed flag ON 8 100201 o EL oo o o w SE _ 8 100201 OFF a G0504_01 VSD Figure G5 4 Monitoring in the Edit Mnemonics Script Pane In the Edit Mnemonics Script pane the monitoring information is displayed in each green line between lines of the script program The device used in the script line immediately above each green line is monitored and displayed White line A script program line Green line The monitor display of the device used in the script line immediately above this line f f Set up speed when x301 is ON IF LOUCB xX00301 THEN B x00301 a mMov 10000 000021 wW D00021 005 movcCsooo D00022 wW D00022 3E8 B 100201 ON f f set up speed flag ON ELSE B I00201 OFF B 100201 O Monito
107. alue SUM s 10 d s 4671 s 1 225 s 2 456 s 3 1666 s 7 864 s 8 631 s 9 1235 Figure G8 1 TIP Total d 16279 Example and Behavior of the SUM Function G0801_01 VSD If the total value exceeds the number range allowed for the prefix of the device for storing a total value only a part of the result within the number range for the prefix is stored in d TIP There is no ladder instruction corresponding to the SUM function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 4 G8 2 MAX Maximum Value MAX is a function for searching for a maximum value This function searches for the maximum value of n values in a data area starting from s Return value MAX s n d Return Prefix index Value Description Constant Expression ai as Arguments W L D F E S B Modification The first device number s of devices in which the P V Y f P maximum value is searched for n 2 The number of data v v v v The first device number d of devices in which the s Pr V Vv maximum value is stored Return Returns 0 normal or 1 Vv r value error 1 Specify the same prefix for s and d 2 Even if s is L D F or E specify W for the return value and n E Return Value Arguments Return Value Input Output Behavior Restrictions Arguments Input There is no restriction Specify the same prefix as d Input n gt 0 If n is 0 or less
108. ant Definition To use the Script editing dialog box to edit constant definitions in a script use the following procedure Procedure 1 In the script shown in the Script editing dialog box place the position cursor over the constant name to be edited and right click A popup menu appears 2 Select the Edit Constant Definition menu gt The Register Constant Definition dialog box is displayed The dialog box shows the current settings of the constant name under the position cursor 3 Edit the constant definition information TIP Available values for constant definitions are the same as in the Constant Definition edit window Register Constant Definition Constant Name Script editing Compile with OK ALT O and discard Ww 000014 TOUT Undo Cut Copy Paste Delete Edit Constant Definition Select All G020305_03 VSD TOUT Value 15 Comment Time out value Step 3 G020305_04 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 18 SEE ALSO For details on available values for constant definitions see Section E3 2 2 Specification of Elements of Constant Definition in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E 4 Click Save A message box is displayed asking if you want to overwrite the existing constant definition Click Yes to overwrite the constant definition AY CAUTION You ca
109. aracters on the right side of a string Return value RPAD s1 n s2 Return Prefix index Peas x Description W L D F Constant Expression Modification A source string to which characters are added or s1 the first device number E of the source string The string length after addition or the first n device number of v v v v devices for the string length after addition A character to be added to the source string or 52 the first device number P V Vv y of another string whose first character is added to the source string Return The string obtained by Vv value the addition E Return Value Arguments Return Value Arguments Input Output Input Range Behavior Restrictions 0 to 2047 characters in string length If the string length specified by s1 is greater than 2047 an instruction processing error occurs during execution in the CPU If s1 is NULL the return value is a string that is filled with the string s2 s until its string length becomes n 2 Input 1 2047 1 to 2047 characters in string length If n is 0 or less or n is less than or equal to the string length specified by s1 an instruction processing error occurs during execution in the CPU If s2 is NULL or the string length of s2 is greater than 2047 an instruction processing error occurs during execution in the CPU Return value Output E Available Devices
110. arithm vis csiicscciieciiestieeiieiieesicnciivie ainda ananeics G8 10 G8 6 EXP EXpOment icccecciieccccatecedesstieccednsdectte de leecedalicetes shteceedntanettestiseceeuien G8 12 G8 7 SQR Square ROOE sists ieccciss ceeseeecvecceses eines eevee ceases eveweeeteevee teenies G8 14 G8 8 POW PoWel o cciccsscccsidcescctseseeestdivnsitenieesnicn siti ateetsceensiiieesieeeies G8 16 68 9 SIN Sime cise cicaci cs scteestc caste Ss tee ehcet tied de araa eraa aTa Se Era a ERA EDRs G8 18 G8 10 COS CoSine 3 iciscciscsicivstcicestenndeesieis wero neti nieernn cain dieernenecie G8 20 G8 11 TAN Tangent iscissi aseinani nnne noraa iaasa anaana aaau G8 22 68 12 ASIN Arc Sime icccisscdcces is cnties cn ebeeecestetnd ancdevetiesuceit soetevsedesteeedientensets G8 24 G8 13 ACOS Arc COSIMe isceccicccts cisecesecticicts cesecteesticcseccaveceeestitbasievsectes ttecast G8 26 G8 14 ATAN Arc Tangent ececceceeseneeeeseeneeeeseeneeeeseeneeeeseeneeeesecneeenseeneeenees G8 28 G8 15 ANDYV Logical AND icc c cccsiciestescccecesnnetesteesececesteccesteeeeceeusuae dentereeses G8 30 G8 16 ORV Logical OR sicsisceisccscesstcesecstcsees evsecrve sas evetenssecteessieeetievsectes aiecssee G8 32 G8 17 XORV Logical XOR cccccccceseesseeeeeeeeeeeeeesseeeeseeeeeseeeseeeeessseeseeeeees G8 34 GB 18 NOTV Logical NOT ncccccciccceiecssstescececessneceetensececdened cnsteeseceeesteecentensetes G8 36 IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 Dat
111. broutines and interrupt routines In scripts you cannot enter SUB RET and INTP IRET which indicate the start and end of a subroutine and interrupt routine respectively Create subroutines and interrupt routines using a ladder program Labels and jumps You cannot enter labels in a script Also you cannot code such as that for a jump that changes the program execution flow in a script IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 15 G2 3 4 Display of Input Candidates You can use the auto suggest function to display input candidates in the Script editing dialog box Auto Suggest of Constant Names To auto suggest defined constant names for a script use the following procedure Procedure 1 In the Edit Mnemonics Script dialog box enter 2 Press the down arrow key gt Alist of currently defined constant names Script editing Compile with OK ALT 0 and discard with CANCEL ESC ays IS displayed W D00001 TOUT_A WORD 10 Time out A i TOUT_B TOUT_C WORD 100 TIP UT READL BIN 0003000000060103 ass UT READ2 BIN 0003000000060103 0834 1 To cancel displaying input candidates and go Step 2 back to the Script editing dialog box press the Esc key G020304_01 VSD 3 Use the up and down arrow keys to select a constant name and press the Enter key to confirm the selection The selected constant name is entered into the Script editing dialog box
112. calculated Return value The obtained TAN value lt Return Value lt Return value G0811_01 VSD Example F D1001 TAN F D0001 When F D0001 3 F D1001 TAN 60 TAN 3 V3 D0001 IEEE code D1001 IEEE code Represents 1 7320508 3FDDB3D7 3 G0811_02 VSD Figure G8 11 Example and Behavior of the TAN Function AN CAUTION Ifs is close to S or E the error in the value of TAN becomes large SEE ALSO The TAN function behaves in the same way as the FTAN instruction in ladder instructions For details on the FTAN instruction see Section 3 3 24 TAN FTAN TAN FATAN in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 24 G8 12 ASIN Arc Sine ASIN is a function for calculating an arc sine value This function stores the arc sine of a real number data s in the return value Return value ASIN s Return Prefix Value Description Constant Expression Arguments id L E r E S B Index Modification A data whose ASIN value is calculated or the first device number of devices for which the ASIN value is calculated The arc sine value Return obtained for s The data type of the v v value return value is the same as that of the argument E Return Value Arguments
113. ccurs during execution in the s1 CPU If s1 is NULL or the string length of s1 is greater than 2047 an instruction processing error occurs during execution in the CPU Input 1 to 2047 If the string length specified by s2 is greater than characters in the string length specified by s1 an instruction string length processing error occurs during execution in the s2 CPU If s2 is NULL or the string length of s2 is greater than 2047 an instruction processing error occurs during execution in the CPU Return Output The start position of the string found first is stored valle If an instruction processing error occurs an indefinite value is returned E Available Devices Arguments Return Prefix xX Y l E L M T CcC D ByYFI W Z R iV HIAYTU Value si S v v v v v v v v v s2 S v v v v v v v v v Return w yvivivilyvly Vv value 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 14 E Function and Example This function searches for string s2 from the first character in string s1 If the function finds string s2 it stores the start position of the string in the return value and if the function cannot find the string it stores 0 in the return value Example d INSTR s1 s2 When s1 0101NGBWR and s2 NG d 5 Sequence of s1 E Oa 1 Sea
114. cessing result is stored Return F If an instruction processing error occurs an value bee indefinite value is returned E Available Devices Return value E Step Counts Prefix Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 5 E Function and Example This function rotates a 16 bit or 32 bit data left by n bits Left Rotate Word is used with a prefix of W when a rotation of a 16 bit data is performed Left Rotate Long word is used with a prefix of L when a rotation of a 32 bit data is performed The carry flag is changed according to the result of the rotation Example W Y00601 LROT W X00501 2 X00516 X00501 0 1 0 0 0 0 1 1 0 1 0 0 1 0 0 1 X00501 From 1 Carry y 2 bit left rotation 0 1 4 0 0 olo JE 0l1 o o 1 olol1lo _ Intermediate processes 1 of ofo o 1 4 o 1 o o o o 1 o 1 yoosos Y00616 Y00601 G0902_01 VSD Figure G9 2 Example and Behavior of the LROT Function SEE ALSO The LROT function behaves in the same way as the LROT instruction in ladder instructions For details on the LROT instruction see Section 3 5 1 Rotate RROT LROT Rotate Long word RROT L LROT L in Sequence CPU Instruction Ma
115. ch script When the script is compiled the automatic space completion function automatically inserts a space character wherever a required space character is missing and also automatically replaces two or more successive space characters with a single space character IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 9 G2 3 G2 3 1 Useful Functions for Editing Scripts This section describes functions for enhancing the capability of a program and improving its readability in script coding Comments and Indents You can enter comments in a script There are two types of comments single line comments which can be written in a whole line and end of text comments which can be written at the end of a line in a script In addition you can use indents to improve the readability of your program End of text comment Single line comment _ Display Ladder Converted from Script r 2 Add up the input data and store the result J UU y FOR CV00001 1 10 IF D00001 lt 0 THEN If the data is negative set it to 0 o1 0 f Add up the data in 00011 000011 000011 D00001 Indents OCOWVONHAMhwW e G020301_01 VSD Figure G2 4 Single Line Comment and End of Text Comment E Single Line Comments This type of comment is written as a single line At the beginning of a line enter two slash characters which are the comment identification characters Then the entire line is handled as a
116. comment The following describes the procedure for entering a single line comment Procedure 1 Click the Edit Mnemonics Script pane 2 Enter two slash characters comment identification characters x Strings that appear after the two slash characters in the current line are processed as a comment Enter followed by a comment Display Ladder Converted from Script q Add up the input data and store the resul CWON AM AWN e Step 2 G020301_02 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 10 3 Press the Enter key to confirm the comment gt The single line comment is confirmed and the position cursor moves to the next line TIP To enter multiple single line comments enter two slash characters in each line E End of Text Comments This type of comment is described as a supplemental comment at the end of a line ina script program Enter two slash characters comment identification characters followed by a string As a result the string is handled as a comment The following describes the procedure for entering an end of text comment Procedure 1 Click the Edit Mnemonics Script pane 2 At the end of a line in a script enter one or more space characters and then enter two slash characters comment identification characters Strings that appear after the two slash characters in the current line are processed as a
117. converts a data s in a BCD format in which the integer part and decimal part a return re separated into a single precision floating point data and writes the result in the value Before the conversion the BCD format has the following format sAAAA BBBB S 2 Sign S sree 0 for the plus sign or 1 for the minus sign AAAA Integer part s 1 A four digit BCD code BBBB Decimal part s 2 A four digit BCD code Example F D0001 BCDF W D0010 D0010 D0011 D0012 Figure Store destination of the Data to be converted floating point data 0000 Sign Conversion D0001 2105 0354 2105 Integer lt lt lt 0354 Decimal G0919_01 VSD G9 20 Example and Behavior of the BCDF Function SEE ALSO The BCDF function behaves in the same way as the BCDF instruction in ladder instructions For details on the Manua BCDF instruction see Section 3 8 5 BCD to Float BCDF in Sequence CPU Instruction Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 43 G9 20 ITOF Integer to Float ITOF is a function for converting a 16 bit or 32 bit integer data into a single precision floating point data Return value ITOF s Return Prefix index Value Description Constant Expression et at Arguments Ww L D F E S B Modification A data to be converted or the first device s number of devices v v v v vA whose data are c
118. ctions Arguments There is no restriction Specify the same prefix as s2 s2 Input There is no restriction Specify the same prefix as s1 Return Output The processing result is stored value E Available Devices Arguments Return Prefix X Y E L M T C D B F WIZ RIVy H ATU P Value Ww v v v v v v v v v v v v v v v v L v v v v v v v v v v v v v v v v D viviviy v v B v v v v v v v Ww L D B W Return L value D B E Step Counts Prefix Step Count Ww 9 L 9 D 26 B 9 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 31 E Function and Example This function performs a logical product of 1 bit 16 bit 32 bit or 64 bit data and assigns the result to the specified device Logical AND 1 bit is used with a prefix of B when a logical product of 1 bit data is performed Logical AND Word is used with a prefix of W when a logical product of 16 bit data is performed Logical AND Long word is used with a prefix of L when a logical product of 32 bit data is performed Logical AND Double Long word is used with a prefix of D when a logical product of 64 bit data is performed The result of each type of logical product has the number of bits shown in the following table The operation result is assigned to the devices star
119. d TIP Spaces and tabs are optimized at compile and deleted except for those at the beginning of a line Step 2 G020301_04 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 12 G2 3 2 Inline Mnemonics You can enter mnemonics in a script Mnemonics coded in a script are called inline mnemonics If it is difficult to achieve a desired task with only a simple script you can enter inline mnemonics in the script to enhance the capability of the program Inline mnemonics Display Ladder Converted fro Script f f Sum up analog input values ajr m m cl Zi J C 3 READ 5 1 DOOO001 4 000011 bo00001 DOOoO0e DOOOOS D00004 D1 to D4 G020302_01 VSD Figure G2 5 Inline Mnemonics Procedure 1 Click the Edit Mnemonics Script pane 2 Enter a colon which is the mnemonic identification character at the beginning of a line The current line can be treated as a mnemonic line 3 Enter a mnemonic string You can enter mnemonic strings as in the case of entering mnemonic strings for ladder instructions 4 Press the Enter key to confirm the line The mnemonic line is confirmed and the position cursor moves to the next line TI P Step 2 G020302_02 VSD You cannot enter more than one mnemonic in a line To enter multiple mnemonic lines enter a colon in each line Delimit the operands of a mnemonic instruction by using space characters Enter a colon
120. d Floating point Approximate Broken Line is used with a prefix of F when a single precision floating point data is approximated The approximation result of a 16 bit or 32 bit integer data is written as an integer value and its error is about 1 y mY t2 t3 _ yoy t0 O 10 Y 5X x x1 y4 fa p EE t1 8 13 _ 20 13 Yp t2 14 a ggg 8 i t3 20 20 165 t4 23 6 t5 26 6 t6 28 0 x Xp Yp t6 2 p 11 16 G0931_01 VSD This function finds the range in which s x exists in the broken line table and then performs a broken line approximation within the range to obtain a return value d yp In the above example this function performs a broken line approximation between t1 8 13 and t2 14 20 Example W D0201 APR W X00201 W D1001 D0101 Broken line table T Table number x y i Approximate data s D1001 D1002 0 iQ 10 i 11 D1003 D1004 1 PE 13 X00201 X00216 D1005 D1006 2 L14 r7i20 D1007 D1008 3 20 20 be nencenennnnenenne boos Approximate data i return value D1013 D1014 6 28 0 LZ 16 eee D0201 D0101 G0931_02 VSD Figure G9 32 Example and Behavior of the APR Function TIP If the prefix is F this function stores n number of tables in the broken line data table at the address one word before the first device address of the broken line data table and then the function passes the data to the FAPR ladder instruction IM 34M06Q16 04E 3rd E
121. dition Dec 25 2013 00 G9 67 SEE ALSO The APR function behaves in the same way as the APR and FAPR instructions in ladder instructions For details on the APR and FAPR instructions see Section 3 8 20 Approximate Broken Line APR Long word Approximate Broken Line APR L and Section 3 8 21 Float Approximate Broken Line FAPR in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Blank Page G10 1 G10 String Manipulation Functions IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 2 G10 1 VAL Convert String to Numeric VAL is a function for converting a string into a numeric value This function converts string s into a numeric value in a format specified by n and stores the numeric value in d VAL n s d Return Prefix Index ra A Description L D E s B Constant Expression Modification A value that specifies the format of the i Vv Y converted numeric value A string or the first s device number of a v v string d The obtained numeric Vv value Return No value is returned value ts fe E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 0 4 If the specified n is less than 0 or greater than or n equal to 5 an instruction processing error occurs during execution in the CPU Input 1 to 2047 If s is NULL or the string leng
122. e Arguments This column shows the return value and arguments of the function 2 Description This column gives the descriptions of the return value and arguments 3 Prefix W If v is shown for W a word type prefix can be used Word type data are stored in a 16 bit format 4 Prefix L If v is shown for L a long word prefix can be used Long word data are stored in a 32 bit format 5 Prefix D If v is shown for D a double long word prefix can be used Double long word data are stored in a 64 bit format 6 Prefix F If v is shown for F a single precision floating point prefix can be used Single precision floating point data are stored in a 32 bit format 7 Prefix E If v is shown for E a double precision floating point prefix can be used Double precision floating point data are stored in a 64 bit format 8 Prefix S If v is shown for S a string type prefix can be used 9 Prefix B If v is shown for B a bit type prefix can be used Bit type data are stored in a 1 bit format 10 Constant If v is shown for Constant a constant can be used IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G6 3 11 Expression If v is shown for Expression an expression can be used Example In this example an expression F D0001 F D0101 is passed to the argument s of the RAD function Return value RAD s F D1001 RAD F D0001 F D0101 12 Index Modification If v is shown for Index Modificat
123. e Section 3 10 6 For Loop FOR Next Loop NEXT and Section 3 10 7 Break Loop BRK in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 9 G11 3 SELECT ENDSELECT Conditional Branch Statement This statement selects and executes the processing that matches conditional expression s1 SELECT s1 CASE s2 Return Prefix Value Description Constant Expression Arguments uid L D j E s B Index Modification The expression for s1 checking whether a v v v v v condition is met An integer compared to s2 the conditional v expression E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments s1 Input There is no restriction s2 Input Specify a range of the prefix type indicated in s1 Return No value is returned value E Available Devices Return Prefix xX Y l E L M T C D BY F W yZ2 R VHA UY P Return value 4 In addition 21 steps are used for each script instruction 2 The step count varies depending on the contents of the SELECT statement IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 10 E Function and Example The program execution is branched depending on the value of the conditional expression SELECT conditional expression CASE constant 1 state
124. e WA FEA FT OCOF C CC CMT ps TE G0401_01 VSD Figure G4 2 Work Devices Displayed in a Ladder Program Edit Window The following shows the naming convention for work devices The type is a string of two alphabetic characters uniquely determined by WideField3 The number is a sequential number starting with 1 and assigned to work devices for each type sM3LIL JL Prefix Type Number G0401_02 VSD Figure G4 3 Naming Convention for Work Devices TIP Among work devices start script relays SM3ON do not have a number IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G4 4 Display Format in a Program Monitor Window Online In a program monitor window work devices are displayed as addresses automatically assigned by WideField3 and are monitored in the same way as devices used in a script or ladder program A work device used in the script A Monitor Block BLKOO1 BLKOO1 The execution logic circuits of the script oy G0401_03 VSD Figure G4 4 Work Devices Displayed in a Program Monitor Window A CAUTION Work devices in a ladder program converted from a script cannot be used for cross referencing or device lists IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 1 G5 Debugging Scripts This chapter describes debugging functions for scripts The following debugging functions are supported Debugging Functions before Scripts are Transferred to the CPU Comp
125. e end of the script Figure G2 3 Start Script Relay SM3ON 00001 00004 00005 ooo06 00007 00008 SIBON 00003 QE ox A CMT hese hrs 3 ol show 2 D00002 D00003 Mov D00001 Mov D00001 D00004 Mov D00002 D00003 CMT Gord csa 3596 M soos a sey S775 CMT re 3 ol zl gt Display Contents in the Ladder Conversion Window G0201_06 VSD The program opened in the ladder conversion window always contains the sM3ON relay as it is required to run a script converted into ladders sM3ON is called a start script relay VON CAUTION Even if you enter a hexadecimal constant in a script the constant is displayed in decimal format in the converted ladder program IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 7 E Displaying the Ladder Conversion Window Use the following procedure to display a script converted into a ladder program Procedure 1 Make sure the Edit Block or Edit Macro window is open n 2 Move the position cursor to the script P ae _ instruction you want to display in the ladder format L Display Ladder Converted from Script D00001 D00002 D00003 mov D00001 D00004 mov Doo002 000003 Step 2 G0201_07 VSD 3 Select View Display Ladder Converted from Script from the menu gt The ladder conversion window is displayed for t
126. e lin COMMENT eeeeeeeetteeeeettteeeeeaes G2 9 single precision floating point type G3 16 G6 2 SINS String Insertion 0 cc eeeeeeeeeeeeees G10 25 SLEN String Length Count G10 9 SMOV String MoVe 0 ccceeeeeeeeeeetteeeeeeees G10 7 SOR Square Root seereis G8 14 Start script relay o cccceescecesescceenesencesesreeedeneeseee G2 6 Step COUNT niwnsieneienhaa eee G6 3 STR Convert Numeric to String G10 5 String COMPALISON 0 eee eeeceeeeeeeeeeeeeteeeeeeteteeeeaes G3 7 String concatenation reenen G3 7 string manipulation FUNCTION eters G10 1 string manipulation operator eceeees G3 7 SUING TYPO orai a G3 16 G6 2 SUDA CUOMN soraira nn G3 4 SUM Summation Value 2 G8 2 SUNIT Byte unit Characters to String G10 42 SWAP SWap sicdercssccudesnsacersadecetatiectensaedertaane G9 26 SYMNLAX CHECK se sdchevevcasadexsasgecesvensaceesusgeedeuisetexensees G5 7 syntax check and error messages G5 9 T tag NAME css iaedbenaddnie aie G2 13 G3 20 TAN TANGent eeeeeeeseeceeeeseeneeeeeeeneeeeeeeeaees G8 22 TRIM Leading and Trailing Space Deletion ceeeeceeceeeeeeeeeeneeeeeeenneeeeeeaes G10 30 TRUE eect artinateticeeteaiieed ain tedienen dn G3 20 type CONVEFSION 0 eeeeeeeeeeeeeeeseeeeeeeteeeeeeeeentees G3 17 V VAL Convert String to Numeric e G10 2 W Word type sssssssssssnsssestennenssrrenrnnnnnserernn nnn G3 16 G6 2 work device seeen G
127. e loop is executed only once If s1 is greater than or equal to s2 the loop is executed only once Return E Available Devices Prefix No value is returned Return value Step Count t 2 4 In addition 21 steps are used for each script instruction 2 The step count varies depending on the contents of the FOR statement IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 6 E Function and Example This statement uses devices specified by d as a counter and repeats processing between FOR and NEXT while the counter changes from s1 initial value to s2 final value The following types of repetitive statements FOR statements are supported 1 Normal Type FOR repetition counter repetition initial value repetition final value statement 1 NEXT Statement 1 is executed repeatedly from the repetition initial value of the repetition counter to the repetition final value This is the same as the FOR NEXT instruction in ladder instructions For example if the repetition initial value is 1 and the repetition final value is 10 statement 1 is executed 10 times 2 With Conditional Break Type FOR repetition counter repetition initial value repetition final value statement 1 IF stop condition THEN BRK ENDIF NEXT Statement 1 is executed repeatedly from the repetition initial value of the repetition counter to the repetition final va
128. e lower byte 8 bits as the second character TIP There is no ladder instruction corresponding to the TRIM function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 32 G10 15 RTRIM Trailing Space Deletion RTRIM is a function for deleting trailing spaces from a string Return value RTRIM s Return Prefix index Pisa is Description L D F E s B Constant Expression Modification A string or the first s device number of a v v v v string Return The obtained string v value E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If s is NULL or the string length is greater than characters in 2047 an instruction processing error occurs string length during execution in the CPU s A a If the string specified by s contains only space characters an instruction processing error occurs during execution in the CPU R Output The obtained string is stored eturn value If an instruction processing error occurs an indefinite value is returned E Available Devices Prefix X Y l 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 E Function and Example This function deletes trailing space characters from string s and writes the remaining string in return value d If string s is NULL the return value is also NULL When s
129. e operation manuals of your computer or printer as required E Structure of the Manual This manual consists of 1 part G Part G describes all functions of the script PART G_ Script Editing Manual G1 Overview of Scripts This chapter describes the overview and limitations of the script G2 Creating and Editing Scripts This chapter describes how to create scripts as well as useful functions for editing scripts G3 Script Syntax This chapter describes the script syntax G4 Setting a Script in a Project This chapter describes how to set a script in a project G5 Debugging Scripts This chapter describes how to debug scripts G6 G11 Script Functions These chapters describe script functions IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 E How to Read This Manual Be sure to read the Introduction as well as How to read this manual before using WideField3 Part G of the manual describes all functions of the script We have tried to make the user interface operations and editing functions of the WideField3 application as similar as possible to other generally available Windows software This manual does not contain information on general Windows editing operations which are not specific to WideField3 E Notation Notation for Windows Screens and Operation Items in initial caps denote symbols names and window names Example WideField3 Program Monitor dialog Bracketed items denote menu bar items
130. e or falling edge has been detected is executed When you use the BRK statement the condition for forcibly terminating a FOR NEXT loop must be met only after the loop is executed at least once SEE ALSO For details on the FOR statement see Section G11 2 FOR NEXT Repetitive Statements in this manual For details on nesting see Section G3 3 4 Restrictions on Control Statements in this manual IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 3 3 G3 13 Script Exit Statements The EXITSCRIPT statement is called a script exit statement You can insert an EXITSCRIPT statement to exit the script without executing the part written after the EXITSCRIPT statement The following types of the script exit statements EXITSCRIPT statements are supported Unconditional Exit Type statement 1 EXITSCRIPT statement 2 Statement 1 is executed After that the script exits with the EXITSCRIPT statement and statement 2 is not executed Conditional Exit Type statement 1 IF condition A THEN EXITSCRIPT ENDIF statement 2 Statement 1 is executed After that if condition A is true the script exits and statement 2 is not executed If condition A is false statement 2 is also executed TIP You can use the EXITSCRIPT statement with branch statements IF and SELECT statements and repetitive statements FOR statements The EXITSCRIPT statement turns off its input condition and executes the
131. e other data sizes IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 17 G9 8 MOV Simplified Move The simplified MOV is a function for transferring only one data This function transfers the data of devices specified by s based on the size of the prefix to the devices specified by d MOV s d Return Prefix Index Pees Description D F E s B Constant Expression Modification The first device number 5 of devices i e the V V 7 s Vv V source from which data are transferred The first device number of devices i e the destination to which d the transfer data are v v v v v assigned Specify the same data type as s Return No value is returned value 1 Specify the same prefix for s and d If B is specified for d no constant or expression can be used for s E Return Value Arguments Reun Value Arguments Input Output Behavior Restrictions s Input There is no restriction Specify the same prefix as d d Output There is no restriction Specify the same prefix as s Return N A value Arguments Return Prefix xX Y l M T C D B FI W Z R i VIHA UY P Value Ww v v v v v v v v v v v v v v L v v v v v v v v v v v v v v D vilvilvliy v v s F v v v v v v v v v v v v v v E vivilvliy v v B v v v v v Ww v v v v v v v v v v v v v L v v v v v v v v v v v v v D v v
132. e prefix as d d Output There is no restriction Specify the same prefix as s Input 0 lt n lt 8191 If O is specified the transfer result is set to 0 n If the specified n is less than 0 or greater than or equal to 8192 the return value is 1 error Return Processing result 0 Normal When an error 1 occurs the operation is not performed value 1 Error and the value before execution is maintained in d IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 15 E Available Devices Y E M Ww vivilylyvly vilvivliy y e7 L vivilyvylyvlyv vilvivlily v 7 D vivilylyvlyv vilvilvliy v v F vivilylyvlyv vilvilvliy v v E vivilylvly vilvivlily r y Ww vivilylyvlyv lylei v 7 L vivilylyvlyv vivivlily v r D vivilylyvlyv vilvilvlily r v F vivilylvlyv sley v 7 E vivilylvlyv vilvilvliy v v n Ww vivilyvlyvlvlyv vilvilvliy y 7 Return w sall z f lviv v v value E Step Counts Prefix Step Count Ww 35 L 35 D 35 F 35 E 35 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 16 E Function and Example This function transfers data contents for n points based on the size of the prefix specified by s from the devices specified by s to the devices specified by d Move Word is used with a prefix of W when a 16 bit data is tra
133. e processing result is stored Arguments Return Value Return value 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 54 E Function and Example This function converts a double precision floating point data into a 64 bit integer data This function is used before the result of a double precision floating point operation is used as an integer Example V PoI 1 0 0 0 0 0 0 1 0 01 1 0 0 11110 1 0 0 110 11010 110 010 11011111010100 110 0111 111 110 110 0 11110 0 0111110 1111110 0 111 1 IEEE code gt Cea D0104 ierte ee hae e eee ee eee D0103 eerees gt lt credible asia D0102 eager ee eee DO101 crreeeee gt i 4 Represents floating point 1234 56789 4093 4A45 84F4 C6E7 V V Ena 01 ooo ooo ooo ooo oe ooo oo ooo ooo oo fol gt ee D0004 eerees gt eee D0003 lt gt a ETETETT D0002 eesse gt RETETEI D0001 lt gt Represents an integer 1234 0000 0000 0000 04D2 G0925_01 VSD Figure G9 26 Example and Behavior of the ETOD Function SEE ALSO The ETOD function behaves in the same way as the ETOI D instruction in ladder instructions For details on the ETOI D instruction see Section 3 8 9 Double
134. eField3 Offline IM 34M06Q16 02E Local Devices You can use local devices in scripts When entering a local device in a script prefix a device with a slash character as in the case of ladder instructions Example W D00001 1 VON CAUTION When you use local devices in a division calculation you must enter a space character after a division operator If the space character is missing a local device name is handled as an end of text comment Example D00030 D00020 D00010 A division by D00010 is performed D00030 D00020 D00010 D00010 is handled as an end of text comment SEE ALSO For details on how to use local devices see Chapter F2 Using Local Devices in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 14 Index Modification In scripts you can use both constant index modifications and index modifications with index registers When entering an index modification in a script add a semicolon after a device followed by an index register or a constant as in the case of ladder instructions Example W D00001 V001 123 for using a word index register W D00001 V001L 123 for using a long word index register W D00001 100 123 for using a constant index modification VON CAUTION Use a long word L prefix if using a long word index register except for index modification Example L V001 100 Correct description
135. eater than s characters in 2047 an instruction processing error occurs string length during execution in the CPU Input 1 2047 If the number of characters to be extracted n is greater than the string length specified by s an instruction processing error occurs during execution in the CPU R Output The obtained string is stored eturn f a value If an instruction processing error occurs an indefinite value is returned E Available Devices Arguments Return Prefix X Y E Lb M T C D B F WI Z RIVy H ATU P Value s S v v v v v v v v v n Ww v v v v v v v v v v v v v v v v Return S value 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 E Function and Example G10 20 This function extracts an n character substring from the right side of source string s and writes the substring in the return value Example d RIGHT s n When s ABC01234 and n 5 d 01234 f A B s 1 i y i s 2 qr 9 s 3 Ee hae s 4 00 Sequence of d 0 4 19 3 4 00 Figure G10 7 TIP Sequence of s No of characters n 5 5 characters Extract 5 characters from the right side ABC01234 hd 5 characters G1009_01VSD Example and Behavior of the RIGHT Function The functions which process strings handle the upper byte 8 bits
136. ect will move that balloon comment to the corresponding script instruction line in the offline circuit editing screen IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G1 7 Saving in Card Load Format Project If a script uses any tag name saving project data in card load format without tag name definitions leaves tag names in the script as they are instead of being converted to the corresponding addresses This causes a syntax error if you open the project in card load format and perform a syntax check on the project because unallocated tag names are used Therefore store the tag name definitions when a script uses any tag name Displaying Project Settings Configuration for Running Program For a running program the script setup shown in the Project Settings screen is the one at the time of the connection This means if project settings of scripts stored in the CPU are modified from another personal computer during connection to the CPU the script setup at the start of the connection will be displayed instead of the one stored in the CPU IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Blank Page G2 1 Creating and Editing Scripts This chapter describes how to create and edit scripts Before creating a script you must first enter a script instruction A script instruction is used to call a script from a ladder program and can be entered only on the output side You can set a script number from 1 to 9 999 prefixed w
137. ed The bit length m bit m length of a data to be v v v shifted The number of bits n V j Y a bits to be shifted Return No value is returned value E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input Output There is no restriction Return value Input E Available Devices 32768 lt m lt 32767 32768 lt m lt 32767 There is no restriction There is no restriction Arguments Return Prefix X Y I L M T C Bi F W Z R V HJA UIP Value d WwW v v v v v v v v v v v v v m WwW v v v v v v v v v v v v v v n w v v v v v v v v v v v v v v Return value 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 11 E Function and Example This function shifts an m bit length data right by n bits The carry flag is changed according to the result of the shift operation After a shift operation mbit __ 3 gt Carry T T T T T T T T T T l l l l l l l l l l I l l l I l l l l l l l l l l l l l L _ 1 l l n bit right shift G0905_01 VSD Example RSETN W DO0001 18 3 Lower two D0001 bits of D0002 D0001 Before the 0 0 1 0 0 0 1 1 0 1 0 O0 operation A L Discarded 1 D0001 After the operation
138. eeneeeeseeneeeneeeneeens G10 25 G10 13 REPLACE String Replacement cccsccccessseeeesssneeeesseeeeesseeeeenes G10 27 G10 14TRIM Leading and Trailing Space Deletion ccssseessseeeees G10 30 G10 15RTRIM Trailing Space Deletion cccccceesseeeeeseneeeeeeereeneseeeeees G10 32 G10 16LTRIM Leading Space Deletion ccccccessseccesseneeeseeneensseeeenes G10 34 G10 17 RPAD Right side Character Addition ccsssseeeesseeeeeeseeeeees G10 36 G10 18LPAD Left side Character Addition cccssseceesseneeesseneeeeeseeeeenes G10 38 G10 19SDIST String to Byte unit Characters cccccesseeeeesereeeeeeeeeeees G10 40 G10 20 SUNIT Byte unit Characters to String ccccessseeeesseeeeeeesseeeeees G10 42 G11 Program Control FUNCtIONS ccccccceeeeeeeeeeeeeeeeeeeeeeeeneeeenaee G11 1 G11 1 IF ENDIF Conditional Branch Statements cssscsessereeeeeeee G11 2 G11 2 FOR NEXT Repetitive Statements cccccesseeeeeseeeeeeeseeeeeeeeeees G11 5 G11 3 SELECT ENDSELECT Conditional Branch Statement G11 9 G11 4 EXITSCRIPT Script Exit Staterent ccccsseeceseeeeeeeeeseeeeeeeeeeees G11 12 aro ES O sane ATT Index 1 Revision Information asec eset cee eee ceed i IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 This manual describes all functions of the script IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Blank Page G1 1 G1 Overview
139. ement is as follows SELECT conditional expression CASE constant 1 statement 1 CASE constant 2 statement 2 DEFAULT statement 3 ENDSELECT If the value of the conditional expression matches constant 1 statement 1 is executed If the value of the conditional expression does not match constant 1 but matches constant 2 statement 2 is executed If the value of the conditional expression does not match constant 1 or 2 statement 3 is executed TIP Constants specified for CASE can contain multiple values and a value range Example CASE 1 CASE 2 8 11 30 CASE 40 50 CASE 60 70 80 90 Single value only 1 Multiple values 2 8 11 and 30 Value range range from 40 to 50 Multiple values and value range range from 60 to 70 80 and 90 IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 10 DEFAULT can be omitted You can specify constants and constant names to CASE Constants can be specified in decimal and hexadecimal formats In hexadecimal format put at the start of a constant Example CASE FF Specifies FF 255 in decimal format FON CAUTION If there are more than one constant that matches CASE a statement specified earlier has precedence The subsequent statement s are not executed Example SELECT D00001 CASE 1 f the value of D00001 is 1 statement 1 CASE 2 20 f the value of D00001 is between 2 and 20 statement 2 CASE 15 f the value of D00001 is 1
140. en Error Cannot be changed Device is Invalid or out of range SEE ALSO For details on tag name definitions see Chapter E2 Tag Name Definition in A device area used in a ladder program overlaps a script work device area Tool WideField3 Offline IM 34M06Q16 02E For details on constant definitions see Chapter E3 Constant Definition in Tool WideField3 Offline IM 34M06Q16 02E Block file name Block name Error Cannot be changed FA M3 Programming FA M3 Programming IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 10 G5 3 Monitoring Converted Ladders In program monitoring a ladder program converted from a script is displayed below the script instruction You can monitor and debug the converted ladder program as in the case of other ladder programs E Monitor Block BLKO01 BLKO01 Display Real Address 100003 B SCRIPT STOO03 DER 00003 100833 Monitoring a script Guy wee D00002 123 oo0003 123 using ladders oaa es a Psa beat converted from the 4 j aaa 248 script ooo0s 100833 p tat Mov oo0001 246 D00004 246 00006 100833 tH MoV D00002 D00003 123 123 a 7226 RCS 3686 Figure G5 3 Monitoring of a Converted Ladder Program G0503_01 VSD A converted ladder program that is monitored is displayed as a shaded area in a standard program monitor screen The
141. epetitions if the count exceeds 10 BRK ENDIF NEXT TIP The repetition initial value and repetition final value that are set when the FOR function is executed for the first time are used throughout all repetitions The number of repetitions is unchanged even if you modify the repetition initial value or repetition final value during repetitions The processing between FOR and NEXT is executed only once if s1 repetition initial value is equal to or larger than s2 repetition final value Use the BRK statement to forcibly terminate a FOR NEXT loop Using EXITSCRIPT instead of BRK terminates processing and exits the script after processing breaks out of repetitions AY CAUTION You can nest FOR statements by including one FOR statement within another The maximum nesting level is eight A compile error occurs if the nesting level exceeds the maximum The IL ILC instruction is used when a FOR statement is converted into a ladder program An instruction processing error occurs during execution in the CPU if the nesting level of an IL ILC instruction including the nesting in scripts and ladder program exceeds eight The FOR NEXT instruction is used when a FOR statement is converted into a ladder program An instruction processing error occurs during execution in the CPU if the nesting level of the following exceeds 16 FOR statements in scripts Script functions for which FOR NEXT instructions are used in functions
142. er byte 8 bits as the second character TIP There is no ladder instruction corresponding to the RPAD function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 38 G10 18 LPAD Left side Character Addition LPAD is a function for adding characters on the left side of a string Return value LPAD s1 n s2 E Return Value Arguments Return Value Arguments Input Output Return Prefix index Ped s Description L D F E s B Constant Expression Modification A source string to which characters are added or s1 the first device number lt x fi a of the source string The string length after addition or the first n device number of v v v devices for the string length after addition A character to be added to the source string or 52 the first device number vy V s of another string whose first character is added to the source string Return The string obtained by y value the addition Range 0 to 2047 characters in string length Behavior Restrictions If the string length specified by s1 is greater than 2047 an instruction processing error occurs during execution in the CPU If s1 is NULL the return value is a string that is filled with the string s2 s until its string length becomes n 2 1 to 2047 characters in string length If n is 0 or less or n is less than or equal to the string length specified by s1 an instruction processing
143. ert the data types in the right hand side to the data type of the multiplication result If you omit the data conversion a part of the value obtained in the multiplication may be lost Example L DO0003 L W D00001 L W D00002 The data types on the right hand side are converted into long word L D D00005 D L D00001 D L D00003 The data types on the right hand side are converted into double long word D In scripts there is no data type larger than the double long word D type in size such that if the multiplicand in a multiplication is a double long word D value the multiplication result is also a double long word D value IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 19 G3 4 4 Data Types in Functions This section describes data types in functions E Data Types of Arguments The data type that can be specified for each argument in each script function has been predefined A compile error occurs if a data type that cannot be specified is passed to a function In the following example a compile error occurs because a long word argument is passed to the RAD function which accepts only a single precision floating point F value as its argument Example RAD L DO00001 Incorrect argument type RAD F D00001 Correct argument type m Data Types of Return Values The data type of the return value of each script function has been predefined If a function supports more than one data type for its return val
144. erted ladder program In addition the number of lines in a ladder program converted from a single script instruction cannot exceed 2 000 lines A compile error occurs if it exceeds 2 000 lines Maximum Number of Characters per Line in a Script You cannot use one or more line feeds to code in multiple lines The maximum number of characters per line in a script is 499 characters There is no restriction on the number of lines in a script although the maximum number of all characters for each script is 10 240 characters IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G1 6 Searching and Replacing in a Script and Changing I O Installation Position Device searching replacement within a script cannot be performed When performing a device search of a ladder program the cursor moves to the script instruction when the searched for item is found in the script For device replacement in a ladder program moving to or replacing the script instruction cannot be performed The contents of a script are not modified even if you use the Replace in Project function or Change I O Installation Position function roe Circuits for a Tag Name Definition and Deleting Unused Tag ames Even if you use the Read Circuits function for a tag name definition the devices used only in a script are not read in the tag name definition Also if you delete unused tag names the devices used only in a script are deleted from the tag name definition Circu
145. es to v Y be transferred The first device number of devices i e the destination to which d the transfer data are v assigned Specify the same data type as s Return Returns 0 normal or 1 y value error E Available Devices Prefix Ww Return Value Input Output Range Behavior Restrictions Arguments Input There is no restriction Specify the same prefix as d Input 1 lt n1 lt 2047 If the specified n1 is 0 or less or greater than or nf 0 lt nit n2 1 lt 2047 equal to 2048 the return value is 1 error If not in the range of 0 lt n1 n2 1 lt 2047 the return value is 1 error Input 0 lt n2 lt 2047 If the specified n2 is less than 0 or greater than O lt n1 n2 1 lt 2047 or equal to 2048 the return value is 1 error If n2 not in the range of 0 lt n1 n2 1 lt 2047 the return value is 1 error If n2 0 the transfer result d is set to 0 d Output There is no restriction Specify the same prefix as S Return Processing result 0 Normal When an error 1 occurs the operation is not 1 Error performed and the value before execution is value ae maintained in d IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 22 E Step Counts Prefix Step Count w 234 4 In addition 21 steps are used for each script instruction E Function and Exa
146. etails on the FASIN instruction see Section 3 3 22 SIN FSIN SIN FASIN in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 26 G8 13 ACOS Arc Cosine ACOS is a function for calculating an arc cosine value This function stores the arc cosine of a real number data s in the return value Return value ACOS s Return Prefix index reine Description W L D F E s B Constant Expression Modification A data whose ACOS value is calculated or the first device number 3 of devices for which the d ACOS value is calculated The arc cosine value Return obtained for s The data type of the v v value return value is the same as that of the argument E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 lt s lt 1 If a value outside of the valid range is entered an instruction processing error occurs during execution in the CPU Output The processing result is stored Return If an instruction processing error occurs during value execution in the CPU the return value is undetermined E Available Devices Step Count 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 27 E Function and Example This function calculates the single precision floating
147. etween relays PMOV W X10101 W Y10201 5 X10105 X10101 X10101 BIN code 1101110 o Y10216 1 Y10201 v v HA BIN code o oj o olo o o olo o o 1 o l1 ol o Filled with Os f Y10205 Y10201 G0909_01 VSD 2 Transfer from relays to a register PMOV W X10101 W D0001 5 X10105 X10101 X10101 Pi pam D0001 i BIN code o ololololo lo o ololol1alo Filled with Os G0909_02VSD Figure G9 9 Example and Behavior of the PMOV Function SEE ALSO The PMOV function behaves in the same way as the PMOV instruction in ladder instructions For details on the PMOV instruction see Section 3 7 3 Partial Move PMOV in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 21 G9 10 HMOV Byte Block Move HMOV is a function for transferring data in the specified byte range This function transfers the n1 th to n2 th bytes of a data starting from s to addresses starting from d Return value HMOV s n1 n2 d E Return Value Arguments Return Prefix Index reine A Description W L D F E s B Constant Expression Modification The first device number of devices i e the Vv source from which data are transferred The byte number of a n1 byte from which the v v v v transfer starts n2 The number of byt
148. even if the script contains an error If you move the position cursor to the script instruction the Check Errors button is enabled on the Edit Mnemonics Script pane allowing you to compile the script again and check the results If the script has no error the Check Errors button is disabled and cannot be selected While editing a script you can cancel the last result you edited and restore the previous state To cancel the last result select Undo on the popup menu or use the corresponding shortcut key In the Edit Mnemonics Script pane you can perform a copy or move operation in the script To perform a copy or move operation select Copy Cut or Paste on the popup menu or use the corresponding shortcut key IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 5 VON CAUTION You can save blocks and macros even if a script contains a compile error Note that the save operation saves scripts and then ladder programs Thus if a script contains a compile error conversion is not performed even if the modified ladder program is correct in regard to circuits without any conversion error When you open the block or macro again the program is displayed with shading indicating that the program is not converted yet The menu bar is not available while you are editing a script To access a function you want to use to edit the script select the function by opening the popup menu or use the corresponding shortcut key You
149. evice specified by d Move Word is used with a prefix of W when a 16 bit data is transferred multiple times Move Long word is used with a prefix of L or F when a 32 bit data is transferred multiple times Move Double Long word is used with a prefix of D or E when a 64 bit data is transferred multiple times The return value indicates whether the function is executed normally 0 or an error occurs 1 Example 1 Word data W D3101 BSET 0 W D0001 2048 Data register D0001 0 D0002 0 Transfer D0003 0 0 j D0004 0 D2047 0 D2048 0 G0911_01 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 25 2 Long word data W D3101 BSET 1111AAAA L D0001 1024 Data register D0001 1111AAAA D0003 1111AAAA Transfer D0005 1111AAAA 1111AAAA gt gt D0007 1111AAAA D2045 1111AAAA D2047 1111AAAA G0911_02 VSD Figure G9 11 Example and Behavior of the BSET Function SEE ALSO The BSET function behaves in the same way for 16 bit data as the BSET instruction in ladder instructions For details on the BSET instruction see Section 3 7 5 Block Set BSET in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E The difference is only in the data size for 32 bit and 64 bit data while the basic behavior is the same as that for the other data sizes IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 26 G9 12 SWAP Swap SW
150. executed If conditions A and B are false statement 3 is executed Example 1 When a conditional branch statement is not nested IF B X00501 1 THEN B Y00601 1 ELSE B Y00601 0 ENDIF x00501 7 _ yYoo6o1 ___ w __ G1101_01 VSD Figure G11 1 Example and Behavior of an IF Statement Not Nested IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 4 2 When two conditional branch statements are nested IF B X00501 1 THEN B Y00601 1 B Y00602 1 ELSE IF B X00502 1 THEN B Y00601 0 B Y00602 1 ELSE B Y00601 0 B Y00602 0 ENDIF ENDIF X00501 EF X00502 71 Y00601 a au Y00602 _ n G1101_02 VSD Figure G11 2 Example and Behavior of Two IF Statements Nested TIP There is no ladder instruction corresponding to the IF ENDIF statement You can insert an EXITSCRIPT statement to exit the script without executing the part written after the EXITSCRIPT statement depending on the specified condition AN CAUTION You can nest IF statements by including one IF statement within another The maximum nesting level is eight A compile error occurs if the nesting level of both IF and SELECT statements exceeds the maximum You can omit an ELSE and statements under the ELSE in both single and multiple branch types but cannot omit any THEN or ENDIF A compile error occurs if a THEN or ENDIF is missing In multiple branch types a space character is req
151. fore execution is maintained Return N A value E Available Devices Arguments Return Prefix X Y E L M T C D B F WI Z RIVy H ATU P Value S Return value E Step Counts Prefix Step Count S 105 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 41 E Function and Example This function divides a string specified by a division source device s into byte units and stores the data in devices specified by the destination device d Example SDIST s d Example of the sequence of s 123456 Result d s T 2 d 00 i a e a m o s 2 5 6 characters d 2 00 3 s 3 00 End of the string Null d 3 00 4 d 4 00 5 d 5 00 6 G1019_01 VSD Figure G10 18 Example and Behavior of the SDIST Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character TIP There is no ladder instruction corresponding to the SDIST function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 42 G10 20 SUNIT Byte unit Characters to String SUNIT is a function for combining characters in byte unit as many word unit characters as you specify to make a continuous string Re
152. from which nit the replacement starts ig The number of characters that are n2 replaced with another x i string The string obtained by Return the replacement is v value stored m Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If s1 is NULL or the string length of s1 is greater s1 characters in than 2047 an instruction processing error occurs string length during execution in the CPU Input 1 to 2047 If s2 is NULL or the string length of s2 is greater s2 characters in than 2047 an instruction processing error occurs string length during execution in the CPU Input 1 2047 If n1 is O or less an instruction processing error occurs during execution in the CPU n1 If n1 is greater than the string length specified by s1 an instruction processing error occurs during execution in the CPU Input 1 2047 If n2 is 0 or less an instruction processing error occurs during execution in the CPU n2 If n2 is greater than the string length specified s2 the number of characters specified by n2 is ignored and as many characters as the string length of s2 are replaced R Output The obtained string is stored eturn A value If an instruction processing error occurs an indefinite value is returned IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 28 E Available Devices Arguments Return Prefix X Y l E L M T c D B F WZ RIV H AJU P Value s
153. g of script work device F The setting of a script work device area in the cache register F is not correct Error Cannot be changed Invalid area setting of script work device V The setting of a script work device area in the index register V is not correct Error Cannot be changed Script work device I area and local device l area are overlapping In the internal relay I a script work device area and a local device area overlap each other Error Cannot be changed Script work device F area and local device F area are overlapping In the cache register F a script work device area and a local device area overlap each other Error Cannot be changed Duplicate blocks using script registered in executing program Multiple blocks that use scripts and have the same name are registered in the executable program Error Cannot be changed Script cannot be used with the sensor CB Scripts cannot be used in the sensor control block Error Cannot be changed Script cannot be used in interrupt processing Scripts cannot be used in interrupt processing INTP IRET Block file name Block name Error Cannot be changed Script setup in project settings is not specified Script Setup in Project Settings Configuration is not configured Or Do Not Use is selected under Configuration Use Do not use in the Project Settings scre
154. grees into radians This function converts the unit of an angle s from degrees into radians and stores the obtained value in the return value Return value RAD s Return Prefix Index nad A Description W L D F E s B Constant Expression Modification An angle value in degrees to be converted or the first s device number of the v v v v devices that are converted i e conversion source The data type of the Return return value is the same value as that of the argument v v The unit of the return value is radians E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input There is no restriction Output The processing result is stored E Available Devices en en Prefix Value F Bo Gob S Return F viviviviy vil v lyvilvjJutvilyvijyivliy value E Step Counts Prefix Step Count 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 60 E Function and Example This function converts the unit of an angle from degrees into radians The relational expression is as follows Return value s x 7 180 Ss Conversion source in degrees Return value Conversion destination in radians Example F D1001 RAD F D0001 D0001 eo a o 0 ac ola olo 11 ic olo
155. h high temperature or humidity Since the CPU module has a built in battery avoid storage in places with high temperature or humidity Since the service life of the battery is drastically reduced by exposure to high temperatures take special care storage surrounding air temperature should be from 20 C to 75 C There is a built in lithium battery in a CPU module and temperature control module which serves as backup power supply for programs device information and configuration information The service life of this battery is more than 10 years in standby mode at room temperature Take note that the service life of the battery may be shortened when installed or stored at locations of extreme low or high temperatures Therefore we recommend that modules with built in batteries be stored at room temperature Always turn off the power before installing or removing modules Failing to turn off the power supply when installing or removing modules may result in damage IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 vii Do not touch components in the module In some modules you can remove the right side cover and install ROM packs or change switch settings While doing this do not touch any components on the printed circuit board otherwise components may be damaged and modules may fail to work Do not use unused terminals Do not connect wires to unused terminals on a terminal block or in a connector Doing
156. h is greater than characters in 2047 an instruction processing error occurs string length during execution in the CPU s Aa If the string specified by s contains only space characters an instruction processing error occurs during execution in the CPU Return Output The obtained string is stored value If an instruction processing error occurs an indefinite value is returned E Available Devices Arguments Return Prefix X Y 1 E LC M T C D B F W Z R V H AYU P Value Fos s EA Step Count 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 E Function and Example G10 31 This function deletes leading and trailing space characters from string s and writes the remaining string in return value d If string s is NULL the return value is also NULL Example d TRIM s Delete leading and trailing spaces When s 123456 d 123456 Example of the sequence of s 123456 ui ui s 1 a 1 s 2 2 3 s 3 4 D s 4 6 i s 5 Cit ee eee Figure G10 13 TIP End of the string Null d 1 d 2 d 3 Result d 123456 z a A z TE Example and Behavior of the TRIM Function _ End of the string Null G1014_01 VSD The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character th
157. he grounding system Configure for CE Marking Conformance For compliance with CE Marking perform installation and cable routing according to the description on compliance to CE Marking in the Hardware Manual We recommend that you stock up on maintenance parts We recommend that you stock up on maintenance parts including spare modules in advance Preventive maintenance replacement of the module or its battery is required for using the module beyond 10 years For enquiries on battery replacement service for purchase contact your nearest Yokogawa Electric representative or sales office The module has a built in lithium battery Lithium batteries may exhibit decreased voltage and in rare cases leakage problems after 10 years Discharge static electricity before touching the system Because static charge can accumulate in dry conditions first touch grounded metal to discharge any static electricity before touching the system Wipe off dirt with a soft cloth Gently wipe off dirt on the product s surfaces with a soft cloth If you soak the cloth in water or a neutral detergent tightly wring it out before wiping the product Letting water enter the module interior can cause malfunctions Do not use volatile solvents such as benzine or paint thinner or chemicals for cleaning as they may cause deformity discoloration or malfunctioning Avoid storing the FA M3 controller in places wit
158. he maximum SEE ALSO For details on the precedence of operators see Section G3 2 6 Operator Precedence in this manual AN CAUTION G3 2 5 G3 2 6 Do not compare with NULL when comparing strings If compared it is possible that an instruction processing error will occur during execution in the CPU and a correct result will not be attained The string concatenation operator amp cannot process data other than string type S data Other Operators This section describes other operators Table G3 5 List of Other Operators Supported in Scripts Usage Examples Symbols Operations in parentheses take precedence W D00004 W D00003 W D00001 W D00002 Assigns the value or operation result of the right W D00003 10 hand side to the left hand side W D00003 W D00001 W DO00002 SEE ALSO For details on the precedence of operators see Section G3 2 6 Operator Precedence in this manual Operator Precedence Operators have precedence Operators with the same precedence in a script statement are executed from left to right The following table shows the precedence of operators Table G3 6 Operator Precedence Precedence Operators Description Highest Parentheses Increment decrement Sign inversion NOT Logical negation MOD Multiplication division remainder Addition subtraction amp String concatenation lt gt gt gt lt
159. he prefix F is specified an index modification cannot be used E Return Value Arguments Return Value Arguments Input Output Return Prefix index iad m Description w L D F E s B Constant Expression Modification The first device number of devices to which a s broken line v v v v v approximation is applied The first device number t of a broken line data v v v Ti table The number of tables in n2 the broken line data v v v table Return Approximation result Vv Z P value Behavior Restrictions There is no restriction There is no restriction There is no restriction The processing result is stored E Step Counts 41 In addition Prefix Step Count wW 10 L 10 F 19 M D B F w v vliv L Iy T yiv F v vliv w MAAA L vliv F vliv w v vlivy w Iv ae ae ee L v vliv F v vliv 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 66 E Function and Example This function approximates a 16 bit or 32 bit integer data or a single precision floating point data according to a broken line table Word Approximate Broken Line is used with a prefix of W when a 16 bit integer data is approximated Long word Approximate Broken Line is used with a prefix of L when a 32 bit integer data is approximate
160. he script berge D00002 gt D00003 MOV sumawi D00001 TI P mov D00001 D00004 Clicking the Display Ladder Converted from mov oomo ooooos Script button also displays the script converted into a ladder program Ifa script contains any compile error the sod sre script cannot be displayed in the ladder format 7226 csa 888 3 Step 3 60201_08 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 2 G2 8 Input Correction Functions for Editing Scripts The Edit Mnemonics Script pane supports the following input correction functions Corrections are made when the script is compiled Automatic Conversion from Lower Case to Upper Case In the Edit Mnemonics Script pane if you use lower case characters when entering a prefix device address or function name the characters are automatically converted into upper case characters when the script is compiled Omission of Zeros for Device Addresses When entering device addresses in the Edit Mnemonics Script pane you can omit leading zeros of the addresses For example when you want to code W D00001 if you enter W D1 this is automatically converted into W D00001 when the script is compiled Automatic Space Completion A space character is required before and after each operator and between arguments of each function in ea
161. he script in the block the relevant line position in the script and the contents of the error or warning C Compile results display Displays the number of errors and number of warnings as a compile result If any error occurs it is indicated that the compile is not successful and the script is not converted into a ladder program IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 4 Compile Error Messages Compile errors are categorized into three types errors serious warnings and warnings The list of compile error messages is shown below If a compile error whose type is error is detected the program cannot be transferred to the CPU Table G5 1 List of Categories of Compile Errors Description Error Serious warning An error message is displayed when a script cannot be converted into ladder circuits A serious warning message is displayed when a script can be converted into ladder circuits but there is a problem that affects the execution of the program A warning message is displayed when a script can be converted into ladder circuits but Table G5 2 Type Error the expected results may not be obtained if the program is executed List of Compile Error Messages Message Syntax Error Near xxx Troubleshooting There is an incorrect script description near the string in xxx Check the script near the string in Syntax error Line ended with incomplete description A script descr
162. he string length is greater than characters in 2047 an instruction processing error occurs string length during execution in the CPU 2 If the end of the string to be extracted is outside of the string specified by s i e ifn1 n2 is greater than the string length of s an instruction processing error occurs during execution in the CPU Input 1 2047 If n1 is 0 or less an instruction processing error occurs n1 If n1 is greater than the string length specified by s an instruction processing error occurs during execution in the CPU Input 1 2047 If n2 is 0 or less an instruction processing error occurs n2 If n2 is greater than the string length specified by s an instruction processing error occurs during execution in the CPU R Output The obtained string is stored eturn f A value If an instruction processing error occurs an indefinite value is returned E Available Devices Return value IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 16 E Step Counts Prefix Step Count 1 In addition 21 steps are used for each script instruction E Function and Example This function extracts an n2 character substring starting from the extraction position n1 in source string s and writes the substring in the return value The extraction position n1 is counted from the first character n1 1 of string s Example d MID s n1
163. ibes the procedure for changing monitor display formats and debugging Procedure 1 Start program monitoring and make sure that a block monitor window or Hexadecimal format macro monitor window is open 2 Move the position cursor to the script instruction for which you want to perform script monitoring and press Ctrl Enter The Edit Mnemonics Script pane opens and script monitoring is performed 3 Click Hexadecimal from the popup menu gt The display format of all scripts in the current block or macro is changed to a hexadecimal format f f Set up speed when X301 is ON IF LOUCB xX00301 THEN B x00301 oO B 100201 OFF B 100201 O Step 3 G0504_03 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 TIP You can change the display format using a shortcut key but you cannot do that from the menu bar 4 Click Decimal from the popup menu The display format returns to a decimal format TIP The above operations switch the display format between decimal and hexadecimal formats for devices with a prefix of W word type L long word type or D double long word type but those operations do not change the monitor display formats for the other prefixes The number of digits in the decimal display has an upper limit A value that exceeds the upper limit is displayed in a floating point format To change the number of digits that can be displayed mod
164. ide and an assignment operator that connects both sides The value or result of the right hand side is assigned to the left hand side There are three types of assignment statements as follows Numeric value assignment statements String assignment statements Bit assignment statements Numeric Value Assignment Statements A numeric value assignment statement assigns the value or operation result of the right hand side to the left hand side Example W DO00001 123 For assigning a numerical constant L D00001 L D00100 L D00200 For assigning the result of a numerical operation F D00001 SQR F D00003 For assigning the operation result of a function String Assignment Statements A string assignment statement assigns a string literal or the result of a string operation at the right hand side to the left hand side Example D00001 AB For assigning a string literal D00001 D2 amp S D2 For assigning the result of a string operation AN CAUTION A NULL assignment cannot be used for a assigning a string Doing so will result in an instruction processing error during execution in the CPU TIP You can assign up to four characters as a string literal Use a constant name if you want to assign a string literal longer than the maximum SEE ALSO For details on how to use constant names see Chapter E3 Constant Definition in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E IM
165. ify the setting of Numeric Parameters Display on the Circuit Display Input tab in the Set up Environment dialog box 5 Move the position cursor to the device line you want to debug and select a debugging function from the popup menu TIP The following monitoring and debugging functions are also available Jump to Device Monitor Forced Set Forced Reset Cancel Forced Set Cancel All Forced Set Change Word Data Change Long Word Data Change Double Long Word Data 6 Select Forced Set A forced set is performed and the symbol representing a forced set state is displayed TIP You can invoke a debugging function using a shortcut key but you cannot do that from the menu bar G5 14 Decimal format 1 Set up speed when x301 is ON IF LDUCB x00301 THEN Movo Do0021 mov Spee 000022 B IOO E ZON f Set up speed fli E B I00201 OFF renee Step 4 G0504_04 VSD Forced set state of a relay represented with a red square symbol _ f f Set up speed when X301 is ON IF LOUCB X00301 THEN mov 10000 D00021 MOV 5000 DOOO22 B IQOZO ON Set up speed fl ELSE B I00201 OFF IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G0504_05 VSD G5 15 TIP I O comments can be displayed during monitoring in the Edit Mnemonics Script pane To automatically display I O comments enable Display
166. igned n The number of points to P 7 P be transferred Return Returns 0 normal or 1 y value error 1 Specify the same prefix for s and d 2 Even if s and d are L D F or E specify W for n E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Specify the same prefix as d d Output There is no restriction Specify the same prefix as s Input 0 lt n lt 32767 If the specified n is 0 transferring data is not performed h and the return value is 0 normal If the specified n is less than 0 the return value is 1 error R Processing result 0 Normal When an error 1 occurs the operation is not eturn ae er valie 1 Error PE Na and the value before execution is maintained in d E Available Devices Prefix Return value S i fjlim m o rs sim anolr XN ENE NINES NENT NENISNIENIENPE NEN SENT SNENE NENT NEN SNES IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 24 E Step Counts Prefix Step Count Ww 56 L 57 D 58 F 57 E 58 4 In addition 21 steps are used for each script instruction E Function and Example This function transfers the data of a device specified by s based on the size of the prefix specified by s to n devices starting from a d
167. ile check and syntax check Debugging Functions when Scripts are Executed on the CPU Monitoring of a ladder program converted from a script and monitoring on the Edit Mnemonics Script pane are supported IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 2 G5 1 Compile Check and Error Messages A compile check checks if there is any script syntax violation in a script Block BLK001 Compiling script 2011 8 23 09 59 09 Block BLK001 Line 1 STOQO01 Line 4 error Invalid argument specification of function SIN Block BLK001 ST0001 Error 1 Serious Warning 0 Warning 0 Cross Reference A Script Figure G5 1 Procedure 1 After editing a script click OK gt The script is compiled and the results of the compile are displayed in the Script tab on the output window 2 If the script has no error a message appears indicating that the compile has been completed successfully One or more compile errors are displayed if the script has any error 3 To jump to an error line double click the error message corresponding to the line you want to jump to in the Script tab on the output window gt The display jumps to the error line in the script TIP Compile Messages The latest compile results are accumulated downward in the Script tab G0501_01 VSD RAR s p _ E Project wideField Sample Program B Executable Program WFSAMPLE F35P76 75 Compo
168. in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E Check if an assignment operator is mistakenly used instead of a comparison operator IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 7 G5 2 Syntax Check and Error Messages A syntax check converts scripts into ladders and checks the entire ladder program for syntax violations Even if no compile error occurs a syntax check error occurs if there is a syntax violation in the converted ladder instructions or the instructions are inconsistent with other ladder descriptions or script settings Category of the syntax check result error or warning Block file name block Result message of the name where the error syntax check of a script occurred C Results of Prograrn Syntax Checking FileName Inst NO Error Message Details SCRIPT BLOCK Address with unallocated tag name or undefined 5 ST0001 constant name used in a script G0502_01 VSD Figure G5 2 Result Message of a Syntax Check Procedure Row displaying a syntax check error 1 Edit a script and save the block WideField3 WIDEFIELD SAMPLEPROGRAN Results of Program Syntax Checking 2 Select Project Check Program from Ess a ae 2 Project gram lesas le al Fe feala z the menu pim ajajajaja P Se A syntax check is performed If there is no problem a message indicating no E C recs mogan Wese F35P76
169. in a project see Chapter G4 Setting a Script in a Project in this manual IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G1 5 G1 3 Precautions When Using Scripts The following restrictions apply to scripts Follow these restrictions when using scripts Compatible CPU Types Scripts can be used only on CPU modules F3SP71 and F3SP76 Number of Scripts Usable in a Block The range of the script numbers that can be registered in a block is from 1 to 9 999 A script number can be used in a block as many times as needed Using a Script Instruction in a Multiple Branching Circuit A script instruction cannot be used in a multiple branching circuit on the output side A conversion error will occur in the following example 10001 10002 SCRIPT ST1 10003 G0102_01 VSD Figure G1 5 Multiple Branching Circuit That Contains a Script Instruction When you want to use a script instruction in a multiple branching circuit modify the circuit into logical branches by inserting another device 10100 shown below 10001 10002 10100 m 10100 Mli SCRIPT ST1 10100 10003 G0102_02 VSD Figure G1 6 How to Avoid a Multiple Branching Circuit That Contains a Script Instruction Effect on the Number of Lines in a Ladder Program Scripts are converted into a ladder program in WideField3 The allowable number of lines in a ladder program for each block contains the number of lines of the conv
170. ing error occurs during execution in the s2 CPU If s2 is NULL or the string length of s2 is greater than 2047 an instruction processing error occurs during execution in the CPU Input 1 2047 If the specified n is O or less or greater than n 2047 an instruction processing error occurs during execution in the CPU Return Output The start position of the string found first is stored If an instruction processing error occurs an value ne indefinite value is returned E Available Devices Prefix Return value S S W wW IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 12 E Step Counts Prefix Step Count 1 In addition 21 steps are used for each script instruction E Function and Example This function searches for string s2 from a start position n in string s1 and if the function finds string s2 it writes the position in bytes of the string counting from the start position in the return value If s2 is found at the beginning of s1 the return value is 1 the first byte If s2 is not found in s1 the return value is 0 Example d INSTR s1 s2 n When s1 NGO1NGBWR s2 NG andn 3 d 5 Sequence of s1 s1 Pere Search start position n s1 2 Sequence of s2 s1 3 s2 N G s1 4 gt d 5 In this case NG is found that starts from the 5 character counted from the 1 character
171. ing instructions rotate shift instructions and data type conversion instructions in ladder instructions The details are described in Chapter G9 String Manipulation Functions The string manipulation functions correspond to the string manipulation instructions in ladder instructions The details are described in Chapter G10 Program Control Functions The program control functions include the conditional branch statement and repetitive statement that are used to control the flow of a program The details are described in Chapter G11 SEE ALSO For details on ladder instructions see Sequence CPU Instruction Manual Instructions IM 34M06P12 03E This manual describes all script functions in the following format IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G6 2 E Function Quick Reference Table The description of each script function begins with a function quick reference table as shown below Return value function name s Prefi Inde Return Value Description E Constant Expression P Arguments Modification An angle value in degrees that is calculated or the first device number of the devices that are converted i e conversion source The data type of the return value is the same as that of the argument The unit of the return value is radian f f Poe ee eae 1 2 3 4 6 7 8 9 10 11 12 G0601_01 VSD Return value 1 Return Valu
172. into a double precision floating point data This function is used before a double precision floating point operation is performed Example E D0101 ITOE L D0001 D0001 lololololololojololololo a 1l1 fff coo Represents an integer 1 000 000 BIN code 000F 4240 D0101 IEEE code Represents floating point 1 000 000 412E 8480 0000 0000 G0921_01 VSD Figure G9 22 Example and Behavior of the ITOE Function AN CAUTION The data may be rounded off when a double long word integer is converted into a double precision floating point value SEE ALSO The ITOE function behaves in the same way as the ITOE instruction in ladder instructions For details on the ITOE instruction see Section 3 8 7 Long word Integer to Double precision Float ITOE L Double Long word Integer to Double precision Float ITOE D in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 47 G9 22 FTOW Float to Integer FTOW is a function for converting a single precision floating point data into a 16 bit integer data Return value FTOW s Return Prefix flee Value Description Constant Expression ar cae Arguments
173. ion an index modification can be used AN CAUTION If using constants and constant names with an argument they can be used according to the following conditions TIP Both constants and constant names can be used for arguments with a v in the Constant column Operation expressions with constants can be used for arguments with a v in the Constant column Operation expressions including constant names can be used for arguments with a v in the Expression column You can use up to two characters four characters in the SMOV function as a string literal Use a constant name if you want to use a string literal longer than the maximum It may not be possible to use some combinations of prefixes even if Y is shown for a prefix In such cases refer to footnotes given below the table E Return Value Arguments The ranges of the return value and arguments are described together with the behaviors that occur when the arguments are outside of the ranges E Available Devices The Y symbol indicates that the device is available The availability is shown for each return value and for arguments E Step Counts Step counts are shown in a table The step count depends on each prefix E Function and Example A program example is used for describing the behavior of each script function SEE ALSO Script functions are converted into a ladder format and stored in the CPU Thus script functions follow the specifications of ladder instructio
174. ion behaves in the same way as the ITOF instruction in ladder instructions For details on the ITOF instruction see Section 3 8 6 Integer to Float ITOF Long word Integer to Float ITOF L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 45 G9 21 ITOE Integer to Double Precision Float ITOE is a function for converting a 32 bit or 64 bit integer data into a double precision floating point data Return value ITOE s Return Prefix index Value Description Constant Expression et at Arguments Ww L D F E S B Modification A data to be converted or the first device s number of devices v v v v vA whose data are converted A T Return Conversion result V V value 1 Regardless of whether s is L or D specify E for the return value E Return Value Arguments Return Value Input Output Arguments There is no restriction The processing result is stored Prefix X Y E L M T C D BYy FI WI 2Z2 RiV H AYU P L viviviy v D v v Return value Step Count 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 46 E Function and Example This function converts a 32 bit integer data with a prefix of L or 64 bit integer data with a prefix of D
175. ions For details on the FTOI instruction see Section 3 8 8 Float to Integer FTOI Float to Long word Integer FTOI L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 51 G9 24 ETOL Double Precision Float to Integer ETOL is a function for converting a double precision floating point data into a 32 bit integer data Return value ETOL s Return Prefix index Value Description Constant Expression et at Arguments Ww L D F E S B Modification A data to be converted or the first device s number of devices v v v v whose data are converted Return Conversion result V V value E Return Value Arguments Return Value Input Output Arguments There is no restriction The processing result is stored Arguments Return Value Return value Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 52 E Function and Example This function converts a double precision floating point data into a 32 bit integer data This function is used before the result of a double precision floating point operation is used as an integer Example V V V D9101 1100
176. iption is incomplete Check if the combinations of parentheses operators are correct or check if there are right and left operands for an operator The combination of IF and ENDIF of a conditional branch statement or the combination of FOR and NEXT of a repetitive statement is not correct Check these statements Invalid character xxx is used An invalid character xxx that cannot be used in a script is used Check the description of the string displayed in the message Invalid constant value xxx is used One line is excessively long Function xxx not found There is an incorrect description in a constant xxx Or a constant is assigned to or compared with a different type Check the description of the constant The line is longer than 499 characters Check the description of the line A function name xxx that is not prepared for the script is used Check the function name Invalid argument specification of function xxx Check if the arguments of the script function xxx are correct Excessive number of arguments provided for the arguments required for the function xxx Check the arguments passed to the function xxx nnn th argument of function xxx is invalid Check the nnn th argument of the function xxx Conditional expressions must be bit type B Operands of minus operator must be numeric type W L D F E A data type other than bit type B is passed to the
177. it Comment out for a Script Instruction Circuit comment out function cannot be used for a script instruction However you can perform the equivalent operation for a script instruction by commenting out inactivating its input condition or by commenting out every line of the script Ladders Converted from a Script A ladder program converted from a script is displayed in a window different from the ladder program edit window In program monitoring that ladder program is displayed in a window together with other ladder programs In addition the converted ladder program cannot be modified either in offline or online editing Online Editing In online editing you can edit the contents of a script but you cannot add or delete a script instruction Not Supported in Interrupt Routines and Sensor Control Blocks You cannot use scripts in interrupt routines and sensor control blocks Using scripts in such components will cause an error during syntax checking Constant Names You cannot use constant names indicating BIN type according to the type specification performed by the constant definition as an internal script constant Using such names in a script will cause a compile error Balloon Comment In the program monitor screen you can insert a balloon comment into a ladder program that has been converted from a script If a balloon comment is inserted into a converted line reflecting the online balloon to the offline proj
178. ith ST SCRIPT stToo01 Script number Script instruction G02_01 V SD Figure G2 1 Example of a Script Instruction TIP Script numbers are managed on a block basis Therefore even if you use the same script number between different blocks the specific behavior depends on each block By specifying the script number of a script instruction you can call the same script as many times as needed in the same block AY CAUTION Even if the input condition of a script instruction is OFF the CPU module scans the inside of the script with the input condition being OFF This is different from the case of a macro call MCALL or a subroutine call CALL in a ladder program In mnemonic editing you cannot newly create or modify a circuit that contains a script instruction AY CAUTION In online editing you cannot add or delete a script instruction For WideField3 R2 03 or later if using online editing to edit the contents of a script you can end editing by canceling it If a compile error occurs when editing a script or if a conversion error occurs in a ladder program after editing the script and ladder program you can cancel and end online editing without reflecting the editing to the CPU If you choose to end online editing by canceling it the program on the CPU retains its state prior to the modifications For WideField3 R2 03 or later if there is a conversion error then all the contents including areas withou
179. ith a prefix of L into BIN codes Example W E0001 BIN W 10001 10001 E 0 so 0 olo 0 1 ic 1 ofo 0234 Conversion from BCD to BIN 00EA E0001 E 0 Jolo olo of 1 1 ac 0 fo 234 G0916_01 VSD Figure G9 17 Example and Behavior of the BIN Function SEE ALSO The BIN function behaves in the same way as the BIN instruction in ladder instructions For details on the BIN instruction see Section 3 8 2 Binary Conversion BIN Long word Binary Conversion BIN L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 37 G9 17 BCD BCD Conversion BCD is a function for converting the BIN codes of a 16 bit or 32 bit data into BCD codes Return value BCD s Return Prefix index Value Description Constant Expression ee ae Arguments wW L D F E S B Modification A data to be converted or the first device 5 number of devices J V V J Y whose data are converted into BCD codes Return Conversion result 7 Vv value 1 Specify the same prefix for s and the return value E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments There is no restriction Return The processing result is stored value E Available Devices Arguments Return Prefix X Y
180. ition Dec 25 2013 00 G9 58 E Function and Example This function converts a double precision floating point data into a single precision floating point data Example V V V D0101 0 1 0 0 0 0 0 0 110 011010 11110 110 0 1 0 110 0 110 0 0 1101 11110 010101 1 010 1 1 1 1 0 1 O O 1 1 0 0 0 11110 111111010111111 IEEE code gt eee D0104 oette Piece ee eee D0103 e ae GETEETTET D0102 1 Pee D0101 eesse gt 4 Represents double precision floating point 1234 56789 4093 4A45 84F4 C6E7 V D0001 IEEE code 0 110 do 1 0 d 00 fh 0 1 go 1 0 10 d 0 0 d 01 fp 0 Represents floating point 1234 568 449A 522C gt ree DO002 eeeeeeee gt ee D0001 lt gt The error is rounded off SiN Figure G9 28 Example and Behavior of the ETOF Function A CAUTION If converting from double precision floating point into single precision floating point the data might be rounded off SEE ALSO The ETOF function behaves in the same way as the ETOF instruction in ladder instructions For details on the ETOF instruction see Section 3 8 11 Double precision Float to Float ETOF in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 59 G9 28 RAD Convert Degree to Radian RAD is a function for converting the unit of an angle from de
181. l E L M T C D B FI WI Z R VJ H ATU P Value Ww v v v v v v v v v v v v v v v v L v v v v v v v v v v v v v v v v Return Ww v v v v v v v v v v v v v v v value L v v v v v v v v v v v v v v v E Step Counts Prefix Step Count Ww 8 L 8 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 38 E Function and Example This function converts the BIN codes of a 16 bit data with a prefix of W or 32 bit data with a prefix of L into BCD codes If the result of a BCD conversion exceeds the range of the BCD codes the lower 16 bits are assigned to the specified devices for a 16 bit data conversion and the lower 32 bits are assigned to the specified devices for a 32 bit data conversion Example W 10001 BCD W E0001 E0001 ofo 0 olo 0 0 olo 111 To 0 ofo ao j Conversion from BIN to BCD 10001 0 0 0 0 0 o o 1 o o o0 1 0 0 1 0 0112 G0917_01 VSD Figure G9 18 Example and Behavior of the BCD Function SEE ALSO The BCD function behaves in the same way as the BCD instruction in ladder instructions For details on the BCD instruction see Section 3 8 3 BCD Conversion BCD Long word BCD Conversion BCD L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 39
182. lue However the FOR statement is stopped and terminated if the stop condition is met during repetitions Example 1 When processing is repeated until the end of repetitions The following example shows a search of the devices D0001 to D1024 for devices that have the same value as that of D2001 and counts the number of found devices Following that it stores the count in D2002 W D2002 0 Initialization FOR V001 0 1023 Search for devices that have the same value as that of D2001 IF W D0001 V001 W D2001 THEN The count is incremented if a match is found W D2002 W D2002 1 ENDIF NEXT D0001 123 D2001 456 D0001 1 65 dias ee 456 is found in 3 points between D0001 and D1024 D0001 1023 1234 G1102_01 VSD Figure G11 3 Example and Behavior of the FOR Statement IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 7 2 When processing is terminated during repetitions The following example shows a search of the devices D01025 to D02048 for devices that have the same value as that of D03001 and counts the number of found devices Following that it stores the count in D03002 and terminates if the count exceeds 10 W D03002 0 II Initialization FOR V001 0 1023 Search for devices that have the same value as that of D03001 IF W D01025 V001 W D03001 THEN The count is incremented if a match is found W D03002 W D03002 1 ENDIF IF W D03002 gt 10 THEN II Terminate the r
183. m bits from the zeroth bit are shifted and if m is 17 or larger the lower m 16 bits of the next device are also shifted in addition to the 16 bits of the device The values of the bits not shifted in this example the second to 15th bits of D0002 are unchanged when the instruction is executed SEE ALSO The LSFTN function behaves in the same way as the LSFTN instruction in ladder instructions For details on the LSFTN instruction see Section 3 6 2 Shift m bit Data by n Bits RSFTN LSFTN in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 14 G9 7 MOV Move MOV is a function for transferring data for the specified number of points This function transfers data contents for n points based on the size of the prefix specified by s from the devices specified by s to the devices specified by d Return value MOV s d n Return Prefix Index rad A Description W L D F E s B Constant Expression Modification The first device number of devices i e the 3 source from which data lt id lt id are transferred The first device number of devices i e the destination to which d the transfer data are v v v v v v assigned Specify the same data type as s n2 The number of points to Vv V Vv P be transferred Return Returns 0 normal or 14 y value error 1 Specify the same prefix for s and
184. ment 1 CASE constant 2 statement 2 DEFAULT statement 3 ENDSELECT If the value of the conditional expression matches constant 1 statement 1 is executed If the value of the conditional expression does not match constant 1 but matches constant 2 statement 2 is executed If the value of the conditional expression does not match constant 1 or 2 statement 3 is executed Example The following example uses D00001 as the condition to select the corresponding value and assigns the selected value to D00002 Table G11 1 Example of Processing of SELECT Statement D00001 D00002 1 3 5 1 10 to 19 2 20 to 29 40 50 3 None of the 4 above SELECT D00001 CASE 1 3 5 D00002 1 CASE 10 19 D00002 2 CASE 20 29 40 50 D00002 3 DEFAULT D00002 4 ENDSELECT TIP Constants specified for CASE can contain multiple values and a value range Example IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 11 CASE 1 Single value only 1 CASE 2 8 11 30 Multiple values 2 8 11 and 30 CASE 40 50 Value range range from 40 to 50 CASE 60 70 80 90 Multiple values and value range range from 60 to 70 80 and 90 DEFAULT can be omitted You can specify constants and constant names to CASE Constants can be specified in decimal and hexadecimal formats In hexadecimal format put at the start of a constant Example CASE FF Specifies FF 255 in decimal format You can insert an EXITSCRIPT sta
185. mple This function transfers byte data in the specified range This function transfers the n1 th to n2 th bytes of a data starting from s to addresses starting from d n1 is a byte number counted from the first byte of the data s where n1 is 1 at the first byte The return value indicates whether the function is executed normally 0 or an error occurs 1 Example Return value HMOV s n1 n2 d Source Destination s d s 1 Transfer d 1 s 2 d 2 s 3 d 3 s 4 d 4 i byte n1 Final byte n1 n2 1 G0910_01 VSD Figure G9 10 Example and Behavior of the HMOV Function TIP The functions which process in byte 8 bits units handle the upper byte of a word data 16 bits as the first byte the lower byte as the second byte IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 23 G9 11 BSET Block Set BSET is a function for transferring the specified size of data multiple times to duplicate the data This function transfers a data for a point with a device type specified by s to n devices starting from a device specified by d Return value BSET s d n a e T T ST Value Description Constant Expression sain aai Arguments W L D F E S B Modification The first device number of devices i e the i v v v v v v v v source from which data are transferred The first device number of devices i e the d destination to which v v v v v the transfer data are ass
186. n in the CPU Input When s1 0 If s1 s2 0 an instruction processing error s2 s240 occurs during execution in the CPU Output The processing result is stored Return If an instruction processing error occurs during value execution in the CPU the return value is E Available Devices undetermined IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Arguments Return Prefix X Y l E L M T C D B FI W Z R V iH AYU Value Ww v v v v v v v v v v v v v v v v L v v v v v v v v v v v v v v v v D vilvilvliy v v F v v v v v v v v v v v v v v v v Ww v v v v v v v v v v v v v v v v s2 F v v v v v v v v v v v v v v v v Ww v v v v v v v v v v v v v v v Return L v v v v v v v v v v v v v v v value D vilvl lvivivyv viviviy v v F v v v v v v G8 17 E Step Counts Prefix Step Count Ww 66 L 66 D 74 F 21 4 In addition 21 steps are used for each script instruction E Function and Example This function assigns the value of s1 raised to the power of s2 to the return value You can use integers with a prefix of W L or D and single precision floating point values for s1 and s2 but both s1 and s2 must be either integers or single precision floating point values Example F D1001 POW F D0001 F D0003 When F D0001 2 0 F D0003 0 5 F D1001 e x2 EEE i E ifo afo elec 0 solo 0 0 olofo alo Jojolo 0
187. n2 When s ABC01234 n1 4 and n2 5 d 01234 4 Extraction position Tad n1 the 4 character s 1 No of characters Pog n2 5 5 characters Sequence of s s 2 s 3 ee ee Cris e oP 4 ae s 4 ABC01234 Se 5 characters Sequence of d 0 4 2 13 4 00 End of the string Null G1007_01 VSD Figure G10 5 Example and Behavior of the MID Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 17 G10 8 MID Simplified String Middle Simplified MID is a function for extracting a substring from a string This function extracts a substring starting from the extraction position n and ending with the NULL character in source string s and writes the substring in the return value The extraction position n is counted from the first character n 1 of string s Return value MID s n Return Prefix ar A Index t z Description w L D F E s B Constant Expression Modification A source string or the first device number of Vv P Vv r devices that represent a source string n An extraction position v v v v Return The extracted string P value E Return Value Arguments Return Value Input Output
188. nction TIP No expression can be used for argument s If you want to use the falling edge of the result of an expression assign the result of the expression to a relay and use the relay as s SEE ALSO The LDD function behaves in the same way as the LDD instruction in ladder instructions For details on the LDD instruction see Section 2 5 Load Differential Up LDU Load Differential Down LDD in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Blank Page G8 Computational Functions IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 2 G8 1 SUM Summation Value SUM is a function for calculating a total value This function sums up n values in a data area starting from s Return value SUM s n d Return Prefix inden ee Description W L F E s Constant Expression Modification The first device number s of devices for which the v v v v total value is calculated n 2 The number of data v v v v The first device number d of devices for which the v v v total value is stored Return Returns 0 normal or 1 P r value error 4 If s is W specify L for d If s is L specify D If s is D specify D If s is F specify E If s is E specify E 2 Even if s is W L D F or E specify W for n E Return Value Arguments Behavior Restrictions There is no restriction Return Value
189. nd values match in the operation or assignment expression Also the BIN type for constant definition cannot be used In a ladder instruction of a converted ladder program a device type or range of the instruction parameter is invalid Also index modification is being used in a position where index modification cannot be performed xxx is a ladder instruction containing an error Check the function arguments of the operand and script Description error in mnemonic instruction Including if there is an end of text comment in the mnemonic line Check the description of the mnemonic instruction Also an end of line comment cannot be used in a mnemonic line Delete any existing end of line comment Mnemonic instruction that cannot be used with the script IF SELECT nest is excessively deep Check if the mnemonic instruction can be used in a script Check if the nesting level of IF and SELECT statements exceeds eight in total Invalid SELECT conditional expression A data type other than an integer type W L is passed to the conditional expression Correct the data type to an integer type Invalid integer constant in CASE statement A data type other than an integer type W L is passed to the integer constant Correct the data type to an integer type Invalid FOR counter FOR counter must be in WORD type W Invalid counter is specified Check if the prefix for the counter is a WORD type W I
190. nent Definition Common Tag Name Definition Constant Definition Pu Properties Project Settings Configuration B Component Blocks 1 MAIN PROGRAM BLK_MAIN 2 LADDER BLOCK 01 BLKO1 3 LADDER BLOCK 02 BLKO2 EO Block List LADDER BLOCK 01 BLKO1 LADDER BLOCK 02 BLKO2 MAIN PROGRAM BLK_MAIN Wy SCRIPT BLOCK 01 SCRIPTO1 hf it BS ottine E onine RDY RUN ALM ERR x _ Cross Reference Script Ready Steps 1 and 2 Line 6 Step 0 G0501_02 VSD Error line E Project wideField Sample Program BG Executable Program WFSAMPLE amp F35P76 75 Component Definition Common Tag Name Definition Constant Definition amp CPU Properties Project Settings Configuration EH Component Blocks 1 MAIN PROGRAM BLK_MAIN 2 LADDER BLOCK O1 BLKO1 3 LADDER BLOCK 02 BLKO2 EQ Block List LADDER BLOCK 01 BLKO1 LADDER BLOCK 02 BLKO2 MAIN PROGRAM BLK_MAIN Uy SCRIPT BLOCK 01 SCRIPTO1 OITA Baron tink 55 otfine E onine RDY RUN ALM ERR Step 3 Block SCRIPT BLOCK 01 Compiling script 2013 1 1 4 22 43 23 Block SCRIPT BLOCK 01 Line 1 STOOO1 Line 4 Invalid argument specification of function SIN Block SCRIPT BLOCK 01 ST0001 Error 1 Serious Warning 0 Warning 0 Line 6 Step 0 Ove G0501_03 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 3
191. ng a logical sum operation Return value ORV s1 s2 Return Prefix Value Description Constant Expression Arguments uid L 2 F E s E Index Modification A data used in the logical sum or the first s1 device number of v v v v v v v devices used as a data in the logical sum A data used in the logical sum or the first s2 device number of v v v v v v v devices used as a data in the logical sum Return The obtained logical Vv VY value sum value 1 Specify the same prefix for s1 s2 and the return value If B is specified for s1 and s2 no constant or expression can be used for s2 or s1 E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments There is no restriction Specify the same prefix as s2 s2 Input There is no restriction Specify the same prefix as s1 Return Output The processing result is stored value E Available Devices Arguments Return Prefix X Y l E L M T Cc D B F WZ RI IVJHJAJUJP Value Ww Vvivilyvlvylvlilv Vvivivlily L Vvivilylvylvlv vivivlily si D Filet AZ B vivilyvlvylvlv Ww Vvivilyvlylvyly oa a ara L vivilyvlylvlv vivivlily s2 D vivivlily B Yvivilyvlvylvlilv Ww yia haa e vivivlily Ret rn L vivivivly v vyl viv value D viviviyv B Vvivilylyvly E Step Counts Prefix Step Count Ww
192. ng a script Enter a script instruction Enter a script instruction in the ladder program edit screen Code a script Program a script as the contents of the script instruction Compile and save Compile the script and save it with the ladder program Set a script in a project Set the work device areas used by the script Syntax check and download Perform a syntax check of the script together with the ladder program and download the program to the CPU G0102_01 VSD Figure G1 4 Procedure for Creating a Script Entering a Script Instruction Enter a script instruction in the ladder program edit window to call a script SEE ALSO For details on entering a script instruction see Chapter G2 Creating and Editing Scripts in this manual Coding and Compiling a Script Code a script that is called by the script instruction After coding a script compile the script to check if the contents are correct i e if the script can be converted correctly into a ladder program SEE ALSO For details on coding and compiling a script see Chapter G2 Creating and Editing Scripts in this manual Setting a Script in a Project Work devices must be used to temporarily store the operation results of script syntax and script functions You can configure where to assign work devices in the device area from the Project Settings Configuration window SEE ALSO For details on setting a script
193. ng efficiency You can use a BASIC like format to code a script for processing including string and computational manipulation that will be lengthy if you code it using a ladder language Processing coded in a BASIC like format can be automatically converted into a ladder program and this increases programming efficiency TIP Coding a script for a string manipulation or computational manipulation is easier than coding a ladder program equivalent The following shows examples of ladder programs and scripts that implement the same manipulations String manipulation This manipulation inserts string 12 between characters A and B in string AB and stores the obtained string in addresses starting from D201 to generate string A12B m Coding as a ladder program Coding as a script SMOV AB S D0101 SMOV 12 S D0121 D0201 SINS S D0101 S D0121 2 G0101_02 VSD Figure G1 2 Comparison of Different Implementations of a String Manipulation IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G1 3 Computational manipulation This manipulation stores the area of a trapezoid in D101 when the upper base lower base and height of the trapezoid are stored in D1 D2 and D3 respectively m Coding as a ladder program oe Coding as a script D0003 W D0101 W D0001 W D0002 W D0003 2 D0010 D0010
194. nnot register constant definition during online editing TIP Regardless of whether the Constant Definition edit window is open or closed in the background the specified constant definition is saved and applied to the window when you register the definition IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 19 G2 4 Printing Scripts This section describes how to print scripts There are two types of script printing formats as follows Printing Only Script Programs When printed in block printing only script programs are printed out Only the script program of each script instruction is printed out 00001 4 4 00001N H TER O EA R EE ANT L ee NEE E E E N PERA E A E ERETO E E E TEE EE eva 0001 stooo4 piogena O PE E E E E E EEEE 0002 0001 Sum up analog inputs 0003 0002 READ 5 1 D00001 4 0004 0003 Dood11 SUM Do00001 4 000101 Tt 0005 sfooot G0204_01 VSD Figure G2 6 Script Printing Format Only Script Programs Are Printed Printing Script Programs and Converted Ladders When printed in block printing both script programs and converted ladder programs are printed out ooo1 fo ir 3 to io a _ eo i co ae eae i aa 100001 i i i i i i i i oo001N H r r r SCRIPT sT0001 i 1 1 i i 1 1 1 1 1 SENEE E EE EESE SEERE EEEE EAEE E ee See eee ee ONS mbai ai e ee acess
195. ns For details on instructions used in ladders converted from script functions see Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Blank Page G7 1 G7 Basic Functions IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G7 2 G7 1 LDU Logical Differential Up LDU is a function for logical differential up Return value LDU s Return Value Description Constant Expression Arguments A bit for checking a rising edge Returns a rising edge state Return Value Behavior Restrictions Arguments s Input There is no restriction Return Processing result 1 TRUE Returns 1 when a rising edge is detected Returns value 0 FALSE 0 when a rising edge is not detected E Available Devices i p pongu popggpgg Return Prefix x Y E L T c D B F V P Value AE v ly lv v vly v Return value B E Step Counts B 11 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G7 3 E Function and Example Only when a rising edge is detected in the change of s 0 to 1 1 is stored in the return value Example Return value LDU s 0 1 1 1 0 0 1 0 0 Figure G7 1 Example and Behavior of the LDU Function TIP No expression can be used for argument s If you want to use the rising edge of the result of an expression assign the resul
196. ns in the return value Return value COS s Return Prefix index Scan n Description W L D F E s B Constant Expression Modification An angle data in radians whose COS value is calculated or s the first device number v v v v of devices for which the COS value is calculated The cosine value obtained for s Return The data type of the v v value return value is the same as that of the argument Return Value Arguments The processing result is stored Return E Step Counts 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 21 E Function and Example This function calculates the COS cosine value single precision floating point value of an angle given in radians The relational expression is as follows Return value COS s1 s1 An angle in radians for which COS is calculated Return value The obtained COS value 1 lt Return Value lt 1 s1 Return value G0810_01 VSD Example F D1001 COS F D0001 When F D0001 3 F D1001 Cos 60 Cos 4 E o 0 1 Ay 1 iP spefolo 1 1 of 0 ao 0 1 sage io 0 10 5 eee o 0 1 an 1 ifs sJofolo 0 0 aC 0 solo 0 0 ao ofo af 0 0 0 Represents 0 5 3F000000 5 G0810_02 VSD Figure G8 10
197. ns only space characters an instruction processing error occurs during execution in the CPU Return Output The obtained string is stored If an instruction processing error occurs an value A indefinite value is returned E Available Devices eon eofelelwlz eiviajalule Return F Vv A Value RARE Eada KAKAKAKA M eturn Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 E Function and Example When s s 1 s 2 s 3 s 4 s 5 G10 35 This function deletes leading space characters from string s and writes the remaining string in return value d Example d LTRIM s Example of the sequence of s 123456 T T F z 7 7 5 Diea 123456 d 123456 Delete leading spaces End of the string Null d 1 d 2 d 3 Result d 123456 sa 2 3 4 5 6 End of the string 00 Null Figure G10 15 Example and Behavior of the LTRIM Function TIP G1016_01 VSD The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character TIP There is no ladder instruction corresponding to the LTRIM function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 36 G10 17 RPAD Right side Character Addition RPAD is a function for adding ch
198. nsferred Move Long word is used with a prefix of L or F when a 32 bit data is transferred Move Double Long word is used with a prefix of D or E when a 64 bit data is transferred The return value indicates whether the function is executed normally 0 or an error occurs 1 Example 1 Word data W D02001 MOV W D01025 W D00001 10 Data register Data register D1025 1216 pooo1 1216 D1026 1102 D0002 1102 Transfer the D1027 7280 entire data D0003 7280 D1028 1215 P D0004 1215 D1033 5425 D0009 5425 D1034 5622 L D0010 5622 G0907_01 VSD 2 Long word data W D02001 MOV L D01025 L D00001 10 Data register Data register D1025 00000000 Do001 00000000 D1027 11111111 D0003 11111111 Transfer the D1029 22222222 entire data D0005 22222222 D1031 33333333 D0007 33333333 D1041 AAAAAAAA D0017 AAAAAAAA D1043 EEEEEEEE L D0019 EEEEEEEE G0907_02 VSD Figure G9 7 Example and Behavior of the MOV Function SEE ALSO The MOV function behaves in the same way for 16 bit data as the BMOV instruction in ladder instructions For details on the BMOV instruction see Section 3 7 4 Block Move BMOV in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E The difference is only in the data size for 32 bit and 64 bit data while the basic behavior is the same as that for th
199. nteger part d 1 A four digit BCD code BBBB Decimal part d 2 A four digit BCD code Example FBCD F D0001 W D0010 Floating point data Store destination of the conversion result D0001 120 0567 Conversion D0010 0001 Sign mee D0011 0120 Integer D0012 0567 Decimal G0918_01 VSD Figure G9 19 Example and Behavior of the FBCD Function SEE ALSO The FBCD function behaves in the same way as the FBCD instruction in ladder instructions For details on the FBCD instruction see Section 3 8 4 Float to BCD FBCD in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 41 G9 19 BCDF BCD to Float BCDF is a function for converting a BCD format data into a single precision floating point data Return value BCDF s Return Prefix index Value Description W L D F E s B Constant Expression Modification Arguments A data to be converted or the first device s number of devices v v whose data are converted Return Conversion result V V value E Return Value Arguments Return Value Input Output Arguments There is no restriction The processing result is stored Arguments Return Value Return value 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 42 E Function and Example This function
200. nual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 6 G9 3 RSFT Right Shift RSFT is a function for shifting a 16 bit or 32 bit data right by n bits Return value RSFT s n Return Prefix index Peas 3 Description W L D F E s B Constant Expression Modification The first device number s of devices for which the P V z Vv P shift operation is performed The first device number of devices that give the n number of bits to be E r K x shifted Return Shift operation result Vv V Vv value 1 Specify the same prefix for s and the return value 2 Even if s is L specify W for n E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Input W is specified for s If O is specified no operation is performed 1 lt ns16 If the n specified for a word data is less than 0 or n L is specified for s greater than or equal to 17 or if the n specified for 1 lt n lt 32 a long word data is less than 0 or greater than or equal to 33 an instruction processing error occurs during execution in the CPU R Output The processing result is stored eturn a valu If an instruction processing error occurs an indefinite value is returned E Available Devices Return value E Step Counts
201. nvalid initial value of FOR counter FOR initial value must be in WORD type W Invalid counter initial value is specified Check if the prefix for the initial value is a WORD type W Invalid final value of FOR counter FOR final value must be in WORD type W Invalid counter final value is specified Check if the prefix for the final value is a WORD type W FOR nest is excessively deep Check if the nesting level of FOR statements exceeds eight BRK is used outside of FOR NEXT Ladder program converted from script is Xxxx lines exceeds 2 000 line limit Check the place where BRK is used The number of lines in the ladder program converted from a script cannot exceed 2 000 lines Check the script IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Serious warning Message Undefined constant name xxx Handled as WORD type W G5 6 Troubleshooting xxx is an undefined constant and cannot be used Define the constant correctly Undefined identifier xxx Handled as WORD type W An undefined tag name or structure member xxx is used Warning Assignment present in IF conditions It may be used as a comparison operator SEE ALSO For details on tag name definitions see Chapter E2 Tag Name Definition in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E For details on constant definitions see Chapter E3 Constant Definition
202. o edit scripts You can edit scripts on the Edit Mnemonics Script pane S Edit Block BLKOO1 BLKOO1 Displays the script for the cursor position Display Ladder Converted from Script Doooo1 D00002 D00003 mMov Do oo1 D00004 mov Dodoo2 DoG003 Saves the edit result of the Displays the ladders converted script from the script G0201_01 VSD Figure G2 2 Edit Mnemonics Script Pane G2 1 1 Procedure for Editing a Script Use the following procedure to edit a script Procedure 1 Make sure the Edit Block or Edit Macro window is open 2 Enter a script instruction When n 5 J m Enter Instruction entering a script instruction enter the 7 Enter mnemonic and instruction parameters instruction SCRIPT anda parameter To display input suggestions press down arrow key Cancel ST number like any other application script stoa eruen Ls instruction Step 2 G0201_02 VSD 3 Move the position cursor to the script instruction for which you want to edit a script and press Ctrl Enter The Edit Mnemonics Script pane opens a lx Check Errors R Step 3 G0201_03 VSD IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 4 4 Code a script on the Edit Coding as a script Mnemonics Script pane When you fang 21 a se Os edit a script the Script editing dialog aN r EE F35P76 75 7 box appears with the OK and snr ene
203. ode 1 9 1 9 9 1 0 1 09 1 0 14 1 4 1 0 G0816_01 VSD Figure G8 16 Example and Behavior of the ORV Function TIP There is no operator or ladder instruction for 64 bit logical operations Use this function if you want to perform a 64 bit logical operation SEE ALSO The ORV function behaves in the same way for 16 bit and 32 bit data as the logical sum instruction in ladder instructions For details on the logical sum instruction see Section 3 4 2 Logical OR CAL Logical OR Long word CAL L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E The difference is only in the data size for 1 bit and 64 bit data while the basic behavior is the same as that for the other data sizes IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 34 G8 17 XORV Logical XOR XORV is a function for performing an exclusive OR operation Return value XORV s1 s2 Return Prefix Index Value Description w L D F E s B Modification Constant Expression Arguments A data used in the exclusive OR or the first s1 device number of v v v v v v v devices used as a data in the exclusive OR A data used in the exclusive OR or the first s2 device number of v v v v v v v devices used as a data in the exclusive OR Return The obtained exclusive Vv VY value OR value 1 Specify the same prefix for s1 s2 and the return value If B is specified for s1 and s2 no constant or expression can be used fo
204. of Yokogawa Electric Corporation E Trademarks The trade and company names that are referred to in this document are either trademarks or registered trademarks of their respective companies IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Blank Page FA M3 TOC 1 Programming Tool WideField3 Script IM 34M06Q16 04E 3rd Edition CONTENTS Applicable ag Le 04 dese tees pene ten ene eet Eee eS Pete he steer eres terete er teers sees seer er rrenee ar reee i Important acses He ee rane gene Ee Bere aa a aa aa cE mr ronrnmes en ii lntroduction aasssssssssneennnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nn Sse rrrere rer rer rrr ore ix Copyrights and Trademarks cccccccceeeeeeeeeeeeeeeeeeeeeeeaeaeaeeeeaneaeeeaeeaaaes xiii PART G Script Editing Manual G1 G2 G3 Overview of SCIONS sccessacosarseectnc essesteenei asec G1 1 G11 SCriptS sisihna riain uranian andapara iiuair G1 2 G1 1 1 What are Scripts 0 0 0 2 cceecceeccece cece eeeecaeceeeeeeeseceneaeeeeeeeseeenaees G1 2 G1 1 2 Purpose of Scripts ecccceccceeeeeeeeeeneeceeeeeeeseceaeaeeeeeeeeeeeenaees G1 2 G1 2 Creating Scripts sssrinin nannu NNE EEANN nna G1 4 G1 3 Precautions When Using Scripts s ssesssssnnnnnrennnnnnnnnnnnnnnnnnnnnnnnnnnnnn G1 5 Creating and Editing Scripts ssssssssssnsnnnnnnnnnnnnnnnnnnnnnnnnnnns G2 1 62 1 Editing Scripts a2ccci gsc ce cabs soce cee ceceece aAA AAA AARE G2 3 G2 1 1 Proced
205. onverted Return Conversion result value 1 Regardless of whether s is W or L specify F for the return value E Return Value Arguments Return Value Input Output Arguments There is no restriction The processing result is stored E Available Devices Prefix X Y l E L MIT c D B FIWwWJ Z Ri V H AJU P WwW v v v v v v v v v v v v v v v v L v v v v v v v v Return F y V 7 Vv value 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 44 E Function and Example This function converts a 16 bit integer data with a prefix of W or 32 bit integer data with a prefix of L into a single precision floating point data This function is used before a floating point operation is performed Example F D1001 ITOF W D0001 D0001 BIN code ofo 0 oo 0 1 1 1 1 1 a O O O je Represents an integer 1000 03E8 eee fof 0 olo 1 0 olo 111 T 0 1 oo 0 0 offs 0 offs 0 olo 0 00 Represents floating point 1000 447A0000 G0920_01 VSD Figure G9 21 Example and Behavior of the ITOF Function AN CAUTION The data may be rounded off when a long word integer is converted into a floating point value SEE ALSO The ITOF funct
206. or 1 bit and 64 bit data while the basic behavior is the same as that for the other data sizes IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 36 G8 18 NOTV Logical NOT NOTV is a function for performing a logical negation operation Return value NOTV s Return Prefix fies Value Description Constant Expression gt ia Arguments Ww L D F E S B Modification A data used in the logical negation or the s first device number of v v v v v v v devices used as a data in the logical negation Return The obtained logical V p Vv Vv value negation value 1 Specify the same prefix for s and the return value If B is specified for the return value no constant or expression can be used for s E Return Value Arguments Return Value Input Output Arguments There is no restriction The processing result is stored E Available Devices Arguments Return Prefix xX Y l E L M T C Dy BYyF W Z RIV H AYU YP Value Ww v v v v v v v v v v v v v v v v L v v v v v v v v v v v v v v v v D v v v v v v B v v v v v v v Ww v v v v v v v v v v v v v v v Return L v v v v v v v v v v v v v v v value D vil vilviv v v B v v v v v v E Step Counts Prefix Step Count wW 12 L 12 D 17 B 8 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd
207. out executing the part after the ENDIF statement if the value of D00001 is smaller than zero IF W D00001 gt 0 THEN W D00002 100 ELSE EXITSCRIPT ENDIF W D00101 W D00002 lf the value of D00001 is smaller than zero this script part is not executed IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 TIP There is no ladder instruction corresponding to the EXITSCRIPT statement G11 14 You can use EXITSCRIPT statements for debugging of scripts by limiting the execution of the script to the part preceding the inserted EXITSCRIPT statement Especially EXITSCRIPT statements are useful for debugging scripts with a large commented out block L D01001 Check the processing of the script part preceding IF D01001 360 THEN the EXITSCRIPT L D01001 0 statement ENDIF F D01103 RAD F L D01001 EXITSCRIPT The script exits here L D01016 L AMP SIN F D01103 The script part after the L D01032 L AMP COS F D01103 EXITSCRIPT statement is F not processed G1104_01 VSD Figure G11 4 Debugging with EXITSCRIPT Statement IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 FA M3 Programming Tool WideField3 Script INDEX A ABS Absolute Value cecccceeeesteeeeeetteeeeeeee G8 8 ACOS Arc Cosine G8 26 AddION sioi aaa aa aaa G3 4 ANDV Logical AND ceeeceeeeteeeeeeeeee G8 30 APR Approximate Broken Line 0 G9 66 ALQUIMGMIN ister cecssiatenee
208. part or as a whole for use by any third party without prior permission by Yokogawa Electric IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 E General Requirements for Using the FA M3 Controller Set the product in a location that fulfills the following requirements Where the product will not be exposed to direct sunlight and where the operating surrounding air temperature is from 0 C to 55 C 32 F to 131 F There are modules that must be used in an environment where the operating surrounding air temperature is in a range smaller than 0 C to 55 C 32 F to 131 F Refer to hardware users manual or the applicable users manual In case of attaching such a module the entire system s operating surrounding air temperature is limited to the module s individual operating surrounding air temperature Where the relative humidity is from 10 to 90 In places where there is a chance of condensation use a space heater or the like to constantly keep the product warm and prevent condensation For use in Pollution Degree 2 Environment Where there are no corrosive or flammable gases Where the product will not be exposed to mechanical vibration or shock that exceed specifications Where there is no chance the product may be exposed to radioactivity Use the correct types of wire for external wiring USE COPPER CONDUCTORS ONLY Use conductors with temperature ratings greater than 75 C Securely tighten screws
209. pecified for a word data is less than 0 or n L is specified for s greater than or equal to 17 or if the n specified for 1 lt ns32 a long word data is less than 0 or greater than or equal to 33 an instruction processing error occurs during execution in the CPU Output The processing result is stored Return F If an instruction processing error occurs an value bee d indefinite value is returned Return value E Step Counts Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 3 E Function and Example This function rotates a 16 bit or 32 bit data right by n bits Right Rotate Word is used with a prefix of W when a rotation of a 16 bit data is performed Right Rotate Long word is used with a prefix of L when a rotation of a 32 bit data is performed The carry flag is changed according to the result of the rotation Example W Y00601 RROT W X00501 3 X00516 X00501 X00501 ofo ola Jo 1 olalalo 0 0 0 1 0 1 0 mo N fo 1 e oO Intermediate processes 3 bit right rotation SSAA Y00001 0 ofhi fehle fh fe Y00616 Y00601 G0901_01 VSD Figure G9 1 Example and Behavior of the RROT Func
210. point value of ACOS arc cosine of a real single precision floating point number in radians The relational expression is as follows Return value ACOS s1 s1 Areal number data whose COS is calculated 1 lt s1 lt 1 Return value The obtained COS value in radians 0 lt Return value lt Tr eturn value 1 G0813_01 VSD Example F D1001 ACOS F D0001 When F D0001 2 F D1001 ACOS COS COS F 4 D1001 IEEE code D0001 IEEE code G0813_02 VSD Figure G8 13 Example and Behavior of the ACOS Function SEE ALSO The ACOS function behaves in the same way as the FACOS instruction in ladder instructions For details on the FACOS instruction see Section 3 3 23 COS FCOS COS FACOS in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 28 G8 14 ATAN Arc Tangent ATAN is a function for calculating an arc tangent value This function stores the arc tangent of a real number data s in the return value Return value ATAN s Return Prefix index reine Description L D F E s B Constant Expression Modification A data whose ATAN value is calculated or the first device number z of devices for which the id ATAN value is calculated The arc tangent value Return obtained for s The
211. r line hiding icon G0504_02 VSD Figure G5 5 Monitoring of Devices Used in a Script IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G5 13 Monitor display formats in the Edit Mnemonics Script pane depend on the prefix used Table G5 4 List of Monitor Display Formats W Word type Displayed in a decimal hexadecimal 16 bit integer format L Long word type Displayed in a decimal hexadecimal 32 bit integer format D Double long word type Displayed in a decimal hexadecimal 64 bit integer format F Single precision floating poi Displayed in a single precision floating point format E Double precision floating point type Displayed in a double precision floating point format S String type Monitored in a string format Up to six characters can be displayed B Bit type Displayed as o or m Constant Name Monitor You can monitor constant names in the Edit Mnemonics Script pane To monitor constant names place the cursor over the constant name to be monitored and press the down arrow key as when you use the auto suggest function for constant names To cancel the monitoring press the Esc key Constant Monitor Type Comment name value H 1 SELECT D00001 2 CASE CONSTNWQ1 3 HEMMDTCONST_O2 WORD 2 Case 2 DEFAULT CONST_O2 WORD 2 Case 2 poooo1 0 ENDSELECT G0504_08 VSD Figure G5 6 Constant Name Monitor G5 4 1 Changing Display Formats and Debugging The following descr
212. r s2 or s1 E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments There is no restriction Specify the same prefix as s2 s2 Input There is no restriction Specify the same prefix as s1 Return Output The processing result is stored value E Available Devices Arguments Return Prefix X Y E L M T C D B F WIZ RIVy H ATU P Value Ww v v v v v v v v v v v v v v v v L v v v v v v v v v v v v v v v v D viviviy v v B v v v v v v v Ww L D B W Return L value D B E Step Counts Prefix Step Count Ww 9 L 9 D 26 B 13 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 35 E Function and Example This function performs an exclusive OR of 1 bit 16 bit 32 bit or 64 bit data and assigns the result to the specified device Logical XOR 1 bit is used with a prefix of B when an exclusive OR of 1 bit data is performed Logical XOR Word is used with a prefix of W when an exclusive OR of 16 bit data is performed Logical XOR Long word is used with a prefix of L when an exclusive OR of 32 bit data is performed Logical XOR Double Long word is used with a prefix of D when an exclusive OR of 64 bit data is performed The result of each t
213. rameter is out of the valid range when a script is converted into a ladder program Table G5 3 Error Message Invalid script Address with unallocated tag name or undefined constant name used in a script List of Syntax Check Error Messages Description The script contains an invalid description This error message is also displayed if a device area used ina script overlaps a script work device area A tag name to which no address is allocated or an undefined constant name is used in a script Additional Information Block file name Block name Block file name Block name Category Error Cannot be changed Error Cannot be changed Script instruction cannot be used The CPU model does not support script instructions Block file name Block name Error Cannot be changed Script processing failed The maximum line limit of blocks will be exceeded if the script is converted into a ladder An error has occurred in script processing due to some reason If the script is converted into ladders the maximum number of lines 20 000 lines in a block will be exceeded Block file name Block name Block file name Block name Error Cannot be changed Error Cannot be changed Invalid area setting of script work device l The setting of a script work device area in the internal relay I is not correct Error Cannot be changed Invalid area settin
214. rator Precedence cccececceceeeeeeeceeeeeeeeeeeteteenieeeeeeeeeees G3 7 G3 3 Control Statements icicccecesccenccseascecceessectesecsceeceedseerceeasearcuesieceessasceeed G3 8 G3 3 1 Conditional Branch Statement 0 ceeeeeeeeeeeeteeeeeteteeeeees G3 8 IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G4 G5 G6 G7 G8 G3 3 2 Repetitive Statement c cccccceeeeeeeceeceeeeeeesecneeaeeeeeeeeeteeed G3 11 G3 3 3 Script Exit Statements ecececceccececeeeeeceecaeceeeeeeeseesncaneeeees G3 13 G3 3 4 Restrictions on Control Statement cece eeeeeeeeeeeeeeeeeee G3 14 G3 4 Data Types and Prefixes ccccccessenesesseeeeeeeeeeeeeesneeeeeesneeseeeseneeeneees G3 16 G3 4 1 Specifying Data Types 0 2 ecceeeeeeeeeeeeeeeeeseeeeeeeseeneeeeeeaees G3 16 G3 4 2 Prefixes and Available Devices 0 0 eee ceceneteeeeneeeeeeenteeeeeeaes G3 17 G3 4 3 Converting Data Types eeeceieeeesneeeeenneeeeeeneeeeeeneeeeeeaas G3 17 G3 4 4 Data Types in FUNCTIONS eee ceceeneeeeeeeeeeeeeetaeeeeeeaeeeeeeaas G3 19 G3 5 Reserved Words cccccsssecesesseeceeesseeeeeeseeeseseseesesesaeseeeseanseeeseanseeeenes G3 20 Setting a Script in a Project ssssssssssssnnnnnnnnnnnnnnnnnnnnnnnnnnnnns G4 1 G4 1 Setting Work Device Areas cesceccseseeeceseeeeeeeeeeeeeeeseeneeeeeeeneeenseeneeen G4 2 G4 2 Display Formats of Work Devices in Converted Ladders G4 3 Debugging Script
215. rch start position s1 1 0 4 The 1 character if not specified s1 2 N G Sequence of s2 s1 3 B W s2 N G s1 4 R 00 gt gt d 5 In this case NG is found at the 5 character counted from the 1 character in string s1 0101NGBWR G1006_01 VSD Figure G10 4 Example and Behavior of the Simplified INSTR Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 15 G10 7 MID String Middle MID is a function for extracting a substring from a string This function extracts an n2 character substring starting from the extraction position n1 in source string s and writes the substring in the return value The extraction position n1 is counted from the first character n1 1 of string s Return value MID s n1 n2 Return Prefix index t z Description L D F E s B Constant Expression Modification A source string or the first device number of Vv P Vv V devices that represent a source string n1 An extraction position v v v The number of n2 characters in bytes to v v v be extracted Return The extracted string Vv g value a E SR E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If s is NULL or t
216. rtial Byte Deletion cccccceseeesseceeeeeeeeeeeeseeeeeeeeeeseeeeees G9 33 G9 16 BIN Binary Conversion ccccccesssneeeeseeeeeeeenseeeseeneeeeseeeeeenseeeeenees G9 35 G9 17 BCD BCD ComnverSion ccccccecceeeenneeeeeeneeeeeseeeeeseeeeenseceeeneeeeeenes G9 37 G9 18 FBCD Float to BCD cccecceseeeseeeeeeeeeeeeeesneeeeseeeeeeeeeseeesessaeeeseeeeees G9 39 G9 19 BCDF BCD to Float cccccceseeeseeeeeeeeeeeeeeeneeseseeeeeeeeeseeeensnaeeeseeeeees G9 41 G9 20 ITOF Integer to Float ccccesseseceseereeeeseeeeeeeseenseeeseeneeeeseenseeesenseeesees G9 43 G9 21 ITOE Integer to Double Precision Float ccsssecesseesssseeenees G9 45 G9 22 FTOW Float to Integer cccceccssseneeeeseeeeeeeseenseesseeesesseenseeeseenseessees G9 47 G9 23 FTOL Float to Integer ccseeeceseeeeeeseeeeeeeseeeseeeeeeseesseenseeeseenseeseees G9 49 G9 24 ETOL Double Precision Float to Integer cccssscsssseeessseeeenees G9 51 G9 25 ETOD Double Precision Float to Integer cseesesesseeeeseeeeeeees G9 53 G9 26 FTOE Float to Double Precision Float cccccesseceeeeereeeeseeeeeeeees G9 55 G9 27 ETOF Double Precision Float to Float cccccesssesesseeeeeseeeeeeeees G9 57 G9 28 RAD Convert Degree to Radian ccccccssseneseseeeseeeseeeseeeseeneeeeeees G9 59 G9 29 DEG Convert Radian to Degree cceeccceseeneeeseeneeeeeeenseeeeeeneeeseees G9 61 G9 30 ASC Convert ASCII c c ccccc
217. s as the first byte the lower byte as the second byte TIP There is no ladder instruction corresponding to the HDEL function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 35 G9 16 BIN Binary Conversion BIN is a function for converting the BCD codes of a 16 bit or 32 bit data into BIN codes Return value BIN s Return Prefix index Value Description Constant Expression ee ae Arguments Ww L D F E S B Modification A data to be converted or the first device 5 number of devices J V V J Y whose data are converted into BIN codes Return Conversion result 7 Vv Vv value 1 Specify the same prefix for s and the return value E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments There is no restriction Return The processing result is stored value E Available Devices Arguments Return Prefix X Y l E L M T C D B FI WI Z R VJ H ATU P Value Ww v v v v v v v v v v v v v v v v L v v v v v v v v v v v v v v v v Return Ww v v v v v v v v v v v v v v v value L v v v v v v v v v v v v v v v 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 36 E Function and Example This function converts the BCD codes of a 16 bit data with a prefix of W or 32 bit data w
218. s cies sae wsces dace seetaestidanteetacesaduuidesiwueideniwweane G5 1 G5 1 Compile Check and Error Messages csseccseseeeeseeeeeeeseseeenseseeees G5 2 G5 2 Syntax Check and Error Messages sccseseeesseseeeeeseseeeeeseseeenneseeees G5 7 G5 3 Monitoring Converted Ladders cccssecccessecceeeseeeeeeesneeeeeeseeneeesees G5 10 G5 4 Monitoring in the Script Pane cccessseeeesseeceeeseeeeeeesneeeeeeseeneeeeeees G5 12 G5 4 1 Changing Display Formats and Debugging ceeee G5 13 G5 4 2 Hiding Monitor Line sessies saiia a G5 15 Script Functions aep renee ne nae pee et ees Eee Nes pnp iene prreene st raster ene rere erst eersen ten G6 1 Basic FUNCIONS cscs ec Sea cetccee neue ncee neuen dee dasanan saadaa danaa G7 1 G7 1 LDU Logical Differential Up ccs eseeceseseeeeeeeeeeeeeeeeneeeeeeseeeeeeeeneees G7 2 G7 2 LDD Logical Differential Down ccecsesseeeseeneeeeeeeneeseneeneeenseeneees G7 4 Computational FUNCTIONS cccccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees G8 1 G8 1 SUM Summation Value cccceseeeceseeeeeeeseeeeeenseeneeeeseeneeenseseeeenseeneees G8 2 G8 2 MAX Maximum Value cceecceseseeeeeseeeeeeeseeneeenseseeeeesesneesneeeneeeneeseeees G8 4 G8 3 MIN Minimum Value 0 cccccecceseseeeceeeeeeeeeeeeeeeeeeeeneeeeeesneesneeseeeneeeneees G8 6 G8 4 ABS Absolute Value cccccesseeceseseeeceseeeeeeesesneeenseeneesesesneeseeeseeensesneees G8 8 68 5 LOG Log
219. seccettescscecesnnecnstecsnceceenetenseuecenetesaresnoeesenees G9 63 G9 31 APR Approximate Broken Line ccecccessenesesseeseeeseenseeeseeneeeeeees G9 65 G10 String Manipulation FUNCTIONS ccccceeceeeeeeeeeeeeeeeeeeeeeeeeeeee G10 1 G10 1 VAL Convert String to Numeric eeeeceeeeeeeeeeneeeeeeeneeeeeeseeneeeenees G10 2 G10 2 STR Convert Numeric to String ceeccceeseceeeeeeeeeeeseeeeeeeseeneeesees G10 5 G10 3 SMOV String Move cccccccesccsseeeeeeeeeseeeseeesesneeeeeneeseeesesseeeneeeeeeenes G10 7 G10 4 SLEN String Length Count ceccccessecceeeseeeeeeesneeeeeeseeeseeeseeeseeesees G10 9 G10 5 INSTR String Search cccccccceseeeeeeeeeeeeeeeeeeeeneeeeeeeeseeeseeseeseeneeeeees G10 11 G10 6 INSTR Simplified String Search ccccceseeseeeeeeeceeeeeeeeseeeeeeeeeee G10 13 G10 7 MID String Middle ccsccesceesceeeeeeeeeeeeeeeeeeeeeeeeeeseesneeeneeesaees G10 15 G10 8 MID Simplified String Middle cceeceeceeeeeeeeeeeeeeeeeeees G10 17 G10 9 RIGHTS String Right ccsceesceesceeeeeeeeeeeeeeeeeeeeeeseeesneeeseeesaees G10 19 G10 10 LEFT String Left ecesceseesceeseeeseeeeeeeeeeeeeeeeeeeeeeeseesneesneeesaees G10 21 G10 11 SDEL Substring Deletion cccccssceceesseceeeseneeesseneeeeseeeeeneneeeenes G10 23 IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 12 SINS String Insertion ccceceeeceeeseeeeeeeeeeeeeeeeeeeees
220. sposing products in the EU contact your local Yokogawa Europe B V office E How to Discard Batteries The following description on DIRECTIVE 2006 66 EC hereinafter referred to as the EU new directive on batteries is valid only in the European Union Some models of this product contain batteries that cannot be removed by the user Make sure to dispose of the batteries along with the product Do not dispose in domestic household waste When disposing products in the EU contact your local Yokogawa Europe B V office Battery type Lithium battery pad Note The symbol above means that the battery must be collected separately as specified in Annex II of the EU new directive on batteries IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Introduction E About This Manual The WideField3 manual set consists of the following four volumes Table 1 Manual List Document No Introduction and Troubleshooting IM 34M06Q16 01E IM 34M06Q16 02E IM 34M06Q16 03E IM 34M06Q16 04E Trace Function IM 34M06Q50 21E This manual is the operation manual Script for the Range free Multi controller FA M3 Programming Tool known as WideField3 in this manual E Overview of This Manual This manual describes functions of the script for WideField3 For enquiries please contact the store where you purchased the product or the nearest Yokogawa sales office listed at the back of this manual We recommend using this manual together with th
221. string is inserted The beginning of s1 cea aig the 1 character s1 A B s2 T 2 siri Cc D s2 1 3 00 s1 2 E 00 s2 2 s1 3 i s2 3 s1 4 i s2 4 Insertion position immediately before the n th character Transfer the string obtained by the insertion Destination d A B d 1 c 4 d 2 9 13 d 3 D E d 4 00 G1012_01 VSD Figure G10 10 Example and Behavior of the SINS Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character TIP There is no ladder instruction corresponding to the SINS function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 27 G10 13 REPLACE String Replacement REPLACE is a function for performing a string replacement This function replaces an n2 character substring starting from the n1 th character in string s1 with string s2 and stores the obtained string in the return value Return value REPLACE s1 s2 n1 n2 Return Prefix Index nad A Description L D F s B Constant Expression Modification A string whose substring is replaced st with another string or of P VY the first device number of devices that represent the string Astring with which a s2 substring of another v v v v string is replaced A position
222. subsequent script statements by turning off the start script relay SEE ALSO For details on the EXITSCRIPT statement see Section G11 4 EXITSCRIPT Script Exit Statement in this manual For details on the start script relay see Section G2 1 2 Displaying a Script in the Ladder Format in this manual IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 14 G3 3 4 Restrictions on Control Statements This section describes the restrictions on control statements E Nesting For branch and repetitive statements you can use control blocks within other control blocks This is called nesting Nesting for Repetitive Statements FOR Statements The maximum nesting level for repetitive statements FOR statements is eight A compile error occurs if the nesting level exceeds the maximum FOR repetition counter repetition initial value repetition final value i I First Nesting Level statement 1 i FOR repetition counter repetition initial value repetition final value Second Nesting Level statement 2 1 FOR repetition counter repetition initial value repetition final value sc Third Nesting Level statement 3 I i s booty Loo oe ae Up to the eighth nesting l level is allowed NEXT NEXT NEXT G0304_02 VSD Figure G3 1 Example of Nested Repetitive Statements IL ILC is used when a FOR statement is converted into a ladder program An instruction processing
223. t For the protection and safe use of the product and the system controlled by it be sure to follow the instructions and precautions on safety stated in this manual whenever handling the product Take special note that if you handle the product in a manner other than prescribed in these instructions the protection feature of the product may be damaged or impaired In such cases Yokogawa cannot guarantee the quality performance function and safety of the product When installing protection and or safety circuits such as lightning protection devices and equipment for the product and control system as well as designing or installing separate protection and or safety circuits for fool proof design and fail safe design of processes and lines using the product and the system controlled by it the user should implement it using devices and equipment additional to this product If component parts or consumable are to be replaced be sure to use parts specified by the company This product is not designed or manufactured to be used in critical applications which directly affect or threaten human lives and safety such as nuclear power equipment devices using radioactivity railway facilities aviation equipment shipboard equipment aviation facilities or medical equipment If so used it is the user s responsibility to include in the system additional equipment and devices that ensure personnel safety Do not attempt to modify the product
224. t definitions are Value the same as in the Constant Definition edit 15 window Comment Time out value To display a list of currently registered constant names click the W button of the cme Constant Name drop down list Select a Step 2 C0205805 Hove constant name to display the current value SEE ALSO For details on available values for constant definitions see Section E3 2 2 Specification of Elements of Constant Definition in FA M3 Programming Tool WideField3 Offline IM 34M06Q16 02E 3 Click Save The constant definition is registered TIP If you try to enter a constant name that has already been registered a message box is displayed asking if you want to overwrite the existing constant definition IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 17 AY CAUTION You cannot use BIN type constant names for constants in scripts Doing so causes a compile error You cannot register constant definition during online editing TIP If the Constant Definition edit window is open in the background the window is updated with your specification of constant definition but the specification is not saved To confirm registration of the specified constant definition you must save the constant definition If the Constant Definition edit window is closed the specified constant definition is saved and applied to the window when you register the definition Editing Const
225. t errors will not be reflected on the CPU To update all changes and exit correct the conversion error If you choose to exit without reflecting to the CPU the program on the CPU retains its state prior to the modifications IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 2 For WideField3 R2 02 or earlier if using online editing to edit the contents of a script there some required conditions for ending online editing If a compile error occurs when editing a script online editing cannot be ended until the compile error is remedied If a conversion error occurs in a ladder program after editing the script and ladder program online editing cannot be ended until the ladder program conversion error is remedied For WideField3 R2 02 or earlier if there is a conversion error then only contents up to the error area will be reflected on the CPU To update all changes and exit correct the conversion error You may choose to exit without reflecting the invalid areas to the CPU but this may result in a displaced circuit comment in subsequent uploading if there was a conversion error in a circuit before or after the circuit comment If using tag names and structures with a script online editing cannot be performed unless a project on a PC is opened After opening a project open the program monitor screen and perform online editing IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G2 3 G2 1 Editing Scripts This section describes how t
226. t of the expression to a relay and use the relay as s SEE ALSO The LDU function behaves in the same way as the LDU instruction in ladder instructions For details on the LDU instruction see Section 2 5 Load Differential Up LDU Load Differential Down LDD in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G7 4 G7 2 LDD Logical Differential Down LDD is a function for logical differential down Return value LDD s Return Value Description Constant Expression Arguments A bit for checking a rising edge Returns a rising edge state E Return Value Arguments Return Value Input Output Behavior Restrictions Arguments s Input Return Processing result 1 TRUE value 0 FALSE 0 when a rising edge is not detected There is no restriction Returns 1 when a rising edge is detected Returns E Available Devices Ca SE PEEP EEE a s v AAR Lv Return B vivivivly J value ee EE EE d l LE E Step Counts Prefix Step Count 5 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G7 5 E Function and Example Only when a falling edge is detected in the change of s 1 to 0 1 is stored in the return value Example Return value LDD s 0 1 1 1 0 0 1 0 0 Figure G7 2 Example and Behavior of the LDD Fu
227. tant name Xxx G5 5 Troubleshooting Check that a function that does not return a value has not been assigned Check if the operation contains a function that does not return a value The length of the constant name xxx exceeds the upper limit Check the constant name Invalid identifier xxx There is an incorrect description in the tag name or address Check the description of the tag name or address Invalid data type specified xxx The data type xxx is an incorrect prefix Or an unsupported type conversion is specified The following types of type conversions cannot be performed Type conversion from word W to double precision floating point E Type conversion from single precision floating point F to double long word D Type conversion from double precision floating point E to word W Type conversion from double long word D to single precision floating point F Check the prefix or the types to be converted String is excessively long Xxx The string literal xxx exceeds the number of characters that can be specified for a string concatenation operation assignment statement or functional argument Types of right left hand values of calculation assignment expression do not match It is necessary to convert from xxx to yyy Cannot perform script to ladder conversion Instruction Parameter range is invalid xxx Check if the types of the right and left ha
228. tement to exit the script without executing the part written after the EXITSCRIPT statement if CASE or DEFAULT is met AN CAUTION If there are more than one constant that matches CASE a statement specified earlier has precedence The subsequent statement s are not executed Example SELECT D00001 CASE 1 f the value of D00001 is 1 statement 1 CASE 2 20 I f the value of D00001 is between 2 and 20 statement 2 CASE 15 f the value of D00001 is 15 statement 3 ENDSELECT If the value of D00001 is 15 then it matches the second CASE and the third CASE However the second CASE has precedence and statement 2 is executed After statement 2 is executed the process jumps to ENDSELECT and thus statement 3 is not executed When a value range is specified for CASE in the format start value end value it is not checked if the start value is equal to or smaller than the end value If a start value larger than the end value is specified by mistake the statement for the CASE is not executed You can nest SELECT statements by including one IF or SELECT statement within a SELECT statement The maximum nesting level is eight A compile error occurs if the nesting level of both IF and SELECT statements exceeds the maximum SEE ALSO SELECT ENDSELECT is described in the explanation of the script syntax See Section G3 3 Control Statements in this manual For details on the EXITSCRIPT statement see Section G11 4
229. ter to the repetition final value This is the same as the FOR NEXT instruction in ladder instructions For example if the repetition initial value is 1 and the repetition final value is 10 statement 1 is executed 10 times AN CAUTION If the repetition final value is equal to or smaller than the repetition initial value a single loop of FOR NEXT is executed With Conditional Break Type FOR repetition counter repetition initial value repetition final value statement 1 IF stop condition THEN BRK ENDIF NEXT Statement 1 is executed repeatedly from the repetition initial value of the repetition counter to the repetition final value However the FOR statement is stopped and terminated if the stop condition is met during repetitions A CAUTION If the repetition final value is equal to or smaller than the repetition initial value a single loop of FOR NEXT is executed TIP The repetition initial value and repetition final value that are set when the FOR function is executed for the first time are used throughout all repetitions The number of repetitions is unchanged even if you modify the repetition initial value or repetition final value during repetitions The processing between FOR and NEXT is executed only once if the repetition initial value is equal to or larger than the repetition final value Use the BRK statement to forcibly terminate a FOR NEXT loop IM 34M06Q16 04E 3rd Edition Dec 25 2013 0
230. th is greater than s characters in 2047 an instruction processing error occurs string length during execution in the CPU Output The conversion result is stored d If an instruction processing error occurs the value before execution is maintained Return N A value E Available Devices E Step Counts Prefix Step Count Ww 29 D 29 F 29 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 3 E Function and Example This function converts string s that has a format specified by n and is terminated with 00 into a numeric value and then the function stores it in d This function can convert a decimal number string hexadecimal number string or real number string Also the format of the converted value is long or long word integer or single precision floating point Example 1 When n 0 The function automatically detects the type of the string and converts it into a numeric value If the string contains a character between A and F the function converts the string in the same way as for n 2 If the string does not contain any of these characters the function converts the string in the same way as for n 1 You must specify 2 for n if you want to convert a string that does not contain any character between A and F into a hexadecimal number 2 When n
231. ting from the first device specified by return value d Instructions Logical AND Word Logical AND Double Long word 4 word instruction Specification Item Logical AND 1 bit Logical AND Long word 1 bit instruction F f 2 word instruction Number of bits of the operation result Device s to which the operation result d 1 d d 3 d 2 d 1 d is assigned 16 bits 32 bits 64 bits Example W Y00601 ANDV W X00501 W X00517 X00516 X00501 encoge 1 0 1 0f tfoltfolsjofa afrj4fo X00532 AND X00517 E olo o o ali 110 X 1l0l1 Y00616 Y00601 Y00601 BIN code G0815_01 VSD Figure G8 15 Example and Behavior of the ANDV Function TIP There is no operator or ladder instruction for 64 bit logical operations Use this function if you want to perform a 64 bit logical operation SEE ALSO The ANDV function behaves in the same way for 16 bit and 32 bit data as the logical product instruction in ladder instructions For details on the logical product instruction see Section 3 4 1 Logical AND CAL Logical AND Long word CAL L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E The difference is only in the data size for 1 bit and 64 bit data while the basic behavior is the same as that for the other data sizes IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 32 G8 16 ORV Logical OR ORV is a function for performi
232. tion SEE ALSO The RROT function behaves in the same way as the RROT instruction in ladder instructions For details on the RROT instruction see Section 3 5 1 Rotate RROT LROT Rotate Long word RROT L LROT L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 4 G9 2 LROT Left Rotate LROT is a function for rotating a 16 bit or 32 bit data left by n bits Return value LROT s n Return Prefix Value Description Constant Expression Index Arguments Modification The first device number of devices for which the rotation is performed The first device number of devices that give the number of bits to be rotated Return Rotation result value 1 Specify the same prefix for s and the return value 2 Even if s is L specify W for n E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Input W is specified for s If O is specified no operation is performed 1 lt n lt 16 If the n specified for a word data is less than 0 or Lis specified for s greater than or equal to 17 or if the n specified for 1 lt n lt 32 a long word data is less than 0 or greater than or equal to 33 an instruction processing error occurs during execution in the CPU Output The pro
233. tion Manual Instructions IM 34MO6P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 11 G10 5 INSTR String Search INSTR is a function for searching for a string This function returns the first position counted from the position specified by n of string s2 found in string s1 R eturn value INSTR s1 s2 n Return Prefix Index nad A Description L D F E s B Constant Expression Modification A string to be searched for or the first device number of devices that sa al d represent the string 52 A string to be searched s V for in s1 is A position from which s Vv the search starts Return The start position of the value string found first E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If n is greater than the string length specified by characters in s1 an instruction processing error occurs during string length execution in the CPU If the string length specified by s2 is greater than si the string length specified by s1 an instruction processing error occurs during execution in the CPU If s1 is NULL or the string length of s1 is greater than 2047 an instruction processing error occurs during execution in the CPU Input 1 to 2047 If the string length specified by s2 is greater than characters in the string length specified by s1 an instruction string length process
234. tion searches for the minimum value of n signed data values in a data area starting from s and stores the minimum value at the addresses starting from d Example Return value MIN s 10 d s 671 p d 225 s 1 225 Search for the minimum s 2 456 value s 3 1666 s 7 864 s 8 631 s 9 1235 G0803_01 VSD Figure G8 3 Example and Behavior of the MIN Function TIP There is no ladder instruction corresponding to the MIN function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G8 8 G8 4 ABS Absolute Value ABS is a function for obtaining an absolute value Return value ABS s d Reum Ln Pretiaxt id a Value Description Constant Expression gta Arguments w L D F E S B Modification A data value whose absolute value is calculated or the first s device number of v v v v v v v v devices for which the absolute value is calculated The first device number of devices for which the d absolute value is Vv stored The data type is x x the same as that of argument s Return Returns 0 normal or 4 y value error 1 Specify the same prefix for s and d 2 Even if s is L D F or E specify W for the return value and n E Return Value Arguments 1 When s is integer W L D Return Value Input Output Range Behavior Restrictions Arguments Input Values other than If
235. to Integer FTOL is a function for converting a single precision floating point data into a 32 bit integer data Return value FTOL s Return Prefix flee Value Description Constant Expression ar cae Arguments wW L D F E S B Modification A data to be converted or the first device s number of devices v v v v whose data are converted Return Conversion result V V value E Return Value Arguments Return Value Input Output Arguments There is no restriction The processing result is stored Arguments Return Value Return value 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 50 E Function and Example This function converts a single precision floating point data into a 32 bit integer data This function is used before the result of a floating point operation is used as an integer Example L D1001 FTOL F D0001 D0001 IEEE code 1 olo 0 fea jo oO lt a oO F A oO 7 lt oO 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 1 D1001 BIN code Represents an integer 333 0000014D G0923_01 VSD Figure G9 24 Example and Behavior of the FTOL Function SEE ALSO The FTOL function behaves in the same way as the FTOI instruction in ladder instruct
236. transfers string s to d You can specify a string literal for s of between 1 to 4 bytes Unlike the MOV function the SMOV function adds a termination character Null 00 at the end of d Use the SMOV function to transfer a string data and use the MOV function to transfer a numeric data Example SMOV s1 d1 Source string p Destination string s1 A B d1 A B s1 1 Cc D d 1 Cc D s1 2 E F d 2 E F s1 3 G H d 3 G H s1 4 00 d 4 00 End of the string Null G1003_01 VSD Figure G10 1 Example and Behavior of the SMOV Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character SEE ALSO The SMOV function behaves in the same way as the SMOV instruction in ladder instructions For details on the SMOV instruction see Section 3 12 4 String Move SMOV L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 9 G10 4 SLEN String Length Count SLEN is a function for obtaining the length of a specified string This function counts the length of string s in bytes Return value SLEN s Return Prefix index aa M Description W L D F E s B Constant Expression Modification A string whose length is counted or the first s device number of v v v v de
237. triction The processing result is stored E Available Devices Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 62 E Function and Example This function converts the unit of an angle from radians to degrees The relational expression is as follows Return value s x 180 7 Ss Conversion source in radians Return value Conversion destination in degrees SEE ALSO The DEG function behaves in the same way as the FDEG instruction in ladder instructions For details on the FDEG instruction see Section 3 8 23 Convert Radian to Degree FDEG in Sequence CPU Instruction Manual Instructions IM 34MO6P12 03E Example F D1001 DEG F D0001 D0001 IEEE code of 0 1 111 To 110 o 0 0 1 0 0 0 offs 1 ior 0 i 0 1 1 Sees ees D0002 lg ee ee D0001 x l Represents 0 7853981 3F490FDB T 7 D1001 0 1 0 0 0 0 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 O0 0 OlO JO IEEE code Represents 45 42340000 G0929_01 VSD Figure G9 30 Example and Behavior of the DEG Function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 63 G9 30 ASC Convert ASCII ASC is a function for converting the n th digit of a 16 bit data in a de
238. tring specified by S If n2 lt 0 an instruction processing error occurs during execution in the CPU If n2 is greater than the string length specified by s the return value is the string obtained by deleting the n1 th character and all subsequent characters from the string s If a string specified by s is deleted an instruction processing error occurs during execution in the CPU The obtained string is stored If an instruction processing error occurs an indefinite value is returned Arguments Return Prefix xX Y l LIMITI CID BI FIW IZ R V HJAJUJP Value s S v v v v v v v A v n1 WwW v v v v v v y v v v v v v v v n2 WwW v v v v v v v v v v v v v v v Renn s ra ae a ae ae y vie value IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 24 E Step Counts S 92 4 In addition 21 steps are used for each script instruction E Function and Example This function deletes an n2 character substring starting from the n1 th character in string s and stores the remaining string in the return value n1 is counted from the first character n1 1 of string s Example d SDEL s n1 n2 When s ABCD01234 n1 3 and n2 5 d AB34 eee fut The beginning of the Eaa Soure ii data to be deleted n1 Destination s d 4 Transfer the remaining data as d 1 a set of continuous data s 2 d2 st3 d 3 st4 d 4 T
239. turn value SUNIT s n Return Prefix index Value Description Constant Expression eat a Arguments L D F E S B Modification The first device number s of a string consisting of word unit characters The number of characters to be combined or the first j v v v L device number of the number of characters to be combined The string obtained by Return combining byte unit v value characters E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 1 to 2047 If s is NULL an instruction processing error s characters in occurs during execution in the CPU string length If the specified n is 0 or less an instruction processing error occurs during execution in the Return value Output E Available Devices CPU The obtained string is stored If the string length of the combined result is greater than 2047 an instruction processing error occurs during execution in the CPU If an instruction processing error occurs an indefinite value is returned Arguments Return Prefix X Y I Ly M T C D B FI W Z R V H AT UY P Value s W viviv n Ww vilvlilvy viv viviv v Return value s 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 43 E Function and Example s 23 s 24
240. ue the data type of the return value is determined by the data type of the argument In the following examples when a word W argument is specified the function returns a word W value and when a long word L argument is specified the function returns a long word L value Example NOTV W D00001 Returns a word W value NOTV L D00001 Returns a long word L value IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G3 20 G3 5 Reserved Words A reserved word is a special code that is reserved in advance for script coding The following describes reserved words Work Device Names The script work device name sM30100 shown in Section G4 2 Display Formats of Work Devices in Converted Ladders is a reserved word Names That Represent an Operation Result or State The following table shows reserved words that represent an operation result or state You can use the reserved words in script statements Table G3 9 Reserved Words That Represent an Operation Result or State Reserved Words Description Usage Examples Represents a true value B 100001 ON Represents a false value B 100001 OFF Represents a true value B 100001 TRUE Represents a false value B 100001 FALSE AN CAUTION In a script the tag name will not function correctly if you use a tag name that is the same as a reserved word This is because such a tag name in a script is not converted into a correct address Do not
241. uired Specifications and Layout of the FA M3 Mounting and Wiring Testing Maintenance and Inspection and System wide Restrictions for Mounting Modules 1 See specific manuals for products other than the power module base module I O module cables and terminal block units Hardware Manual IM 34M06C11 01E Fiber optic FA Bus Functions Fiber optic FA bus Module and Fiber optic FA bus Type 2 Module FA bus Type 2 Module IM 34M06H45 01E FA Link Functions FA Link H Module Fiber optic FA Link H Module IM 34M06H43 01E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 Copyrights and Trademarks E Copyrights Copyrights of the programs and online manual included in this CD ROM belong to Yokogawa Electric Corporation This online manual may be printed but PDF security settings have been made to prevent alteration of its contents This online manual may only be printed and used for the sole purpose of operating this product When using a printed copy of the online manual pay attention to possible inconsistencies with the latest version of the online manual Ensure that the edition agrees with the latest CD ROM version Copying passing selling or distribution including transferring over computer networks of the contents of the online manual in part or in whole to any third party is strictly prohibited Registering or recording onto videotapes and other media is also prohibited without expressed permission
242. uired between the ELSE and IF in each ELSE IF A compile error occurs if the space character is missing There is no limitation on the number of ELSE IFs There is no limitation on the number of statements in an IF statement in both single and multiple branch types SEE ALSO Details of the IF ENDIF statement are given also in the section on the script syntax See Section G3 3 Control Statements in this manual For details on the EXITSCRIPT statement see Section G11 4 EXITSCRIPT Script Exit Statement in this manual For details on nesting see Section G3 3 4 Restrictions on Control Statements in this manual IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G11 5 G11 2 FOR NEXT Repetitive Statements The FOR NEXT statement uses devices specified by d as a counter and repeats processing between FOR and NEXT while the counter changes from s1 to s2 FOR d s1 2 Return Prefix index Poia x Description L D F E s B Constant Expression Modification d The first device number of a repetition counter The device number of s1 the initial value of the v v v repetition counter The device number of s2 the final value of the v v v repetition counter Return No value is returned value E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments d Input There is no restriction If s1 is greater than or equal to s2 th
243. ure for Editing a Script eeessseseessessernesssrnesesnnesrernaarene G2 3 G2 1 2 Displaying a Script in the Ladder Format ceceeeeeteeeees G2 6 G2 2 Input Correction Functions for Editing Scripts cccssseeseeeees G2 8 G2 3 Useful Functions for Editing Scripts cccccseseereesesneeeeeeeneeeneeseeees G2 9 G2 3 1 Comments and Indent 0 eccceceeeeeeeeeeeeeeeneeeeeeteeeeetnneeeee G2 9 G2 3 2 Inline MNEMONICS eee eect ee eeeeeeeeeeeeeeeseeeeeeeseeaaeeeeeenaees G2 12 G2 3 3 Using the Functions for Ladders in Scripts eee G2 13 G2 3 4 Display of Input Candidates ccccceeeeceeeeeeeeeeeeteneeeeees G2 15 G2 3 5 Registering and Editing of Constant Definition 00 G2 16 G2 4 Printing SCripts ticecsccccceccdecetscsctecssecdecenscsttecesecdeeensesttvesnecdieetaesttvensecten G2 19 Script Synta osese aodan aaa aiaa a G3 11 G3 1 Assignment Statements ccc sesseeesesneeeeseeeeenseeeeeensesneeseeeeneeeneeeneees G3 2 G32 Op ratOrS sisson eceves saactene sevceves aa anaa araara ainaani G3 4 G3 2 1 Arithmetic Operators ccccccceceeeeeeeeneeceeeeeeeseceneaeeeeeeeeeseenaees G3 4 G3 2 2 Comparison Operators ccccccceeeeeeceeceeeeeeeseceneaeeeeeeeseeennaees G3 6 G3 2 3 Logical Operators secsec A G3 6 G3 2 4 String Manipulation Operators ccceceeeeeeeceeeeeeeeeeeeenaees G3 7 3 2 5 Other Operator Seinna aa aa aa ai AE A a aaa G3 7 G3 2 6 Ope
244. vice s into an ASCII code Return value ASC s n Return Prefix index Value Description Constant Expression eae ae Arguments Ww L D F E S Modification The first device number s of a data that is v v v v converted The position 0 to 3 of n the digit to be converted v v v v in the data Return The converted data is 7 VY value written in E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Input Osns3 If the specified n is less than 0 or greater than or n equal to 4 an instruction processing error occurs during execution in the CPU Return Output The processing result is stored If an instruction value processing error occurs an indefinite value is returned E Available Devices Arguments Return Prefix X Y It E L M T COC DI BY F Z R V H AJ U P Value s W v v v v v v v v v v v v v v v n W v v v v v v v v v v v v v v v Return w value Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 64 E Function and Example This function converts a value 0 to F at the n th digit conversion source position of a 16 bit data conversion source represented by a device s into an ASCII code 0 30 1 31 F 4
245. vices that represent the string Ret rh The obtained string valik length in bytes is v stored E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments Input 0 to 2047 If s is NULL the string length is 0 characters in If the string length specified by s is greater than string length 2047 an instruction processing error occurs during execution in the CPU R Output The length of string is stored eturn P valie If an instruction processing error occurs an indefinite value is returned E Available Devices Step Count 4 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G10 10 E Function and Example This function counts the length of string s in bytes Example d SLEN s String Co nt fe s 1 s 2 s 3 s 4 o j Count the number of characters number of bytes before 00 G1004_01 VSD Figure G10 2 Example and Behavior of the SLEN Function TIP The functions which process strings handle the upper byte 8 bits of a word data 16 bits as the first character the lower byte 8 bits as the second character SEE ALSO The SLEN function behaves in the same way as the SLEN instruction in ladder instructions For details on the SLEN instruction see Section 3 12 5 String Length Count SLEN in Sequence CPU Instruc
246. viedsdeesaanasee aad iadaaa G6 2 arithmetic Operator c ccecceceeeeeeeeeeeeeeeeteeees G3 4 ASC Convert ASCII ccccececseeeeeeeeeeeneees G9 64 ASIN Are Sine cccceeceseeseceeeeeeeeeeeeeaees G8 24 assignment statement eerren G3 2 ATAN Arc Tangent ieee G8 28 auto suggest of constant names 0 0 G2 15 available device cccccessesseceeeeeeeeeeaees G3 17 G6 3 B balloon coMMent 2 ccceceeeeeeeeeteeeeeeeteeeeeees G1 6 basi fUNC ON ssion G7 1 BCD BCD Conversion G9 38 BCDF BCD to Float cceeeeeeseeeeeeteees G9 42 BIN Binary Conversion G9 36 Dit LWP vsccccisgene devs azecvcavesen s G3 16 G6 2 BSET Block Set ccceeeeseseeceeeeeeeeeeeees G9 24 C Cache register eceseeeeceeeeeeeeeeeeeneees G4 1 G4 2 Check Errors ccccceceeeeeeeeceeeeeeeseseeneeeeeeees G2 4 Circuit COMMeENt OU ee ee eeceeeeeeeeeeeeetteeeeeeeees G1 6 comment identification character G2 9 G2 10 Comparison Operator cccceceeeeeeeeteeeeeeeeees G3 6 of 14 gt See G2 4 G5 2 COMPING EO excites eae a G5 3 compile error MESSAGE s es G5 3 G5 4 Compile Warning 2 eceeeeeeeeeeeeeneees G5 3 G5 5 computational fUNCTION ceeeeteeeeeeeeeees G8 1 conditional branch statement G3 8 G11 2 G11 9 constant index modification 00cee G2 14 constant name n
247. word type sessseesssesesrneseenneerennaseennee G3 16 G6 2 LPAD Left side Character Addition G10 38 EROT Left Rotate ee eeeeeeeeeeteeeeeeneees G9 4 LSFT Left Shift orrai G9 8 LSFTN Left Shift m bit Length Data Dy BIS A A G9 12 LTRIM Leading Space Deletion 0 G10 34 M MAX Maximum Value G8 4 MID String Middle 0 ccececeeeeeeeeees G10 15 MID Simplified String Middle 0 G10 17 MIN Minimum Value G8 6 mnemonic ECItING eee eeeeeeeeeeenteeeeeenteeeeeeaes G2 1 MOV MOVE 2 c cccccccecceceesssccceesesseeeeseeeeeeneneeees G9 14 MOV Simplified Move G9 17 multiple branching circuit eects G1 5 multiplication ccceeeeeseece cece ee eeeeeeeeeeeeeeeeeees G3 4 N nesting level 2 G3 9 G3 10 G3 12 G3 14 G11 4 G611 7 G11 11 NOTY Logical NOT eeecceeeseteeeeeeeteeeeenaes G8 36 O OPF lt tisateceisiesdeedakteceliestittvandaee did akties G3 20 ON adeeeitidnddeetialientecied identi G3 20 online CITING eee eeeeeee cette ee etteeeeetnteeeeetneeeeeeee G1 6 ORV Logical OR Jasrncrcrcnrnicinaniarans G8 32 output WINKOW cccccccccecceeeeeeeeeeeeeeeeeeees G2 4 G5 3 P PMOV Partial Move G9 19 POW POWETD ccceeseeeeeeeeeeeeeeeseeeeeeeenaeeeeseaaes G8 16 PROTX E Ea as eos cee ET G3 16 G6 2 program control function 0 eee eeeeeeeenees G11 1 Project Settings Configuration 0 2e G4
248. xample This function shifts a 16 bit or 32 bit data left by n bits Left Shift Word is used with a prefix of W when a left shift of a 16 bit data is performed Left Shift Long word is used with a prefix of L when a left shift of a 32 bit data is performed The last bit that is shifted out is stored in the carry Example W Y00601 LSFT W X00501 3 X00516 X00501 X00501 0 110 olo of 0 0 1 ri 7 7 Sr Filled with Os 4 4 7 y ff 3 bit left shift Discarded a vA Z y 0101111 Y00601 e 0 0 1 0 o 0 Carry Y00616 Y00601 G0904_01 VSD Figure G9 4 Example and Behavior of the LSFT Function SEE ALSO The LSFT function behaves in the same way as the LSFT instruction in ladder instructions For details on the LSFT instruction see Section 3 6 1 Shift RSFT LSFT Shift Long word RSFT L LSFT L in Sequence CPU Instruction Manual Instructions IM 34M06P12 03E IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 10 G9 5 RSFTN Right Shift m bit Length Data by n Bits RSFTN is a function for shifting an m bit length data right by n bits RSFTN d m n Return Prefix index Value Description Constant Expression ae gs Arguments L D F S B Modification The first device number d of devices for which the shift operation is erform
249. y Setup EB FA Link Setup E Samping Trace Setup ok Cancer He lt gt Steps 2 and 3 G0402_01 VSD 4 Click OK to confirm the settings of Project Settings Configuration AN CAUTION Ifyou use a script you must configure Script Setup in Project Settings Configuration If you do not configure Script Setup an error occurs in the syntax check If you configure Script Setup in Project Settings Configuration even if you do not use any script work device areas are allocated You cannot modify Script Setup in Project Settings Configuration online IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G4 2 G4 3 Display Formats of Work Devices in Converted Ladders This section describes the display formats of work devices in a ladder program converted from a script Display Format in a Ladder Program Edit Window Offline CO In a ladder program edit window each work device is displayed as a tag name to which no address is assigned Address assignment to work devices is automatically performed by WideField3 when the program is transferred to the CPU A work device used in the script Edit Block BLKOO1 BLKOO1 SCRIPT STO003 00001 i 1 fe he 00002 GEO i D00002 D00003 00003 The execution logic ma circuits of the script MOV Dooooi Doooo4 00005 GCO D00002 D00003 0000 ell sord s226 csa 686 CMT so
250. ype of exclusive OR has the number of bits shown in the following table The operation result is assigned to the devices starting from the first device specified by return value d Instructions Logical XOR Word Logical XOR Double Specification Item Logical XOR 1 bit Logical XOR Long word itt 1 word i f Long word 1 bit instruction instruction 2 word instruction 4 word instruction N mber of bits of 32 bits 64 bits the operation result Device s to which the operation result d 1 d d 3 d 2 d 1 d is assigned Example W Y00601 XORV W X00501 W X00517 oi a X00501 BIN code E Tele 1 HE 110 a 1 110 j i XOR et X00517 BIN code o Tele 1 Jp 110 io 1010 1 Y00616 Y00601 Y00601 BIN code E Jaai 0 ant 0 0 y 0 1 1 G0817_01 VSD Figure G8 17 Example and Behavior of the XORV Function TIP There is no operator or ladder instruction for 64 bit logical operations Use this function if you want to perform a 64 bit logical operation SEE ALSO The XORV function behaves in the same way for 16 bit and 32 bit data as the exclusive OR instruction in ladder instructions For details on the exclusive OR instruction see Section 3 4 3 Logical XOR CAL Logical XOR Long word CAL L in Sequence CPU Instruction Manual Instructions IM 34MO06P12 03E The difference is only in the data size f
251. yte and lower one byte of d Example HSWAP W D0001 Vv D0001 Before the 914 q ololol1 1 o 1lolol1lolo 1 operation Upper byte Lower byte Upper byte Lower byte y D0001 Afterthe ol4lolol lololilolilolololol1la operation G0913_01 VSD Figure G9 13 Example and Behavior of the HSWAP Function TIP There is no ladder instruction corresponding to the HSWAP function IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 30 G9 14 HCHN Byte Chain HCHN is a function for concatenating byte data This function concatenates n1 bytes of data starting from s1 with n2 bytes of data starting from s2 and stores the concatenated data at the addresses starting from d Return value HCHN s1 n1 s2 n2 d Return Prefix Index rad A Description W L D F E s B Constant Expression Modification The first device number of devices whose data s1 v are concatenated as leading data The number of bytes nf that are taken from s1 r The first device number of devices whose data s2 v v are concatenated as trailing data n2 The number of bytes V J that are taken from s2 The first device number d of devices to which the v concatenated data are assigned Return Returns 0 normal or 1 y value error E Return Value Arguments
252. z Vv P shift operation is performed The first device number of devices that give the n number of bits to be E r K x shifted Return Shift operation result Vv V value 1 Specify the same prefix for s and the return value 2 Even if s is L specify W for n E Return Value Arguments Return Value Input Output Range Behavior Restrictions Arguments s Input There is no restriction Input W is specified for s If O is specified no operation is performed 1 lt ns16 If the n specified for a word data is less than 0 or L is specified for s greater than or equal to 17 or if the n specified for 1 lt n lt 32 a long word data is less than 0 or greater than or equal to 33 an instruction processing error occurs during execution in the CPU R Output The processing result is stored eturn a valu If an instruction processing error occurs an indefinite value is returned E Available Devices Arguments Return Prefix xXx Y l E L JM T C D BYFI W Z RI V HI A UYP Value Ww v v v v v v v v v v v v v v v v s L v v v v v v v v v v v v v v v v n Ww v v v v v v v v v v v v v v v v Return Ww v v v v v v v v v v v v v v v value L v v v v v v v v v v v v v v v E Step Counts Prefix Step Count 1 In addition 21 steps are used for each script instruction IM 34M06Q16 04E 3rd Edition Dec 25 2013 00 G9 9 E Function and E

Download Pdf Manuals

image

Related Search

Related Contents

Manual de usuario  Télécharger : A08973D (FR)  User Manual EasyLine system User Manual EasyLine system  BT-500カタログ  Samsung GE73BR Инструкция по использованию  Web Browser Interface User's Guide  professional mobile radio  Zoch Zicke Zacke - Ei Ei Ei  Sony Xperia P 16GB Black  

Copyright © All rights reserved.
Failed to retrieve file