Search code examples
avratmeldigital-logicusartatmega16

What is the USART digital logic in AVR microcontrollers?


Just reading about USART connection in AVR microcontrollers and i faced this question:

What is the digital logic used in USART(RXC, TXC and other internals) of the AVR microcontrollers?

I've found the answer to this question in the datasheet of the microcontroller(It says that the logic is TTL), But i can't find out why we use other logic convertors like MAX232 to change the serial communication protocol to RS232C. Is that needed for long-distance serial communications?

Finally, do we need to use another MAX232 to convert the previous converted protocol to TTL again? If yes, then the following setup for the ATmega16 USART connection with a virtual terminal would be true.

enter image description here


Solution

  • You can connect two AVRs or Arduinos directly TX-RX and vice versa. But if you want to talk to a real RS-232 port that operates at RS-232 voltage swings (like one on a PC or a PC serial card, only then do you need a MAX232-based level shifter. And you only need only one, because the MAX "upshifts" TX signals from the AVR and "downshifts" RX signals to 0-5V.

    The only time you need the MAX232-based adapter is if the device at the other end expects (and produces) the much larger voltage swings specified in the RS-232 specification. Most PC serial cards or serial ports, for example, go -13V to 13V or thereabouts. But AVR to AVR or AVR to serial-controlled LCD and short distances? No need.