Last active
August 29, 2015 13:58
-
-
Save ibanezmatt13/10010594 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
// note, rtty_txbit() function will be replaced by directly operating pins, just using to save space for now | |
current_byte = "E"; | |
ISR(TIMER1_COMPA_vect) | |
{ | |
if (current_bit_count == 0){ // if we're about to send a new byte... | |
rtty_txbit(0); // tx a start bit | |
} | |
else if (current_bit_count == 8){ // if we've sent all the bits in the byte | |
current_bit_count = 0; // reset bit count for next byte transmission | |
// send two stop bits | |
rtty_txbit(1); | |
rtty_txbit(1); | |
} | |
else { | |
if (current_byte & 1){ // if the first bit of current_byte is a 1... | |
rtty_txbit(1); | |
} | |
else { | |
rtty_txbit(0); | |
} | |
current_bit_count++; | |
current_byte = current_byte << 1; // shift all bits in byte by 1 so first bit of byte is actually the next bit | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment