Attiny 2313 & Serial Port

Is it possible, using just an Attiny 2313, to exchange data with a computer via serial -- or do I need one of those RS232 chips?
Theoretically, I think I can, using the digital IOs, dispite its lack of efficiency, but there may be some problem with that...

Sending is the main part that I'm not quite confident about ;-)

sort by: active | newest | oldest
trialex8 years ago
You'd AT LEAST need a voltage converter - such as a MAX232 - to let the 2313 talk to a PC. The 2313 is a TTL-level device, i.e. 0V~5V. Your PC is RS-232 level device, i.e. -12V~12V
zachninme (author)  trialex8 years ago
Hm, so I guess I *do* need something else... aww... oh well :P
No, not really. You can't use the uart in the 2313 without a level converter - that's true. But if you bitbang the serial input & output you could do with just a single resistor. Receiving data from the PC will work fine, transmitting to the PC works to most modern machines since the port will accept as reduced voltage swing. (0 volt instead of -12 and +5 instead of +12)

The need for bitbanging is due to the fact that the two levels (called mark and space) is inverted between the ttl and rs232. TTL-mark=+5 volt and RS232-mark = -12 volt. TTL-space=0 volt and RS232-space=+12. Unless the uart can be set into a inverted mode (I've seen this on some uarts) it can't be used.

This document stamp dox
zachninme (author)  matseng8 years ago
Thanks for the help, but I've got it under control now ;-)
trialex8 years ago
By the way, if you google "serial attiny2313" the first result is excellent, and gives you pretty much everything you need to know

HowTo: Serial communication between PC and Atmel attiny2313