|
发表于 2016-10-15 07:09:18
|
显示全部楼层
/* The _BV() is a compiler macro defined as #define _BV( bit ) ( 1<<(bit) ) in
<avr/sfr_defs.h> which was included already indirectly through <avr/io.h>.
It stands for Bit Value where you pass it a bit and it gives you the byte value
with that bit set.
As we seen already, in the C language one assigns and tests bits using bit
operators, the assign operator, and the concept of bit masks: */
PORTC |= 0x01; // Set bit 0 only.
PORTC &= ~0x01; // Clear bit 0 only.
PORTC ^= 0x01; // Toggle bit 0 only.
PORTC & 0x01; // Test bit 0 only.
PORTC |= 0x80; // Set bit 7 only.
|
|