文档视界 最新最全的文档下载
当前位置:文档视界 › HART协议

HART协议

Highway Addressable Remote

Transducer(HART)

Ⅰ.HART Overview

The majority of smart field devices installed worldwide today are HART-enabled. But some new in the automation field may need a refresher on this powerful technology.

Simply put, the HART (Highway Addressable Remote Transducer) Protocol is the global standard for sending and receiving digital information across analog wires between smart devices and control or monitoring system.

More specifically, HART is a bi-directional communication protocol that provides data access between intelligent field instruments and host systems. A host can be any software application from technician's hand-held device or laptop to a plant's process control, asset management, safety or other system using any control platform.

A DIGITAL UPGRADE FOR EXISTING PLANTS

HART technology offers a reliable, long-term solution for plant operators who seek the benefits of intelligent devices with digital communication – that is included in the majority of the devices being installed. In many cases however, most applications cannot retrofit their existing automation systems with a system that can accept the digital data which is provided by the HART Protocol.

Because most automation networks in operation today are based on traditional

4-20mA analog wiring, HART technology serves a critical role because the digital information is simultaneously communicated with the 4-20mA signal. Without it, there would be no digital communication.

A CRITICAL, DIGITAL ROLE

HART technology is easy to use and very reliable when used for commissioning and calibration of smart devices as well as for continuous online diagnostics.

There are several reasons to have a host communicate with smart devices. These include:

?Device Configuration or re-configuration

?Device Diagnostics

?Device Troubleshooting

?Reading the additional measurement values provided by the device

?Device Health and Status

Much more: There are many benefits of using HART technology, and more users are reporting benefits in their projects on a continual basis. For more information please visit Success Stories

Years of success using these benefits explain why HART technology is the largest of all communication protocols, installed in more than 30 million devices worldwide.

If you've ever used a land-line telephone and noticed the Caller ID display to take note of who is calling, you already know half of what the HART Protocol does—it tells "who" is calling. In an industrial automation network "who" is a microprocessor-based smart field device. In addition to letting such smart field devices "phone home," HART Communication lets a host system send data to the smart instrument.

HART emerged in the late1980s based on the same technology that brought Caller ID to analog telephony. It has undergone continued development, up to and including automation products now shipping with built-in Wireless HART Communication. Ⅱ.How HART Works

―HART‖ is an acronym for Highway Addressable Remote Transducer. The HART Protocol makes use of the Bell 202 Frequency Shift Keying (FSK) standard to superimpose digital communication signals at a low level on top of the 4-20mA.

Figure 1. Frequency Shift Keying (FSK)

This enables two-way field communication to take place and makes it possible for additional information beyond just the normal process variable to be communicated to/from a smart field instrument. The HART Protocol communicates at 1200 bps without interrupting the 4-20mA signal and allows a host application (master) to get two or more digital updates per second from a smart field device. As the digital FSK signal is phase continuous, there is no interference with the 4-20mA signal.

HART technology is a master/slave protocol, which means that a smart field (slave) device only speaks when spoken to by a master. The HART Protocol can be used in various modes such as point-to-point or multidrop for communicating information

to/from smart field instruments and central control or monitoring systems.

HART Communication occurs between two HART-enabled devices, typically a smart field device and a control or monitoring system. Communication occurs using standard instrumentation grade wire and using standard wiring and termination practices.

The HART Protocol provides two simultaneous communication channels: the

4-20mA analog signal and a digital signal. The 4-20mA signal communicates the primary measured value (in the case of a field instrument) using the 4-20mA current loop - the fastest and most reliable industry standard. Additional device information is communicated using a digital signal that is superimposed on the analog signal.

The digital signal contains information from the device including device status, diagnostics, additional measured or calculated values, etc. Together, the two communication channels provide a low-cost and very robust complete field communication solution that is easy to use and configure.

Figure 2. Two Communication Channels

The HART Protocol provides for up to two masters (primary and secondary). This allows secondary masters such as handheld communicators to be used without interfering with communications to/from the primary master, i.e. control/monitoring system.

Figure 3. Primary and Secondary Masters

The HART Protocol permits all digital communication with field devices in either point-to-point or multidrop network configurations:

Figure 4. Point-to-Point Configuration

Multidrop Configuration

There is also an optional "burst" communication mode where a single slave device can continuously broadcast a standard HART reply message. Higher update rates are possible with this optional burst communication mode and use is normally restricted to point-to-point configuration.

Figure 5. Multidrop Configuration

Ⅲ.Benefits of Using HART

Engineers operating in analog automation environments no longer need utter the words "if only" as in "if only I could get the device information without going into the field" or ―if only I could get this configuration information from that pressure transmitter into my PC."

Users worldwide who have realized the benefits of HART Communication know that they can gain quick, easy visibility to devices in the field when using HART-enabled handheld test, calibration devices and portable computers. In fact, device testing, diagnostics and configuration has never been easier!

However, many have yet to realize HART technology’s greatest benefits which come from full-time connections with real-time asset management and/or control systems. HART technology can help you:

?Leverage the capabilities of a full set of intelligent device data for operational improvements.

?Gain early warnings to variances in device, product or process performance.

?Speed the troubleshooting time between the identification and resolution of problems.

?Continuously validate the integrity of loops and control/automation system strategies.

?Increase asset productivity and system availability.

Increase Plant Availability

?Integrate devices and systems for detection of previously undetectable problems.

?Detect device and/or process connection problems real time.

?Minimize the impact of deviations by gaining new, early warnings.

?Avoid the high cost of unscheduled shutdowns or process disruptions.

Reduce Maintenance Costs

?Quickly verify and validate control loop and device configuration.

?Use remote diagnostics to reduce unnecessary field checks.

?Capture performance trend data for predictive maintenance diagnostics.

?Reduce spares inventory and device management costs.

Improve regulatory compliance

?Enable automated record keeping of compliance data.

?Facilitates automated safety shutdown testing.

?Raise SIL/safety integrity level with advanced diagnostics.

?Take advantage of intelligent multivariable devices for more thorough, accurate reporting. The standard features of HART technology range from simple compatibility with existing 4-20mA analog networks to a broad product selection:

?Compatibility with standard 4-20mA wiring

?Simultaneous transmission of digital data

?Simplicity through intuitive menu-driven interfaces

