Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Basic UART and RS422 implementation

2006-01-21 by Robert Adsett

At 11:18 AM 1/20/06 -0500, my_cool_nickname@... wrote:
>First off, the user manual says that the 2214 has a 16-byte-deep Tx 
>FIFO.  Does this mean that when I want to transmit, I could just write 
>myself a loop routine to read bytes out of my Tx buffer and write 16 bytes 
>into the THR, then wait for the TEMT flag to tell me when it\'s done 
>transmitting?

That sound right.  There was some discussion here recently about techniques 
for determining when it was safe to turn the line around.  It would be 
worth taking a browse.

>If this is the case what is a method I could use to easily keep track of 
>how large my messages are in order to use the 16-byte FIFO efficiently?

Why?  Just send 16 bytes at a time until you are done. Filling the FIFO 
will be the most efficient method in terms of the number of 
interrupts.  Anything else will just add overhead.

>The code that we currently use seems to be copied from 8051 apps and only 
>writes one byte at a time to the THR, then waits for the THRE interrupt to 
>write another single byte to the THR.

That will work too.  If you are coming from an 8051 you may want to leave 
performance improvements till later and just send one byte at a time.  If 
it works why fool with it until you have everything else working at least.

>Considering the above things, how would I know when to shut down my RS-422 
>Tx enable line as quickly as possible without cutting off the 
>transmitssion?  We don\'t have any sort of echoing back the Tx to the Rx, 
>and it\'s too late to change the hardware design now.


Not that big of a HW change really.  With the transmitters I've used it 
would just be a trace cut and a pull-up or pull-dn resistor at 
most.  Pretty simple patch.

Still, reading back the echo may impose a delay time of up to 1.5 
characters before you get the last receive interrupt, so other techniques 
may be worth looking at.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.