ABSTRACT

This chapter identifies the importance of subroutines, and discusses various assembly instructions that enable the programmer to move away from sequential execution. A control statement in a program is equivalent to a diamond symbol. A control statement has the ability to change the computer’s control from automatically reading the next line of code to reading a different one. The chapter aims to understand the basic concepts of control structures and subroutines using HC11 instructions. The chapter introduces the concept of stack, and its role in subroutines. It provides some of the frequently used BUFFALO utility subroutines. Recall that a microcontroller operates by moving data from memory into its internal registers, processing them, and then copying it back into memory. Generically, the term subroutine can be used to denote a piece of code, separate from the main body, fulfilling a discrete task. For example, a program might refer to time-delay subroutines.