366 A. PROGRAMMING
comment. A multi-line comment can be constructed using a /∗ at the beginning of the comment
and a ∗/ at the end of the comment.
At the beginning of the program, comments may be extensive. Comments may include some
of the following information:
• ﬁle name
• program author
• revision history or a listing of the key changes made to the program
• compiler setting information
• hardware connection description to microcontroller pins
• program description
A.3.2 INCLUDE FILES
Often you need to add extra ﬁles to your project besides the main program. For example, most
compilers require a “personality ﬁle” on the speciﬁc microcontroller that you are using. This ﬁle is
provided with the compiler and provides the name of each register used within the microcontroller.
It also provides the link between a speciﬁc register’s name within software and the actual register
location within hardware.These ﬁles are typically called header ﬁles and their name ends with a “.h”.
Within the C compiler, there will also be other header ﬁles to include in your program such as the
“math.h” ﬁle when programming with advanced math functions.
To include header ﬁles within a program, the following syntax is used:
In the top down design, bottom up implementation approach to a microcontroller based project
including both hardware and software, the project is partitioned into systems, subsystems, etc. The
idea is to take a complex project and break it into doable pieces with a deﬁned action.
We use the same approach when writing computer programs. At the highest level is the main
program which calls functions that have a deﬁned action. When a function is called, program control
is released from the main program to the function. Once the function is complete, program control
reverts back to the main program.