Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
PIC Program Development 77 The address of the instruction following (in this case `GOTO start') is saved automatically on the stack as part of the execution of the CALL instruction. The subroutine is terminated with the instruction `RETURN', which does not require an operand because the return destination address is automatically pulled from the stack and replaced in the program counter. This takes the program back to the original place in the main program. The PIC 16 stack can store up to eight return addresses, so multiple levels of subroutine can be used. The return addresses are pushed onto and pulled from the stack in order, so if a CALL or RETURN is missed out of the program, a stack error will occur. Unfortunately, this mistake will not be detected by the assembler, but will cause a run-time error message. 4.5.7. End of Source Code END The source code must be terminated with assembler directive END so that the assembly process can be stopped in an orderly way, and control returned to the host operating system. It is the only assembler directive that is essential.