background image

98

Procedures

Section 3-2

Method 1: Using the F Key in the Ladder Section Window and Inputting 

the Instance Name

1,2,3...

1.

In the Ladder Section 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 Dialog Box will be displayed. 

When using ST language, a function block can be called by selecting
“FUNCTION BLOCK” as the variable’s data type, using the desired in-
stance name, and entering the following function block call statement.
Specify arguments in parentheses after the instance name (to pass input
variable values from the calling function block to input variables in the
called function block) and also specify return values (to receive output vari-
able values from the called function block to output variables in the calling
function block). The instance name can be set to any internal variable with
the “FUNCTION BLOCK” data type. 

2.

Input the instance name, select the function block from which to create an
instance, and click the 

OK

 Button. 

3.

As an example, set the instance name in the 

FB Instance

 Field to 

sample

,

set the function block in the 

FB Definition

 Field to 

FunctionBlock1

, and

click the 

OK

 Button. As shown below, a copy of the function block definition

called 

FunctionBlock1

 will be created with an instance name of 

sample. 

The instance will be automatically registered in the global symbol table
with an instance name of 

sample

 and a data type of 

FUNCTION BLOCK.

 

Method 2: Registering the Instance Name in the Global Symbol Table in 

Advance and Then Selecting the Instance Name

If the instance name is registered in the global symbol table in advance, the
instance name can be selected from the global symbol table to create other
instances. 

Press 

F

 Key with cursor here. 

Input the instance name. 

Select the function block from 
which to create an instance. 

Following dialog 
box is displayed.

Instance name
Function block definition

An instance called 

sample

is created from the function
block definition called

FunctionBlock1.

Содержание SYSMAC CX-Programmer 9

Страница 1: ...Cat No W447 E1 09 CX Programmer Ver 9 WS02 CXPC1 V9 SYSMAC OPERATION MANUAL Function Blocks Structured Text ...

Страница 2: ......

Страница 3: ...CX Programmer Ver 9 WS02 CXPC1 V9 Operation Manual Function Blocks Structured Text Revised December 2009 ...

Страница 4: ...iv ...

Страница 5: ...on some OMRON products often means word and is abbreviated 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 following headings appear in the left column of the manual to help you locate different types of information Note Indicates information of particular in...

Страница 6: ...vi ...

Страница 7: ...ION 1 Introduction to Function Blocks SECTION 2 Function Block Specifications SECTION 3 Creating Function Blocks SECTION 4 Introduction to Structured Text SECTION 5 Structured Text ST Language Specifica tions SECTION 6 Creating ST Programs Appendices ...

Страница 8: ......

Страница 9: ... Information 25 SECTION 2 Function Block Specifications 29 2 1 Function Block Specifications 30 2 2 Data Types Supported in Function Blocks 41 2 3 Instance Specifications 42 2 4 Programming Restrictions 51 2 5 Function Block Applications Guidelines 56 2 6 Precautions for Instructions with Operands Specifying the First or Last of Multiple Words 65 2 7 Instruction Support and Operand Restrictions 68...

Страница 10: ...ge Specifications 136 5 2 Data Types Used in ST Programs 137 5 3 Inputting ST Programs 138 5 4 ST Language Configuration 141 5 5 Statement Descriptions 148 5 6 ST language Program Example 166 5 7 Restrictions 167 SECTION 6 Creating ST Programs 169 6 1 Procedures 170 Appendices A System defined external variables supported in function blocks 181 B Structured Text Errors 183 C Function Descriptions ...

Страница 11: ...the CS series CJ series CP series and NSJ series Controllers CX Programmer Ver 9 Manuals Name Cat No Contents SYSMAC WS02 CXPC1 V9 CX Programmer Operation Manual Function Blocks Structured Text W447 this manual Explains how to use the CX Programmer software s function block and structured text functions For explanations of other shared CX Programmer functions refer to the CX Program mer Operation ...

Страница 12: ...ammable Controllers Instructions Reference Manual W474 Describes the ladder diagram programming instructions sup ported by CS CJ series or NSJ series PLCs When programming use this manual together with the Oper ation Manual or Hardware User s Manual CS1 W339 CJ1 W393 or CJ2 W472 and Programming Manual or Software User s Manual CS1 CJ1 W394 or CJ2 W473 SYSMAC CS Series CS1G H CPU EV1 CS1G H CPU H P...

Страница 13: ...1 CJ2H CPU6 EIP CJ2H CPU6 CJ1G CPU CJ1G H CPU H CJ1G CPU P CJ1M CPU CJ1W SCU21 V1 41 V1 CP1H X CP1H XA CP1H Y NSJ B G5D NSJ B M3D SYSMAC CS CJ Series Communications Commands Reference Manual W342 Describes the communications commands that can be addressed to CS CJ series CPU Units The following information is included C series Host Link commands FINS commands Note This manual describes commands th...

Страница 14: ...anual in combination with the FQM1 Series Operation Manual O012 when programming Cat No Models Name Description W450 CP1H X CP1H XA CP1H Y SYSMAC CP Series CP1H CPU Unit Operation Manual Provides the following information on the CP series CP1H PLCs Overview Features System configuration Mounting and wiring I O memory allocation Troubleshooting Use this manual together with the CP1H CP1L Programmab...

Страница 15: ...ollowing sections Section 4 introduces the structure text programming functionality of the CX Programmer and explains the features that are not contained in the non structured text version of CX Programmer Section 5 provides specifications for reference when using structured text programming as well as programming examples and restrictions Section 6 explains how to create ST programs Appendices pr...

Страница 16: ...xvi ...

Страница 17: ...above warranty period OMRON will replace the defective media without charge If OMRON is unable to replace the defective media or correct the Software the liability of OMRON and the User s remedy shall be limited to a refund of the license fee paid to OMRON for the Software LIMITATIONS OF LIABILITY 1 THE ABOVE WARRANTY SHALL CONSTITUTE THE USER S SOLE AND EXCLUSIVE REMEDIES AGAINST OMRON AND THERE ...

Страница 18: ...xviii Application Considerations SUITABILITY FOR USE THE USER SHALL NOT USE THE SOFTWARE FOR A PURPOSE THAT IS NOT DESCRIBED IN THE ATTACHED USER MANUAL ...

Страница 19: ... other reasons EXTENT OF SERVICE The license fee of the Software does not include service costs such as dispatching technical staff ERRORS AND OMISSIONS The information in this manual has been carefully checked and is believed to be accurate however no responsibility is assumed for clerical typographical or proofreading errors or omissions ...

Страница 20: ...xx ...

Страница 21: ...on is important for the safe and reliable application of the CX Programmer and Programmable Controller You must read this section and understand the information contained before attempting to set up or operate the CX Programmer and Programmable Controller 1 Intended Audience xxii 2 General Precautions xxii 3 Safety Precautions xxii 4 Application Precautions xxiii ...

Страница 22: ...this manual 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 purpose and under the specified conditions especially in applications that can directly or indirectly affect human life You must consult with your OMRON representative before applying a PLC Syste...

Страница 23: ...t in serious accidents Check that the system will not be adversely affected if the size of the variable specified in the operand is less than the size in the operand definition before starting PLC operations Caution Confirm safety at the destination node before transferring a program to another node or changing contents of the I O memory area Doing either of these without confirming safety may res...

Страница 24: ...the backup operation is in progress Do not turn OFF the power supply to the CPU Unit when the BKUP 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 Memory Backup Status in the PLC properties and then select Windows PLC Memory Backup Status from the View Menu Programs includ...

Страница 25: ... variable The same applies to the timing for writing values to the parameters from output variables Always use internal variables with AT settings in the following cases The addresses allocated to Basic I O Units Special 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 ...

Страница 26: ...xxvi Application Precautions 4 ...

Страница 27: ...Part 1 Function Blocks ...

Страница 28: ......

Страница 29: ...nction Block Menus in CX Programmer Ver 5 0 and later Versions 8 1 2 Function Blocks 11 1 2 1 Outline 11 1 2 2 Advantages of Function Blocks 12 1 2 3 Function Block Structure 13 1 3 Variables 18 1 3 1 Introduction 18 1 3 2 Variable Usage and Properties 19 1 3 3 Variable Properties 19 1 3 4 Variable Properties and Variable Usage 20 1 3 5 Internal Allocation of Variable Addresses 21 1 4 Converting F...

Страница 30: ...egistered in variable tables A variable can be registered automatically when it is entered in a ladder or ST program Registered variables can also be entered in ladder programs after they have been registered in the variable table A single function block can be converted to a library function as a single file making it easy to reuse function blocks for standard processing A program check can be pe...

Страница 31: ...CJ1M CJ1M CPU11 12 13 21 22 23 The following CP series CPU Units are compatible CP1H CP1H X XA Y CP1L CP1L M L Note If a user program containing function blocks created on the CX Program mer Ver 5 0 or later is downloaded to a CPU Unit that does not support function blocks CS CJ series CPU Units with unit version 2 0 or earlier all instances will be treated as illegal commands and it will not be p...

Страница 32: ...4H 65H 66H 67H 64H R 65H R 66H R 67H R 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 CP1H CPU Units All models 128 max per CPU Unit CP1L CPU Units CP1L M L 128 max per CPU Unit NSJ Controllers NSJ G5D 1 024 max per Controller NSJ M3D 128 max per Controller FQM1 Flexible Motion Controllers FQM1 CM002 MMA22 MMP22 128 m...

