3-263
3 Functions of NB-Designer
NB-series Programmable Terminals NB-Designer Operation Manual(V106)
3-9 Macro Function
3
3-9-1 Create a Simple Macro Program
In the example below, the Properties of LW0_R are set as follows:
Here, specify “signed int.” from “Storage Format”, “Read” from “R/W”, “LW” from “Area” and “0” from
“Address” respectively. After the specification, click the “OK” button, then this variable will be seen in
“Macro Variable Table [macro_0.c]” window.
Note The variables used in the Macro are necessary to be registered to the [Macro Variables Table] in advance.
Specify LW1_R and make its address to LW1, then set the address of LW2_W to LW2 by the same
method.
Note When the Storage Format is set to “double”, the Word Length will automatically become 4, i.e. this variable
will occupy LW2 to LW5.
After the completion of setup, the “Macro Variable Table [macro_0.c]” window is shown as below:
After defining the variables, we should write the following Macro:
int MacroEntry()
{
//LW0 is divided by LW1and LW2 is obtained
LW2_W=LW0_R/LW1_R;
return 0;
}
Once it is saved, the simple Macro is completed. At this time, go to the Edit Window to make the
editions as shown below:
Place 2 Number Input components corresponding to LW0 and LW1 respectively;
Place 1 text component and enter “/” to represent division.
Place 1 Number Display component corresponding to LW2, and set the Storage Format to “double” (i.e.
double-precision floating-point) and both the Integer and Decimal to “4”;