Society of Robots - Robot Forum

Software => Software => Topic started by: airman00 on August 23, 2008, 07:53:14 PM

Title: UART on any pin
Post by: airman00 on August 23, 2008, 07:53:14 PM
I have a question on UART.

Why is UART limited to certain pins on the AVR?
Back in my PIC days ( like 3 months ago , lol  ) I was able to achieve TTL serial communication on any pin . It seems that with the AVR UART is only on certain pins. Well serial is just a combination of 1 and 0 , so shouldn't serial be possible on any output pin?

Can someone clear this up for me ?

Thanks,
Eric
Title: Re: UART on any pin
Post by: Admin on August 23, 2008, 08:33:08 PM
hardware UART vs software UART . . . the previous is more accurate, faster, and less computationally expensive.

the latter is called 'bit banging (http://en.wikipedia.org/wiki/Bit-banging)'
Title: Re: UART on any pin
Post by: airman00 on August 23, 2008, 08:40:31 PM
oh thanks for clearing that up

with hardware UART does this "run in the background" or something like that?
Title: Re: UART on any pin
Post by: Admin on August 23, 2008, 09:13:08 PM
Someone correct me if I'm wrong here, but I believe the buffer does. But it's only like 1 byte, if I remember correctly.
Title: Re: UART on any pin
Post by: airman00 on August 23, 2008, 09:26:42 PM
is there some function in the AVRlib for bit-banging?
Title: Re: UART on any pin
Post by: Admin on August 23, 2008, 09:48:03 PM
If you google around, you can find source code to do it. No built in function, however.
Title: Re: UART on any pin
Post by: Kirk on September 02, 2008, 10:23:31 PM
The Arduino environment has a bit bang send and recieve serial on any pin that I have used.  It could be hacked to run under gcc.

Kirk
Title: Re: UART on any pin
Post by: pomprocker on September 02, 2008, 10:45:16 PM
yep
http://www.mil.ufl.edu/~chrisarnold/components/microcontrollerBoard/AVR/avrlib/docs/html/index.html (http://www.mil.ufl.edu/~chrisarnold/components/microcontrollerBoard/AVR/avrlib/docs/html/index.html)

Title: Re: UART on any pin
Post by: Admin on September 03, 2008, 04:35:57 AM
Actually now that I think about it, I seem to remember seeing AVRlib having a software UART.
Title: Re: UART on any pin
Post by: Kirk on September 03, 2008, 06:23:38 AM
Oh I forgot about AVR USB   firmware only USB

http://www.obdev.at/products/avrusb/index.html
Title: Re: UART on any pin
Post by: pomprocker on September 03, 2008, 10:09:19 AM
sorry bad link above

http://www.mil.ufl.edu/~chrisarnold/components/microcontrollerBoard/AVR/avrlib/docs/html/group__uartsw.html (http://www.mil.ufl.edu/~chrisarnold/components/microcontrollerBoard/AVR/avrlib/docs/html/group__uartsw.html)