Chapter 2 Syntax
2-7
2.3 Program
Control
Instructions
This section explains the details of program control instructions.
entry and end statements
Instructions to start and end the main program
- Format
Format
Description
entry
This instruction indicates the beginning of the main program.
(This instruction must be described at the top of the main program.)
end
This instruction indicates the end of the main program.
- Explanation
The entry and end statements indicate the beginning and end of the main program, respectively. Each program always
requires these instructions.
- Sample program
Label
Mnemonic
parameter1
parameter2
parameter3
parameter4
parameter5
㩷
㩷
entry
㩷
㩷
㩷
㩷
㩷
: The main program begins.
㩷
㩷 䋺㩷
㩷
㩷
㩷
㩷
㩷
㩷
FW= 1
㩷
㩷
㩷
: Start forward rotation of the motor.
㩷
wait 10.00
㩷
㩷
㩷
㩷
: Wait 10 seconds.
㩷
stop
㩷
㩷
㩷
㩷
㩷
: Stop inverter output.
㩷
wait 10.00
㩷
㩷
㩷
㩷
: Wait 10 seconds.
㩷
㩷 䋺㩷
㩷
㩷
㩷
㩷
㩷
㩷
end
㩷
㩷
㩷
㩷
㩷
: The main program ends.
sub and end sub statements
Instructions to start and end a subroutine
- Format
Format
Description
sub
<subroutine name>
This instruction indicates the beginning of a subroutine.
end sub
This instruction indicates the end of a subroutine.
Control is returned to the calling routine.
- Explanation
The sub and end sub statements indicate the beginning and end of a subroutine, respectively.
<subroutine name>
: Specifies the name of a called subroutine. This subroutine name is the first argument (branch
destination) of the call instruction in the calling routine.
Note : Subroutines can be nested in up to eight layers. A subroutine programmed with a structured instruction (i.e.,
sub, for, while, until, select, or ifs) is counted as one nesting layer. Therefore, when a for-next loop statement
is described in a subroutine, there are two nesting layers.
- Sample program
Label
Mnemonic
parameter1
parameter2
parameter3
parameter4
parameter5
㩷
㩷
sub sub1
㩷
㩷
㩷
㩷
: Subroutine "sub1" begins.
㩷
㩷 䋺㩷
㩷
㩷
㩷
㩷
㩷
㩷
FW= 1
㩷
㩷
㩷
: Start forward rotation of the motor.
㩷
wait 10.00
㩷
㩷
㩷
㩷
: Wait 10 seconds.
㩷
stop
㩷
㩷
㩷
㩷
㩷
: Stop inverter output.
㩷
wait 10.00
㩷
㩷
㩷
㩷
: Wait 10 seconds.
㩷
㩷 䋺㩷
㩷
㩷
㩷
㩷
㩷
㩷
end sub
㩷
㩷
㩷
㩷
㩷
: Subroutine "sub1" ends.
Summary of Contents for NT2021XA
Page 4: ... Safety Instructions ...
Page 8: ... Contents ...
Page 10: ...Chapter 1 Outline of EzSQ ...
Page 14: ...1 4 Chapter 1 Outline of EzSQ ...
Page 16: ...Chapter 2 Syntax ...
Page 68: ...2 52 Chapter 2 Syntax ...
Page 70: ...Chapter 3 Interface with the Inverter ...
Page 80: ...3 10 Chapter 3 Interface with the Inverter ...