PIC usart problem

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

Reply to
ali.keles
Loading thread data ...

The problem may not be with this code (I can't see a bug either). Are you initialising TRISA?

Reply to
toby

Hi,

Hope you have configured the PORTA as only digital, check the ADCON0 and ADCON1 register''

toby wrote:

Reply to
Jemmy

Try following the examples on

formatting link
and then expand on them. :)

You can get some pretty good bitrates out of the 40Mhz PICs clocked at 60Mhz but have to guess the divisor-thingies almost (thoroughly untechnical term I know).

Reply to
techie_alison

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.