gnupic: PIC16F877 & USART


Previous by date: 31 Dec 2002 21:33:46 -0000 Re: PIC16F877 & USART, Edward Tiong
Next by date: 31 Dec 2002 21:33:46 -0000 Re: PIC16F877 & USART, Rick Mann
Previous in thread: 31 Dec 2002 21:33:46 -0000 Re: PIC16F877 & USART, Edward Tiong
Next in thread: 31 Dec 2002 21:33:46 -0000 Re: PIC16F877 & USART, Rick Mann

Subject: RE: PIC16F877 & USART
From: "Andreas Junge - DSLX" ####@####.####
Date: 31 Dec 2002 21:33:46 -0000
Message-Id: <HPEPKMGBOBBNPFCOKLJGKEKCDCAA.andreas@tecthermo.com>

What is your clock rate for the pic? There are multiple tables for different
clock rates in the documentation.

Here are my settings for a 20Mhz pic and 9600baud:

  SPBRG = 129;          // 9600bps
  BRGH = 1;						// High speed baud rate generation on
  RCSTA = 0;
  SYNC = 0;						// Async
  TX9  = 0;						// 8bits TX please
  RX9  = 0;						// 8bits RX please
  SPEN = 1;						// Enable serial port
  CREN = 1;						// Enable receiver
  TXEN = 1;						// Enable transmitter
  TXIE = 0;						// Disable transmitter interrupts


I hope this helps...

Andreas, N6NU

-----Original Message-----
From: Rick Mann ####@####.####
Sent: Saturday, December 28, 2002 1:14 PM
To: PICList; GNU PIC List
Subject: PIC16F877 & USART


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.

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.

FWIW, it seemed to work better when the SPRG value was set to 26 instead of
25, the value everything says I should use.

I have a MAX232 from TI between the PIC and the PC. The handshaking lines
are all hard-wired.

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.

Any ideas? Thanks!

--
Rick


---------------------------------------------------------------------
To unsubscribe, e-mail: ####@####.####
For additional commands, e-mail: ####@####.####



Previous by date: 31 Dec 2002 21:33:46 -0000 Re: PIC16F877 & USART, Edward Tiong
Next by date: 31 Dec 2002 21:33:46 -0000 Re: PIC16F877 & USART, Rick Mann
Previous in thread: 31 Dec 2002 21:33:46 -0000 Re: PIC16F877 & USART, Edward Tiong
Next in thread: 31 Dec 2002 21:33:46 -0000 Re: PIC16F877 & USART, Rick Mann


Powered by ezmlm-browse 0.20.