October 2014
Intermediate to advanced
453 pages
13h 3m
English
Chapter 13
Subroutines, which are routines dedicated to focused or shorter tasks, occur in nearly all embedded code, often to perform initialization routines or to handle algorithms that require handcrafted assembly. You’re very likely to write subroutines when you come across a large problem to solve. The notion of divide-and-conquer aptly applies to writing assembly code—it’s just easier to get your head around a problem by describing it as a sequence of events, worrying about the low-level details when you write the event itself. For example, you could break a large program that controls a motor into something that looks like
main BL ConfigurePWM
BL GetPosition
BL CalcOffset
BL MoveMotor
...
Read now
Unlock full access