Robert Adsett wrote:
>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.
>
>
>
We've used a "front porch", "back porch" approach sucessfully for many
years with RS485 half duplex. The baudrate is 1200buad, so, when the
last char is loaded into the uart TX shifter (FIFO Empty or no FIFO in
use), a timer is set. Once the timer expires, the line is turned
around. Two things are important, that the back porch (carrier hold) is
greater than the time it takes to xmit one char. This way you are sure
that it was completely shifted out before the carrier is dropped and
don't drop the carrier in the middle of the last char..
The other thing is the front porch, or line precharge, we usually charge
the line for a minimum of 15ms before transmitting. The 15ms is greater
than one char time, this way junk can be fully decoded at that recieving
side, the reciever goes idle waiting for a start bit, then we start
transmitting.
A timer value is also used for the line precharge, when the timer
expires, the first char is shoved into the XMIT buffer, therefore
setting the Uart Interrupt system into motion.
TomW
>>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/
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------