?Risk reduction through a highly accurate and robust protocol

?Ease of implementation for maximum ―up-front‖ cost effectiveness

?Broad product selection, with compatible devices and software applications from most process automation providers

?Platform independence for full interoperability in multi-vendor environments Worldwide support by leading suppliers

Most of the world’s leading process instrumentati on and control system suppliers, comprising most of the industry’s solutions, actively support HART technology. There are 1300+ registered devices in 24 device categories manufactured by 300+ members of the HART Communication Foundation.

Types of HART-enabled

Devices

Device Category

No. of Devices

Actuator 11 Analytical 267 Calibrator 8 Consistency 2 Control 12 DCS 6 Density 12 Development Services &

Tools

30 Flow 228 Handheld 13 I/O System 46 IS Barrier 25 Isolator 47 Level 217 Loop Monitor 4 Modem 30 Modem IC (chips) 8 Multiplexer / Gateway 16 Positioners - Valve 77 Pressure Transmitters 140 Software 35 Temperature 116

Wireless HART Adapter 11

Wireless HART Gateway 9

Ⅳ.HART Protocol Specifications

The HART Protocol was developed in the late 1980's and transferred to the HART Foundation in the early 1990's. Since then it has been updated several times. When the protocol is updated, it is updated in a way that ensures backward compatibility with previous versions. The current version of the HART Protocol is revision 7.3. The "7" denotes the major revision level and the "3" denotes the minor revision level.

The HART Protocol implements layers 1,2, 3, 4 and 7 of the Open System Interconnection (OSI) 7-layer protocol model:

The HART Physical Layer is based on the Bell 202 standard, using frequency shift keying (FSK) to communicate at 1200 bps. The signal frequencies representing bit values of 0 and 1 are 2200 and 1200Hz respectively. This signal is superimposed at a low level on the 4-to-20mA analog measurement signal without causing any interference with the analog signal.

The HART Data Link Layer defines a master-slave protocol - in normal use, a field device only replies when it is spoken to. There can be two masters, for example, a control system as a primary master and a handheld HART communicator as a secodary master. Timing rules define when each master may initiate a communication transaction. Up to 15 or more slave devices can be connected to a single multidrop cable pair.

The Network Layer provides routing, end-to-end security, and transport services. It manages "sessions" for end-to-end communication with correspondent devices.

The Transport Layer: The Data-Link Layer ensures communications are successfully propagated from one device to another. The Transport Layer can be used to ensure end-end communication is successful.

The Application Layer defines the commands, responses, data types and status reporting supported by the Protocol. In the Application Layer, the public commands of the protocol are divided into four major groups:

1.Universal Commands - provide functions which must be implemented in all

field devices

https://www.docsj.com/doc/9c2382113.html,mon Practice Commands - provide functions common to many, but not all

field devices

3.Device Specific Commands - provide functions that are unique to a particular

field device and are specified by the device manufacturer

4.Device Family Commands - provide a set of standardized functions for

instruments with particular measurement types, allowing full generic access without using device-specific commands.

Ⅴ.HART Commands

The HART Protocol is a master-slave communication protocol which means that during normal operation, each slave (a field device) communication is initiated by a request (or command) from the master (host) communication device. The master or host is generally a distributed control, PLC, or PC-based asset management system for example. The slave device is typically a field measurement device such as pressure, level, temperature, flow or other transmitters.

In order to make certain any HART-enabled device from any supplier can communicate properly and respond to a command with the correct information, the set and types of commands are defined in the HART Specifications and implemented in all HART registered devices.

Users need not worry about these commands because they are included in the functions of the host. The specific capabilities of a device (device specific commands) are available to the host when the host is given the instructions included in the Device Description (DD) of a specific device.

An important point is that defined device status indications are included with each communication response to the host. The host then interprets these status indicators and may provide basic device diagnostic information.

The HART Command Set provides uniform and consistent communication for all field devices. Host applications may implement any of the necessary commands for a particular application. The command set includes three classes:

Universal

All devices using the HART Protocol must recognize and support the universal commands. Universal commands provide access to information useful in normal operations (e.g., read primary variable and units).

Common Practice

Common Practice commands provide functions implemented by many, but not necessarily all, HART Communication devices.

Device Specific

Device Specific commands represent functions that are unique to each field device. These commands access setup and calibration information, as well as information about the construction of the device. Information on Device Specific commands is available from device manufacturers.

A Partial List of HART Commands:

Universal Commands Common Practice Commands Device Specific Commands

?Read manufacturer and device type

?Read primary variable (PV) and units

?Read current output and percent of range

?Read up to four pre-defined dynamic

variables

?Read or write ?Read selection of up to four

dynamic variables

?Write damping time constant

?Write device range values

?Calibrate (set zero, set span)

?Set fixed output current

?Perform self-test

?Perform master reset

?Trim PV zero

?Write PV unit

?Read or write low-flow

cut-off

?Start, stop, or clear

totalizer

?Read or write density

calibration factor

?Choose PV (mass, flow,

or density)

?Read or write materials

or construction

eight-character tag,

16-character descriptor,

date

?Read or write 32-character message

?Read device range values, units, and damping time

constant

?Read or write final assembly number

?Write polling address ?Trim DAC zero and gain

?Write transfer function

(square root/linear)

?Write sensor serial number

?Read or write dynamic

variable assignments

information

?Trim sensor calibration

?PID enable

?Write PID set point

?Valve characterization

?Valve set point

?Travel limits

?User units

?Local display

information

电脑通讯协议

电脑通讯协议 数据格式说明: 0XAF,0XAF:同步头 0X00,0X00:ID码(一般是0X00,0X00) 0XAF:头 0X80,0X00:命令码(上位机发码是0X80,YY,单片几发码给电脑0X00,YY)LEN:数据长度是从LEN开始到CS的数据个数,不包括LEN和CS CS:是验证码,CS前面所有数据之和%0XFF 结束码:0X0D 0X0A 举例: 设置空中参数为9600代码为: AF AF 00 00 AF 80 03 02 04 00 96 0D 0A 读取空中参数代码为: AF AF 00 00 AF 80 04 02 00 00 93 0D 0A //******************************************************************* 02发码设置串口 AF AF 00 00 AF 80 01 LEN XX YY CS 0D 0A XX:01-1200 02-2400 03-4800 04-9600 05-19200 06-38400 07-56700 08-115200 YY:00-无验证 01-偶验证 02-奇验证 答应回码 AF AF 00 00 AF 00 01 LEN XX YY CS 0D 0A XX:01-1200 02-2400 03-4800 04-9600 05-19200 06-38400