Страница 33: ... input output variables 64 max Allocation of addresses used by variables Automatic allocation The allocation range can be set by the user Actual address specification Supported Array specifications Supported one dimensional arrays only and only for internal variables and input output variables Language Function blocks can be created in ladder programming language or structured text ST see note Cre...

Страница 34: ...ck library file cxf Project Text Files Containing Function Blocks cxt Data equivalent to that in project files created with CX Programmer Ver 6 0 cxp can be saved as CXT text files cxt 1 1 4 Function Block Menus in CX Programmer Ver 5 0 and later Versions The following tables list menus related to function blocks in CX Programmer Ver 5 0 and later versions For details on all menus refer to the CX ...

Страница 35: ...dis play shows details such as the relationship between instance nesting levels and allocated variable addresses in the instances Insert Function Block Invocation F Creates an instance in the program section at the present cursor location Function Block Parameter P When the cursor is located to the left of an input variable or the right of an output variable sets the variable s input or output par...

Страница 36: ...on Point Used with the Step Run or Continuous Step Run com mands to automatically scroll the display and always show the pause point Break Point List Displays a list of the break points that have been set Operation can be jumped to a specified point Pop up menu Function Insert Function Block Ladder Creates a function block definition with a ladder programming language algo rithm Structured Text Cr...

Страница 37: ...dds a variable to the last line Insert Variable Above Inserts the variable above the current cursor position Below Inserts the variable below the current cursor position Cut Cuts the variable Copy Copies the variable Paste Pastes the variable Find Searches for the variable Variable names variable comments or all text strings can be searched Replace Replaces the variable Delete Deletes the variable...

Страница 38: ...m a single function block by using the parameters in the standard process as input variables such as timer SVs control constants speed settings and travel distances Reduce Coding Errors Coding mistakes can be reduced because blocks that have already been debugged can be reused Black boxing Know how Read protection can be set for function blocks to prevent programming know how from being disclosed ...

Страница 39: ...tained in function blocks Each function block definition contains the algorithm and variable definitions as shown in the following diagram 1 Algorithm Standardized programming is written with variable names rather than real I O memory addresses In the CX Programmer algorithms can be written in either ladder programming or structured text 2 Variable Definitions The variable table lists each variabl...

Страница 40: ...d initialized the next time an instance is executed the same instance name can be used to save memory Number of Instances Multiple instances can be created from a single function block definition Up to either 256 or 2 048 instances can be created for a single CPU Unit depending on the CPU Unit model The allowed number of instances is not related to the number of function block definitions and the ...

Страница 41: ...rd address Note 1 Only addresses in the following areas can be used as parameters CIO Area Auxiliary Area DM Area EM Area banks 0 to C Holding Area and Work Area The following cannot be used Index and Data Registers both direct and indirect specifications and indirect addresses to the DM Area and EM Area both in binary and BCD mode 2 Local and global symbols in the user program can also be specifi...

Страница 42: ...al symbol as an external variable Using Input Output Variables In Out When using an input output variable set the address for the input parameter A constant cannot be set The address set for the input parameter will be passed to the function block If processing is performed inside the function block using the input output variable the results will be written to I O starting at the address set for ...

Страница 43: ...ication and the timer will not function properly if both instructions are exe cuted P_On 1 0 10 CONTROL EN ENO ON_TIME OFF_TIME 20 CASCADE_01 P_On 1 1 10 CONTROL EN ENO ON_TIME OFF_TIME 15 CASCADE_02 P_On 1 2 8 CONTROL EN ENO ON_TIME OFF_TIME 7 CASCADE_03 Function Block Definition Example CONTROL Algorithm Variables Instance CASCADE_02 Algorithm Internal and I O variables Instance CASCADE_01 Algor...

Страница 44: ...lock1 N A Auto Program Instance sample of function block definition A The instance is registered in the global symbol table with the instance name as the symbol name Name Data type Address value The function block definition name is registered after FB in square parentheses Instance name a b c MOV a c b Name Type AT Initial Value Retained a BOOL c BOOL Name Type AT Initial Value Retained b BOOL 0 ...

Страница 45: ...lobal symbols for use within instances For details on variable usage refer to the section on Variable Type Usage under Variable Definitions in 2 1 2 Function Block Elements The following table shows the number of variables that can be used and the kind of variable that is created by default for each of the variable usages 1 3 3 Variable Properties Variables have the following properties Variable N...

Страница 46: ...iable bit to either 1 TRUE or 0 FALSE Set a WORD variable to a value between 0 and 65 535 between 0000 and FFFF hex If an initial value is not set the variable will be set to 0 For example a bool ean variable would be 0 FALSE and a WORD variable would be 0000 hex Retain Select the Retain Option if you want a variable s data to be retained when the PLC is turned ON again and when the PLC starts ope...

Страница 47: ...y Function Block SFC Memory Allo cation from the PLC Menu Set the areas in the Function Block SFC Memory Allocation Dialog Box a b 15 0 15 0 t Name Type AT Initial Value Retained a BOOL Name Type AT b YES t TIMER 2000 00 Name Type Initial Value c 2000 00 Initial Value Retained Retained AT BOOL BOOL Input 0 00 Instance of function block definition A Output 2 00 Output 5 00 Note Variable c is an int...

Страница 48: ...o 9 CJ2H CPU67 EIP EM banks 7 to E CJ2H CPU68 EIP EM banks 11 to 18 FB Instance Area Default value Applicable memory areas Start address End address Size Non Retain H512 H1407 896 CIO WR HR DM EM Retain H1408 H1535 128 HR DM EM Timers T3072 T4095 1024 TIM Counters C3072 C4095 1024 CNT FB Instance Area Default value Applicable memory areas Start address End address Size Non Retain 5000 5999 1000 CI...

Страница 49: ...t it can be reused in other projects PLCs 1 5 1 Creating Function Blocks and Executing Instances The following procedure outlines the steps required to create and execute a function block 1 2 3 1 First create the function block definition including the algorithm and vari able definitions in ladder program or ST language Alternatively insert a function block library file that has been prepared in a...

Страница 50: ...ote 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 on each function block definition file before saving or reusing the file a b c 1 Algorithm 2 Variables Standard program section with variable names a b c etc Table defining usage and properties of variables a b c etc Input 0 00 Function block ...

Страница 51: ...an be combined freely so that the best language for each process can be used which reduces program development time and makes the program easier to understand Support for ST Language in the Program Task Allocation Comparison of Function Block Definitions and ST Programs Version 8 3 Version 9 0 Data structures are not supported CJ2 CPU Units now support data structures as symbol data type Version 7...

Страница 52: ... Version 7 0 The STRING data type text cannot be used in ST programming See note There are no text processing functions sup ported for ST programming Even in a ladder program the user has to con sider the ASCII code and code size of text for display messages and no protocol communica tions see note when executing string process ing instructions data conversion instructions and serial communication...

Страница 53: ...dder ST programs in function blocks Note The CX Simulator Ver 1 6 sold separately must be installed in order to use these functions Note I O break conditions cannot be set Previous version Ver 6 0 New version Ver 6 1 The operation of ST programs within function block instances could not be monitored while monitoring the program online It was possible to check the contents of a func tion block defi...

Страница 54: ...block instance s lad der diagram could not be monitored while moni toring the program online It was only possible to check the program in the function block definition The I O status of a function block instance s ladder diagram can be monitored while monitoring the program online To monitor the I O status either double click the function block instance or right click the instance and select Monit...

Страница 55: ...Programming Restrictions 53 2 4 3 Programming Restrictions 54 2 5 Function Block Applications Guidelines 56 2 5 1 Deciding on Variable Data Types 56 2 5 2 Determining Variable Types Inputs Outputs In Out Externals and Internals 57 2 5 3 AT Settings for Internal Variables 59 2 5 4 Array Settings for Input Output Variables and Internal Variables 59 2 5 5 Specifying Addresses Allocated to Special I O...

Страница 56: ...PU Units Suffix CPU44H 45H 64H 65H 66H 67H 64H R 65H R 66H R 67H R 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 CP1H CPU Units CP1H XA X Y 256 max per CPU Unit CP1L CPU Units CP1L M L 256 max per CPU Unit NSJ Controllers All models 2 048 max per Controller FQM1 Flexible Motion Controllers FQM1 CM002 MMA22 MMP22 256 ...

Страница 57: ...acters long Variables name cannot contain spaces or any of the following characters Variable names cannot start with a number 0 to 9 Variable names cannot contain two underscore characters in a row The following characters cannot be used to indicate addresses in I O memory A W H or HR D or DM E or EM T or TIM C or CNT followed by the numeric value word address Item Description Function block defin...

Страница 58: ...to and from instances using addresses Variables used only within instance Global symbols registered as vari ables beforehand with the CX Pro grammer or user defined global symbols Status of value at next execu tion The value of the input parameter will be given The value is passed on to the next execution The value of the external parameter The value is passed on to the next execution The value of...

Страница 59: ...put parameter value will be set when the parameter for input variable EN goes ON and the instance is executed Note The input parameter setting cannot be omitted when using the CX Programmer EN Enable Variable When an input variable is created the default input variable is the EN variable The instance will be executed when the parameter for input variable EN is ON Output Variables Output variables ...

