Hitachi HIDIC MICRO-EH Applications Manual page 164

Table of Contents

Advertisement

Syntax of SB n, RTS, INT n and RTI
1] A subroutine can be programmed between a normal scan
and interrupt scan, between two interrupt scans, or after
the final interrupt scan.
Program head
Normal scan
END
Subroutine area
Interrupt
INT 1
scan
RTI
Subroutine area
Interrupt
INT 2
scan
RTI
Subroutine area
Program end
2] Program the subroutine start (SB n) and subroutine
end (RTS) instructions without specifying startup
conditions.
Startup
SB n
condition
Program
Startup
RTS
condition
3] Program the interrupt scan start (INT n) and scan complete
(RTI) instructions without specifying startup conditions.
Startup
INT n
condition
Program
Startup
RT1
condition
4] The same subroutine can be called from a normal scan,
interrupt scan or subroutine.
Program head
CAL 1
Normal scan
CAL 1
END
SB 2
Subroutine 2
CAL 1
RTS
SB 1
Subroutine 1
RTS
INI 0
Interrupt scan
CAL 1
RTI
SB 1
Subroutine 1
RTS
SB 2
Subroutine 2
RTS
SB 10
Subroutine 10
RTS
SB 11
Subroutine 11
RTS
SB 12
Subroutine 12
RTS
• The RTS startup condition error
will occur during operation pre-
processing.
5-114
Chapter 5 Instruction Specifications
5] It is also possible to program a subroutine with
multiple entry points and one exit.
SB 1
SB 2
SB 3
JMP 1
JMP 1
LBL 1
RTS
6] It is also possible to program a interrupt scan with
many entry points and one exit.
INT 0
INT 1
INT 2
JMP 1
JMP 1
LBL 1
RTI
7] Nesting of subroutines is allowed up to 5 levels.
1st level 2nd level 3rd level 4th level 5th level
SB 1
SB 20
SB 30
CAL 30
CAL 40
CAL 20
RTS
RTS
RTS
Program head
END
SB 20
(1) As shown to the left, the subroutine
RTS
program order and nesting order
SB 1
have no relationship.
RTS
INT 0
RTI
SB 40
RTS
SB 30
RTS
SB 50
RTS
SB 1
JMP 1
SB 2
JMP 1
SB 3
LBL 1
RTS
INT 0
JMP 1
INT 2
JMP 1
INT 1
LBL 1
RTI
SB 40
SB 50
CAL 50
RTS
RTS

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents