PicChristmas
New Member
Could anyone tell me why I have to wait for 0.6 seconds for a charater to be sent? If the delays are not used the direction of the RS485 chip has switched back to Rx and the Tx data is lost.
I am using a 18F2420 PIC at 40 mhz with the buad set at 57.6 with TXSTA = b'00100100' and RCSTA = b'10010000'
I am using a 18F2420 PIC at 40 mhz with the buad set at 57.6 with TXSTA = b'00100100' and RCSTA = b'10010000'
Code:
bsf PORTC, 0x1, ACCESS ; set RS485 direction to XMT
bsf PORTC, 0x2, ACCESS ; turn off LED
movlw char
movwf TXREG
btfss PIR1, 0x4 ; Write only if TXREG is ready
bra $ - 2
call Delay ; 0.2 seconds
call Delay ; 0.2 seconds
call Delay ; 0.2 seconds
bcf PORTC,0x2, ACCESS ; turn on LED
bcf PORTC, 0x1, ACCESS ; set RS485 direction to RCV
return