Страница 60: ...hin the execution cycle of the algorithm do not write the value to a parameter Assign the value to an in ternal variable and use an AT setting specified addresses Initial Value An initial value can be set for an output variable that is not being retained i e when the Retain Option is not selected An initial value cannot be set for an output variable if the Retain Option is selected The initial val...

Страница 61: ...les Internal variables are used within an instance These variables are hidden within each instance They cannot be referenced from outside of the instance and are not displayed in the instance The values of internal variables are retained until the next time the instance is executed i e when EN turns OFF the value of the internal variable is retained Consequently even if instances of the same funct...

Страница 62: ... els To hold the values of variables in function blocks however use the Retain Option and not the IOM Hold Bit 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 Retain Option is selected Internal variables that are not being retained will be initialized...

Страница 63: ...e Timer Completion Flag 1 bit or the timer present value 16 bits is specified depending on the in struction operand The TIMER data type cannot be used in structured text function blocks 2 The COUNTER data type is used to enter variables for counter numbers 0 to 4095 in the operands for COUNTER instructions CNT CNTR etc When this variable is used in another instruction the Counter Com pletion Flag ...

Страница 64: ...s in advance PLC addresses for other nodes in the network Example If the READ DATA FILE instruction FREAD is being used in the function block definition and it is necessary to check the File Memory Operation Flag A34313 use an internal variable and specify the flag s address in the AT set ting Register an internal variable select the AT setting option and specify A34313 as the address The status o...

Страница 65: ... The index indicates the location of the element in the array A one dimensional array is an array with just one index number Example When an internal variable named SCL is set as an array variable with 10 elements the following 10 variables can be used SCL 0 SCL 1 SCL 2 SCL 3 SCL 4 SCL 5 SCL 6 SCL 7 SCL 8 and SCL 9 Note Use an array variable when specifying the first or last of multiple words in a...

Страница 66: ...he power is interrupted and PLC operation starts Algorithm Enter the logic programming using the registered variables Operand Input Restrictions Addresses cannot be directly 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 Registers IR0 to IR15 and Dat...

Страница 67: ...integer 32 0 to 4 294 967 295 ULINT Unsigned long 8 byte integer 64 0 to 18 446 744 073 709 551 615 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 79769313486232 10308 WORD 16 bit data 16 0000 to FFFF or 0 to 65 535 DWORD 32 bit data 32 00000000 to FFFFF...

Страница 68: ...nstance s internal variables input variables output variables and input output variables These areas are known as the function block instance areas and the user must specify the first addresses and sizes of these areas The first addresses and area sizes can be specified in 1 word units When the CX Programmer compiles the function it will output an error if there are any instructions in the user pr...

Страница 69: ... CPU67 EIP EM banks 7 to E CJ2H CPU68 EIP EM banks 11 to 18 FB Instance Area Default value Applicable memory areas Start address End address Size Non Retain H512 H1407 896 CIO WR HR DM EM Retain H1408 H1535 128 HR DM EM Timers T3072 T4095 1024 TIM Counters C3072 C4095 1024 CNT FB Instance Area Default value Applicable memory areas Start address End address Size Non Retain 5000 5999 1000 CIO WR DM ...

Страница 70: ... Variables for which the retain property for power OFF and operation start is set as non retained See note 1 Applicable areas H Function block Special Holding Area I O CIO Area H Holding Area W Internal Relay Area D Data Memory Area see note 2 E Extended Data Memory Area See notes 2 and 3 Setting unit Set in words Allocated words default H512 to H1407 Item Contents Allocated variables Variables fo...

Страница 71: ...nction Block Holding Area words for the non retained area and retained area If there are not sufficient words use words in areas not used by the user program FQM1 Flexible Motion controller Non retained Areas Note 1 Except when the data type is set to TIMER or COUNTER 2 Bit data can be accessed even if the DM Area is specified for the non re tained area Retained Area None Timer Area Counter Area F...

Страница 72: ...be created If this occurs execute the optimization opera tion to effectively use the allocated areas and remove the unused areas Comments A comment of up to 30 000 characters long can be entered Creating Multiple Instances Calling the Same Instance A single instance can be called from multiple locations In this case the inter nal variables will be shared Making Multiple Instances Multiple instance...

Страница 73: ...nce B I O variables Internal variables Body I O variables Internal variables Body FB definition 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 input variable from the parameter is the actual value of the size of the input variable data An address itself ...

Страница 74: ...cimal point Negative value followed by real number with decimal point 3 402823 1038 to 1 175494 10 38 0 1 175494 10 38 to 3 402823 1038 LREAL Long real number 64 bits 1 79769313486232 10308 to 2 22507385850720 10 308 0 2 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 3...

Страница 75: ... In this case the input to EN is bit 0 0 at the left of the diagram When the input to EN is ON the instance is executed and the execution results are reflected in bit 1 0 and word D10 When the input to EN is OFF the instance is not executed bit 1 0 is turned OFF and the content of D10 is not changed 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...

Страница 76: ...n guage ladder language or either combination of the two The function block nesting levels can also be displayed in a directory tree for mat with the FB Instance Viewer function The nested function blocks function block definitions are included in the func tion block library file cxf containing the calling function block s definitions FB EN ENO 1 0 P_Off P_On ENO 1 0 P_Off P_On Program FB definiti...

Страница 77: ...as in I O memory Restrictions for Input Variables Output Variables and Input Output Variables Unsupported Data Areas Addresses in the following data areas cannot be used as parameters for input variables output variables and input output variables Index Registers neither indirect nor direct addressing is supported and Data Registers Indirect addressing of DM or EM Area addresses Neither binary mod...

Страница 78: ... instructions cannot be used to reset multiple timers and counters within a function block at the same time Always specify the same variable for the first operand timer counter num ber 1 and second operand timer counter number 2 Different variables cannot be specified for the first and second operand Timer Instructions in Function Block Definitions An instance will not be executed while its EN inp...

Страница 79: ...atements Iteration statements FOR WHILE REPEAT and EXIT statements RETURN statements Function block calling statements Arithmetic operators Logical operators Comparison operators Numerical functions Arithmetic functions Standard text string functions Numeric text string functions OMRON expansion functions Comments The TIMER and COUNTER data types cannot be used For further details refer to SECTION...

Страница 80: ...in task units but uploading is possible Programming Console Displays When a user program created with the CX Programmer is downloaded to the CPU Unit and read by a Programming Console the instances will all be dis played as question marks The instance names will not be displayed Online Editing Restrictions The following online editing operations cannot be performed on the user pro gram in the CPU ...

Страница 81: ...ter and NSJ Controllers FQM1 Flexible Motion Controllers FB EN ENO AAA BBB D200 D100 0 0 LD P_On AAA MOV AAA BBB 10 0 Program FB definition Body Instance name Fatal error occurs here Function block instance area Initial value of start address Initial value of size Allowed data areas Non retained H512 896 CIO WR HR DM EM See note Retained H1408 128 HR DM EM See note Timer T3072 1024 TIM Counter C30...

Страница 82: ...1 Deciding on Variable Data Types Integer Data Types 1 2 or 4 word Data Use the following data types when handling single numbers in 1 2 or 4 word units INT and UINT DINT and DINT LINT and ULINT Note Use signed integers if the numbers being used will fit in the range Word Data Types 1 2 or 4 word Data Use the following data types when handling groups of data non numeric data in 1 2 or 4 word units...

Страница 83: ...ariable as described in 2 5 4 Array Settings for Input Output Variables and Internal Variables Values are passed in a batch from the input parameters to the input vari ables before algorithm execution not at the same time as the instruction in the algorithm is executed Therefore to pass the value from a parame ter to an input variable when the instruction in the function block algorithm is execute...

Страница 84: ...ess set for the input parameter can be used inside the FB Input output variables should thus be used when it s necessary to pass large quantities of data to a function block W0 00 OK_Flag NG_Flag W0 01 Program Instance for function block definition A The actual value is passed Variable for passing a value outside or monitoring Use an output variable D100 a a D100 a D100 Program Section Instance of...

Страница 85: ...or details refer to 2 5 5 Specify ing Addresses Allocated to Special I O Units When Auxiliary Area bits that are not pre registered to external variables are used and these bits are registered to global symbols that are not specified as external variables When setting the first destination word at the remote node for SEND 090 and the first source word at the local node for RECV 098 When the instru...

Страница 86: ...dder programming within the function block to set data into the array Handling Control Data in Multiple Words In this example an array contains the number of words and first source word operand S1 for an FREAD instruction Variable table Input output variable or internal variable data type DINT array setting with 3 elements variable names read_num 0 to read_num 9 Data Settings and Internal Function...

Страница 87: ...st be calculated as follows Remainder Dividend Divisor Quotient 2 5 5 Specifying Addresses Allocated to Special I O Units Use Index Registers IR0 to IR15 indirectly specified constant offset to spec ify addresses allocated to Special I O Units based on the value passed for the unit number as an input parameter within the function block definition as shown in the following examples Note For details...

Страница 88: ...dex Register indirect speci fication IR0 to IR15 Note After storing the real I O memory addresses in the Index Registers using the MOVR 560 instruction Index Registers can be indirectly specified using gen eral instructions This enables all I O memory areas to be specified dynami cally 3 Unit No 10 Unit No Offset MOVR Relay IR0 L IR0 Offset IR0 SETB 1 IR0 2 Instance for function block definition A...

Страница 89: ...d 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 without the values being set IR IR0 5 IR0 a MOVR 560 Pointer All I O memory areas Index Register I O memory Example Specifying 5 IR0 using constant offset specification not variable name Function block I...

Страница 90: ...O 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 the func tion block is stored in IR0 Procedure Assumes that unit numbers 0 to 15 have already been input from outside the func tion block in UnitNo input variables INT data type 1 Multiple UnitNo by...

Страница 91: ...struction 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 following precautions apply to when an array variable is specified 2 Specifying constant offset of Index Register Specifying a bit between CIO n 0 to n 24 The real I O memory address for CIO 1500 Uni...

Страница 92: ... in 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 words Always use either non array variables data type with a size that is the same as the data size required by the instruction or array variable with the number of elements that is the same as the d...

Страница 93: ...Operand 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 specified in W array variable a with data type WORD and 10 elements is specified in S and array variable b with data type WORD and 10 elements is specified in D XFER 20 a 0 b 0 Even though the array variab...

Страница 94: ...rsion 3 0 are given as Not supported in function blocks in the Symbol col umn Restrictions on Operands Operands that specify the first or last of multiple words thereby requiring AT setting or specification of array variables are indicated as follows in the AT setting or array required column Yes An AT setting or external specification or array variable must be specified for the operand to specify...

Страница 95: ...ersion 7 0 or higher or 2 An array variable with the required number of elements must be pre pared and after the array data is set in the function block definition the first or last element in the array variable must be specified for the operand Any operands for which an AT setting must be specified for an I O mem ory address on a remote node in the network are indicated as Specify address at remo...

Страница 96: ...a Memory 32K words 25 banks E0_00000 to E18_32767 32K words 15 banks E0_00000 to EE_32767 32K words 10 banks E0_00000 to E9_32767 32K words 4 banks E0_00000 to E3_32767 32K words 4 banks E0_00000 to E3_32767 Force set reset enabled area EM 11 to EM 18 EM 7 to EM E EM 6 to EM9 EM3 EM3 Function blocks Maxi mum number of definitions 1 024 Maxi mum number of instances 2 048 Source Com ment areas Symbo...

Страница 97: ...8 64 64 128 64 64 64 Item Specification Item Specification Model CJ1H CPU67H CPU67H R CJ1H CPU66H CPU66H R CJ1H CPU65H CPU65H R CPU64H R CJ1G CPU45H CJ1G CPU44H CJ1G CPU43H CJ1G CPU42H I O points 2 560 1 280 960 Program capacity steps 250K 120K 60K 30K 60K 30K 20K 10K Data memory 32K words Extended Data Memory 32K words 13 banks E0_00000 to EC_32767 32K words 7 banks E0_00000 to E6_32767 32K words...

Страница 98: ...ity steps 20K 10K 5K 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 deceleration 70 µs with acceleration decel eration 63 µs without acceleration deceleration 100 µs with acceleration deceleration Number of sched uled interrupts 2 1 2 1 PWM outputs 2 1 Non...

Страница 99: ... models XA models Y models Model CP1H X40DR A CP1H X40DT D CP1H X40DT1 D CP1H XA40DR A CP1H XA40DT D CP1H XA40DT1 D CP1H Y20DT D Max number of I O points 320 points 40 built in points 40 points Expansion Rack x 7 Racks 300 points 20 built in points 40 points Expan sion Rack x 7 Racks Program capacity steps 20K Data memory 32K words Number of connectable Expan sion Units and Expansion I O Units 7 U...

Страница 100: ...nits and Expansion I O Units 3 Units CP series Expansion Units and Expansion I O Units 1 Unit CP series Expan sion Unit or Expansion I O Unit None Function blocks Maximum num ber of definitions 128 Maximum num ber of instances 256 Inside comment memory Function block program mem ory Kbytes 256 Comment files Kbytes 64 Program index files Kbytes 64 Variable tables Kbytes 64 Model NSJ5 TQ0 G5D NSJ5 S...

Страница 101: ... function blocks Refer to the descriptions of individual instruc tion in the CS CJ Series Instruction Reference for details Item Coordinator Module Motion Control Modules Model FQM1 CM002 FQM1 MMA22 FQM1 MMP22 Max number of I O points 344 points 24 built in points 320 points on Basic I O Units 20 built in points Program capacity steps 10K Data memory 32K words Function blocks Maximum num ber of de...

Страница 102: ...cations 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 block definition p The following table applies only to CP series CPU Units with unit version Ver 1 0 or later and CS CJ series CPU Units with unit version Ver 3 0 or later NSJ Controllers and FQM1 Flexible Motion Controllers Refresh Descrip...

Страница 103: ...exible Motion Controllers Use the following equation to calculate the effect of instance execution on the cycle time when function block definitions have been created and the instances copied into the CPU Unit s user program Contents Number of steps m Call part 57 steps n I O parameter transfer part The data type is shown in parenthe ses 1 bit BOOL input vari able or output variable 6 steps 1 word...

Страница 104: ...6 H CJ1H CPU6 H CS1G CPU4 H CJ1G CPU4 H NSJ CJ1M CPU CP1H X CP1H XA CP1H Y CP1L M CP1L L A Startup time Startup time not including I O parameter transfer 3 3 µs 6 8 µs 8 8 µs 15 0 µs B I O parameter trans fer processing time The data type is indicated in paren theses 1 bit input variable out put variable or input out put variable BOOL 0 24 µs 0 4 µs 0 7 µs 1 0 µs 1 word input variable output varia...

Страница 105: ...ariables 104 3 2 8 Copying and Editing Function Block Definitions 106 3 2 9 Checking the Source Function Block Definition from an Instance 106 3 2 10 Checking Instance Information such as Nesting Levels 106 3 2 11 Checking the Size of the Function Block Definition 107 3 2 12 Compiling Function Block Definitions Checking Program 108 3 2 13 Printing Function Block Definition 108 3 2 14 Password Prot...

Страница 106: ...Function Blocks Structured Text from the pop up menu Define the Function Block Refer to 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 ladder program or ST program Registering Variables as Necessary while Inputting the Ladder Program or ST Program 1 2 3 ...

Страница 107: ...stance and select Function Block SFC Memory Function Block SFC 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 File Refer to 3 2 12 Compiling Function Block Definitions Checking Program and 3 2 16 Saving and Reusing Function Block Definition Files for deta...

Страница 108: ...as shown below 2 Function block definitions are created by inserting function block 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 Device CPU CJ2H CPU68 67 66 65 64 68 EIP 67 EIP 66 EIP 65 EIP 64 EIP CS1G H CPU42H 43H 44H 45H CS1H H CPU63H 64H 65H 66H 67H CJ1G H CPU42H 43H...

Страница 109: ...eated the name FunctionBlock will be assigned automatically where is a serial number These names can be changed All names must contain no more than 64 characters Using OMRON FB Library Files Use the following procedure to insert OMRON FB Library files cxf 1 Select Function Blocks in the project workspace right click and select Insert Function Blocks Library File from the pop up menu Or select Func...

Страница 110: ...int 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 the function block can con tain any of the instructions used in the normal program Refer to 2 4 Pro gramming Restrictions for restrictions on the instructions that can be used Structured text can b...

Страница 111: ...st 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 click and per form either of the following operations To add a variable to the last line select Insert Variable from the pop up menu To add the variable to the line above or below a line within the l...

Страница 112: ...riable is registered can be changed by double clicking and changing the setting in the Usage field N Internals I Inputs O Outputs E Externals P In Out The variable can also be copied or moved between the sheets for internal external in put output and input output variables Select the variable right click and select Copy or Cut from the pop up menu and then select Paste 3 Variable names must also b...

Страница 113: ...nd 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 Text An ST language program see note can either be input directly into the ST input area or a program input into a general purpose text editor can be copied and then pasted into the ST input area using the Paste Comm...

Страница 114: ...r structured text 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 variable name that has not been registered is input The variable is registered at that time Use the following procedure 1 2 3 1 Press the C Key and input a variable name that has not been regi...

Страница 115: ...gistered 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 click the Advanced Button The Advanced Settings Dialog Box will be displayed 2 Select AT Specified Address under AT Settings and input the desired ad dress The variable name is used to enter variables...

Страница 116: ...xt 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 programming in the variable table either as you need them or after completing the program Place the cursor in the tab page on which to register the variable right click and select Insert Variable from the pop up men...

Страница 117: ...under 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 Double click on the instruction and input the symbol name into the operand Index Registers IR and Data Registers DR however do not require modifi cation after pasting and function in the operand as is So...

Страница 118: ...is function is designed to help you create function block definitions based on existing ladder programming It does not automatically generate finish def initions After generating a function block definition with this function always check the warning messages in the FB Variable Allocation Dialog Box and Output Window and check the program that was generated and be sure to make any required changes...

Страница 119: ...e Menu If necessary double click any variable in the variable list and change the name or comment The array and AT settings can also be changed 4 Click the OK Button The following Function Block Ladder Generation Di alog Box will be displayed Input the FB definition name and comment and then click the OK Button 5 The function block definition will be generated based on the settings and will appear...

