ISPSoft User Manual

ISPSoft User Manual ISPSoft User Manual

02.09.2014 Views

Chapter 7 Function Block Class VAR_IN_OUT Description A symbol of this class is used as a feedback pin of a function block. When the function block is called, the value of an operand specified by the superior POU (caller) is sent to the function block through the symbol of this type. After the function is executed, the operation result is sent to the operand specified by the superior POU (caller). • Data types Model AH500 DVP Description BOOL, WORD, DWORD, LWORD, INT, DINT, LINT, REAL, LREAL, ARRAY, STRING, POINTER, T_POINTER, C_POINTER, HC_POINTER, and a function block BOOL, WORD, DWORD, LWORD, REAL, ARRAY, STEP, TIMER, and COUNTER *1. The data type of a symbol of the VAR_INPUT class, the VAR_OUTPUT class, or the VAR_IN_OUT class can not be STRING, STEP, COUNTER, or TIMER. *2. Please refer to section 7.2.4 for more information about POINTER, T_POINTER, C_POINTER, and HC_POINTER. • Assigning memories to the symbols in a function block Model Description When the symbols whose data type is a function block, and the local symbols AH500 created in a function block are declared, users can not assign device addresses to them. The system will automatically assign memories reserved by the CPU module. Every symbol whose data type is a function block is assigned a P device. Besides, DVP the system automatically assigns devices in the PLC to the local symbols in a function block instance according to the data types of the local symbols. *. Please refer to sections 7.2.5~7.2.7 for more information about function block instances and the assignment of memories. 7.2.3 Input/Output Pins of a Function Block When a POU calls a function block, it sends the value in a device to the input pin of the function block. After the function block is executed, the operation result is sent to the device in the POU through the output pin of the function block. Please refer to the following figures. • Before a function block is executed The caller assigns D0 to DT_IN, the input pin of the function block. When the function block is called, the system sends the present value in D0 to DT_IN. (DT_IN is a symbol of the VAR_INPUT type.) • After a function block is executed After the function block is executed, the value of DT_IN becomes 89. The value in D0 is unchanged. Besides, DT_OUT sends the final operation result to D2, the device specified by the caller. Even if the value in D2 is overwritten during the execution of the program, the value of DT_OUT will remain unchanged. (DT_ OUT is a symbol of the VAR_OUTPUT class.) 7-5

ISPSoft User Manual Although the value of the symbol of the VAR_IN_OUT class will be sent to the device that the caller assigns to the symbol after the function block is executed, the present value in the device specified by the caller is sent to the symbol before the symbol sends the final operation result to the device. *. The data type of the symbol of the VAR_IN_OUT class in a function block in a project for an AH500 series PUC module can be POINTER. The caller can send the device address to the function block through the symbol whose data type is POINTER. Please refer to the following section for more information. Please refer to the function blocks below. FB_Var is the pin of the function block, and P_Var is the operand that the superior POU (caller) assigns to FB_Var. The data type of P_Var and that of FB_Var must conform to the basic principle described below. However, in order to make the writing of a program more convenient, ISPSoft provides some special principles. As long as the data type of P_Var and that of FB_Var conform to one of the special principles, the system will regard the data types as legal data types even if the data types does not conform to the basic principle. • Basic principle for the general data types The data type of P_Var must be the same as the data type of FB_Var. • Special principles for the general data types (Please refer to the following table.) 1. If either the data type of P_Var or the data type of FB_Var is WORD, DWORD, or LWORD, the data type of the other symbol can be WORD, DWORD, LWORD, INT, DINT, LINT, REAL, or LREAL. If this condition is met, the data length of P_Var can be larger than or equal to the data length of FB_VAR. 2. If the data type of P_Var is STEP, the data type of FB_Var can be BOOL. The state of the step in the caller will be used in the function block. FB_Var (function block) Data type WORD DWORD LWORD INT DINT LINT REAL LREAL BOOL WORD DWORD P_VAR (caller) LWORD INT DINT LINT 7-6

<strong>ISPSoft</strong> <strong>User</strong> <strong>Manual</strong><br />

Although the value of the symbol of the VAR_IN_OUT class will be sent to the device that the<br />

caller assigns to the symbol after the function block is executed, the present value in the device<br />

specified by the caller is sent to the symbol before the symbol sends the final operation result to<br />

the device.<br />

*. The data type of the symbol of the VAR_IN_OUT class in a function block in a project for an AH500 series PUC<br />

module can be POINTER. The caller can send the device address to the function block through the symbol<br />

whose data type is POINTER. Please refer to the following section for more information.<br />

Please refer to the function blocks below. FB_Var is the pin of the function block, and P_Var is the<br />

operand that the superior POU (caller) assigns to FB_Var. The data type of P_Var and that of<br />

FB_Var must conform to the basic principle described below. However, in order to make the<br />

writing of a program more convenient, <strong>ISPSoft</strong> provides some special principles. As long as the<br />

data type of P_Var and that of FB_Var conform to one of the special principles, the system will<br />

regard the data types as legal data types even if the data types does not conform to the basic<br />

principle.<br />

• Basic principle for the general data types<br />

The data type of P_Var must be the same as the data type of FB_Var.<br />

• Special principles for the general data types (Please refer to the following table.)<br />

1. If either the data type of P_Var or the data type of FB_Var is WORD, DWORD, or LWORD, the<br />

data type of the other symbol can be WORD, DWORD, LWORD, INT, DINT, LINT, REAL, or<br />

LREAL. If this condition is met, the data length of P_Var can be larger than or equal to the data<br />

length of FB_VAR.<br />

2. If the data type of P_Var is STEP, the data type of FB_Var can be BOOL. The state of the step<br />

in the caller will be used in the function block.<br />

FB_Var (function block)<br />

Data type<br />

WORD DWORD LWORD INT DINT LINT REAL LREAL BOOL<br />

WORD <br />

DWORD <br />

P_VAR<br />

(caller)<br />

LWORD <br />

INT <br />

DINT <br />

LINT <br />

7-6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!