...
Table of Contents | ||
---|---|---|
|
...
Introduction
The RediGate Configuration Manual describes the configuration of many of the RediGate's standard features using the ACE program. This document gives additional instructions for configuring the RediGate to use the following protocols:
...
Function Code | Register Group | Starting Address | Read/Write Read-Only | Description |
---|---|---|---|---|
1 | Coil Registers | 00,001 | Read | Coils are used for digital outputs or other general purpose Boolean values. |
2 | Status Registers | 10,001 | Read-only | Status Registers are Boolean values, typically used for digital status inputs. |
3 | Holding Registers | 40,001 | Read | Holding Registers are the most commonly used register, used for analog outputs, and general purpose integer or floating point data, strings, etc. |
4 | Input Registers | 30,001 | Read-only | Input Registers are typically used for analog inputs. |
5 | Write Coil | 00,001 | Write | Write a single Coil. |
6 | Write Holdreg | 40,001 | Write | Write a single Holding Register. |
15 | Write Multiple Coils | 00,001 | Write | Write multiple Coil Registers. |
16 | Write Multiple Holdregs | 40,001 | Write | Write multiple Holding Registers. |
...
For example, using a Function Code=3, Offset=0, and Count=6 would request the registers commonly notated as 40,001-40,006. The following message shows this poll and response for a device number 21 (0x15). The values returned from the registers in this example are 0001 through 0006 (underlined below).
...
Info |
---|
Note that both Modbus TCP-Encapsulated and Open Modbus/TCP use TCP/IP protocol to transport Modbus protocol messages, but the contents of data packets are slightly different. Be aware that some devices use one or the other protocol type, and they may use somewhat different terminology to refer to these options. If the device uses port 502, it is almost certain that the protocol is Open Modbus/TCP. If the device vendor provides documentation on the binary protocol structure, the presence or absence of the Modbus CRC is another way to distinguish the two protocols. |
...
The following sections describe the ACE objects used for Modbus Master, object properties (including constraints on the Instance number), and object fields and their possible values required to configure for the given protocol(s). The object structure in ACE is hierarchical, with each object existing under a certain parent object. For instance, the FieldUnit is the child of one of several types of Circuit objects, either serial or network type (" System>Clients>Master Channels>Master Channel>Circuit").
...
Include Page | ||||
---|---|---|---|---|
|
AsyncCircuit, NetCircuit
As with most FieldUnit types, Modbus Master requires either an AsyncCircuit for serial (RS-232 or RS-485) devices or a NetCircuit for TCP/IP devices (TCP-Encapsulated Modbus or Open Modbus/TCP).
...
Poll Table Properties | |
---|---|
Properties | Values |
Source Register | Enter the starting source register in the device to begin polling data. This will be found in the documentation for the device, based on the information that you want to obtain. The format of the Source Register depends on the configuration of the Source Format, described below. For OFFSET source formats, the Source Register should be entered as a zero-based Offset (Coils or Holding registers only). For other Source Formats, the Source Register must be entered as a 5-digit absolute address. |
Source Format | Select the data type of the data being read in this row of the Poll Table. See below for under Configuring Source Format for more details on this option. |
Count | Enter the count of points to read from the device. For everything other than Strings, the Count includes the number of entities (Boolean, 16-bit, 32-bit, etc.) being requested, based on the Source Format setting listed above. This will typically also be the number of Destination Registers used by the poll. For String data types, the Count must be configured to match whatever convention is used in the Modbus device, and it must be defined such that the Modbus response contains the correct number of response registers (multiples of 8 bytes for String-8, multiples of 16 bytes for String-16, etc.). See below under “Configuring String Data Formats” for more details on the String data types. |
Destination Register | Enter the starting destination register within the field unit's RTDB into which the Write Count of data points will be stored. These registers must be configured in the RTDB object. The Destination Register type should be chosen based on the Source Format of the data points defined on this row of the Poll Table:
|
Comment | The Comment column is an optional field, allowing a description to be entered for each row in the table. This is only for the user and has no effect on the operation of the RediGate. |
...
AnchorConfiguringSourceFormat ConfiguringSourceFormat
Configuring Source Format
ConfiguringSourceFormat | |
ConfiguringSourceFormat |
...
The following “OFFSET” formats are equivalent to the Source Format types above in byte and word order, but they allow the configuration to identify the source register using the "Function Code / Offset" convention. The OFFSET type of Source Format is sometimes necessary for Modbus devices that have coil registers greater than 9999 or holding registers numbered higher than an offset of 25,534 (i.e., higher than an absolute address of 65535).
For each OFFSET type, the Source Format column should be configured as a number from 0 to 65535, which is an offset from the first coil register (function code 1) or the first holding register (function code 3). Only Modbus commands 1 and 3 are currently supported for reading OFFSET types (with corresponding Modbus write function codes 5, 6, 15, and 16).
OFFSET Source Formats | Description | Meaning | ||
---|---|---|---|---|
OFFSET Coils 0 to 65535 | Binary (single bit) registerBinary (single bit) register | Use Modbus command 1 with offset (starting from 0) as the Source Register to request Boolean coils. | ||
OFFSET 16 bit Hreg (HL) 0 to 65535 | Big Endian 16-bit register | Use Modbus command 3 for all following command formats. Typical 16-bit holding register, but requested with Source Register as an offset (starting from 0). | ||
OFFSET 32 bit Hreg (hlHL) 0 to 65535 | Little-Big Endian 32-bit register | 32-bit holding register, with Source Register as an offset | ||
OFFSET 16 BitPair L/B Endian (hl HL) 0 to 65535 | Little-Big Endian 16-bit pair of registers | 32-bit value stored as pairs of registers, requested with Source Register as an offset. Bytes transmitted in Little-Big Endian byte order (LSW first). | ||
OFFSET 32 Bit B/B Endian (HLhl) 0 to 65535 | Big-Big Endian 32-bit register | Each of the OFFSET Source Format types use the same Endian notation as in the previous table of Source Formats. | ||
OFFSET 16 Bit Pair B/B Endian (HL hl) 0 to 65535 | Big-Big Endian 16-bit pair of registers. | |||
OFFSET 16 Bit L Endian (LH) 0 to 65535 | Little Endian 16-bit register | |||
OFFSET 32 Bit L/L Endian (lhLH) 0 to 65335 | Little-Little Endian 32-bit register | |||
OFFSET 16 Bit Pair L/L Endian (lh LH) 0 to 65535 | Little-Little Endian 16-bit pair of registers. | |||
OFFSET 32 Bit B/L Endian (LHlh) 0 to 65535 | Big-Little Endian 32-bit register | |||
OFFSET 16 Bit Pair B/L Endian (LH lh) 0 to 65535 | Big-Little Endian 16-bit pair of registers. |
Examples of Source Format
...
String Source Formats | Description | Meaning |
---|---|---|
String-8 (abcdefgh)String-8 (abcdefgh) | 8-character String request8-character String request | Request sets of four 16-bit registers, returning 8 ASCII characters, which should be stored into STRING32 or STRING256 RTDB registers. Only 8 characters are stored into each RTDB register (multiple register reads are stored into sequential RTDB string registers). Example: Omni flow computer in Omni mode returns 8 characters in response to a read request with Count=1. But in Modicon mode, you have to request a Count=4 registers in order to receive 8 characters. The RediGate Modbus driver will accept the bytes that are returned in whatever quantity, regardless of the mode, and store them into the RTDB in groups of 8 until the whole response message is processed. |
String-8 Swapped (badcfehg) | 8-character String request, byte-swapped | Like the String-8, only each pair of bytes (MSB/LSB in each register) is reversed. Only 8 characters are stored into each RTDB register (multiple register reads are stored into sequential RTDB string registers). |
String-16 (abcdefghijklmnop) | 16-character String request | Request sets of eight 16-bit registers, returning 16 ASCII characters, which should be stored into STRING32 or STRING256 RTDB registers. Only 16 characters are stored into each RTDB register (multiple register reads are stored into sequential RTDB string registers). |
String-16 Swapped (badcfehgjilknmpo) | 16-character String request, byte-swapped | Like the String-16, only each pair of bytes (MSB/LSB in each register) is reversed. Only 16 characters are stored into each RTDB register (multiple register reads are stored into sequential RTDB string registers). |
String-32 (abcdefghijklmnop) | 32-character String request | Request sets of sixteen 16-bit registers, returning 32 ASCII characters, which should be stored into STRING32 or STRING256 RTDB registers. Only 32 characters are stored into each RTDB register (multiple register reads are stored into sequential RTDB string registers). |
String-32 Swapped (badcfehgjilknmpo) | 32-character String request, byte-swapped | Like the String-32, only each pair of bytes (MSB/LSB in each register) is reversed. Only 32 characters are stored into each RTDB register (multiple register reads are stored into sequential RTDB string registers). |
OFFSET String-8 (abcdefgh) 0 to 65535 | 8-character String request, using Offset instead of register address | Like String-8, but the Source Register is an offset from register 40001, not an absolute address (using Modbus command 3). |
OFFSET String-8 Swapped (badcfehg) 0 to 65535 | 8-character String request, byte-swapped, using Offset instead of register address | Like String-8 Swapped, but using Source Register as offset. |
OFFSET String-16 (abcdefghijklmnop) 0 to 65535 | 16-character String request, using Offset instead of register address | Like String-16, but using Source Register as offset. |
OFFSET String-16 Swapped (badcfehgjilknmpo) 0 to 65535 | 16-character String request, byte-swapped, using Offset instead of register address | Like String-16 Swapped, but using Source Register as offset. |
OFFSET String-32 (abcdefghijklmnop) 0 to 65535 | 32-character String request, using Offset instead of register address | Like String-32, but using Source Register as offset. |
OFFSET String-32 Swapped (badcfehgjilknmpo) 0 to 65535 | 32-character String request, byte-swapped, using Offset instead of register address | Like String-32 Swapped, but using Source Register as offset. |
Example of writing to String registers
...
Below is an example of a Poll Table containing a command to read String-8 registers from a device that stores ASCII data with two bytes per 16-bit register. The Poll Table reads 12 registers from the device, receives 24 bytes in response, parses the message into three String-8 values, and stores the resulting data into 48001-3 (40033‑36 à 48001, 40037‑40 à 48002, and 40041‑44 à 48003).
Source Register | Source Format | Count | Destination Register |
40033 | String-8 | 12 | 48001 |
...
If a host writes to 48001, the RediGate Modbus driver will correctly write the four registers (40033‑36) back to the device. But writing to 48002 or 48003 will not work correctly. In order to make all of the String registers write to the correct locations, there must be additional polls defined in the Poll Table (which do not need to be scanned in the Scan Table), as follows:
...
If these special additional capabilities of the Modbus polling are not needed, this object may be omitted from the configuration.
Attributes | Function |
---|---|
Object Type | SosMod |
Parent(s) | System → Clients → Master Channels → Master Channel → Circuit → Modbus Field Unit |
Instance | Must be 0 |
...
Properties | Values |
---|---|
Poll Modification Defs | Click the Edit Table button to define the special characteristics needed for the Modbus protocol modification on this Field Unit. |
Poll Index | This refers to the poll numbers defined in the Field Unit Poll Table. The poll message whose number appears in this row will be modified as specified in the remainder of this row. If several rows refer to the same poll number, all modifications will be evaluated before modifying this poll transmit message, in case one condition specifies "no modification". |
Trig. Addrs | Enter the Modbus address location in this RTU's RTDB to use for a Trigger Address. If the Trig Address contain the exact value as specified in the "Trig Value" parameter, then this SOS row becomes active, and the modification of this poll message will take place. The values in the Trig Address RTDB registers may be modified by a polling process, or by ISaGRAF or POD logic. |
Trig. Value | Enter the value which, if found at the Trig Addrs. location, will cause the poll message modification to take place. This value may be between 0 and 65535 inclusive. If the Trig Addrs is a Boolean register, the valid values are 0 and 1. |
Tx Start Byte | Unless using a "Skip" option for the Fill Control, the SOS table allows bytes in a Modbus message to be modified before the poll is sent. The poll byte modification is controlled by the Tx Start Byte, Tx #Bytes Filled, Fill from Addrs. and Fill Control parameters. Enter the starting byte of the Modbus poll command to be modified. Modbus poll Tx bytes that might be used for this option typically include:
|
Tx #Bytes Filled | Enter how many bytes in the poll command are to be modified starting at the Tx Start Byte. |
Fill from Addrs | Enter the Modbus location in the RTDB containing the bytes to use for the poll modification. The values in this RTDB location(s) should be filled as required, before the Trigger occurs, either by ISaGRAF, an external host, or as the result of another poll to the Field Unit. |
Fill Control | This parameter allows certain variations when executing the self-modifying poll. If either of the "Skip" options is used, the poll is either skipped or not skipped based on the value of the Trig. Addrs. Otherwise (if using a non-Skip option on this SOS table row), bytes in the Modbus poll will be modified before sending to the device. This can be useful for some complex operations, such as working with non-standard Modbus in certain flow computers. Options available for this parameter are: No Conversion (LSB first) - Bytes from the Fill from Addrs registers are used with no conversion, as 16-bit values. Byte Swapping (MSB first) - Bytes from the Fill from Addrs. Register are put into the transmit message MSB first, followed by LSB. Fill using LSB only - Use this option if the Fill from Addrs register contains an 8-bit value rather than a 16-bit value, so that the most-significant byte is omitted. If more than one byte is modified (Tx #Bytes Filled > 0), the subsequent registers will be used as the source of the additional bytes. Skip Poll if Matching Trigger - Selecting this option causes the poll not to be sent if the value in the Trig Addrs matches the Trig Value (NOTE that no byte modification occurs in this case). When selecting this option, the other values in this row of the Poll Modification Def must be set to dummy values but will not be used. Skip Poll on NON-Matching Trigger – If the Trigger register contains a zero value, then ignore. If the trigger register is non-zero, skip the poll. |
Extra Logic | This option gives some additional options that may be used in the Modbus poll modification. None – Choose this option to disable Extra Logic. Ignores the parameter RTDB for Poll Length. Save Reply Length to RTDB – Use last field to save byte count of the Modbus reponse packet length. Incr-FillRtdb+Decr-SaveRtdb – The Fill from Addrs RTDB register is incremented after the poll happens. The next consecutive RTDB register is decremented (assuming that the poll was successful.) See section Modbus Flow Computer SOS Example23527434 for an example of how this "Incr-FillRtdb+Decr-SaveRtdb" option would be used. |
RTDB for Poll Length | Enter the Modbus address into which you want put the byte length of the response. This is very useful if your command is requesting data of unknown length such as "all alarms", etc. You will know how many bytes were returned in response to your command by looking at this address after the poll response has been processed. If you don't wish to use this feature, set the Extra Logic field to "None". |
Simple Modbus SOS Examples
...
Poll 2 When the Modbus register 40,001 (Trig Addrs) is set to a value of 20 (Trig Value), the second row in the SOS table is activated. This could be done externally by a communication process, by the user MMI, or using a Pre-Initialized RTDB ACE object (see Pre-Initialized RTDB).
When the Master Channel attempts to send Poll Index 2, it checks the SOS table and determines that the trigger for Poll Index 2 is active (matching the Trig Value). Thus, even though the Poll Table and Master Channel Scan Table would have activated this poll to be sent, the SOS table causes the poll to be blocked, so it the poll is skipped until the Trig Value changes to something other than its active value.
...
- The Modbus poll bytes 5 and 6 (event index) are replaced with the value contained in 40151. Then the poll is sent to the flow computer.
- When the poll response is received, register 40,001 contains the number of bytes of data included in the response.
- The value in Register 40,151 (Fill from Address) is automatically incremented by one in preparation for the next event number to be retrieved.
- The next consecutive Register (40,152) is automatically decremented by one (until it becomes zero).
- On the next scan of poll index 14, the next consecutive event record is retrieved, and so on until the Trig Addrs register becomes zero.
- Because register 40,152 is used as the Trig Addrs for both polls, once it is decremented to zero, the first SOS record causes poll index 14 to be skipped until the trigger registers are populated again, and the process starts over.
- Note that the "Skip poll" row for Poll Index 14 is configured above the "Byte Swap" row. If the poll is skipped because of the trigger (register value at 40,152 = 0), then the second SOS poll modification row has no effect.
...