Beginner’s Guide to Programming: Lesson 3
Once the mode is set,
make sure you save your settings as shown in Figure 5.
The LookUp command
will allow you to create a
lookup table. For instance,
let’s say you need to return a
particular value based on a number
between 0 and 10. Looking at Figure 6,
you can see that the first argument is the
result variable in which you wish to place
the looked up value. The next argument
is the actual index in the range of 0-255.
You then supply a list of lookup values.
Each of these values maps to the index.
For instance, the first lookup value maps
to 0 and the next to 1, and so on.
If a lookup value is not found for
the index supplied, the original value
will not be changed.
The Paste button will paste the actual
command shown in the Usage field into
your code at the current cursor position.
it is used with other commands, like the
Branch command as shown in Figure 9.
By using the LookDown command first,
we can create an index off of any
range of numbers. The index can then
be used to perform a jump using the
You can get full syntax help for any of
the Athena commands by hitting F8 on
any Edit Form. All the available commands
for the current difficulty mode will be
displayed on the left as shown in Figure 7.
When you select one of the commands,
the syntax, description, and a code
example will be displayed on the bottom.
The LookDown command works
about the same as the LookUp command
in the way that you supply the arguments; however, it takes a second argument and performs a search against all
the table entries. When it finds a match,
it returns the index of the item found.
In the example shown in Figure 8, the
seventh element is matched so a value
of 6 is returned. Remember that the
command is zero-based, so the first element will return
a zero and the
second will return
one, and so on.
The real power
of the LookDown
command is when
Many microcontrollers and
compilers have support for Character
LCDs and the Athena is no exception.
First, in order to see the results of your
LCD commands, you need to activate
the LCD in the simulator. This is
done by selecting the Show LCD option
in the Watch menu on the chip
SERVO 09.2007 47