Страница 120: ...unction is convenient for converting existing ladder programming that has been proven in actual operation into function blocks The application of addresses within the selected program cir cuits is analyzed both inside and outside the selection to allocate internal input output and input output variables as accurately as possible Program circuits that contain operands that are only symbols i e that...

Страница 121: ...1 for W0 and SET for W0 02 Here the instruction can be changed to specify a word instead of a bit As shown below W0 is used both for MOV 021 and SETB 532 and the bit number for SETB 532 is specified using 2 Program Circuits That Must Be Altered after Generating a Function Block Definition In the following cases operand specifications must be changed using array settings after generating the functi...

Страница 122: ... 498 and DT_WORD 1 is specified for MOV 021 Instructions with Two Operands Specifying Starting and Ending Words Example D0 to D9 Specified for BSET 071 As shown below the variables must be changed to specify the first word in an array and a specific word in the same array after the function block definition has been generated Example DT_WORD is set as a WORD array variable with 10 elements DT_WORD...

Страница 123: ...e second operand of XFER 070 3 2 4 Creating Instances from Function Block Definitions If a function block definition is registered in the global symbol table either of the following methods can be used to create instances Method 1 Select the function block definition insert it into the program and input a new instance name The instance will automatically be registered in the global symbol table Me...

Страница 124: ...iable with the FUNCTION BLOCK data type 2 Input the instance name select the function block from which to create an instance and click the OK Button 3 As an example set the instance name in the FB Instance Field to sample set the function block in the FB Definition Field to FunctionBlock1 and click the OK Button As shown below a copy of the function block definition called FunctionBlock1 will be c...

Страница 125: ...e left bus bar i e an EN must always be inserted Note If changes are made in the I O variables in a variable table for a function block definition the 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 and select Update Invoca tion The instance will be ...

Страница 126: ... 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 is passed to input variable aaa Input variable data type Content Size Input method Setting range BOOL Bit data 1 bit P_Off P_On 0 FALSE 1 TRUE INT Integer 16 bits Positive value or followed by integer...

Страница 127: ... 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 digits max or followed by decimal number 0000 to FFFF or 0 to 65535 DWORD 32 bit data 32 bits followed by hexadecimal number 8 digits max or followed by decimal number 00000000 to FFFFFFFF or 0 to 429496...

Страница 128: ...s are specified CS CJ series CPU Units Ver 3 0 or Later and NSJ Controllers Note 1 Bit data can be accessed even if the DM or EM Area is specified for the non retained area or retained area FB Instance Area Default value Applicable memory areas Start address End address Size Non Retain H512 H1407 896 CIO WR HR DM EM See note Retain H1408 H1535 128 HR DM EM See note Timers T3072 T4095 1024 TIM Coun...

Страница 129: ...sses in the function block instance areas overlap with any of the addresses used in the user program an error will occur when compil ing This error will also occur when a program is downloaded edited on line or checked by the user If addresses are duplicated and an error occurs either change the function block instance areas or the addresses used in the user program FQM1 Flexible Motion Controller...

Страница 130: ... pop up menu Alternately select Memory Allocation Function Block SFC Memory Function Block SFC Memory Address from the PLC Menu 3 The FB Interface Memory Dialog Box will be displayed Check the I O memory addresses internally allocated to variables here Address CP1L L D0000 to D9999 Provided D10000 to D31999 Not Provided D32000 to D32767 Provided Example Instance name displayed in global variable t...

Страница 131: ...ated to a different block of addresses if the original 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 that memory is used more efficiently 1 2 3 1 Select the instance in the Ladder Section Window right click and select Memory Allocation Function Block SFC M...

Страница 132: ... from an Instance Use the following procedure to check the function block definition from which an instance was created Either double click the instance or right click the instance and select To Lower Layer from the pop up menu The function block definition will be dis played 3 2 10 Checking Instance Information such as Nesting Levels When function blocks are nested in the created program the stru...

Страница 133: ...under Function Block refer to the number of function block definitions When nesting this area shows the nesting level relationship between instances function block definition names in parentheses The higher level is the calling block and the lower level is the called block Also if there are array variables or timer counter variables they are displayed just below the instance The variable names dat...

Страница 134: ...le Table Page of the Output Window 3 2 13 Printing Function Block Definition Use the following procedure to print function block definitions 1 2 3 1 Double click the function block definition to be printed and with the vari able table and algorithm displayed select Print from the File Menu The following Target Print Rung Dialog Box will be displayed 2 Select the All Rung or Select Rung option When...

Страница 135: ...rotection level restricts both writing changing and displaying the contents of the function block definition To set read write protection select Prohibit writing and display as the Protec tion type in the function block s properties This level of protection prevents unintended program changes modifications and also protects against misap propriation of program materials Password Protection on Writ...

Страница 136: ... up to 8 characters long and only alphanumeric char acters can be used 5 When a function block definition has been password protected the func tion block definition s icon will change to indicate that it is protected The icon also indicates the protection level as shown below Prohibit writing and display same for ladder and ST Prohibit writing ladder Prohibit writing ST Protecting Multiple Functio...

Страница 137: ... 1 2 3 1 In the project workspace select the function block definition right click and select Properties from the pop up menu Alternately select Proper ties from the View Menu 2 The Function Block Properties Dialog Box will be displayed Click the Pro tection Tab and click the Release Button 3 The Function Block Protection Release Dialog Box will be displayed Input the password in the Password Fiel...

Страница 138: ...lock definition and perform a program check 2 When function blocks are being nested the function block definition of the called nested function blocks are included and saved in the function block library file Saving a Function Block Library File Use the following procedure to save a function block definition to a function block library file 1 2 3 1 Select the function block definition right click ...

Страница 139: ... 18 Monitoring and Debugging Function Blocks The following procedures can be used to monitor programs containing func tion blocks Monitoring I O in Ladder Programs within Instances With the CX Programmer Ver 6 0 and later versions it is possible to monitor the status of bits and content of words in a ladder program within an instance when monitoring the program To monitor I O bits and words I O Bi...

Страница 140: ...ray variable s arguments the present value cannot be monitored if that array variable is used as the operand of an input condition or special in struction In this case the input condition or instruction will be displayed in red Double click I O values can be monitored in the algorithm within the function block ...

Страница 141: ...splayed in the left side of the window called the ST pro gram monitor window The values of variables used in the ST program are displayed in the right side of the window called the ST variable monitor window At this point it is possible to monitor variable values change PVs force set or force reset bits and copy paste variables in the Watch Window These oper ations are described below Monitoring V...

Страница 142: ...variable monitor window displayed in reverse video when selected right click and select Force On Force Off Force Cancel or Force Cancel All Forces from the pop up menu Copying and Pasting in the Watch Window 1 2 3 1 To copy a variable to the Watch Window select the desired variable in the ST variable monitor window displayed in reverse video when selected right click and select Copy from the pop u...

Страница 143: ...f the three following methods to display the FB variables reg istration Dialog Box a Right click the instance and select Register in Watch Windows from the pop up menu b Copy the instance and paste it in the Watch Window c Right click an empty row in the Watch Window and select Register in Watch Windows from the pop up menu 3 Select Usage Data Type The FB Instance setting can also be selected The ...

Страница 144: ...e simulation function 1 2 3 1 Open the program containing the instance to be debugged 2 Select View Toolbars and select the Simulator Debug Option in the Tool bars Tab 3 Select Work Online Simulator from the CX Programmer s PLC Menu and transfer the program to the CX Simulator in the computer Note Steps 2 and 3 can be done in the opposite order Step Execution Step Run Executes the program in step ...

Страница 145: ...dder Program Note When the program is being executed at a point outside of the function block instance the processing is the same as normal Step Run operation Step Out Use the following procedure to pause step execution of a ladder ST program within an instance Step Run operation and return to one level higher in the program the program or instance that was the source of the call 1 2 3 1 During St...

Страница 146: ... change the color select Tools Options and click the Appearance Tab Select Pause Simulator Simulator Instruction Break or Simulator IO Break and change the color for that condition Break Point Operation in an Instance Execution can be paused automatically at the preset break point in the instance In this case the Step In operation cannot be used Note When a break point is set for an instance the b...

Страница 147: ...ructions not in instances can be changed and instances can be deleted Instances cannot be added instance names cannot be changed and changes cannot be made to variable tables or algorithms in function block definitions Editing Reserved Memory to Add an Internal Variable with Online Editing To add an internal variable to the variable table in a function block definition the memory required for the ...

Страница 148: ...arted At the same time a list of instances that will be affected is displayed in the Output Window Note Affect of Function Block Definition Changes on Instances When a function block definition is changed the contents of all in stances that call that function block definition will also be changed This is illustrated below Change function block definitions only after considering the affect of the c...

Страница 149: ...B online Edit Send Changes The following FB Online Edit Transfer Dialog Box will be displayed 4 Select one of the following transfer modes and click the Yes Button Normal Mode Quick Mode Refer to Transfer Modes on page 124 and Selecting a Transfer Mode on page 125 for details on the transfer modes ...

