ESE 380 Lecture Notes - Lecture 12: Nested Function, Subroutine, Microcontroller

31 views11 pages

Document Summary

Subroutines reduce source program size and program memory required, enhanced modularity, aid in code reuse, and make it easier to design a program. A subroutine is a named sequence of instructions that performs a task. Instructions in a subroutine appear only once in the program. However, these instructions can be executed from multiple places in the program using an instruction that calls the subroutine. After a subroutine"s execution is complete, instruction execution flow automatically continues from the instruction following the call. The stack is a last-in-first-out (lif0) memory structure that is used primarily to support subroutine calls and interrupt service routines. For subroutines to be used a stack is required. A stack is a last-in-first-out (lifo) memory structure. Items can only be read from the stack in the reverse of the order in which they were entered. This existence of a stack is a requirement for supporting nested subroutines.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents