Abl-electronic PIC Microcontrollers PIC16 Manual do Utilizador Página 135

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 312
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 134
A macro won’t be expanded during its own expansion (so #define MACRO
MACRO
won’t expand indefinitely).
Let’s have an example:
/* Here are some simple macros: */
#define ERR_MSG "Out of range!"
#define EVERLOOP for( ; ; )
/* which we could use like this: */
main() {
EVERLOOP {
...
if (error) {Lcd_Out_Cp(ERR_MSG); break;}
...
}
}
Attempting to redefine an already defined macro identifier will result in a warning
unless the new definition is exactly the same token-by-token definition as the
existing one. The preferred strategy where definitions might exist in other header
files is as follows:
#ifndef BLOCK_SIZE
#define BLOCK_SIZE 512
#endif
The middle line is bypassed if BLOCK_SIZE is currently defined; if BLOCK_SIZE
is not currently defined, the middle line is invoked to define it.
MikroElektronika:
Development
tools
-
Books
-
Compilers
127
page
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
Vista de página 134
1 2 ... 130 131 132 133 134 135 136 137 138 139 140 ... 311 312

Comentários a estes Manuais

Sem comentários