07-56700 08-115200 YY:00-无验证 01-验证 02-奇验证 //******************************************************************* 03读串口参数 //读串口参数 //AF AF 00 00 AF 80 02 LEN 00 00 CS 0D 0A //答应参数 //AF AF 00 00 AF 00 02 LEN XX YY CS 0D 0A XX:01-1200 02-2400 03-4800 04-9600 05-19200 06-38400 07-56700 08-115200 YY:00-无验证 01-偶验证 02-奇验证 //******************************************************************* 04设空中参数// //AF AF 00 00 AF 80 03 LEN XX YY CS 0D 0A //XX 01-1200 02-2400 03-4800 04-9600 05-19200 06-38400 07-56700 08-115200 YY=0 //答应参数 //AF AF 00 00 AF 00 03 LEN XX YY CS 0D 0A //XX 01-1200 02-2400 03-4800 04-9600 05-19200 06-38400 07-56700 08-115200

单片机串口通信协议程序

#include #include #define R55 101 #define RAA 202 #define RLEN 203 #define RDATA 104 #define RCH 105 //#define unsigned char gRecState=R55; unsigned char gRecLen; unsigned char gRecCount; unsigned char RecBuf[30]; unsigned char gValue; void isr_UART(void) interrupt 4 using 1 { unsigned char ch; unsigned char i; unsigned char temp; if (RI==1) { ch=SBUF; switch(gRecState) { case R55: // wait 0x55 if (ch==0x55) gRecState=RAA; break;

