16F877 UART problems

Started by stdf23173 October 24, 2003

Hello All,

I have written/copied some routines from c2c examples and used these
to get the uart on the 877 working. (No commercial stuff just DIY).

Instead of using the TRMT to determine whether the buffer is empty i
use the TXIF flag. The first 20-30 tranmissions go fine
(complete "Hello world" strings !) . Than it stops ! Any one an idea ? grtz

Simon





Even worse now.
It does think the buffer (TXREG) is not empty and will not jump out
of the loop.

void sendchar(char x)
{
while(!TXIF);
TXREG=x;
}

aaarggh.

grtz

Simon



We can wag (wild ass guess) all day. Why don't you post the
initialization part for UART and applicable code segments.

Chad

--- stdf23173 <> wrote:
>
> Even worse now.
> It does think the buffer (TXREG) is not empty and will not jump out
> of the loop.
>
> void sendchar(char x)
> {
> while(!TXIF);
> TXREG=x;
> }
>
> aaarggh.
>
> grtz
>
> Simon >

__________________________________





I am ashamed to admit , blush, that i forgot to switch on TXEN.
I used to init every single bit in TXSTA. Later on i replaced it by
configuring TXSTA in one go ! I stared and stared at it and could not
find it.(at first instance)

grtz

Simon
--- In , Chad Russel <chadrussel@y...> wrote:
> We can wag (wild ass guess) all day. Why don't you post the
> initialization part for UART and applicable code segments.
>
> Chad
>
> --- stdf23173 <stdf23173@y...> wrote:
> >
> > Even worse now.
> > It does think the buffer (TXREG) is not empty and will not jump
out
> > of the loop.
> >
> > void sendchar(char x)
> > {
> > while(!TXIF);
> > TXREG=x;
> > }
> >
> > aaarggh.
> >
> > grtz
> >
> > Simon
> >
> >
> >
>
> __________________________________
>




We have all done the same thing. ***blush***

--- stdf23173 <> wrote:
>
> I am ashamed to admit , blush, that i forgot to switch on TXEN.
> I used to init every single bit in TXSTA. Later on i replaced it by
> configuring TXSTA in one go ! I stared and stared at it and could not

> find it.(at first instance)
>
> grtz
>
> Simon
>
<<*** snip ***>>

__________________________________