Specifications

93
allow a series of commands to be invoked by a single command. The two main
advantages of this are to speed up the display and to reduce the space needed
in the host processor to store the commands. Macros can have parameters
associated with them so that a general purpose macro can be used in different
ways on several screens. For example if we created a macro to have buttons for
the user to raise and lower temperature and relative humidity with a display of
current temperature and relative humidity conditions between the buttons, we
could associate parameters as to where to draw this on the screen. This would
save us time when programming because we could reuse the drawing on every
screen simply by calling the macro and specifying where to place it on that
particular screen. Macros can also be linked to specific buttons so that when the
button is pressed a single macro can be called that creates the new screen that
the user expects. The macro files can be created by using applications such as
notepad and can be saved as an ASCII text file. The use of this file format allows
the macro definition file to be used to both load the macros into the SLCD5 flash
memory and to be used as a “C” include file in the program that runs the
microcontroller. This allows the one macro file to be used on both ends and
therefore avoids any potential confusion with macro index numbers. The
following example shows the general format for a macro file.
#define <text_name><number>
(one or more command lines)
.
.
#end
The only use of the <text_name> identifier is to provide the C program with a
reference to include the macro file in the library. The <number> argument is 1 for
the first macro, 2 for the second, and so on. The macros must be listed in
increasing index order.
There are some limitations associated with the use of macros. The limitations on
macro commands associated with firmware version 2.3.0 and above are as
follows:
Macros have the ability to call other macros, but the maximum call depth is 4.
The maximum number of arguments allowed per macro is 4.
The maximum characters per argument are 8.
The maximum number of stored arguments is 50.
In order to parameterize macros, the escape sequences „0‟, „1‟, „2‟, „3‟ in the
command lines. When the programmer invokes the macro, they supply
arguments to replace the escape sequences. For example the following is a
macro definition: