RS-232 vs. TTL Serial Communication(转载)

  RS-232串口一度像现在的USB接口一样,是PC的标准接口,用来连接打印机、Modem和其他一些外设。后来逐渐被USB接口所取代,现在PC上已经看不到它的身影了。开发调试时如果用到串口,一般都是用USB转串口头,如下图所示。左图为USB-to-RS-232,右图为USB-to-TTL。USB-to-RS-232和USB-to-TTL因电气特性不同,所以应用场合也不同,不能互换。本文所转载的文章,重点介绍了RS-232和TTL串口的异同。

  

  One of the tools we use most when debugging our projects is serial input/output. Serial is very easy to implement, and it allows you to send/receive any data you need from your microcontroller to a computer's serial port so it can be viewed using a terminal emulator. These two devices are compatible from a software perspective, however you can't just hook a microcontroller up to a computer because the hardware interfaces are not compatible.

  Most microcontrollers these days have built in UARTs (universally asynchronous receiver/transmitter) that can be used to receive and transmit data serially. UARTs transmit one bit at a time at a specified data rate (i.e. 9600bps, 115200bps, etc.). This method of serial communication is sometimes referred to as TTL serial (transistor-transistor logic). Serial communication at a TTL level will always remain between the limits of 0V and Vcc, which is often 5V or 3.3V. A logic high ('1') is represented by Vcc, while a logic low ('0') is 0V.

  The serial port on your computer (if it's lucky enough to have one, they're quickly becoming a relic) complies with the RS-232 (Recommended Standard 232) telecommunications standard. RS-232 signals are similar to your microcontroller's serial signals in that they transmit one bit at a time, at a specificbaud rate, with or without parity and/or stop bits. The two differ solely at a hardware level. By the RS-232 standard a logic high ('1') is represented by a negative voltage – anywhere from -3 to -25V – while a logic low ('0') transmits a positive voltage that can be anywhere from +3 to +25V. On most PCs these signals swing from -13 to +13V.

  The more extreme voltages of an RS-232 signal help to make it less susceptible to noise, interference, and degradation. This means that an RS-232 signal can generally travel longer physical distances than their TTL counterparts, while still providing a reliable data transmission.

   

  This timing diagram shows both a TTL (bottom) and RS-232 signal sending 0b01010101

Solutions

  So, you may see where the problem lies in interfacing these two signals. To connect these two ports you not only have to invert the signals, but you also have to deal with regulating the potentially harmful RS-232 voltages to something that won't destroy a microcontroller's serial pins. There are a handful of solutions to this problem of voltage converting and inverting. The most common, and easiest solution is just plugging a MAX-232 in between the two devices:

  There are many generic derivatives of the MAX-232. Maxim IC just happened to be the first to market with this neato device (decades ago!) so out of habit, we call all ICs that do similar jobs 'MAX-232s'.

  Less expensive solutions, like our RS-232 Shifter, use transistors or inverters to flip the signals, and charge pumps to get the voltages high enough to be RS-232 compliant:

Sample Question

  With the above information at hand, here's a quick quiz to test your shiny new knowledge:

  1. What are the two main differences between RS-232 and TTL signals?

  2. True or false: Data is sent from a PC's RS-232 port at 9600 bits-per-second (bps), it's converted to TTL by a MAX232 before reaching a microcontroller. The voltages of the signals look different on each end, but the speed (bps) does not change.

Answers:

  Spoiler Alert! Highlight from here...

  1. The  '1's and '0's are inverted from each other. The minimum and maximum voltages of RS-232 signals is +/-13V, and only 0 to 3.3V/5V for TTL signals.

  2. True. The data rate will always remain the same, even if the voltages of the RS-232 and TTL signals are different.

...to here to reveal the answers. Because, you know, they're so super-secret.

  原文地址:https://www.sparkfun.com/tutorials/215

时间: 2024-09-30 15:32:26

RS-232 vs. TTL Serial Communication(转载)的相关文章

RS-232, RS-422, RS-485 Serial Communication General Concepts(转载)

前面转载的几篇文章重点介绍了UART及RS-232.在工控领域除了RS-232以外,常用的串行通信还有RS-485.本文转载的文章重点介绍了RS-232.RS-422和RS-485. Overview This article explains the general concepts of the serial communication protocols RS-232, RS-422, and RS-485, including basic concepts like baud rate,

UART to Serial Terminal(转载)

