Create a timer interrupt which happens once every 104us. Make it relatively high priority.
During startup, intitalize the output pin for digital output and drive it high
From inside the interrupt call this:
C:
void SendUART() {
static int state = 0;
static char mask = 0;
static char data = 0;
switch (state) {
case 0: if (has_byte_to_send()) { // replace the call according to your needs; must be quick
OUTPUT = 0; // start bit
data = get_byte_to_send(); // replace the call according to your needs
state = 1;
mask = 1;
}
break;
case 1: OUTPUT = (data & mask) != 0; // data bit
mask <<= 1;
if (mask == 0) {
state = 2;
}
break;
case 2: OUTPUT = 1; // stop bit
state = 0;
break;
}
}