Author Topic: UART Output Time  (Read 1677 times)

0 Members and 1 Guest are viewing this topic.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
UART Output Time
« on: April 17, 2009, 09:44:52 PM »
Hi,
Is the amount of time it takes to send a character out UART a constant?
For example: If it takes me 10uS to send 'A' out UART now, does that mean that it will always take exactly 10uS to send out 'A'?(assuming registers are always cleared before send, etc.)
If its not a constant, how much can it be off by?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: UART Output Time
« Reply #1 on: April 18, 2009, 04:06:51 AM »
asynchronous comm is synchronized at the bit level...so it will alwayz take the same time...provided the distance remains same...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: UART Output Time
« Reply #2 on: April 18, 2009, 11:54:25 AM »
Yes - the timing on the UART hardware will be the same but, just stating the obvious, the timings in software may be thrown out by other interrupts happening in the background.
ie if it takes 10uS to send one character then it may take more than 100us to send 10 characters as other interrupts MAY stop you feeding the UART fast enough - so there may be some 'gaps' in between each 10uS burst. This will also depend on whether you are feeding the UART in the foreground (character at a time) or from a transmit buffer via transmit interrupts.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: UART Output Time
« Reply #3 on: April 18, 2009, 06:19:37 PM »
gotcha, thanks!
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline frank26080115

  • Supreme Robot
  • *****
  • Posts: 322
  • Helpful? 2
Re: UART Output Time
« Reply #4 on: April 18, 2009, 11:43:44 PM »
Yes - the timing on the UART hardware will be the same but, just stating the obvious, the timings in software may be thrown out by other interrupts happening in the background.
ie if it takes 10uS to send one character then it may take more than 100us to send 10 characters as other interrupts MAY stop you feeding the UART fast enough - so there may be some 'gaps' in between each 10uS burst. This will also depend on whether you are feeding the UART in the foreground (character at a time) or from a transmit buffer via transmit interrupts.

This is not true for AVR microcontrollers (I can't comment on others), there's a FIFO buffer to ensure that the stop bit has the exacty same duration as all the other bits, no more no less, unless your software is delayed longer than the time it takes to send 10 bits (8 data, 1 start, 1 stop, so 11 if you are using 9 bit mode).

Your UDR = x statement will place x into the buffer, and if the shift register is empty, it will go immediantly into the shift register and gets clocked out the TX pin according to the downcounter (your UBRR), if the shift register is not empty, then it waits until it is actually empty.

The most important thing to know: The time at which the transmit complete interrupt flag is set is when the byte is moved from the buffer to the shift register, not when the shift register is finished sending the byte.

So be extra careful about changing baud rates during run time, make sure you have a software delay before changing baud rates, because the shift register can still be busy even if the transmit complete interrupt flag is set

 


Get Your Ad Here

data_list