A
[email protected]
- Jan 1, 1970
- 0
Hi everyone,
I am having a big trouble with my PIC's serial communication. I have
codes like these:
GPS:
CALL set4800
A0: CALL RCread
CALL TXsend
XORLW 'G'
BNZ A0
MOVLW 0XFF
MOVWF PORTA
RETURN
I have incoming messages and I want to take the one which starts
with 'G', so I write these simple codes. Althoug I have sentences which
starts with 'G', PortA never gets FF. I tried these codes with Proteus
and it works. But it doesnt work with my pic16f877 in my circuit. From
TX output I get the bytes which I sent from RC, I see that there are
G's in RC but they dont make the port A to be FF. Please hellllppppp
me.
Here are my functions:
RCread: bcf STATUS,RP0 ; Select Bank 0.
getc1 btfss PIR1,RCIF ; Skip if RC int flag set
goto getc1 ; Try again
movf RCREG,W ; Read the character
bcf PIR1,RCIF ; Clear the interrupt flag
return
TXsend bcf STATUS,RP0 ; Select Bank 0.
putc1 btfss PIR1,TXIF ; Skip if TXbuffer empty
goto putc1 ; Try again
movwf TXREG ; Write it!
bcf STATUS,RP0 ; Select Bank 0.
return
set4800: bsf STATUS,RP0
MOVLW D'51'
MOVWF SPBRG
movlw 0xA4 ; CSRC/TXEN (Internal clock, 8 bit mode,
Async
;operation,
High Speed)
movwf TXSTA ; Write to TX control register.
BSF TXSTA,BRGH
BCF STATUS,RP0 ;
RETURN
I am having a big trouble with my PIC's serial communication. I have
codes like these:
GPS:
CALL set4800
A0: CALL RCread
CALL TXsend
XORLW 'G'
BNZ A0
MOVLW 0XFF
MOVWF PORTA
RETURN
I have incoming messages and I want to take the one which starts
with 'G', so I write these simple codes. Althoug I have sentences which
starts with 'G', PortA never gets FF. I tried these codes with Proteus
and it works. But it doesnt work with my pic16f877 in my circuit. From
TX output I get the bytes which I sent from RC, I see that there are
G's in RC but they dont make the port A to be FF. Please hellllppppp
me.
Here are my functions:
RCread: bcf STATUS,RP0 ; Select Bank 0.
getc1 btfss PIR1,RCIF ; Skip if RC int flag set
goto getc1 ; Try again
movf RCREG,W ; Read the character
bcf PIR1,RCIF ; Clear the interrupt flag
return
TXsend bcf STATUS,RP0 ; Select Bank 0.
putc1 btfss PIR1,TXIF ; Skip if TXbuffer empty
goto putc1 ; Try again
movwf TXREG ; Write it!
bcf STATUS,RP0 ; Select Bank 0.
return
set4800: bsf STATUS,RP0
MOVLW D'51'
MOVWF SPBRG
movlw 0xA4 ; CSRC/TXEN (Internal clock, 8 bit mode,
Async
;operation,
High Speed)
movwf TXSTA ; Write to TX control register.
BSF TXSTA,BRGH
BCF STATUS,RP0 ;
RETURN