Страница 150: ... procedure from the beginning Transfer Modes Normal Mode In Normal Mode both the source code and object code are transferred to the CPU Unit Some time may be required for Normal Mode transfers because of the quantity of data that must be sent Other editing or transfer operations cannot be performed until the transfer has been completed Note The Display confirmation of FB online edit changes Option...

Страница 151: ...ock definitions always select Program Transfer FB Source later to transfer the source code as well Even if the source code is not trans ferred it will be automatically transferred when you go offline unless the com puter or CX Programmer crashes before the source code can be transferred In that happens it may be impossible to upload the program See note Note It may be still be possible to transfer...

Страница 152: ...e time are given in the following table Note Cycle Time Monitor Time Be sure that the cycle time monitor time set in the PLC Setup is not exceeded when the program is rewritten as a result of online editing in MONITOR mode If the monitor time is exceeded a cycle time exceeded error will occur and CPU Unit operation will stop If this occurs switch to PROGRAM mode and then to MONITOR or RUN mode to ...

Страница 153: ...or details The previous status flags for all differentiated instructions DIFU 013 instructions DIFD 014 and instructions will be initialized i e turned OFF when online editing is finished After performing online editing do not turn OFF the power supply to the PLC until the CPU Unit has finished backing up data to the built in flash memory i e until the BKUP indicator stops flashing If the power su...

Страница 154: ...128 Procedures Section 3 2 ...

Страница 155: ...Part 2 Structured Text ST ...

Страница 156: ......

Страница 157: ...ing functionality of the CX Programmer and explains the features that are not contained in the non structured text version of CX Programmer 4 1 ST Language 132 4 1 1 Overview 132 4 2 CX Programmer Specifications 133 4 2 1 PLC Models Compatible with ST Programs ST Tasks 133 4 2 2 Specifications 133 ...

Страница 158: ...d to tasks The PLC must be a CS CJ series CPU Unit with unit version 4 0 or later or a CJ2 series CPU Unit The following list shows the features of the ST language There are many control statements available such as loop statements and IF THEN ELSE statements many operators such as arithmetic oper ators comparison operators and AND OR operators as well as many mathematical functions string extract...

Страница 159: ...PU Unit model CJ2H CJ2H CPU68 67 66 65 64 68 EIP 67 EIP 66 EIP 65 EIP 64 EIP CS1G H with unit version 4 0 CS1G CPU45H 44H 43H 42H CS1H H with unit version 4 0 CS1H CPU67H 66H 65H 64H 63H CJ1G H with unit version 4 0 CJ1G CPU45H 44H 43H 42H CJ1H H with unit version 4 0 CJ1H CPU67H 66H 65H 67H R 66H R 65H R 64H R CJ1M with unit version 4 0 CJ1M CPU23 22 21 13 12 11 Item Specification Program languag...

Страница 160: ...134 CX Programmer Specifications Section 4 2 ...

Страница 161: ...2 Derivative Data Types 137 5 3 Inputting ST Programs 138 5 3 1 Syntax Rules 138 5 3 2 CX Programmer s ST Input Screen Display 140 5 4 ST Language Configuration 141 5 4 1 Statements 141 5 4 2 Variables 142 5 4 3 Inputting Constants 142 5 4 4 Operators 142 5 4 5 Standard Functions 143 5 4 6 OMRON Expansion Functions 146 5 5 Statement Descriptions 148 5 5 1 Assignment 148 5 5 2 Control Statements 14...

Страница 162: ...efer to 5 4 4 Operators Functions Refer to 5 4 5 Standard Functions and 5 4 6 OMRON Expan sion Functions Example of a Control Statement Note In an ST program addresses are not input as actual I O memory addresses Variable names are used for all address inputs The addresses that use vari ables are set by the user For details on variable specifications and setting methods refer to the CX Programmer ...

Страница 163: ...47 483 647 LINT Long 8 byte integer 64 9 223 372 036 854 775 808 to 9 223 372 036 854 775 807 UINT Unsigned integer 16 0 to 65 535 UINT BCD Unsigned BCD integer See note 1 UDINT Unsigned double integer 32 0 to 4 294 967 295 UDINT BCD Unsigned double BCD integer See note 1 ULINT Unsigned long 8 byte integer 64 0 to 18 446 744 073 709 551 615 ULINT BCD Unsigned long 8 byte BCD integer See note 1 REA...

Страница 164: ...anywhere within statements Therefore use spaces carriage returns and tabs between reserved words and equations to make them easier to read Spaces carriage returns and tabs cannot be used between the following tokens the smallest meaningful unit for compiling in which case they are referred to as token separators Tokens Reserved words variable names special characters constants numerical values Res...

Страница 165: ...s are used in this way Operator Priority Consider the operator priority in the structured text syntax or enclose operations requiring priority in parentheses Example AND takes priority over OR Therefore in the example X OR Y AND Z priority will be given to Y AND Z STRING Data Type The following text strings are supported Strings with up to 255 alphanumeric characters The text strings are not case ...

Страница 166: ...ext keywords reserved words Blue Comments Green Errors Red Other Black Changing Fonts To change font sizes or display colors select Tools Options click the Appearance Tab and then click the ST Font Button The font name font size default is 8 point and color can be changed Notation Description The dollar sign ASCII 24 A single quotation mark ASCII 27 L or l Line feed ASCII 0A N or n Carriage return...

Страница 167: ...ial_value TO final_value BY increment DO expression END_FOR WHILE DO END_WHILE Repeatedly evaluates an expression as long as a condition is true WHILE condition DO expression END_WHILE REPEAT UNTIL END_REPEAT Repeatedly evaluates an expression until a condition is true REPEAT expression UNTIL condition END_REPEAT EXIT Stops repeated processing EXIT RETURN ST program Ends the ST task that is being ...

Страница 168: ...ccording to the data type Therefore the addition result for INT data for example must be a variable using the INT data type Particularly care is required when a carry or borrow occurs in an operation for integer type variables For example using integer Operation Symbol Data types supported by operator Priority 1 Lowest 11 Highest Parentheses and brackets expression array index 1 Function evaluatio...

Страница 169: ...variable b stored in variable a LN argument REAL LREAL REAL LREAL Natural logarithm LOGe argument a 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 REAL LREAL REAL LREAL Natural exponential ear gument a EXP b natural exponential of vari able b stor...

Страница 170: ...ters Source_ string STRING STRING Extracts charac ters from a text string starting from the right a RIGHT b c number of characters specified by variable c extracted from the eight of text string b and stored in variable a Number_of_ characters INT UINT MID Source_string Number_of_characters Position Source_ string STRING STRING Extracts charac ters from a text string a MID b c d number of characte...

Страница 171: ...ng stored in variable a Replace_ string STRING Number_of_ characters INT UINT Position INT UINT FIND Source_string Find_string Source_ string STRING INT Finds characters within a text string a FIND b c first occurrence of text string c found in text string b and posi tion stored in variable a 0 stored if text string c is not found Find_string STRING Function Argument data type Return value data ty...

Страница 172: ...YES YES YES YES YES YES YES No No No LREAL No YES YES YES YES YES YES YES YES YES No No No STRING No YES YES No YES YES No YES YES No No No No Function type Description Memory Card Functions Functions that write data to Memory Cards Communications Functions Functions that send and received text strings Angle Conversion Functions Functions that convert between degrees and radians Function Argument ...

Страница 173: ...c number of characters specified by variable b are received from the serial port specified by variable c on the Serial Communications Board and stored in variable a Number_of_ characters INT UINT WORD Serial_port INT UINT WORD RXD_SCU Storage_ location Number_of_ characters SCU_unit_ number Serial_port Internal_logic_port Storage_ location STRING Receives a text string from a serial port on a Seri...

Страница 174: ...ubstitutes stores an equation variable or constant for the variable Examples Example 1 Substitute variable A with the result of the equation X 1 A X 1 Example 2 Substitute variable A with the value of variable B A B Example 3 Substitute variable A with the constant 10 A 10 Precautions The data type of the equation variable or constant to be assigned must be the same as the data type of the variabl...

Страница 175: ...ation for the evaluation result Example IF A 10 The condition can also be specified as a boolean variable only rather than an equation As a result the variable value is 1 ON True result 0 OFF False result Statements that can be used in expression_1 and expression_2 are assignment statements IF CASE FOR WHILE or REPEAT Example IF condition_1 THEN IF condition_2 THEN expression_1 ELSE expression_2 E...

Страница 176: ...th true variable X will be substituted with numerical value 10 and variable Y will be substituted with numerical value 20 If variable A 0 and variable B 1 are both false variable X and variable Y will both be substituted with numerical value 0 IF A 0 AND B 1 THEN X 10 Y 20 ELSE X 0 Y 0 END_IF Example 3 If the boolean BOOL data type variable A 1 ON variable X will be substituted with numerical valu...

Страница 177: ...Condition 2 If false Condition 3 If true execute expression 3 etc Condition n If true execute expression n If none of these conditions are met condition m is executed Precautions IF must be used together with END_IF Condition_ contains the true or false result of the equation e g IF A 10 A boolean BOOL data type variable only can also be specified as the condition rather than an equation For boole...

