Ответ: HI-TECH PICC-18 compiler 73 manual
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено Andrey_ 04 июня 2004 г. 12:16
В ответ на: А что такое bitset? отправлено Bill 04 июня 2004 г. 12:11

HI-TECH PICC-18 compiler 73
4.2.6 Bit Instructions
Wherever possible, PICC-18 will attempt to use the PIC18 bit instructions. For example, when using a
bitwise operator and a mask to alter a bit within an integral type, the compiler will check the mask value
to determine if a bit instruction can achieve the same functionality.
int foo;
foo |= 0x40;
Features and Runtime Environment
will produce the instruction
bsf _foo,6
To set or clear individual bits within integral types, the following macros could be defined and used.
#define bitset(var, bitno) ((var) |= 1 << (bitno))
#define bitclr(var, bitno) ((var) &= ~(1 << (bitno)))
To perform the same operation as the above example, the bitset macro could be employed as follows.
bitset(foo, 6);

Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru