Doc. Version 4.0
SERIAL-PROFIBUS-INTERFACE | SPI 3
for Fieldbus Devices with a Serial Interface
– MODBUS RTU
Contents SPI 3 – all Controls (up to SPI 3 Release 16)
Contents Online Documentation
Page 1: ...Doc Version 4 0 SERIAL PROFIBUS INTERFACE SPI 3 for Fieldbus Devices with a Serial Interface MODBUS RTU Contents SPI 3 all Controls up to SPI 3 Release 16 Contents Online Documentation ...
Page 2: ... 385 39572 22 E mail support t h de Homepage http www t h de The information in this online documentation is the property of Trebing Himstedt Prozessautomation GmbH Co KG This online documentation or extracts thereof may only be duplicated or passed on to third parties following explicit written approval from Trebing Himstedt Prozessautomation GmbH Co KG The right is reserved to make changes to th...
Page 3: ...arting up the SPI 3 13 SPI 3 Configuration 14 SPI 3 Parameters 15 Checking the SPI 3 for correct operation 18 Using data channel with MODBUS_Master Kanal module and FB 127 20 Parameters for data transfer for SIMATIC S7 21 Error diagnosis and remedies 25 Technical specifications 27 Appendix 28 Creating function blocks 28 Telegram for data transfer without fragmentation 29 Telegram for data transfer...
Page 4: ...onfigured Data exchange between MODBUS slave and SPI 3 MODBUS master is controlled by the SPI 3 Different MODBUS functions are executed depending on the configuration The SPI 3 is easy to install and configure and a separate program for configuration or parameter setting is not necessary Configuration is done using the respective PROFIBUS DP master Features of the SPI 3 DP slave at up to 12 Mbit s...
Page 5: ...et www t h de You need the GSD file for the PLC project About this online documentation Please read this online documentation before starting the installation work It contains important information on planning your system connecting up and configuring the SPI 3 and on parameter setting The online documentation uses the following keywords and symbols Danger Risk of injury to personnel due to electr...
Page 6: ...formation on maximum cable lengths for PROFIBUS Terminating resistors Terminating resistors must be used if the SPI 3 is installed at the beginning or end of the PROFIBUS cable segment In this case you should use PROFIBUS connectors which contain an integrated terminating resistor We recommend use of connectors from ERNI and Siemens If the bus is incorrectly terminated this can lead to errors in d...
Page 7: ...er purpose The SPI 3 may only be installed or de installed by qualified technical personnel with appropriate electrotechnical qualifications When connecting up the SPI 3 you must observe the guidelines in the VDE 0100 regulations for handling electrical equipment Always mount the SPI 3 on a suitable top hat rail The cables used to connect up the SPI 3 should not apply any mechanical forces to the ...
Page 8: ...pply GND Signal ground terminal PE Protective ground terminal PROFIBUS interface Serial interface RS232 RS422 or RS485 see label on SPI 3 Mounting the device Stop lever for releasing fixing the SPI 3 from on a 35 mm DIN top hat rail top hat rail not included in delivery Operating elements Two rotary switches for setting the PROFIBUS address Switch for setting the tens value Switch for setting the ...
Page 9: ...eived from the serial interface Release The following information is indicated on the SPI 3 back panel Article No Release No Serial No Implementation guideline Please procede through the following steps for start up Mount the SPI 3 see Installing the SPI 3 on page 10 Connect the SPI 3 to power supply see Connecting up the power feed on page 10 Connect the SPI 3 to the serial field device see Conne...
Page 10: ...PI 3 Press the screwdriver in the direction of the SPI 3 while at the same time swivelling the SPI 3 away from the top hat rail Connecting up the power feed Danger Incorrect grounding of the SPI 3 can injure personnel and damage equipment Make sure that the SPI 3 is correctly grounded Warning Although the SPI 3 is protected against polarity reversal connecting up the power feed with incorrect pola...
Page 11: ...rom ERNI and Siemens If the SPI 3 is installed at the beginning or end of the PROFIBUS cable segment you should use PROFIBUS connectors which contain an integrated terminating resistor We recommend using connectors from ERNI and Siemens To ensure that the SPI 3 functions without errors you must ground the screen of the PROFIBUS cable Ensure that the PROFIBUS connector uses the pin assignments show...
Page 12: ...terminating resistor Is the feeding voltage 5 V supplied by the device SPI 3 the PROFIBUS is shorted via the resistors when the device is disconnected from voltage PROFIBUS communication can be interrupted or completely break down until the device is re energized Use active resistors to avoid this problem as in this case the terminating resistors are fed with 5 V and GND independently from the dev...
Page 13: ...module configured Figure Display example of a MODBUS register in PROFIBUS DP I O data blocks with the SPI 3 Register MODBUS Slave Coil 0 200 10 90 1 Byte 1 Word Input Register 0 100 20 8 Words Input 20 600 40 400 4 Words 16 Words Holding 1000 2000 1020 1900 1070 1 Word 1 Word 2 Words MB_REG_WRITE_1W Coil 2 Byte 90 MB_REG_READ_1W Holding 2 Byte 1020 MB_REG_READ_16W Input 32 Byte 400 MB_REG_WRITE_1W...
Page 14: ...y when using I O fields bigger than 2 words depending on PLC used The SPI 3 always sends data for all configured modules in full length to the MODBUS slave Module MB_REG_Write_1B is an exception You can use Module Name I O Field Description MODBUS_Master Kanal 4 words Specific SPI 3 parameters 4 word data channel Data channel can only be used in connection with function blocks MODBUS_Master_Kopf S...
Page 15: ...NPUT INPUT REGISTER HOLDING as well as the corresponding start address SPI 3 specific parameters for the MODBUS_Master_Kopf and MODBUS_Master Kanal modules The first 7 bytes bytes 0 6 of the parameter telegram contain bus related parameters which are standardized in PROFIBUS norm The following 10 bytes byte 7 to byte 16 in the table of the parameterizing telegram contain SPI 3 specific parameters ...
Page 16: ...ity Odd parity Mark parity Space parity 0x00 0x01 0x02 0x03 0x04 Even 0x01 10 11 Timeout slave response Delay time of slave response in 10 ms 0 65535 10 ms 0 65535 0x0000 to 0xFFFF 100 0x00 0x64 12 Number of repeats number of telegram repeats if slave fails to answer within timeout 1 255 0x01 to 0xFF 3 0x03 13 Writing mode Original data are sent to the MODBUS slave either always repeated or only i...
Page 17: ...g project You only need to open the example project with the PLC programming software STEP 7 1 Test example project connection of MODBUS client required Start PLC programming software Open the example project Adapt the applied PLC hardware Execute PLC Erase Program Load the project into the PLC After successful loading and subsequent SPS RUN the LEDs RUN and PB will light on the SPI 3 see also Che...
Page 18: ...e PROFIBUS interface or the serial interface Switch on the power feed for the SPI 3 The RUN LED should light continuously If this is not the case there is a fault in the 24 V power feed Refer to Error diagnosis and remedies on page 25 for details of how to locate the fault Checking PROFIBUS communication Connect up the PROFIBUS interface cable Switch on the power feed for the SPI 3 RUN LED lights ...
Page 19: ...est The diagnosis telegram contains general PROFIBUS diagnosis data see PROFIBUS Norm as well as manufacturer specific diagnosis data You can evaluate the diagnosis telegram through the DP master and or a PROFIBUS diagnosis tool e g the PROFIBUS Scope Hexacode Significance Remedy 17 Invalid MODBUS start address Check the default start address for the paramete rized module with the help of the data...
Page 20: ... or received via the SPI 3 This FB uses an I O field with 4 words SFC14 and 15 for data consistency are already included in the FB 127 Parameters must be set for calling the FB 127 you can also use the example project The example project is intended as a guide only Note The FB is only applicable for SIMATIC S7 controllers The example project for SIMATIC S7 uses the following hardware S7 315 2DP or...
Page 21: ...ailable to call the FB Parameters for address information specify location and length of the SPI 3 address field in the PLC address space Function Data area for user data Marker area for user data Contents Functions 1 2 15 DBB n DBB n 1 MB n MB n 1 Byte 1 Byte 2 Function 5 DBB n DBB n MB n MB n 0xFF set bit 0x00 reset bit Functions 3 4 6 16 DBW n DBW n 2 DBW n 4 MW n MW n 2 MW n 4 Word 1 Word 2 Wo...
Page 22: ...respond to the MODBUS exception codes 0x01 Invalid MODBUS function 0x02 Invalid MODBUS address 0x03 Invalid MODBUS data value 0x04 Slave device faulty 0x05 Acknowlegde slave cannot process data immediately 0x06 Slave busy repeat service later 0x07 Negative MODBUS receipt 0x08 Memory parity error 0xFF Timeout slave did not respond within timeout range Bit 3 5 7 Internal use by the FB do not change ...
Page 23: ...rameters for the FB Call the FB repeatedly while bit 0 Operation is executing is 1 If the operation completed without errors ANZW bit 1 1 the data have been sent completely If the operation completed with errors ANZW bit 2 1 evaluate the error message and remedy the error TH FD010e Start End Send data in Data Set FB parameters Call FB Evaluate error code ANZW Bit 0 0 ANZW Bit 1 1 ANZW Bit 2 1 yes ...
Page 24: ...s 1 If the operation completed without errors ANZW bit 1 1 the received data is now available in the user data area DATA If the operation completed with errors ANZW bit 2 1 evaluate the error messageand remedy the error Set ANZW bit 4 to 1 to reset the operation Bit 4 is reset to 0 by the FB when the operation has been reset TH FD012e Start End Set FB parameters Call FB Evaluate error code Read Da...
Page 25: ... when the slave gets new parameter and configuration values LED off LED short LED medium LED long LED on LED off LED is off on LED is off on LED is off on LED always on PB LED code Status Significance Remedy PB LED off Correct data transfer rate could not be determined No PROFIBUS master in the network Connect up the DP master Check the wiring PB LED short DP master available A master is available...
Page 26: ...sis see Evaluating PROFIBUS diagnosis telegrams on page 19 RUN LED code Status Significance Remedy RUN LED off SPI 3 not ready 24 V supply not present Check external power supply Check the wiring RUN LED medium Receive error No response from slave Error when receiving MODBUS slave did not respond after max number of repeats Check parameters of all modules the SPI 3 is MODBUS master Check the addre...
Page 27: ...ction of the data transfer rate Pin assignment Sub D connector Pin 1 Pin 2 Pin 3 Pin 4 Pin 5 Pin 6 Pin 7 Pin 8 Pin 9 Screen Unused B line Request to Send RTS Ground for 5 V M5 5 V galvanically isolated P5 Unused A line Unused Serial interface Interface type RS 232 RS 422 RS 485 Data transfer rate Bit s 110 300 600 1 200 2 400 4 800 9 600 19 200 Data frame Bit 7 8 Parity Even odd none mark space Pi...
Page 28: ...trol data and user data Byte 0 Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte n User data contain the actual information in the form of MODBUS telegrams or telegram fragments User data length is transferred in the first byte Control data control data exchange between DP master and SPI 3 They are used to highlight new data to transfer telegrams exceeding the available data channel to control the fl...
Page 29: ...elegram length must not exceed 4 words Bit 7 6 5 4 3 2 1 0 Byte 0 n 1 OUT Control data Byte 0 sending receiving DP master irrelevant irrelevant irrelevant Reset Stamp Receive Fragment Stamp Receive Telegram Stamp Send Fragment Stamp Send Telegram Bit 7 6 5 4 3 2 1 0 Byte 0 n 1 IN irrelevant irrelevant irrelevant Reset Mirror Receive Fragment Mirror Receive Telegram Mirror Send Fragment Mirror Send...
Page 30: ... Bit 7 1 6 5 4 3 2 1 0 Byte 0 n 2 1 IN Empfangen Telegramm 1 Quittung Telegramm 1 0x02 A B Länge Telegramm Nutzdaten Bit 7 0 6 5 4 3 2 1 0 Byte 0 n 2 1 OUT Bit 7 0 6 5 4 3 2 1 0 Byte 0 n 2 1 IN Empfangen Telegramm 2 Länge Telegramm Nutzdaten Quittung Telegramm 2 2 Nächstes Telegramm empfangen nur Bit 2 in Byte 0 toggeln Telegrammlänge in Byte 1 angeben Nutzdaten ab Byte 2 angeben 0x02 Z Y 0 0 Requ...
Page 31: ... n 2 1 OUT Bit 7 1 6 5 4 3 2 1 0 Byte 0 n 2 1 IN Receive telegram 1 Receipt telegram 1 0x02 A B Telegram length User data Bit 7 0 6 5 4 3 2 1 0 Byte 0 n 2 1 OUT Bit 7 0 6 5 4 3 2 1 0 Byte 0 n 2 1 IN Receive telegram 2 Telegram length User data Receipt telegram 2 2 Receive next telegram only toggle Bit 2 in Byte 0 specify telegram length in Byte 1 specify user data from Byte 2 onward 0x02 Z Y 0 0 R...
Page 32: ...ength is transmitted and received only in the first telegram fragment Send telegram with fragmentation Bit 7 0 6 5 4 3 2 1 0 Byte 0 3 2 1 DP Master SPI 3 OUT Bit 7 0 6 5 4 3 2 1 0 Byte 0 3 2 1 IN Bit 7 1 6 5 4 3 2 1 0 Byte 0 3 2 1 OUT Bit 7 1 6 5 4 3 2 1 0 Byte 0 3 2 1 IN Send telegram 1 Telegram length User data 0x17 A B Receipt telegram 1 0 Example original configuration Send telegram only toggl...
Page 33: ...her user data in telegram fragments toggle only Bit 1 in Byte 0 specify further user data from Byte 1 onward n n 0 0 Receipt telegram fragment 4 Send further user data in telegram fragments until telegram 1 has been sent completely only toggle Bit 1 in Byte 0 specify further user data from Byte 1 onward 5 Send next telegram only toggle Bit 0 in Byte 0 specify telegram length in Byte1 specify user ...
Page 34: ...1 6 5 4 3 2 1 0 Byte 0 3 2 1 IN Receive telegram fragment Receive telegram 1 D E F Receipt telegram 1 0 Example original configuration Receive telegram only toggle Bit 2 in Byte 0 telegram length is received in Byte1 user data are received from Byte 2 1 Request DP Master Response SPI 3 Request DP Master Response SPI 3 Request DP Master Response SPI 3 Receive user data in telegram fragments only to...
Page 35: ...elegram fragments until telegram 1 has been received completely only toggle Bit 3 in Byte 0 specify further user data from Byte 1 onward 5 Receive next telegram only toggle Bit 2 in Byte 0 telegram length is received in Byte1 user data are received from Byte 2 Bit 7 0 6 5 4 3 2 1 0 Byte 0 3 2 1 OUT Bit 7 0 6 5 4 3 2 1 0 Byte 0 3 2 1 IN Receive telegram 2 Telegram length User data 0x8 L S Receipt t...
Page 36: ...I 3 Reset SPI 3 Receipt reset Switch Bit 4 in Byte 0 back to 0 again Bit 7 0 6 5 4 3 2 1 0 Byte 0 n 2 1 DP Master SPI 3 OUT Bit 7 6 5 4 3 2 1 0 Byte 0 n 2 1 IN Bit 7 6 5 4 3 2 1 0 Byte 0 n 2 1 OUT Bit 7 1 6 5 4 3 2 1 0 Byte 0 n 2 1 IN 2 0 Example original configuration Reset SPI 3 change Bit 4 in Byte 0 to 1 1 Request DP Master Response SPI 3 Request DP Master Response SPI 3 0 1 Bit 7 0 6 5 4 3 2 ...
Page 37: ...ription of the MODBUS functions e g in MODBUS Protocol Reference Guide see http www modicon com Function 01 Read Coil Status Request to the slave Slave response Byte Contents Hex code e g Contents Hex code e g Byte 1 Slave Address 11 Slave Address 11 Byte 2 Function 01 Function 01 Byte 3 Starting Address High 00 Byte Count 05 Byte 4 Starting Address Low 13 Data Coils 27 20 CD Byte 5 No of Points H...
Page 38: ...x code e g Contents Hex code e g Byte 1 Slave Address 11 Slave Address 11 Byte 2 Function 03 Function 03 Byte 3 Starting Address High 00 Byte Count 06 Byte 4 Starting Address Low 6B Data High Register 40108 02 Byte 5 No of Points High 00 Data Low Register 40108 2B Byte 6 No of Points Low 03 Data High Register 40109 00 Byte 7 Data Low Register 40109 00 Byte 8 Data High Register 40110 00 Byte 9 Data...
Page 39: ...ts Hex code e g Byte 1 Slave Address 11 Slave Address 11 Byte 2 Function 06 Function 06 Byte 3 Register Address High 00 Register Address High 00 Byte 4 Register Address Low 01 Register Address Low 01 Byte 5 Preset Data High 00 Preset Data High 00 Byte 6 Preset Data Low 03 Preset Data Low 03 Request to the slave Slave response Byte Contents Hex code e g Contents Hex code e g Byte 1 Slave Address 11...
Page 40: ...ts Hex code e g Contents Hex code e g Byte 1 Slave Address 11 Slave Address 11 Byte 2 Function 10 Function 10 Byte 3 Starting Address High 00 Starting Address High 00 Byte 4 Starting Address Low 01 Starting Address Low 01 Byte 5 No of Registers High 00 No of Registers High 00 Byte 6 No of Registers Low 02 No of Registers Low 02 Byte 7 Byte Count 04 Byte 8 Data High 00 Byte 9 Data Low 0A Byte 10 Da...
Page 41: ...Appendix 41 MODBUS RTU SPI 3 Trebing Himstedt 0x07 Negative acknowledge 0x08 Memory parity error ...
Page 42: ...f ASCII data The telegram currently being received is considered to be completed when the time between two received characters is larger than the specified character timeout Configuration During configuration the modules and the addresses of the DP slave are assigned The actual configuration describes the modules which are actually present in the slave the required configuration describes the modu...
Page 43: ...its inputs and to transfer the frozen values cyclically to the master The slave only starts to transfer the cyclically updated values to the master again after it receives the UNFREEZE command Galvanically isolated With galvanically isolated I O devices the reference potentials of control circuits and power circuits are not electrically interconnected Ground Conductive material e g ground wire who...
Page 44: ... MBUS 300 Rev D Module Selecting a module during device configuration determines the configuration telegram and thus the size of the PLC I O area MSB Most Significant Bit Non floating With non floating I O devices the reference potentials of control circuits and power circuits are electrically interconnected and are not galvanically isolated Non isolated With non isolated I O devices the reference...
Page 45: ...ween the bodies PROFIBUS Process Field Bus is an open Fieldbus system used to network PROFIBUS compatible devices PROFIBUS works with three different protocols PROFIBUS DP Decentral Peripheral PROFIBUS FMS Fieldbus Message Specification and PROFIBUS PA Process Automation PROFIBUS is standardized in EN 50 170 Protocol A set of rules and regulations which control the flow of information in a communi...
Page 46: ...s byte Mirror Step 5 Programming language used for user programs for SIMATIC S5 controllers Step 7 Programming language used for user programs for SIMATIC S7 controllers Step 7 tool Tool for Step 7 which automates particular programming tasks SYNC Control command that a DP slave receives from the DP master It causes the slave to store freeze the current states of its outputs When following telegra...
Page 47: ...hen the hardware or software in the product is updated or modified The version code can be seen on the first and second page of this online documentation at the bottom left Word Data word Xon With software flow control the Xon control character indicates readiness to receive complement of Xoff Xoff With software flow control the Xoff control character indicates unreadiness to receive complement of...
Page 48: ...emperature dependent faults An electrostatic discharge can only be perceived by humans in case of high level voltage However lower electrostatic voltages which are below the limits of perception can still damage or destroy electronic components Copyright The information contained in this manual is the copyright of Trebing Himstedt Prozeßautomation GmbH Co KG Users of the manual agree to use the in...
Page 49: ...Doc No 10001239 Trebing Himstedt Prozessautomation GmbH Co KG ...