case RAA: if (ch==0xaa) gRecState=RLEN; else if (ch==0x55) gRecState=RAA; else gRecState=R55; break; case RLEN: gRecLen=ch; gRecCount=0; gRecState=RDATA; break; case RDATA: RecBuf[gRecCount]=ch; gRecCount++; if (gRecCount>=gRecLen) { gRecState=RCH; } break; case RCH: temp=0; for(i=0;i

网络协议大全

网络协议大全 在网络的各层中存在着许多协议,它是定义通过网络进行通信的规则,接收方的发送方同层的协议必须一致,否则一方将无法识别另一方发出的信息,以这种规则规定双方完成信息在计算机之间的传送过程。下面就对网络协议规范作个概述。 ARP(Address Resolution Protocol)地址解析协议 它是用于映射计算机的物理地址和临时指定的网络地址。启动时它选择一个协议(网络层)地址,并检查这个地址是否已经有别的计算机使用,如果没有被使用,此结点被使用这个地址,如果此地址已经被别的计算机使用,正在使用此地址的计算机会通告这一信息,只有再选另一个地址了。 SNMP(Simple Network Management P)网络管理协议 它是TCP/IP协议中的一部份,它为本地和远端的网络设备管理提供了一个标准化途径,是分布式环境中的集中化管理的重要组成部份。 AppleShare protocol(AppleShare协议) 它是Apple机上的通信协议,它允许计算机从服务器上请求服务或者和服务器交换文件。AppleShare可以在TCP/IP协议或其它网络协议如IPX、AppleTalk上进行工作。使用它时,用户可以访问文件,应用程序,打印机和其它远程服务器上的资源。它可以和配置了AppleShare协议的任何服务器进行通信,Macintosh、Mac OS、Windows NT和Novell Netware都支持AppleShare协议。 AppleTalk协议 它是Macintosh计算机使用的主要网络协议。Windows NT服务器有专门为Macintosh服务,也能支持该协议。其允许Macintosh的用户共享存储在Windows NT文件夹的Mac-格式的文件,也可以使用和Windows NT连接的打印机。Windows NT共享文件夹以传统的Mac文件夹形式出现在Mac用户面前。Mac 文件名按需要被转换为FAT(8.3)格式和NTFS文件标准。支持MAc文件格式的DOS和Windows客户端能与Mac用户共享这些文件。 BGP4(Border Gateway Protocol Vertion 4)边界网关协议-版本4 它是用于在自治网络中网关主机(每个主机有自己的路由)之间交换路由信息的协议,它使管理

模块通信协议

YL-0202通信协议 一、说明 本协议支持0~FF的全数据的传送,移植到其它通讯中可支持全双工通信模式,且带有自同步功能,无需超时。 二、串口 波特率:9600,1位起始位,1位停止位,8位数据位,无奇偶校验。

三、帧格式 1.命令帧格式概述 a.命令头——固定0x7F(数据中若有0x7F则发送双个0x7F,详见2) b.命令长度——命令长度包括:命令长度(1 byte)+命令字(1 byte)+数据(n byte),长 度不超过0x7E,不小于2 c.命令字——详见四:命令表 d.数据——n字节数据。 e.校验——校验内容包括:命令长度(1 byte)、命令字(1 byte)、数据(n byte)。 2.命令头说明 命令头固定为0x7F,数据或命令中若含有0x7F,则用(0x7F、0x7F)代替,此代替行为只传输时,所以在计算长度或校验时只按原数据计算,即一个0x7F。 如原命令:7F 0A 03 10 7F 37 50 7F 35 01 4A 实际传输数据为:7F 0A 03 10 7F 7F 37 50 7F 7F 35 01 4A 除去命令头实际传输数据共12字节,但命令长度则为0A即10字节,校验同理。 3.校验说明 校验为所有校验内容的异或值,校验函数如下: private byte checkSum(byte[] data, int offset, int length) { byte temp = 0; for (int i = offset; i < length + offset; i++) { temp ^= data[i]; } return temp; }

51串口通信协议(新型篇)

51串口通信协议(新型篇) C51编程:这是网友牛毅编的一个C51串口通讯程序! //PC读MCU指令结构:(中断方式,ASCII码表示) //帧:帧头标志|帧类型|器件地址|启始地址|长度n|效验和|帧尾标志 //值: 'n' 'y'| 'r' | 0x01 | x | x | x |0x13 0x10 //字节数: 2 | 1 | 1 | 1 | 1 | 1 | 2 //求和: ///////////////////////////////////////////////////////////////////// //公司名称:*** //模块名:protocol.c //创建者:牛毅 //修改者: //功能描述:中断方式:本程序为mcu的串口通讯提供(贞结构)函数接口,包括具体协议部分 //其他说明:只提供对A T89c51具体硬件的可靠访问接口 //版本:1.0 //信息:QQ 75011221 ///////////////////////////////////////////////////////////////////// #include #include //预定义 //帧 #define F_ST1 0x6e //帧头标志n #define F_ST2 0x79 //帧头标志y #define F_R 0x72 //帧类型读r #define F_W 0x77 //帧类型写w #define F_D 0x64 //帧类型数据帧d #define F_B 0x62 //帧类型写回应帧b #define F_C 0x63 //帧类型重发命令帧c #define F_Q 0x71 //帧类型放弃帧q #define F_ADDR 0x31 //器件地址0-9 #define F_END 0x7a //帧尾标志z #define F_SPACE 0x30 //空标志0 #define F_ERR1 0x31 //错误标志1,flagerr 1 #define F_ERR2 0x32 //错误标志2 2 //常数 #define S_MAXBUF 16 //接收/发送数据的最大缓存量 #define FIELD_MAXBUF 48 //最小场缓存,可以大于48字节,因为协议是以20字节为

协议号大全

协议号大全 Decimal Keyword Protocol References -------- ------------- ---------------------------- ---------------- 0 HOPOPT IPv6 Hop-by-Hop Option [RFC1883] 1 ICMP Internet Control Message [RFC792] 2 IGMP Internet Group Management [RFC1112] 3 GGP Gateway-to-Gateway [RFC823] 4 IP IP in IP (encapsulation) [RFC2003] 5 ST Stream [RFC1190,RFC1819] 6 TCP Transmission Control [RFC793] 7 CBT CBT [Ballardie] 8 EG P Exterior Gateway Protocol [RFC888,DLM1] 9 IG P any private interior gateway [IANA] (used by Cisco for their IGRP) 10 BBN-RCC-MON BBN RCC Monitoring [SGC] 11 NVP-II Network Voice Protocol [RFC741,SC3] 12 PUP PUP [PUP,XEROX] 13 ARGUS ARGUS [RWS4] 14 EMCON EMCON [BN7] 15 XNET Cross Net Debugger [IEN158,JFH2] 16 CHAOS Chaos [NC3] 17 UDP User Datagram [RFC768,JBP] 18 MUX Multiplexing [IEN90,JBP] 19 DCN-MEAS DCN Measurement Subsystems [DLM1] 20 HMP Host Monitoring [RFC869,RH6] 21 PRM Packet Radio Measurement [ZSU] 22 XNS-IDP XEROX NS IDP [ETHERNET,XEROX] 23 TRUNK-1 Trunk-1 [BWB6] 24 TRUNK-2 Trunk-2 [BWB6] 25 LEAF-1 Leaf-1 [BWB6] 26 LEAF-2 Leaf-2 [BWB6] 27 RDP Reliable Data Protocol [RFC908,RH6] 28 IRTP Internet Reliable Transaction [RFC938,TXM] 29 ISO-TP4 ISO Transport Protocol Class 4 [RFC905,RC77] 30 NETBLT Bulk Data Transfer Protocol [RFC969,DDC1] 31 MFE-NSP MFE Network Services Protocol [MFENET,BCH2] 32 MERIT-INP MERIT Internodal Protocol [HWB] 33 DCCP Datagram Congestion Control Protocol 34 3PC Third Party Connect Protocol [SAF3] 35 IDPR Inter-Domain Policy Routing Protocol [MXS1] 36 XTP XTP [GXC] 37 DDP Datagram Delivery Protocol [WXC] 38 IDPR-CMTP IDPR Control Message Transport Proto [MXS1] 39 TP++ TP++ Transport Protocol [DXF] 40 IL IL Transport Protocol [Presotto] 41 IPv6 Ipv6 [Deering]

各种通信协议

分层及通信协议 协议软件是计算机通信网中各部分之间所必须遵守的规则的集合,它定义了通信各部分交换信息时的顺序、格式和词汇。协议软件是计算机通信网软件中最重要的部分。网络的体系结构往往都是和协议对应的,而且,网络管理软件、交换与路由软件以及应用软件等都要通过协议软件才能发生作用。 一、通信协议 1、什么是通信协议 通信协议(简称协议Protoco l),是指相互通信的双方(或多方)对如何进行信息交换所一致同意的一整套规则。一个网络有一系列的协议,每一个协议都规定了一个特定任务的完成。协议的作用是完成计算机之间有序的信息交换。 通信网络是由处在不同位置上的各节点用通信链路连接而组成的一个群体。通信网必须在节点之间以及不同节点上的用户之间提供有效的通信,即提供有效的接入通路。在计算机通信网中,将这种接入通路称为连接(connection)。建立一次连接必需要遵守的一些规则,这些规则也就是通信网设计时所要考虑的主要问题。 (l)为了能在两个硬件设备之间建立起连接,应保证在源、宿点之间存在物理的传输媒介,在该通路的各条链路上要执行某种协议。 如果传输线路使用电话线,则要通过调制解调器将信号从数字转换成模拟的,并在接收端进行反变换。 如果用的是数字传输线路,则在数据处理设备和通信设备之间,必须有一个数字适配器,以便将数字信号的格式转换成两种设备各自所期望的形式。 为了在两个端设备之间互换数据,需要协调和同步,调制解调器和数字适配器必须执行它们自己的协议。 无论是模拟的还是数字的通信设备,调制解调器和数字适配器的状态必须由接到节点上的设备来控制,这里必定有一个物理的或电气的接口来执行这种功能,执行某种适当的协议来达到这一控制目的。 (2)在计算机通信网中,许多信息源都是突发性的(bursty),问题是要利用信息的这种突发性质来降低消耗在线路上的费用,由此开发了许多共享通信资源的技术。所谓共享,是指允许多个用户使用同一通信资源,这就产生了多用户的接入问题。多路接入

STP生成树协议原理与算法简析

STP生成树协议原理与算法简析 简介 在实际的网络环境中,物理环路可以提高网络的可靠性,当一条线路断掉的时候,另一条链路仍然可以传输数据。但是,在交换网络中,当交换机接收到一个未知目的地址的数据帧时,交换机的操作是将这个数据帧广播出去,这样,在存在物理的交换网络中,就会产生一个双向的广播环,甚至产生广播风暴,导致交换机死机。这就产生一个矛盾,需要物理环路来提高网络可靠性,而环路又可能产生广播风暴,如何才能两全其美呢? 本章将要讲述的STP,就是用来解决这个矛盾的。STP(Spanning Tree Protocol,生成树协议)是根据IEEE 802.1D 标准建立的,用于在局域网中消除数据链路层物理环路的协议。运行该协议的设备通过彼此交互信息发现网络中的环路,并有选择的对某些端口进行阻塞,最终将环路网络结构修剪成无环路的树型网络结构,从而防止报文在环路网络中不断增生和无限循环,避免设备由于重复接收相同的报文所造成的报文处理能力下降的问题发生。 STP采用的协议报文是BPDU(Bridge Protocol Data Unit,桥协议数据单元),也称为配置消息,BPDU中包含了足够的信息来保证设备完成生成树的计算过程。STP即是通过在设备之间传递BPDU来确定网络的拓扑结构。 1 STP 生成树协议 1.1 STP的主要作用 消除环路:通过阻断冗余链路来消除网络中可能存在的路径回环。 链路备份:当前活动路径发生故障时,激活冗余备份链路,恢复网络连通性。 1.2 STP的基本原理: 通过在交换机之间传递一种特殊的协议报文——BPDU(在IEEE 802.1D中这种协议报文被称为“配置消息”)来确定网络的拓扑结构。配置消息中包含了足够的信息来保证交换机完成生成树计算。(注:此BPDU被称为配置BPDU,另外STP还有TCN BPDU。)

通讯协议大全

T C P/I P TCP/IP是网络中使用的基本的通信协议。 TCP/IP协议包括TCP、IP、UDP、ICMP、RIP、TELNETFTP、SMTP、ARP、TFTP等许多协议,这些协议一起称为TCP/IP协议。 IPX/SPX(多用于局域网) 是基于施乐的XEROX’S Network System(XNS)协议,而SPX是基于施乐的XEROX’S SPP (Sequenced Packet Protocol:顺序包协议)协议 NetBEUI 即NetBios Enhanced User Interface,或NetBios增强用户接口。 网络通信协议: RS-232-C、RS-449、V.35、X.21、HDLC 简单网络管理协议: 简单网络管理协议SNMP、点到点协议PPP 3G标准: WCDMA(欧洲版)、CDMA2000(美国版)和TD-SCDMA(中国版) Modbus协议 Modbus就是工业控制器的网络协议中的一种 包括ASCII、RTU和TCP

现在Modbus已经是工业领域全球最流行的协议。此协议支持传统的RS-232、RS-422、RS-485和以太网设备。许多工业设备,包括PLC,DCS,智能仪表等都在使用Modbus协议作为他们之间的通讯标准。有了它,不同厂商生产的控制设备可以连成工业网络,进行集中监控。 网络协议大全 1、ARP(address resolution protocol)地址解析协议 2、SNMP(simple network management P)网络管理协议,是TCP/IP的一部分 3、AppleShare protocol(AppleShare 协议) 4、AppleTalk 协议 5?、BOOTP协议(Bootstrap?Protocol)?应用一个基于TCP/IP协议的协议,该协议主要用于有无盘工作站的局域网 6、CMIP(Common Management Information Protocol)通用管理信息协议,它是建立在开放系统互连通信模式上的网络管理协议。相关的通用管理信息服务(CMIS)定义了访问和控制网络对象,设备和从对象设备接收状态信息的方法。 7、 DHCP协议、Dynamic?Host?Configuration?Protocol(动态主机配置协议),应用:在Windows中要启用DHCP协议,只要将IP地址设置为“自动获得IP地址”即可 9、Connection-oriented Protocol/Connectionless Protocol面向连接的协议/无连接协议 10 、Discard Protocol抛弃协议它的作用就是接收到什么抛弃什么,它对调试网络状态

HLP SV Modbus标准通讯协议格式

HLP_SV Modbus RTU 标准通讯协议格式 通信资料格式 Address Function Data CRC check 8 bits 8 bits N×8bits 16bits 1)Address通讯地址:1-247 2)Function:命令码8-bit命令 01 读线圈状态 上位机发送数据格式: ADDRESS 01 ADDRH ADDRL NUMH NUML CRC 注: ADDR: 00000 --- FFFF(ADDR=线圈地址-1);NUM: 0010-----0040 (NUM为要读线圈状态值的二进制数位数) 正确时变频器返回数据格式: ADDRESS 01 BYTECOUNT DATA1 DATA2 DATA3 DATAN CRC 注: BYTECOUNT:读取的字数 错误时变频器返回数据格式: ADDRESS 0X81 Errornum CRC 注: Errornum为错误类型代码 如:要检测变频器的输出频率 应发送数据:01 01 00 30 00 10 3D C9(16进制) 变频器返回数据:01 01 02 00 20 B8 24(16进制) 发送数据:0030hex(线圈地址49) 返回的数据位为“0020”(16进制),高位与低位互换,为2000。即输出频率为 303(Max Ref)的50%。关于2000对应50%,具体见图1。