Страница 178: ...A 0 is false but variable B 2 variable X will be substituted with numerical value 2 If either of these conditions is met variable X will be substituted with numeri cal value 0 IF A 0 THEN X 10 ELSIF B 1 THEN X 1 ELSIF B 2 THEN X 2 ELSE X 0 END_IF CASE Statement Summary This statement executes an expression containing a selected integer that matches the value from an integer equation If the selecte...

Страница 179: ...ed in expression_ are assignment state ments IF CASE FOR WHILE or REPEAT Multiple statements can be executed in expression_ Be sure to use a semicolon delimiter between multiple statements in an expression Variables in integer format INT DINT LINT UINT UDINT or ULINT or equations that return integer values can be specified in the integer_equation When OR logic is used for multiple integers in the ...

Страница 180: ...h numerical value 2 If vari able A is a value between 6 and 10 variable X is substituted with numerical value 3 If variable A is 11 12 or a value between 15 and 20 variable X is substituted with numerical value 4 If neither of these cases matches variable Y will be substituted with 0 CASE A OF 1 X 1 2 5 X 2 6 10 X 3 11 12 15 20 X 4 ELSE Y 0 END_CASE FOR Statement Summary This statement is used to ...

Страница 181: ...e expression is executed This process is repeated If the iteration_variable final_value_equation see note 2 the processing ends Note 1 If the value from the increment_equation is negative the condition is iteration_variable final_value_equation value 2 If the value from the increment_equation is negative the condition is iteration_variable final_value_equation Precautions A negative value can be s...

Страница 182: ...itial_value final_value_equation and increment_equation Example 1 The iteration is performed when the iteration variable n 0 to 50 in increments of 5 and the array variable SP n is substituted with 100 FOR n 0 TO 50 BY 5 DO SP n 100 END_FOR Example 2 The total value of elements DATA 1 to DATA 50 of array vari able DATA n is calculated and substituted for the variable SUM FOR n 0 TO 50 BY 1 DO SUM ...

Страница 183: ...n This process is repeated If the condition is false the expres sion is not executed and the condition evaluation ends Precautions WHILE must be used in combination with END_WHILE Before executing the expression if the condition equation is false the pro cess will end without executing the expression Statements that can be used in the expression are assignment state ments IF CASE FOR WHILE or REPE...

Страница 184: ... repeat processing for as long as a condition is met after specified processing when the number of iterations is undetermined beforehand depends on whether the condition is met This statement can be used to determine whether to repeat processing according to the results of specified processing execution post test loop Description The expression will execute the first time without a condition There...

Страница 185: ...ithin an IF statement to force an iteration statement to end when a specified condition is met Reserved Words EXIT Statement Syntax Example Using within IF Statement FOR WHILE REPEAT expression IF condition THEN EXIT END_IF END_FOR WHILE REPEAT Usage Use the EXIT statement to force iteration processing to end before the end condition is met Description Example Using within IF Statement When the co...

Страница 186: ...o forcibly end an SFC program and function block that is executing an ST task Function Block Call Statement Summary This statement calls a function block definition Reserved Words None Statement Syntax Enter the arguments specified variable values that are passed to the called function block s input variables and return value specified variable that receives the function block s output variable va...

Страница 187: ...alues depending on the ST program being used Calling function block s input variable or a constant when ST is being used in the function block s instance Global variable or local variable name when ST is being used in an ST task or SFC action program D Omitted called function block definition s output variable name or constant E One of the following values depending on the ST program being used Ca...

Страница 188: ...ition s output variable name or constant D One of the following values depending on the ST program being used Calling function block s output variable or constant when ST is being used in the function block s instance Global variable or local variable name when ST is being used in an ST task or SFC action program Examples Showing Additional Details The following two examples show how to actually u...

Страница 189: ...IN3 Passed to FB_IN3 input variable OUT1 Received from FB_OUT1 output variable OUT2 Received from FB_OUT2 output variable OUT3 Received from FB_OUT3 output variable A Note Data type BOOL Passed to EN internal variable B Note Data type BOOL Received from ENO internal variable Instance_FB Note Data type FUNC TIONBLOCK Calling function block definition Function block Variable type Function block call...

Страница 190: ...IN1 FB_IN2 IN2 FB_IN3 IN3 FB_OUT1 OUT1 FB_OUT2 OUT2 FB_OUT3 OUT3 ENO B EN and ENO not entered Instance_FB FB_IN1 IN1 FB_IN2 IN2 FB_IN3 IN3 FB_OUT1 OUT1 FB_OUT2 OUT2 FB_OUT3 OUT3 ENO not entered Instance_FB EN A FB_IN1 IN1 FB_IN2 IN2 FB_IN3 IN3 FB_OUT1 OUT1 FB_OUT2 OUT2 FB_OUT3 OUT3 FB_OUT2 data not required Instance_FB EN A FB_IN1 IN1 FB_IN2 IN2 FB_IN3 IN3 FB_OUT1 OUT1 FB_OUT3 OUT3 ENO B Internal ...

Страница 191: ...d return the value from FB_OUT2 The EN and ENO data cannot be entered as an argument or return value Specification method 1 cannot be used together with specification method B in the same function block call statement Example 2 In the following example function block 1 calls function block 2 which calcu late the average value by calling a function block from within a function block Function Block ...

Страница 192: ...alculates the average value of input1 input2 and input3 and stores the result in average average input1 input2 input3 3 5 6 ST language Program Example 5 6 1 Using an ST Program in a Function Block Converting an Integer to BCD and Outputting It as a Text String Input Variable INT Input_Num Input Output Variable STRING Output_String Internal Variable WORD Num_BCD Check Input_BCD input parameter BCD...

Страница 193: ...le if A is a REAL data type a syntax error will occur for A 2 Use A 2 0 Bits TRUE FALSE can only be allocated to variables with the BOOL data type For example if A is a BOOL data type A FALSE is possible If a BOOL data type is not used a syntax error will occur For example if A is an INT data type a syntax error will occur for A FALSE Data types must all be consistent within the structured text Fo...

Страница 194: ... an error will not be detected for the following type of statement Operation will be unstable when this statement is executed i 15 INT i 10 Q Are the variables in the structured text editor automatically registered in the variable tables A No Register the variables in the variable table before using them Q Can ladder programming instructions be called directly A No ...

Страница 195: ...ting a New ST Program 170 6 1 3 Allocating the ST Program to a Task 171 6 1 4 Creating the ST Program 172 6 1 5 Compiling the ST Program Checking Program 174 6 1 6 Downloading Uploading Programs to the Actual CPU Unit 174 6 1 7 Comparing ST Programs 175 6 1 8 Monitoring and Debugging the ST Program 175 6 1 9 Online Editing of ST Programs 176 ...

Страница 196: ...r settings refer to the CX Programmer Operation Manual W446 6 1 2 Creating a New ST Program Use the following procedure to create an ST program in a project 1 2 3 1 Right click the Programs Item in the project workspace to display the pop up menu 2 Select Insert Program ST from the pop up menu An ST program will be inserted in the project workspace and the ST Editor will be displayed on the right ...

Страница 197: ...it If a program has not been allocated to a task there will be a check mark over that program s icon in the project workspace Note The following procedure which allocates a program to a task can be per formed after the program has been created but always allocate the programs before transferring the user program to the PLC Use the following procedure to allocate a program to a task 1 2 3 1 Right c...

Страница 198: ...nt Input the ST language after registering the variables Register the variables as you input the ST language Inputting the ST Language after Registering Variables There are two kinds of variables global variables and local variables This section explains how to set local variables For details on setting global vari ables refer to the CX Programmer Operation Manual W446 1 Registering Variables with...

Страница 199: ... can be created in a text editor and then pasted in the ST Editor Win dow by selecting Edit Paste If the symbol table with the registered variables is displayed while inputting the ST program it is easy to reference the variable names for program ming Note 1 Tabs or spaces can be input to create indents They will not affect the al gorithm 2 The display size can be changed by holding down the Ctrl ...

Страница 200: ... standard text programming in the variable table either as you need them or after completing the program 6 1 5 Compiling the ST Program Checking Program The ST program can be compiled to perform a program check on it Use the following procedure 1 2 3 1 Select the ST program right click and select Compile from the pop up menu Alternately press the Ctrl F7 Keys 2 The ST program will be compiled and ...

Страница 201: ...the Watch Window These oper ations are described below Monitoring Variables Variable values are displayed in blue in the ST variable monitor window Changing PVs To change a PV select the desired variable in the ST variable monitor window displayed in reverse video when selected right click and select Set Value from the pop up menu The Set New Value Dialog Box will be displayed Input the new value ...

Страница 202: ...ed in systems that cannot be shut down such as systems that operate 24 hours day ST programs can be edited online when the PLC is in an operating mode other than RUN mode This function cannot be used with the simulator Starting Online Editing 1 2 3 1 Start monitoring 2 Select the desired ST program in the project workspace and display it in program view 3 Select Program Online Edit Begin At this p...

Страница 203: ... making Quick Mode faster than Normal Mode After transferring the object code in Quick Mode either 1 select Program Transfer SFC ST Source to PLC to transfer the source code or 2 transfer the source code according to instructions displayed in a dialog box when you go offline After transferring the object code a yellow mark will be displayed at the bot tom of the window until offline status is ente...

