added atomic blocks
made transmit fifo pointer volatile