MikroElektronika PIC Microcontrollers PIC16 Uživatelský manuál Strana 43

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 172
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 42
Symbol makes possible to replace expression with a single identifier alias. Use of
symbols increases the reusability and flexibility of code.
BASIC syntax restricts you to single line expressions, allowing shortcuts for con-
stants, simple statements, function calls, etc. Scope of symbol identifier is a whole
source file in which it is declared.
Symbol is declared as:
symbol alias = single_line_expression
where alias must be a valid identifier which you will be using throughout the
code.
Using a symbol in a program technically consumes no RAM memory - compiler
simply replaces each instance of a symbol with the appropriate code from the dec-
laration.
symbol MaxAllowed = 234
' symbol as alias for numeral
symbol PORT = PORTC
' symbol as alias for SFR
symbol DELAY1S = delay_ms(1000)
' symbol as alias for proc. call
if teA > MaxAllowed then
teA = teA - 100
end if
PORT.1 = 0
DELAY1S
...
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
38
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
SYMBOLS
Symbols
and PIC
Example
Zobrazit stránku 42
1 2 ... 38 39 40 41 42 43 44 45 46 47 48 ... 171 172

Komentáře k této Příručce

Žádné komentáře