前一篇<UART Explained>介绍了UART的基本信息,重点分析了UART的信号.本文摘录的文章则重点介绍了波特率(Baud Rate)相关的内容,波特率越高,传输速度越快,但实际使用时波特率是越高越好吗,多少合适?文中给出了答案,具体如下. Although the PIC32 is an elegant and powerful microcontroller, it doesn't stand so tall when compared against a PC in terms

Serial Communication Protocol Design Hints And Reference

前面转载的几篇文章详细介绍了UART.RS-232和RS-485的相关内容,可以知道,串口通信的双方在硬件层面需要约定如波特率.数据位.校验位和停止位等属性,才可以正常收发数据.实际项目中使用串口通信时,一般还需要设计一套通讯协议.那么设计串口通讯协议有什么需要注意的地方呢?本文以iPod.车载CAN解码盒及IoT设备EnOcean的串口通讯协议为例,对通讯协议数据帧的定义做一个简单的介绍和分析. 首先看Apple提供的文档<iPod_Accessory_Protocol_Interface_S

TTL和RS232之间的详细对比

[背景] 之前就听过TTL,一直没搞懂其和RS232的区别. 最近,打算去买个USB转RS232的芯片,结果找到此产品: 六合一多功能USB转UART串口模块CP2102 usb TTL485 232互转自恢复 正面: 背面: 其中的: 以及引脚说明: 都提到了,不仅仅支持RS232,还支持TTL. 所以,再次遇到TTL,需要去搞清楚,TTL和RS232的区别.   [折腾过程] 1.参考: RS-232 vs. TTL Serial Communication 整理如下: 常见的微控制器中,都

Serial Port Programming on Linux(转载)

This is a tutorial on how to program the Serial Ports on your Linux box.Serial Ports are nice little interfaces on the PC which helps you to interface your embedded system projects using a minimum number of wires.In this tutorial we will write a smal

微型计算机总线简介

任何一个微处理器都要与一定数量的部件和外围设备连接,但如果将各部件和每一种外围设备都分别用一组线路与CPU直接连接,那么连线将会错综复杂,甚至难以实现.为了简化硬件电路设计.简化系统结构,常用一组线路,配置以适当的接口电路,与各部件和外围设备连接,这组共用的连接线路被称为总线.采用总线结构便于部件和设备的扩充,尤其制定了统一的总线标准则容易使不同设备间实现互连. 微机中总线一般有内部总线.系统总线和外部总线.内部总线是微机内部各外围芯片与处理器之间的总线,用于芯片一级的互连;而系统总线是微机中各

利用VB 6.0实现网络远程PC与单片机通信

在各种单片机应用系统的设计中,常常遇到单片机与PC的通信问题,在速度要求不高.传送距离不远的场合一般采用RS 232标准串行接口实现,在传送距离较远的场合,也有学者研究通过网络实现PC间的通信.但是,要同时满足高速度和远距离PC与单片机通信这是一个迫切需 要解决的问题.随着信息技术的发展,计算机和网络越来越普及,对单片机的远程控制与测量的要求也越来越多.本文在结合现有研究的基础上,对相关的设计进行 一定的改进和创新,设计一个远程通信系统,他由3部分构成:远端PC.本地端PC和单片机系统.通过VB

值得推荐的C/C++框架和库

下次造轮子前先看看现有的轮子吧   值得学习的C语言开源项目 - 1. Webbench  Webbench是一个在linux下使用的非常简单的网站压测工具.它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性能,最多可以模拟3万个并发连接去测试网站的负载能力.Webbench使用C语言编写, 代码实在太简洁,源码加起来不到600行. 下载链接:http://home.tiscali.cz/~cz210552/webbench.html - 2. Tinyhttpd

主机租用商详解服务器集群技术特点

在服务器主机租用的过程中,我们会考虑到技术方面的问题,面对服务器集群技术方面,我们又应该做出哪些更好的理解,就需要看看腾佑科技为您整理的这篇文章了. 服务器集群技术的特点和功能高可应用性与可扩展性 1.高可应用性 对于一些实时性很强的应用系统,必须保持服务的24小时不间断运行,而由于软件.硬件.网络和人为等各种原因,单一服务运行环境很难达到这种要求,此时构建一个服务器集群系统是个不错的选择.构建集群的一个最大的优点是集群具有高可用性,在服务出现故障时,服务器集群系统可以自动将服务从故障节点切换到