gnupic@linuxhacker.org

gnupic@linuxhacker.org


Subject: Re: PIC16F877 & USART
From: Snail Instruments
Date: Wed, 01 Jan 2003 23:24:17

At 13:14 28.12.02 -0800, you wrote:
>Hi. I'm trying to get a PIC16F877 to work at 9600 baud. It works fine at
>2400, with BRGH=0, but I can't seem to get reliable operation at 9600 with
>BRGH=1.

If possible check your signals with scope, maybe the problem lies somewhere else.

>I thought I read somewhere that one shouldn't even try to use BRGH=1, but
>all of the examples I've seen on the Microchip website and Piclist.com seem
>to do it.

This BRGH=1 bug applied to PIC16C77 (or 74?), not to the 16F877.

>I try to send ascii '0' through '9' from my terminal program, and display
>those values on 8 LEDs. At 2400 baud, it works great. At 9600, I get
>incorrect (although consistently) values.

Check your hardware this way - remove the PIC from its socket, connect the RC6 and RC7
contacts with a piece of wire. Now your terminal program should echo all the characters
typed. If this works O.K., try following main loop, which should echo all the characters
as well:

;setup serial port
....
     bcf _GIE ;(or don't set it)
main:btfss _RCIF
     goto main
     movf rcreg,w
     movwf txreg
     goto main

Regards,

Josef



gnupic@linuxhacker.org