E eng1 New Member Aug 14, 2007 #21 What about checking the TRMT bit? Code: TXRDY: bsf STATUS,RP0 ; bank 1 Wait: btfss TXSTA, TRMT ; transmission complete? goto Wait bcf STATUS,RP0 ; bank 0 Send: movwf TXREG ; send data return I would also provide a short delay after initialization of the USART module...
What about checking the TRMT bit? Code: TXRDY: bsf STATUS,RP0 ; bank 1 Wait: btfss TXSTA, TRMT ; transmission complete? goto Wait bcf STATUS,RP0 ; bank 0 Send: movwf TXREG ; send data return I would also provide a short delay after initialization of the USART module...
ericgibbs Well-Known Member Most Helpful Member Aug 14, 2007 #22 Nigel Goodwin said: Why two goto's?. Change the BTFSC to BTFSS and delete the GOTO XMIT1 Here are the routines from my RS232 tutorial. Code: XMIT_RS232 btfss PIR1, TXIF ;xmit buffer empty? GOTO XMIT_RS232 ;no, wait MOVWF TXREG ;now send RETURN Rcv_RS232 BTFSS PIR1, RCIF ; check for received data GOTO Rcv_RS232 MOVF RCREG, W RETURN Click to expand... hi, Quite right, clumsy coding Eric
Nigel Goodwin said: Why two goto's?. Change the BTFSC to BTFSS and delete the GOTO XMIT1 Here are the routines from my RS232 tutorial. Code: XMIT_RS232 btfss PIR1, TXIF ;xmit buffer empty? GOTO XMIT_RS232 ;no, wait MOVWF TXREG ;now send RETURN Rcv_RS232 BTFSS PIR1, RCIF ; check for received data GOTO Rcv_RS232 MOVF RCREG, W RETURN Click to expand... hi, Quite right, clumsy coding Eric
Gayan Soyza Active Member Aug 14, 2007 #23 eng1 said: What about checking the TRMT bit? Code: TXRDY: bsf STATUS,RP0 ; bank 1 Wait: btfss TXSTA, TRMT ; transmission complete? goto Wait bcf STATUS,RP0 ; bank 0 Send: movwf TXREG ; send data return I would also provide a short delay after initialization of the USART module... Click to expand... Bente Petersen using the same technic
eng1 said: What about checking the TRMT bit? Code: TXRDY: bsf STATUS,RP0 ; bank 1 Wait: btfss TXSTA, TRMT ; transmission complete? goto Wait bcf STATUS,RP0 ; bank 0 Send: movwf TXREG ; send data return I would also provide a short delay after initialization of the USART module... Click to expand... Bente Petersen using the same technic
imhereithink New Member Aug 14, 2007 #24 Finally got it working , i used the xmit subroutine from Nigel and it works perfectly. Thanks guys for all the help
Finally got it working , i used the xmit subroutine from Nigel and it works perfectly. Thanks guys for all the help
F flemmard New Member Sep 22, 2007 #25 ericgibbs said: hi, I use this subr on all my PIC prgms with no problems ;---- SERIAL UART ---- ; Hardware Serial Communication Routines TXRDY: BTFSC PIR1,TXIF GOTO XMIT1 GOTO TXRDY;busy,so loop XMIT1: MOVWF TXREG;send RETURN Are you sure that the receiving PC is OK? Eric Click to expand... Hi, You hav any routine for PIC C to do serial communication? Thanks
ericgibbs said: hi, I use this subr on all my PIC prgms with no problems ;---- SERIAL UART ---- ; Hardware Serial Communication Routines TXRDY: BTFSC PIR1,TXIF GOTO XMIT1 GOTO TXRDY;busy,so loop XMIT1: MOVWF TXREG;send RETURN Are you sure that the receiving PC is OK? Eric Click to expand... Hi, You hav any routine for PIC C to do serial communication? Thanks
Nigel Goodwin Super Moderator Most Helpful Member Sep 22, 2007 #26 flemmard said: Hi, You hav any routine for PIC C to do serial communication? Thanks Click to expand... I would expect any C compiler to have built-in routines for serial operations?.
flemmard said: Hi, You hav any routine for PIC C to do serial communication? Thanks Click to expand... I would expect any C compiler to have built-in routines for serial operations?.