background image

OPERATION MANUAL

Function Blocks

CX-Programmer Ver.5.0

SYSMAC
WS02-CXPC1-E-V50
CS1-H, CJ1-H, CJ1M CPU Units

Cat.No. W438-E1-01

Summary of Contents for CS1-H Series

Page 1: ...OPERATION MANUAL Function Blocks CX Programmer Ver 5 0 SYSMAC WS02 CXPC1 E V50 CS1 H CJ1 H CJ1M CPU Units Cat No W438 E1 01...

Page 2: ...CX Programmer Ver 5 0 WS02 CXPC1 E V50 CS1 H CJ1 H CJ1M CPU Units Operation Manual Function Blocks Produced July 2004...

Page 3: ...iv...

Page 4: ...reviated Wd in documentation in this sense The abbreviation PLC means Programmable Controller PC is used however in some Program ming Device displays to mean Programmable Controller Visual Aids The fo...

Page 5: ...vi...

Page 6: ...Instance Specifications 30 2 3 Restrictions on Function Blocks 37 2 4 Function Block Applications Guidelines 42 2 5 Precautions for Instructions with Operands Specifying the First or Last of Multiple...

Page 7: ...viii TABLE OF CONTENTS...

Page 8: ...ted to the CS1 H CJ1 H CJ1M CPU Units Name Cat No Contents SYSMAC WS02 CXPC1 E V50 CX Programmer Ver 5 0 Operation Manual Function Blocks CS1G CPU H CS1H CPU H CJ1G CPU H CJ1H CPU H CJ1M CPU CPU Units...

Page 9: ...CPU P CJ1M CPU Programmable Controllers Instructions Reference Manual W340 Describes the ladder diagram programming instructions sup ported by CS CJ series PLCs When programming use this manual toget...

Page 10: ...s important for the safe and reliable application of the CX Programmer Ver 5 0 and Programmable Controller You must read this section and understand the information contained before attempting to set...

Page 11: ...anual before attempting to use the product and keep this manual close at hand for reference during operation WARNING It is extremely important that a PLC and all PLC Units be used for the speci fied p...

Page 12: ...allocations unexpected oper ation will occur which may result in serious accidents Check that the system will not be adversely affected if the size of the variable specified in the operand is less tha...

Page 13: ...KUP indicator is lit The data will not be backed up if power is turned OFF To display the status of writing to flash memory on the CX Programmer select Display dialog to show PLC Mem ory Backup Status...

Page 14: ...l I O Units and CPU Bus Units cannot be registered to global symbols and these vari ables cannot be specified as external variables e g the data set for global variables may not be stable Use internal...

Page 15: ...xvi Application Precautions 4...

Page 16: ...r 5 0 4 1 1 4 CX Programmer Ver 5 0 Function Block Menus 5 1 2 Function Blocks 7 1 2 1 Outline 7 1 2 2 Advantages of Function Blocks 7 1 2 3 Function Block Structure 8 1 3 Variables 13 1 3 1 Introduct...

Page 17: ...can be created easily because variables do not have to be declared in text They are registered in variable tables A variable can be registered automatically when it is entered in a ladder or ST progra...

Page 18: ...illegal commands and it will not be possible to edit or execute the user program CS CJ Series Function Restrictions Instructions Not Supported in Function Block Definitions Block Program Instructions...

Page 19: ...45H 64H 65H 66H 67H 1 024 max per CPU Unit Suffix CPU42H 43H 63H 128 max per CPU Unit CJ1M CPU Units CJ1M CPU11 12 13 21 22 23 128 max per CPU Unit Function block names 64 characters max Variables Va...

Page 20: ...ock Load Function Block from File Reads the saved function block library files cxf Save Function Block to File Saves the created function block definitions to a file function block library file cxf Ed...

Page 21: ...menu Function Open Displays the contents of the selected function block definition on the right side of the window Save Function Block File Saves the selected function block definition in a file Compi...

Page 22: ...a program and setting the parameters for the function block s I O The ability to reuse existing function blocks will save significant time when creating debugging programs reduce coding errors and ma...

Page 23: ...g the def initions from the file and placing them in a new program Compatible with Multiple Languages Mathematical expressions can be entered in structured text ST language 1 2 3 Function Block Struct...

Page 24: ...ables Instances with different names will have different internal variables For example consider multiple function blocks that use a timer as an internal variable In this case all instances will have...

Page 25: ...ed parameters Here it is not the input source address itself but the contents at the input address in the form and size specified by the variable data type that is passed to the function block In a si...

Page 26: ...is necessary to read or write a value within the execution cy cle of the algorithm do not pass the value to or from a parameter Assign the value to an internal variable and use an AT setting specifie...

