Searching \ for '[PIC] Serial buffer on 18F4550' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=serial
Search entire site for: 'Serial buffer on 18F4550'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Serial buffer on 18F4550'
2009\01\29@100804 by Joe P. Farr

flavicon
face
Hello List,

As I understand the datasheet, the 18F4550 contains a 2 byte RX buffer
for the EUSART.

If there a way to clear this buffer without reading off the data ?

I've looked at the RCSTA register and was hoping to see a ClearBuffer
type bit but nothing.


Many thanks,
Joe


2009\01\29@104130 by William \Chops\ Westfield

face picon face

On Jan 29, 2009, at 7:11 AM, Joe P. Farr wrote:

> As I understand the datasheet, the 18F4550 contains a 2 byte RX buffer
> for the EUSART.
>
> If there a way to clear this buffer without reading off the data ?
>
> I've looked at the RCSTA register and was hoping to see a ClearBuffer
> type bit but nothing.

Read the rx buffer twice.  Ignore what you read.  All gone.
(why do you specifically wan to avoid reading the data?)

BillW

2009\01\29@104233 by Bob Ammerman

picon face
> As I understand the datasheet, the 18F4550 contains a 2 byte RX buffer
> for the EUSART.
>
> If there a way to clear this buffer without reading off the data ?
>
> I've looked at the RCSTA register and was hoping to see a ClearBuffer
> type bit but nothing.
>
> Many thanks,
> Joe

Why can't you just read the data and then ignore it?

-- Bob Ammerman
RAm Systems

2009\01\29@105714 by Joe P. Farr

flavicon
face
Thanks for the response BillW.

The reason is that I'm not using assembler for this, and the read will
slow things down, and it's a waste of CPU time if I don't want the data,
hence hoping for something like a quick bit set.

Joe


{Original Message removed}

2009\01\29@121455 by William \Chops\ Westfield

face picon face

On Jan 29, 2009, at 7:59 AM, Joe P. Farr wrote:

> I'm not using assembler for this, and the read will
> slow things down, and it's a waste of CPU time if I don't want the  
> data,
> hence hoping for something like a quick bit set.

You should be able to read the data directly from the uart register just
as fast as "a quick bit set."  You don't have to go through the higher
level "read character from uart" functions that might exist.
(Of course, if you have an interrupt-driven uart driver "in-play", then
there are all sorts of other complications as well.)

BillW

2009\01\29@122114 by solarwind

picon face
On Thu, Jan 29, 2009 at 10:59 AM, Joe P. Farr <spam_OUTjoe.farrTakeThisOuTspamkcsl.uk.com> wrote:
> Thanks for the response BillW.
>
> The reason is that I'm not using assembler for this, and the read will
> slow things down, and it's a waste of CPU time if I don't want the data,
> hence hoping for something like a quick bit set.
>
> Joe
>

When I was using UART and I had to flush the buffer I did something
like this on m 16 F 886:

typedef unsigned char byte;

byte rx;

rx = rcreg;
rx = rcreg;
rx = rcreg;

--
solarwind

2009\01\29@123024 by Isaac Marino Bavaresco

flavicon
face
Joe P. Farr escreveu:
> Thanks for the response BillW.
>
> The reason is that I'm not using assembler for this, and the read will
> slow things down, and it's a waste of CPU time if I don't want the data,
> hence hoping for something like a quick bit set.
>
> Joe
>  

Don't worry about slowing down, any good C compiler will waste at most
one or to instruction cycles for each read. And you may use in-line
assembly if you like.

Plain asm (PIC12/16):
 movf RCREG,w

Plain asm (PIC18):
 movf RCREG,w,ACCESS

Plain 'C':
 dummy = RCREG;

In-line assembly (Hi-Tech PICC):
asm( "movf RCREG,w" );

In-line assembly (Hi-Tech PICC-18):
asm( "movf RCREG,w,ACCESS" );

In-line assembly (MPLAB-C18):
_asm movf RCREG,w,ACCESS _endasm

Regards,

Isaac

__________________________________________________
Faça ligações para outros computadores com o novo Yahoo! Messenger
http://br.beta.messenger.yahoo.com/

More... (looser matching)
- Last day of these posts
- In 2009 , 2010 only
- Today
- New search...