03读保持寄存器 上位机发送数据格式: ADDRESS 03 ADDRH ADDRL NUMH NUML CRC 注:ADDR: 0 --- 0XFFFF;NUM: 0010-----0040 (NUM为要读取数据的字数) ADDR=Parameter Numbe r×10-1 正确时变频器返回数据格式: ADDRESS 03 BYTECOUNT DATA1 DATA 2 DATA 3 DATAN CRC 注: BYTECOUNT:读取的字节数 错误时变频器返回数据格式: ADDRESS 0X83 Errornum CRC 如:要读变频器参数303的设定值 应发送数据:01 03 0B D5 00 02 95 BC (16进制) Parameter 303(3029)=0BD5HEX 变频器返回数据:“:”01 03 04 00 00 EA 60 B5 7B 返回的数据位为“00 00 EA 60”(16进制)转换为10进制数为60000, 表示303设置值为60.000 ※当参数值为双字时,NUM的值必须等于2。否则无法读取或读取错误。 05 写单个线圈状态 上位机发送数据格式: ADDRESS 05ADDRH ADDRL DATAH DA TAL CRC 注:ADDR: 0 ---- 0XFFFF(ADDR=线圈地址-1);DATA=0000HEX(OFF) OR FF00(ON) HEX 正确时变频器返回数据格式: ADDRESS 05 DATAH DATAL BYTECOUNT CRC 错误时变频器返回数据格式: ADDRESS 0X85 Errornum CRC 如:要使写参数为写入RAM和EEPROM 应发送数据:01 05 00 40 FF 00 CRC(16进制) 变频器返回数据:01 05 FF 00 00 01 CRC(16进制) 发送数据:0040hex(线圈地址65) 06 写单个保持寄存器值(只能写参数值为单个字的参数) 上位机发送数据格式: ADDRESS 06 ADDRH ADDRL DA TAH DATAL CRC 注:ADDR: ADDR=Parameter Numbe r×10-1 正确时变频器返回数据格式: ADDRESS 06 ADDRH ADDRL DA TAH DA TAL CRC 错误时变频器返回数据: ADDRESS 0X86 Errornum CRC 如:要对变频器参数101写入1 应发送数据:01 06 00 03 F1 00 01 19 BD(16进制) 变频器返回数据:01 06 03 F1 00 01 19 BD(16进制) PARAMETER 101(1009)=03F1 HEX

