WAGO PFC as a MODBUS MASTER, English Version 1.0.0
2 General Copyright 2002 by WAGO Kontakttechnik GmbH All rights reserved. WAGO Kontakttechnik GmbH Hansastraße 27 D-32423 Minden Phone: +49 (0) 571/8 87 0 Fax: +49 (0) 571/8 87 1 69 E-Mail: info@wago.com Web: http://www.wago.com Technical Support Phone: +49 (0) 571/8 87 5 55 Fax: +49 (0) 571/8 87 85 55 E-Mail: support@wago.com Every conceivable measure has been taken to ensure the correctness and completeness of this documentation. However, as errors can never be fully excluded we would appreciate any information or ideas at any time. We wish to point out that the software and hardware terms as well as the trademarks of companies used and/or mentioned in the present manual are generally trademark or patent protected.
Table of Contents 3 TABLE OF CONTENTS 1 Important comments... 4 1.1 Legal principles... 4 1.1.1 Copyright... 4 1.1.2 Personnel qualification... 4 1.1.3 Intended use... 4 1.2 Range of validity... 5 2 Description... 6 Modbus Master... 6 Slave Node... 6 Profibus... 6 3 Reference Material... 7 3.1 PFC & Modbus Configuration... 7 3.2 Profibus Configuration... 13 3.3 Mapping the inside of the PFC... 15
4 Important comments 1 Important comments 1.1 Legal principles 1.1.1 Copyright To ensure fast installation and start-up of the units described in this manual, we strongly recommend that the following information and explanation is carefully read and adhered to. This manual is copyrighted, together with all figures and illustrations contained therein. Any use of this manual which infringes the copyright provisions stipulated herein, is not permitted. Reproduction, translation and electronic and photo-technical archiving and amendments require the written consent of WAGO Kontakttechnik GmbH. Non-observance will entail the right of claims for damages. 1.1.2 Personnel qualification 1.1.3 Intended use The use of the product detailed in this manual is exclusively geared to specialists having qualifications in PLC programming, electrical specialists or persons instructed by electrical specialists who are also familiar with the valid standards. WAGO Kontakttechnik GmbH declines all liability resulting from improper action and damage to WAGO products and third party products due to non-observance of the information contained in this manual. For each individual application, the components supplied are to work with a dedicated hardware and software configuration. Modifications are only admitted within the framework of the possibilities documented in the manuals. All other changes to the hardware and/or software and the non-conforming use of the components entail the exclusion of liability on part of WAGO Kontakttechnik GmbH. Please direct any requirements pertaining to a modified and/or new hardware or software configuration directly to WAGO Kontakttechnik GmbH.
Important comments 5 1.2 Range of validity This application note is based on the stated hardware and software of the specific manufacturer as well as the correspondent documentation. This application note is therefore only valid for the described installation. New hardware and software versions may need to be handled differently. Please note the detailed description in the specific manuals.
6 Description 2 Description This document is to make the WAGO 750-8xx PFC a Modbus Master using the 750-650/000-018 (RS-232) or 750-653/000-018 (RS-485) module. Using the Modbus Master Function Block in a WAGO-I/O-PRO32 Program maks it possible create a Gateway between remote Modbus devices and a network such as Profibus, DeviceNet, Interbus, CanOpen and Ethernet networks. This type of gateway makes it possible to send and receive Modbus data across different Networks. The following describes Configuring and networking the example node using the software and equipment listed below. Modbus Master 750-833 Profibus PFC 750-650/000-018 RS-232, 9600,N,8,1, 5-Byte (Has to be a 5byte module) 750-600 End Module Slave Node 750-314 Modbus RS232,9600,N,8,1, RTU 750-402 4pt Input, 24VDC 750-402 4pt Input, 24VDC 750-504 4pt Output, 24VDC 750-504 4pt Output, 24VDC 750-600 End Module Profibus The software and Scanner card used in this example is the SST Profibus card and software. The GSD files can be downloaded from the web site www.wago.com
Reference Material 7 3 Reference Material 3.1 PFC & Modbus Configuration The PFC can act as a Modbus Master using the Modbus Master routine program. The routine program will need to be loaded with the following information: Modbus Node Address Address of the Node to read/write data Function Call Function read/write Registers or bits Register Address Register Address to read/write data Number of Addresses How many Registers to read/write data Sende_Start Use F_Trig function block to trigger Program The following WAGO Modules used for the example: Modbus Master 750-833 Profibus PFC 750-650/000-018 RS-232, 9600,N,8,1, 5-Byte (Has to be a 5byte module) 750-600 End Module Slave Node 750-314 Modbus RS232,9600,N,8,1, RTU 750-402 4pt Input, 24VDC 750-402 4pt Input, 24VDC 750-504 4pt Output, 24VDC 750-504 4pt Output, 24VDC 750-600 End Module Note: Please check WAGO Part number to be sure that a 750-65x/000-018 5-Byte Tx/Rx module is ordered. The Modbus Master routine Program only works with this. The 3 byte Tx/RX modules will not work.
8 Reference Material Modbus Master PFC to Modbus Slave Master Slave TX ------------- 3 RX------------- 2 Sig Com ---- 5 RTS Jumper to CTS
Reference Material 9 Variable list in WAGO-I/O-PRO32
10 Reference Material
Reference Material 11 Rung 1: Does not need any changes by the programmer. It is the data cop to move data in and out of the program. Rung 2: This is the function block that does all the work to set up the Modbus data and do the Read/Write of the data. The following explains the variables: InterfaceData.SlaveAdress Modbus Node address to read/write data. InterfaceData.FunctionCode Function Code to perform data read/writes. 0x02 = Read Input Status 0x03 = Read Input Register (16 bits) 0x10 = Write Multiple Registers 0x05 = Force Single Coil InterfaceData.StartAdress Address of Bit/Register to perform function InterfaceData.NumberOfPoints Number of bits/registers to read/write Sende_Start Use F_Trig to toggle function block to read/write data to 750-650/000-018 module This example used a Profibus buscoupler to receive data from a Profibus network, Load the data into the correct variables and then cycle the data through a Modbus buscoupler. Rung 3: NODEADDRS gets Modbus Node address and moves it to InterfaceData.SlaveAdress. Nodeaddrs gets data from %IB513 Network Variable area of the PFC which was downloaded from the Profibus Network.
12 Reference Material Rung 4: Func_Code gets the Modbus Function Code data and moves it to Interface- Data.FunctionCode InterfaceData.FunctionCode gets data from %IB512 Network Variable area of the PFC which was downloaded from the Profibus Network. Rung 5: IO_Addrs gets the Modbus IO_Addrs data and moves it to InterfaceData.StartAdress IO_Addrs gets data from %IW257 Network Variable area of the PFC from the Profibus Network. Rung 6: Number_Points gets the Modbus Number_Points data and moves it to InterfaceData.NumberOfPoints Number_Points gets data from %IB517 Network Variable area of the PFC from the Profibus Network. Rung 7: ReceiveData.Buffer[3] is the buffer where the return input data is located and moves the data to PLCOUT256. ReceiveData.Buffer[3] holds the input data from the Modbus read inputs function performed and moves it to PLCOUT256. PLCOUT256 is PFC address %QW256 to send the input data back to the Profibus Master. Rung 8: Input1 is clocked by the timer in Rung 9. When there is a rise and fall from the time in rung 9 the F_Trig function block sends a one-shot pulse to Sende_start. Sende_Start starts the function block with the Modbus data. When the function block is finished Sende_Start will return back to False.
Reference Material 13 3.2 Profibus Configuration The software and Scanner card used in this example is the SST Profibus card and software. The 750-833 GSD file can be downloaded from www.wago.com. The following GSD configuration was used for this example 0 750-833 PFC Profibus 1 PLC 750-650 is a place holder for the 750-650/000-001 RS-232 Module. The PLC 750-650 parameter was selected because the PFC Program will have control of the module. 2 Out4bytes is the number of bytes allocated to send data to Network Variable Input area form the master to the PFC. 3 In4bytes is the number of bytes allocated to receive data from the Network Variable output area from the PFC to the master.
14 Reference Material In the configuration there are 5 choices: 750-XXX Allocates data for the network to control *750-XXX Allocates a place holder for the next module of the same type PLC 750-xxx Allocates the module to be controlled by the PFC Program OutxBytes Number of bytes to be allocated to Network Variable inputs Data from Master to PFC InxBytes Number of Bytes to be allocated to Network Variable Outputs Data from PFC to Master PFC Memory Map The memory map of the PFC is as follows, This map applies to all PFC s Address 0-255 Real world inputs and output module addresses Address 256 511 Network Variable area of memeory for the network to read/write data to these registers. The network can be configured to read/write data to the Network Variable area in the PFC. The PFC program will use the registers in the program to move data to and from the Network Variable area. Data should be moved in and out of the Network Variable area and let the PFC use the data to do the logic scanning to control the real world I/O. The PFC can also be configured so the inputs or outputs are controlled by the Network.
Reference Material 15 3.3 Mapping the inside of the PFC In this configuration all the Profibus data has been mapped to the Network Variable area of the PFC. Data From Master to PFC PLCIN256 Byte 513 [Node Addrs] %IB513 Byte 512 [Function Code] %IB512 PLCIN257 Word 257 [ Start Address] PLCIN258 Byte 517 [Number of Points] PLCIN259 Word 259 [ DATA to be sent to PFC for Analog or Digital outputs] Data From PFC to Master PLCOUT256 Word 256 [Input Module data to Master] PLCOUT257 Word 257 [Input Module data to Master] PLCOUT258 Word 258 [Input Module data to Master] PLCOUT259 Word 259 [Input Module data to Master] Examples: Reading Input status: Function Code = 0x02 Start address = 0000 or 0001 or 0002 or 0003 Number of points = 1 (1 Input) ReceiveData.Buffer.Buffer[3] = Value of 1 st input (00 or 01) Reading Holding registers: Function Code = 0x03 Start address = 0000 Number of points = 1 (number of words registers to read) ReceiveData.Buffer.Buffer[4]= Value of the register being read
16 Reference Material Force Single Coil: Function Code = 0x05 Start Address = 0000 or 0001 or 0002 or 0003 Number of points = 1 (One output) InterfaceData.Data[1] = 0xFF to turn ON / 0x00 to turn OFF Or use ForceData;Buffer[0] to turn On/OFF Write Multiple Registers: Function Code = 0x10 Start Address = 0000 Number of Points = 1 (depends of number of register to write) InterfaceData.Data[1] = Value to write to PFC Register It may be faster to use function 0x03 to read 16 bits at one time and function 0x10 to write 16 bits at one time
Reference Material 17 Slave Setup: The Modbus slave was set up for the following 9600,N,8,1, RTU, No Watch Dog The dip switches were set as follows F switch =1 Dn 2 Up 3 Up 4 Dn 5 Dn 6 Dn P switch =1 Dn 2 Dn 3 Dn 4 Up 5 Up 6 Up 7 Up 8 Dn Addition to the PFC Program: An addition to this program would be to get the data from the Master and send it to the Slave for a register data write. Add the following run to the program. Data will be sent to the PFC and then placed into InterfaceData.Data[1].
WAGO Kontakttechnik GmbH Postfach 2880 D-32385 Minden Hansastraße 27 D-32423 Minden Phone: 05 71/8 87 0 Telefax: 05 71/8 87 1 69 E-Mail: info@wago.com WAGO Corporation USA N120W19129 Freistadt Road PO Box 1015 Germantown, Wi 53022 Phone: 1-262-255-6333 Fax: 1-262-255-3232 Internet: http://www.wago.com Call Toll Free: 1-800-DIN-RAIL (346-7245)