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-10-16 06:40:33

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 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

【转载】值得推荐的C/C++框架和库

原文:值得推荐的C/C++框架和库 值得学习的C语言开源项目 Libevent libev是一个开源的事件驱动库,基于epoll,kqueue等OS提供的基础设施.其以高效出名,它可以将IO事件,定时器,和信号统一起来,统一放在事件处理这一套框架下处理.基于Reactor模式,效率较高,并且代码精简(4.15版本8000多行),是学习事件驱动编程的很好的资源. 下载链接:https://github.com/libevent/libevent Memcached Memcached 是一个高性能

win10 IoT开发 Serial?Device 返回 null

树莓派3,win10 Iot,串口开发,抄例子,串口获取返回老是null,例子却可以,代码一样,上网查询结果如下: https://stackoverflow.com/questions/34160376/windows-universal-app-serial-ports-wont-open-serialdevice-fromidasync-always-n So Microsoft do not mention that you need to add something to the ap

aes加密/解密(转载)

这篇文章是转载的康奈尔大学ece5760课程里边的一个final project,讲的比较通俗易懂,所以转载过来.附件里边是工程文件,需要注意一点,在用modelsim仿真过程中会出现错误,提示非法引用memory,网上搜了一下是因为verilog还不支持数组引用,但是system verilog是支持的,而且modelsim也支持system verilog的仿真,那么就需要把.v扩展名改为.sv就可以了. Advanced Encryption Standard (AES), a Feder

select/poll/epoll on serial port

In this article, I will use three asynchronous conferencing--select, poll and epoll on serial port to transmit data between PC and Raspberry pi. Outline Character device file of serial port Naive serial communication Asynchronous conferencing Select

&quot;《 Serial Drivers 》by Alessandro Rubini&quot; 学习笔记

Introduction to "serial device driver"     (My study note) 膜拜大神的作品. Standing on the shoulder of the gaints. --题记 用什么眼光去看待串口设备 当谈到软件对于串口的抽象实现的时候,人们第一反应可能是设备/dev/ttyS0,这个众所周知的串行设备通信的接口文件(至少在PC端是这样的). 由于/dev/ttyS0 是一个char类型的文件,于是一个串口设备通常被认为是一个char

Redis 利用锁机制来防止缓存过期产生的惊群现象-转载自 http://my.oschina.net/u/1156660/blog/360552

首先,所谓的缓存过期引起的“惊群”现象是指,在大并发情况下,我们通常会用缓存来给数据库分压,但是会有这么一种情况发生,那就是在一定时间 内生成大量的缓存,然后当缓存到期之后又有大量的缓存失效,导致后端数据库的压力突然增大,这种现象就可以称为“缓存过期产生的惊群现象”! 以下代码的思路,就是利用“锁机制”来防止惊群现象.先看代码: class KomaRedis{ private $redis; //redis对象 private static $_instance = null; private