What exactly are you trying to do?
Bitbang.
Works OK with select case but not with posted code.
Need to get each bit from a send byte and set pin to TX or
read a pin and set a bit in receive byte to RX.

I would do the increment from 0 to 7
Bitbang sends/reads bit 7 first.

Norm