Eng04027a - SMC-Wago Ethernet I-O Connections
Eng04027a - SMC-Wago Ethernet I-O Connections
Eng04027a - SMC-Wago Ethernet I-O Connections
Summary:
This document describes how to setup and configure a distributed I/O system using
the SMC products that feature Ethernet ports and products from Wago. Both an
Ethernet coupler (non-intelligent) and an Ethernet Programmable Fieldbus Controller
(intelligent) I/O device are used. Timing differences between direct I/O vs. Ethernet
I/O are measured. A PLS-type application is configured with the PFC.
11/22/2004 1 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
Table Of Contents:
Subject: SMC Product to Wago I/O connectivity ...........................................................................1
The Application:..............................................................................................................................3
Hardware Layout: ...........................................................................................................................3
Software Layout:.............................................................................................................................4
Programming the SMC product ..................................................................................................4
Programming the Wago Ethernet Coupler .................................................................................4
Setting up the Application:..............................................................................................................5
Configure SMC IP address using Y-Term: .................................................................................5
Configure Wago IP address using Wago BootP:........................................................................8
Wago Configuration and Addressing: .......................................................................................10
Opening SMC Ethernet connections to a Wago I/O block: ......................................................11
Programming the SMC using I/O set, read and Modbus commands: ......................................13
Programming the Wago PFC using Wago-I/O-PRO 32: ..........................................................17
Appendix:......................................................................................................................................19
SMC Example Code Listing: .....................................................................................................19
Wago PFC Example Code Listing: ...........................................................................................22
Oscilloscope Traces:.................................................................................................................23
11/22/2004 2 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
THE APPLICATION:
The SMC controller features connections to direct on-board I/O, Ethernet distributed I/O, and an
Ethernet Programmable Fieldbus Controller (PFC). The response differences between the direct
vs. Ethernet I/O is measured by an oscilloscope. The SMC will send motor position information
continuously to the PFC which will run its own ladder logic program to perform a PLS-type
operation. In this manner, 1 of 8 outputs will be assigned to a 45° quadrant.
P P
HARDWARE LAYOUT:
U
WAGO 750-842
SMC-4000
Ethernet
Hub
PC Laptop
RS-232
11/22/2004 3 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
SOFTWARE LAYOUT:
11/22/2004 4 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
6. Program the Wago PFC to perform a PLS function based on motor position.
An IP address for the SMC must contain the same address in the first 3 IP fields and a unique
address in the 4th.
11/22/2004 5 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
Once serial communication is established, click on the Terminal Tab and enter the IP address
with the IA command.
Ex: IA 192,168,3,16
Ex: BN
: IA?
11/22/2004 6 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
:RS
Close Y-Term and re-launch. This time, choose Ethernet connection and enter the IP address
you just configured.
11/22/2004 7 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
You should now be able to connect to the SMC unit over Ethernet.
Once installed, it can be found at Start, Programs, Wago Software, Wago BootP Server.
Click on Edit Bootptab to modify the BootP initialization file. This will allow you to assign an IP
address and a network name to a device at a particular MAC address. This procedure will
overwrite an existing IP address for the chosen device.
11/22/2004 8 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
Modify the last line only of the file with the desired information.
Ex: WagoCoupler:ht=1:ha=0030DE006368:ip=192.168.3.151:sm=255.255.255.0
Save and close the file and click on the Start Button. The program will prepare the I/O device to
re-ARP.
Cycle the power on the I/O device. The IP configuration will be completed.
11/22/2004 9 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
Wago I/O configures and maps itself automatically upon power up. Understanding how the Wago
I/O is addressed is the key to proper application.
On power up, the I/O coupler or PFC will address the I/O according to what it finds to be present.
Addresses are assigned in the following order:
Analog Inputs
Digital Inputs
Analog Outputs
Digital Outputs
The coupler follows this hierarchy no matter what order the modules are physically arranged in
the rack.
Each analog channel consumes 1 word of memory. Each digital channel consumes 1 bit.
For the 750-842 Programmable Fieldbus Coupler, the physical Inputs are mapped starting at
Word 0. The physical Outputs are mapped starting at Word 512. Variable memory that the logic
processor can use are mapped starting at Word 256. And finally, variable memory registers that
an external device (like the SMC) can write to begin at Word 768.
11/22/2004 10 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
IH
FUNCTION: Open Internet Handle
Description:
The IH command is used when the SMC product is operated as a network master. This command
opens a handle and connects to a slave.
Each controller may have several handles open at any given time. They are designated by the letters
A through P. To open a handle, the user must specify:
The port number of the slave. TCP protocol uses port 502.
Arguments: IHh = ip0, ip1, ip2, ip3 <p >q OR IHh = n <p >q OR IHh = >r Where:
11/22/2004 11 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
For example:
To open a TCP/IP connection to the above configured Wago I/O block using Handle C, issue the
command:
The Ethernet handle connections are viewed by going under the menu Tools, Ethernet Status.
The IH command also contains status variables _IHh1 through _IHh4 where ‘h’ is the handle
letter. These are useful for programmatically checking the status of the handle when
implementing proper programming technique.
11/22/2004 12 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
Programming the SMC using I/O set, read and Modbus commands:
Distributed Digital I/O is extremely easy to accomplish with the SMC products. Digital outputs are
controlled using the already familiar SB and CB commands. The Wago TCP/IP connection
implements Modbus protocol.
SB
FUNCTION: Set Bit
Description:
The SB command sets a bit on the output port, slave controller or Modbus I/O
When using Modbus devices, the I/O points are calculated using the following formula:
Slave address is used when the Modbus device has slave devices connected to it, and specified as
Addresses 0 to 255. Please note that the use of slave devices for Modbus are very rare and this
number will usually be 0.
Arguments: SB n
11/22/2004 13 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
CB
FUNCTION: Clear Bit
Description:
The SB command clears a bit on the output port, slave controller or Modbus I/O
Arguments: CB n
EX: SB 3000 will turn on the first digital output on the above I/O device using Handle C.
CB 3000 will turn it off.
Distributed Digital input status is read with the @IN function just as it is with local inputs.
@IN
FUNCTION: Status of Digital Input
Description:
@IN returns the status of the digital input number or variable given in square brackets. Note that the
@IN command is a function and does not follow the convention of the commands, and does not
require the underscore when used as an operand.
When using Modbus devices, the I/O points are calculated using the following formula:
Slave address is used when the Modbus device has slave devices connected to it, and specified as
Addresses 0 to 255. Please note that the use of slave devices for Modbus are very rare and this
number will usually be 0.
EX: IF (@IN[3000]) //If the 1st digital input of the above I/O device is ON
MG {EA} @IN[3000] //print the status to the screen
ENDIF
11/22/2004 14 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
Analog I/O or Memory variables are implemented using the Modbus command to read and/or
write registers (words) in the distributed device.
MB
FUNCTION: Modbus
Description:
The MB command is used to communicate to devices using the first 2 levels of the Modbus protocol.
The format of the command varies depending on each function code. The function code, -1,
designates that the first level of Modbus is used (creates raw packets and receives raw data). The
other codes are the 10 major function codesof the second level that the SMC products support.
Note: All formats contain an ‘h’ parameter. This designates the handle connection number.
11/22/2004 15 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
This command will write a value of 1024 into the first analog output of the Wago I/O
device on Handle C
This command will read the value of the first analog input of the Wago I/O device. Analog
output #1 has been wired to Analog Input #1. These values should be close to the same.
11/22/2004 16 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
After Installation, start the program by clicking Start, Programs, Wago-I/O-PRO 32, Wago-I/O-
PRO 32.
For this example, open the PLS program by choosing File, Open and locate
“ProgrammableLimitSwitch.pro” The code listing, written in Structured Text will be displayed.
Highlight and alter the TCP/IP address of the device. Don’t forget to hit <enter> to accept the
changes. Then click OK.
11/22/2004 17 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
Next, go Online with the unit by choosing Online, Login. Start the logic processor by choosing
Online, Run.
11/22/2004 18 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
Note that the screen has changed and now shows actual program states and values.
For our PLS example, download the file “SMC-Wago Connectivity.smc” to the SMC controller
using Y-Term. Run the PLS program by typing:
XQ #SETUP
Keep in mind that if the PFC is used, the SMC would not normally write directly to the outputs.
This could cause a conflict with the 2 logic programs trying to control the same I/O. The more
common method would be to write to a memory register as demonstrated, and let the Wago PFC
take control from there.
APPENDIX:
//----------------------------------------
#SETUP
DM WAGO[20]
UDP=1
TCP=2
UDPCONN=-5
TCPCONN=-6
ON = 0
OFF = 1
MW 1
//Tuning Parameters
KP 1.4
KD 16
KI 0
//Scale factors
mres = 8192
11/22/2004 19 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
JS #RELEASE
JS #ASSIGN
JS #INIT
EN
#RELEASE
MG {EA} "RELEASING HANDLES..."
IF(_IHB2<>0)
#REL_B
IHB=>@ABS[_IHB2]*-1
WT 1000
JP #REL_B, _IHB2<>0
ENDIF
IF(_IHC2<>0)
#REL_C
IHC=>@ABS[_IHC2]*-1
WT 1000
JP #REL_C, _IHC2<>0
ENDIF
MG {EA} "RELEASE DONE"
EN
#ASSIGN
#ASSIGNB
MG {EA} "ASSIGNING HANDLES..."
IHB= 192,168,3,150 <502 >TCP //PROGRAMMABLE FIELD COUPLER
#ASGN_B;WT 10; JP #ASGN_B, _IHB2=TCPCONN; JP #ASSIGNB, _IHB2<>-TCP
MG {EA} "HANDLE B ASSIGNED TCP"
#ASSIGNC
IHC= 192,168,3,151 <502 >TCP //ETHERNET TCP/IP COUPLER
#ASGN_C;WT 10; JP #ASGN_C, _IHC2=TCPCONN; JP #ASSIGNC, _IHC2<>-TCP
MG {EA} "HANDLE C ASSIGNED TCP"
MG {EA} "ASSIGN DONE"
EN
#INIT
MG {EA} "Homing the motor..."
XQ #PLS, 1
EN
11/22/2004 20 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
#OUTLOOP
x=2000
#OLOOP1
SB x
WT 250
x=x+1
JP #OLOOP1, x<=2007
x=3000
#OLOOP2
SB x
WT 250
x=x+1
JP #OLOOP2, x<=3003
WT 500
x=2000
#OLOOP3
CB x
WT 250
x=x+1
JP #OLOOP3, x<=2007
x=3000
#OLOOP4
CB x
WT 250
x=x+1
JP #OLOOP4, x<=3003
EN
#DIO_TIM
dstartt = TIME
SB 3
#WT_DI; JP #WT_DI, @IN[3]<>ON
dstopt = TIME
dtdiff = (dstopt-dstartt)*1000/1024
CB 3
EN
#EIO_TIM
estartt = TIME
SB 2000
#WT_EI; JP #WT_EI, @IN[2000]<>ON
estopt = TIME
etdiff = (estopt-estartt)*1000/1024
CB 2000
EN
11/22/2004 21 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
//PLS Operation
#PLS
//Start moving the motor
JG 2*mres
BG X
//Send motor position out to the Wago PFC, this also adds
//speed compensation by sending an advanced motor position
//based on the motor velocity
#SENDPOS
SB3
MBB=2,6,768,@FRAC[_TPX+(_TVX/200)/mres]*mres
CB3
JP #SENDPOS
EN
#IOLOOP
SB3;SB2000;SB3000
WT 20
CB3;CB 2000;CB3000
WT 20
JP #IOLOOP
EN
11/22/2004 22 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
Oscilloscope Traces:
11/22/2004 23 of 24 eng/04.027/MCD
APPLICATION NOTE
MOTION PRODUCT AND ENGINEERING GROUP
11/22/2004 24 of 24 eng/04.027/MCD