Created
May 16, 2015 18:39
-
-
Save dranger003/c057bed0708b3aa470b0 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
// 1 cycle = 62.5ns | |
int main() | |
{ | |
DDRD |= _BV(3); | |
PORTD &= ~_BV(3); | |
for (;;) | |
{ | |
PORTD ^= _BV(3); // 5 cycles | |
if (PORTD & _BV(3)) // 2 cycles | |
{ | |
__asm__("nop\n\t"); // 1 cycle | |
_delay_loop_1(44); // 3 cycles per | |
} | |
else // 1 cycle | |
{ | |
_delay_loop_1(91); // 3 cycles per | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment