Hardware Reference
In-Depth Information
If you want to add the values of three memory locations at $1000, $1001, and $1002 and leave
the sum in accumulator A, you can use the following statement to invoke the previously de-
fi ned macro:
sumOf3 $1000,$1001,$1002
When processing this macro call, the assembler will insert the following instructions in the
user program:
ldaa
$1000
adda
$1001
adda
$1002
2.4 Software Development Issues
A complete discussion of issues involved in software development is beyond the scope of this
text. However, we do need to take a serious look at some software development issues because
embedded system designers must spend a significant amount of time on software development.
Software development starts with problem definition . The problem presented by the appli-
cation must be fully understood before any program can be written. At the problem definition
stage, the most critical thing is to get the programmer and the end user to agree on what needs to
be done. To achieve this, asking questions is very important. For complex and expensive applica-
tions, a formal, written definition of the problem is formulated and agreed on by all parties.
Once the problem is known, the programmer can begin to lay out an overall plan of how
to solve the problem. The plan is also called an algorithm . Informally, an algorithm is any
well-defined computational procedure that takes some value, or a set of values, as input and
produces some value, or a set of values, as output. An algorithm is thus a sequence of computa-
tional steps that transforms the input into the output. We can also view an algorithm as a tool
for solving a well-specified computational problem. The statement of the problem specifies in
general terms the desired input/output relationship. The algorithm describes a specific compu-
tational procedure for achieving that input/output relationship.
An algorithm is expressed in pseudocode which is very much like C or PASCAL. What
separates pseudocode from “real” code is that in pseudocode, we employ whatever expressive
method is most clear and concise to specify a given algorithm. Sometimes, the clearest method
is English, so do not be surprised if you come across an English phrase or sentence embedded
within a section of “real” code.
An algorithm provides not only the overall plan for solving the problem but also documen-
tation to the software to be developed. In the rest of this topic, all algorithms will be presented
in the following format:
Step 1
. . .
Step 2
. . .
An earlier alternative for providing the overall plan for solving software problems was the
use of flowcharts. A flowchart shows the way a program operates. It illustrates the logic flow
of the program. Therefore, flowcharts can be a valuable aid in visualizing programs. Flowcharts
are not only used in computer programming; they are also used in many other fields, such as
business and construction planning.
 
Search WWH ::




Custom Search