Last active
August 29, 2015 14:14
-
-
Save NearLinHere/f98c2ac6a73ca4abbf16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
PORTC |= (_BV(0) | _BV(1) | _BV(2)); // Set bits 0, 1, 2 | |
PORTC &= ~(_BV(3) | _BV(4) | _BV(5)); // Clear bits 3, 4, 5 | |
PORTC ^= (_BV(6) | _BV(7)); // Toggle bits 6, 7 | |
//without using MACRO _BV() would looks like this | |
PORTC |= ((1 << 0) | (1 << 1) | (1 << 2)); // Set bits 0, 1, 2 | |
PORTC &= ((1 << 3) | (1 << 4) | (1 << 5)); // Clear bits 3, 4, 5 | |
PORTC ^= ((1 << 6) | (1 << 7)); // Toggle bits 6, 7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment