My full code is located here.
Basically, I'm transmitting to an Arduino, and I'm not receiving the correct value (you'll notice I'm trying to send d'22'). Here's the method where I actually bit bang the transmission:
// Method for transmitting value using serial bit banging
void uart_tx_bit_bang(unsigned char val) {
unsigned char i;
Tx_Pin = 0; // Start bit
uart_time_delay();
for ( i = 8 ; i != 0 ; --i ) {
if (val & 0x01) Tx_Pin = 1; // Begin with LSB
else Tx_Pin = 0;
val >>= 1;
uart_time_delay();
}
Tx_Pin = 1; // Stop bit
uart_time_delay();
}
Since the delay should be 1/baud, uart_time_delay()
should be a 104us delay. I'm using __delay_us(104)
from the PIC libraries. Any help on this is greatly appreciated.
I'm positive that I'm using the correct baud rate on both ends.