3-267
3 Functions of NB-Designer
NB-series Programmable Terminals NB-Designer Operation Manual(V106)
3-9 Mac
ro F
unc
tion
3
3-9-2 Ma
cro and Specification
of Op
er
ation
with
Read/Wr
ite V
ar
iab
les
In this part, we will provide the description about specification of the operating Macro, and we will also
provide the description that should be noted when you use Macro.
The Macro can be regarded as a black box for input and output. Taking the example of the division
program which was mentioned in the first part of this section, the flow of the procession is as follows:
The specification of the operation is as follows: Before the program is executed, the value from the
memory for LW0 and LW1 will be assigned to Read variables LW0_R and LW1_R, then Macro will be
executed. Later, after Macro function returns, the value of variable LW2_W will be written into LW2.
Therefore, the variables of the Macro performs like the copy of the memory and even if the variables are
modified, the value of the memory is not be changed.
Note 1
Since the read variables do not read the memory value during executing the Macro, the read value remain
the same as the one when the Macro read during operating. Even if the memory value is modified from the
external device during the Macro executing, result of the operation is not be affected.
2
Even if the memory value is written with a value from the external device during the Macro executing, the
memory value will be updated to the result of the execution of the Macro after the Macro completed.
3
The read variable is read only and the write value is write only. Therefore, writing the value to the read vari-
able or reading the writing variable by using the Macro are not impossible. Similarly, when one address is
used for reading and writing at the same time, use two different names by contrast for the variables such
as LW0_R and LW0_W for LW0.
4
The global variables or the static variables are not available in the Macro. If the data should be retained
using the global variables, use the PT internal memories such as LW or LB.
5
The values which output the result of the Macro should be prepared.
The description of the other functions are provided as follows.
(a) Modify or delete the variable in Macro.
Open the [Project File Window] and double-click the Macro file corresponded to open the [Macro
Variables Table] dialog box. Right-click the variable to select [Delete variable] or [Modify Variable].
Please be careful because the deleted variables can’t be restored.
(b) Delete the whole Macro file.
Open the Project File Window, press “Delete” key after selecting the corresponding Macro file.
Please be careful because the deleted Macro files can’t be restored.
3-9-2
Macro and Specification of Operation with Read/Write Variables
Read variable
(Read only)
LW0_R
LW1_R
Write variable
(Write only)
LW2_W
Macro
int MacroEntry()
{
If(LW1_R!=0)
LW2_W=(double)(LW0_R)/LW1_R,
Return 0;
}
Right-click the variable
to select [Delete variable]
or [Modify Variable]
Select and press
“Delete” key.
Содержание NB10W-TW01B
Страница 4: ......
Страница 10: ...Terminology 6 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 448: ...3 Functions of NB Designer 3 406 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 450: ...3 Functions of NB Designer 3 408 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 462: ...4 Functions of NBManager 4 10 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 472: ...4 Functions of NBManager 4 20 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 482: ...5 Maintenance and Abnormality Handling 5 10 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 528: ...8 Web Interface 8 10 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 544: ...Appendices A 16 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 546: ...Revision 2 NB series Programmable Terminals NB Designer Operation Manual V106 ...
Страница 547: ......