Page 27: ...ction Block Definition Example CONTROL Algorithm Variables Instance CASCADE_02 Algorithm Internal and I O variables Instance CASCADE_01 Algorithm Internal and I O variables Instance CASCADE_03 Algorit...

Page 28: ...and Data Registers DR0 to DR15 directly into the instruction operand 1 3 2 Variable Usage and Properties Variable Usage The following variable types usages are supported Internals Internal variables a...

Page 29: ...NT WORD DWORD LWORD REAL LREAL TIMER COUNTER For details on variable data types refer to Variable Definitions in 2 1 2 Func tion Block Elements AT Settings Allocation to an Actual Addresses It is poss...

Page 30: ...Setting Internal Allocation Areas for Variables The user sets the function block instance areas in which addresses are allo cated internally by the system The variables are allocated automatically by...

Page 31: ...rn the power ON OFF or clear the area without retaining the values when starting opera tion 1 4 Converting Function Block Definitions to Library Files A function block definition created using the CX...

Page 32: ...ing the program insert copies of the completed function block definition This step creates instances of the function block 3 Enter an instance name for each instance 4 Set the variables input source a...

Page 33: ...he program when creating the new program Note In the CX Programmer Ver 5 0 each function block definition can be com piled and checked as a program We recommend compiling to perform a pro gram check o...

Page 34: ...ses Allocated to Special I O Units 45 2 4 6 Using Index Registers 46 2 5 Precautions for Instructions with Operands Specifying the First or Last of Multiple Words 49 2 6 Instruction Support and Operan...

Page 35: ...ng Instructions 99 2 6 31 Text String Processing Instructions 101 2 6 32 Task Control Instructions 103 2 6 33 Model Conversion Instructions 103 2 6 34 Special Instructions for Function Blocks 104 2 7...

Page 36: ...2 048 max per CPU Unit Suffix CPU42H 43H 63H 256 max per CPU Unit CJ1M CPU Units CJ1M CPU11 12 13 21 22 23 256 max per CPU Unit Number of instance nesting levels Nesting is not supported Number of I...

Page 37: ...TIMX tim_a OFF_TIME tim_b TIMX tim_b OFF_TIME tim_a ENO tim_a TIMER tim_b TIMER ON_TIME INT OFF_TIME INT Input variables Output variables Internal variables Variable table Name Internal Internal Inpu...

Page 38: ...the algorithm If it is necessary to read a value within the execution cycle of the algorithm do not pass the value from a parameter Assign the value to an internal variable and use an AT setting speci...

Page 39: ...next time the instance is executed i e when EN turns OFF the value of the output variable is retained Example In the following example the value of output variable CV will be retained until the next t...

Page 40: ...variable can be used as a flag to check whether or not instance execution has been completed normally Internal Variables Internal variables are used within an instance These variables are internal to...

Page 41: ...Initial Value An initial value can be set for an internal variable that is not being retained i e when the Retain Option not selected An initial value cannot be set for an internal variable if the Re...

Page 42: ...etc When this variable is used in another instruction the Counter Com pletion Flag 1 bit or the counter present value 16 bits is specified de pending on the instruction operand The COUNTER data type...

Page 43: ...ify A34313 as the address The status of the File Memory Operation Flag can be checked through this internal variable When the AT setting is used the function block loses its flexibility This func tion...

Page 44: ...able reusing the function block if an inter nal variable with a AT property cannot be set for the operand and an external variable cannot be set Prepare an internal array variable with the number of e...

Page 45: ...ly input into instruction operands within function blocks Addresses that are directly input will be treated as variable names Note Exception Input directly or indirectly specified addresses for Index...

Page 46: ...t an error if there are any instructions in the user program that access words in these areas Function Block Instance Area Types The following settings are made in the function block instance area Non...

Page 47: ...ese words are displayed in red if they are input when a function block is not being created Although the words can be input when creating a function block an error will occur when the program is check...

Page 48: ...all variables will be allocated different addresses As a result unused areas will be created If this occurs execute the optimization opera tion to effectively use the allocated areas and remove the un...

Page 49: ...nition Variable definitions Body Item Applicable data Input parameters Values See note 1 addresses and program symbols glo bal symbols and local symbols See note 2 Note The data that is passed to the...

Page 50: ...22507385850720 10 308 1 79769313486232 10308 WORD 16 bit data 16 bits followed by hexadecimal number 4 digits max or followed by decimal number 0000 to FFFF or 0 to 65 535 DWORD 32 bit data 32 bits f...

Page 51: ...thm the output parameter will retain its previous value P_On 1 0 10 CLOCK PULSE EN ENO ON_TIME OFF_TIME 20 Pulse_2sON_1sOFF 20 10 TIMX tim_a OFF_TIME tim_b TIMX tim_b ON_TIME tim_a ENO 1 The FB is cal...

