Ethernet communication Schneider PLC (LMC058LF42)

jagjag1

Member
Join Date
Jan 2012
Location
Codesys
Posts
17
I'm trying to connect my barcode scanner (leuze 508i) to my Schneider PLC LMC058LF42 via Ethernet/IP. I use SoMachine v3.1.10.1 to program the PLC.
I can send the code from the scanner to my computer both as server and client so the scanner is working fine. I know that the Ethernet port on the PLC can only act like a slave but I'm unsure where to define the port number in SomMachine. In the world of Siemens i should use a functionblock to start the communication and define the port. The only FB that i have found in SoMachine is Read_Var but it seems only to be used for modbus tcp.

I have another option to upgrade my HMI to a Magelis GTO panel and make the communication there instead.

I would really appreciate some help and maybe a example program if anyone have got.

Thanks in advance Daniel
 
When you say "Ethernet/IP", I interpret that to mean EtherNet/IP, which is the CIP protocol used with Ethernet and managed by ODVA. I know the LMC series will act as an EtherNet/IP adapter or slave for Class1 IO connections, so I went down this path.

I looked up the documentation for your scanner

http://www.wolfautomation.com/assets/15/BCL508.pdf
http://www.wolfautomation.com/assets/15/brochurebcl500i.pdf
(hooray for this vendor - it was easy to find with a simple google search!)

and cannot find where it supports EtherNet/IP at all: only Profinet or Ethernet & TCP/IP. Profinet is a fieldbus, as is EtherNet/IP, but my experience is that when a vendor says Ethernet & TCP/IP, as I see on this spec sheet, you need some type of raw socket interface on your automation products. The pdf does confirm that - either TCP or UDP, client or server.

So you would not use the EtherNet/IP feature of the LMC device to communicate with the barcode reader as you need a way to make raw sockets. Here is a case study from Schneider on using raw UDP sockets with this family of controllers.

Also you might want to look up SysLibSockets.lib for the Codesys platform (SoMachine is just re-badged Codesys 3 with their HMI software stuck on the side to add a little bloat), though this and the other networking libraries you may need might already be part of the install to add the communication function blocks for this configuration.
 
Thank you for your help. I followed you advise and came across and example of the codesys socket-communication. I can now connect my plc to the sever and send a string, but when i try to receive from the server my plc crashes and I need to cut the power in order to download again.

At the moment the program looks like this

PROGRAM POU
VAR
sa:sockaddress;
hSocket:UDINT;

SetIPAdress:STRING[14]:='192.168.60.1';
port:WORD:=999;
Result:UDINT;
NrOfBytes:DINT;
str:STRING:='hello server';
Str2:STRING;
END_VAR


//ClientProgram
sa.sin_family:=SOCKET_AF_INET;
sa.sin_port:=SysSockHtons(port);

result:=SysSockInetAddr(SetIPAdress, ADR(sa.sin_addr.ulAddr));

hSocket:=SysSockCreate(SOCKET_AF_INET, SOCKET_STREAM, SOCKET_IPPROTO_TCP, ADR(Result));



Result:=SysSockConnect(hSocket, ADR(sa), SIZEOF(sa));


NrOfBytes:=SysSockRecv(hSocket, ADR(str2), 50,0, ADR (Result));


NrOfBytes:=SysSocksend(hSocket, ADR(str), len(str)+1,0, ADR (Result));

//SysSockClose(hSocket);


The error I get is because of this line "NrOfBytes:=SysSockRecv(hSocket, ADR(str2), 50,0, ADR (Result));"

any thoughts?

Thanks
 

Similar Topics

Hi All, We are planning Establish communication between Power Energy Meter (Schneider PM5320) with Rockwell PLC. I am unable to get the Assembly...
Replies
4
Views
732
I want to establish communication communication between Schneider 140 NOC 771 01 and PowerFlex 755 over Ethernet/IP. If anybody have tried this...
Replies
1
Views
4,511
I'm retrofitting equipment, but I didn't want to change the electrical characteristics of the panel. In this equipment I have a dedicated...
Replies
0
Views
66
I have a contractor at my water plant installing 3 brand new Powerflex 7000 VFD's for my High Service pumps. I would like to control these via...
Replies
6
Views
991
Hi All ... In one full plant, all machines are connected to networks. above 500 ip address... that consists of plc,servo,hmi and third party...
Replies
3
Views
1,511
Back
Top Bottom