Specifications

http://www.mikroelektronika.co.yu/english/product/books/PICbook/4_Poglavlje.htm
At the end of the "list" file there is a table of symbols used in a program. Useful element of 'list'
file is a graph of memory utilization. At the very end, there is an error statistic as well as the
amount of remaining program memory.
Macros
Macros are a very useful element in assembly language. They could briefly be described as "user
defined group of instructions which will enter assembler program where macro was called". It is
possible to write a program even without using macros. But with their use written program is
much more readable, especially if more programmers are working on the same program together.
Macros have the same purpose as functions of higher program languages.
How to write them:
<label> macro [<argument1>,<argument2>,......<argumentN>]
........
.......
endm
From the way they were written, we could be seen that macros can accept arguments, too which
is also very useful in programming. Whenever argument appears in the body of a macro, it will be
replaced with the <argumentN> value.
Example:
The above example shows a macro whose purpose is to place on port B the ARG1 argument that
was defined while macro was called. Its use in the program would be limited to writing one line:
ON_PORTB 0xFF , and thus we would place value 0xFF on PORTB. In order to use a macro in the
program, it is necessary to include macro file in the main program with instruction include
"macro_name.inc". Contents of a macro is automatically copied onto a place where this instruction
was written. This can be best seen in a previous list file where file with macros "bank.inc" was
copied below the line #include"bank.inc"
Previous page Table of contents Chapter overview Next page
© Copyright 1999. mikroElektronika. All Rights Reserved. For any comments contact webmaster.
http://www.mikroelektronika.co.yu/english/product/books/PICbook/4_Poglavlje.htm (15 of 15) [4/2/2003 16:18:11]