三极管组成的串口接口电路图(含RS232 RS485 资源整理) 下载本文

三极管组成的串口接口电路图

1.三极管组成的RS232串口接口电路图

典型的RS-232串口的信号在正负电平之间摆动,在发送数据时,发送端驱动器输出正电平在+5V~+15V,负电平在-5V~-15V,而单片机串行口一般为TTL电平(0V~5V)。两个串口之间不能简单地直接用电线连接。

它利用VD2和C1从RS-232接口获取通信所需的负电源,能很好地实现两个接口之间的电平转换和数据通信,经笔者多年使用实践证明通信效果十分优秀,而且,在工作电压为3.3V时,仍非常稳定。

三极管组成的RS232串口接口电路

如果将图中电路做成一块小巧的电路板,即可装进RS-232插座,用四芯线缆将VCC、TXD、RXD、GND引出,即制成了一条通用的串行数据通信线。

附两种电路:一种用同一个三极管,另一种和上面差不多哈(不过网上有人做了分析,这种电路要稳定些):

2.Simple RS232C Level Converter using Transistors

There're many, who built the Easy Programmer or C-52 Evaluation Board, asking for the RS232C

level converter chip, DS275. Many have changed to MAX232 instead, because of not available in

his home. Here is another simple and cheap circuit using small signal transistor providing TTL to RS232C level converter.

A circuit diagram shown above was used two small signal transistor, NPN and PNP transistors. Dash line separate transmitter and receiver circuit. For those who need only transmitter circuit can use above circuit (and GND (5) signal ). Technically the RS232C is -3V to -12V for logic '1' and +3V to +12V for logic '0'. The transmitter circuit uses PNP transistor, BC557. While in mark state the TxD signal is logic '1', Q1 turns off. TxD (pin3) then provides -9V (depends on what converter chip being used for COM1, say) to RxD (pin2). For space state, TxD control signal then becomes logic '0', which turns on Q1, the approx. +5V is then fed to RxD (pin2). With this method, while sending data has being made, TxD (pin3) must stable at -9V, say.

Some applications not only need transmitter, but also for receiving data. The circuit below dash line is a simple inverter circuit that converts RS232C level back to TTL logic again. When PC sends data to TxD (pin3) pin, logic '1' is -9V, say, Q2 turns off, RxD (TTL) is approx. +5V. The start bit makes TxD (pin3) to approx. +9V, Q2 then turns on, RxD (TTL) then becomes approx. 0V.

The circuit above can be used for half duplex transmission. I have tested with the Easy-Downloader both version and C-52 EVB to replace DS275 chip. It works fine. My student have made the circuit on a small PCB with 8-pin DIP socket. It can replace DS275 directly.

Of course for PIC, as shown in my page we can connect the PIC I/O pin directly to the COM1 without the need of RS232C level converter chip, say. It's quite lucky for those who who use PIC chip. But with another microcontroller that need such converter, for hobbyists project, I thought above circuit would be better.

2nd version RS232C level converter

Here is the 2nd version level converter using two NPN transistors. Without the need of borrowing negative supply from TxD pin, we use a simple inverter circuit as shown below. The RxD' pin now can switch between approx. 0V (not -10V as above circuit) for logic high at pin 3 and approx. +5V for logic low. This is not RS232C standard, but most modern PC use the converter chip that accepts such level. I have tested with 9600 baud, it works fine. For the receiver, the circuit is same as the 1st circuit. The pin number in ( ) is for DS275 8-pin DIP, so with these circuit, we can replace the DS275 easily. Please try with your PC, either one. Any small signal transistors can be used as well. The one used in my prototype was 2SC1740, small package. Resistors are 1/8 watt.

Feedback:

Subject: NEW Date: Wed, 4 Nov 1998 16:17:22 -0800 From: \ Dear WICHIT

I changed your hardware and it work good with my pc I send files for you. Thanks, Asghar Charmin

-------------------------------------------------------------------------------- Asghar Charmin from Iran sent me modification for his PC's serial port shown below. I hope this would be useful for other.

3. 超简单RS232转RS485电路

有网友测试可用,本人没有亲自测试。 这个电路一段为RS232接口,另一端为RS485接口,在发送的时候由于三极管的作用可以阻止RS232接收端收到,就是说可以避免自发自收,输出直接为RS485,具有发送和接受功能。

电路很精巧,不得不佩服设计者的高超技术。