Modbus

Solo disponible en BuenasTareas
  • Páginas : 11 (2568 palabras )
  • Descarga(s) : 0
  • Publicado : 7 de noviembre de 2011
Leer documento completo
Vista previa del texto
27/02/2011

Introduction to MODBUS - Developer …

Improve your ni.com experience. Login or Create a user profile.

Document Type: Tutorial NI Supported: Yes Publish Date: Feb 18, 2009

Introduction to MODBUS
Overview MODBUS is an application-layer protocol based on a client/server or request/reply architecture. It was published by Modicon and 1979 and is primarily used in industrialapplications. The following tutorial outlines the high level functionality of the MODBUS application layer with emphasis on the specifications for a serial implementation and TCP/IP specification. For more details, please see the complete MODBUS specifications on www.modbus.org. Table of Contents 1. 2. 3. 4. 5. 6. MODBUS Protocol Hardware Implementations LabVIEW Libraries MODBUS IO server MODBUSFrequently Asked Questions 1Resources

MODBUS Protocol Introduction The MODBUS protocol follows a client/server (master/slave) architecture where a client will request data from the server. The client can also ask the server to perform some action. The client initiates a process by sending a function code that represents the type of transaction to perform. The transaction performed by the MODBUSprotocol defines the process a controller uses to request access to another device, how it will respond to requests from other devices, and how errors will be detected and reported. The MODBUS protocol establishes a common format for the layout and contents of message fields. During communications on a MODBUS network, the protocol determines how each controller will know its device address, recognizea message addressed to it, determine the kind of action to be taken, and extract any data or other information contained in the message. Controllers communicate using a master/slave technique where only one device, the master, can initiate transactions or queries. The other devices, slaves, respond by supplying the requested data to the master or by taking the action requested in the query.Typical master devices include host processors and programming panels. Typical slaves include programmable controllers.

zone.ni.com/devzone/cda/tut/p/id/767…

1/15

27/02/2011

Introduction to MODBUS - Developer …

Figure 1: Basic MODBUS Network1

Figure 2: Basic MODBUS Transaction1

The messages exchanged between the client and the server is called frames. There are two types of MODBUSframes: Protocol Data Unit (PDU) and Application Data Unit (ADU). The PDU frames contain a function code followed by data. The function code represents the action to perform and the data represents the information to be used for this action. ADU frames add a little more complexity with an additional address part. ADU frames also provide some error checking. Both the ADU and PDU frames followBig-Endian encoding.

Figure 3: MODBUS Frame1

MODBUS transactions always perform a set of actions by reading or writing to a set of four data types. Table 1 describes the four data formats used by the MODBUS application layer.

zone.ni.com/devzone/cda/tut/p/id/767…

2/15

27/02/2011

Introduction to MODBUS - Developer …

Table 3: MODBUS Data Types 1

The Discrete Inputs represent asingle bit (Boolean) which can only be read. In other words, the client can only perform a read action on the discrete inputs. The same holds for the Input Registers. The client can only read the server’s Input Registers. The difference between the Discrete Inputs and the Input Registers is that the Input Registers represent 16 bits while the Discrete Inputs are only a single bit. The Coils alsorepresent a Boolean data type which can be read and written from the client. The Holding Registers represent a 16 bit word that can be read and written to.

Figure 4: MODBUS Transaction with Data Types 1

The Complete MODBUS Transaction As mentioned before, the type of action that the server performs is defined by a function code. For example, if the client wants to reads a certain Discrete...
tracking img