Page 52: ...ogramming Restrictions There are some restrictions on instructions used in ladder programs Instructions Prohibited in Function Block Definitions The following instructions cannot be used in function b...

Page 53: ...rted and Data Registers Indirect addressing of DM or EM Area addresses Neither binary mode nor BCD mode indirect addressing is supported Interlock Restrictions When a function block is called from an...

Page 54: ...ecuted while its EN input variable is OFF so the fol lowing precautions are essential when using a Timer Instruction in a function block definition The Timer Instruction will not be initialized even t...

Page 55: ...perators Numerical Functions Arithmetic Functions Comments The TIMER and COUNTER data types cannot be used For further details refer to Appendix B Structured Text ST Language Specifi cations Program S...

Page 56: ...uctions outside of an instance can be changed Error related Restrictions If a fatal error occurs in the CPU Unit while a function block definition is being executed ladder program execution will stop...

Page 57: ...Types Inputs Outputs Externals and Internals Using Input Variable to Change Passed Values To paste a function block into the program and then change the value not the address itself to be passed to t...

Page 58: ...ari ables requiring addresses with AT settings e g I O allocation addresses addresses specially allocated for Special I O Units or variables requiring array settings For details on conditions requirin...

Page 59: ...of elements that matches the data size to be processed by the instruction Note Some examples are the first source word or first destination word of the XFER 070 BLOCK TRANSFER instruction the first so...

Page 60: ...so the remainder can t be calculated directly in ST language The remainder must be calculated as follows Remainder Dividend Divisor Quotient 2 4 5 Specifying Addresses Allocated to Special I O Units U...

Page 61: ...fy addresses using IR0 to IR15 and not the variable names Index Register direct specification IR0 to IR15 Index Register indirect speci fication IR0 to IR15 Note After storing the real I O memory addr...

Page 62: ...incorporate processing in the program to return the Index Register to the saved value 2 Always set the value before using Index Registers Operation will not be stable if Index Registers are used witho...

Page 63: ...Area word n Example The real I O memory address for the first word of CIO 1500 unit number 25 allocated in the CPU Bus Unit allocation area based on the CPU Bus Unit s unit number 0 to 15 passed from...

Page 64: ...ction The follow ing precautions apply 1 2 3 1 If a non array variable is specified without AT setting and without a match ing data size the CX Programmer will output an error when compiling 2 The fol...

Page 65: ...a serious accident Do not use variables with a size that does not match the data size to be pro cessed by the instruction in the operand specifying the first address or last address for a range of wor...

Page 66: ...perand Specifying Size Constant The CX Programmer will output an error when compiling Example BLOCK TRANSFER XFER W S D W Number of words S First source word D First destination word When 20 is specif...

Page 67: ...are given as Not supported in function blocks in the Symbol column Restrictions on Operands Operands that specify the first or last of multiple words thereby requiring AT setting or specification of a...

Page 68: ...truction operand input parameters cannot be used to pass data to or from variables Either an AT setting or an array variable with the required number of elements must be prepared and after the array d...

Page 69: ...D NOT NOT 520 CONDITION ON UP 521 CONDITION OFF DOWN 522 BIT TEST LD TST 350 S Source word WORD N Bit number UINT BIT TEST LD TSTN 351 S Source word WORD N Bit number UINT Instruction Mnemonic Functio...

Page 70: ...monic Function code Symbol Operands Supported variable data types AT setting or array variable required Required word data size shown in parentheses OUTPUT OUT OUT BOOL OUTPUT NOT OUT NOT OUT NOT BOOL...

Page 71: ...T Yes not fixed N1 Beginning bit UINT N2 Number of bits UINT SINGLE BIT SET SETB SETB SETB 532 D Word address UINT N Bit number UINT SINGLE BIT RESET RSTB RSTB RSTB 533 D Word address UINT N Bit numbe...

Page 72: ...TI INTER LOCK DIFFER ENTIATION RELEASE MILR 518 N Interlock number decimal only D Interlock Status Bit BOOL MULTI INTER LOCK CLEAR MILC 519 N Interlock number decimal only JUMP JMP 004 Not supported i...

Page 73: ...ue WORD TIMHX BIN 551 N Timer number TIMER S Set value UINT ONE MS TIMER TMHH BCD 540 Not supported in function blocks N Timer number TIMER S Set value WORD TMHHX BIN 552 Not supported in function blo...

Page 74: ...TRX BIN 548 N Counter number COUNTER S Set value UINT RESET TIMER COUNTER CNR CNR BCD 545 N1 1st number in range TIMER or COUNTER See note N2 Last number in range TIMER or COUNTER See note CNRX CNRX B...

