Searching \ for '[PIC] 18F4550 USART' 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=usart
Search entire site for: '18F4550 USART'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] 18F4550 USART'
2009\06\19@230236 by Jared Sanson

flavicon
face
Hello, I am having trouble with my PIC18F4550's USART module:

Transmitting is fine, works perfectly

However I can not get my code to receive properly.

I used the following code:

while (!PIR1bits.RCIF) {}

return RCREG;

But it doesn't work properly.

It waits until the first byte is received, and using an if() statement I
can check the byte is valid,

But after this it just skips through the routine, returning the same
byte value.

c = getch();

LED1 = (c == 'A');

I have tried many different configurations and code, but it still does
the same thing.

I have heard that RCREG is a 3-deep buffer and reading RCREG 3 times is
enough to clear it, but this does not seem to work

Please help me, I am getting really frustrated over this (should be)
simple code



Thanks, Jared.



2009\06\20@043719 by Vitaliy

flavicon
face
Jared Sanson wrote:
> Hello, I am having trouble with my PIC18F4550's USART module:
>
> Transmitting is fine, works perfectly
>
> However I can not get my code to receive properly.
>
> I used the following code:
>
> while (!PIR1bits.RCIF) {}
>
> return RCREG;
>
> But it doesn't work properly.
>
> It waits until the first byte is received, and using an if() statement I
> can check the byte is valid,
>
> But after this it just skips through the routine, returning the same
> byte value.

Can you post the rest of your code?

Are you doing anything with the CREN/SREN bits?

Vitaliy

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