菱f系列plc编程口通信协议

三菱FX系列 PLC 编程口通信协议总览 三菱PLC-FX2N 三菱FX系列PLC编程口通信协议总览 该协议实际上适用于PLC编程端口以及 FX-232AW 模块的通信。 通讯格式: 命令命令码目标设备 DEVICE READ CMD "0" X,Y,M,S,T,C,D DEVICE WRITE CMD "1" X,Y,M,S,T,C,D FORCE ON CMD " 7" X,Y,M,S,T,C FORCE OFF CMD "8" X,Y,M,S,T,C 传输格式: RS232C 波特率: 9600bps 奇偶: even 校验: 累加方式(和校验) 字符: ASCII 16进制代码: ENQ 05H 请求 ACK 06H PLC正确响应 NAK 15H PLC错误响应 STX 02H 报文开始 ETX 03H 报文结束 帧格式: STX CMD DATA ...... DATA ETX SUM(upper) SUM(lower) 例子: STX ,CMD ,ADDRESS, BYTES, ETX, SUM 02H, 30H, 31H,30H,46H,36H, 30H,34H, 03H, 37H,34H

SUM=CMD+......+ETX; 30h+31h+30h+46h+36h+30h+34h+03h=74h; 累加和超过两位取低两位 1、DEVICE READ(读出软设备状态值) 计算机向PLC发送: 始命令首地址位数终和校验 STX CMD GROUP ADDRESS BYTES ETX SUM 例子:从D123开始读取4个字节数据 02h 30h 31h,30h,46h,36h 30h,34h 03h 37h,34h 地址算法:address=address*2+1000h 再转换成ASCII 31h,30h,46h,36h PLC返回 STX 1ST DATA 2ND DATA ..... LAST DATA ETX SUM 注:最多可以读取64个字节的数据 例子:从指定的存储器单元读到3584这个数据 02h 33h 35h 38h 34h 03h 44h,36h 2、DEVICE WRITE(向PLC软设备写入值) 始命令首地址位数数据终和校验 STX CMD GROUP ADDRESS BYTES 1ST DATA 2ND DATA ...... LAST DATA ETX SUM 例子:向D123开始的两个存储器中写入1234,ABCD 02h 31h 31h,30h,46h,36h 30h,34h 33h,34h,31h,32h,43h,44h,41h,42h 03h 34h,39h PLC返回 ACK (06H) 接受正确 NAK (15H) 接受错误 3、位设备强制置位/复位 FORCE ON置位 始命令地址终和校验 STX CMD ADDRESS ETX SUM 02h 37h address 03h sum FORCE OFF复位 始命令地址终和校验

通信协议与编程

MODBUS通讯协议及编程 ModBus通讯协议分为RTU协议和ASCII协议,我公司的多种仪表都采用ModBus RTU 通讯协议,如:YD2000智能电力监测仪、巡检表、数显表、光柱数显表等。下面就ModBus RTU协议简要介绍如下: 一、通讯协议 (一)、通讯传送方式: 通讯传送分为独立的信息头,和发送的编码数据。以下的通讯传送方式定义也与MODBUS RTU通讯规约相兼容: 初始结构= ≥4字节的时间 地址码= 1 字节 功能码= 1 字节 数据区= N 字节 错误校检= 16位CRC码 结束结构= ≥4字节的时间 地址码:地址码为通讯传送的第一个字节。这个字节表明由用户设定地址码的从机将接收由主机发送来的信息。并且每个从机都有具有唯一的地址码,并且响应回送均以各自的地址码开始。主机发送的地址码表明将发送到的从机地址,而从机发送的地址码表明回送的从机地址。 功能码:通讯传送的第二个字节。ModBus通讯规约定义功能号为1到127。本仪表只利用其中的一部分功能码。作为主机请求发送,通过功能码告诉从机执行什么动作。作为从机响应,从机发送的功能码与从主机发送来的功能码一样,并表明从机已响应主机进行操作。如果从机发送的功能码的最高位为1(比如功能码大与此同时127),则表明从机没有响应操作或发送出错。 数据区:数据区是根据不同的功能码而不同。数据区可以是实际数值、设置点、主机发送给从机或从机发送给主机的地址。 CRC码:二字节的错误检测码。