Page 75: ...ta 2 UINT Symbol Compari son Double word unsigned LD AND OR L 301 306 311 316 321 326 S1 Comparison data 1 UDINT S2 Comparison data 2 UDINT Symbol Compari son Signed LD AND OR S 302 307 312 317 322 32...

Page 76: ...f set 1 WORD Yes 16 S2 1st word of set 2 WORD Yes 16 R Result word UINT UNSIGNED BLOCK COMPARE BCMP BCMP 068 S Source data WORD T 1st word of table WORD Yes 32 R Result word UINT EXPANDED BLOCK COMPAR...

Page 77: ...1st word of comparison time WORD Yes 3 Instruction Mnemonic Function code Symbol Operands Supported variable data types AT setting or array variable required Required word data size shown in parenthes...

Page 78: ...word WORD Yes not fixed BLOCK TRANSFER XFER XFER 070 N Number of words UINT S 1st source word WORD Yes not fixed D 1st destina tion word WORD Yes not fixed BLOCK SET BSET BSET 071 S Source word WORD...

Page 79: ...ic Function code Symbol Operands Supported variable data types AT setting or array variable required Required word data size shown in parentheses SHIFT REGIS TER SFT 010 St Starting word UINT Yes not...

Page 80: ...IFT LEFT ASL ASL 025 Wd Word UINT DOUBLE SHIFT LEFT ASLL ASLL 570 Wd Word UDINT ARITHMETIC SHIFT RIGHT ASR ASR 026 Wd Word UINT DOUBLE SHIFT RIGHT ASRL ASRL 571 Wd Word UDINT ROTATE LEFT ROL ROL 027 W...

Page 81: ...UINT N Shift data length UINT SHIFT N BIT DATA RIGHT NSFR NSFR 579 D Beginning word for shift UINT Yes not fixed C Beginning bit UINT N Shift data length UINT SHIFT N BITS LEFT NASL NASL 580 D Shift w...

Page 82: ...rd UDINT DECREMENT BINARY 592 Wd Word UINT DOUBLE DECRE MENT BINARY L L 593 Wd 1st word UDINT INCREMENT BCD B B 594 Wd Word WORD DOUBLE INCRE MENT BCD BL BL 595 Wd 1st word DWORD DECREMENT BCD B B 596...

Page 83: ...d WORD DOUBLE BCD ADD WITHOUT CARRY BL BL 405 Au 1st augend word DWORD Ad 1st addend word DWORD R 1st result word DWORD BCD ADD WITH CARRY BC BC 406 Au Augend word WORD Ad Addend word WORD R Result wo...

Page 84: ...DOUBLE BCD SUBTRACT WITH OUT CARRY BL BL 415 Mi 1st minuend word DWORD Su 1st subtrahend word DWORD R 1st result word DWORD BCD SUBTRACT WITH CARRY BC BC 416 Mi Minuend word WORD Su Subtrahend word WO...

Page 85: ...esult word ULINT BCD MULTIPLY B B 424 Md Multiplicand word WORD Mr Multiplier word WORD R Result word DWORD DOUBLE BCD MULTIPLY BL BL 425 Md 1st multiplicand word DWORD Mr 1st multiplier word DWORD R...

Page 86: ...rray vari ables are required DOUBLE UNSIGNED BINARY DIVIDE UL UL 433 Dd 1st dividend word UDINT Dr 1st divisor word UDINT R 1st result word LWORD Yes 2 UDINT must be used when array vari ables are req...

Page 87: ...n parenthe ses BCD TO BINARY BIN BIN 023 S Source word WORD R Result word UINT DOUBLE BCD TO DOUBLE BINARY BINL BINL 058 S 1st source word DWORD R 1st result word UDINT BINARY TO BCD BCD BCD 024 S Sou...

Page 88: ...ASC 086 S Source word UINT Di Digit designator UINT D 1st destination word UINT Yes 3 ASCII TO HEX HEX HEX 162 S 1st source word UINT Yes 2 Di Digit designator UINT D Destination word UINT Yes not fi...

Page 89: ...C Control word UINT S 1st source word DINT D 1st destination word DWORD Instruction Mnemonic Function code Symbol Operand Supported variable data types AT setting or array variable required Required...

Page 90: ...RD I2 Input 2 DWORD R Result word DWORD EXCLUSIVE NOR XNRW XNRW 037 I1 Input 1 WORD I2 Input 2 WORD R Result word WORD DOUBLE EXCLU SIVE NOR XNRL XNRL 613 I1 Input 1 DWORD I2 Input 2 DWORD R Result wo...

Page 91: ...word WORD ARITHMETIC PRO CESS APR APR 069 C Control word UINT Yes not fixed S Source data WORD R Result word WORD FLOATING POINT DIVIDE FDIV FDIV 079 Dd 1st dividend word UDINT Dr 1st divisor word UD...

