Difference between revisions of "Modbus Server"
Line 156: | Line 156: | ||
|- | |- | ||
− | |unitid.address.di | + | |rowspan="3"|unitid.address.di |
|bit:0<br/>bit:false<br/>bit:off<br/> | |bit:0<br/>bit:false<br/>bit:off<br/> | ||
|W | |W | ||
|sets a single bit in the discrete inputs data table to off | |sets a single bit in the discrete inputs data table to off | ||
|- | |- | ||
− | + | |bit:1<br/>bit:true<br/>bit:on<br/> | |
+ | |W | ||
+ | |sets a single bit in the discrete inputs data table to on | ||
+ | |- | ||
+ | |bits:<0|1|-...><br/> '-' characters in the sequence are skipped | ||
+ | |W | ||
+ | |sets multiple bits in the discrete inputs data table. The left-most bit in the sequence is the discrete input at <address> | ||
+ | |- | ||
|} | |} | ||
Revision as of 15:24, 17 March 2014
The Modbus Protocol is a messaging structure. It is used to establish master-slave/client-server communication between intelligent devices. It is a de facto standard. The Modbus RTU specification defines the default communication protocol over serial lines. The Modbus TCP/IP specification takes the Modbus instruction set and wraps TCP/IP around it.
HSYCO’s MODBUS TCP SERVER I/O Server implements a Modbus TCP/IP server, allowing external Modbus clients to connect to HSYCO and perform any standard Modbus function.
This support is implemented as a simple Java API.
Contents
HSYCO Configuration
Options
ID | Default | Values | Description |
---|---|---|---|
eventslog | false | true | if the general eventsLog option is also true in hsyco.ini, Modbus events for this gateway are written in the log files |
false | Modbus events for this gateway are not written in the log files, even if the eventsLog option is true in hsyco.ini |
Modbus Server Integration
The Modbus TCP Server is implemented as a multi-threaded socket server that can accept multiple concurrent connections.
There are no hard-coded limits to the number of concurrent connections and no idle time-out mechanism to disconnect connections that don’t do any traffic for a certain amount of time. A socket-level keepalive mechanism is in place to ensure that a socket thread is closed and resources freed if the client drops the connection without a graceful close.
It is the clients’ responsibility to ensure the correct handling of connections to the server.
Whenever a client sends a Modbus request to the HSYCO server, the Modbus TCP Server will execute a Java callback method passing the complete PDU as a byte array, and respond with a PDU based on the returned byte array or, if the callback method is not defined or returns null, it will execute the Modbus read or write function using its internal data tables.
Datapoints
The naming convention HSYCO uses for the events is closely related to the Modbus addressing standards and data types.
The data point names always begin with the same format: <ioserver_id>.unitid.address, where unitid is the Modbus slave device address, from 1 to 247, and address is the initial register address you are reading.
The supported public function codes are:
- 01: Read Coils
- 02: Read Discrete Inputs
- 03: Read Holding Registers
- 04: Read Input Registers
- 05: Write Single Coil
- 06: Write Single Register
- 15: Write Multiple Coils
- 16: Write Multiple Registers
- 22: Mask Write Register
These functions read and write data on four distinct data tables:
Table | Suffix | Object Type | Mode | Functions |
---|---|---|---|---|
Discrete Inputs | .di | Single bit | Read Only | 02 |
Coils | .co | Single bit | Read Write | 01 05 15 |
Input Registers | .ir | 16-bit word | Read Only | 04 |
Holding Registers | .hr | 16-bit word | Read Write | 03 06 16 22 |
Operations on Input Registers and Holding Registers tables support the following data types:
Type code | Description | Return range | Number of registers |
---|---|---|---|
ushort | unsigned short integer | 0 ... 65535 | 1 |
uint | unsigned integer | 0 ... (232 - 1) | 2 |
ulong | unsigned long integer | 0 ... (264 - 1) | 4 |
short signed | short integer | -32768 ... +32767 | 1 |
int | signed integer | -231 ... (231 - 1) | 2 |
long | signed long integer | -263 ... (263 - 1) | 4 |
float | signed IEEE 754 floating point | +/- 2-149 ... (2-2-23)x2127 | 2 |
Discrete Inputs Data Table
The internal discrete inputs data table can be read by a Modbus client, and written locally to set the discrete inputs’ values.
ID | Value | R/W | Description |
---|---|---|---|
unitid.address.di | bit:0 bit:false bit:off |
W | sets a single bit in the discrete inputs data table to off |
bit:1 bit:true bit:on |
W | sets a single bit in the discrete inputs data table to on | |
1|-...> '-' characters in the sequence are skipped |
W | sets multiple bits in the discrete inputs data table. The left-most bit in the sequence is the discrete input at <address> |
User Interface
Airzone Object
The user interface for the Airzone control framework:
The (airzone) object is listed in the Project Editor’s new object list only when at least one Airzone I/O Server is defined.
Parameters
- server id: the server ID
- zone: the zone
- position: the object's position. Use the pixels or rows and columns coordinates format
Syntax
(airzone <server id>; <zone>; <position>)
E.g.
(airzone serverid; zone; x10y20)
UISET Actions
You can use any object that accepts a text attribute, usually text, but also marquee and others, to display the status of the system according to the following table:
USER Commands
The CSx75 I/O Server supports a few system commands to be inserted within the Web interface. The controls are directly supported as ordinary user objects, by setting the name and param fields according to the following table:
ID | Attribute | Set to |
---|
Name | Param | Action |
---|