(二)、通讯规约: 当通讯命令发送至仪器时,符合相应地址码的设备接通讯命令,并除去地址码,读取信息,如果没有出错,则执行相应的任务;然后把执行结果返送给发送者。返送的信息中包括地址码、执行动作的功能码、执行动作后结果的数据以及错误校验码。如果出错就不发送任何信息。 1.信息帧结构 地址码:地址码是信息帧的第一字节(8位),从0到255。这个字节表明由用户设置地址的从机将接收由主机发送来的信息。每个从机都必须有唯一的地址码,并且只有符合地址码的从机才能响应回送。当从机回送信息时,相当的地址码表明该信息来自于何处。 功能码:主机发送的功能码告诉从机执行什么任务。表1-1列出的功能码都有具体的含义及操作 数据区:数据区包含需要从机执行什么动作或由从机采集的返送信息。这些信息可以是数值、参考地址等等。例如,功能码告诉从机读取寄存器的值,则数据区必需包含要读取寄存器的起始地址及读取长度。对于不同的从机,地址和数据信息都不相同。 错误校验码:主机或从机可用校验码进行判别接收信息是否出错。有时,由于电子噪声或其它一些干扰,信息在传输过程中会发生细微的变化,错误校验码保证了主机或从机对在传送过程中出错的信息不起作用。这样增加了系统的安全和效率。错误校验采用CRC-16校验方法。 注:信息帧的格式都基本相同:地址码、功能码、数据区和错误校验码。 2.错误校验 冗余循环码(CRC)包含2个字节,即16位二进制。CRC码由发送设备计算,放置于发送信息的尾部。接收信息的设备再重新计算接收到信息的 CRC码,比较计算得到的CRC码是否与接收到的相符,如果两者不相符,则表明出错。

几种通信协议

RS-232-C RS-232-C是OSI基本参考模型物理层部分的规格,它决定了连接器形状等物理特性、以0和1表示的电气特性及表示信号意义的逻辑特性。 RS-232-C是EIA发表的,是RS-232-B的修改版。本来是为连接模拟通信线路中的调制解调器等DCE及电传打印机等DTE拉接口而标准化的。现在很多个人计算机也用RS-232-C作为输入输出接口,用RS-232-C作为接口的个人计算机也很普及。 RS-232-C的如下特点:采用直通方式,双向通信,基本频带,电流环方式,串行传输方式,DCE-DTE间使用的信号形态,交接方式,全双工通信。RS-232-C在ITU建议的V.24和V.28规定的25引脚连接器在功能上具有互换性。 RS-232-C所使用的连接器为25引脚插入式连接器,一般称为25引脚D-SUB。DTE端的电缆顶端接公插头,DCE端接母插座。 RS-232-C所用电缆的形状并不固定,但大多使用带屏蔽的24芯电缆。电缆的最大长度为15m。使用RS-232-C在200K位/秒以下的任何速率都能进行数据传输。 RS-449 RS-449是1977年由EIA发表的标准,它规定了DTE和DCE之间的机械特性和电气特性。RS-449是想取代RS-232-C而开发的标准,但是几乎所有的数据通信设备厂家仍然采用原来的标准,所以RS-232-C仍然是最受欢迎的接口而被广泛采用。 RS-449的连接器使用ISO规格的37引脚及9引脚的连接器,2次通道(返回字通道)电路以外的所有相互连接的电路都使用37引脚的连接器,而2次通道电路则采用9引脚连接器。 RS-449的电特性,对平衡电路来说由RS-422-A规定,大体与V.11具有相同规格,而RS-423-A大体与V.10具有相同规格。

VB编写的Modbus RTU协议通讯源程序

modbus rtu协议可以算是一种事实上的工业标准协议,为许多仪表、PLC等所支持。以前有几个用户问如何使用VB编程来与我们的KND-K3系列PLC通讯,于是整了一个demo 程序。这次把这个demo共享,希望能给大家一点帮助。 1)模块文件:modCRC,其中包含了CRC校验的函数。 'data 待校验的数组名称 'no 数组中元素个数 'btLoCRC 算出的CRC高字节 'btHiCRC 算出的CRC低字节 Public Function CalCRC16Fast(data() As Byte, no As Integer, btLoCRC As Byte, btHiCR C As Byte) As String Dim CL As Byte, CH As Byte '多项式码&HA001 Dim SaveHi As Byte, SaveLo As Byte Dim i As Integer Dim Flag As Integer btHiCRC = &HFF btLoCRC = &HFF CL = &H1 CH = &HA0 For i = 0 To (no - 1) btHiCRC = btHiCRC Xor data(i) '每一个数据与CRC寄存器进行异或 For Flag = 0 To 7 SaveHi = btLoCRC SaveLo = btHiCRC btLoCRC = btLoCRC \ 2 '高位右移一位 btHiCRC = btHiCRC \ 2 '低位右移一位 If ((SaveHi And &H1) = &H1) Then '如果高位字节最后一位为1 btHiCRC = btHiCRC Or &H80 '则低位字节右移后前面补1 End If '否则自动补0 If ((SaveLo And &H1) = &H1) Then '如果LSB为1,则与多项式码进行异或 btLoCRC = btLoCRC Xor CH btHiCRC = btHiCRC Xor CL End If

交换机生成树协议原理

交换机生成树协议原理 方便用户连接服务器或高速主干网。用户也可以通过设计多台服务器(进行业务划分)或追加多个网卡来消除瓶颈。交换机还可支持生成树算法,方便用户架构容错的冗余连接。 1.网络中的广播帧 目前广泛使用的网络操作系统有Netware、WindowsNT等,而LanServer的服务器是通过发送网络广播帧来向客户机提供服务的。这类局域网中广播包的存在会大大降低交换机的效率,这时可以利用交换机的虚拟网功能(并非每种交换机都支持虚拟网)将广播包限制在一定范围内。 每台文交换机的端口都支持一定数目的MAC地址,这样交换机能够“记忆”住该端口一组连接站点的情况,厂商提供的定位不同的交换机端口支持MAC数也不一样,用户使用时一定要注意交换机端口的连接端点数。 如果超过厂商给定的MAC数,交换机接收到一个网络帧时,只有其目的站的MAC地址不存在于该交换机端口的MAC地址表中,那么该帧会以广播方式发向交换机的每个端口。 2.虚拟网的划分 虚拟网是交换机工作原理的重要功能,通常虚拟网的实现形式有三种: (1)静态端口分配