Page 92: ...nd word REAL R 1st result word REAL FLOATING POINT MULTIPLY F F 456 Md 1st Multiplicand word REAL Mr 1st Multiplier word REAL R 1st result word REAL FLOATING POINT DIVIDE F F 457 Dd 1st Dividend word...

Page 93: ...ATAN 465 S 1st source word REAL R 1st result word REAL SQUARE ROOT SQRT SQRT 466 S 1st source word REAL R 1st result word REAL EXPONENT EXP EXP 467 S 1st source word REAL R 1st result word REAL LOGARI...

Page 94: ...e word REAL C Control word UINT Yes 3 D Destination word UINT Yes not fixed ASCII TO FLOATING POINT FVAL FVAL 449 S Source word UINT Yes not fixed D 1st destination word REAL Instruction Mnemonic Func...

Page 95: ...NG DBL DBL 843 S Source word INT D 1st destination word LREAL 32 BIT BINARY TO DOUBLE FLOATING DBLL DBLL 844 S 1st source word DINT D 1st destination word DINT DOUBLE FLOATING POINT ADD D D 845 Au 1st...

Page 96: ...OUBLE ARC SINE ASIND ASIND 854 S 1st source word LREAL R 1st result word LREAL DOUBLE ARC COSINE ACOSD ACOSD 855 S 1st source word LREAL R 1st result word LREAL DOUBLE ARC TAN GENT ATAND ATAND 856 S 1...

Page 97: ...mparoson data 1 LREAL S2 Comparison data 2 LREAL Instruction Mnemonic Function code Symbol Operands Supported variable data types AT setting or array variable required Required worddata size shown in...

Page 98: ...SETR 635 Not supported in func tion blocks N Table number R Record number D Destination Index Register GET RECORD NUMBER GETR GETR 636 Not supported in func tion blocks N Table number IR Index Regist...

Page 99: ...READ SREAD SREAD 639 TB First stack address UINT Yes not fixed C Offset value UINT D Destination word UINT STACK DATA OVERWRITE SWRIT SWRIT 640 TB First stack address UINT Yes not fixed C Offset value...

Page 100: ...1st parameter word WORD Yes 40 D Output word UINT LIMIT CONTROL LMT LMT 680 S Input word INT C 1st limit word DINT Yes 2 D Output word INT DEAD BAND CON TROL BAND BAND 681 S Input word INT C 1st limit...

Page 101: ...Required worddata size shown in parenthe ses SUBROUTINE CALL SBS SBS 091 Not supported in func tion blocks N Subroutine num ber SUBROUTINE ENTRY SBN 092 Not supported in func tion blocks N Subroutine...

Page 102: ...Required word data size shown in parenthe ses SET INTERRUPT MASK MSKS MSKS 690 N Interrupt identi fier decimal only S Interrupt data UINT READ INTERRUPT MASK MSKR MSKR 692 N Interrupt identi fier dec...

Page 103: ...WORD Yes 1 or 2 COUNTER FRE QUENCY CON VERT CJ1M CPU Unit Ver 2 0 or later only PRV2 883 C1 Control data WORD C2 Pulses revolu tion UINT D 1st destination word UDINT COMPARISON TABLE LOAD CTBL CTBL 88...

Page 104: ...ble data types AT setting or array variable required Required word data size shown in parenthe ses STEP DEFINE STEP 008 Not supported in func tion blocks B Bit STEP START SNXT 009 Not supported in fun...

Page 105: ...word UINT HEXADECIMAL KEY INPUT HKY 212 I Data input word UINT O Output word UINT D 1st register word WORD Yes 3 C System word WORD MATRIX INPUT MTR 213 I Data input word UINT O Output word UINT D 1st...

Page 106: ...nd number of words UINT Yes 2 UINTmust be used when array vari ables are required CPU BUS UNIT I O REFRESH DLNK DLNK 226 N Unit number UINT Instruction Mnemonic Function code Symbol Operands Supported...

Page 107: ...XDU TXDU 256 S 1st source word UINT Yes not fixed C 1st control word UDINT N Number of send bytes 4 digits BCD UINT RECEIVE VIA SERIAL COMMUNI CATIONS UNIT RXDU RXDU 255 D 1st destination word UINT Ye...

Page 108: ...ith AT setting D 1st destination word UINT Yes not fixed C 1st control word WORD Yes 5 DELIVER COMMAND CMND CMND 490 S 1st command word UINT Yes not fixed D 1st response word UINT Yes not fixed C 1st...

Page 109: ...1st destination word in local CPU Unit UINT Yes 2 C 1st control word WORD Yes 5 EXPLICIT WORD WRITE ECHWR 724 S 1st source word in local CPU Unit UINT Yes not fixed D 1st destination word in remote C...

