Declaration of Variables
(Original Document)
At a Glance
All of the variables used in the different sections of the program must be declared.
Undeclared variables cannot be used in the program.
NOTE: For more information, refer to chapter Data Editor.
Procedure for Declaring Variables
The table below shows the procedure for declaring application variables:
Step
Action
1
In Project Browser / Variables & FB instances, double-click on Elementary Variables
2
In the Data Editor window, select the box in the Name column and enter a name for your first variable.
3
Now select a Type for this variable.
4
When all your variables are declared, you can close the window.
Variables Used for the Application
The following table shows the details of the variables used in the application and declared in the project associated with the PLC X:
Variable
Type
Definition
Adr_Char
STRING
Master PLC serial port address.
Adr_modbus
STRING
Modbus Slave PLC serial channel address (channel 0 of BMX NOM 0200 module).
AnsString1
STRING
First modem answer character string.
AnsString2
STRING
Second modem answer character string.
AnsString3
STRING
Third modem answer character string.
Error
INT
Function error code.
Function_Step
INT
Function step.
MngtInput
ARRAY[0..3] of INT
Array of the communication parameters for the INPUT_CHAR block.
MngtPrint
ARRAY[0..3] of INT
Array of the communication parameters for the PRINT_CHAR block.
MngtWrite
ARRAY[0..3] of INT
Array of the communication parameters for the WRITE_VAR block.
nb_charac_to_receive_connect
INT
Number of character to receive: modem connexion
nb_charac_to_receive_ok
INT
Number of character to receive: modem confirmation message
ReqString
STRING
Modem answer.
Start
EBOOL
Starting mode (signal coming from channel 0 of the BMX DDI 1602 module).
Serial_Port
T_COM_MB_BMX
Serial port I/O object
Test_inc
INT
Incrementation value
The following screen shows the application variables created using the data editor:
Declaring an Array Type
Before declaring an Array type, click on Tools/Project Settings/Variables then check "Directly represented array variables" and "Allow dynamic arrays"
The following table shows how to declare an Array type:
Step
Action
1
In the ProjectBbrowser, click on Variables & FB instances.
2
Click in the Name column and enter a name for the variable.
3
Double-click in the Type column and then click on the button.
The Variable Type Selection window opens:
4
Choose the desired variable type (for example, click on <EDT> and select INT), then click into the Array checkbox.
5
Modify the intervalle, then confirm with OK.
Declaration of I/O Objects
For declaring I/O Derived Variables, open the Variable Type Selection window as described in the above procedure and click on <Catalog> to access the <IODDT> type variables (select T COM MB BMX for example), then confirm with OK.