I was just looking at the function you wrote and in this line:
PORTAbits.RA3 = (txdata > 127); // Copy bit 7 of txdata to RA3 (MOSI)
I've never seen an argument like this before, wish this was something my professors taught me, very useful. Can you apply this to select out certain bits, like...