Page 110: ...en array vari ables are required S2 Filename UINT Yes 39 D 1st destination word UINT Yes not fixed WRITE DATA FILE FWRIT FWRIT 701 C Control word UINT D1 1st destination word LWORD Yes 2 DWORD must be...

Page 111: ...st time word DWORD Yes 2 WORD must be used when array vari ables are required R 1st result word WORD Yes 3 CALENDAR SUB TRACT CSUB CSUB 731 C 1st calendar word WORD Yes 3 T 1st time word DWORD Yes 2 W...

Page 112: ...OCK ADJUST MENT DATE DATE 735 S 1st source word LWORD Yes 4 WORD must be used when array vari ables are required Instruction Mnemonic Function code Symbol Operands Supported variable data types AT set...

Page 113: ...mber decimal only M 1st message word or error code to generate 0000 to FFFF WORD FAILURE POINT DETECTION FPD 269 Not supported in func tion blocks C Control word T Monitoring time R 1st register word...

Page 114: ...ND 801 Not supported in func tion blocks BLOCK PROGRAM PAUSE BPPS 811 Not supported in func tion blocks N Block program number BLOCK PROGRAM RESTART BPRS 812 Not supported in func tion blocks N Block...

Page 115: ...mer number SV Set value COUNTER WAIT CNTW BCD 814 Not supported in func tion blocks N Counter number SV Set value I Count input CNTWX BIN 817 Not supported in func tion blocks N Counter number SV Set...

Page 116: ...ord UINT Yes not fixed S2 Number of characters UINT D First destination word UINT Yes not fixed GET STRING RIGHT RGHT RGHT 653 S1 Text string first word UINT Yes not fixed S2 Number of characters UINT...

Page 117: ...word 1 UINT Yes not fixed Ex2 1st exchange word 2 UINT Yes not fixed CLEAR STRING CLR CLR 666 S Text string first word UINT Yes not fixed INSERT INTO STRING INS INS 657 S1 Base text string first word...

Page 118: ...ariable data types AT setting or array variable required Required word data size shown in parenthe ses BLOCK TRANSFER XFERC XFERC 565 W Number of words in BCD WORD S 1st source word WORD Yes not fixed...

Page 119: ...ction Mnemonic Function code Symbol Operands Supported variable data types AT setting or array variable required Required word data size shown in parenthe ses GET VARIABLE ID GETID GETIC 286 S Source...

Page 120: ...024 512 512 512 Com ment files Kbytes 128 128 64 64 64 64 64 64 64 Program index files Kbytes 128 128 64 64 64 64 64 64 64 Variable tables Kbytes 128 128 128 64 64 128 64 64 64 Item Specification Ite...

Page 121: ...20K 10K 5K Number of Expan sion Racks 1 max Expansion not supported 1 max Expansion not supported Data memory 32K words Extended Data Memory None Pulse start times 46 s without acceleration decelerat...

Page 122: ...en below This behavior is the same for CPU Units that do not support function blocks Refer to the descriptions of individual instruc tion in the CS CJ Series Instruction Reference for details Function...

Page 123: ...ock definition is copied to multiple locations i e for multiple instances Therefore in the above equation the number of instances is not multiplied by the number of instruction steps in the function b...

Page 124: ...h unit version 3 0 or later m Call part 57 steps n I O parameter transfer part The data type is shown in parenthe ses 1 bit I O variable BOOL 6 steps 1 word I O variable INT UINT WORD 6 steps 2 word I...

Page 125: ...Block Program Steps and Instance Execution Time Section 2 8 Note The execution time is increased according to the number of multiple instances when the same function block definition has been copied...

Page 126: ...sing the P Key 125 3 2 6 Setting the FB Instance Areas 128 3 2 7 Checking Internal Address Allocations for Variables 129 3 2 8 Copying and Editing Function Block Definitions 131 3 2 9 Checking the Sou...

Page 127: ...o 3 2 3 Defining Function Blocks Created by User for details Registering Variables before Inputting the Ladder Program or ST Program 1 2 3 1 Register variables in the variable table 2 Create the ladde...

Page 128: ...lock Memory Allocation from the PLC Menu 2 Set the function block memory allocations Printing Saving and Reusing Function Block Files Compile the Function Block Definition and Save It as a Library Fil...

Page 129: ...defini tions after the Function Blocks icon Creating Function Block Definitions Function blocks can be defined by the user using either ladder programming or structured text Creating Inserting Functio...

Page 130: ...cxf 1 Select Function Blocks in the project workspace right click and select Insert Function Blocks Library File from the popup menu Or select Function Block Library File from the Insert Menu 2 The f...

