3-261
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
Storage Format used in Macro Variable
Create a Macro program with basic arithmetical function in the following figure.
Read 2 signed data from LW0 and LW1, make LW0 divided by LW1, then place the result of the division
in the 4 words from LW2 to LW5.
Press the (Add Macro) icon in the database toolbar, or click [Macro] in the [Option] menu, then the
following dialog box will pop up.
Select the PT No. and input the file name, then click “OK” to enter the Macro Editing Window (i.e.
[macro_0.c]), as shown below.
Data Type Data length Descriptions
Bool 1bit Bit variable with 2 statuses of 0 and 1.
(Signed) char 1byte(8bit) Signed short-integer variable with a range of -128 to 127.
Unsigned char 1byte(8bit) Unsigned short-integer variable with a range of 0 to 255.
(Signed) short 1word (16bits) Signed short-integer variable with a range of -32768 to 32767.
Unsigned short 1word (16bits) Unsigned short-integer variable with a range of 0 to 65535.
(Signed) int 2word (32bits) Signed-integer variable with a range of -2147483648 to
2147483647.
Unsigned int 2word (32bits) Unsigned-integer variable with a range of 0 to 4294967295.
Float 2word (32bits) Single-precision floating-point variable with a range of
-3.4E+38 to +3.4E38
Double 4word (64bits) Double-precision floating-point variable with a range of
-1.79E+308 to +1.79E+308