Mikroelektronika MIKROE-742 데이터 시트
The processed section can contain further conditional clauses, nested to any depth;
each
each
$IFDEF
must be matched with a closing
$ENDIF
.
Here is an example:
// Uncomment the appropriate flag for your application:
//{$DEFINE resolution10}
//{$DEFINE resolution12}
{$IFDEF resolution10}
// <code specific to 10-bit resolution>
{$ELSE}
{$IFDEF resolution12}
// <code specific to 12-bit resolution>
{$ELSE}
// <default code>
{$ENDIF}
{$ENDIF}
Include Directive $I
The
$I
parameter directive instructs mikroPascal PRO for AVR to include the named
text file in the compilation. In effect, the file is inserted in the compiled text right after
the
the
{$I filename}
directive. If filename does not specify a directory path, then, in
addition to searching for the file in the same directory as the current unit, mikroPas-
cal PRO for AVR will search for file in order specified by the search paths.
cal PRO for AVR will search for file in order specified by the search paths.
To specify a filename that includes a space, surround the file name with quotation
marks:
marks:
{$I "My file"}.
There is one restriction to the use of include files: An include file can't be specified
in the middle of a statement part. In fact, all statements between the begin and end
of a statement part must exist in the same source file.
in the middle of a statement part. In fact, all statements between the begin and end
of a statement part must exist in the same source file.
Predefined Flags
The compiler sets directives upon completion of project settings, so the user does-
n't need to define certain flags.
Here is an example:
n't need to define certain flags.
Here is an example:
{$IFDEF ATMEGA16} // If ATmega16 MCU is selected
{$IFDEF ATMEGA128} // IF ATmega128 MCU is selected
In some future releases of the compiler, the JTAG flag will be added also.
See also predefined project level defines.
178
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroPASCAL PRO for AVR
CHAPTER 5