Searching \ for '[PIC]: Proper Serial I/O' 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: 'Proper Serial I/O'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Proper Serial I/O'
2002\09\29@185525 by Nick Veys

flavicon
face
Hi all, planning on doing a little serial i/o and want to get a good
idea before writing code that may end up worthless due to a false
assumption. :)

I plan on using the 16F876's USART in Asynch mode to talk to a HAM TNC,
9600 baud 8N1.  Looking through the datasheet, I see the TRMT bit is set
once a transmission is complete, is it safe to assume I can being a new
transmission once that bit is set?  I've used the SPI ports quite often,
and there is a transmit flag there which I use for the same purpose and
have no problems, but I'm wondering if since these commands might be
coming in too fast to be buffered by the slow TNC on the other end, if a
wait would be warranted after the transmission...

I'm hoping I can just keep firing away on the port but I'd like some
words of wisdom just in case.

Thanks

Nick

spam_OUTnickTakeThisOuTspamveys.com | http://www.veys.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\09\29@194445 by Jinx

face picon face
> 9600 baud 8N1.  Looking through the datasheet, I see the TRMT
> bit is set once a transmission is complete, is it safe to assume I
> can begin a new transmission once that bit is set?

Yes. As soon as TRMT is set then Elvis has left the building and
a new value can be loaded

        bank0
        movlw   byte        ;load Transmit reg with data to send
        movwf   txreg

        bank1
        btfss   txsta,trmt   ;byte transmission complete
        goto    $-1
        bank0

As 9600 is relatively slow, the TRMT test loop is quite long, and
you could use that time to do something else (maybe prepare
data for transmission ?), periodically checking for TRMT=1

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\09\29@200622 by Byron A Jeff

face picon face
On Sun, Sep 29, 2002 at 04:32:25PM -0500, Nick Veys wrote:
> Hi all, planning on doing a little serial i/o and want to get a good
> idea before writing code that may end up worthless due to a false
> assumption. :)

OK.

{Quote hidden}

I have a better idea. Take a good read of Fr. Thomas McGahee's PICUART
turorial. It's a highly annotated PIC assembly source file that doubles as
the best PIC UART tutorial around and as a drop in working program that'll
get your USART right as rain.

I cannot recommend the code or the comments highly enough.

I have a copy of Fr. Tom's latest version online. Download here:

http://www.finitesite.com/d3jsys/picuart.zip

BAJ

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\09\29@201442 by Charles Craft

picon face
Serial comm, especially RS-232 serial,  without software or hardware
handshaking is going to burn you eventually. Do you plan on implementing
XON/XOFF support or hardware line checking on the PIC side?

{Original Message removed}

2002\09\30@035636 by Alan B. Pearce

face picon face
>I cannot recommend the code or the comments highly enough.

>I have a copy of Fr. Tom's latest version online. Download here:

>http://www.finitesite.com/d3jsys/picuart.zip

I have to agree with this. I have a version minimally modified to use
interrupts, using Olin Lathrops build environment. Olin also has a version
now in the environment currently available, but I do not know if it is built
around this file like mine is.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\30@080824 by Olin Lathrop

face picon face
> I plan on using the 16F876's USART in Asynch mode to talk to a HAM TNC,
> 9600 baud 8N1.  Looking through the datasheet, I see the TRMT bit is set
> once a transmission is complete, is it safe to assume I can being a new
> transmission once that bit is set?

The TRMT bit tells you that all bits have finished going out.  The TXIF bit
in PIR1 indicates when the UART can accept another outgoing character.  This
happens as soon as TXREG is copied into TSR.  That gives you a whole
character time to react before there would be any break in the output
stream.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\30@081833 by Olin Lathrop

face picon face
> I have to agree with this. I have a version minimally modified to use
> interrupts, using Olin Lathrops build environment. Olin also has a version
> now in the environment currently available, but I do not know if it is
built
> around this file like mine is.

My UART routine at http://www.embedinc.com is fully interrupt driven and has
assembly constants to select the sizes of the input and output software
FIFOs and the baud rate.  The interface to the rest of the application is
via the UART_PUT and UART_GET routines, which each transfer one byte.  There
are also global flags that let you know when those routines won't block
before you call them.  And of course it does work with my build environment.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\30@090636 by Russell McMahon

face
flavicon
face
> My UART routine at http://www.embedinc.com is fully interrupt driven and
has
> assembly constants to select the sizes of the input and output software
> FIFOs and the baud rate.  The interface to the rest of the application is
> via the UART_PUT and UART_GET routines, which each transfer one byte.
There
> are also global flags that let you know when those routines won't block
> before you call them.  And of course it does work with my build
environment.

Sounds excellent - but I couldn't see how to access it from the above link.



           Russell McMahon

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\30@091634 by Olin Lathrop

face picon face
> > My UART routine at http://www.embedinc.com is fully interrupt driven and
> has
> > assembly constants to select the sizes of the input and output software
> > FIFOs and the baud rate.  The interface to the rest of the application
is
> > via the UART_PUT and UART_GET routines, which each transfer one byte.
> There
> > are also global flags that let you know when those routines won't block
> > before you call them.  And of course it does work with my build
> environment.
>
> Sounds excellent - but I couldn't see how to access it from the above
link.

Oops, sorry.  I should have said http://www.embedinc.com/pic.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\09\30@092439 by Dennis Crawley

flavicon
face
Hi Russell
http://www.embedinc.com/pic/

Dennis.

PS:
Do you know something about Fr. Thomas?



----- Original Message -----
From: "Russell McMahon" <.....apptechKILLspamspam@spam@PARADISE.NET.NZ>
To: <PICLISTspamKILLspamMITVMA.MIT.EDU>
Sent: Monday, September 30, 2002 10:05 AM
Subject: Re: [PIC]: Proper Serial I/O


> > My UART routine at http://www.embedinc.com is fully interrupt driven and
> has
> > assembly constants to select the sizes of the input and output software
> > FIFOs and the baud rate.  The interface to the rest of the application
is
> > via the UART_PUT and UART_GET routines, which each transfer one byte.
> There
> > are also global flags that let you know when those routines won't block
> > before you call them.  And of course it does work with my build
> environment.
>
> Sounds excellent - but I couldn't see how to access it from the above
link.
{Quote hidden}

Ahora podis usar Yahoo! Messenger desde tu celular. Aprendi csmo hacerlo en Yahoo! Msvil: http://ar.mobile.yahoo.com/sms.html

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


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