MCM Protocol Manual
MCM Protocol Manual
MCM Protocol Manual
May 7, 2012
PROTOCOL MANUAL
How to Contact Us
ProSoft Technology 5201 Truxtun Ave., 3rd Floor Bakersfield, CA 93309 +1 (661) 716-5100 +1 (661) 716-5101 (Fax) www.prosoft-technology.com [email protected] Copyright 2012 ProSoft Technology, Inc., all rights reserved. MCM Protocol Manual May 7 , 2012 ProSoft Technology , ProLinx , inRAx , ProTalk , and RadioLinx are Registered Trademarks of ProSoft Technology, Inc. All other brand or product names are or may be trademarks of, and are used to identify products and services of, their respective owners.
WARNING - EXPLOSION HAZARD - SUBSTITUTION OF COMPONENTS MAY IMPAIR SUITABILITY FOR CLASS I, DIV. 2; WARNING - EXPLOSION HAZARD - WHEN IN HAZARDOUS LOCATIONS, TURN OFF POWER BEFORE REPLACING OR WIRING MODULES WARNING - EXPLOSION HAZARD - DO NOT DISCONNECT EQUIPMENT UNLESS POWER HAS BEEN SWITCHED OFF OR THE AREA IS KNOWN TO BE NON-HAZARDOUS. THIS DEVICE SHALL BE POWERED BY CLASS 2 OUTPUTS ONLY.
Markings
Label Markings
<cULus> E183151 Class I Div 2 Groups A,B,C,D T6 -30 <= Ta <= 60 C C <Ex> II 3 G Ex nA IIC T4 -20 <= Ta <= 50 C C II Equipment intended for above ground use (not for use in mines). 3 Category 3 equipment, investigated for normal operation only. G Equipment protected against explosive gasses.
Contents
Your Feedback Please ........................................................................................................................ 2 How to Contact Us .............................................................................................................................. 2 ProSoft Technology Product Documentation .................................................................................... 2 Important Installation Instructions ....................................................................................................... 3 ProLinx Products Warnings ............................................................................................................... 3 ProLinx Gateways with Ethernet Ports ............................................................................................... 3 To upgrade a previously purchased Series C model ..................................................................... 3 To order a ProLinx Plus gateway with the -WEB option ................................................................ 3 Markings .............................................................................................................................................. 4
1
1.1 1.2 1.3 1.4 1.5 1.6
Start Here
9
System Requirements ............................................................................................. 10 Package Contents ................................................................................................... 11 Mounting the Gateway on a DIN-rail ....................................................................... 12 Connecting Power to the Unit ................................................................................. 13 Installing ProSoft Configuration Builder Software ................................................... 14 Using the Online Help ............................................................................................. 15
2
2.1 2.2 2.3 2.4
Functional Overview
17
2.4.1
Modbus Master/Slave Port(s) .................................................................................. 18 Serial Port Specifications ........................................................................................ 19 Modbus Master/Slave Port Specifications............................................................... 20 Module Internal Database ....................................................................................... 21 Modbus Port Access to Database ........................................................................... 22
3
3.1
23
[Modbus Port x] ....................................................................................................... 25 Enabled ................................................................................................................... 25 RS Interface ............................................................................................................ 25 Type......................................................................................................................... 25 Float Flag ................................................................................................................ 25 Float Start ................................................................................................................ 26 Float Offset .............................................................................................................. 26 Protocol ................................................................................................................... 26 Baud Rate ............................................................................................................... 27 Parity ....................................................................................................................... 27 Data Bits .................................................................................................................. 27 Stop Bits .................................................................................................................. 27 RTS On.................................................................................................................... 28 RTS Off.................................................................................................................... 28 Minimum Response Delay ...................................................................................... 28 Use CTS Line .......................................................................................................... 28 Response Timeout .................................................................................................. 28 Retry Count ............................................................................................................. 28 Internal Slave ID ...................................................................................................... 29 Bit Input Offset......................................................................................................... 29
Page 5 of 92
3.2
4
4.1 4.2
39
4.3
Viewing Error and Status Data ............................................................................... 40 Modbus Error and Status Data Area Addresses .................................................... 41 Modbus Ports: Error and Status ............................................................................. 41 Slave Port: General Port STATE and COMM STATE Status ................................. 42 Master Port: Command List Errors ......................................................................... 43 Master Port: Modbus Slave List Status .................................................................. 45 Error Codes............................................................................................................. 47 Modbus Error Codes ............................................................................................... 47
48
Command List Error Codes .................................................................................... 48 Modbus Configuration Error Word .......................................................................... 49
6
6.1 6.2 6.3 6.4 6.5
51
Port 0, 1, 2, 3: RS-232 - Null Modem (DTE with Hardware Handshaking) ............ 52 Port 0, 1, 2, 3: RS-232 - Null Modem (DTE without Hardware Handshaking) ....... 53 Port 0, 1, 2, 3: RS-232 - DTE to DCE Modem Connection .................................... 54 Port 0, 1, 2, 3: RS-422 Interface Connections ........................................................ 55 Port 0, 1, 2, 3: RS-485 Interface Connections ........................................................ 56
7
7.1 7.2
LED Indicators
57
8
8.1
61
Page 6 of 92
8.2
9
9.1
Reference
9.1.1 9.1.2 9.1.3 9.1.4 9.1.5 9.1.6 9.1.7 9.1.8 9.1.9 9.1.10
73
Modbus Protocol Specification ................................................................................ 74 Read Coil Status (Function Code 01) ..................................................................... 74 Read Input Status (Function Code 02).................................................................... 75 Read Holding Registers (Function Code 03) .......................................................... 76 Read Input Registers (Function Code 04)............................................................... 77 Force Single Coil (Function Code 05) ..................................................................... 78 Preset Single Register (Function Code 06)............................................................. 79 Diagnostics (Function Code 08) .............................................................................. 80 Force Multiple Coils (Function Code 15) ................................................................. 82 Preset Multiple Registers (Function Code 16) ........................................................ 83 Modbus Exception Responses ................................................................................ 84 Moving Data using the Data Map ............................................................................ 87
9.2
10
89
Contacting Technical Support ........................................................................................................... 89 10.1 Return Material Authorization (RMA) Policies and ConditionsError! Bookmark not defined. 10.1.1 Returning Any Product .............................................. Error! Bookmark not defined. 10.1.2 Returning Units Under Warranty ............................... Error! Bookmark not defined. 10.1.3 Returning Units Out of Warranty ............................... Error! Bookmark not defined. 10.2 LIMITED WARRANTY............................................... Error! Bookmark not defined. 10.2.1 What Is Covered By This Warranty ........................... Error! Bookmark not defined. 10.2.2 What Is Not Covered By This Warranty .................... Error! Bookmark not defined.
Page 7 of 92
Index
91
Page 8 of 92
Start Here
In This Chapter
System Requirements ........................................................................... 10 Package Contents ................................................................................. 11 Mounting the Gateway on a DIN-rail ..................................................... 12 Connecting Power to the Unit ................................................................ 13 Installing ProSoft Configuration Builder Software .................................. 14 Using the Online Help ........................................................................... 15
Page 9 of 92
1.1
System Requirements
The configuration software for the MCM gateway requires the following minimum hardware and software components: Pentium II 450 MHz minimum. Pentium III 733 MHz (or better) recommended 128 Mbytes of RAM minimum, 256 Mbytes of RAM recommended 100 Mbytes of free hard disk space (or more based on application requirements) 256-color VGA graphics adapter, 800 x 600 minimum resolution (True Color 1024 768 recommended) CD-ROM drive Supported operating systems: Microsoft Windows 7(32 bit) (64bit not tested) Microsoft Windows Vista (not tested) Microsoft Windows XP Professional with Service Pack 1 or 2 Microsoft Windows 2000 Professional with Service Pack 1, 2, or 3 (not tested) Microsoft Windows Server 2003 (not tested)
Page 10 of 92
1.2
Package Contents
The following components are included with your MCM gateway, and are all required for installation and configuration. Important: Before beginning the installation, please verify that all of the following items are present.
Qty. 1 1 Varies
Part Number PLX-#### Cable #15, RS232 Null Modem Cable #9, MiniDIN8 to DB9 Male Adapter 1454-9F
Part Description ProLinx communication gateway For RS232 Connection from a PC to the CFG Port of the gateway For DB9 Connection to gateways Port. One DIN to DB-9M cable included per configurable serial port, plus one for gateway configuration Adapters, DB9 Female to Screw Terminal. For RS422 or RS485 Connections to each serial application port of the gateway Contains sample programs, utilities and documentation for the MCM gateway.
Varies
Adapter
ProSoft Solutions CD
If any of these components are missing, please contact ProSoft Technology Support for replacements.
Page 11 of 92
1.3
Page 12 of 92
1.4
WARNING: Ensure that you do not reverse polarity when applying power to the gateway. This will cause damage to the gateways power supply.
Page 13 of 92
1.5
Open your web browser and navigate to http://www.prosofttechnology.com/pcb 2 Click the link at the Current Release Version section to download the latest version of ProSoft Configuration Builder. 3 Choose SAVE or SAVE FILE when prompted. 4 Save the file to your Windows Desktop, so that you can find it easily when you have finished downloading. 5 When the download is complete, locate and open the file, and then follow the instructions on your screen to install the program. If you do not have access to the Internet, you can install ProSoft Configuration Builder from the ProSoft Solutions Product CD-ROM, included in the package with your gateway.
1 2 3 4
Insert the ProSoft Solutions Product CD-ROM into the CD-ROM drive of your PC. Wait for the startup screen to appear. On the startup screen, click PRODUCT DOCUMENTATION. This action opens a Windows Explorer file tree window. Click to open the UTILITIES folder. This folder contains all of the applications and files you will need to set up and configure your gateway. Double-click the SETUP CONFIGURATION TOOL folder, double-click the PCB_*.EXE file and follow the instructions on your screen to install the software on your PC. The information represented by the "*" character in the file name is the PCB version number and, therefore, subject to change as new versions of PCB are released.
Note: Many of the configuration and maintenance procedures use files and other utilities on the CD-ROM. You may wish to copy the files from the Utilities folder on the CD-ROM to a convenient location on your hard drive.
Page 14 of 92
1.6
Page 15 of 92
Page 16 of 92
Functional Overview
In This Chapter
Modbus Master/Slave Port(s) ................................................................ 18 Serial Port Specifications....................................................................... 19 Modbus Master/Slave Port Specifications ............................................. 20 Module Internal Database ..................................................................... 21
The Modbus Master/Slave protocol driver may exist in a single port (MCM) or a multiple port (MCM4) implementation. In either case, each port can be independently configured as a Master or Slave port to interface, as required, with other Modbus devices.
Page 17 of 92
2.1
Page 18 of 92
2.2
Type Serial Ports Serial Port Adapter Cables Config Port Connector/ Pinout Serial Port Isolation
Specifications One Mini DIN to DB-9M adapter cable included for each configurable serial port DB-9F connector / DTE pinout 2500V RMS port-to-port isolation per UL 1577. 3000V DC min. port to ground and port to logic power isolation. RS-485/422 port interface lines TVS diode protected at +/- 27V standoff voltage. RS-232 port interface lines fault protected to +/- 36V power on, +/- 40V power off.
Note: On all ProLinx gateways, data from the application port on the main board, serial Port 0, is not buffered. Packets go directly to and from the serial chipset to the processor. This has the potential to cause the serial communications to become erratic at baud rates above 38,400 baud. ProLinx gateways with 4 serial ports have a separate serial interface board for serial Ports 1, 2, and 3. These serial ports are buffered and can handle communications up to 115,200 baud.
Page 19 of 92
2.3
Status Data
Page 20 of 92
2.4
The Master driver uses the database in two ways: A read command issued to a slave device by the Master driver will return the slave data into the internal database. A write command issued to a slave device by the Master driver uses the data in the internal database as the source data to send to the slave. The slave driver allows external Master devices to access the database, reading data from the database or writing data to the database. External Modbus Master devices can monitor and control data in this database through any port configured as a slave. Status and error data from the slave and Master ports generated by the gateway can be mapped into the internal database, where it can be retrieved by either protocol driver.
Page 21 of 92
The following virtual addresses are not part of the normal gateway user database and are not valid addresses for standard data. However, these addresses may be used for incoming commands that are requesting 32-bit floating-point data. To use addresses in this upper range requires you to: 1 Set the Float Flag (page 25) to YES 2 Set the Float Start (page 26) to a database address in the range below 3 Set the Float Offset (page 26) to a database address in the gateway user memory area shown above. Remember that, once you do this, all data in addresses above the Float Offset address will be treated as 32-bit floating-point data and require two gateway memory registers per Modbus address.
Database Address 4000 5000 6000 7000 8000 9000 9999 Modbus Address 44001 (five-digit addressing) or 440001 (six-digit addressing) 45001 or 450001 46001or 460001 47001 or 470001 48001 or 480001 49001or 490001 50000 or 500000
Page 22 of 92
Page 23 of 92
#This is an example of a Master port using Modbus RTU protocol [Modbus Port 0] # Settings required by both Master and Slave Enabled : Yes #Port enable flag Y=Yes, N=No RS Interface : 0 #0=RS-232, 1=RS-485, 2=RS-422 Type : Master #Port type M=Master, S=Slave Float Flag Float Start Float Offset : No #Use floating data type Y=Yes, N=No : 7000 #Register offset in message for floats : 2000 #Internal Address for floats
Protocol : RTU #Modbus Protocol R=RTU, A=ASCII Baud Rate : 384 #Baud rate for port Parity : None #N=None, O=Odd, E=Even Data Bits : 8 #5 to 8 data bits for messages Stop Bits : 1 #1 or 2 stop bits for messages RTS On : 0 #Delay after RTS set before message sent (mSec) RTS Off : 1 #Delay after message before RTS dropped(mSec) Minimum Response Delay : 2 #Number of mSec to delay before respose Use CTS Line : No #Monitor CTS modem line (Y/N) Response Timeout : 1000 #mSec for response timeout of command Retry Count : 2 #retry count for failed requests # Settings required for Slave Driver Internal Slave ID : 1 #Modbus Node address for this port on network Bit Input Offset : 0 #Internal DB offset to bit input data Word Input Offset : 0 #Internal DB offset to word input data Output Offset : 0 #Internal DB offset to bit output data Holding Register Offset : 0 #Internal DB offset to holding reg data Use Guard Band Timer : N #Use packet gap timeout for messages Guard Band Timeout : 0 #0=Use default for baudrate, or set timeout # Settings required for Master Driver Minimum Command Delay : 0 #mSec delay between commands Error Delay Counter : 100 #0-65535 Command cycle count if error Command Control Reg : -1 #DB start reg for Cmd Control (-1=disable) [Modbus Port 0 Commands] # Internal Poll Reg Swap Node Modbus MB Address # Enable Address Interval Count Code Address Func in Device START 1 0 0 10 0 1 3 0 1 10 0 10 0 1 4 10 END
Page 24 of 92
3.1
[Modbus Port x]
The [Modbus Port x] sections of the CFG file, where x stands for 0, 1, 2, or 3, set the Modbus Master and slave port communication parameters and define the protocol-specific settings.
3.1.1 Enabled
YES or NO This flag specifies if the port on the gateway will be utilized. If the parameter is set to NO, the port will not be used. If the parameter is set to YES, the port will be used.
3.1.2 RS Interface
0 = RS-232 1 = RS-485 2 = RS-422 This parameter is used when Ports 1, 2, and 3 are present to configure the electrical interface for these ports. RS Interface selections for Port 0 are done with a jumper (electrical shunt) on the back of the gateway.
3.1.3 Type
MASTER or SLAVE This parameter defines if the port will emulate a Master or slave device. Choose a value of MASTER to make the port function as a Modbus Master. Choose SLAVE to make the port function as a Modbus slave.
3.1.7 Protocol
RTU ASCII This parameter specifies the Modbus protocol version to be used on the port. Valid Protocols are RTU and ASCII.
Page 26 of 92
Note: On all ProLinx gateways, data from the application port on the main board, serial Port 0, is not buffered. Packets go directly to and from the serial chipset to the processor. This has the potential to cause the serial communications to become erratic at baud rates above 38,400 baud. ProLinx gateways with 4 serial ports have a separate serial interface board for serial Ports 1, 2, and 3. These serial ports are buffered, and can handle communications up to 115,200 baud.
3.1.9 Parity
None, Odd, Even Parity is a simple error checking algorithm used in serial communication. This parameter specifies the type of parity checking to use. All devices communicating through this port must use the same parity setting.
3.1.12 RTS On
0 to 65535 milliseconds This parameter sets the number of milliseconds to delay after Ready To Send (RTS) is asserted before data will be transmitted.
Page 28 of 92
Page 29 of 92
Page 30 of 92
1 2
First of all, enable the the Use Guard Band Timer parameter. Then, set the Guard Band Timeout.
This configuration will set the gateway to use a pre-defined time interval for Modbus message recognition calculated for each baud rate. This should provide optimal performance for most applications. If you still observe a considerable number of communication errors, try to increase the Guard Band Timeout value until the network performance is improved.
Page 31 of 92
Page 32 of 92
Page 33 of 92
3.2
Modbus Enable Function Code Code FC1 FC2 FC3 FC4 FC5 FC6 FC15 FC16 Code Code Code Code Code Code Code Code
Function Device Code MODBU S Address 1 2 3 4 5 6 15 16 Bit Bit Register Register Bit Register Bit Register
The first part of the record is the Module Information, which relates to the ProLinx module and the second part contains information required to interface to the Modbus slave device. Refer to the Modbus protocol specification and slave device documentation for a full discussion of each function. The Device Modbus Address information can be found in the documentation for the slave device. Command list example:
[PORT 0 COMMANDS] # INTERNAL POLL SWAP SLAVE FUNCTION DEVICE # ENABLE ADDRESS INTERVAL COUNT CODE NODE CODE ADDRESS START 1 0 0 10 0 1 3 0 1 0 0 10 0 1 16 10 END
Page 34 of 92
3.2.1 Enable
0,1, 2 or 3 This field defines whether the command is to be executed and under what conditions. If the parameter is set to 0, the command is disabled and will not be executed in the normal polling sequence. However, the command can still be activated using Command Control. Setting the parameter to a value of 1 causes the command to be executed each scan of the Command List if the Poll Interval is set to zero (0). If the Poll Interval is set to a non-zero value, the command will be executed, when the interval timer for that command expires. An Enable code of 2 is valid only for write commands, FC 5, 6, 15, and 16. If the parameter is set to 2, the command will execute only if the internal data associated with the command changes. An Enable code of 3 is valid only for bit-level write commands, FC 5 and 15. If the parameter is set to 3, the command will execute only if the internal bit data associated with the command changes. It will also clear the bit or bits in the internal database after the write command is built. Important: Not all revisions of the MCM driver support an Enable code of 3. To determine if your gateway supports this Enable code, contact ProSoft Technical Support.
Page 35 of 92
These swap operations affect 4-byte (or 2-word) groups of data. Therefore, data swapping using these Swap Codes should be done only when using an even number of words, such as when 32-bit integer or floating-point data is involved.
Page 36 of 92
Page 37 of 92
Page 38 of 92
The most thorough troubleshooting method for debugging the operation of the MCM driver (and the gateway in general) is the powerful Debug port on the gateway. Accessing the Debug capabilities of the gateway is accomplished by connecting a PC to the Debug port and loading a terminal program such as ProSoft Configuration Builder or Windows HyperTerminal. Note: 4101 series modules that use both serial ports (Debug and Port x) as application ports (for example, 4101-MCM-DFCM) must be reset or power-cycled in order to enable the selected port as a Debug port. To enable the debug port, connect to the port using a null-modem serial cable, and then press and hold the [A] key on the keyboard while resetting or power cycling the card. Do not release the key until HyperTerminal shows the debug port menu. Debug mode can be enabled on either port. The upload/download command is only available when connected to the Debug port.
Page 39 of 92
4.1
Page 40 of 92
4.2
Note: None of the addresses are available in the Modbus address range. In order to view them via a Modbus request, they must be moved into the 0 to 3999 address range using the Data Map section of the configuration file. For additional information on how to move data within the gateway's internal database, see Moving Data (page 87).
Refer to the following Error Codes (page 47) section to interpret the status/error codes present in the data area.
Page 41 of 92
4.2.2 Slave Port: General Port STATE and COMM STATE Status
In addition to the port status information stored in the gateway database memory, as already mentioned, there are two additional port status parameters that are not available from the database. The status values, Port STATE (highlighted in yellow) and Port COMM STATE (highlighted in orange), can be found only though the diagnostic menus under "Communication Status" for a port, as shown in the following graphic.
These status values are state registers. They are used as 'scratchpad' areas by the operating firmware to keep track of the current logical state of activities on a slave port. These state registers are constantly changing as the gateway progresses through the various stages needed to process communication on the serial ports. This processing happens faster than can be followed, unless a port error causes the value to remain constant for some noticable length of time.
Page 42 of 92
The diagnostic screen displays are 'snapshot' type screens; that is, they display the current value at the time they are called but do not continue to automatically update the data displayed. They are not live-data screens. Therefore, to see a change in STATE or COMM STATE, you must repeatedly call the screen by pressing the appropriate menu key to have the screen refreshed. Depending on the refresh timing you may or may not see a change in the displayed values everytime you call for an update. The STATE register may display any of the following values.
STATE Value -2 -1 0 1 2 2000 Description Preparing port, Flushing all buffers, Scan for RTS-Off, or Waiting for port enable signal Waiting for receipt of data Undefined state Receiving a message from the Master Building a slave response message Sending slave response to the Master
The COMM STATE register may display any of the following values.
COMM STATE Value 0 1 101 2 3 4 5 6 Description Port not sending data (Wait for send) Setting up minimum Response Delay Timer Waiting for Minimum Response Delay to timeout Turning on RTS line and starting RTS-On Delay Timer Waiting for RTS-On Delay timer to timeout Sending data Waiting for all data to be sent and starting RTS-Off Delay Timer Waiting for RTS-Off Delay timeout and then turning OFF RTS line after timeout
Page 43 of 92
The first word in the defined register location contains the status/error code for the first command in the port's Command List. Successive words in the Command Error List are associated with corresponding commands in the list. Refer to Error Codes (page 47) to interpret the status/error codes present in this data area. Port 0 Command Error List Layout The addresses listed are for Port 0 only; but the format is the same for each port. The start address for each port is given in the previous section, Master Port: Command List Errors (page 43).
Internal Database Address (Example) 4410 4411 4412 4413 4414 ... ... ... 4507 4508 4509 Offset 0 1 2 3 4 ... ... ... 97 98 99 Description Command #0 Error Status Command #1 Error Status Command #2 Error Status Command #3 Error Status Command #4 Error Status ... ... ... Command #97 Error Status Command #98 Error Status Command #99 Error Status
Note that the values in the Command Error List tables are initialized to zero (0) at power-up, cold boot, and warm boot. If a command executes successfully, the value in the associated register will remain at zero (0), indicating no command error was detected. Any non-zero value in this table indicates the corresponding command experienced an error. The Error Code (page 47) shown will provide valuable troubleshooting information. The data in this table is dynamic. It is updated each time a command is executed. Therefore, if the command fails once and succeeds on the next attempt, the Error Code from the previously failed attempt will be replace with zero and lost. Error Codes are not archived in the gateway's database. To see if the port has experienced an error since the most recent restart and what the most recently occurring error was, if any, you can check the Last Error/Index (page 41).
Page 44 of 92
Slaves are defined to the system when the gateway loads the Master Command List during start-up and initialization. Each slave defined will be set to a state value of 1 in this initial step. If the Master port fails to communicate with a slave device (timeout expired on a command, retries failed), the Master will set the state of the slave to a value of 2 in this status table. This suspends communication with the slave device for a user-specified Error Delay Count (page 33). When the Master first suspends polling of a particular slave, it creates a Error Delay Counter for this slave address and set the value in that counter equal to the Error Delay Counter parameter in the configuration file. Then, each time a command in the list is scanned that has the address of a suspended slave, the delay counter value for that slave will be decremented. When the value reaches zero, the slave state will be set to 1. This will re-enable polling of the slave. The first word in the defined register locations contains the status code for slave node address 1. Each successive word in the list is associated with the next node in sequence, up to slave node address 255. The individual Slave List Status for each Modbus port are returned to the address locations specified in the following table.
Modbus Port 0 1 2 3 Address Range 4510 to 4764 4910 to 5164 5310 to 5564 5710 to 5965=4
Page 45 of 92
Port 0 Slave List Status Layout The addresses listed are for Port 0 only; but the format is the same for each port. The start address for each port is given in the previous section, Master Port: Modbus Slave List Status. (page 45)
Internal Database Address (Example) 4510 4511 4512 4513 4514 Offset Description
0 1 2 3 4 . . .
Slave #1 Status Slave #2 Status Slave #3 Status Slave #4 Status Slave #5 Status . . .
Note that the values in the Slave List Status tables are initialized to zero (0) at power-up, cold boot and during warm boot.
Page 46 of 92
4.3
Error Codes
These are error codes that are part of the Modbus protocol or are extended codes unique to this gateway.
Page 47 of 92
4.4
Page 48 of 92
If any of these registers contains a non-zero value, it indicates a problem with the configuration of the associated port. The following table lists the codes, a description of the problem, and which parameters to change tocorrect the error condition within the configuration file.
Bit 0 1 2 3 4 5 6 7 8 9 10 Code 0x0001 0x0002 0x0004 0x0008 0x0010 0x0020 0x0040 0x0080 0x0100 0x0200 0x0400 Description Invalid Enabled parameter (Yes or No) Invalid RS-Interface parameter (0 to 2) Invalid Type (Master or Slave) Invalid Protocol (RTU or ASCII) Invalid Baud Rate Invalid Parity (None, Odd, Even) Invalid Data Bits (7 or 8 bits) Invalid Stop Bits (1 or 2) Invalid Use CTS Line (Yes or No) Retry Count Invalid (0 to 10) Invalid Floating Point Data: Float Flag not Yes or No Float Start less than 0 or Float Offset is Invalid Invalid Internal Slave ID (1 to 255) (Slave Only) Invalid Entry for Register Offset Data (Slave Only) Reserved Reserved Reserved
11 12 13 14 15
Page 49 of 92
Page 50 of 92
Page 51 of 92
5.1
Page 52 of 92
5.2
Note: If the port is configured with the Use CTS (page 28) set to YES, then a jumper is required between the RTS and the CTS line on the gateway connection.
Page 53 of 92
5.3
The Use CTS Line (page 28) parameter for the port configuration should be set to YES for most modem applications.
Page 54 of 92
5.4
Page 55 of 92
5.5
NOTE: This type of connection is commonly called a RS-485 half-duplex, 2-wire connection. If you have RS-485 4-wire, full-duplex devices, they can be connected to the gateway's serial ports by wiring together the TxD+ and RxD+ from the two pins of the full-duplex device to Pin 1 on the gateway and wiring together the TxD- and RxD- from the two pins of the full-duplex device to Pin 8 on the gateway. As an alternative, you could try setting the gateway to use the RS-422 interface and connect the full-duplex device according to the RS-422 wiring diagram (page 55). For additional assistance, please contact ProSoft Technical Support.
Page 56 of 92
LED Indicators
In This Chapter
Base Module LEDs ................................................................................ 58 LEDs for Serial Ports ............................................................................. 59
LED indicators provide a means of monitoring the operation of the system and individual ports. There are extremely useful for troubleshooting. The gateway provides LEDs to help monitor each port. In addition, system configuration errors, application errors, and fault indications are all indicated by LEDs, providing alerts to possible problems.
Page 57 of 92
6.1
Cfg
Err
Off Flashing
Solid Red
Page 58 of 92
6.2
Normal state. When off and Port Active led is indicating activity, there are no communication errors Activity on this LED indicates communication errors are occurring. To determine the exact error, connect the Debug terminal to the Debug port and use the built-in Diagnostic Menus (page 39).
Page 59 of 92
Page 60 of 92
Page 61 of 92
7.1
7.1.2 Protocol
RTU ASCII This parameter specifies the Modbus protocol version to be used on the port. Valid Protocols are RTU and ASCII.
Page 62 of 92
Note: On all ProLinx gateways, data from the application port on the main board, serial Port 0, is not buffered. Packets go directly to and from the serial chipset to the processor. This has the potential to cause the serial communications to become erratic at baud rates above 38,400 baud. ProLinx gateways with 4 serial ports have a separate serial interface board for serial Ports 1, 2, and 3. These serial ports are buffered, and can handle communications up to 115,200 baud.
7.1.4 Parity
None, Odd, Even Parity is a simple error checking algorithm used in serial communication. This parameter specifies the type of parity checking to use. All devices communicating through this port must use the same parity setting.
Page 63 of 92
7.1.7 RTS On
0 to 65535 milliseconds This parameter sets the number of milliseconds to delay after Ready To Send (RTS) is asserted before data will be transmitted.
Page 65 of 92
7.2
7.2.1 Enabled
YES or NO This flag specifies if the port on the gateway will be utilized. If the parameter is set to NO, the port will not be used. If the parameter is set to YES, the port will be used.
7.2.2 RS Interface
0 = RS-232 1 = RS-485 2 = RS-422 This parameter is used when Ports 1, 2, and 3 are present to configure the electrical interface for these ports. RS Interface selections for Port 0 are done with a jumper (electrical shunt) on the back of the gateway.
7.2.3 Protocol
RTU ASCII This parameter specifies the Modbus protocol version to be used on the port. Valid Protocols are RTU and ASCII.
Page 66 of 92
Note: On all ProLinx gateways, data from the application port on the main board, serial Port 0, is not buffered. Packets go directly to and from the serial chipset to the processor. This has the potential to cause the serial communications to become erratic at baud rates above 38,400 baud. ProLinx gateways with 4 serial ports have a separate serial interface board for serial Ports 1, 2, and 3. These serial ports are buffered, and can handle communications up to 115,200 baud.
Page 67 of 92
7.2.5 Parity
None, Odd, Even Parity is a simple error checking algorithm used in serial communication. This parameter specifies the type of parity checking to use. All devices communicating through this port must use the same parity setting.
7.2.8 RTS On
0 to 65535 milliseconds This parameter sets the number of milliseconds to delay after Ready To Send (RTS) is asserted before data will be transmitted.
Page 68 of 92
1 2
First of all, enable the the Use Guard Band Timer parameter. Then, set the Guard Band Timeout.
This configuration will set the gateway to use a pre-defined time interval for Modbus message recognition calculated for each baud rate. This should provide optimal performance for most applications. If you still observe a considerable number of communication errors, try to increase the Guard Band Timeout value until the network performance is improved.
Page 69 of 92
Page 70 of 92
Page 71 of 92
Page 72 of 92
Reference
In This Chapter
Modbus Protocol Specification .............................................................. 74 Moving Data using the Data Map .......................................................... 87
Page 73 of 92
8.1
Response An example response to Read Coil Status is as shown in Figure C2. The data is packed one bit for each coil. The response includes the Slave address, function code, quantity of data characters, the data characters, and error checking. Data will be packed with one bit for each coil (1 = ON, 0 = OFF). The low order bit of the first character contains the addressed coil, and the remainder follow. For coil quantities that are not even multiples of eight, the last characters will be filled in with zeros at high order end. The quantity of data characters is always specified as quantity of RTU characters, that is, the number is the same whether RTU or ASCII is used. Because the Slave interface device is serviced at the end of a controller's scan, data will reflect coil status at the end of the scan. Some Slaves will limit the quantity of coils provided each scan; thus, for large coil quantities, multiple PC transactions must be made using coil status from sequential scans.
Ad r 11 Func Byte Data Coil Coun Status 20 t to 27 05 CD Data Coil Status 28 to 35 6B Data Coil Status 36 to 43 B2 Data Coil Status 44 to 51 OE Data Coil Status 52 to 56 1B Error Check Field CRC
01
Page 74 of 92
The status of coils 20 to 27 is shown as CD(HEX) = 1100 1101 (Binary). Reading left to right, this shows that coils 27, 26, 23, 22, and 20 are all on. The other coil data bytes are decoded similarly. Due to the quantity of coil statuses requested, the last data field, which is shown 1B (HEX) = 0001 1011 (Binary), contains the status of only 5 coils (52 to 56) instead of 8 coils. The 3 left most bits are provided as zeros to fill the 8-bit format.
Response An example response to Read Input Status is as shown in Figure C4. The data is packed one bit for each input. The response includes the Slave address, function code, quantity of data characters, the data characters, and error checking. Data will be packed with one bit for each input (1=ON, 0=OFF). The lower order bit of the first character contains the addressed input, and the remainder follow. For input quantities that are not even multiples of eight, the last characters will be filled in with zeros at high order end. The quantity of data characters is always specified as a quantity of RTU characters, that is, the number is the same whether RTU or ASCII is used. Because the Slave interface device is serviced at the end of a controller's scan, data will reflect input status at the end of the scan. Some Slaves will limit the quantity of inputs provided each scan; thus, for large coil quantities, multiple PC transactions must be made using coil status for sequential scans.
Adr Func Byte Count 03 Data Discrete Input 10197 to 10204 AC Data Discrete Input 10205 to 10212 DB Data Discrete Input 10213 to 10218 35 Error Check Field CRC
11
02
Page 75 of 92
The status of inputs 10197 to 10204 is shown as AC (HEX) = 10101 1100 (binary). Reading left to right, this show that inputs 10204, 10202, and 10199 are all on. The other input data bytes are decoded similar. Due to the quantity of input statuses requested, the last data field which is shown as 35 HEX = 0011 0101 (binary) contains the status of only 6 inputs (10213 to 102180) instead of 8 inputs. The two left-most bits are provided as zeros to fill the 8-bit format.
Response The addressed Slave responds with its address and the function code, followed by the information field. The information field contains 1 byte describing the quantity of data bytes to be returned. The contents of the registers requested (DATA) are two bytes each, with the binary content right justified within each pair of characters. The first byte includes the high order bits and the second, the low order bits. Because the Slave interface device is normally serviced at the end of the controller's scan, the data will reflect the register content at the end of the scan. Some Slaves will limit the quantity of register content provided each scan; thus for large register quantities, multiple transmissions will be made using register content from sequential scans. In the example below, the registers 40108 to 40110 have the decimal contents 555, 0, and 100 respectively.
Adr Func ByteCn Hi Data Lo t Data 11 03 06 02 2B Hi Data Lo Data 00 00 Hi Data Lo Data 00 64 Error Check Field CRC
Page 76 of 92
Response The addressed Slave responds with its address and the function code followed by the information field. The information field contains 1 byte describing the quantity of data bytes to be returned. The contents of the registers requested (DATA) are 2 bytes each, with the binary content right justified within each pair of characters. The first byte includes the high order bits and the second, the low order bits. Because the Slave interface is normally serviced at the end of the controller's scan, the data will reflect the register content at the end of the scan. Each PC will limit the quantity of register contents provided each scan; thus for large register quantities, multiple PC scans will be required, and the data provided will be form sequential scans. In the example below the register 3009 contains the decimal value 0.
Adr 11 Func 04 Byte Count 02 Data Input Reg Hi 00 Data Input Reg Lo 00 Error Check Field E9
Page 77 of 92
Response The normal response to the Command Request is to re-transmit the message as received after the coil state has been altered.
Adr 11 Func 05 Data Coil # Hi 00 Data Coil # Lo AC Data On/ Off FF Data 00 Error Check Field CRC
The forcing of a coil via MODBUS function 5 will be accomplished regardless of whether the addressed coil is disabled or not (In ProSoft products, the coil is only affected if the necessary ladder logic is implemented). Note: The Modbus protocol does not include standard functions for testing or changing the DISABLE state of discrete inputs or outputs. Where applicable, this may be accomplished via device specific Program commands (In ProSoft products, this is only accomplished through ladder logic programming).
Page 78 of 92
Coils that are reprogrammed in the controller logic program are not automatically cleared upon power up. Thus, if such a coil is set ON by function Code 5 and (even months later), an output is connected to that coil, the output will be "hot".
Adr 11
Func 06
Response The response to a preset single register request is to re-transmit the query message after the register has been altered.
Adr 11 Func 06 Data Reg Hi 00 Data Reg Lo 01 Data Input Reg Hi 00 Data Input Reg Lo 03 Error Check Field CRC
Page 79 of 92
Page 80 of 92
Example and State Diagram Here is an example of a request to remote device to Return Query Data. This uses a sub-function code of zero (00 00 hex in the two-byte field). The data to be returned is sent in the two-byte data field (A5 37 hex).
Request Field Name Function Sub-function Hi Sub-function Lo Data Hi Data Lo (Hex) 08 00 00 A5 37 Response Field Name Function Sub-function Hi Sub-function Lo Data Hi Data Lo (Hex) 08 00 00 A5 27
The data fields in responses to other kinds of queries could contain error counts or other data requested by the sub-function code.
Page 81 of 92
11
0F
00
Response The normal response will be an echo of the Slave address, function code, starting address, and quantity of coils forced.
Adr 11 Func 0F Hi Addr 00 Lo Addr 13 Quantity 00 Error Check Field 0A CRC
The writing of coils via Modbus function 15 will be accomplished regardless of whether the addressed coils are disabled or not. Coils that are unprogrammed in the controller logic program are not automatically cleared upon power up. Thus, if such a coil is set ON by function code 15 and (even months later) an output is connected to that coil, the output will be hot.
Page 82 of 92
Adr 11
Func 10
Hi Add 00
Lo Add 87
Quantity 00
Byte Cnt
Hi Data 00
Lo Hi Data Data 0A 01
Lo Data 02
02 04
Response The normal response to a function 16 query is to echo the address, function code, starting address and number of registers to be loaded.
Adr 11 Func 10 Hi Addr 00 Lo Addr 87 Quantity 00 02 Error Check Field 56
Page 83 of 92
Page 84 of 92
In this example, the Master addresses a request to server device. The function code (01) is for a Read Output Status operation. It requests the status of the output at address 1245 (04A1 hex). Note that only that one output is to be read, as specified by the number of outputs field (0001). If the output address is non-existent in the server device, the server will return the exception response with the exception code shown (02). This specifies an illegal data address for the Slave. Modbus Exception Codes
Code 01 Name Illegal Function Meaning The function code received in the query is not an allowable action for the Slave. This may be because the function code is only applicable to newer devices, and was not implemented in the unit selected. It could also indicate that the Slave is in the wrong state to process a request of this type, for example because it is unconfigured and is being asked to return register values. The data address received in the query is not an allowable address for the Slave. More specifically, the combination of reference number and transfer length is invalid. For a controller with 100 registers, a request with offset 96 and length 4 would succeed; a request with offset 96 and length 5 will generate exception 02. A value contained in the query data field is not an allowable value for Slave. This indicates a fault in the structure of the remainder of a complex request, such as that the implied length is incorrect. It specifically does not mean that a data item submitted for storage in a register has a value outside the expectation of the application program, because the Modbus protocol is unaware of the significance of any particular value of any particular register. An unrecoverable error occurred while the Slave was attempting to perform the requested action. Specialized use in conjunction with programming commands. The Slave has accepted the request and is processing it, but a long duration of time will be required to do so. This response is returned to prevent a timeout error from occurring in the Master. The Master can next issue a poll program complete message to determine if processing is completed. Specialized use in conjunction with programming commands. The Slave is engaged in processing a longduration program command. The Master should retransmit the message later when the Slave is free. Specialized use in conjunction with function codes 20 and 21 and reference type 6, to indicate that the extended file area failed to pass a consistency check. The Slave attempted to read record file, but detected a parity error in the memory. The Master can retry the request, but service may be required on the Slave device.
02
03
04 05
06
08
Page 85 of 92
Gateway Path Unavailable Specialized use in conjunction with gateways, indicates that the gateway was unable to allocate an internal communication path from the input port to the output port for processing the request. Usually means that the gateway is misconfigured or overloaded. Gateway Target Device Failed To Respond Specialized use in conjunction with gateways, indicates that no response was obtained from the target device. Usually means that the device is not present on the network.
0b
Page 86 of 92
8.2
The Delay Preset parameter determines how often the data transfer will happen. The value entered here is in number of internal firmware scan cycles. Since the actual amount of time required for an internal firmware scan varies based on the protocols involved and application-specific configuration variations, there is no direct relationship between scan counts and time interval. Therefore, if you need to move data based on specific timing, you will have to determine this relationship experimentally by trying different Delay Preset values and monitoring the time between data moves, until you discover an acceptable setting for your application.
Page 87 of 92
Page 88 of 92
Page 89 of 92
Tel: +603.7724.2080, E-mail: [email protected] Languages spoken include: Chinese, English Tel: +86.21.5187.7337 x888, E-mail: [email protected] Languages spoken include: Chinese, English Tel: +33 (0) 5.34.36.87.20, E-mail: [email protected] Languages spoken include: French, English Tel: +971-4-214-6911, E-mail: [email protected] Languages spoken include: English, Hindi Tel: +1.661.716.5100, E-mail: [email protected] Languages spoken include: English, Spanish Tel: +1-281-2989109, E-Mail: [email protected] Languages spoken include: Spanish, English
Latin America Tel: +52-222-3-99-6565, (location in Puebla, Mexico) E-mail: [email protected] Languages spoken include: Spanish Brasil (location in Sao Paulo) Tel: +55-11-5083-3776, E-mail: [email protected] Languages spoken include: Portuguese, English
9.1
Warranty Information
For complete details regarding ProSoft Technologys TERMS & CONDITIONS OF SALE, WARRANTY, SUPPORT, SERVICE AND RETURN MATERIAL AUTHORIZATION INSTRUCTIONS please see the documents on the Product CD/DVD or go to www.prosoft-technology/warranty Documentation is subject to change without notice
Page 90 of 92
Index
[
[Modbus Master Port] 62 [Modbus Port X Commands] 32, 33 [Modbus Port x] 25 [Modbus Slave Port x] 65
I
Important Installation Instructions 3 Installing ProSoft Configuration Builder Software 14 Intellectual Property Indemnity 91 Internal Address 34 Internal Slave ID 28, 62
0
00 Return Query Data 78
L
LED Indicators 57 LEDs for Serial Ports 59 Limitation of Remedies ** 92 LIMITED WARRANTY 87, 89
A
Allocation of Risks 92
B
Base Module LEDs 58 Baud Rate 27, 63, 66 Bit Input Offset 29 Busy Timeout 69, 70
M
Markings 4 Master Port Command List Errors 43, 44 Modbus Slave List Status 45, 46 MB Address in Device 37 MCM Protocol Configuration 23 Minimum Command Delay 31 Minimum Response Delay 28, 64, 67 Modbus Configuration Error Word 50 Modbus Error and Status Data Area Addresses 41 Modbus Error Codes 47 Modbus Exception Codes 83 Modbus Exception Responses 47, 82 Modbus Function 36 Modbus Master/Slave Port Specifications 20 Modbus Master/Slave Port(s) 18 Modbus Port Access to Database 22 Modbus Port Expander (4102/5102-MBS3MBM) 61 Modbus Ports Error and Status 41, 44 Modbus Protocol Specification 72 Module Communication Error Codes 49 Module Internal Database 21 Mounting the Gateway on a DIN-rail 12 Moving Data using the Data Map 41, 84
C
Command Control Reg 32 Command List Error Codes 49 Communication Port Cables 51 Connecting Power to the Unit 13 Contacting Technical Support 85, 87 Controlling Law and Severability 92
D
Data Bits 27, 63, 67 Diagnostics (Function Code 08) 78 Disclaimer of all Other Warranties 91 Disclaimer Regarding High Risk Activities 90
E
Enable 32, 34 Enabled 25, 65 Error Codes 41, 43, 44, 47 Error Delay Counter 31, 45 Example and State Diagram 79
F
Float Flag 22, 25 Float Offset 22, 26 Float Start 22, 26 Force Multiple Coils (Function Code 15) 80 Force Single Coil (Function Code 05) 76 Functional Overview 17
N
No Other Warranties 92
O
Output Offset 29
P
Package Contents 11 Parity 27, 63, 67
G
Guard Band Timeout 31, 69
Page 91 of 92
U
Use CTS Line 28, 52, 53, 54, 64, 67 Use Guard Band Timer 30, 68 Using the Online Help 15
V
Viewing Error and Status Data 40
W
What Is Covered By This Warranty 89, 91 What Is Not Covered By This Warranty 90 Word Input Offset 29
R
Read Coil Status (Function Code 01) 72 Read Holding Registers (Function Code 03) 74 Read Input Registers (Function Code 04) 75 Read Input Status (Function Code 02) 73 Reference 71 Reg Count 35 Request Timeout 69 Response Timeout 28, 64 Retry Count 28, 64 Return Material Authorization (RMA) Policies and Conditions 87 Returning Any Product 87 Returning Units Out of Warranty 88 Returning Units Under Warranty 87 RS Interface 25, 65 RTS Off 28, 64, 67 RTS On 28, 64, 67
Y
Your Feedback Please 2
S
Serial Port Modbus Error and Status Data 39, 59 Serial Port Specifications 19 Slave Address 36 Slave Port General Port STATE and COMM STATE Status 42 Start Here 9 Stop Bits 27, 64, 67 Sub-function Codes Supported 78 Support, Service & Warranty 85 Swap Code 35 System Requirements 10
Page 92 of 92