After opened a Class 3 connection, How to implement non-cyclic communication using this class 3 connection ?
Could you post some codes as example?
Hi all
I have a different perspective since i am constructing a Adapter, not a scanner. I am using the EIPDemo as a base and my problem is that I have registered a class 3 connection and succeeded in sending data from the scanner to my adapter, but I am not able to construct a response package.
My response package looks like this:
ptRespPck->tHead.ulSrc = (UINT32)0x10;
ptRespPck->tHead.ulSrcId = 0;
ptRespPck->tHead.ulDest = (UINT32)0x20;
ptRespPck->tHead.ulDestId = pvPck->tHead.ulSrcId;
//ptRespPck->tHead.ulSta = 0;
ptRespPck->tHead.ulCmd = EIP_OBJECT_CL3_SERVICE_RES;
ptRespPck->tHead.ulId = 1;
ptRespPck->tHead.ulExt = 0;
ptRespPck->tData.ulConnectionId = pvPck->tData.ulConnectionId;
ptRespPck->tData.ulService = pvPck->tData.ulService;
ptRespPck->tData.ulObject = pvPck->tData.ulObject;
ptRespPck->tData.ulInstance = pvPck->tData.ulInstance;
ptRespPck->tData.ulAttribute = pvPck->tData.ulAttribute;
//... GRCC, ERCC error handling NOT IMPLEMENTED
// ptRespPck->tData.abData[0] = 0xAA;
//Send response package back
TLR_QUE_SENDPACKET_FIFO_INTERN((TLR_HANDLE)ptRsc->tRem.hEipObjectQue , ptRespPck, TLR_INFINITE);
What am i doing wrong, it seems like I am crashing the class 3 connection and the emulator in Hitop generated an error if i put in a breakpoint.
Thx. in advance.
regards to all.
Hilscher Gesellschaft für Systemautomation mbH
Hi hc@jvl.dk,
It looks like you are not setting the packet length according to your length of data.
Could that be the problem?
Regards,
Kai
Hi Kai ,
I try to follow your guide by sending packet using sycon.net. packet from 192.168.0.200 to 192.168.0.210
communication is well ,and IO monitor can do IO data exchange.
Then , I send open connection req packet:

IPAddr:C0(192)A8(168)00(0)D2(210)
Time:0x00989680(10000000)
TimeoutMult: 0x00000004(4)
however, connection failed. could you tell me what's wrong with it ?
I have known the reason.
IPAddr:C0(192)A8(168)00(0)D2(210) should be d2 00 a8 c0 !
now, I have successfully gotten the connection's handle. thanks to your code.
However, when I send the "EIP_OBJECT_PACKET_CONNECT_MESSAGE_REQ" packet .
the sycon.net shows "packet 343: No answer Recieved by device in time ".
and in my adapter's sycon.net ,the packet moniter revieved nothing .
could you do me a favour ?
Hilscher Gesellschaft für Systemautomation mbH
Hi houzenan,
This is probably not a problem of the packet or its content.
It seems you used Sycon and another application in parallel. In this case it happens that a confirmation packet is picked up by the wrong application and the other application runs in a timeout with the error you described.
Just make sure you only use one application to send packets to the EtherNet/IP stack.
i just use sycon.net's packet monitor. first, open connection, second, before connection timeout, send message request.
I have found the problem .
sycon.net is "big-endians". an unsigned long 0x12345678 will be shown as "78 56 34 12" in sycon.net.
I send the wrong packet. What a stupid mistake ! :(
Then, I managed to run the code you give in VS2003, and your code works well ! :)
Thank you , Kai .
Hilscher Gesellschaft für Systemautomation mbH
sycon.net is "big-endians". an unsigned long 0x12345678 will be shown as "78 56 34 12" in sycon.net.
You are wrong on that one.
SYCON.NET is little-endian, which is proven by your sample.
On Little Endian a DWORD with the value 0x12345678 will be inserted into memory as 78 56 34 12
On Big Endian a DWORD of 0x12345678 will be placed as 12 34 56 78 in memory.
http://wiki.answers.com/Q/What_is_the_difference_between_big_endian_and_little_endian
Regards,
MT
Kai Michel
Hilscher Gesellschaft für Systemautomation mbH
Hi houzenan,
Here is some example code:
It's important to know that once the class 3 connection is opened (EIMPF_OpenCl3Connection), the class 3 messages (EIMPF_ConnectedCl3Request) need to be sent repeatedly with a maximum interval of the adjusted timeout, which is in this example set to 40 sec ( timeout multiplier is set to 4). Otherwise the connection will be closed automatically.
Hope this helps you. :-)
Kai