AB PLC 与modbus 通信
AB PLC 与modbus 通信AB PLC 与modbus 通信AB PLC 与modbus 通信AB PLC 与modbus 通信www.PlcwoRld.cnu变频器触摸屏伺服启动气出程102Sepam2000与远程监控系统之间的通信是采用 MODBUS协议的通信方式MODBUS的通信采用的是一种主/从式数据传输,在主从结构的通信方式中有一台主机,多台从机,主机可与各个从机作双向通信,而各从机之间不能通信。主机与各个从机通信的报文形式为请求/响应帧方式。每次通信均由主机发起,不需握手。主机发出请求帧后,等待从机返回响应帧直至响应时间超时。从机只能通过提供数据响应主机的请求,或根据请求做出相应的动作。MODBUS协议定义了主札请求的格式,包括:请求的编址,要求动作的功能码,传输数据和错误校验等。请求中的编址(即地址码)提供接收主机报文霉的从机地址,从机根据地址判别是否接受该请求,用户必须设置每台从机的地址。功能编码告诉指定编址的从机完成什么样的动作。数据字段屮包含了从机执行任务时所需的附加信息。例如,功能编码03表示读取从机的保持寄存器并w毁w.91{κ其中的内容,数据区中的信息就益领诉从机从哪个寄存器开始读,需要读的寄冇器数。错淏校验字段为从杋提供了信息完整性校验的方法。同样,响N→oomo应的格式也是采用 MODBUS协议结构,从杋响应的功能编码与接受的请求的功能编码相对应,数据字段包含根据请求返回的数据,错误校验字段允许主机确认信息内容是合有效。MODBUS协议共有24种功能编码,但是并不都适用于 Sepam2000,实际应用中Sepam2000只是支持下面有限的几种:01读取输出状态02读取输入状态03读取内部寄存器内容04读取输入寄存器内容05强制单个输出状态第3页共10页www.PlcwoRld.cnu变频器触摸屏伺服启动气出程10206刷新单个寄存器内容07读取异常事件状态08诊断测试11读取计数器和状态字15强制多个输出状态16刷新多个寄存器内容如果主机希望读取2号 Sepam2000从机中寄存器0805h-080Ah的内容,则需要调用功能03。主机请求和从机响应的帧格式如下:请求帧地址功能号数据起始寄存器编址寄存器数目错误校验字段030C0506CRC16w3M9HMo应帧:WwW PLCworld cn字节数据寄存器数据寄存器错误校地址功能号计数(0805)(080A)验字段03OCDatalData6CRC16而如果主机希望刷新2号 Sepam2000从机中寄存器0810h的内容并把寄存器内容设置为1000,则需要调用功能06。主机请求和从机响应的帧格式如下:请求帧:地址功能号寄存器编址设置值错误校验字段06OCOE1000CRC16响应帧:(返回收到的请求帧)地址功能号寄存器编址设置值错误校验字段06OCOE1000CRC16第4页共10页www.PlcwoRld.cnPC变频器触挾屏伺服镦启动電气里程-1521Sepam2000的帧格式以及所执行的功能都有明确的定义,不能随意更改。在通信过程中,要确保主机和各从机的对应关系正确。此外,用户可以根据实际需要配置合适的传输波特率、宁符奇偶校验、停止位的个数等通信参数设置。四. AB PLC中 MODBUS协议的实现1.MCM模块的通信控制PROSOFT TECHNOL0GY公司的3100/3150-MOM通信模块,相当于网络接冂,PLC通过MoM模块与 MODBUS总线相连。MOM模块能快速、可靠地在 AB PLC中实现 MODBUS协议。3100/♂315σ0-MM通信模块可供用户选择使用主机模式或者从机模式。当MCM模块设定为主机,它对连接到总线上的从机进行控制,支持 MODBUS协议屮(01、02、03、04、05、06、15、16)8种功能编码,可以发送多达一百条定制的请求WM91H样am并支持以“广播”方式发出请求盖MCM模块指定为从机,它响应主机§的请求,此时能够支持 MODBUS协议中(01、02、03、04、05、06、08、15、16)9种功能编码。同时,无论是主机模式或者是从机模式,3100/3150MCM通信模趴都支持 ASCII和RTU两种传输模式当 AB PLC配置了3100/3150-MCM通信模块作为主机模式时,PLC采用周期扫描方式,按请求指令的顺序与从机交换数据。每次扫描期间,处理器使用逻辑写指令将主机内存中要输出到各从机的数据传送到3100/3150-MM通信模块屮的发送缓冲区,模块根据存储的功能指令,发送到指定的从机;而各从机响应后返回的数据,3100/3150-ⅦOM通信模块将其先存放在接收缓冲区,然后PLC使用逻辑读指令把数据移入相应的输入数据存储区。周而复始,使主机与从机中的数据得到周期性的刷新。整个数据流程如图2所示:第5页共10页www.PlcwoRld.cnu变频器触摸屏伺服启动气出程102PLC内存PLC指令MCM缓冲MCMMODBUS模式设备数据读数据:-(从机主机推令一(写)指令一主二一从参数参数配置配置图2MCM模块数据流程示意图2.MCM模块与 MODBUS的硬件连接MCM模块使用的是与RS232C兼容的标准通讯接口,但在实际应用中由于要实w{M.91耙通信,所以采用RS485方式。图3是3150-MCM模块9芯串行口与 MODBUS 8的连接图3150-MCMMODBUSTxRxD+ 9TxRxDTxRxDTxRXDRTS 7G№D5GND图33150MCM端口与 MODEUS连接示意图3.MM模块的缓冲区管理PLC与MM模块之间是通过模块输入、输出映像文件进行数据传送。PLC与数据时,将数据写入输出映像文件,然后3100/3150-MM通信模块把数据映射第6页共10页www.PlcwoRld.cnu变频器触摸屏伺服启动气出程102到相应的缓冲区位置上;PLC读数据时,根据映射地址,从输入映像文件屮读取模块缓冲区中对应地址的数据。映像文件的数据传送单位为一个50字节的数据块,PLC必须循环地一次传送一个数据块。MCM把缓冲区按数据传送的单位大小,分为若干个块,并一一标号,用块号对应起来,并且划分为三个区,分别用于数据、指令、参数设置。数据存储区从0块号开始,结束于79块号,中间有4000个字节的空间,用于存储接收的数据和发送的数据,是主札、从札交换数据的场所;指令存储区从第80块至第99块,共1000°个字节,用于存储主机模式下,模块的功能指令表,每次扫描,顺序按功能指令列表向从机发出请求帧:第25块号前40个字节则专门定义为模块设置参数存储区,用于初始化模块。在通信过程中,首先要对主机进行初始化,即对第255块号对应的缓冲区ww.91{进行参数配置,主要是定义通信端舶设置,模块缓冲区的详细划分。设置的有以下参数:N→oomo定义MCM通信模块两个独立的通讯接口设置。包括:选择主机模式或者从机模式、定义字符奇偶校验、停止位的个数,传输的波特率,响应延时等参数。〈2〉定义模块的缓冲区中冇储接收数据的数据冇储区。包括:接收数据存储区的起始块号,存储区的连续块数。③3〉定乂模块的缓洲区屮存储发送数据的数据存储区。包括:发送数据存储区的起始块号,存储区的连续块数。〈4〉定义模块的缓冲区中指令存储区。由于指令储区固定从80号数据块开始,所以只需指定存储区的块数。4.MCM模块的功能指令设置第7页共10页www.PlcwoRld.cnPC变频器触挾屏伺服镦启动電气里程-1521MCM模块处于主机模式下时,功能指令列表存放在模块缓区屮的指令存储区。主机向从札发出请求时,模块从指令存储区逐条读出功能指令,并按照MODBUS请求帧格式发送数据。指令存储区中每条功能指令的具体内容如下:1模块通信端口选择2从机的站地址。从机在接收数据时将本站编址的值与收到的站地址比较,以此判定信息是否是发给木站的。而主机在接收压则将收到的站地址与发送的站地址比较,以判断是否是正确的从机响应3指令的功能编码4源地址。即主机要发送或接收的数据在缓冲区中的起始数据地Wbn.91Hmi.com-Itwww.plcworld.Cn5数据长度。即主机要发送或接收的数据的字节数6目的地址。即从机要接收或响应的数据的寄存器地址数据的类型。用于标示读、写的数据是双字节的浮点数还是单字节的整数8轮询时间如果主机希望在1号通讯接冂读取2号 Sepam2000从机中寄存器0805h-080Ah的内容并存放到模块缓冲区第50个字节开始的连续6个字节中,功能指令内容如下:从机功能数据端口号源地址目的地址类型时间地址编码长度506080500第8页共10页www.PlcwoRld.cnu变频器触摸屏伺服启动气出程1025. AB PLC通讯程序的开发程序执行时,在第一个扫描周期,都必须设置MCM的状态,即初始化MM模块。通信程序屮,PLC在输入、输出映像文件屮为MCM缓冲区设置当前以及后续读写指针,分别指向当前MCM缓冲区数据块号,后续缓冲区数据块号。若MCM处于数据传送允许状态,即I1:1/0=1,00:1/0=0时,PLC判别当前读写指针,调用相应读写逻辑指令。如果指针指向接收数据的数据冇储区,则PC从jCM模块中接收数据:如果指针指向发送数据的数据存储区,则PLC向MCM模块发送数据;如果指针指向指令存储区,则PLC向MM模块传送功能指令,每次执行一个数据块的传送,并在传送后,把后续读写指针覆盖当前读与指针,w毁w91{M恧砟下个扫描周期进行下一个数据块的传送。PLC自动周期性扫描,按照编定的功能指令向从机的输入/输出数据进行发送/接收,以满足数据传输的要求。根据PLC的逻辑指令及MCM的通信原理,画出了图4所示的主机通信程序结构框图开始首次扫描时MCM初始化百传送允许?>是∈向接收数据区读数据指令一向发送数据区?>据[写数据指令是指向指令区?与功能指更改读写指针图4PLC程序框图第9页共10页www.PlcwoRld.cnPC变频器触挾屏伺服镦启动電气里程-1521五.结束语经过现场调试,实现了1台 AB PLC与13台 SEPAM2000组成的 MODBUS网络连接。实际应用证明,这种方式组成的系统结构简单,应用方便,能满足复杂的控制需要。参考文献3100/3150 MCM USER Manual, Pro Soft Tcchnology, 1997吵一2 AB PLC Programming Reference Manual, AB, 19973 Sepam2000 Communication protocol, Schneider, 1999W点M91HM|comWwW PLCworld cnN→oomo第10页共10页
- 2020-11-05下载
- 积分:1
RTCM3.3协议全
全新RTCM3.3协议完整版RTCM STANDARD 10403.3DIFFERENTIAL GNSS(GLOBAL NAVIGATION SATELLITE SYSTEMS)SERVICES – VERSION 3DEVELOPED BYRTCM SPECIAL COMMITTEE NO. 104OCTOBER 7, 2016COPYRIGHT©2016 RTCMRadio Technical Commission for Maritime Services1611 N. Kent St., Suite 605Arlington, Virginia 22209-214RTCM Paper 141-2016-SC104-STD000ocRTCMco00c30RTCM 10403. 3, Differential GNSS Global Navigation Satellite Systems)Services- Version 3, October 7, 2016This standard (referred to as version 3 has been developed by rtCm special Committee 104 as a moreefficient alternative to the standards entitled rtcm recommended standards for diffe rentialRecommended Standards for Differential gNss Global Navigation Satellite Systems Service, Version 2.x(Current version is 2. 3, now designated as RTCM 10402. 3. Service providers and vendors represented onthe SC104 Committee wanted a new standard that would be more efficient, easy to use, and more easilyadaptable to new situations. The main complaint was that the version 2. x parity scheme, which useswords with 24 bits of data followed by 6 bits of parity, was wasteful of bandwidth. Another complaint wasthat the parity was not independent from word to word. Still another was that even with so many bitsdevoted to parity the actual integrity of the message was not as high as it should be. Plus, 30-bit wordsare awkward to handle. the new standard version 3 is intended to correct these weaknessesUnlike Version 2. x, this standard does not include tentative messages The messages in Version 3 haveundergone testing for validity and interoperability and are considered to be permanent. amendments tothe standard may change the meaning of reserved bits or provide additional clarifying text, but no changeswill be made in the data fields. Changes will require new messages to be developed. In addition to themessages described in the current standard the committee continues to develop new messages whichare described in separately published amendments and periodically gathered into a new edition of thestandard. RTCM 10403x for dgNSS services is proving useful in supporting highly accurate differentialand kinematic positioning as well as a wide range of navigation applications worldwideNote that Version 3 messages are not compatible with Version 2. x. Since many receivers have beendesigned and programmed for use with Version 2. x messages, rtCm is maintaining both standards0402 3 and 10403, 3 as" standardsVersion 3.0The initial edition consisted primarily of messages designed to support real-time kinematic (RTK)operations. The reason for this emphasis is that rtk operation involves broadcasting a lot of informationand thus benefits the most from an efficient data format. Version 3.0 provided messages that supportGPS and gloNaSs rTK operations including code and carrier phase observables antenna parametersand ancillary system parametersVersion 3. 1(RTCM Standard 10403.1:The next edition, Version 3. 1 (RTCM Standard 10403. 1), incorporated GPS Network Corrections, whichenable a mobile receiver to obtain accurate rtk information valid over a large area. In addition, new GPSand GLoNaSS messages provide orbital parameters to assist in rapid acquisition a Unicode text messageis also provided for the transmission of textual data. Finally a set of messages are reserved for vendorswho want to encapsulate proprietary data in their broadcasts the gps Network Corrections enable amobile receiver to obtain accurate rtk information valid over a large area. the network rtk correctioninformation provided to a rover can be considered as interpolated corrections between the referencestations in the rtk network this interpolation is not perfect and varies with the actual conditions of theatmosphere. A residual interpolation error has to be expected. With sufficient redundancy in the RtKnetwork, the network server process can provide an estimate for residual interpolation errors. Suchquality estimates may be used by the rover to optimize the performance of rtk solutions The values maybe considered by the rover as a priori estimates only with sufficient tracking data available the rovermight be able to judge residual geometric and ionospheric errors itselfVersion 3. 1. Amendment 1:Amendments 1 was an extensive addition that adds rtcm messages containing transformation data andinformation about Coordinate reference Systems. For rtCm data supporting a rtk service, coordinatesare measured within the itrf or a regional realization surve yors and other users of rtk services mustnormally present their results in the coordinates of local datums. Therefore, coordinate transformationsare necessary. by having RTCM messages that contain transformation data and information about theCoordinate reference systems the users of the rtk service can obtain their results in the desired datumwithout any manual operations. the rtk service providers can then ensure that current information forthe computation of the transformations is always used. the convenience of this method will promote theacceptance of rtK servicesVersion 3. 1. amendment 2:Amendment 2 added residual error messages to support the use of Non-Physical or Computed referenceStations in a network rtk environmentVersion 3. 1. amendment 3:Amendment 3 addressed differences in the way gnss receiver manufacturers have implemented carrierphase encoding of some Version 3 messages so that carrier phase observations are in phase for all carrierphases of a specific frequency i e. they correct for quarter cycle phase shifts. others retain the quartercycle offset between the carrier phase observations in the data. this amendment documents the waydifferent manufacturers have handled the phase shift issue and prescribes a uniform approach for futureproducts.∨ersiⅰon3.1, Amendment4:Amendment 4 added sections 3.5.13 on glONASS Network rtK Correction Messages and 3.5. 14 on FKPNetwork Rtk Correction Messages Related revisions were also made elsewhere in the document.Version 3. 1. amendment 5Amendment 5 added section 3. 5. 12 on State Space Representation related revisions are also madeelsewhere in the document, along with some editorial correctionsVersion 3. 2(RTCM Standard 10403.2)Version 3.2 consolidates Version 3. 1 and all five amendments into a new edition, and it adds MultipleSignal Messages (MSM)as well. the Multiple Signal Message (MSm)format generates receiverobservables in the same way for all included satellite systems. the messages include compact and fullmessages for Pseudorange, PhaseRange, Carrier to Noise Ratio (standard and high resolution), andPhaseRangeratea table near the beginning of the standard lists which messages were included in each separate editionand amendment, so it should not be necessary for users to refer to older versions. Multiple signalMessages are a generic format that will be followed for all GNSs systems. version 3 originally consisted ofmessages for GPS and GLONASS, each in their own format Now with the imminent addition of signals forBeiDou, Galileo, and QZSS, as well as new signals provided by modernized GPS and GloNASS satellitesthe need for a consistent generic format became evident. service providers and users are urged to migrateto the MsM messages to make it easier to accommodate new gNss services(See The RTCM Multiple Signal Messages: A New Step in GNSS Data Standardization")Another newmessage is the gloNaSS Bias Information message. This message provides information which is intendedto compensate for the first-order inter-frequency phase range biases introduced by the reference receivercode- phase biasVersion 3.2, Amendment 1:Added Galileo F/NAv Satellite Ephemeris Data(msg. 1045 )and Bds MSM(msgs. 1121-1127)Version 3.2 amendment 2Added qzss ephemeris(msg. 1044 )and QZss MSm (msgs. 1111-1117Version 3. 3(RTCM Standard 10403.3)This new edition adds Satellite-Based Augmentation System Multiple Signal Messages to previouslydopted messages for GPS, GLONASS, Galileo, and QzssA new ephemeris message has been added for BeiDou(BDS)and a new I/NAV ephemeris message hasbeen added for Galileo. The new edition also reserves 100 messages be used exclusively by sc104 fornew message developmentFinally, the new edition makes consolidates previous amendments and makes numerous editorialImprovementsNavstar GPS Service, Version 2. x. Service providers and vendors represented on the scco000c30z1O2co00c30Contentsco00c30
- 2020-06-27下载
- 积分:1