静态虚拟网的划分通常是网管人员使用网管软件或直接设置交换机的端口,使其直接从属某个虚拟网。这些端口一直保持这些从属性,除非网管人员重新设置。这种方法虽然比较麻烦,但比较安全,容易配置和维护。 (2)动态虚拟网 支持动态虚拟网的端口,可以借助智能管理软件自动确定它们的从属。端口是通过借助网络包的MAC地址、逻辑地址或协议类型来确定虚拟网的从属。当一网络节点刚连接入网时。 交换机工作原理端口还未分配,于是交换机通过读取网络节点的MAC地址动态地将该端口划入某个虚拟网。这样一旦网管人员配置好后,用户的计算机可以灵活地改变交换机端口,而不会改变该用户的虚拟网的从属性,而且如果网络中出现未定义的MAC地址,则可以向网管人员报警。 (3)多虚拟网端口配置 该配置支持一用户或一端口可以同时访问多个虚拟网。这样可以将一台网络服务器配置成多个业务部门(每种业务设置成一个虚拟网)都可同时访问,也可以同时访问多个虚拟网的资源,还可让多个虚拟网间的连接只需一个路由端口即可完成。 但这样会带来安全上的隐患。虚拟网的业界规范正在制定当中,因而各个公司的产品还谈不上互操作性。Cisco公司开发了 Inter-SwitchLink(ISL)虚拟网络协议,该协议支持跨骨干网(ATM、FDDI、FastEther)的虚拟网。但该协议被指责为缺乏安全性上的考虑。

智能家居通讯协议大汇总

智能家居无疑是这几年来热门的研究对象之一,各类协议不停的更新最新版本及改进缺点,导致目前没有一种真正意义上国际标准化用于智能家居、智能照明的通讯协议。本文主要针对各种方案的原理,技术特点及优缺点作出了一个对比并以此展望了智能家居市场的未来。 下面我们将一一介绍这些协议: 一、ZigBee协议: Zigbee是IEEE 802.15.4协议的简称,它来源于蜜蜂的八字舞,蜜蜂(bee)是通过飞翔和“嗡嗡”(zig)抖动翅膀的“舞蹈”来与同伴传递花粉所在方位信息,而ZigBee协议的方式特点与其类似便更名为ZigBee。ZigBee主要适合用于自动控制和远程控制领域,

可以嵌入各种设备,其特点是传播距离近、低功耗、低成本、低数据速率、可自组网、协议简单。 ZigBee的主要优点如下: 1. 功耗低 对比Bluetooth与WiFi,在相同的电量下(两节五号电池)可支持设备使用六个月至两年左右的时间,而Bluetooth只能工作几周,WiFi仅能工作几小时。 2. 成本低 ZigBee专利费免收,传输速率较小且协议简单,大大降低了ZigBee设备的成本。 3. 掉线率低 由于ZigBee的避免碰撞机制,且同时为通信业务的固定带宽预留了专用的时间空隙,使得在数据传输时不会发生竞争和冲突;可自组网的功能让其每个节点模块之间都能建立起联系,接收到的信息可通过每个节点模块间的线路进行传输,使得ZigBee传输信息的可靠性大大提高了,几乎可以认为是不会掉线的。 4. 组网能力强 ZigBee的组网能力超群,建立的网络每个有60,000个节点。 5. 安全保密

ZigBee提供了一套基于128位AES算法的安全类和软件,并集成了IEEE 802.15.4的安全元素。 6. 灵活的工作频段 2.4 GHz,868 MHz及915 MHz的使用频段均为免执照频段。 ZigBee的缺点如下: 1. 传播距离近 若在不适用功率放大器的情况下,一般ZigBee的有效传播距离一般在10m-75m,主要还是适用于一些小型的区域,例如家庭和办公场所。但若在牺牲掉其低掉线率的优点的前提下,以节点模块作为接收端也作为发射端,便可实现较长距离的信息传输。 2. 数据信息传输速率低 处于2.4 GHz的频段时,ZigBee也只有250 Kb/s的传播速度,而且这单单是链路上的速率且不包含帧头开销、信道竞争、应答和重传,去除掉这些后实际可应用的速率会低于100 Kb/s,在多个节点运行多个应用时速率还要被他们分享掉。 3. 会有延时性 ZigBee在随机接入MAC层的同时不支持时分复用的信道接入方式,因此在支持一些实时的应用时会因为发送多跳和冲突会产生延时。 二、Bluetooth(蓝牙协议)

常用几种通讯协议

常用几种通讯协议 Modbus Modbus技术已成为一种工业标准。它是由Modicon公司制定并开发的。其通讯主要采用RS232,RS485等其他通讯媒介。它为用户提供了一种开放、灵活和标准的通讯技术,降低了开发和维护成本。 Modbus通讯协议由主设备先建立消息格式,格式包括设备地址、功能代码、数据地址和出错校验。从设备必需用Modbus协议建立答复消息,其格式包含确认的功能代码,返回数据和出错校验。如果接收到的数据出错,或者从设备不能执行所要求的命令,从设备将返回出错信息。 Modbus通讯协议拥有自己的消息结构。不管采用何种网络进行通讯,该消息结构均可以被系统采用和识别。利用此通信协议,既可以询问网络上的其他设备,也能答复其他设备的询问,又可以检测并报告出错信息。 在Modbus网络上通讯期间,通讯协议能识别出设备地址,消息,命令,以及包含在消息中的数据和其他信息,如果协议要求从设备予以答复,那么从设备将组建一个消息,并利用Modbus发送出去。 BACnet BACnet是楼宇自动控制系统的数据通讯协议,它由一系列与软件及硬件相关的通讯协议组成,规定了计算机控制器之间所有对话方式。协议包括:(1)所选通讯介质使用的电子信号特性,如何识别计算机网址,判断计算机何时使用网络及如何使用。(2)误码检验,数据压缩和编码以及各计算机专门的信息格式。显然,由于有多种方法可以解决上述问题,但两种不同的通讯模式选择同一种协议的可能性极少,因此,就需要一种标准。即由ISO(国际标准化协会〉于80年代着手解决,制定了《开放式系统互联(OSI〉基本参考模式(Open System Interconnection/Basic Reference Model简称OSI/RM)IS0- 7498》。 OSI/RM是ISO/OSI标准中最重要的一个,它为其它0SI标准的相容性提供了共同的参考,为研究、设计、实现和改造信息处理系统提供了功能上和概念上的框架。它是一个具有总体性的指导性标准,也是理解其它0SI标准的基础和前提。 0SI/RM按分层原则分为七层,即物理层、数据链路层、网络层、运输层、会话层、表示层、应用层。 BACnet既然是一种开放性的计算机网络,就必须参考OSIAM。但BACnet没有从网络的最低层重新定义自己的层次,而是选用已成熟的局域网技术,简化0SI/RM,形成包容许多局 域网的简单而实用的四级体系结构。 四级结构包括物理层、数据链路层、网络层和应用层。

相关文档