关键词不能为空

当前您在: 主页 > 英语 >

分立元件-TTL转RS232适配器详解(内容非常详细)

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-10 14:27
tags:

-

2021年2月10日发(作者:政务院)


TTL to RS232 adaptor Explained


TTL




RS232


适配器详解



How to build a simple TTL to RS232 adaptor for your


microcontroller projects. You should be able to


scrounge


all


the parts you need or buy them at your local Radio Shack. In


this article I explain how the adaptor works and provide many


links to more information you need to know as a


microcontroller hobbyist. This article should be very helpful to


those that receive the


free Arduino compatible kit offered by


uC hobby


as part of the Arduino Microcontroller kit giveaway.


作为一个业余的微控 制器爱好者,在这片文章里,我会解释这


个适配器是如何工作的,并且提供很多链接让大 家来了解所需


要的信息。



Just about every microcontroller available today includes at lest one UART or serial port. Serial ports are


the most common way to communicate with auC or other devices such as GPS receivers. The most


common interface type is RS232, only a simple conversion from the logic level signals of the uC serial RX


and TX pins is required to work with RS232.


RS232 101


For a detailed understanding of RS232 and serial interfacing in general, go to


Beyond Logic


, the mother


load for interfacing information. From this point forward I will assume you know enough about serial


communications and will focus on the why and how for the TTL to RS232 adaptor.

< br>通过前面这点知识,我将假定知道了关于串口通信足够的知识,然后把注意力集中在


TTL-to- RS232


适配


器上。



The easiest way to make an RS232 interface is with an interface IC, the


MAX232


for example. There are


a great number of different dedicated chips available with cost ranging in the $$1-$$3 range. You simply


add a few capacitors and you have a reliable RS232 interface. For hobby work you can buy


a versatile


RS232 adaptor from SparkFun


for about $$7 as a kit. The picture shows the kit parts and the assembled


adaptor. I highly recommend this kit if you want to solve this problem quickly and at little cost.



The basic problem we have to solve is that theuC UART is a logic level device and RS232 is not. To send


data over RS232 the voltages need to be about +/-10V while the output at the uC will be 0-5V or 0-3.3V.


To see a zero signal the receiving RS232 device needs to see a negative voltage. We also need to invert


the phase of our logic signal so that a 1 (5V) is converted to the negative voltage (-10).


Typically the threshold for 1 vs. 0 in the RS232 receiver is slightly above 0V we can get away with using


less then +/- 10V. +/-5V should be sufficient for almost any devices. We usually have +5V available in our


electronics projects but the negative voltage is a problem.



RS232


接收器里,典型的


1



0


的阈值电压是稍微大于


0V


即可,从而我们可以侥幸使用小于


+/- 10V


的电压做成。 对于大多数的器件,


+/-5V


应该足够。在我们的电子工程中 ,经常可以得到


+5V


的电压,但


是想 要得到负电压确实一个难题。



After doing a quick search on the net I found that many TTL to RS232 adaptors use


a common two


transistor circuit


. I have recreated the schematic for this circuit and will explain briefly how it works below.


This is the circuit used in


the recommended SparkFun kit


.


This is basically the same


schematic provided by SparkFun


with some re-arranging to make it easier to


explain. Each major section is enclosed in a dotted line with a name for that region. Each of these regions


is explained below.


这个电路和


SparkFun


提供的原理图基本上是一样了,只是重新调整了一下 使我们更容易了解。每个主要


部分都使用虚线框起来了,并且给每个部分都命名了。每个 部分在下面都有解释。



PC RS232



This shows the DB9 connector which would connect to your PC. The PC has a male connector so you


would need a female if you built this circuit with an integrated cable. I recommend a DB9 female


connector so that a straight through serial cable could be used. While there are many other signals


available on the serial port we are only concerned with Ground, RX, and TX. Ground is the signal


reference against which all other signals are measured. RX is the serial data input to the PC. The voltage


levels here should be switching between +/-10V. We will get away with -10 and +5 for this circuit.


这部分是连接到


PC



DB9


连接座,


PC


一般有一个公头连接器,所以如果你的电路使用集成线缆的话你


则需要一个母 头。我建议使用母头,如此就能够使用线缆直接连接了。由于在这个端口有很多的可用信号


线,我们只需要使用


Ground



RX



TX


即可。

Ground


是其他可测量信号的参考信号


RX

< p>
时输入到


PC



数据信号 线,电压需要在


+/-10V


之间转换。在这个电路中,我们将 侥幸成功使用


-10V



+5V




Neg Supply


This is the tricky part of the adaptor. The major problem is getting a negative supply to feed back to the


RX input. This circuit steals that negative voltage. The diode D1 is arranged so that the negative voltage


output by the PC is used to charge the capacit


or C1. Note that C1′s + input is connected to ground. C1


will store up the -10V output by the PC so we can use it to drive the RX input to a negative voltage. D1 is


necessary because the TX output will not always be at negative voltage. It will transition to +10 as data is


transmitted and this would quickly discharge C1 if the diode did not limit the direction of current flow. With


D1 in place, only the negative voltages at the TX pin will be stored.


这是适配器棘手的一部分。最主要的问题是得到一个 负电压反馈给


RX


输入端。这部分电路窃取到了负电

< p>
压。由于


D1


的作用,从


PC


输出的电压被用来给


C1


充电。需 要注意的是


C1



+

< br>极是连接到地的。


C1



积储从


PC


输出的


-10V

< br>电压,


因此我们可以用它来驱动


RX

输入端,


使其达到一个负电压。


D1


是必须的,


因为


TX


输出端不会一直 处于负电压状态,它会随着数据的发送转换到


+10V


。如果二 极管没有限制电流的


流向,


C1


将会快 速放电。


D1


的存在使只有


TX


是负电压


C1


才被充电。


RS232 to TTL


This is a simple transistor switch which is turned on when the TX output goes positive. Fully explaining


how a transistor works is beyond the scope of this short article but I am sure you can learn more on the


net. I will say that the NPN transistor, Q2, used here turns on when it’s base pin (on flat symbol side to


the left) is p


ulled up over it’s emitter pin (with the arrow pointing toward the bottom). When the transistor


sees the +10V from the TX pin it turns on and pulls down it’s collector (top of the symbol). By pulling


down (towards ground, the signal on the emitter), the voltage drop across the 10K resistor is increased


so that the TTL RX signal is brought very near ground or 0V. This will be a valid 0 signal to our uC. When


the PC RS232 TX voltage goes negative, Q2 will turn off and the 10K resistor R1 will pull the voltage up


to VCC (+5V) which will be a valid signal to the uC. Notice that the +10 to -10V RS232 signal is inverted


in phase and changed in level (0 to +5V) to the TTL voltages required by the uC. The voltage will not go


all the way to 0V at the collector becaus


e the transistor will have some voltage drop between it’s collector


and ground. But it should go low enough to satisfy the logic low level input requirements of our uC.


这是一个简单的开关三极管,当


TX


输出端变高 电平的时候它将会导通。关于三极管的详细工作原理超出


本短文的范围,但我确信你能够 在网络上学到更多这方面的知识。我将会讲的是这个


NPN


三极 管


Q2


,当


它的基极(在标志符号的左 边)相对发射极(在箭头方向的末端)被拉高的时候,它会导通。当


TX


引脚


输出


+10V


的时候,< /p>


三极管会导通并拉低集电极


(标志符号的顶部)

< br>。


通过下拉


(发射极上的信号拉到地)

< br>,


10K


电阻上的电压下降增加,


以致


TTL RX


信号被带到接近


g round


电平或者


0V


< p>
这将是一个对


IC


有效的


0


电平信号。



PC RS232 T X


变负电压时,


Q2


截止,

< p>
R1


会上拉电压到一个队


IC

有效的高电平信号


VCC



+5V


)。请注意,


+10




-10V RS232

< p>
信号被反相了并变成


0



+5V



IC


需要的

< br>TTL


电平。三极管集

-


-


-


-


-


-


-


-



本文更新与2021-02-10 14:27,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/629641.html

分立元件-TTL转RS232适配器详解(内容非常详细)的相关文章

  • 爱心与尊严的高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊严高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊重的作文题库

    1.作文关爱与尊重议论文 如果说没有爱就没有教育的话,那么离开了尊重同样也谈不上教育。 因为每一位孩子都渴望得到他人的尊重,尤其是教师的尊重。可是在现实生活中,不时会有

    小学作文
  • 爱心责任100字作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任心的作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文