首页 > 编程知识 正文

android rs232串口协议RS232串口协议详解,天龙功放232串口协议

时间:2023-05-06 05:10:14 阅读:179075 作者:4317

2.2.RS232和UART的比较

其实RS232和UART不是一个东西,有区别。 对RS232和UART的关系进行说明。

只是,大多数情况下,把UART和RS232混在一起说。 在这种情况下,是指串行端口的意思

URT==universalasynchronousreceivertransmitter

UART,通用,意味着可以配置,支持多种不同的协议

也就是说,UART的输出为许多位,这些位最终可配置RS232、RS422、RS485等的其它协议。

通用异步传输(the UART ) )。 istheheartoftheserialhardware.itisachiporpartofachipwithepurposetoconvertbetweeenparalleldataaandserialdata.RS-232 uartsartsart rystart/stopandparitybitswhentransmitting,anddecodethisinformationwhenreceiving。

auarttypicallyoperatesentirelyoncomputerlogicvoltage.itsserialdatainput/outputvoltageisthecomputerlogicvoltage, nottheseriallinevoltage.theyleavetheactuallineinterfacetoaparticularlinedriver/receiver.this line driver/receiverdoesnotnecessarilyneedtobeanrs-232 line driver/receiver,butcoulde.g.alsobeanrs-422差异驱动程序/receial parity,number of stop bits, numberofdatabitsareprogrammableisthereasonwhyuartsarecalleduniversal.thedistinctionbetweenuartandlinedriver/receiverblursiftheyarebothplacedinthesamechip.suchipsaretypicallyalsosoldunderthelabel ' UART '。

UARTs are called asynchronous,because they don ' tuseaspecialclocksignaltosynchronizewiththeremoteside.instead,theyusethethesthesthesthestared

thankstotheuarttherestofthehardware、 aswellasthesoftwareapplicationcandealwithnormalbytestoholdthecommunicationdata.itisthejoboftheuarttochopabyteintoaseries of andtoassembleseriesofbitsintoabytewhenreceiving.uartstypicallycontaineightbitwidereceiverandtransmissionbuffers.ofwhichnot ransmissionisused.receivedserialdataisprovidedinparallelinthereceiverbuffer, to-be-senddataiswritteninparalleltothetransmissionbuffer.dependingontheuartthebuffersmightjusthaveadepthofonebyte, orafewbytes (intherangeof 15 or 16 bytes ).The less deep the buffers are, themoreprecisethecommunicationwiththecpuneedstobe.e.g.ifthereceiverbufferjusthasadepthofonebyte,andthedataisnotfetched thenextreceiveddatacanoverwritethepreviouslyreceiveddatainthebuffer、andthepreviouslyreceiveddatainthebuffer、andthepreprevioused

becauseofthefactthatthetimingontheserialinterfaceisimportant,uartsaretypicallyconnectedtoabaudrategenerator,eitheranininter

URT角色:

为了节省CPU的时间和劳力:

每次都将大量的字节,慢慢地转换成一个个比特,不需要在传输线路上一点点塞住发送给对方

需要:

将发送的数据字节流向缓存缓冲区,向UART传达有数据后,UART将各字节变换为单一的8位,一点一点地发送

简而言之:

URT将串行字节数据转换为并行位并传输

总的来说:

表2.1 .序列、RS232和UART比较

要比较的项目

所属类型

数据位数

主要作用和功能

备注

序列

软件概念

串行在概念上是“时分复用”,数据往往随着时间逐渐发送,逐位发送。 USART、UART、RS232、USB、SPI、I2C、TTL等是与串行相关的协议或概念。

UART

硬件、电子电路、物理模块

1

最常见的串行协议。 处理串行接口之间的通信。 但是,该串行接口经常是RS232接口。

每次传输1字节时,都会在自己第一位的下降沿取得同步,因此称为异步通信。

RS232

电气接口规格

2

串行通信协议定义了DCE与DTE之间的电气特性:作为硬件接口的管脚及其功能、信号时序和含义等

更严格地说,应该把RS232称为EIA-232; 在电信中,5V不可靠,所以为了增大电压,采用12V。 也就是说,12V表示0,-12V表示1

RS232和UART以及相应的行驱动程序/接收程序、CPU等模块之间的数据流关系可以如下图所示。

图2.1.RS232和UART之前的数据流关系

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。