gnupic: PIC16F877 & USART


Previous by date: 1 Jan 2003 22:08:17 -0000 Re: PIC16F877 & USART, Andreas Junge - DSLX
Next by date: 1 Jan 2003 22:08:17 -0000 Re: PIC16F877 & USART, Snail Instruments
Previous in thread: 1 Jan 2003 22:08:17 -0000 Re: PIC16F877 & USART, Andreas Junge - DSLX
Next in thread: 1 Jan 2003 22:08:17 -0000 Re: PIC16F877 & USART, Snail Instruments

Subject: Re: [PIC]: PIC16F877 & USART
From: Rick Mann ####@####.####
Date: 1 Jan 2003 22:08:17 -0000
Message-Id: <BA38A2F9.106CF%rmann@latencyzero.com>

on 12/31/02 1:27 PM, Andreas Junge - DSLX at ####@####.#### wrote:

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

Oh, I forgot to mention that, sorry. 4.000 MHz.

> 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

So, here's the thing. I appreciate everyone giving me info about how to set
up the values, but the problem I'm facing is that I *did* set up the values
correctly, using both formulas (the one from Microchip and the one that
accounts for rounding errors).

The formulas work for 2400 baud, but don't seem to work for 9600 baud.

I finally shipped a couple of units at 2400 baud. It's suitable for my
application (simple control protocol), but I've run into more problems.

Basically, someone sends something like "I3" to my device. My device then
responds with "I3". It does this by executing synchronous code to send one
byte, then the next.

After a time, it will stop sending the second byte. However, if you command
it again, it will send the first byte. I'll probably have to post the code
at some point, but that's the new problem (still haven't solved the old
ones).

Happy New Year to all!


-- 
Rick


Previous by date: 1 Jan 2003 22:08:17 -0000 Re: PIC16F877 & USART, Andreas Junge - DSLX
Next by date: 1 Jan 2003 22:08:17 -0000 Re: PIC16F877 & USART, Snail Instruments
Previous in thread: 1 Jan 2003 22:08:17 -0000 Re: PIC16F877 & USART, Andreas Junge - DSLX
Next in thread: 1 Jan 2003 22:08:17 -0000 Re: PIC16F877 & USART, Snail Instruments


Powered by ezmlm-browse 0.20.