8.6.1 _BV macro
A macro that allows bit operations.
Include
<avr/sfr_defs.h>
Prototype
void _BV(bit_number);
Remarks
This macro converts a bit number into a byte value, thus allowing you to access bits within an address.
The compiler will use a hardware sbi
or cbi
instruction to perform the access if appropriate, or a read or write operation
otherwise.
Example
#include <xc.h>
#include <avr/sfr_defs.h>
int main(void)
{
PORTB |= _BV(PB1); // set bit #1 of PORTB
EECR &= ~(_BV(EEPM4) | _BV(EEPM5)); // clear bits #4 and #5 in EECR
}