Actions

Difference between revisions of "Modbus TCP"

From Zenitel Wiki

Line 20: Line 20:
 
In this example the information is written to specific registers in the PLC, 1 register for each intercom station. The PLC registers to use are from 50001 and up, the intercom stations have directory number 101 and up.
 
In this example the information is written to specific registers in the PLC, 1 register for each intercom station. The PLC registers to use are from 50001 and up, the intercom stations have directory number 101 and up.
 
<br>
 
<br>
Example: Station line error
+
Example: Station line error - Program an event:
Progam an event:
 
 
* Owner Type: Station with UDP 8
 
* Owner Type: Station with UDP 8
 
* Event Type: 13 - Faulty station line
 
* Event Type: 13 - Faulty station line

Revision as of 11:58, 24 January 2012

Introduction

Modbus TCP is a Modbus variant used for communications over TCP/IP networks, connecting over port 502. It does not require a checksum calculation as lower layers already provide checksum protection. Note that this is not the same as as Modbus over TCP/IP. For background information on Modbus and its different variants please see the Modbus article in Wikipedia. Modbus is often used by PLC's.

AlphaCom and the Modbus TCP protocol

AlphaCom can send out status information in the Modbus TCP protocol via an EDO-port.

  • Select an available EDIO port, for instance EDIO 1
  • TCP/IP client
  • Enter the IP address of the PLC to connect to
  • Enter the Port nr. which is used by the Modbus TCP protocol, by default 502

Modbus TCP protocol - AlphaPro programming

The exact meaning of databytes will depend on the specific installation and PLC used. This article gives an example of an implementation for a real installation. Please modify as appropriate for the actual requirement. In this example the AlphaCom sends status information about each intercom station to a PLC, which uses this information for visualisation. The status is coded in a single byte, where each bit has a specific meaning.

  • Bit #0: Intercom station is OK and ready for use
  • Bit #1: Faulty line or faulty station
  • Bit #2: Intercom station in conversation

In this example the information is written to specific registers in the PLC, 1 register for each intercom station. The PLC registers to use are from 50001 and up, the intercom stations have directory number 101 and up.
Example: Station line error - Program an event:

  • Owner Type: Station with UDP 8
  • Event Type: 13 - Faulty station line
  • When Change To: ON
  • Action string: EDO 1 "\0\x01\0\0\0\x06\x02\x06%dfmt(%op(%1.dir,+,49900),X,4)\0\x02"

In this specific case the meaning of the bytes is:

  • \0\x01 - Transaction Identifier; 2 bytes
  • \0\0 - Protocol Identifier; 2 bytes; always '0' for Modbus TCP
  • \0\x06 - Length Field; 2 bytes; Number of remaining bytes in this frame
  • \x02 - Unit Identifier; 1 byte; Slave Address (255 if not used)
  • \x06 - Function code; 1 byte; Function codes as in other variants
  • %dfmt(%op(%1.dir,+,49900),X,4)\0\x02 - Data bytes; n bytes; Data as response or commands