Program Control Instructions; Entry And End Statements; Sub And End Sub Statements - Hitachi NT2021XA Instruction Manual

Easy-sequence programming software
Table of Contents

Advertisement

2.3

Program Control Instructions

This section explains the details of program control instructions.

entry and end statements

- Format
entry
end
- 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
entry
FW=
wait
stop
wait
end

sub and end sub statements

- Format
sub
<subroutine name>
end sub
- Explanation
The sub and end sub statements indicate the beginning and end of a subroutine, respectively.
<subroutine name>
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
sub
FW=
wait
stop
wait
end sub
Instructions to start and end the main program
Format
This instruction indicates the beginning of the main program.
(This instruction must be described at the top of the main program.)
This instruction indicates the end of the main program.
parameter1
parameter2
1
10.00
10.00
Instructions to start and end a subroutine
Format
This instruction indicates the beginning of a subroutine.
This instruction indicates the end of a subroutine.
Control is returned to the calling routine.
: Specifies the name of a called subroutine. This subroutine name is the first argument (branch
parameter1
parameter2
sub1
1
10.00
10.00
Description
parameter3
parameter4
parameter5
Description
parameter3
parameter4
parameter5
2-7
Chapter 2 Syntax
: The main program begins.
: Start forward rotation of the motor.
: Wait 10 seconds.
: Stop inverter output.
: Wait 10 seconds.
: The main program ends.
: Subroutine "sub1" begins.
: Start forward rotation of the motor.
: Wait 10 seconds.
: Stop inverter output.
: Wait 10 seconds.
: Subroutine "sub1" ends.

Advertisement

Table of Contents
loading

Table of Contents