This header provides a set of general purpose handy macro. In the following, reg denotes a 8 bit signed or unsigned integer, and bit a bit number (0 bit
7).
macro.h is not part of the ANSI standard.
Macro | Role |
BIT_1(reg, bit) |
Set bit bit of reg variable |
BIT_0(reg, bit) |
Reset bit bit of reg variable |
BIT_TST(reg,bit) |
Return true if bit bit of reg is set. |
BIT_TOGGLE(reg, bit) |
Toggle bit bit of reg |
BIT_COPY(treg, tbit, sreg, sbit) |
Copy bit sbit of sreg to bit tbit of treg |
BIT_NCOPY(treg, tbit, sreg, sbit) |
Copy inverse of bit sbit of sreg to bit tbit of treg |
BIT_WRITE(treg, tbit, flag) |
Copy the boolean value flag to bit tbit of treg |
NOP |
Generate a nop asm instruction |
CLEAR_WATCHDOG |
Generate a clrwdt asm instruction |
Notice that the bit-oriented macros are made obsolete since V0.7.0 due to the availability of bit fields.