NothinRandom / CoDeSys_EIP

Communicate with EtherNet/IP devices using explicit messaging in CoDeSys!
MIT License
24 stars 7 forks source link

Trying to understand how this works at the low level #9

Closed TheColonel2688 closed 3 years ago

TheColonel2688 commented 4 years ago

So I am trying to understand how to do some basic Tag Read writes myself.

I'll probably end up using your library but I want to understand it first.

I downloaded the library soruce code project, but I can't find where you are actually sending the raw data to the remote device/adapter, or reciving it back. I see no function calls for that.

maybe I am not looking in the right place.

Futher we are activly discussing this on PLCTalk.com and dmroeder the PyLogix author is involved but I don't think he can help much on the codesys side.

http://www.plctalk.net/qanda/showthread.php?t=127087

Any information you can give would be greatly appreciated.

NothinRandom commented 3 years ago

@TheColonel2688,

All of the sending/receiving is done in the "main" function block (FB) called Device under CoDeSys_EIP/Function Blocks/Device, and we're communicating via TCP FBs. Anyway, high level goes like this...

  1. CoDeSys controller starts a TCP session with PLC/device 1.1. If connection is established, it sends a list identity command (0x63) to device to gather its attributes (model, make, serial number etc) 1.2. If not successful, it will retry within the specified interval from udiTcpClientRetry
  2. Next step is to register a session (0x65) with the device if it has been identified from 1.1
  3. Then forward open (0x54) can be established (optional)

In Device, the read and write FBs are called _TcpRead and _TcpWrite, respectively. To stitch this together, you will need to look at both the included literature (Examples/Rockwell/Literature/) and the structs (I referenced page number from literature) [CoDeSys_EIP/Structs/]. I hope this somewhat helps to get you started, but feel free to shoot me an email at my username at gmail, and we can do a deep dive session if this is still clear as mud.

NothinRandom commented 3 years ago

@TheColonel2688,

I take the silence as your inquiry has been answered. Closing; reopen if needed. If you're in the States, Happy Thanksgiving!

TheColonel2688 commented 3 years ago

Sorry, I actually haven't gotten back to this I got pull in another direct at the moment.

Thank you for your response though. I'll let you know if I have more questions :)