Beruflich Dokumente
Kultur Dokumente
Copyright
WARNING
You
TuxEip V1.0
2/17
Purpose
Road map
Trademark
TuxEip V1.0
3/17
Content
1 Overview................................................................................................................................................. 5
1.1 Ethernet/IP....................................................................................................................................... 5
1.2 Organisation.................................................................................................................................... 5
2 Global Variables......................................................................................................................................6
2.1 Identity.............................................................................................................................................6
2.1 Send / receive.................................................................................................................................. 6
2.2 Connection parameters.................................................................................................................... 6
2.3 Error handling..................................................................................................................................6
3 Sweeping statement about functions....................................................................................................... 7
3.1 Functions declaration.......................................................................................................................7
3.2 Return values................................................................................................................................... 7
4 Standard scheme of communications using TuxEip............................................................................... 8
5 In depth travel inside TuxEip data structures..........................................................................................9
5.1 Session............................................................................................................................................. 9
5.2 Connection.......................................................................................................................................9
5.3 LGX_Read.....................................................................................................................................10
5.4 PLC_Read......................................................................................................................................10
5.5 DHP_Header..................................................................................................................................10
6 How to Determine Connection Path ,connection and read / write functions........................................ 11
6.1 Connection path.............................................................................................................................11
6.2 Connection function...................................................................................................................... 11
6.3 Read / write functions....................................................................................................................12
6.4 Example......................................................................................................................................... 13
6.4.1 Example 1 : Accessing ControlLogix (Rack id 1,slot 0) via Ethernet :.................................13
6.4.2 Example 2 : Accessing Micrologix (Rack id 2) via Ethernet :............................................. 14
6.4.3 Example 3 : Accessing PLC5 (Rack id 6) via ControlNet :................................................. 15
6.4.4 Example 4 : Accessing PLC5 (Rack id 6) via ControlNet and DH+ :.................................. 16
6.4.5 Example 5 : Accessing FlexLogix (Rack id 7) via ControlNet............................................. 17
TuxEip V1.0
4/17
1 Overview
1.1 Ethernet/IP
EtherNet/IP is an encapsulation protocol which use the Control Information Protocol.
1.2 Organisation
This library is divide in many files :
EIP_Const define many constant used by EtherNet/IP protocol.
CIP_ prefixed files contain generic CIP constants and misc subroutines.
Ethernet_IP contain implementation of the EtherNet/IP protocol.
SendData is used to send / receive data over Ethernet, the whole library depends on it.
(In fact, TuxEip use function pointer to the send/receive subroutines defined in this file so you can
write your own.)
MR contain the Message Router implementation
CM contain the Connection Manager implementation
AB contain generic Allen Bradley data types and subroutines
PLC contain subroutines to access PLC5 and SLC500 controllers ...(controllers which use the PCCC
protocol)
LGX contain subroutines to access ControlLogix ...(controllers which use the CIP protocol)
TuxEip V1.0
5/17
2 Global Variables
2.1 Identity
CM.h
Each device have to provide a vendor Id and a serial number, in TuxEip they are defined like this (you can also
overwrite it before accessing the network) :
(CIP_UINT) _OriginatorVendorID=TuxPlcVendorId;
(CIP_UDINT) _OriginatorSerialNumber=0x12345678;
BYTE _Priority=0x0A;
CIP_USINT _TimeOut_Ticks=0x05;
WORD _Parameters=0x43f8; Attention this parameters depend on the network type (ControlNet / DH+)
BYTE _Transport=0xa3;
BYTE _TimeOutMultiplier=0x01;
TuxEip V1.0
Internal_Error : An error in TuxEip itself (time out, unsupported data type ...)
PCCC_Error : error while accessing a PCCC base controller (PLC5, SLC500,MicroLogix 1100
...)
6/17
TuxEip V1.0
7/17
TuxEip V1.0
Illustration 2: TuxEip communication scheme
8/17
CIP_UDINT Session_Handle;
CIP_DINT
You can use this to your own usage
Sender_ContextL,Sender_Conte
xtH;
int timeout;
int References;
Not used
void *Data;
5.2 Connection
typedef struct Eip_Connection
Eip_Session *Session;
int References;
Not used
void *Data;
CIP_UINT
ConnectionSerialNumber;
CIP_UINT
OriginatorVendorID;
CIP_UDINT
OriginatorSerialNumber;
CIP_UDINT OT_ConnID;
CIP_INT packet;
Packet identifier
BYTE Path_size;
TuxEip V1.0
9/17
5.3 LGX_Read
typedef struct LGX_Read
LGX_Data_Type type;
Data type
(LGX_BOOL,LGX_BITARRAY,LGX_SINT,LGX_INT=,LG
X_DINT,LGX_REAL ...)
int Varcount;
int totalsize;
int elementsize;
5.4 PLC_Read
typedef struct PLC_Read
PLC_Data_Type type;
Data type
(PLC_BIT,PLC_BIT_STRING,PLC_BYTE_STRING,PLC
_INTEGER,PLC_TIMER,PLC_COUNTER,PLC_CONTR
OL,PLC_FLOATING,PLC_ARRAY,PLC_ADRESS,PLC_
BCD...)
int Varcount;
int totalsize;
int elementsize;
5.5 DHP_Header
typedef struct DHP_Header
CIP_UINT Dest_link1
CIP_UINT Dest_adress
CIP_UINT Src_link
CIP_UINT Src_adress
Address of the source node
1) This parameters are used when you need to access physically different s DH+ network (refers to
Rockwell documentation) and are not need by TuxEip.
TuxEip V1.0
10/17
A link address is a destination node ,if the corresponding port is a backplane then the link address is the
slot number,else it's a network address.
Interface Module
Port 1
Port 2
Port 3
1756- ENET/ENBT
Backplane
Ethernet network
N/A
1756-DHRIO
Backplane
1756-CNET
Backplane
ControlNet network
N/A
Note : When using TuxEip the first port is your Ethernet interface, so your path begin with the IP address of your
1756-ENET/ENBT card.
Micrologix
ControlLogix
ConnectPLCOverCNET
ConnectPLCOverCNET
FlexLogix
1. The Path must target the last 1756-DHRIO you use
Fill in fields with the right values
ConnectPLCOverDHP
session
ConnectPLCOverCNET
Plc
TO_ConnID
ConnSerialNumber
RPI
channel
path
pathsize
TuxEip V1.0
11/17
Processor
Function to use
PLC5
Rq
Plc type=PLC
ReadPLCData / WritePLCData1
SLC500
Micrologix
Plc type=SLC
Plc type=SLC
ReadPLCData / WritePLCData
ControlLogix
ReadLgxData / WriteLgxData
FlexLogix
1. In this case, you are not obliged to open a connection
ReadPLCData
Connected
WritePLCData
Unconnected
Connected
Unconnected
session
connection
dhp
routepath
NULL
routepathsize
Size of the
0
routepath (in bytes)
type
tns
Transaction number
address
datatype
NA
data
NA
number
NULL
WriteLGXData
session
connection
address
datatype
NA
data
NA
number
TuxEip V1.0
12/17
6.4 Example
Here is a sample factory network, we will use it to explain the connection path.
Illustration 4: example 1
IP of your 1756 ENET card
192.168.1.3
Backplane
L55 in slot 0
Path
192.168.1.3,1,0
Connection method
ConnectPLCOverCNET
ReadLgxData / WriteLgxData
TuxEip V1.0
13/17
Illustration 5: example 2
IP of your Micrologix controller
192.168.1.4
Backplane
Path 1
192.168.1.4,1,0
Connection method
ConnectPLCOverCNET
ReadPLCData / WritePLCData
Plc type
SLC
1 The whole Logix controllers are build using the same scheme, communications card are plug into a backplane
(sometime its a real one like ControlLogix's backplane, alternatively it is a virtual one like for Micrologix, FlexLogix)
TuxEip V1.0
14/17
Illustration 6: example 3
As we can see in chapter 4 "TuxEip communication scheme" there is two way to access PLC5 and
SLC500 logic controllers :
Connected way
192.168.1.5
Backplane
slot 1 (1756-CNET)
Path
192.168.1.5,1,1,2,3
Connection method
ConnectPLCOverCNET
ReadPLCData / WritePLCData
Plc type
PLC
Unconnected way
To Read / Write data, you will have to fill in the "routepath" and "routepathsize" (see section
6.3)
TuxEip V1.0
15/17
Illustration 7: example 4
IP of your 1756 ENET card
192.168.1.5
Backplane
slot 1 (1756-CNET)
Backplane
slot 3 (1756-DHRIO)
Path
192.168.1.5,1,1,2,2,1,3
Connection method
ReadPLCData / WritePLCData
Plc type
PLC
dhp
TuxEip V1.0
Dest_link
Dest_adress
Src_link
Src_adress
16/17
192.168.1.3
Backplane
slot 1 (1756-CNET)
Node 5 (1788-CNC)
Path
192.168.1.3,1,1,2,5,1,0
Connection method
ConnectPLCOverCNET
ReadLGXData / WriteLGXData
TuxEip V1.0
17/17