Страница 204: ... to be transferred 2 Connect online with the PLC that was the destination of the Quick Mode transfer The flashing yellow message Src Fail will be displayed in the CX Programmer s status bar 3 Select Program Online Edit Transfer SFC ST Source to PLC The ST source code transfer dialog box will be displayed 4 Click the OK Button The ST source code that was automatically backed up in the computer will...

Страница 205: ...aximum of 0 5 Ksteps can be added to or deleted from an ST program during one online editing operation except for CJ2 series CPU Units After performing online editing do not turn OFF the power supply to the PLC until the CPU Unit has finished backing up data to the built in flash memory i e until the BKUP indicator goes OFF If the power supply is turned OFF before the data is backed up the data wi...

Страница 206: ...180 Procedures Section 6 1 ...

Страница 207: ...lways ON Flag P_On BOOL 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 1 0 second clock pulse bit P_1s BOOL CF102 Auxiliary Area Flags Bits First Cycle Flag P_First_Cycle BOOL A200 11 Step Flag P_Step BOOL A200 12 First Task Execution Flag P_First_...

Страница 208: ...182 System defined external variables supported in function blocks Appendix A ...

Страница 209: ... type was substituted Y ABS X X is an INT type variable Y is a UINT type variable Division by Zero The 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 comment Invalid Literal Format s The numeric format is illegal X 123_ There is no numeral after un...

Страница 210: ...REPEAT in the syntax UNTIL X 10 END_REPEAT Invalid variable for Function output The specified variable for the function output is illegal A non boolean BOOL variable or numeral has been specified as the ENO transfer 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 parenthe...

Страница 211: ...a variable with a data type that does not support negative values UINT UDINT ULINT Y X X is 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 Too many parameter settings are specified for the function Y SIN X1 X2 Undefined identifier s A variable that ...

Страница 212: ...word has been used in an invalid location For example use of the EXIT statement outside a loop syn tax Conversion from s to s possible loss of data Data may be lost due to con version of a data type with a large data size to a data type with a small data size Y DINT_TO_INT X X is a DINT type variable Y is an INT type variable ...

Страница 213: ...m the right of the specified text string Application Return_value RIGHT Source_string Number_of_characters Variable name Data type Description String STRING Specifies the text string for which to find the length Return_value INT Returns the size of the speci fied text string Variable name Data type Description Source_string STRING Specifies the text string from which to extract characters Number_o...

Страница 214: ...eturn_value STRING Returns the extracted charac ters Variable name Data type Description Source_string STRING Specifies the text string from which to extract characters Number_of_characters INT UINT Specifies the number of characters to extract Position INT UINT Specifies the position from which to start extracting characters The first character is position 1 e g position 1 is A in mes sage 1 in t...

Страница 215: ...A in message 1 in the following illustration Return_value STRING Returns the text string with the characters inserted Variable name Data type Description Source_string STRING Specifies the text string from which to delete characters Number_of_characters INT UINT Specifies the number of characters to delete Position INT UINT Specifies the position from which to delete characters The first character...

Страница 216: ... INT UINT Specifies the number of characters to be replaced Position INT UINT Specifies the position from which to replace characters The first character is position 1 e g position 1 is A in mes sage 1 in the following illustration Return_value STRING Returns the text string with the characters replaced Variable name Data type Description Source_string STRING Specifies the text string to search Fi...

Страница 217: ...ies the directory and file name including the root direc tory The file name must be 8 characters or less The file name extension is always TXT For example the following file name creates a file named LINE_A TXT in the root directory LINE_A Delimiter STRING Empty character Comma L or l Line feed ASCII 0A N or n Carriage return line feed ASCII 0D 0A P or p New page ASCII 0C R or r Carriage return AS...

Страница 218: ... Auxiliary Area Easy backup operation Memory Card Detected Flag A343 15 ON when a Memory Card has been detected Variable name Data type Description Send_string STRING Specifies the text string to send Variables BOOL P_MemCardBusyFlag File Memory Operation Flag AT A343 13 BOOL P_MemCardAskFlag Memory Card Detected Flag AT A343 15 STRING FileName File name INT LogData1 2 3 Log number STRING FiledStr...

Страница 219: ...l mode Variable name Data type Description Send_string STRING Specifies the text string to send Serial_port INT UINT WORD Specifies the number of the serial port 1 Serial port 1 2 Serial port 2 Variables BOOL DoSendData Variable to control send function INT iProcess Process number STRING Message Send message BOOL SendEnableCPUPort Send Ready Flag AT A392 05 2 Execute send function if sending is en...

Страница 220: ...rotocol mode Port 2 Send Ready Flag A356 13 ON when sending is enabled in no protocol mode Variables BOOL P_DoSendData Variable to control send function INT iProcess Process number STRING Message Send message BOOL P_SendEnableSCBPort1 Send Ready Flag AT A356 05 Serial port 1 used Use serial port number 1 Send data when P_DoSendData is ON and iProcess is 0 IF P_DoSendData TRUE AND iProcess 0 THEN i...

Страница 221: ...T iProcess Process number STRING Message Send message BOOL P_TXDU_Exe TXDU Execution Flag AT 1519 05 Unit number 0 Use serial port 2 BOOL P_ComInstEnable Communications Port Enable Flag AT A202 07 Use port 7 Use the following Unit number 0 Serial port number 2 Logical port number 7 Send data when P_DoSendData is ON and iProcess is 0 IF P_DoSendData TRUE AND iProcess 0 THEN iProcess 1 P_DoSendData ...

Страница 222: ...ort must be set to no protocol communications Arguments and Return Values Related Auxiliary Area Flag Address Communications Instruction Enable Flags A202 00 to A202 07 ON when network communications can be executed The bit numbers correspond directly to the internal logic port numbers Bits 00 to 07 Internal logic ports 0 to 7 Related CPU Bus Unit Area bits Bit n CIO 150 25 x unit number Port 1 n ...

Страница 223: ... RS 232C Port Reception Overflow Flag A392 07 ON when a data overflow occurred during reception in no pro tocol mode RS 232C Port Reception Counter A393 Contains the number of characters received in no protocol mode Variable name Data type Description Storage_location STRING Specifies the storage location for the received text string Number_of_characters INT UINT WORD Specifies the number of chara...

Страница 224: ... A356 07 ON when a data overflow occurred during reception in no pro tocol mode Port 1 Reception Counter A357 Contains the number of characters received in no protocol mode Port 2 Reception Completed Flag A356 14 ON when reception has been completed in no protocol mode Port 2 Reception Overflow Flag A356 15 ON when a data overflow occurred during reception in no pro tocol mode Port 2 Reception Cou...

Страница 225: ... Variable to control receive function INT iProcess Process number STRING Message Variable to store received message BOOL P_RXDU_Recv Status of Serial Communications Unit AT 1519 06 Unit No 0 Use serial port 2 BOOL P_ComInstEnable Communications Port Enable Flag AT A202 07 Use port 7 Use the following Unit number 0 Serial port number 2 Logical port number 7 Receive data when P_DoRecvData is ON and ...

Страница 226: ...lag A202 00 to A202 07 ON when network communications can be executed The bit numbers correspond directly to the internal logic port numbers Bits 00 to 07 Internal logic ports 0 to 7 Related CPU Bus Unit Area bits Bit n CIO 150 25 x unit number Port 1 n 9 Port 2 n 19 06 ON when reception has been completed in no protocol mode n CIO 150 25 x unit number Port 1 n 9 Port 2 n 19 07 ON when a data over...

Страница 227: ...tions 13 checking for an instance 106 compiling 108 creating 82 saving to files 112 function blocks advantages 12 application guidelines 56 creating 23 debugging 113 defining 85 elements 31 errors 55 monitoring 113 operating specifications 49 outline 11 restrictions 51 reusing 24 setting parameters 99 specifications 6 7 30 structure 13 functions 4 function blocks 6 7 restrictions 5 G global symbol...

Страница 228: ... safety precautions xxii specifications CX Programmer Ver 5 0 5 function block operation 49 instances 42 structured text function block definition 84 restrictions 53 symbol name automatically generating 91 T timer instructions operation 75 restrictions 52 V variable names 19 variables address allocations 21 checking address allocations 104 creating as needed 88 definitions 31 introduction 18 prope...

Страница 229: ...uly 2006 Added Ver 7 0 upgrade information 04 January 2007 Pages 17 and 18 Changed can to cannot in table two locations and changed note Page 29 Changed text in inputs cell for the status of value at next execution Page 213 Changed illustration Pages 214 216 to 218 and 202 Changed illustration and changed code Pages 215 and 219 Changed text in bottom right cell 05 July 2007 Added upgrade informati...

Страница 230: ...204 Revision History ...

Страница 231: ......

Страница 232: ... 8 1 l e T s r e t r a u q d a e H l a n o i g e R V B E P O R U E N O R M O p r o d d f o o H D J 2 3 1 2 9 6 7 6 n a a l a g e W s d n a l r e h t e N e h T 8 8 3 1 8 6 5 3 2 1 3 x a F 0 0 3 1 8 6 5 3 2 1 3 l e T m o c n o r m o a i w w w t c a t n o C N A P A J o y k o T D T L E T P C I F I C A P A I S A N O R M O 2 y b b o L 8 0 5 0 5 0 d a o R a r d n a x e l A A 8 3 4 o N k r a p o n h c e T...

Отзывы: