AVR series microcontrollers are equipped with asynchronous serial interface, and atmega64 we are learning now has two serial ports. We know that the level of MCU is generally TTL level (the difference between TTL level and CMOS level will be explained separately later), while the computer’s serial port is RS-232 level, and the two levels can’t match each other. Therefore, if the two levels are interconnected, a level conversion circuit is needed. In this example, the commonly used MAX232 chip is used, It realizes the exchange of RS-232 level and TTL level.

In the data manual of MAX232, there is a typical connection circuit of this chip. We can directly use this circuit. The connection circuit of MAX232 is very simple. We just need to remember 4 capacitors (or 5 capacitors). Here, 4 capacitors means that only 4 capacitors need to be connected in the circuit; As for capacitor 5, the extra capacitor is the one connecting VCC and GND. This capacitor may not be connected, but considering the stability of the power supply, it is recommended to connect it. As for the selection of capacitance size in the circuit, please refer to the data manual. It should be noted that the non-polar capacitance is used here. Generally, there are three choices of capacitance value: 0.1uF, 1uF, 10uF. The capacitance value will affect the driving ability of the port. The large capacitance has strong driving ability, while the small capacitance has weak driving ability. Usually, a capacitance of 1uF is enough.

  The circuit diagram of RS-232 serial communication is as follows:

  Design of RS232 asynchronous serial communication USART circuit

Leave a Reply

Your email address will not be published. Required fields are marked *