EasyManua.ls Logo

FATEK FBs-2DA - Page 214

FATEK FBs-2DA
348 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Advanced Function Instruction
7-50
FUN 67 P
CALL
CALL
FUN 67 P
CALL
LBL : The subroutine label name to be called.
z When call control “EN”=1 or “EN” ( P instruction) changes from 01, PLC will call (perform) the
subroutine bear the same label name as the one being called. When execute the subroutine, the program
will execute continuous as normal program does but when the program encounter the RTS instruction then
the flow of the program will return back to the address immediately after the CALL instruction.
z All the subroutines must end with one “return from
subroutine instruction RTS” instruction; otherwise it
will cause executing error or CPU shut down.
Nevertheless, an RTS instruction can be shared by
subroutines (so called as multiple entering
subroutines; even though the entry points are
different, they have a same returning path) as
illustrated in the right diagram subroutine SUB13.
z When main program called a subroutine, the
subroutine also can call the other subroutines (so
called the nested subroutines) for up to 5 levels at
the most (include the interrupt routine).
1X
2X
3X
4X
5X
RTS
RTS
RTS
RTS
Main program area
Subroutine area
CALL SUB1
LBL SUB1
CALL SUB2 CALL SUB3
CALL SUB4
LBL SUB2
LBL SUB3
LBL SUB4
65
LBL
SUB1
Program 1
65
LBL
SUB2
Program 2
66
JMP
SUB3
65
LBL
SUB3
Program 3
68
RTS
SUB3
SUB2
+
SUB1
z Interrupt service programs HSC0IHSC7IPSO0IPSO3IX0+IX15+IINT0INT15X0IX15I
INT0INT15HSTAIATMRI1MSI1MS2MSI2MS3MSI3MS4MSI4MS5MSI5MS
10MSI10MS50MSI50MS100MSI100MS are also a kind of subroutine. It is also placed in sub
program area. However, the calling of interrupt service program is triggered off by the signaling of
hardware to make the CPU perform the corresponding interrupt service program (which we called as the
calling of the interrupt service program). The interrupt service program can also call subroutine or
interrupted by other interrupts with higher priority. Since it is also a subroutine (which occupied one level),
it can only call or interrupted by 4 levels of subroutine or interrupt service program. Please refer to RTI
instruction for explanation.

Other manuals for FATEK FBs-2DA

Related product manuals