Page 131: ...the variable table is empty because there are no variables allo cated for I O memory addresses in the PLC Ladder Program or Structure Text as an Algorithm With some exceptions the ladder program for t...

Page 132: ...t be switched while registering or displaying the variables 1 2 3 1 Make the sheet for the type of variable to be registered active in the vari able table See note Place the cursor in the sheet right...

Page 133: ...able to move to the registered sheet double click and switch the setting in the Usage field N Internals I Inputs O Out puts E Externals The variable can also be copied or moved between the sheets for...

Page 134: ...Registers IR and Data Registers DR can be input directly as follows not as variables Addresses DR0 to DR5 direct specifica tions IR0 to IR15 and indirect specifications IR0 to IR15 Using Structured Te...

Page 135: ...xt program can be input first and variable registered as they are required Using a Ladder Program When using a ladder diagram a dialog box will be displayed to register the variable whenever a variabl...

Page 136: ...istered using the CX Programmer A variable name is required to achieve this Use the following procedure to specify an address 1 2 3 1 After inputting the variable name in the New Variable Dialog Box c...

Page 137: ...structured text a dialog box will not be displayed to register the variable whenever a variable name that has not been registered is input Be sure to always register variables used in standard text p...

Page 138: ...nder Options in Tools Menu Addresses and I O comments are not registered in the function block defini tion variable tables Addresses are displayed in the operand in red I O com ments will be lost Doub...

Page 139: ...Window place the cursor in the program where the instance is to be inserted and press the F Key Alternately select Func tion Block Invocation from the Insert Menu The New Function Block In vocation D...

Page 140: ...bus bar to the left of all instances that have been created from that function block definition will be displayed in red to indicate an error When this happens select the function block right click an...

Page 141: ...definition Press the P Key with the cursor on the left of the instance The New Parameter Dialog Box will be displayed Input the address from which to pass data to the input variable The value of 001 i...

Page 142: ...1038 LREAL Long real number 64 bits 1 79769313486232 10308 to 2 22507385850720 10 308 0 2 22507385850720 10 308 to 1 79769313486232 10308 WORD 16 bit data 16 bits followed by hexadecimal number 4 digi...

Page 143: ...fied in the internal variable s AT settings 3 Words H512 to H1535 are contained in the Holding Area but the ad dresses set as non retained will be cleared when the power is turned OFF and ON again or...

Page 144: ...l symbol table right click and select Func tion Block Memory Address from the popup menu Alternately select Function Block Memory Function Block Memory Address from the PLC Menu 3 The FB Interface Mem...

Page 145: ...riginal block of addresses cannot accommodate the change in variables This will result in an unused block of addresses The following procedure can be used to eliminate the unused areas in memory so th...

Page 146: ...Function Block Definition CX Programmer can be used to check the size of the function block definition being created using a similar method to checking the program capacity The procedure is as follow...

Page 147: ...tion is selected specify the start rung and end rung numbers When a page number has been specified in the header and footer fields in File Page Setup the first page number can be specified 3 Select ei...

Page 148: ...2 3 1 Select the function block definition right click and select Save Function Block to File from the popup menu Alternately select Function Block Save Function Block to File from the File Menu 2 Th...

Page 149: ...tains function blocks however downloading in task units is not possible uploading is possible 3 2 15 Monitoring and Debugging Function Blocks The following procedures can be used to monitor programs...

Page 150: ...riables are displayed below the parameters Editing Function Block Definition Programs Online Programs using function blocks can be edited online Changes can also be made around instances Instance para...

Page 151: ...136 Procedures Section 3 2...

Page 152: ...REAL Real number 32 3 402823 1038 to 1 175494 10 38 0 1 175494 10 38 to 3 402823 1038 LREAL Long real number 64 1 79769313486232 10308 to 2 22507385850720 10 308 0 2 22507385850720 10 308 to 1 7976931...

Page 153: ...138 Data Types Appendix A...

Page 154: ...statement can not be completed by simply using a carriage return Do not use a semicolon as a delimiter within a statement such as following reserved words values or equations Inserting a semicolon wi...

Page 155: ...tokens the parts of the token on either side will be treated as separate tokens Therefore make sure that spaces carriage returns or tabs are not used within a single token Always use a space carriage...

Page 156: ...nt Ends the statement Comment All text between and is treated as a comment comment Assignment Substitutes the results of the expres sion variable or value on the right for the variable on the left A B...

Page 157: ...ier Depends on the function refer to 2 6 Instruction Support and Operand Restrictions 2 Exponential REAL LREAL 3 Complement NOT BOOL WORD DWORD LWORD 4 Multiplication INT DINT UINT UDINT ULINT REAL LR...

Page 158: ...LN b natural logarithm of vari able b stored in variable a LOG argument REAL LREAL REAL LREAL Common logarithm LOG10 argument a LOG b common logarithm of vari able b stored in variable a EXP argument...

Page 159: ...e or within control statements This statement can be used for setting initial values storing calculation results and incre menting or decrementing variables Description Substitutes stores an equation...

Page 160: ...nt Syntax IF condition THEN expression_1 ELSE expression_2 END_IF Process Flow Diagram Usage Use the IF statement to perform a different operation depending on whether a single condition condition equ...

Page 161: ...tion is executed if the result of the condition equation is false Processing Flow Diagram Examples Example 1 If variable A 0 is true variable X will be substituted with numerical value 10 If A 0 is fa...

Page 162: ...dition is not met but another condition is met a corresponding expression is executed If none of the conditions is met a different expression is executed Reserved Words IF THEN ELSIF ELSE Note ELSE ca...

Page 163: ...tween multiple statements in an expression The ELSE statement can be omitted When ELSE is omitted no operation is executed if the result of any condition equation is false Examples Example 1 If variab...

Page 164: ...tween multiple statements in an expression Variables in integer format INT DINT LINT UINT UDINT or ULINT or equations that return integer val ues can be specified in the integer_equation When OR logic...

Page 165: ...Statement Summary This statement is used to execute a specified expression repeatedly until a variable referred to here as an iter ation variable reaches a specified value Reserved Words FOR TO BY DO...

Page 166: ...e an iteration variable that is outside the FOR statement where possible The value of the iteration variable after completing execution of the FOR statement depends on the actual model specifica tions...

Page 167: ...is used to execute a specified expression repeatedly for as long as a specified condition is true Reserved Words WHILE DO END_WHILE Statement Syntax WHILE condition DO expression END_WHILE Processing...

Page 168: ...only rather than an equation Examples Example 1 The value exceeding 1000 in increments of 7 is calculated and substituted for variable A A 0 WHILE A 1000 DO A A 7 END_WHILE Example 2 While X 3000 the...

Page 169: ...HILE or REPEAT Multiple statements can be executed in the expression Be sure to use a semicolon delimiter between multiple statements in an expression The condition can also be specified as a boolean...

Page 170: ...ext must be forced to end before it has been completed Reserved Words RETURN Statement Syntax RETURN Usage Use the RETURN statement when a function block has been forced to end Examples of Structured...

Page 171: ...e allocated to variables with data types WORD DWORD INT DINT UINT UDINT or ULINT For example if A is an INT data type A 1 it possible If the value is not an integer data type a syntax error will occur...

Page 172: ...e numeric expression con tains division by 0 End of comment not found The comment does not have a closing parenthesis and aster isk corresponding to the opening parenthesis and asterisk of the comment...

Page 173: ...er destina tion Y SIN X1 ENO 1 Missing The call for a data format con version instruction or function does not contain a open ing parenthesis Y INT_TO_DINT X Missing The operator parentheses or the ca...

Page 174: ...an UINT type variable Y is an INT type vari able There must be one line of valid code excluding com ments There is no line of valid code excluding comments Too many variables specified for Function To...

Page 175: ...or the array variable INT 10 with 10 elements an error will not be detected for the following type of state ment Operation will be unstable when this statement is executed i 15 INT i 10 Q Are the vari...

Page 176: ...CF113 Clock Pulses 0 02 second clock pulse bit P_0_02s BOOL CF103 0 1 second clock pulse bit P_0_1s BOOL CF100 0 2 second clock pulse bit P_0_2s BOOL CF101 1 minute clock pulse bit P_1mim BOOL CF104...

Page 177: ...162 External Variables Appendix C...

Page 178: ...tions 8 checking for an instance 131 compiling 131 creating 114 saving to files 133 function blocks advantages 7 application guidelines 42 creating 17 111 debugging 134 defining 117 elements 21 errors...

Page 179: ...specifications 19 CX Programmer Ver 5 0 3 function block operation 35 instances 30 structured text function block definition 116 restrictions 40 symbol name automatically generating 123 T timer instr...

Page 180: ...catalog number on the front cover of the manual The following table outlines the changes made to the manual during each revision Page numbers refer to the previous version Revision code Date Revised c...

Page 181: ...166 Revision History...

Page 182: ...adquarters OMRON EUROPE B V Wegalaan 67 69 NL 2132 JD Hoofddorp The Netherlands Tel 31 2356 81 300 Fax 31 2356 81 388 OMRON ELECTRONICS LLC 1 East Commerce Drive Schaumburg IL 60173 U S A Tel 1 847 84...

Page 183: ...Authorized Distributor Cat No W438 E1 01 Note Specifications subject to change without notice Printed in Japan This manual is printed on 100 recycled paper...

Reviews: